Post Go back to editing

First-time programing of U-Boot on SPI Flash with a command line utility

Category: Software
Product Number: ADSP SC584 Ez-Board

Our end goal is to have U-Boot on our boards and that in-turn will load our non-Linux images on the rest of the cores.

To start with, I'm experimenting with the EZ-Board. My setup is this:

  • ADZS-SC584 EZ-BOARD 1.4, BOM REV 2.4, with all jumpers and switches to the default position
  • ICE-1000
  • Windows 10
  • CCES 2.9.4

I'm using ADI's U-Boot, lnxdsp-u-boot and more specifically 09225f2bf4e9466c8bdd055af96370912f75c9b5 commit id.

I've built U-Boot for the board in a Ubuntu 20.04 box (WSL2):

$ make sc584-ezkit_defconfig
$ CROSS_COMPILE=/opt/analog/cces/2.9.4/ARM/arm-none-eabi/bin/arm-none-eabi- make

I then transferred the generated files to my Windows so that I can proceed with programming U-Boot on SPI flash.

I've followed the "Installing U-boot" guide, and I was successful in "Flash U-Boot for the First Time" section. I managed to get the U-Boot run on the board.

However, we really want to make the procedure shorter and program Das U-Boot directly on Flash via OpenOCD or any other command line tool.

I've tried with OpenOCD but I failed:

$ /c/Analog\ Devices/CrossCore\ Embedded\ Studio\ 2.9.4/ARM/openocd/bin/openocd.exe -s /c/Analog\ Devices/CrossCore\ Embedded\ Studio\ 2.9.4/ARM/openocd/share/openocd/scripts/ -f interface/ice1000.cfg -f board/adspsc584_ezbrd.cfg -c "program ../u-boot-builds/u-boot-sc584-ezkit verify reset exit"

Open On-Chip Debugger (Analog Devices CCES 2.9.0 OpenOCD 0.9.0-ga44a178) 0.9.0
Licensed under GNU GPL v2
Report bugs to <processor.tools.support@analog.com>
adapter speed: 1000 kHz
Info : transports supported by the debug adapter: "jtag", "swd"
Info : auto-select transport "jtag"
trst_only separate trst_push_pull
adspsc58x_init
Info : ICE-1000 firmware version is 1.0.2
Info : clock speed 1000 kHz
Info : JTAG tap: adspsc584.adjc tap/device found: 0x228080cb (mfg: 0x065, part: 0x2808, ver: 0x2)    
Info : JTAG tap: adspsc584.dap enabled
Info : adspsc584.dap: hardware has 3 breakpoints, 2 watchpoints
Info : adspsc584.dap: but you can only set 1 watchpoint
Info : ttbcr 0ttbr0 0ttbr1 0
Info : adspsc584.dap rev 1, partnum c05, arch f, variant 0, implementor 41
Info : number of cache level 1
Info : adspsc584.dap cluster 0 core 0 mono core
Info : JTAG tap: adspsc584.adjc tap/device found: 0x228080cb (mfg: 0x065, part: 0x2808, ver: 0x2)
Info : JTAG tap: adspsc584.dap enabled
Info : adspsc584.dap: hardware has 3 breakpoints, 2 watchpoints
Info : adspsc584.dap: but you can only set 1 watchpoint
Boot Mode 1
start system reset ...
system reset asserted
background polling: off
TAP: adspsc584.dap (enabled)
target state: running
target state: halted
target halted in Thumb state due to debug-request, current mode: Supervisor
cpsr: 0x800001f3 pc: 0x00004884
MMU: disabled, D-Cache: disabled, I-Cache: disabled
system reset done
REG_RCU0_STAT  0x00002128
HWRST          : 0 (0x00)
SSRST          : 0 (0x00)
SWRST          : 1 (0x01) SWRST
RSTOUT         : 1 (0x01) RSTOUT
BMODE          : 1 (0x01)
TESTMODE       : 0 (0x00)
STESTMODE      : 1 (0x01) STESTMODE
OTPLOCK        : 0 (0x00)
STESTROUTINE   : 0 (0x00) 
ADDRERR        : 0 (0x00)
LWERR          : 0 (0x00)
RSTOUTERR      : 0 (0x00)
REG_RCU0_MSG  0x00460600
BOOTERROR      : 0 (0x000)
C0IDLE         : 0 (0x00)
C1IDLE         : 1 (0x01) Core 1 is IDLE
C2IDLE         : 1 (0x01) Core 2 is IDLE
C0TASK         : 0 (0x00)
C1TASK         : 0 (0x00)
C2TASK         : 0 (0x00)
C0L1INIT       : 0 (0x00) 
C1L1INIT       : 1 (0x01) Core 1 L1 initialized
C2L1INIT       : 1 (0x01) Core 2 L1 initialized
L2INIT         : 1 (0x01) L2 initialized
HALTONAPP      : 0 (0x00)
HALTONINIT     : 0 (0x00)
HALTONCALL     : 0 (0x00)
HALTONERR      : 0 (0x00)
CALLAPP        : 0 (0x00)
CALLINIT       : 0 (0x00)
CALLBACK       : 0 (0x00)
CALLERR        : 0 (0x00)
target state: halted
target halted in Thumb state due to debug-request, current mode: Supervisor
cpsr: 0x800001f3 pc: 0x00004884
MMU: disabled, D-Cache: disabled, I-Cache: disabled
** Programming Started **
** Programming Failed **
shutdown command invoked
embedded:startup.tcl:490: Error:
in procedure 'flash' called at file "embedded:startup.tcl", line 490

I've tried with CLDP but I failed again:

$ /c/Analog\ Devices/CrossCore\ Embedded\ Studio\ 2.9.4/cldp -proc ADSP-SC584 -core 0 -emu 1000 -driver /c/Analog\ Devices/ADSP-SC5xx_EZ-KIT_Lite-Rel2.0.2/ADSP-SC5xx_EZ-KIT/Examples/Device_Programmer/sc584/sharc/sc584_w25q128fv_dpia_Core0/w25q128fv_dpia_SC584_SHARC_Core0 -cmd prog -erase affected -format bin -file ../u-boot-builds/u-boot-sc584-ezkit.ldr

Target          Emulation Debug Target
Platform        ADSP-SC584 via ICE-1000
Processor       ADSP-SC584
Core            0
Driver          C:/Analog Devices/ADSP-SC5xx_EZ-KIT_Lite-Rel2.0.2/ADSP-SC5xx_EZ-KIT/Examples/Device_Programmer/sc584/sharc/sc584_w25q128fv_dpia_Core0/w25q128fv_dpia_SC584_SHARC_Core0
Error: [TpsdkServer] Failed to load file: C:/Analog Devices/ADSP-SC5xx_EZ-KIT_Lite-Rel2.0.2/ADSP-SC5xx_EZ-KIT/Examples/Device_Programmer/sc584/sharc/sc584_w25q128fv_dpia_Core0/w25q128fv_dpia_SC584_SHARC_Core0 [Error: Failed to connect to target., Code=0x80047344]

Do you have any ideas on why I cannot program U-Boot directly on SPI Flash with any of the above tools?

