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.

AM62A7-Q1: [FAQ] how to enable eMMC UDA boot mode and eMMC boot mode on AM62A

Part Number: AM62A7-Q1
Other Parts Discussed in Thread: CSD

below ticket shows one issue, while try to boot from eMMC boot partition, When BOOTMODE[7] = 0, tiboot3.bin try to load tispl.bin incorrectly from “fs” instead of “raw”.

it provides a u-boot patch to fix it as a workround.

(1) [FAQ] A53 boot binary (tispl.bin) loading error when BOOTMODE[7]="0" in eMMC boot mode on AM62A - Processors forum - Processors - TI E2E support forums

based on this patch, here is step-by-step guideline to enable eMMC UDA boot mode and eMMC boot mode.

HW: AM62A EVM, SK-AM62A-LP Evaluation board | TI.com

SW: TI SDK, ti-processor-sdk-linux-am62axx-evm-08.06.00.45. https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-AM62A

------------------------------------------------------------------------------------------------------

1. Pin map between SW2/SW3 and BOOT MODE pins.

BOOT MODE (SW2/SW3)

                                                            lsb          msb                   lsb           msb
SD boot mode:                          SW2: 1100 0010              SW3: 0100 0000
EMMC UDA boot mode:            SW2: 1100 0010              SW3: 0000 0000
EMMC boot mode:                    SW2: 1101 0010               SW3: 0000 0000

take SD boot mode as example, SW2 is low byte, and SW3 is high byte. and in each byte, LSB is high bit.

------------------------------------------------------------------------------------------------------

2. CASE: boot with EMMC boot mode.

recommends to erase eMMC boot0 partition and delete partition table in eMMC user partition to avoid conflict firstly. see appendix E and F. and check if erase and delete OK, see appendix G and H.

step1: apply patch, 0001-port-script-from-host-pc-to-client-evm.patch, to u-boot source in ti-processor-sdk-linux-am62axx-evm-08.06.00.45. see appendix A.

step2: create SD card with tisdk-edgeai-image-am62axx-evm.tar.xz on PC, see appendix B.

step3: prepare SD card with related files to write to eMMC. see appendix C.

step4: apply patch, 0001-am62a-bootmode7-emmc.patch,  to u-boot source in ti-processor-sdk-linux-am62axx-evm-08.06.00.45. and update to SD card. see appendix D.

step5: switch to SD boot mode, then insert SD card, power on AM62A EVM. use uboot command to set rootfs location to rootfs partition in SD.

Hit any key to stop autoboot: 0
=>
=> setenv bootpart 1:2

=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK
=>

step6: power on the EVM again, run below commands in linux console to format eMMC and prepare boot and rootfs partitions.

Arago Project am62axx-evm ttyS2

Arago 2021.09 am62axx-evm ttyS2

am62axx-evm login: root
root@am62axx-evm:/opt/edgeai-gst-apps# cd
root@am62axx-evm:~# chmod +x create-sdcard_client.sh
root@am62axx-evm:~# ./create-sdcard_client.sh


Notice1: currently device(mmcblk1) is SD card; device(mmcblk0) is eMMC on AM62A EVM.
if it is opposite on your board, please change ROOTDRIVE to "mmcblk0" in check_for_mm() function.
/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45/bin/create-sdcard_client.sh
check_for_emmc()
{
# find the avaible emmc
ROOTDRIVE=mmcblk1
PARTITION_TEST=`cat /proc/partitions | grep -v $ROOTDRIVE | grep '\<sd.\>\|\<mmcblk.\>' | grep -n ''`
if [ "$PARTITION_TEST" = "" ]; then
echo -e "no emmc found\n"
exit 1
fi
}

Notice2:
sometimes, there is existing filesystem on /dev/mmcblk0p2, need enter to let the script resume.
################################################################################

Partitioning rootfs

################################################################################
mke2fs 1.45.7 (28-Jan-2021)
/dev/mmcblk0p2 contains a ext3 file system labelled 'rootfs'
last mounted on /home/root/rootfs on Mon Feb 27 10:38:19 2023
Proceed anyway? (y,N)

