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.
Secondary Bootloaders on OMAP-L1x
Contents
NOR Legacy[edit]
This topic describes the development of a secondary bootloader used for NOR legacy boot on an OMAP-L1x or C674x device. The NOR legacy boot mode forgoes the more sophisticated Application Image Script (AIS) boot system to simplify boot. A NOR legacy image consists of a single block of program data stored at the head of NOR (EMIFA chip select 2, or address 0x60000000). At boot, the bootloader copies this block to L2RAM and jumps directly into the copied code starting at address 0x11800004.
No integrated tool exists to prepare NOR legacy boot images, so this topic provides step-by-step instructions. Please note that boot modes and implementations vary between devices. This topic applies only to OMAP-L1x and C674x devices.
NOR Configuration Word[edit]
OMAP-L1x and C674x devices have three separate NOR bootmodes, but all three share the same boot pin selection values. The bootloader distinguishes between the three boot modes by reading the first 32-bit word of NOR. This word is called the NOR Configuration Word. For NOR Legacy boot, the configuration word should look like this:
Bit | Field | Value | Description |
31-12 | Reserved | 0 | Reserved |
11-8 | COPY | 0x0 1 KB
0x1 2 KB ... 0xE 15 KB 0xF 16 KB |
Length of data to copy from the base of the NOR Flash to the base of the digital signal processor
(DSP) L2 RAM. This value is used only for the Legacy NOR boot method. |
7-6 | Reserved | 0 | Reserved |
5-4 | METHOD | 0 | Legacy NOR boot |
3-1 | Reserved | 0 | Reserved |
0 | ACCESS EMIFA | 0x0 8-bit access
0x1 16-bit access |
access mode |
To summarize: the NOR Configuration word takes the form 0x00000X0Y, where (X + 1) is the size in KB of the NOR legacy boot image and Y selects either 8- or 16-bit NOR access.
The first step in building a secondary bootloader application is to determine how much space the appliation data will occupy in memory. Using this, determine the necessary value of the NOR configuration word. Note that 16 KB is the largest possible application size for NOR legacy boot. Larger application sizes may require the use of an alternate boot mode.
Building the Secondary Bootloader Application[edit]
Once the configuration word is finalized, the application source and linker command files are next. The linker must not place any program data or initialization sections in memory outside the first 16 KB (or smaller, depending on your NOR configuration word) of L2RAM. Furthermore, the very first word of L2RAM must be reserved for the NOR configuration word. An example linker command file may have the following form:
Linker Command File (DSP) | Linker Command File (ARM) |
---|---|
-stack 0x1000 -heap 0x1000 MEMORY { CFG_L2RAM: o = 0x11800000 l = 0x00000020 PROG_L2RAM: o = 0x11800020 l = 0x00003FE0 } SECTIONS { .entryPoint > PROG_L2RAM .text > PROG_L2RAM .data > PROG_L2RAM .const > PROG_L2RAM .far > PROG_L2RAM .switch > PROG_L2RAM .cinit > PROG_L2RAM .bss > PROG_L2RAM .cio > PROG_L2RAM .stack > PROG_L2RAM .sysmem > PROG_L2RAM .nor_cfg_word > CFG_L2RAM } |
-stack 0x1000 -heap 0x1000 MEMORY { CFG_L3RAM: o = 0x80000000 l = 0x00000020 PROG_L3RAM: o = 0x80000020 l = 0x00003FE0 } SECTIONS { .entryPoint > PROG_L3RAM .text > PROG_L3RAM .data > PROG_L3RAM .const > PROG_L3RAM .far > PROG_L3RAM .switch > PROG_L3RAM .cinit > PROG_L3RAM .bss > PROG_L3RAM .cio > PROG_L3RAM .stack > PROG_L3RAM .sysmem > PROG_L3RAM .nor_cfg_word > CFG_L3RAM } |
Note that a 32-byte section is set aside for the exclusive use of the configuration word. This is the minimum allowed section size in some cases, and it is a safe value to use.
The NOR configuration word must now be inserted into the secondary bootloader's source code. This can be done using a simple assembly source file:
.global _c_int00 .sect ".nor_config_word" config_word: .word 0x00000F01 B _c_int00 NOP NOP NOP NOP NOP NOP
At boot, the bootloader will jump to address 0x11800004 (0x80000004 on ARM), then branch from there to the secondary bootloader's actual entrypoint. Note that this assumes that the standard RTS library entrypoint, _c_int00, is used. To use an alternate entrypoint, the branch (B) instruction argument must be changed.
With the NOR configuration word placed at 0x11800000 and the program data confined to the first 16 KB of L2 RAM, the secondary bootloader should now be ready to build (for DSP - for ARM, the NOR configuration word placed at 0x80000000 and the program data is confined to the first 16 KB of L3 RAM). Compile and link the application.
Extracting the Binary Image[edit]
The application executable (.out) must now be converted to a raw binary image. TI's code generation tools include utilities to do this, but it is a complicated task. Locate the hex utility in your code gen tools' bin folder. (The DSP version should be named hex6x.exe, and the ARM version should be hex470.exe.)
Next, create a utility command file (.cmd) to hold the complicated parameters that will tell the utility what we want to do. The contents of this file should be as follows:
hex6x.exe Command File (DSP) | hex470.exe Command File (ARM) |
---|---|
-b -image -zero -memwidth 8 -linkerfill -fill 0x00000000 ROMS { FLASH: org = 0x11800000, len=0x4000, romwidth=8 } |
-b -image -zero -memwidth 8 -linkerfill -fill 0x00000000 ROMS { FLASH: org = 0x80000000, len=0x4000, romwidth=8 } |
This tells the utility to extract all sections contained in the 16-KB block starting at the head of L2RAM (DSP) or L3RAM (ARM). The contents of these sections will be dumped to a binary file and fill any unoccupied space with 0-valued words. Call the script with the following command line instruction (with "secondary_bl" replaced by your actual file names):
DSP:
hex6x.exe secondary_bl.cmd -o=secondary_bl.bin secondary_bl.out
ARM:
hex470.exe secondary_bl.cmd -o=secondary_bl.bin secondary_bl.out
The resulting binary file should now be ready to flash to a NOR device. Use a hex editor to double-check that the binary file contents seem correct. The first word in the binary file should be the NOR configuration word in little-endian order.
NOR Direct[edit]
Preparing an image for NOR Direct boot mode is similar to NOR legacy, with a few modifications:
- Coming soon