Load U-Boot from SD card on Espressobin v5



Recommended Posts

Hi everybody,


I have an Espressobin v5 in front of me and by default it boots fine from SATA:


WTMI: system early-init                                                                                                           
SVC REV: 3, CPU VDD voltage: 1.132V                                                                                               
Fill memory before self refresh...done                                                                                            
Now in Self-refresh Mode                                                                                                          
Restore termination values to original values                                                                                     
Exited self-refresh ...                                                                                                           
Self refresh Pass.                                                                                                                
DDR self test mode test done!!                                                                                                    
QS GATING                                                                                                                         
Calibration done: cycle = 0x00 tap =0x5B                                                                                          
CH0_PHY_RL_Control_CS0_B0[0xC0001180]: 0x0000005B                                                                                 
CH0_PHY_RL_Control_CS0_B1[0xC0001184]: 0x0000005B                                                                                 
DLL TUNING                                                                                                                        
   DLL 0xc0001050[21:16]: [0,2d,16]                                                                                               
   DLL 0xc0001050[29:24]: [0,2d,16]                                                                                               
   DLL 0xc0001054[21:16]: [0,26,13]                                                                                               
   DLL 0xc0001054[29:24]: [3,2e,18]                                                                                               
   DLL 0xc0001074[21:16]: [0,3f,1f]                                                                                               
   DLL 0xc0001074NOTICE:  Booting Trusted Firmware                                                                                
NOTICE:  BL1: v1.3(release):armada-17.10.3:39a62a1                                                                                
NOTICE:  BL1: Built : 11:19:53, Jun 19 2NOTICE:  BL2: v1.3(release):armada-17.10.3:39a62a1                                        
NOTICE:  BL2: Built : 11:19:54, Jun 19 2018NOTICE:  BL31: v1.3(release):armada-17.10.3:39a62a1                                    
NOTICE:  BL31:                                                                                                                    
U-Boot 2017.03-armada-17.10.2-g14aeedc (Jun 19 2018 - 11:18:51 +0800)                                                             
Model: Marvell Armada 3720 Community Board ESPRESSOBin                                                                            
       CPU    @ 1000 [MHz]                                                                                                        
       L2     @ 800 [MHz]                                                                                                         
       TClock @ 200 [MHz]                                                                                                         
       DDR    @ 800 [MHz]                                                                                                         
DRAM:  1 GiB                                                                                                                      
U-Boot DT blob at : 000000003f7161b8                                                                                              
Comphy-0: USB3          5 Gbps                                                                                                    
Comphy-1: PEX0          2.5 Gbps                                                                                                  
Comphy-2: SATA0         6 Gbps                                                                                                    
SATA link 0 timeout.                                                                                                              
AHCI 0001.0300 32 slots 1 ports 6 Gbps 0x1 impl SATA mode                                                                         
flags: ncq led only pmp fbss pio slum part sxs
PCIE-0: Link down
MMC:   sdhci@d0000: 0, sdhci@d8000: 1
SF: Detected w25q32dw with page size 256 Bytes, erase size 4 KiB, total 4 MiB
Net:   eth0: neta@30000 [PRIME]
Hit any key to stop autoboot:  0


Now I need it to load the bootloader (U-Boot) from SD card. However, I can't seem to get it working.


What I have tried so far:

1. Set the jumper on the board (J11,J3,J10) to "eMMC download mode" as well as "eMMC alternate download mode".

2. Get a SD card connected to my Linux host. Empty it with "dd if=/dev/zero of=/dev/sdg bs=1M count=100".

3. Then I tried to get the U-Boot on the SD card, but I am not exactly sure about the proper way. I tried two different things:

3.a. I just copied it raw onto the SD card with "dd if=/home/amue/Downloads/flash-image-ddr3-1g-2cs-1000_800.bin of=/dev/sdg".

3.b. I created an ext4 partition and then copied the U-Boot binary onto the partition.


I have no success with both of those tries. All I see when booting is a minimal console environment:


h/? - print this help screen
r yyyyyyyy - read register/memory at address yyyyyyyy in hex
w yyyyyyyy zzzzzzzz - write zzzzzzzz to address yyyyyyyy in hex
j yyyyyyyy - jump to address yyyyyyyy in hex
x y - change the boot mode, where y is in hex
a - UART control passed to AP CPU ROM
c - UART control passed to CM3 CPU ROM


As I said, I am not sure about the proper way for loading U-Boot from the SD card, since I can't seem to find the correct documentation for it. I would appreciate any help with this, as I am sure that quite a few people have already done this.


Best regards,


Link to post
Share on other sites

Armbian is a community driven open source project. Do you like to contribute your code?

The instructions say:

Copy this flash-image-ddr3/ddr4-MEM-RAM_CHIPS-CPU_DDR.bin to your FAT formatted USB key, plug it into USB3.0 port and execute from u-boot prompt:


bubt flash-image-ddr3/ddr4-MEM-RAM_CHIPS-CPU_DDR.bin spi usb


U-Boot gets flashed to the board, it doesn't need to get run each time from the boot media.

Link to post
Share on other sites

I assume that you want to start Linux from SD card instead of SATA, right? This is different from loading the board firmware form SD card instead of SPI flash. The firmware should be able to boot Linux from any device, no matter where the firmware is actually stored.  You may post the u-boot environment (the output of `printenv`) here. 

Link to post
Share on other sites

HI everybody,


thanks for the replies.


@ManoftheSea You assume that there is already U-Boot running on my board. I do not make this assumption. I want it to load the complete bootloader (U-Boot) from a SD card and run it, without any bootloader on the board itself.


