Project

General

Profile

Boot EMMC

NOTE: The AM62x has multiple MMC interfaces. The EMMC is configured on MMC0
NOTE: If you are using the eMMC as a back-up boot device, please refer to the "Using the eMMC as a backup boot device" section of this wiki.

To boot the Dev Kit from EMMC using a CL supplied image, set the boot pins as follows:
Reference: TRM Section 5.3 "Boot Mode Pins"

B3 B4 B5 B6 B7 B8 B9
1 0 0 1 Reserved (X) Reserved (X) Reserved (X)

emmc_boot.jpg

Based on the TI wiki procedure ( https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/08_03_00_19/exports/docs/linux/Foundational_Components/U-Boot/UG-Memory.html )

EMMC Layout

             boot0 partition (4 MB)                        user partition
     0x0+----------------------------------+      0x0+-------------------------+
        |      tiboot3.bin (512 KB)        |         |                         |
 0x80000+----------------------------------+         |                         |
        |        tispl.bin (2 MB)          |         |                         |
0x280000+----------------------------------+         |        rootfs           |
        |      u-boot.img (1.412 MB)       |         |                         |
0x3E1000+----------------------------------+         |                         |
        |      environment (124 KB)        |         |                         |
0x400000+----------------------------------+         +-------------------------+

Steps

  • Optional: Run through Clearing_the_eMMC if you want to test flashing a clean eMMC
  • Boot to linux using a valid sd card image
  • Make the partition label
    root@mitysom-am62x:~# parted /dev/mmcblk0 mklabel gpt
    
  • Make the partiton
    root@mitysom-am62x:~# parted /dev/mmcblk0 mkpart primary ext4 0% 100%
    
  • Print the newly created partition
    root@mitysom-am62x:~# parted /dev/mmcblk0 print
    Model: MMC KC3032 (sd/mmc)
    Disk /dev/mmcblk0: 31.3GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags:
    
    Number  Start   End     Size    File system  Name     Flags
     1      1049kB  31.3GB  31.3GB               primary
    
    
  • Manually mount the partition or Reboot
    root@mitysom-am62x:~# mkfs.ext4 /dev/mmcblk0p1
    root@mitysom-am62x:~# mkdir /run/media/mmcblk0p1
    root@mitysom-am62x:~# mount /dev/mmcblk0p1 /run/media/mmcblk0p1
    
    or
    
    root@mitysom-am62x:~# reboot
    
  • Check the partition table
    *root@mitysom-am62x:~# lsblk
    NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
    mmcblk0      179:0    0 58.3G  0 disk
    `-mmcblk0p1  179:1    0 58.3G  0 part /run/media/mmcblk0p1
    mmcblk0boot0 179:32   0    4M  1 disk
    mmcblk0boot1 179:64   0    4M  1 disk
    mmcblk1      179:96   0 29.8G  0 disk
    |-mmcblk1p1  179:97   0  128M  0 part /run/media/boot-mmcblk1p1
    `-mmcblk1p2  179:98   0 29.7G  0 part /*
    
  • enable writing to the mmcblk0boot0 partition
    root@mitysom-am62x:~# echo 0 > /sys/block/mmcblk0boot0/force_ro
    
  • Copy the needed images from the SD card to the eMMC boot partition
    root@mitysom-am62x:~# cd /run/media/boot-mmcblk1p1
    root@mitysom-am62x:~# dd if=tiboot3.bin of=/dev/mmcblk0boot0 bs=512 seek=0
    root@mitysom-am62x:~# dd if=tispl.bin of=/dev/mmcblk0boot0 bs=512 seek=1024
    root@mitysom-am62x:~# dd if=u-boot.img  of=/dev/mmcblk0boot0 bs=512 seek=5120
    
  • Enable the boot partition of the eMMC device
    root@mitysom-am62x:~# mmc bootpart enable 1 1 /dev/mmcblk0
    root@mitysom-am62x:~# mmc bootbus set single_backward x1 x8 /dev/mmcblk0
    
  • Copy the filesystem
    Note: Copying the tisdk-default image takes about 3 minutes
    root@mitysom-am62x:~# mkdir -p /mnt/sd-rootfs
    root@mitysom-am62x:~# mount /dev/mmcblk1p2 /mnt/sd-rootfs
    root@mitysom-am62x:~# cp -a /mnt/sd-rootfs/* /run/media/mmcblk0p1
    

    Note We do not recommend copying a live/booted filesystem as a way of imaging/copying a system. As written this provides an easy way to show the emmc works but it should be rewritten to program the emmc using outputs from yocto.
  • Power off the board
    root@mitysom-am62x:~# poweroff
    
  • Set the boot mode to boot from the eMMC and remove the SD card
    SW1 BM0-7 = xxx1001x
    SW2 BM8-15 = xx000000

emmc_boot.jpg

  • Toggle S1 to power on the board, and you should successfully boot to the login prompt.
  • Check to make sure we have booted from eMMC
    root@mitysom-am62x:~# lsblk
    NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
    mmcblk0      179:0    0 58.3G  0 disk
    `-mmcblk0p1  179:1    0 58.3G  0 part /    <----- */ should be on eMMC partition*
    mmcblk0boot0 179:32   0    4M  1 disk
    mmcblk0boot1 179:64   0    4M  1 disk
    
  • To test if eMMC fallback is functional, Toggle S1 to turn off the board, insert the SD card, power on and you should boot to linux.
  • Run the following command
    root@mitysom-am62x:~# lsblk
    NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
    mmcblk0      179:0    0 58.3G  0 disk
    `-mmcblk0p1  179:1    0 58.3G  0 part /run/media/mmcblk0p1
    mmcblk0boot0 179:32   0    4M  1 disk
    mmcblk0boot1 179:64   0    4M  1 disk
    mmcblk1      179:96   0 29.8G  0 disk
    |-mmcblk1p1  179:97   0  128M  0 part /run/media/boot-mmcblk1p1
    `-mmcblk1p2  179:98   0 29.7G  0 part /    <----- */ should be on MMC partition*
    