step7: go to kernel. empty boot partition in eMMC.
root@am62axx-evm:~# ls -l /dev/mmc*
brw-rw---- 1 root disk 179, 0 Feb 27 10:40 /dev/mmcblk0
brw-rw---- 1 root disk 179, 32 Feb 27 10:38 /dev/mmcblk0boot0
brw-rw---- 1 root disk 179, 64 Feb 27 10:38 /dev/mmcblk0boot1
brw-rw---- 1 root disk 179, 1 Feb 27 10:40 /dev/mmcblk0p1
brw-rw---- 1 root disk 179, 2 Feb 27 10:40 /dev/mmcblk0p2
crw------- 1 root root 237, 0 Feb 27 10:38 /dev/mmcblk0rpmb
brw-rw---- 1 root disk 179, 96 Feb 27 10:38 /dev/mmcblk1
brw-rw---- 1 root disk 179, 97 Feb 27 10:38 /dev/mmcblk1p1
brw-rw---- 1 root disk 179, 98 Feb 27 10:38 /dev/mmcblk1p2
root@am62axx-evm:~# mkdir -p emmc_boot
root@am62axx-evm:~# mount /dev/mmcblk0p1 emmc_boot/
root@am62axx-evm:~# ls -l emmc_boot/
total 2527
-rwxrwx--- 1 root disk 360193 Feb 27 10:40 tiboot3.bin
-rwxrwx--- 1 root disk 1210016 Feb 27 10:40 tispl.bin
-rwxrwx--- 1 root disk 1015424 Feb 27 10:40 u-boot.img
-rwxrwx--- 1 root disk 486 Feb 27 10:40 uEnv.txt
root@am62axx-evm:~# rm -rf emmc_boot/*
root@am62axx-evm:~# ls -l emmc_boot/
total 0
root@am62axx-evm:~# sync

step8: power on AM62A EVM again. then run below commands in uboot console to write tiboot3/tispl/u-boot to eMMC boot0 partition.
Hit any key to stop autoboot: 0

=>
=> mmc dev 0 1
switch to partitions #1, OK
mmc0(part 1) is current device
=> mmc erase 0x0 0x2000

MMC erase: dev # 0, block # 0, count 8192 ... 8192 blocks erased: OK
=> fatload mmc 1 ${loadaddr} tiboot3.bin
360193 bytes read in 20 ms (17.2 MiB/s)
=> mmc write ${loadaddr} 0x0 0x400

MMC write: dev # 0, block # 0, count 1024 ... 1024 blocks written: OK
=> fatload mmc 1 ${loadaddr} tispl.bin
1210016 bytes read in 56 ms (20.6 MiB/s)
=> mmc write ${loadaddr} 0x400 0x1000

MMC write: dev # 0, block # 1024, count 4096 ... 4096 blocks written: OK
=> fatload mmc 1 ${loadaddr} u-boot.img
1015424 bytes read in 47 ms (20.6 MiB/s)
=> mmc write ${loadaddr} 0x1400 0x2000

MMC write: dev # 0, block # 5120, count 8192 ... 8192 blocks written: OK
=> mmc partconf 0 1 1 1
=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK

step9: switch to EMMC boot mode, remove SD card, power on AM62A EVM. then run below commands in uboot console.
Hit any key to stop autoboot: 0
=>
=> mmc bootbus 0 2 0 0
=> setenv bootpart 0:2
=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK

step9: power on the EVM again. then it will go to LINUX console, that means system boot-up successfully.
in addition, you can double check boot partition is empty, it proves that system should boot from boot0 partition.

