Sei sulla pagina 1di 2

Understanding u-boot-min startup for DM814x

From Texas Instruments Wiki


After several hours of grepping and looking at disassembly windows I thought this might be a helpful starting point in understanding the boot process for u-boot-min on
the DM814x.

Key Files and Symbols

Currently this article is based off the early adopter u-boot(-min) for DM816x/DM814x. All paths below are relative to the u-boot root directory.

◾ Makefile
◾ Main rules for building u-boot(-min) located under name "ti8148_evm_*".
◾ TEXT_BASE as defined in this rule specifies where u-boot(-min) will ultimately execute from. If u-boot gets loaded to a different address (e.g. this would
happen during many of the boot modes) then the code will relocate itself to the address specified by TEXT_BASE.
◾ When building u-boot-min the make target is specified as "u-boot.ti". The u-boot.ti target is defined in this file. Specifically it invokes mkimage with a
custom type of "tiimage". The corresponding code is located in tools/tiimage.c.
◾ board/ti/ti8148/
◾ TI_LOAD_ADDR specifies the address where the ROM code is to load the image.
◾ Typically you would see TI_LOAD_ADDR = 0x40300000 (OCMC RAM).
◾ tools/tiimage.c
◾ Code utilized by mkimage for the "u-boot.ti" type image as utilized by u-boot-min.
◾ Function ti814ximage_set_header() adds a TI-defined header to the u-boot binary during the mkimage step. The header starts out with the "GP Device
image format" which the ROM code expects to see. This consists of size, destination, and the image itself. The image itself is also manipulated slightly. A
branch instruction (0xe51ff004) gets stuffed into the beginning of the image along with the address to which it will branch. The address to which it
branches is based off the entry point (TI_LOAD_ADDR) plus an offset to allow for stack.
◾ arch/arm/cpu/arm_cortexa8/
◾ Linker command file
◾ First section to get linked into the image is start.o
◾ arch/arm/cpu/arm_cortexa8/start.S
◾ First thing in start.S is reset vector (at label _start) which contains a branch to "reset".
◾ The "reset" code calls cpu_init_crit() which has setup specific to Cortex-A8.
◾ The cpu_init_crit() code calls lowlevel_init (getting into device-specific code)
◾ arch/arm/cpu/arm_cortexa8/ti81xx/lowlevel_init.S
◾ Contains initialization code for GPMC
◾ Calls s_init() which is in board/ti/ti8148/evm.c
◾ board/ti/ti8148/evm.c
◾ Contains s_init() function which sets up PLLs, DDR (only when running from SRAM), and pin muxing

Boot Timeline

1. Boot ROM executes

◾ Sets up clocks
◾ Determines boot mode
2. For "memory booting" (NAND, SD, etc) the ROM code expects to find an image. The image header should consist of the size, destination, and the actual
◾ The image header expected by the ROM code is already created during the build process during the mkimage step.
◾ The size is calculated automatically during the mkimage step.
◾ The destination is configured by TI_LOAD_ADDR.
3. The boot ROM copies "size" bytes to "destination" and then branches to "destination".
4. The first thing executed at "destination" is a branch instruction to the reset vector. (This branch instruction was stuffed in there as part of the tiimage process of
the mkimage step.)
5. Now the assembly functions start executing:

reset (arch/arm/cpu/arm_cortexa8/start.S)

cpu_init_crit (arch/arm/cpu/arm_cortexa8/start.S)

lowlevel_init (arch/arm/cpu/arm_cortexa8/ti81xx/lowlevel_init.S)

s_init (board/ti/ti8148/evm.c)

lowlevel_init (arch/arm/cpu/arm_cortexa8/ti81xx/lowlevel_init.S)

cpu_init_crit (arch/arm/cpu/arm_cortexa8/start.S)

reset (arch/arm/cpu/arm_cortexa8/start.S)

6. The reset function will now relocate the code from TI_LOAD_ADDR to TEXT_ADDR
7. The reset function branches to "start_armboot" C function, which is now at the relocated address.

For technical support please post your questions at Please post only comments about the article
Understanding u-boot-min startup for DM814x here.

Amplifiers & Linear DLP & MEMS ( ◾ ARM Processors
( High-Reliability ( (
Audio ( Interface ( ◾ Digital Signal Processors (D
Broadband RF/IF & Digital Radio Logic ( (
( Power Management ◾ Microcontrollers (MCU)
Clocks & Timers ( (
( ◾ OMAP Applications Proce
Data Converters (
( processors/the-omap-exper

Retrieved from ""

◾ This page was last modified on 28 February 2011, at 12:45.

◾ This page has been accessed 5,316 times.
◾ Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.