本人总结了关于TI DSP的boot原理,格式,以及参考代码供大家参考。不足之处,敬请指正。
2014.12.8: 更新:改成CCSV5.5工程,内容稍做修改与简化。
也可以参考Starterware里的bootloader example,说明如下:
C6748 StarterWare Booting And Flashing
The StarterWare Bootloader[edit]
The StarterWare bootloader is a platform-specific helper application that makes it easy to transition from running a StarterWare application in a debug context (i.e. in Code Composer Studio with a GEL file) to a production context (i.e. running the application automatically when the board is powered on). The bootloader acts as an intermediary between the ROM bootloader (RBL) and the application. During boot, the StarterWare bootloader takes the following actions:
- Applies common PLL and DDR/EMIF settings
- Copies application program and data sections from flash memory to DDR
- Jumps to application entrypoint
If the bootloader encounters an error during boot, it prints diagnostic messages to the UART console.
The StarterWare bootloader comes pre-built with the standard installation and typically does not need to be modified or rebuilt unless you want to port it to a custom hardware platform. The prebuilt binary can be found in the following location:
<StarterWare Installation Path>/binary/armv5/<toolchain>/c6748/evmC6748/bootloader/Release/boot.out
Booting a StarterWare Application[edit]
Binary Image Generation[edit]
Booting a StarterWare application requires two binary images:
- An AIS file containing the StarterWare bootloader
- A binary file containing the application
These images are generated using two separate tools, both of which are included in the tools folder of the standard StarterWare installation.
Using AISgen to Create the Bootloader AIS File[edit]
The AISgen GUI can be used to generate the StarterWare bootloader AIS file. All of the critical settings are located on the General tab of the AISgen GUI:
- Boot Mode - Set to SPI0 Flash
- Application File - Set to bootloader .out file
- AIS Output File - Desired AIS file name/path
The AISgen tool has many options to configure the device at boot time, but these are generally not necessary since the StarterWare bootloader will boot very quickly and apply its own configuration immediately. The following screenshot shows the typical settings that should be specified to generate the bootloader AIS file. Simply click the Generate AIS button to create the AIS file.
You will typically need to generate the bootloader AIS file only once. That same AIS file can be used with any number of different applications.
Using out2rprc to Create the Application Binary[edit]
The out2rprc command line utility is used to generate the application binary image. This tool strips out the initialized sections from the executable file (i.e. *.out) and places them in a compact format that the StarterWare bootloader can understand. Generating this binary file is very simple:
$> out2rprc.exe [application].out [application].bin
The output (bin) file is typically much smaller than the original executable (out) file.
Flashing the Application[edit]
Once you have generated both binary images (i.e. the AIS and bin files described above), you are ready to flash these images to the EVM's SPI flash memory. This can be done using the standard serial flasher utility that's included in the tools folder of the standard StarterWare installation:
- Set the boot switches for UART2 boot (5:8 = 0011 on EVM)
- Run SFH from the command line:
-
$> sfh_OMAP-L138.exe -flash -targetType C6748 [bootloader].ais [application].bin
-
- Power on or reset the EVM
The SFH tool may take several minutes to complete depending on the size of the application. When SFH completes successfully, your application is ready to boot.
The SFH tool automatically adds simple header information to the application binary file. This header tells the bootloader basic information about the application contents, including its total size in bytes.
Booting the Application[edit]
After the binary images have been flashed to the EVM, the application is ready to boot. This is as simple as setting the boot switches for SPI0 flash boot (5:8 = 0000 on the EVM) and powering on or resetting the board.
During boot, control passes from the ROM bootloader to the StarterWare bootloader, which configures the system and loads the application. Finally, the bootloader jumps to the application entrypoint. The overall process is summarized in the following diagram.