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.

TMDS64EVM: Flashing Uboot and Linux kernel image on emmc via DFU Flash

Part Number: TMDS64EVM

Dear team

I was able to flash the Uboot images and linux kernal on emmc via DFU flash, but when boot mode switches was changed to emmc, board doesnt boot with linux.

Also as i understood, u-boot images are stored in Boot 0 partition, but when i tried to run "ls mmc 0:0" command to check the image files, I did not find any images flashed on emmc.

Below are the logs on UART serial terminal

U-Boot SPL 2021.01 (Jun 20 2023 - 16:52:28 +0530)
Resetting on cold boot to workaround ErrataID:i2331
resetting ...

U-Boot SPL 2021.01 (Jun 20 2023 - 16:52:28 +0530)
SYSFW ABI: 3.1 (firmware rev 0x0008 '8.6.4--v08.06.04 (Chill Capybar')
SPL initial stack usage: 13424 bytes
Trying to boot from DFU
#############################################DOWNLOAD ... OK
Ctrl+C to exit ...
Authentication passed
Authentication passed
Authentication passed
Authentication passed
init_env from device 10 not supported!
Starting ATF on ARM64 core...

NOTICE:  BL31: v2.8(release):v2.8-226-g2fcd408bb3-dirty
NOTICE:  BL31: Built : 13:45:56, Feb 27 2023
I/TC:
I/TC: OP-TEE version: 3.20.0 (gcc version 9.2.1 20191025 (GNU Toolchain for the A-profile Architectu                                                                                         re 9.2-2019.12 (arm-9.10))) #1 Mon Feb 27 13:46:53 UTC 2023 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.h                                                                                         tml
I/TC: Primary CPU initializing
I/TC: SYSFW ABI: 3.1 (firmware rev 0x0008 '8.6.4--v08.06.04 (Chill Capybar')
I/TC: HUK Initialized
I/TC: Activated SA2UL 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 (Jun 20 2023 - 16:52:09 +0530)
SYSFW ABI: 3.1 (firmware rev 0x0008 '8.6.4--v08.06.04 (Chill Capybar')
Trying to boot from DFU
#####DOWNLOAD ... OK
Ctrl+C to exit ...
Authentication passed
Authentication passed


U-Boot 2021.01 (Jun 20 2023 - 16:52:09 +0530)

SoC:   AM64X SR2.0 HS-FS
Model: Texas Instruments AM642 EVM
Board: AM64-EVM rev C
DRAM:  2 GiB
NAND:  0 MiB
MMC:   mmc@fa10000: 0, mmc@fa00000: 1
In:    serial@2800000
Out:   serial@2800000
Err:   serial@2800000
Unidentified board claims AM64-EVM in eeprom header
Net:   eth0: ethernet@8000000port@1
Hit any key to stop autoboot:  0
#DOWNLOAD ... OK
Ctrl+C to exit ...
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002
###DOWNLOAD ... OK
Ctrl+C to exit ...
####DOWNLOAD ... OK
Ctrl+C to exit ...
#####DOWNLOAD ... OK
Ctrl+C to exit ...
###############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################DOWNLOAD ... OK
Ctrl+C to exit ...
=> mmc
mmc - MMC sub system

Usage:
mmc info - display info of the current MMC device
mmc read addr blk# cnt
mmc write addr blk# cnt
mmc erase blk# cnt
mmc rescan [mode]
mmc part - lists available partition on current mmc device
mmc dev [dev] [part] [mode] - show or set current mmc device [partition] and set mode
  - the required speed mode is passed as the index from the following list
    [MMC_LEGACY, MMC_HS, SD_HS, MMC_HS_52, MMC_DDR_52, UHS_SDR12, UHS_SDR25,
    UHS_SDR50, UHS_DDR50, UHS_SDR104, MMC_HS_200, MMC_HS_400, MMC_HS_400_ES]
mmc list - lists available devices
mmc wp - power on write protect boot partitions
mmc hwpartition [args...] - does hardware partitioning
  arguments (sizes in 512-byte blocks):
    [user [enh start cnt] [wrrel {on|off}]] - sets user data area attributes
    [gp1|gp2|gp3|gp4 cnt [enh] [wrrel {on|off}]] - general purpose partition
    [check|set|complete] - mode, complete set partitioning completed
  WARNING: Partitioning is a write-once setting once it is set to complete.
  Power cycling is required to initialize partitions after set to complete.
mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode
 - Set the BOOT_BUS_WIDTH field of the specified device
mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>
 - Change sizes of boot and RPMB partitions of specified device
mmc partconf dev [boot_ack boot_partition partition_access]
 - Show or change the bits of the PARTITION_CONFIG field of the specified device
mmc rst-function dev value
 - Change the RST_n_FUNCTION field of the specified device
   WARNING: This is a write-once field and 0 / 1 / 2 are the only valid values.
mmc setdsr <value> - set DSR register value

=> mmc part

Partition Map for MMC device 0  --   Partition Type: EFI

Part    Start LBA       End LBA         Name
        Attributes
        Type GUID
        Partition GUID
  1     0x00000022      0x01da3fde      "rootfs"
        attrs:  0x0000000000000000
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   6920369f-8855-4591-a250-21feb0b50bdc
=> ls mmc 0:1
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
<DIR>       4096 bin
<DIR>       4096 boot
<DIR>       4096 dev
<DIR>       4096 etc
<DIR>       4096 home
<DIR>       4096 lib
<SYM>         19 linuxrc
<DIR>       4096 media
<DIR>       4096 mnt
<DIR>       4096 proc
<DIR>       4096 run
<DIR>       4096 sbin
<DIR>       4096 srv
<DIR>       4096 sys
<DIR>       4096 tmp
<DIR>       4096 usr
<DIR>       4096 var
=> ls mmc 0:0
** Unrecognized filesystem type **
=> ls mmc 0:2
** Invalid partition 2 **
=> ls mmc 0:3
** Invalid partition 3 **
=> setenv mmcdev 0
=> setenv bootpart 0:1
=> boot

  • Hi Shraddha,

    The flashing looks okay. But, I notice that you are running "setenv mmcdev 0" and "setenv bootpart 0:1" without first powering off the board and switching the bootmodes to eMMC. I have listed below the steps needed:

    1) Perform the flashing procedure. If already done, skip this step.

    2) Power off the board.

    3) Switch the bootmodes to eMMC.

    4) Power on the board.

    5) Let the board boot to U-Boot.

    6) Stop the autoboot by pressing any key and run the following commands to boot Linux from eMMC.

    => setenv mmcdev 0
    => setenv bootpart 0:1
    => boot

    Also as i understood, u-boot images are stored in Boot 0 partition, but when i tried to run "ls mmc 0:0" command to check the image files, I did not find any images flashed on emmc.

    The eMMC is hardware partitioned as shown below

    +---------+---------+--------+----------------------------------+
    |  boot0  |  boot1  |  rpmb  |          User Data Area          |
    +---------+---------+--------+----------------------------------+
    

    The U-Boot images are flashed into Boot0 partition while Linux is flashed in UDA partition. The "ls mmc" command will not work to list the U-Boot images in Boot0 partition.

    Regards,

    Prashant

  • Hello Prashant,

    Once I change the boot mode to emmc, board doesnt boot to Uboot itself. There is no message/error on UART terminal also, its blank.

    I have tried the steps now on another evm kit, on that while flashing i get below errors.

    U-Boot 2023.04-ga97ca328b3 (Jan 08 2024 - 08:11:13 +0000)
    
    SoC:   AM64X SR2.0 HS-FS
    Model: Texas Instruments AM642 EVM
    Board: AM64-EVM rev C
    DRAM:  2 GiB
    Core:  66 devices, 31 uclasses, devicetree: separate
    NAND:  0 MiB
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    Loading Environment from nowhere... OK
    In:    serial@2800000
    Out:   serial@2800000
    Err:   serial@2800000
    Unidentified board claims AM64-EVM in eeprom header
    Net:   eth0: ethernet@8000000port@1
    Hit any key to stop autoboot:  0
    MMC: no card present
    SD/MMC found on device 1
    MMC: no card present
    ** Bad device specification mmc 1 **
    Couldn't find partition mmc 1
    Can't set block device
    MMC: no card present
    ** Bad device specification mmc 1 **
    Couldn't find partition mmc 1
    Can't set block device
    MMC: no card present
    ** Bad device specification mmc 1 **
    ## Error: "main_cpsw0_qsgmii_phyinit" not defined
    MMC: no card present
    ** Bad device specification mmc 1 **
    Couldn't find partition mmc 1:2
    Can't set block device
    MMC: no card present
    ** Bad device specification mmc 1 **
    Couldn't find partition mmc 1:2
    Can't set block device
    libfdt fdt_check_header(): FDT_ERR_BADMAGIC
    No FDT memory address configured. Please configure
    the FDT address via "fdt addr <address>" command.
    Aborting!
    Bad Linux ARM64 Image magic!
    switch to partitions #0, OK
    mmc0(part 0) is current device
    MMC: no card present
    starting USB...
    No working controllers found
    USB is stopped. Please issue 'usb start' first.
    starting USB...
    No working controllers found
    ethernet@8000000port@1 Waiting for PHY auto negotiation to complete......... TIMEOUT !
    am65_cpsw_nuss_port ethernet@8000000port@1: phy_startup failed
    am65_cpsw_nuss_port ethernet@8000000port@1: am65_cpsw_start end error
    missing environment variable: pxeuuid
    Retrieving file: pxelinux.cfg/01-1c-63-49-1a-de-33
    ethernet@8000000port@1 Waiting for PHY auto negotiation to complete......... TIMEOUT !
    am65_cpsw_nuss_port ethernet@8000000port@1: phy_startup failed
    am65_cpsw_nuss_port ethernet@8000000port@1: am65_cpsw_start end error
    Retrieving file: pxelinux.cfg/00000000

    The "ls mmc" command will not work to list the U-Boot images in Boot0 partition.

    How to check U boot images in Boot0 partition?

    Regards,

    Shraddha N

  • Hi Shraddha,

    Once I change the boot mode to emmc, board doesnt boot to Uboot itself. There is no message/error on UART terminal also, its blank.

    If you are booting for the first time from eMMC, you would need to manually run the following one-time command from the U-Boot prompt

    => mmc partconf 0 1 1 1
    => mmc bootbus 0 2 0 0

    Regards,

    Prashant

  • Hello Prashant,

    Next steps what i followed

    1.  Flashed Uboot + linux image with boot mode switch on USB DFU.

    2. Entered to Uboot prompt by pressing Ctrl+C keys, & entered below commands

    => mmc partconf 0 1 1 1
    => mmc bootbus 0 2 0 0

    3. Powered off the board.

    4. Switched the bootmodes to eMMC.

    5.  Powered on the board.

    6. EVM boots to U-Boot. Stopped the evm autobooting by pressing any key & enytered below commands

    => setenv mmcdev 0
    => setenv bootpart 0:1
    => boot

    Here board doesnt boot.

    Regards

    Shraddha N

  • Hi Shraddha,

    From the U-Boot booted from eMMC, can you please share the output of the following command

    => printenv bootcmd

    Regards,

    Prashant

  • Hi Shraddha,

    This explains why you are not able to boot because you have flashed the same set of U-Boot images into eMMC that are used for flashing purpose.

    Please note the U-Boot images available in "bin/am64xx-evm/hsfs" are built for supporting the USB DFU flashing and must not be flashed anywhere. You should build your own U-Boot images and flash them.

    For instance, if you are using TI EVM, you can flash the prebuilt U-Boot images in "PSDK_PATH/board-support/prebuilt-images/am64xx-evm".

  • Thanks Prashant, I was able to boot the board with linux.

    So what I was actually looking for is to flash all the images on emmc via DFU Flash automatically without any manual intervention. But what i understand is 1. 1. we need to do partition of emmc manually from Uboot prompt

    2.Once flashing is done, we need to give the ROM access to the boot partition manually from Uboot

    3. Again in emmc boot mode, we need to give specific commands to boot kernel from eMMC from uboot--> this we can add patch in am64x.env file

    But for other 2 points mentioned above, is there any way to do these automatically ?

    Also wrt emmc partition, what i understood is Linux is flashed in the eMMC UDA partition while tiboot3.bin, tispl.bin and u-boot.img are flashed into Boot0 partition. Boot 0 & Booot1 is harware partitioned & when we do partiotioning of emmc using GPT uuid is in UDA partition, so we create only 1 partition in this step ie. mmcblk0p1 as shown below ? 

     

    root@am64xx-evm:~# lsblk
    NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
    mtdblock0     31:0    0    1M  0 disk
    mtdblock1     31:1    0    2M  0 disk
    mtdblock2     31:2    0    4M  0 disk
    mtdblock3     31:3    0  256K  0 disk
    mtdblock4     31:4    0  256K  0 disk
    mtdblock5     31:5    0 55.8M  0 disk
    mtdblock6     31:6    0  256K  0 disk
    mmcblk0      179:0    0 14.8G  0 disk
    `-mmcblk0p1  179:1    0 14.8G  0 part /
    mmcblk0boot0 179:32   0 31.5M  1 disk
    mmcblk0boot1 179:64   0 31.5M  1 disk
    mmcblk1      179:96   0 29.7G  0 disk
    |-mmcblk1p1  179:97   0  128M  0 part /run/media/boot-mmcblk1p1
    `-mmcblk1p2  179:98   0  7.2G  0 part /run/media/root-mmcblk1p2

    The eMMC is hardware partitioned as shown below

    Fullscreen
    1
    2
    3
    +---------+---------+--------+----------------------------------+
    | boot0 | boot1 | rpmb | User Data Area |
    +---------+---------+--------+----------------------------------+
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    The U-Boot images are flashed into Boot0 partition while Linux is flashed in UDA partition. The "ls mmc" command will not work to list the U-Boot images in Boot0 partition.

    which command will work to list images in Boot0/1 ??

    Regards

    Shraddha

  • Hello Prashant,

    Any update on this??

  • Hi Shraddha,

    But for other 2 points mentioned above, is there any way to do these automatically ?

    There are many ways to do this. One way is to create a set of U-Boot images with the following patch and save the generated U-Boot images somewhere to use them anytime. Revert the patch afterwards so that you can continue building the regular U-Boot images.

    diff --git a/board/ti/am64x/am64x.env b/board/ti/am64x/am64x.env
    index 53c7d8d6..fdb5205a 100644
    --- a/board/ti/am64x/am64x.env
    +++ b/board/ti/am64x/am64x.env
    @@ -61,3 +61,16 @@ usbboot=setenv boot usb;
     fw_storage_interface=mmc
     fw_dev_part=1:2
     #endif
    +
    +emmc_partition=
    +	echo "eMMC partitioning ...";
    +	setenv uuid_gpt_rootfs e4809335-571e-4a4a-9ec6-48387691081e;
    +	gpt write mmc 0 $partitions;
    +	echo "eMMC partitioning ... DONE!!!";
    +
    +emmc_boot_conf=
    +	echo "eMMC boot config ...";
    +	mmc dev 0;
    +	mmc partconf 0 1 1 1;
    +	mmc bootbus 0 2 0 0;
    +	echo "eMMC boot config ... DONE!!!";
    diff --git a/configs/am64x_evm_a53_defconfig b/configs/am64x_evm_a53_defconfig
    index 396385f9..8c3e9008 100644
    --- a/configs/am64x_evm_a53_defconfig
    +++ b/configs/am64x_evm_a53_defconfig
    @@ -33,7 +33,7 @@ CONFIG_SPL_LOAD_FIT=y
     CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
     CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
     CONFIG_DISTRO_DEFAULTS=y
    -CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;"
    +# CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;"
     CONFIG_BOARD_LATE_INIT=y
     CONFIG_SPL_MAX_SIZE=0x180000
     CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
    @@ -226,3 +226,6 @@ CONFIG_SYS_MAX_NAND_DEVICE=1
     CONFIG_SPL_MTD_SUPPORT=y
     CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
     CONFIG_SYS_NAND_U_BOOT_OFFS=0x600000
    +
    +CONFIG_BOOTDELAY=0
    +CONFIG_BOOTCOMMAND="run emmc_partition;run emmc_boot_conf;"
    

    These U-Boot images when booted over DFU partitions the eMMC and configures it as shown

    U-Boot 2023.04-dirty (Apr 30 2024 - 11:27:21 +0530)
    
    SoC:   AM64X SR2.0 HS-FS
    Model: Texas Instruments AM642 EVM
    Board: AM64-GPEVM rev A
    DRAM:  2 GiB
    Core:  91 devices, 32 uclasses, devicetree: separate
    NAND:  0 MiB
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    Loading Environment from nowhere... OK
    In:    serial@2800000
    Out:   serial@2800000
    Err:   serial@2800000
    Net:   eth3: icssg1-eth, eth0: ethernet@8000000port@1
    Hit any key to stop autoboot:  0
    eMMC partitioning ...
    Writing GPT: success!
    eMMC partitioning ... DONE!!!
    eMMC boot config ...
    switch to partitions #0, OK
    mmc0(part 0) is current device
    Set to BOOT_BUS_WIDTH = 0x2, RESET = 0x0, BOOT_MODE = 0x0
    eMMC boot config ... DONE!!!
    =>

    Once successful, do a POR and run the flash writer to flash the eMMC with regular U-Boot images and Linux Rootfs.

    which command will work to list images in Boot0/1 ??

    There is no filesystem in Boot0/1 partition. The images are RAW flashed at certain offsets. The best you can do is read the RAW images directly and use md to display the bytes.

    => mmc dev 0 1
    switch to partitions #1, OK
    mmc0(part 1) is current device
    => mmc read $loadaddr 0x1800 0x2000
    
    MMC read: dev # 0, block # 6144, count 8192 ... 8192 blocks read: OK
    => md $loadaddr
    82000000: edfe0dd0 f3471400 38000000 f0431400  ......G....8..C.
    82000010: 28000000 11000000 02000000 00000000  ...(............
    82000020: 63000000 b8431400 00000000 00000000  ...c..C.........
    82000030: 00000000 00000000 01000000 00000000  ................
    82000040: 03000000 04000000 53000000 42883066  ...........Sf0.B
    82000050: 03000000 27000000 47000000 20544946  .......'...GFIT
    82000060: 67616d69 69772065 6d206874 69746c75  image with multi
    82000070: 20656c70 666e6f63 72756769 6f697461  ple configuratio
    82000080: 0000736e 01000000 67616d69 00007365  ns......images..
    82000090: 01000000 6f6f6275 00000074 03000000  ....uboot.......
    820000a0: 16000000 47000000 6f422d55 6620746f  .......GU-Boot f
    820000b0: 4120726f 2034364d 72616f62 00000064  or AM64 board...
    820000c0: 03000000 09000000 42000000 6d726966  ...........Bfirm
    820000d0: 65726177 00000000 03000000 07000000  ware............
    820000e0: 3f000000 6f622d75 0000746f 03000000  ...?u-boot......
    820000f0: 04000000 3a000000 006d7261 03000000  .......:arm.....
    =>