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.

Understanding u-boot-min startup for DM814x

From Texas Instruments Wiki
Jump to: navigation, search

Intro[edit]

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[edit]

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/config.mk
    • 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/u-boot.lds
    • 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[edit]

  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 code/data.
    • 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.
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 Understanding u-boot-min startup for DM814x 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 Understanding u-boot-min startup for DM814x here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Understanding u-boot-min startup for DM814x here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Understanding u-boot-min startup for DM814x here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Understanding u-boot-min startup for DM814x here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Understanding u-boot-min startup for DM814x here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Understanding u-boot-min startup for DM814x here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Understanding u-boot-min startup for DM814x here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Understanding u-boot-min startup for DM814x 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