Various ways to load images into EMMC on TechNexion products

Difficulty Levels: Intermediate
Date added: July 18, 2019
Affected Products: EDM-GNOME , EDM-GNOME-IMX7 , EDM-IMX7 , EDM1-CF-IMX6 , EDM1-CF-IMX6SX , EDM1-FAIRY , EDM1-FAIRY-IMX6 , EDM1-GOBLIN , EDM1-IMX6 , EDM1-IMX6UL , EDM2-ELF , EDM2-GREMLIN , EDM2-IMX6PLUS , PICO SERIES , PICO-DWARF , PICO-HOBBIT , PICO-IMX6 , PICO-IMX6UL , PICO-IMX6ULL , PICO-IMX7 , PICO-IMX8M , PICO-IMX8M-MINI , PICO-NYMPH , PICO-NYMPH-IMX6 , PICO-PI , PICO-PI-8M , PICO-PI-IMX7 , PICO-PI-IMX8M , PICO-PI-IMX8M-MINI , TC-0700 , TC-0710 , TC-1010 , TEK3-BSW , TEK3-IMX6 , TEK3-IMX6UL , TEP-0500-IMX6UL , TEP-0500-IMX7 , TEP-0700-IMX6UL , TEP-0700-IMX7 , TEP-1010-IMX6 , TEP-1560-IMX6 , TWP-1010-IMX6 , TWP-1560-IMX6 , WBDUAL , WBQUAD , WBSOLO

One of the first things developers need to be able to do when working embedded products is to load images onto it.

An “image” in this case, is a monolithic digital file that comprises the entirety of the content of the EMMC, from the boot partition, through the Secondary Program Loader (SPL), through the various partitions. Usually, there are a minimum of two partitions (boot, and root filesystem). However, there could be many partitions depending on the setup, if you have an A/B partitioning scheme.

1. Use the Rescue Loader

All TechNexion SOMs ship with what we call the “rescue loader” pre-loaded into EMMC. This rescue loader provides a convenient way to load various images onto the unit for evaluation. In order to use it, you simply have to assemble the unit, install a display, connect an ethernet cable, and use the graphical user interface (GUI) to download and install a selection of images from TechNexion’s FTP server.

Note that this method is only used to load an image on our FTP server onto the unit. It cannot be used to load a custom image, or one that you’ve built yourself and want to try. For that, you can use the U-boot ‘ums’ command, or you can also use the Universal Update Utility (or “uuu”).

2.  Use the U-boot ‘ums’ Command

In more recent versions of our u-boot (called ‘u-boot-edm’) we have enabled the ‘ums’ command (USB Mass Storage).  Using this command, you can cause the SOC to ‘export’ the EMMC (or even an SD card) device as a mass storage device to the host computer. Think about this like a flash drive.  Once the EMMC or SD card is visible as a USB mass storage device on your host machine, you can write an image to it using your favorite utility.

Utilities used by Host OS Type:

LInux:

Windows:

Mac OS:

  • dd

Cross-platform:

There is also a nice tool that works across many platforms (LInux, Windows, Mac OS) from Balena called Etcher.

One of the main advantages of using UMS is there is no need to change the physical boot configuration of the SOM (boot jumpers, boot switches, etc.). You can update the ENTIRE image this way, including the bootloader. This also means you can corrupt the EMMC in case the process fails for one reason or another, so this is good to use during development where the product can be recovered, but is not an ideal method for field updates.

Platform Support

As of the writing of this article, UMS support is being added for our products starting with PICO-IMX8M-MINI, PICO-IMX8M, and PICO-IMX6.  UMS support for TechNexion SOMs is only available in u-boot versions 2018.03 and later. Not all SOMs may be supported at this time, but it is our goal to have this support for all SOMs eventually.

Steps

1)  Get a debug console and serial terminal set up

These commands require you to connect to the serial (UART) debug console on your board. On our “PI” form-factor boards such as PICO-PI, FLEX-PI, and AXON-PI, the debug console is available through a USB-UART bridge chip on the board itself.  On PICO-DWARF, PICO-HOBBIT, and PICO-NYMPH, a separate cable is needed. Here is an article showing you how to connect it.

Connecting the USB-UART cable to the PICO-DWARF, PICO-HOBBIT, and PICO-NYMPH baseboards

After connecting your cable and getting a serial terminal program running, you can power up and then reset your board.  The first thing it will do is load U-boot (the main bootloader for Linux).  When you see the text “Hit any key to stop autoboot: “, hit a key to stop the boot process and you should see a boot prompt.

2)  Get a list of available MMC devices

You need to get a list of available MMC devices. Depending on the product, this might vary from 1 to 2 devices, but usually not more than 2.  The two devices would be the primary EMMC or the SD card. To do this, you would run the ‘mmc list’ command in U-boot:

=> mmc list
FSL_SDHC: 0 (SD)
FSL_SDHC: 1

In the above example, you see that device 0 is an SD card, and device 1 is an EMMC (by process of elimination).

3) Run the ums command to export the EMMC to the host computer

Run the following command – since the EMMC is device 1, you would run ‘ums 0 mmc 0’

=> ums 0 mmc 1
UMS: LUN 0, dev 1, hwpart 0, sector 0x0, count 0xe90000
/

While UMS is running, you will see a rotating cursor (like a pinwheel), and you won’t get another boot prompt until after you are done and have exited UMS.

At this point in time, your host computer should see a USB mass storage gadget connected. This should appear as a USB mass storage device (a block device). If there is no boot partition or anything else loaded onto it (i.e. the EMMC could be blank), you won’t see any drives available.

Use one of the above utilities to load the EMMC, and then when it is done you and exit UMS by pressing CTRL-C in the serial console window. Then you can reset your unit. If everything loaded well, your unit should load the OS image that you just wrote to the EMMC.

3.  Use the Universal Update Utility (uuu)

We’ll add more instructions here – please check back soon!

 

 

Stay up to date with all the latest TechNexion news...

Sign-up for our Newsletter