@umiddelb No, I do not want to start Linux from SD card. I can start a Linux from anywhere, I know that. I want the board to load U-Boot from SD card. I did that with other projects,  but it does not seem possible with the espressobin v5. I think the hardware does not allow it unfortunately.


If I am wrong, please correct me.

Link to post
Share on other sites

I assume you have U-Boot running on your board, because you posted what appears to be the console output and it included:
"U-Boot 2017.03-armada-17.10.2-g14aeedc (Jun 19 2018 - 11:18:51 +0800)"

And also that the CPU was running at 1000 and the 1 gig of DDR at 800. 

I do not understand why you want to "load" the bootloader, and whether you are distinguishing that from "flashing" the bootloader.  You are required to have a bootloader on the board itself.


The USB flashing directions indicate a FAT-formatted USB drive.  You mentioned an unformatted raw SD, and an EXT4 formatted SD, which are both wrong.  I would suggest you try a FAT-formatted SD card, and put the flash-image-ddr3-MEM-RAM_CHIPS-CPU_DDR.bin in the FAT-formatted partition.  Then, your flash command is bubt flash-image.bin spi mmc



Link to post
Share on other sites

@ManoftheSea Again, thanks for the reply. I am sorry for being unclear. The console output I included in my first post, was meant as an example for when I am booting from NOR flash. I just wanted to show that it is working fine when booting from NOR flash.


I do not think that it is necessary to have a bootloader on the board itself. Check the UART recovery, I think it is similar there. The board will download the bootloader via UART, copy it into RAM and run it from there. I want to do the same thing, but download it from SD card.


Where can I read about this FAT-formatted USB drive? When looking here or here, it is always formatted with EXT4.

Edited by Shirohige
Corrected a mistake. I accidently wrote "flash" instead if "RAM".
Link to post
Share on other sites

@Shirohige I see, you are correct the U-Boot can be loaded from alternate locations.  I learned something.


Your links, however, are describing loading Linux from U-Boot, and are not applicable to loading U-Boot itself.



This link tells me that a v5 board is unable to load U-Boot from SD card, while a v7 can.  It appears neither version can do so from USB.



Link to post
Share on other sites

@ManoftheSea Yes, as mentioned in my previous post, I came to the same conclusion. It seems that v5 cannot do it, but v7 can. I have already bought the v7 and now I am trying to get it to download the bootloader from from SD card. So far no luck.


Also you are correct, my links are not applicable to the problem. However, I have no better links. I am unable to find any link with a description of how to download the bootoader from SD card, be it with espressobin v5 or with v7.


The depictions and tables from the link you posted (http://wiki.espressobin.net/tiki-index.php?page=Ports+and+Interfaces#Boot_selection) also seems to be weird. If you look at the table for v7, all the boot modes (other than NOR)  seem to have the same jumper setting. This cannot be correct. Also the order of jumpers for v7 is wrong in the table. The order on the real board is J3, J11, J10, which is quite irritating when using the table to check your settings. This goes further, the depictions and tables for the v5 are flat out wrong. The table says that "NOR boot" is J11=1, J3=0, J10=0, but to get it to boot from NOR flash I actually have to sett it to J11=0, J3=0, J10=1. This sucks and took some time to figure out.


Long story short: I cannot find any source with a description of how to download the bootloader from SD card with espressobin v7. Maybe I should open a new thread for that.




Link to post
Share on other sites

Wow, that table is a pain and a half to read!  The image of the v7 and its description agree, but don't match the order of jumpers in the table.  On the other hand, the image of the v5 and its jumpers disagree on which jumper is which, but one of them matches the table.
Can you clarify which labeling you're using, and which direction of jumper you're calling "1" or "0"?  This link would have me believe that the jumper next to the SATA connecter is toward the edge of the board, while the other two are toward the center - [J11, J3, J10] = [0, 1, 1] to boot from SATA if oriented with the printed labels, and [1, 1, 0] to boot from NOR. ,
And that "boot from SATA" link has the jumper settings in the 10, 3, 11 orientation, as opposed to the 11, 3, 10 orientation given in the big table of boot modes.  How absolutely horrid!


In Summary: The ports and interfaces page needs:

- Reorganize the v7 table columns to match the order of the jumpers on the v7 board, either 10,11,3 or 3,11,10, but we don't know whether the columns are correct

- Fix the callout on the v5 image to J10, J3, J11

- Reverse the labels on the v5 table columns so it's J10, J3, J11, but don't move the columns.

Link to post
Share on other sites

13 hours ago, Shirohige said:

@umiddelb No, I do not want to start Linux from SD card. I can start a Linux from anywhere, I know that. I want the board to load U-Boot from SD card. I did that with other projects,  but it does not seem possible with the espressobin v5. I think the hardware does not allow it unfortunately.

Hm,  there are two ways to do that:

  1. You can try to chainload the u-boot binary from SD card with the help of the SPI u-boot.
  2. The SPL may check the presence of a SD card and try to load the u-boot binary from there instead of SPI flash. 

The first option requires some u-boot script hacking but should work with the existing firmware while the second option needs a modified SPL. 

Link to post
Share on other sites

@ManoftheSea Indeed it is and I am not sure why it was published in that state. I am calling the jumper setting "1-2" 1 and the jumper setting "2-3" 0. This is because I measured the jumpers with the multimeter and could measure a signal when setting the jumpers to 1-2. The labeling I am using is exactly inverted to the one from the table. 1, 0, 0 (meaning J11=1-2, J3=2-3, J10=2-3) for serial NOR, I actually will set them to 0,0,1 (meaning J11=2-3, J3=2-3, J10=1-2). As if exchanging J11 with J10. I tested it with booting from NOR and booting from UART.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.