For regular development and potentially production programming, the eMMC can be programmed over USB. See Snagboot Boot and Flash eMMC Instructions

Hardware Reset setting

NOTE: We enable hw reset in our factory test environment, setting this yourself should not be necessary.

The eMMC part ships with hardware reset disabled. This caused reset/reboot to hang when booting from the eMMC.
To fix this, the HW reset needs to be enabled in the part. This is done by writing a 1 to the RST_N_FUNCTION CSD register in the part.
THIS IS A ONE-TIME-PROGRAMMABLE VALUE
If you write a 2 to this register, you will permanently DISABLE reset and effectively prevent using the eMMC as a boot device.

From linux

root@mitysom-am62x:~# mmc hwreset enable /dev/mmcblk0

The state of this register can be checked using the extcsd read command
root@mitysom-am62x:~# mmc extcsd read /dev/mmcblk0 | grep RST
H/W reset function [RST_N_FUNCTION]: 0x01

From U-Boot

mmc rst-function 0 1

Enabling boot partitions from u-boot

In addition, the emmc boot partitions can also be enabled from u-boot

mmc partconf 0 1 1 1
mmc bootbus 0 2 0 0

Using the eMMC as a backup boot device

When configured as a backup boot device (Table 5-5 in the TRM), the eMMC must be configured in "UDA filesystem mode." This is TRM terminology for saying you need to create a boot partition with your bootloader files. This differs from the "RAW" mode where you use dd to copy the bootloader files directly to the start of the eMMC device. For UDA filesytem mode, please follow these steps after you boot from the SD card:

# fdisk /dev/mmcblk0

Inside fdisk:

o        # Create new MBR partition table
n        # New partition
p        # Primary
1        # Partition number 1
<enter>  # Default start sector (2048)
+128M    # 128 MB for the boot partition (adjust if needed)
t        # Change type
c        # Set type to W95 FAT32 (LBA) — type 0x0c
a        # Mark partition 1 as bootable
w        # Write and exit

Then, format as FAT32

mkfs.fat -F 32 -n "BOOT" /dev/mmcblk0p1

Next, mount the new partition.

mkdir foo
mount /dev/mmcblk0p1 foo/

Copy the bootloader files from the SD card to the eMMC partition:

cp /run/media/boot-mmcblk1p1/* foo/

At this point, you can poweroff your board, remove the SD card, and apply power to boot from the eMMC.

Note that, at this point, only U-Boot is on the eMMC for testing purposes. Once you have the eMMC boot working, you can boot from the SD card and add a filesystem partition to the eMMC.

Finally, you will need to review your U-Boot configuration to make sure it is using the correct eMMC partitions.

There are many ways to configure your boot process. Ultimately, we suggest you create an SD card image via Yocto which can then be used to create an SD Card or copied to the eMMC (in both cases using dd). This allows you to skip the manual partitioning and filesystem steps described earlier in this section.

Please contact Critical Link for further assistance.

Go to top
Add picture from clipboard (Maximum size: 1 GB)