NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

OMAP-L138 Preparing SD Card for Boot

From Texas Instruments Wiki
Jump to: navigation, search

This document describes the boot process of the OMAP-L138 ARM+DSP SOC. The content also applies to AM1808 and C6748 devices unless otherwise specified.

Introduction[edit]

Starting with silicon revision 2.1, OMAP-L138 now supports SD/MMC boot directly from a card. This eliminates the need for a separate UBL that boots from on-board flash memory.

Formatting Requirements[edit]

The bootloader requires that the AIS boot image be placed within the first 2MB and sector-aligned. The image is read raw so the image must be in an unformatted partition of the card.

TI Tools[edit]

  • Serial Flashing Tools: The most recent version of the serial flashing tools now contains CCS3.3 ARM and DSP projects flashing a file to an SD/MMC card using the EVM. They may also be imported to CCS4 or CCS5.
  • Linux SDK: The Linux Software Development Kit (SDK) provides scripts for formatting SD/MMC cards for Linux kernels and file systems.

Procedures[edit]

Booting a Stand-Alone Image[edit]

When no other partitions or file systems are needed on the SD/MMC card, you can directly write an AIS-signed executable to the start of the SD/MMC card. This can be performed using CCS or Linux:

CCS[edit]

To flash a single AIS image, open SDMMCWriter_ARM.pjt (or DSP) located in the "OMAP-L138\CCS\SDMMCWriter\" directory of the serial flashing tools. For CCS4/5 it will need to be imported in order to rebuild the flashing tool.

Follow the following steps

  • Load the EVM GEL file
  • Connect to the ARM core (or DSP core)
  • Load the SDMMCWriter_ARM(DSP).out and run
  • Type "y" when asked if you will be writing a UBL image
  • Type the name of the AIS file to flash
  • Type "none" when asked to enter the application file name

The file should now be successfully flashed to the SD/MMC card. Change the boot switches to SDMMC0 boot mode and power cycle to verify.

Linux[edit]

  • Insert the SD/MMC card into a Linux host.
  • Type "dmesg". The SD/MMC card name should show up near the end, usually something like "SDC".
  • Type "sudo dd if=ais_file.bin of=/dev/sdx", where ais_file.bin is the file to flash and "sdx" is the name determined in the previous step.

The file should now be successfully flashed to the SD/MMC card. Change the boot switches to SDMMC0 boot mode and power cycle to verify.

Booting Linux[edit]

In order to boot Linux entirely off the SD/MMC card, there must be 3 separate partitions:

  1. Unformatted partition to flash AIS-signed U-Boot image
  2. FAT32 file system to store the Linux kernel for U-Boot to read
  3. EXT3 file system to store the file system Linux will mount

Perform the following steps to set up the card:

  • On a Windows machine, use AISgen to convert the U-Boot binary to a bootable AIS file.
    • You must specify the entry point as shown below in addition to the load address (adding @ to the application file). Be sure to do both. The ARM Application File defaults to @0x8000000 and will be loaded to the wrong address if you don't explicitly modify it!
    • Certain version of U-Boot do not enable the UART2 PSC, so select "Configure PSC" and in the PSC tab, type "13" in the "Enable LSPC" field for PSC1.

Uboot.jpg

  • On the Linux host, use the "mksdboot.sh" script found in the /bin/ directory of the SDK install as follows, where "sdx" is where the SD/MMC card is detected:

sudo mksdboot.sh --device /dev/sdx --sdk <base directory of SDK install>

  • After it has completed, remove and reinsert the card. You should see two partitions, one with uImage and another with the file system mounted.
  • Now write the AIS-signed U-Boot directly to the card. To prevent overwriting the boot table, write to offset 10 of the card as follows:

sudo dd in=u-boot.ais of=/dev/sdx seek=10

The SD card should now be successfully prepared. Change the boot switches to SDMMC0 boot mode and power cycle to verify.

A Complete procedure on How to boot Linux from SD/MMC card on OMAP138 SDI EVM[edit]

Formatting the SD/MMC card[edit]

In order to boot Linux entirely off from the SD/MMC card, there must be 4 separate partitions (The 4th partition is optional): In other ways, need to create SD card into 3 partitions with leaving atleast ~500K space before the first cylinder for keeping the u-boot binary.

   1. Unformatted partition to flash u-boot.bin image.
   2. FAT32 file system to store the Linux kernel for U-Boot to read.
   3. EXT3 file system to store the file system. Linux will mount.
   4. EXT3 file system to store the media files.

Format the SD/MMC card using Linux Host PC: Download the below script files to format the SD/MMC card.

File:Create-sdcard-omapl13x.zip

   1. Insert the SD/MMC card into a Linux host PC.
   2. Type "dmesg". The SD/MMC card name should show up something like "sdb" or “mmcblk0” .
   3. Type "'sudo sh create-sdcard-omapl13x.sh /dev/sdx'", where "sdx" is the name determined in the previous step.

Preparation of SPL and u-boot binaries[edit]

For SPL & u-boot,

   1. Change the working directory to uboot source folder.
   2. Build u-boot source for OMAPL138 SDI EVM board with mmc support.
   3. Convert the SPL bin to AIS signed format.

Linux Commands

    host# cd DaVinci-PSP-SDK-03.22.00.06/src/u-boot/u-boot-davinci
    DaVinci-PSP-SDK-03.22.00.06/src/u-boot/u-boot-davinci# make distclean CROSS_COMPILE=arm-none-linux-gnueabi-
    DaVinci-PSP-SDK-03.22.00.06/src/u-boot/u-boot-davinci# make da850sdi_mmc_config CROSS_COMPILE=arm-none-linux-gnueabi-
    DaVinci-PSP-SDK-03.22.00.06/src/u-boot/u-boot-davinci# make
