As stated in my last post eMMC memory devices are quickly replacing native NAND memory on embedded devices. This can not happen soon enough in my opinion. If anyone has worked with native NAND and tried to get these working knows exactly what I am talking about.

The BeagleBone Black utilizes a 2Gb eMMC memory part for local, on board, bulk non-volatile storage. On later rev C boards the part was upgraded to 4Gb with no change in the footprint.

To fully support eMMC on the community BSP several modifications had to be made. Several drivers (SDHC, SDMEMORY and FATFS) had to be modified as well as the boot code. Support for sector mode addressing (eMMC parts greater than 2Gb) was also added.

The sdmemory driver needed some tweaks but for the most part the sdmemory library included with WEC2013 and WEC7 works as-is. This library handles the commands issued to the SD/SDHC/MMC/eMMC device and is also responsible for detecting which flavor of device is connected, among other tasks.

The SDHC also needed modification as this is the hardware specific layer that interfaces directly to the AM335x MMC/SDIO on-chip controller. The AM335x processor actually has three instances of the controller. One is connected to the uSD card cage on the Beaglebone, another is connected to the eMMC device and a third is not used. The uSD card cage is connected as a 4bit interface while the eMMC is connected as an 8bit interface (one of the subtle differences).

Once the drivers are working both devices (uSD and eMMC) should be able to mount as a separate drive under Windows Embedded. This is the easy part, much harder to develop and debug is the boot code. Basically, the same driver functionally has to be pushed down into the boot code but without the added benefits of a running OS. Things like threading and most of the API call are not available in the boot code. You also have limited operating memory and some very strict formatting requirements as imposed by the AM335x (I won’t go into all the gory details).

Partitioning is the next task. As I have stated before, the BeagleBone comes with Linux and the eMMC device comes from the factory with two working partitions. Unfortunately the factory FAT32 formatted boot partition is too small for most Windows Embedded images so re-partitioning is required.

I like having two partitions, one I’ll call the “BOOT” partition and this will hold the MLO, EBOOTSD.NB0 and NK.BIN files. It will also hold the hive based persistent registry files created after initial boot up. The second, larger partition will be the “Hard Disk” partition and is available for application use.

I created a “DISKPARTEMMC.EXE” partitioning tool and included it in the image to help with the partitioning and formatting tasks needed to properly configure the eMMC device for initial use. A simple batch file will kick off a script which will partition, format and copy the boot files to the eMMC memory. To use this tool it is very important to remember this batch file must ONLY be run when you have initially booted the device from a properly formatted uSD card (see on-line documentation on the community BSP’s for uSD card creation).

Here is what happens:

  1. Create uSD card with all bootable files.
  2. Place uSD card is BeagleBone’s uSD card cage.
  3. Press user button and power on (pressing user button during power up forces boot from uSD card).
  4. Open a command prompt.
  5. Execute the PREPEMMC.BAT file in the \windows directory.


  1. Prompt you to make sure you booted from uSD card.
  2. Run the diskpartemmc executable with the partemmc.txt script file.
  3. The script will:
  4. Clean the MBR deleting all existing partitions.
  5. Create a primary partition of approximately 100Mb for the boot files.
  6. Format the boot partition as FAT32.
  7. Mark the boot partition as ACTIVE.
  8. Create a second partition with all remaining space on the eMMC device.
  9. Format the partition FAT32.
  10. The script will return and the batch will take over
  11. Batch file will copy MLO, EBOOTSD.NB0 and NK.BIN from the storage card to the boot partition.
  12. Remove the uSD card and cycle power.
  13. The BeagleBone should now boot directly from the eMMC device.

A few things to note: The same image file set (MLO, EBOOTSD.NB0 and NK.BIN) works on the BeagleBone White and Black as executed from a uSD card or the BeagleBone Black executed from ether a 2Gb or 4Gb eMMC. Unlike other BSPs there is no need build separate images or keep track of several file sets based on which device you are booting from!

David Vescovi