root@am62axx-evm:/opt/edgeai-gst-apps# ls -l /dev/mmc*
brw-rw---- 1 root disk 179, 0 Feb 27 10:38 /dev/mmcblk0
brw-rw---- 1 root disk 179, 32 Feb 27 10:38 /dev/mmcblk0boot0
brw-rw---- 1 root disk 179, 64 Feb 27 10:38 /dev/mmcblk0boot1
brw-rw---- 1 root disk 179, 1 Feb 27 10:38 /dev/mmcblk0p1
brw-rw---- 1 root disk 179, 2 Feb 27 10:38 /dev/mmcblk0p2
crw------- 1 root root 237, 0 Feb 27 10:38 /dev/mmcblk0rpmb
root@am62axx-evm:/opt/edgeai-gst-apps# cd
root@am62axx-evm:~# mkdir -p emmc_boot
root@am62axx-evm:~# mount /dev/mmcblk0p1 emmc_boot
root@am62axx-evm:~# ls -l emmc_boot/
total 0
root@am62axx-evm:~# mkdir -p emmc_rootfs
root@am62axx-evm:~# mount /dev/mmcblk0p2 emmc_rootfs
mount: /home/root/emmc_rootfs: /dev/mmcblk0p2 already mounted on /.

------------------------------------------------------------------------------------------------------

3. CASE: boot with EMMC UDA boot mode.

recommends to erase eMMC boot0 partition and delete partition table in eMMC user partition to avoid conflict firstly. see appendix E and F. and check if erase and delete OK, see appendix G and H.

step1: same to above step1

step2: same to above step2

step3: same to above step3

step4: same to above step4

step5: same to above step5

step6: same to above step6

step7: switch to SD boot mode, then insert SD card. power on AM62A EVM. then run below commands in uboot console.
Hit any key to stop autoboot: 0
=>
=> mmc partconf 0 1 7 1
=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK

step8: switch to EMMC UDA boot mode, then remove SD card, power on AM62A EVM. then run below commands in uboot console.

Hit any key to stop autoboot: 0
=>
=> mmc bootbus 0 2 0 0
=> setenv bootpart 0:2
=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK
=> 

step9: power on AM62A EVM again. then it will go to LINUX console, that means system works.

appendix:

------------------------------------------------------------------------------------------------------

A. steps to apply patch, 0001-port-script-from-host-pc-to-client-evm.patch

0001-port-script-from-host-pc-to-client-evm.patch

------------------------------------------------------------------------------------------------------ 

B. steps to create SD card with tisdk-edgeai-image-am62axx-evm.tar.xz on PC
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo ./bin/create-sdcard.sh

(selection 1)
Available Drives to write images to:

# major minor size name
1: 8 16 62367744 sdb

Enter Device Number or n to exit: 1

(selection 2)
################################################################################

**********WARNING**********

Selected Device is greater then 16GB
Continuing past this point will erase data from device
Double check that this is the correct SD Card

################################################################################

Would you like to continue [y/n] : y


(selection 3)
################################################################################

Select 2 partitions if only need boot and rootfs (most users).
Select 3 partitions if need SDK & other content on SD card. This is
usually used by device manufacturers with access to partition tarballs.

****WARNING**** continuing will erase all data on sdb

################################################################################

Number of partitions needed [2/3] : 2

(selection 4, optional)
################################################################################

Partitioning rootfs

################################################################################
mke2fs 1.44.1 (24-Mar-2018)
/dev/sdb2 contains a ext3 file system labelled 'rootfs'
last mounted on /media/a0224068local/rootfs on Tue Apr 18 15:53:09 2023
Proceed anyway? (y,N) y

(selection 5)
################################################################################

Partitioning is now done
Continue to install filesystem or select 'n' to safe exit

**Warning** Continuing will erase files any files in the partitions

################################################################################


Would you like to continue? [y/n] : y

(selection 6)
################################################################################

Choose file path to install from

1 ) Install pre-built images from SDK
2 ) Enter in custom boot and rootfs file paths

################################################################################

Choose now [1/2] : 1

(selection 7)
################################################################################

Multiple rootfs Tarballs found

################################################################################

1:tisdk-edgeai-image-am62axx-evm.tar.xz
2:tisdk-default-image-am62axx-evm.tar.xz
3:tisdk-docker-rootfs-image-am62axx-evm.tar.xz
4:tisdk-thinlinux-image-am62axx-evm.tar.xz
5:tisdk-base-image-am62axx-evm.tar.xz
6:tisdk-bootstrap-image-am62axx-evm.tar.xz
7:tisdk-tiny-image-am62axx-evm.tar.xz
Enter Number of rootfs Tarball: 1

------------------------------------------------------------------------------------------------------

C. steps to prepare SD card with related files to write to eMMC

a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo mkdir -p /media/a0224068local/rootfs/home/root/board-support
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo mkdir -p /media/a0224068local/rootfs/home/root/board-support/prebuilt-images
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo cp board-support/prebuilt-images/tispl.bin /media/a0224068local/rootfs/home/root/board-support/prebuilt-images/
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo cp board-support/prebuilt-images/u-boot.img /media/a0224068local/rootfs/home/root/board-support/prebuilt-images/
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo cp board-support/prebuilt-images/uEnv.txt /media/a0224068local/rootfs/home/root/board-support/prebuilt-images/
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo cp board-support/prebuilt-images/tiboot3-am62ax-hs-fs-evm.bin /media/a0224068local/rootfs/home/root/board-support/prebuilt-images/
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo mkdir -p /media/a0224068local/rootfs/home/root/filesystem
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo cp filesystem/tisdk-edgeai-image-am62axx-evm.tar.xz /media/a0224068local/rootfs/home/root/filesystem/
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo cp bin/create-sdcard_client.sh /media/a0224068local/rootfs/home/root/
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sync

Notice: for GP EVM, use tiboot3-am62ax-gp-evm.bin.
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo cp board-support/prebuilt-images/tiboot3-am62ax-gp-evm.bin /media/a0224068local/rootfs/home/root/board-support/prebuilt-images/

------------------------------------------------------------------------------------------------------

D. steps to apply patch, 0001-am62a-bootmode7-emmc.patch

0001-am62a-bootmode7-emmc.patch
step1: apply the patch to uboot source.

step2: re-build u-boot
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ make u-boot-r5

a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ export TI_SECURE_DEV_PKG=/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45/board-support/core-secdev-k3
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ make sysfw-image
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ make u-boot-a53

step3: update SD card
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo cp board-support/k3-image-gen-2022.01/tiboot3-am62ax-hs-fs-evm.bin /media/a0224068local/rootfs/home/root/board-support/prebuilt-images/
a0224068local@a0224068local-HP-EliteBook-830-G7-Notebook-PC:/opt/1Twork/repository/ti-processor-sdk-linux-am62axx-evm-08.06.00.45$ sudo cp board-support/u-boot_build/a53/tispl.bin /media/a0224068local/rootfs/home/root/board-support/prebuilt-images/

------------------------------------------------------------------------------------------------------

E steps to erase eMMC boot0 partition.

step1: switch to SD boot mode, insert SD card, power on the EVM.

step2: use uboot command to erase
Hit any key to stop autoboot: 0
=>
=> mmc dev 0 1
switch to partitions #1, OK
mmc0(part 1) is current device
=> mmc erase 0 2000

MMC erase: dev # 0, block # 0, count 8192 ... 8192 blocks erased: OK
=> mmc part
## Unknown partition table type 0

------------------------------------------------------------------------------------------------------

F. steps to delete partition table in eMMC user partition

step1: switch to SD boot mode, insert SD card, power on the EVM.

step2: use uboot command to set rootfs location to rootfs partition in SD.
Hit any key to stop autoboot: 0
=>
=> setenv bootpart 1:2

=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK
=>

step3: power on the EVM again. go to kernel, use fdisk tool to delete parttions in EMMC chip.

root@am62axx-evm:/opt/edgeai-gst-apps# ls -l /dev/mmc*
brw-rw---- 1 root disk 179, 0 Feb 27 10:40 /dev/mmcblk0
brw-rw---- 1 root disk 179, 32 Feb 27 10:38 /dev/mmcblk0boot0
brw-rw---- 1 root disk 179, 64 Feb 27 10:38 /dev/mmcblk0boot1
brw-rw---- 1 root disk 179, 1 Feb 27 10:40 /dev/mmcblk0p1
brw-rw---- 1 root disk 179, 2 Feb 27 10:40 /dev/mmcblk0p2
crw------- 1 root root 237, 0 Feb 27 10:38 /dev/mmcblk0rpmb
brw-rw---- 1 root disk 179, 96 Feb 27 10:38 /dev/mmcblk1
brw-rw---- 1 root disk 179, 97 Feb 27 10:38 /dev/mmcblk1p1
brw-rw---- 1 root disk 179, 98 Feb 27 10:38 /dev/mmcblk1p2
root@am62axx-evm:/opt/edgeai-gst-apps# fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.35.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Partition number (1,2, default 2): 1

Partition 1 has been deleted.

Command (m for help): d
Selected partition 2
Partition 2 has been deleted.

Command (m for help): w

The partition table has been altered.
Failed to remove partition 1 from system: Device or resource busy
Failed to remove partition 2 from system: Device or resource busy

The kernel still uses the old partitions. The new table will be used at the next reboot.
Syncing disks.

step4: power on the EVM again, go to kernel and check if partitions deleted successfully.
root@am62axx-evm:/opt/edgeai-gst-apps# ls -l /dev/mmc*
brw-rw---- 1 root disk 179, 0 Feb 27 10:38 /dev/mmcblk0
brw-rw---- 1 root disk 179, 32 Feb 27 10:38 /dev/mmcblk0boot0
brw-rw---- 1 root disk 179, 64 Feb 27 10:38 /dev/mmcblk0boot1
crw------- 1 root root 237, 0 Feb 27 10:38 /dev/mmcblk0rpmb
brw-rw---- 1 root disk 179, 96 Feb 27 10:38 /dev/mmcblk1
brw-rw---- 1 root disk 179, 97 Feb 27 10:38 /dev/mmcblk1p1
brw-rw---- 1 root disk 179, 98 Feb 27 10:38 /dev/mmcblk1p2

step5: power on the EVM again, use uboot command to erase
Hit any key to stop autoboot: 0
=>
=> mmc dev 0 0
switch to partitions #0, OK
mmc0(part 0) is current device
=> mmc erase 0 2000

MMC erase: dev # 0, block # 0, count 8192 ... 8192 blocks erased: OK
=> mmc part

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

Part Start Sector Num Sectors UUID Type
bad MBR sector signature 0x0000

------------------------------------------------------------------------------------------------------

G. steps to check if system can boot from eMMC boot0 partition.
step1: switch to SD boot mode, insert SD card, power on the EVM.

step2: use uboot command to enable boot from boot0 partition.
Hit any key to stop autoboot: 0

=>
=> mmc partconf 0 1 1 1

=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK
=>

step3: remove SD card, switch to EMMC boot mode, power on the EVM.

------------------------------------------------------------------------------------------------------

F. steps to check if system can boot from eMMC user partition.
step1: switch to SD boot mode, insert SD card, power on the EVM.

step2: use uboot command to enable boot from user partition.
Hit any key to stop autoboot: 0
=>
=>
=> mmc partconf 0 1 7 1
=>
=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK

step3: remove SD card, switch to EMMC UDA boot mode, power on the EVM.

------------------------------------------------------------------------------------------------------

Note:

1. steps to check partconf
Hit any key to stop autoboot: 0
=>
=> mmc partconf 1
PARTITION_CONFIG only exists on eMMC
=> mmc partconf 0
EXT_CSD[179], PARTITION_CONFIG:
BOOT_ACK: 0x1
BOOT_PARTITION_ENABLE: 0x7
PARTITION_ACCESS: 0x1

2. steps to check bootpart
Hit any key to stop autoboot: 0
=>
=> printenv bootpart
bootpart=1:2

1                 :               2
0/emmc                      1/partition1
1/sd                            2/partition2

3. steps to check current active device/partition
Hit any key to stop autoboot: 0
=>
=> mmc dev 0 1
switch to partitions #1, OK
mmc0(part 1) is current device

0                   1
[dev]             [part]
0/emmc        0/UDA
1/sd              1/boot0
                     2/boot1