all CROSS_COMPILE=arm-none-linux-gnueabi-
    DaVinci-PSP-SDK-03.22.00.06/src/u-boot/u-boot-davinci# tools/mkimage -s -n
/dev/null -T aisimage -e 0x80000000 -d spl/u-boot-spl.bin spl/u-boot-spl.ais

Flash the SPL AIS file into SPI flash[edit]

1. DIP switch settings for UART boot mode.

Pin# 1 2 3 4 5 6 7 8
Position OFF OFF OFF OFF OFF ON OFF OFF

2. Flash the SPL AIS signed binary into SPI flash through serial flasher tools.

3. Type "./sfh_OMAP-L138.exe -flash_noubl u-boot-spl.ais -targetType OMAPL138_LCDK -flashType SPI_MEM" to flash SPL ais signed binary to SPI flash. Please note, here the target type is given as "OMAPL138_LCDK" instead of "OMAPL138". Click here for more information on serial flasher utility.

Flash the U-Boot file built for SPI flash into SD’s unformatted partition[edit]

   1. Insert the formatted SD/MMC card into a Linux host PC.
   2. Flash the u-boot binary into unformatted SD card partition.
   3. Change the working directory to uboot source folder.
   4. Type "tools/uflash/uflash -d /dev/sdb -b u-boot.bin -p OMAPL138 -vv" to flash SPL binary to SPI flash.

Successful sample Log:

ti-e2e/OMAPL138_SDI_EVM/DaVinci-PSP-SDK-03.22.00.06/src/u-boot/u-boot-davinci# sudo tools/uflash/uflash -d /dev/sdb -b u-boot.bin -p OMAPL138 -vv

OMAPL138
U-Boot Size 186595
First partition starts at 32130(16450560)
U-Boot Magic Number     : a1aced66
U-Boot Entry Point      : c1080000
U-Boot Number of Blocks : 0000016d
U-Boot Starting Block   : 00000075
Load U-Boot Address     : c1080000
Writing U-Boot Signature
Writing U-Boot
Done...

Preparation of kernel image[edit]

   1. Change the directory to kernel source folder.
   2. Export your tool chain path.
   3. Configure and build the kernel for OMAPL138 SDI EVM board.
   4. Copy the kernel image into 1st FAT partition (boot) of SD/MMC card.

Linux Commands:

    host# cd DaVinci-PSP-SDK-03.22.00.06/src/kernel/linux-davinci
    DaVinci-PSP-SDK-03.22.00.06/src/kernel/linux-davinci# export ARCH=arm
    DaVinci-PSP-SDK-03.22.00.06/src/kernel/linux-davinci# export CROSS_COMPILE=arm-arago-linux-gnueabi-
    DaVinci-PSP-SDK-03.22.00.06/src/kernel/linux-davinci# make da850_sdi_defconfig
    DaVinci-PSP-SDK-03.22.00.06/src/kernel/linux-davinci# make uImage
    DaVinci-PSP-SDK-03.22.00.06/src/kernel/linux-davinci# cp -r arch/arm/boot/uImage /media/boot

Preparation of file system[edit]

   1. Copy the OMAPL138 LCDK's linux SDK file system to "rootfs" partition.
   2. Untar the file system tar ball into 2nd partition (rootfs) of SD/MMC card.
   2. Do safe remove the SD/MMC card from host PC.

Example:

   1. cd /media/rootfs
   2. /media/rootfs# cp -rf /home/<user>/ti-sdk-omapl138-lcdk-01.00.00/filesystem/omapl138-lcdk-fs.tar.gz .
   3. /media/rootfs# tar -zxvf omapl138-lcdk-fs.tar.gz
   4. /media/rootfs# cd /
   5. # sync
   6. # umount /media/rootfs

SD/MMC boot[edit]

   1.	Settings DIP switch to SPI boot mode.
Pin# 1 2 3 4 5 6 7 8
Position OFF OFF OFF OFF OFF ON ON OFF
   2. Hit any key to stop the auto boot of u-boot.
   3. Provide the bootcmd and bootargs to boot the kernel image from SD/MMC 1st partition

and mount the ext3 file system on SD/MMC's 2nd partition.

   4. Now,the OMAPL138 SDI EVM board will boot SPL code from SPI flash and take u-boot from SD/MMC card.

Setting bootargs and bootcmd[edit]

Bootcmd should be set to copy and boot uImage from the first partition of the micro-SD card. The bootargs should be set to take root file system from the second partition of the micro-SD card.

setenv bootargs 'mem=32M console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait ip=off'
setenv bootcmd 'mmc rescan 0;fatload mmc 0 0xc0700000 uImage; bootm c0700000;'
E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article OMAP-L138 Preparing SD Card for Boot here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article OMAP-L138 Preparing SD Card for Boot here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article OMAP-L138 Preparing SD Card for Boot here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article OMAP-L138 Preparing SD Card for Boot here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article OMAP-L138 Preparing SD Card for Boot here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article OMAP-L138 Preparing SD Card for Boot here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article OMAP-L138 Preparing SD Card for Boot here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article OMAP-L138 Preparing SD Card for Boot here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article OMAP-L138 Preparing SD Card for Boot here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity