This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] How to flash u-boot to GPMC-NAND with USB-DFU on AM62x

Part Number: AM625
Other Parts Discussed in Thread: SK-AM62-LP

Tool/software:

AM62x boot ROM supports booting from parallel GPMC NAND.
From "5.4.9.1 GPMC NAND Bootloader Operation" in AM62x TRM
"GPMC NAND boot only supports boot from ONFI 1.0 compatible 8 bit parallel NAND memory up to 2Gbytes in size connected
to GPMC CS0 with the following geometries:
• 2Kbyte page and spare area of at least 64 bytes or
• 4Kbyte page size and spare area of at least 128 bytes.
• Non-ECC part only:
– ROM uses ELM to handle ECC
– ECC is BCH8 using D[7:0] for data
– The param page CRC is checked and in case of failure the redundant page is used"

Please refer to AM62x TRM "Chapter 5 Initialization" for details on GPMC NAND support by boot rom.

The FAQ lists how to flash u-boot to GPMC-NAND with USB-DFU on SK-AM62-LP board [1} and [2] with AM62x Linux SDK 10.0.7.4 [3]
[1]. SK-AM62-LP board (https://www.ti.com/tool/SK-AM62-LP)
[2]. TI internal NAND card (PROC143E1)
[3]. https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-AM62X/10.00.07.04

There're other options to flash u-boot to GPMC-NAND as listed below
https://e2e.ti.com/support/processors-group/processors/f/791/t/1402705
https://e2e.ti.com/support/processors-group/processors/f/791/t/1422565

  • (1). Build u-boot to boot from USB-DFU
    a/. make the following change in Rules.make under the top level of the Linux SDK Installer

    - UBOOT_MACHINE_R5=am62x_lpsk_r5_defconfig
    + UBOOT_MACHINE_R5=am62x_lpsk_r5_defconfig am62x_r5_usbdfu.config

    b/. build u-boot using the top-level makefile by running the cmd from the top-level of the Linux SDK installer.
    make u-boot PLATFORM=am62xx-lp-evm

    (2). Build u-boot to boot from GPMC-NAND
    a/. make the following change in Rules.make under the top level of the Linux SDK Installer.

    - UBOOT_MACHINE_R5=am62x_lpsk_r5_defconfig
    + UBOOT_MACHINE_R5=am62x_lpsk_r5_gpmc_defconfig

    b/. build u-boot using the top-level makefile by running the cmd from the top-level of the Linux SDK installer.
    make u-boot PLATFORM=am62xx-lp-evm

    (3). Boot the u-boot built in (1) to boot from USB-DFU
    - configure BOOTMODE[15:0] = 045B => GPMC-NAND (primary) + USB-DFU (backup)
    - power on the board
    - issue the cmds from Linux host (dfu-util installed) with the u-boot binary built from (1)

    sudo dfu-util -l
    sudo dfu-util -R -a bootloader -D tiboot3-am62x-hs-fs-evm.bin
    sudo dfu-util -R -a tispl.bin -D tispl.bin
    sudo dfu-util -R -a u-boot.img -D u-boot.img

    - stop @u-boot prompt, and run the cmds to configure GPMC-NAND flashing next in (4)
    => setenv dfu_alt_info "tiboot3.bin raw 0x0 0x200000; tispl.bin raw 0x200000 0x400000; u-boot.img raw 0x600000 0xA00000"
    => dfu 0 mtd nand0

    (4). Flash the u-boot built in (2) to GPMC-NAND
    - issue the cmds from Linux host (dfu-util installed) with the u-boot binary built from (2)

    sudo dfu-util -l
    sudo dfu-util -a 0 -D tiboot3-am62x-hs-fs-evm.bin
    sudo dfu-util -a 1 -D tispl.bin
    sudo dfu-util -a 2 -D u-boot.img

    The three logs are attached for reference
    - am62-lpsk_gpmc-nand_dfu_host.log: the linux host log from USB-DFU gpmc-nand flashing
    - am62-lpsk_gpmc-nand_dfu_target.log: the u-boot target log from USB-DFU gpmc-nand flashing
    - am62-lpsk_gpmc-nand_boot.log: the u-boot log from gpmc-nand booting

    am62-lpsk_gpmc-nand_dfu_host.log
    jason@laptop:~/test/SDK_debug/dfu/am62x-lpsk$ sudo dfu-util -l
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    Found DFU: [0451:6165] ver=0200, devnum=44, cfg=1, intf=0, path="1-4", alt=1, name="SocId", serial="01.00.00.00"
    Found DFU: [0451:6165] ver=0200, devnum=44, cfg=1, intf=0, path="1-4", alt=0, name="bootloader", serial="01.00.00.00"
    jason@laptop:~/test/SDK_debug/dfu/am62x-lpsk$ sudo dfu-util -R -a bootloader -D tiboot3-am62x-hs-fs-evm.bin
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    dfu-util: Invalid DFU suffix signature
    dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
    Opening DFU capable USB device...
    ID 0451:6165
    Run-time device DFU version 0110
    Claiming USB DFU Interface...
    Setting Alternate Setting #0 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 0110
    Device returned transfer size 512
    Copying data from PC to DFU device
    Download	[=========================] 100%       310014 bytes
    Download done.
    state(6) = dfuMANIFEST-SYNC, status(0) = No error condition is present
    dfu-util: unable to read DFU status after completion
    dfu-util: can't detach
    Resetting USB to switch back to runtime mode
    jason@laptop:~/test/SDK_debug/dfu/am62x-lpsk$ sudo dfu-util -R -a tispl.bin -D tispl.bin
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    dfu-util: Invalid DFU suffix signature
    dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
    Opening DFU capable USB device...
    ID 0451:6165
    Run-time device DFU version 0110
    Claiming USB DFU Interface...
    Setting Alternate Setting #0 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 0110
    Device returned transfer size 4096
    Copying data from PC to DFU device
    Download	[=========================] 100%      1207347 bytes
    Download done.
    state(7) = dfuMANIFEST, status(0) = No error condition is present
    state(2) = dfuIDLE, status(0) = No error condition is present
    Done!
    Resetting USB to switch back to runtime mode
    jason@laptop:~/test/SDK_debug/dfu/am62x-lpsk$ sudo dfu-util -R  -a u-boot.img -D u-boot.img
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    dfu-util: Invalid DFU suffix signature
    dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
    Opening DFU capable USB device...
    ID 0451:6165
    Run-time device DFU version 0110
    Claiming USB DFU Interface...
    Setting Alternate Setting #1 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 0110
    Device returned transfer size 4096
    Copying data from PC to DFU device
    Download	[=========================] 100%      1292787 bytes
    Download done.
    state(7) = dfuMANIFEST, status(0) = No error condition is present
    state(2) = dfuIDLE, status(0) = No error condition is present
    Done!
    Resetting USB to switch back to runtime mode
    jason@laptop:~/test/SDK_debug/dfu/am62x-lpsk$ sudo dfu-util -l
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    Found DFU: [0451:6165] ver=0223, devnum=47, cfg=1, intf=0, path="1-4", alt=2, name="u-boot.img", serial="0000000000000296"
    Found DFU: [0451:6165] ver=0223, devnum=47, cfg=1, intf=0, path="1-4", alt=1, name="tispl.bin", serial="0000000000000296"
    Found DFU: [0451:6165] ver=0223, devnum=47, cfg=1, intf=0, path="1-4", alt=0, name="tiboot3.bin", serial="0000000000000296"
    jason@laptop:~/test/SDK_debug/dfu/am62x-lpsk$ cd gpmc-nand
    jason@laptop:~/test/SDK_debug/dfu/am62x-lpsk/gpmc-nand$ ls -lrt
    total 3408
    -rw-rw-r-- 1 jason jason  324358 Aug 16 15:52 tiboot3-am62x-hs-evm.bin
    -rw-rw-r-- 1 jason jason  324358 Aug 16 15:52 tiboot3-am62x-hs-fs-evm.bin
    -rw-rw-r-- 1 jason jason  321769 Aug 16 15:52 tiboot3-am62x-gp-evm.bin
    -rw-rw-r-- 1 jason jason 1209299 Aug 16 15:52 tispl.bin
    -rw-rw-r-- 1 jason jason 1295139 Aug 16 15:52 u-boot.img
    lrwxrwxrwx 1 jason jason      29 Jan  8 16:01 tiboot3-gpmc.bin -> ./tiboot3-am62x-hs-fs-evm.bin
    jason@laptop:~/test/SDK_debug/dfu/am62x-lpsk/gpmc-nand$ sudo dfu-util -a 0 -D tiboot3-am62x-hs-fs-evm.bin
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    dfu-util: Invalid DFU suffix signature
    dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
    Opening DFU capable USB device...
    ID 0451:6165
    Run-time device DFU version 0110
    Claiming USB DFU Interface...
    Setting Alternate Setting #0 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 0110
    Device returned transfer size 4096
    Copying data from PC to DFU device
    Download	[=========================] 100%       324358 bytes
    Download done.
    state(7) = dfuMANIFEST, status(0) = No error condition is present
    state(2) = dfuIDLE, status(0) = No error condition is present
    Done!
    jason@laptop:~/test/SDK_debug/dfu/am62x-lpsk/gpmc-nand$ sudo dfu-util -a 1 -D tispl.bin
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    dfu-util: Invalid DFU suffix signature
    dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
    Opening DFU capable USB device...
    ID 0451:6165
    Run-time device DFU version 0110
    Claiming USB DFU Interface...
    Setting Alternate Setting #1 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 0110
    Device returned transfer size 4096
    Copying data from PC to DFU device
    Download	[=========================] 100%      1209299 bytes
    Download done.
    state(7) = dfuMANIFEST, status(0) = No error condition is present
    state(2) = dfuIDLE, status(0) = No error condition is present
    Done!
    jason@laptop:~/test/SDK_debug/dfu/am62x-lpsk/gpmc-nand$ sudo dfu-util -a 2 -D u-boot.img
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    dfu-util: Invalid DFU suffix signature
    dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
    Opening DFU capable USB device...
    ID 0451:6165
    Run-time device DFU version 0110
    Claiming USB DFU Interface...
    Setting Alternate Setting #2 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 0110
    Device returned transfer size 4096
    Copying data from PC to DFU device
    Download	[=========================] 100%      1295139 bytes
    Download done.
    state(7) = dfuMANIFEST, status(0) = No error condition is present
    state(2) = dfuIDLE, status(0) = No error condition is present
    Done!
    jason@laptop:~/test/SDK_debug/dfu/am62x-lpsk/gpmc-nand$
    

    am62-lpsk_gpmc-nand_dfu_target.log
    U-Boot SPL 2024.04-dirty (Jan 08 2025 - 15:29:16 -0600)
    SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)')
    SPL initial stack usage: 13392 bytes
    Trying to boot from DFU
    ###########################################################DOWNLOAD ... OK
    Ctrl+C to exit ...
    Authentication passed
    Authentication passed
    Authentication passed
    Loading Environment from nowhere... OK
    init_env from device 10 not supported!
    Authentication passed
    Authentication passed
    Starting ATF on ARM64 core...
    
    NOTICE:  BL31: v2.10.0(release):v2.10.0-367-g00f1ec6b87-dirty
    NOTICE:  BL31: Built : 16:09:05, Feb  9 2024
    
    U-Boot SPL 2024.04-dirty (Jan 08 2025 - 15:29:47 -0600)
    SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)')
    SPL initial stack usage: 1904 bytes
    Trying to boot from DFU
    #####DOWNLOAD ... OK
    Ctrl+C to exit ...
    Authentication passed
    Authentication passed
    
    
    U-Boot 2024.04-dirty (Jan 08 2025 - 15:29:47 -0600)
    
    SoC:   AM62X SR1.0 HS-FS
    Model: Texas Instruments AM62x LP SK
    EEPROM not available at 0x50, trying to read at 0x51
    Board: AM62-LP-SKEVM rev E2
    DRAM:  2 GiB
    Core:  83 devices, 32 uclasses, devicetree: separate
    NAND:  1024 MiB
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    Loading Environment from nowhere... OK
    In:    serial
    Out:   serial
    Err:   serial
    Net:   eth0: ethernet@8000000port@1
    Hit any key to stop autoboot:  2  0 
    => md.w 0x43000030 1
    43000030: 045b                                     [.
    => setenv dfu_alt_info "tiboot3.bin raw 0x0 0x200000; tispl.bin raw 0x200000 0x400000; u-boot.img raw 0x600000 0xA00000"
    => pri dfu_alt_info
    dfu_alt_info=tiboot3.bin raw 0x0 0x200000; tispl.bin raw 0x200000 0x400000; u-boot.img raw 0x600000 0xA00000
    => dfu 0 mtd nand0
    generic_phy_get_bulk : no phys property
    ##DOWNLOAD ... OK
    Ctrl+C to exit ...
    #####DOWNLOAD ... OK
    Ctrl+C to exit ...
    #####DOWNLOAD ... OK
    Ctrl+C to exit ...

    am62-lpsk_gpmc-nand_boot.log
    U-Boot SPL 2024.04-dirty (Aug 16 2024 - 15:51:36 -0500)
    SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)')
    SPL initial stack usage: 13392 bytes
    Trying to boot from NAND
    Authentication passed
    Authentication passed
    Authentication passed
    Loading Environment from nowhere... OK
    init_env from device 11 not supported!
    Authentication passed
    Authentication passed
    Starting ATF on ARM64 core...
    
    NOTICE:  BL31: v2.10.0(release):v2.10.0-367-g00f1ec6b87-dirty
    NOTICE:  BL31: Built : 16:09:05, Feb  9 2024
    
    U-Boot SPL 2024.04-ti-gfda88f8bcea3 (Jul 26 2024 - 11:00:12 +0000)
    SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)')
    SPL initial stack usage: 1904 bytes
    Trying to boot from NAND
    Authentication passed
    Authentication passed
    
    
    U-Boot 2024.04-ti-gfda88f8bcea3 (Jul 26 2024 - 11:00:12 +0000)
    
    SoC:   AM62X SR1.0 HS-FS
    Model: Texas Instruments AM62x LP SK
    EEPROM not available at 0x50, trying to read at 0x51
    Board: AM62-LP-SKEVM rev E2
    DRAM:  2 GiB
    Core:  83 devices, 32 uclasses, devicetree: separate
    NAND:  1024 MiB
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    Loading Environment from nowhere... OK
    In:    serial
    Out:   serial
    Err:   serial
    Net:   eth0: ethernet@8000000port@1
    Hit any key to stop autoboot:  2  0 
    => md.l 0x43000030 1
    43000030: 0000045b                             [...
    => mtd list
    List of MTD devices:
    * nand0
      - device: nand@0,0
      - parent: memory-controller@3b000000
      - driver: gpmc-nand
      - path: /bus@f0000/memory-controller@3b000000/nand@0,0
      - type: NAND flash
      - block size: 0x40000 bytes
      - min I/O: 0x1000 bytes
      - OOB size: 128 bytes
      - OOB available: 142 bytes
      - ECC strength: 8 bits
      - ECC step size: 512 bytes
      - bitflip threshold: 6 bits
      - 0x000000000000-0x000040000000 : "nand0"
    	  - 0x000000000000-0x000000200000 : "NAND.tiboot3"
    	  - 0x000000200000-0x000000400000 : "NAND.tispl"
    	  - 0x000000400000-0x000000600000 : "NAND.tiboot3.backup"
    	  - 0x000000600000-0x000000a00000 : "NAND.u-boot"
    	  - 0x000000a00000-0x000000a40000 : "NAND.u-boot-env"
    	  - 0x000000a40000-0x000000a80000 : "NAND.u-boot-env.backup"
    	  - 0x000000a80000-0x000040000000 : "NAND.file-system"
    * spi-nand0
      - device: flash@0
      - parent: spi@fc40000
      - driver: spi_nand
      - path: /bus@f0000/bus@fc00000/spi@fc40000/flash@0
      - type: NAND flash
      - block size: 0x40000 bytes
      - min I/O: 0x1000 bytes
      - OOB size: 128 bytes
      - OOB available: 80 bytes
      - 0x000000000000-0x000008000000 : "spi-nand0"
    	  - 0x000000000000-0x000000080000 : "ospi_nand.tiboot3"
    	  - 0x000000080000-0x000000280000 : "ospi_nand.tispl"
    	  - 0x000000280000-0x000000680000 : "ospi_nand.u-boot"
    	  - 0x000000680000-0x0000006c0000 : "ospi_nand.env"
    	  - 0x0000006c0000-0x000000700000 : "ospi_nand.env.backup"
    	  - 0x000002000000-0x000007fc0000 : "ospi_nand.rootfs"
    	  - 0x000007fc0000-0x000008000000 : "ospi_nand.phypattern"
    => nand info
    
    Device 0: nand0, sector size 256 KiB
      Page size         4096 b
      OOB size           128 b
      Erase size      262144 b
      ecc strength         8 bits
      ecc step size      512 b
      subpagesize       1024 b
      options       0x4000400c
      bbt options   0x00000000
    =>