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.

PROCESSOR-SDK-J721E: u-boot instructions for programming eMMC using USB-DFU

Part Number: PROCESSOR-SDK-J721E
Other Parts Discussed in Thread: DRA829J

Hi,

I have custom h/w based on the DRA829J/J721e.  I have u-boot running.  It is currently downloaded using USB-DFU.  

I'd like to program the eMMC using u-boot dfu functionality.  

Can you provide instructions?.  For instance should I use dfu_alt_info_mmc or dfu_alt_info_emmc ?

Thanks

  • Hi Stephan,

    There are two ways to flash images to emmc once you have uboot up 

    1.Using fatload command => Once you are at the uboot prompt run the below command to flash the images into the emmc.

     

    mmc dev 0 1
    fatload mmc 1 ${loadaddr} tiboot3.bin
    mmc write ${loadaddr} 0x0 0x400
    fatload mmc 1 ${loadaddr} tispl.bin
    mmc write ${loadaddr} 0x400 0x1000
    fatload mmc 1 ${loadaddr} u-boot.img
    mmc write ${loadaddr} 0x1400 0x2000
    
    mmc partconf 0 1 1 1
    mmc bootbus 0 2 0 0
    
    gpt write mmc 0 ${partitions}

    2.Using dfu-util =>You can see section 5.1.3.1 Flashing Instructions in 

    https://www.ti.com/lit/an/spracy5/spracy5.pdf?ts=1676525108645&ref_url=https%253A%252F%252Fwww.google.com%252F

    using dfu utility.

    Regards
    Diwakar

  • Hi Diwakar,

    My h/w only has USB, UART and eMMC ports attached (MMC0).  There is no SD card.  Therefore I need to use DFU-USB to program to the eMMC.

    I followed instructions in section 5.3.1 of SPRACY5.  I got here:

    HOST $ sudo dfu-util -l
    HOST $ sudo dfu-util -R -a bootloader -D <PATH_TO_BIN>/tiboot3.bin
    HOST $ sudo dfu-util -R -a sysfw.itb -D <PATH_TO_BIN>/sysfw.itb
    HOST $ sudo dfu-util -R -a tispl.bin -D <PATH_TO_BIN>/tispl.bin
    HOST $ sudo dfu-util -R -a u-boot.img -D <PATH_TO_BIN>/u-boot.img
    
    TARGET => env default -f -a
    TARGET => setenv mmcdev 0
    TARGET => setenv bootpart 0
    TARGET => saveenv
    TARGET Saving Environment to FAT... Failed (1)

    I believe the eMMC boot partition is RAW rather than FAT?

    => dfu 0 mmc 0 list
    DFU alt settings list:
    dev: eMMC alt: 0 name: rawemmc layout: RAW_ADDR
    dev: eMMC alt: 1 name: rootfs layout: RAW_ADDR
    dev: eMMC alt: 2 name: tiboot3.bin.raw layout: RAW_ADDR
    dev: eMMC alt: 3 name: tispl.bin.raw layout: RAW_ADDR
    dev: eMMC alt: 4 name: u-boot.img.raw layout: RAW_ADDR
    dev: eMMC alt: 5 name: u-env.raw layout: RAW_ADDR
    dev: eMMC alt: 6 name: sysfw.itb.raw layout: RAW_ADDR

    thanks!

  • HI Stephen,

    I believe the eMMC boot partition is RAW rather than FAT?

    Yes it is raw partition.

    also for this error 

    TARGET Saving Environment to FAT... Failed (1)

    You can check the solution provided in this thread.

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1185260/tda4vm-why-emmc-boot-does-not-take-effect/4464968#4464968

    Regards
    Diwakar

  • Hi Diwakar

    I have been able to get all the way to writing the boot files to the eMMC using dfu-util.  However when the boot mode is changed to eMMC nothing happens.

    I have tried the same procedure/files on my custom h/w and the EVM with no joy.

    The procedure is the same as in section 5.3.1 of SPRACY5.

    env default -f -a
    setenv mmcdev 0
    setenv bootpart 0
    saveenv
    setenv dfu_alt_info ${dfu_alt_info_emmc}
    gpt write mmc 0 ${partitions}
    mmc partconf 0 1 1 1
    mmc bootbus 0 2 0 0
    mmc dev 0 0
    dfu 0 mmc 0
    
    [HOST] dfu-util -a bootloader -D tiboot3.bin
    [HOST] dfu-util -a tispl.bin -D tispl.bin
    [HOST] dfu-util -a u-boot.img -D u-boot.img
    [HOST] dfu-util -a sysfw.itb -D sysfw.itb

    I have changed the config files in the bootloader like so:

    k3_dfu.h
    
    /* ASI modified to fit in a 4MB (0x2000 blocks) eMMC boot partition*/
    #define DFU_ALT_INFO_EMMC \
    	"dfu_alt_info_emmc=" \
    	"rawemmc raw 0 0x400000 mmcpart 1;" \
    	"rootfs part 0 1 mmcpart 0;" \
    	"tiboot3.bin.raw raw 0x0 0x400 mmcpart 1;" \
    	"tispl.bin.raw raw 0x400 0xB00 mmcpart 1;" \
    	"u-boot.img.raw raw 0xF00 0xD00 mmcpart 1;" \
    	"u-env.raw raw 0x1C00 0x100 mmcpart 1;" \
    	"sysfw.itb.raw raw 0x1D00 0x300 mmcpart 1\0"

    j721e_evm_a72_defconfig
    
    CONFIG_ENV_IS_IN_MMC=y
    CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
    CONFIG_SYS_RELOC_GD_ENV_ADDR=y
    CONFIG_SYS_MMC_ENV_PART=1
    # CONFIG_ENV_IS_IN_FAT is not set by AudioScience
    # CONFIG_ENV_FAT_DEVICE_AND_PART="1:1" is not set by AudioScience
    CONFIG_SPL_ENV_IS_NOWHERE=y
    #!!!!!!!!!!!!!! not clear if this is needed !!!!!!!!!!!!!!
    # set by AudioScience according to emmc values in DFU_ALT_INFO_EMMC
    #CONFIG_ENV_SIZE=0x20000 is not set by AudioScience
    CONFIG_ENV_OFFSET=0x380000
    CONFIG_ENV_OFFSET_REDUND=0x380100

    Any ideas?

  • HI Stephen,

    These are the steps which i followed to flash the images in the emmc using dfu and it is working for me.

    1.Applied this patch 

    0001-Save-Env-To-mmc-instead-of-sd.patch

    2.Run below commnands

    # This will download the images to the board but not flash them to eMMC
    # These first set of steps are optional if you have u-boot running on the board already
    HOST $ sudo dfu-util -l
    HOST $ sudo dfu-util -R -a bootloader -D <PATH_TO_BIN>/tiboot3.bin
    HOST $ sudo dfu-util -R -a sysfw.itb -D <PATH_TO_BIN>/sysfw.itb
    HOST $ sudo dfu-util -R -a tispl.bin -D <PATH_TO_BIN>/tispl.bin
    HOST $ sudo dfu-util -R -a u-boot.img -D <PATH_TO_BIN>/u-boot.img
    # At this point, the u-boot will start executing. Halt at the u-boot prompt (u-boot logs will
    
    
    
    appear on the MAIN UART 1st instance)
    TARGET => env default -f -a
    TARGET => setenv mmcdev 0
    TARGET => setenv bootpart 0
    TARGET => saveenv
    TARGET => setenv dfu_alt_info ${dfu_alt_info_emmc}
    
    
    # one time only per board
    TARGET => gpt write mmc 0 ${partitions}
    TARGET => dfu 0 mmc 0
    
    
    # This does the actual flashing to the eMMC boot0 partition
    HOST $ sudo dfu-util -l
    HOST $ sudo dfu-util -a tiboot3.bin.raw -D <PATH_TO_BIN>/tiboot3.bin
    HOST $ sudo dfu-util -a tispl.bin.raw -D <PATH_TO_BIN>/tispl.bin
    HOST $ sudo dfu-util -a u-boot.img.raw -D <PATH_TO_BIN>/u-boot.img
    
    
    #one time only per board, to give ROM access to the boot partition, the following commands must
    be used for the first time
    TARGET => mmc partconf 0 1 1 1
    TARGET => mmc bootbus 0 2 0 0

    Set boot mode to emmc and power on you will be able to see the boot logs.

    Regards
    Diwakar

  • Hi Diwakar,

    I followed your instructions exactly and was able to generate files that would boot from the EVM eMMC.  

    I then modified our custom h/w to use a 19.2MHz Oscillator thus allowing me to use the same tiboot3.bin as the EVM.

    Our h/w uses a 4GB eMMC with a 4MB boot partition vs. the EVM's 16GB eMMC and what looks like a 32MB partition.

    I had to modify k3_dfu.h to allow everything to fit inside 4MB:

    /* ASI modified to fit in a 4MB (0x2000 blocks) eMMC boot partition*/
    #define DFU_ALT_INFO_EMMC \
    	"dfu_alt_info_emmc=" \
    	"rawemmc raw 0 0x400000 mmcpart 1;" \
    	"rootfs part 0 1 mmcpart 0;" \
    	"tiboot3.bin.raw raw 0x0 0x400 mmcpart 1;" \
    	"tispl.bin.raw raw 0x400 0xB00 mmcpart 1;" \
    	"u-boot.img.raw raw 0xF00 0xD00 mmcpart 1;" \
    	"u-env.raw raw 0x1C00 0x100 mmcpart 1;" \
    	"sysfw.itb.raw raw 0x1D00 0x300 mmcpart 1\0"

    I also had to remove this CONFIG in j721e_evm_a72_defconfig otherwise u-boot would crash when loading on my h/w during the DFU-USB phase

    # CONFIG_DM_PCA953X is not set by AudioScience
    

    This resulting set of boot files almost gets to a u-boot prompt on the EVM, but not quite....

    U-Boot SPL 2021.01-dirty (Feb 24 2023 - 22:59:43 +0000)
    Model: Texas Instruments K3 J721E SoC
    Board:  rev
    SYSFW ABI: 3.1 (firmware rev 0x0008 '8.5.2--v08.05.02 (Chill Capybar')
    Trying to boot from MMC1
    init_env from device 17 not supported!
    Starting ATF on ARM64 core...
    
    NOTICE:  BL31: v2.7(release):v2.7.0-359-g1309c6c805-dirty
    NOTICE:  BL31: Built : 07:46:16, Dec 18 2022
    I/TC:
    I/TC: OP-TEE version: 3.19.0 (gcc version 9.2.1 20191025 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10))) #1 Sun Dec 18 07:46:21 UTC 2022 aarch64
    I/TC: WARNING: This OP-TEE configuration might be insecure!
    I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
    I/TC: Primary CPU initializing
    I/TC: SYSFW ABI: 3.1 (firmware rev 0x0008 '8.5.2--v08.05.02 (Chill Capybar')
    I/TC: HUK Initialized
    I/TC: Activated SA2UL device
    I/TC: Fixing SA2UL firewall owner for GP device
    I/TC: Enabled firewalls for SA2UL TRNG device
    I/TC: SA2UL TRNG initialized
    I/TC: SA2UL Drivers initialized
    I/TC: Primary CPU switching to normal world boot
    
    U-Boot SPL 2021.01-dirty (Feb 24 2023 - 22:59:39 +0000)
    Model: Texas Instruments K3 J721E SoC
    Board:  rev
    SYSFW ABI: 3.1 (firmware rev 0x0008 '8.5.2--v08.05.02 (Chill Capybar')
    ti_i2c_eeprom_am6_get: Ignoring record id 255
    Trying to boot from MMC1
    <crash>
    

    These same binaries do not seem to work on our h/w when booting from eMMC.  I see no output on the UART at all.

    Any ideas?.

    thanks

  • HI Stephen,

    You have to apply these changes as well 

    diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
    index 26ae4cb077..f37c733f4e 100644
    --- a/arch/arm/mach-k3/Kconfig
    +++ b/arch/arm/mach-k3/Kconfig
    @@ -132,7 +132,7 @@ config K3_SYSFW_IMAGE_NAME
    config K3_SYSFW_IMAGE_MMCSD_RAW_MODE_SECT
    hex "MMC sector to load SYSFW firmware and configuration blob from"
    depends on K3_LOAD_SYSFW && SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
    - default 0x3600
    + default 0x1D00
    help
    Address on the MMC to load the combined System Firmware and
    configuration image tree blob from, when the MMC is being used
    diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
    index 7b70632619..8a8f657661 100644
    --- a/configs/j721e_evm_a72_defconfig
    +++ b/configs/j721e_evm_a72_defconfig
    @@ -35,7 +35,7 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
    CONFIG_SPL_STACK_R=y
    CONFIG_SPL_SEPARATE_BSS=y
    CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
    -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
    +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xF00
    CONFIG_SPL_DMA=y
    CONFIG_SPL_ENV_SUPPORT=y
    CONFIG_SPL_I2C_SUPPORT=y

    Regards
    Diwakar

  • That works!.  Thanks for your help.

    Would be nice to have all these change documented in a readme somewhere.