Parents Reply Children
  • Do the network cable is connected? And tftp server is up and running?
    Have you followed this quick start guide before? https://github.com/analogdevicesinc/lnxdsp-adi-meta/wiki/Getting-Started-with-ADSP%E2%80%90SC584-(Linux-for-ADSP%E2%80%90SC5xx-Processors-3.1.1) here will be the steps to flash u-boot to SPI 

    By running update_spi I want to verify that u-boot image that is used can boot board and its ok.  

  • I didn't have a TFTP server up and running for those tests.

    One more issue I was facing was the setting of proper network connection between the eval board and my PC. ping wasn't working.

    Give me a while to try the steps of the guide you've shared with me - I didn't know about it.

  • So, I set up TFTP in a laptop and tried the same command. According to the output I got and the docs you've shared with me, I need stage1-boot.ldr and stage2-boot.ldr.

    My build of U-Boot didn't generate those. How do I generate them? Can I change the update_spi command in a way to choose different files?

  • Hi do you compile u-boot outside of yocto? Those files should be generated by one of the yocto steps and generated by ldr utility. 
    Those are u-boot-spl and u-boot-proper converted to LDR file format. 

  • On your previous screenshots I can see ldr files are generated you can use those, and rename those
    u-boot-spl-sc594-ezkit.ldr is stage1.ldr
    u-boot-sc594-ezkit.ldr is stage2.ldr 

  • Hi Arturs,

    Sorry, I missed the notifications.

    I'm building U-Boot outside of yocto - I've cloned https://github.com/analogdevicesinc/lnxdsp-u-boot and I'm compiling this directly as our goal is to use U-Boot without Linux.

    I'll retry at the end of the day.

  • Hi Arturs,

    I have issues establishing a network connection between my PC and the EZBOARD. I've followed the instructions of the guide you've shared step by step, but pings do not reach either destination. I don't use DHCP on my PC so I have this configuration:

    PC address: 169.254.99.90/16
    EZBoard ipaddr: 169.254.99.95
    EZBoard tftpserverip: 169.254.99.90

    When I ping from EZBoard:

    When I ping from my PC:

    and I see red LED20 blinking everytime a ping is sent on the EZBoard.

    Packets are flowing from my PC to EZBoard, but they aren't accepted.

    I tried setting `gatewayip` to 169.254.99.80 and `netmask` to 255.255.0.0 on U-Boot but noting changed. Is that the correct way to set the IP settings for the network interface?

    Here's my U-Boot environment:

    => printenv
    addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off
    argscmd=spiargs
    autoload=no
    baudrate=115200
    bootcmd=run spiboot
    bootdelay=10
    dtbaddr=0x8b000000
    dtbfile=sc584-ezkit.dtb
    erase_spi=setenv sfdev 2:1; setenv sfsize 0x1000000; sf probe ${sfdev}; sf erase 0 ${sfsize};
    ethact=eth0
    ethaddr=02:80:ad:20:31:e8
    fdt_high=0xFFFFFFFF
    fdtcontroladdr=892545e0
    gatewayip=169.254.99.80
    imagefile=fitImage
    init_ethernet=mii info; setenv serverip ${tftpserverip};
    initramaddr=0x8C000000
    initramfile=adsp-sc5xx-ramdisk-adsp-sc584-ezkit.cpio.xz.u-boot
    initrd_high=0xFFFFFFFF
    ipaddr=169.254.99.95
    jffs2file=adsp-sc5xx-tiny-adsp-sc584-ezkit.jffs2
    loadaddr=0x89300000
    netmask=255.255.0.0
    nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:/romfs,tcp,nfsvers=3 earlyprintk=serial,uart0,115200 console=ttySC0,115200 vmalloc=512M
    nfsboot=run init_ethernet; tftp ${loadaddr} ${tftp_dir_prefix}${imagefile};run nfsargs;run addip;bootm ${loadaddr};
    ramargs=setenv bootargs earlyprintk=serial,uart0,115200 console=ttySC0,115200 vmalloc=512M
    ramboot=run init_ethernet; tftp ${loadaddr} ${tftp_dir_prefix}${imagefile}; run ramargs; bootm ${loadaddr};
    serverip=169.254.99.90
    sfdev=2:1
    sfsize=0x1000000
    spi_boot=run spiargs; sf probe ${sfdev};sf read ${loadaddr} 0xE0000 ${imagesize}; bootm ${loadaddr};
    spiargs=setenv bootargs root=/dev/mtdblock4 rw rootfstype=jffs2 earlyprintk=serial,uart0,115200 console=ttySC0,115200 vmalloc=512M
    spiboot=run spi_boot
    stage1file=stage1-boot.ldr
    stage2file=stage2-boot.ldr
    start_update_spi=run init_ethernet; sf probe ${sfdev}; run update_spi_uboot; run update_spi_fit; run update_spi_rfs; sleep 3; saveenv
    start_update_spi_uboot_only=run init_ethernet; sf probe ${sfdev}; run update_spi_uboot; sleep 3; saveenv
    stderr=serial@0x31003000
    stdin=serial@0x31003000
    stdout=serial@0x31003000
    tftpserverip=169.254.99.90
    ubootfile=u-boot-sc584-ezkit.ldr
    update_spi=setenv sfdev 2:1; setenv sfsize 0x1000000; setenv bootcmd 'run spiboot'; setenv argscmd spiargs; run start_update_spi;
    update_spi_fit=tftp ${loadaddr} ${tftp_dir_prefix}${imagefile}; sf probe ${sfdev}; sf update ${loadaddr} 0xE0000 ${filesize}; setenv imagesize ${filesize};
    update_spi_image=tftp ${loadaddr} ${tftp_dir_prefix}${imagefile}; sf probe ${sfdev}; sf update ${loadaddr} 0xE0000 ${filesize}; setenv imagesize ${filesize};
    update_spi_rfs=tftp ${loadaddr} ${tftp_dir_prefix}${jffs2file}; sf probe ${sfdev}; sf update ${loadaddr} 0x6E0000 ${filesize};
    update_spi_uboot=run update_spi_uboot_stage1; run update_spi_uboot_stage2;
    update_spi_uboot_only=setenv sfdev 2:1; run start_update_spi_uboot_only;
    update_spi_uboot_stage1=tftp ${loadaddr} ${tftp_dir_prefix}${stage1file}; sf probe ${sfdev}; sf update ${loadaddr} 0x0 ${filesize};
    update_spi_uboot_stage2=tftp ${loadaddr} ${tftp_dir_prefix}${stage2file}; sf probe ${sfdev}; sf update ${loadaddr} 0x20000 ${filesize};
    Environment size: 2904/16380 bytes
  • Can you get some other machine with ethernet port and for testing purpose establish same connection between those and test ping? LED blinking suggests that the packets are sent.

    I see your netmask is set to 255.255.0.0 default value usually is 255.255.255.0 

  • As a reminder, I'm using u-boot version of: https://github.com/analogdevicesinc/lnxdsp-u-boot/commit/09225f2bf4e9466c8bdd055af96370912f75c9b5

    and I've changed to an ADSP-SC573 EZKIT which has board revision of 1.9.

    Also I'm following this guide: github.com/.../Getting-Started-with-ADSP‐SC573-(Linux-for-ADSP‐SC5xx-Processors-3.1.1)

    I got a bit further:

    stage1-boot.ldr and stage2-boot.ldr have the same size as they are identical.

    Also, I see at the end of the transfers that 0 bytes are written and everything else is skipped.

    I powered-off the device, disconnected the ICE-1000, switched to BOOT mode 1 and after power on all I got in the serial was a bootloop:

     

    Then I tried everything from the start but with `run spi_boot` as instructed in a previous reply:

    It's weird that after the first two boot images have been transferred successfully (pink ticks in the image), no bytes are written to the SPI (red crosses), but later one for the other two uninteresting images (pink crosses), I see that bytes are written in the flash (pink questionmarks).

    I restarted the devices and all I got was again a boot loop:

    Any ideas?

    Cheers Ioannis 

  • Hi so from logs I see stage1 and stage2 are the same size, stage1 should be <100kb in size.
    What the content of your tftp server directory? Do all files that failed to download are in same directory as stage1.ldr and stage2.ldr files?