AR# 67157


Zynq UltraScale+ MPSoC: eMMC Programming Solutions


2018.1 Vivado can format and partition eMMC flashes (See (UG908) for reference).

This Answer Record is an alternative method and describes the steps to program an eMMC device for the first time using Zynq UltraScale+ MPSoC.

in both cases, after programming, the user can boot from eMMC up to Linux  and managed the eMMC partitions from there.


The steps are divided into 4 main sections:

  1. Creating a Xilinx bootable image (BOOT.bin and Image.ub)
  2. Creating the emmc.img
  3. Programming the emmc.img on the eMMC device
  4. Boot Linux from the eMMC device


1) Creating a Xilinx bootable image

Use the standard 2016.3 XSDK or Petalinux flow to create BOOT.bin and Image.ub. 

See (UG1137) Zynq UltraScale+ MPSoC Software Developer Guide

The image should be built to support eMMC as primary boot device.


2) Creating the emmc.img

From a Linux host machine, create the partition and copy the files.

dd if=/dev/zero of=emmc.img bs=512 count=65536
sudo parted emmc.img mktable msdos
sudo parted emmc.img mkpart p fat32 0% 100%
sudo kpartx -a emmc.img
sudo mkfs.vfat /dev/mapper/loop0p1
sudo mount /dev/mapper/loop0p1 /mnt/sata/
sudo cp BOOT.bin /mnt/sata/BOOT.bin
sudo umount /dev/mapper/loop0p1
sudo kpartx -d emmc.img

3) Programming the emmc.img on the eMMC device

a) Boot in JTAG boot mode (Mode Pins[3:0] = 0x0)

b) Using XSDB to download u-boot and emmc.img

exec sleep 4
targets -set -filter {name =~ "PSU"}
# write bootloop and release A53-0 reset
mwr 0xffff0000 0x14000000
mwr 0xFD1A0104 0x380E
exec sleep 1
# download and run FSBL
targets -set -filter {name =~ "Cortex-A53 #0"}
# downloading FSBL
dow zynqmp_fsbl.elf
exec sleep 4
exec sleep 1
mwr 0xFF18031C 0x64406440  
mwr 0xFF180314 0x01150000        
mwr 0xFF180318 0x00450043
exec sleep 1
dow u-boot.elf
dow bl31.elf
dow -data emmc.img 0x8000                 
(NOTE: This step can be replaced by "tftpb 8000 emm.img" from u-boot prompt to improve transfer speed)

c) Programming steps from u-boot prompt:

mmc write 8000 0 10000       

Note: The First entry is the address, the last entry is $filesize/512


d) Verification steps from the u-boot prompt:

mmc rescan
mmc part
************* Output Example ******************
Partition Map for MMC device 0  --   Partition Type: DOS
Part    Start Sector    Num Sectors     UUID                   Type
  1       1                       65535                 000cbbb0-01     0c

4) Boot Linux from the eMMC device

Boot in eMMC boot mode (Mode Pins[3:0] = 0x6)

AR# 67157
Date 07/03/2018
Status Active
Type General Article
People Also Viewed