Processor SDK RTOS BOOT AM57x

From Texas Instruments Wiki
Jump to: navigation, search


RTOS Software Developer Guide BOOT AM57x



Overview

User Interface

Application

Debug


Overview

The Secondary Bootloader (SBL) for AM57xx device initializes the execution environment for multi-core application and this can be used to demonstrate an out-of-box experience.The section covers additional details including execution sequence, tools and additional flashing instructions.

Bootloader Execution Sequence

  • Power On Reset
  • RBL [Read Only Memory BootLoader], residing in ROM of SoC kickstarts.
  • RBL checks boot mode setting and depending upon those settings, it copies boot loader from the respective memory device.
  • SBL begins execution from internal memory by running basic initialization routines like setting up Stack, BSS and then jumps to main() to begin Board Initialization.
  • Board Initialization is done by a call to Board_init() API.For additional details refer Processor SDK Board Support.
    • It includes setting up PLLs, enabling clocks to all interfaces and modules, performing pinmux and setting up UART console.
  • Once Board Initialization is complete, it enables clocks to the slave C66x/DSP cores and brings them out of reset.
  • Parses Multicore Application image located in memory device and copies it to DDR memory based on load address for different sections.
  • Once copy is successful it transfers control to application.
  • Application then starts executing from DDR.
NOTE

  • RBL requires boot loader to be in a special format with a header appended to the binary image. The header shall contain the load address of the bootloader and size of the bootloader image.
  • For more information on the TI header refer TRM document

Tools and Binary Formats

This section lists out the various tools and scripts used by SBL for different boot modes and those required to create a bootable application image.

A bootable application image can be created by using the Am57xImageGen script provided under tools folder as part of sbl. It can be located at <PDK_INSTALL_DIR>\packages\ti\boot\sbl\tools\scripts folder.

The Am57xImageGen script uses out2rprc and multicoreImageGen format conversion tools to create the final application image.

The script creates the bootable image in 2 steps

  • RPRC format conversion
    • Firstly, application executable is converted from ELF/COFF format to custom TI RPRC image format.
  • Multicore Image file generation.
    • RPRC files for each cores is combined into a single multicore bootable application image.

Refer section App Image Creation for more details on usage of this script and application image creation.

To generate the MLO, SBL uses tiImageGen tool to prepend the sbl.bin image with the TI header information.

SBL provides a CCS based qspi flash writer utility to flash image and multicore AppImage from a SD card to onboard QSPI device. It is located at <PDK_INSTALL_DIR>\packages\ti\boot\sbl\tools\flashWriter\qspi

Boot Modes

This Release of SBL supports MMCSD and QSPI Boot modes. The different boot modes supported for all the boards is tabulated in the table below.


MMCSD QSPI
AM572x GPEVM YES NO
AM572x IDKEVM YES YES
AM571x IDKEVM YES YES


Booting Via SD Card

  1. Preparing the SD card.
  2. Booting the target.

Preparing the SD card 

  1. To boot the target the SD card should be bootable. Follow the steps at Creating bootable SD card in windows or Creating bootable SD card in Linux.
  2. Delete the "MLO" and "app" in the bootable SD card which are created in the process of making the SD bootable.
  3. Copy the sbl binary(MLO) to the SD card.
  4. Copy the Application image(app) generated using the Script to the SD card.

Booting the target

  1. Insert micro SD card into the SD card slot of the board.
  2. Open a serial communication terminal like TeraTerm, MiniCom on host PC and connect to the UART console port
  3. Do a power reset of the board to boot the appliation from the SD card.

Booting Via QSPI

Booting from QSPI flash involves two steps-

  1. Flashing bootloader and app image to QSPI flash.
  2. Booting the target.

Preparing Flash Device

Use the CCS based qspi_flash_writer.out utility provided in <TI_PDK_INSTALL_DIR>\packages\ti\boot\sbl\tools\flashwriter\qspi\<Board>' to flash the SBL image at offset 0 and application image at offset 0x80000 to the QSPI device.

QSPI device Memory Map:

Offset 0x00 SBL
Offset 0x80000 Application Multicore Image

The images can be flashed into QSPI flash by following steps given below.

  1. Copy QSPI mode SBL image TI_PDK_INSTALL_DIR\packages\ti\boot\sbl\binary\<BoardName>\qspi\bin\MLO and application image(app) generated using the Script into the SD card.
    Rename the bootloader file to 'boot' and application image to 'app' with no extensions. 
  2. Copy 'config' file into the SD card, the config file should contain names of the image to be flashed and the offset.
    A sample config file can be found at TI_PDK_INSTALL_DIR\packages\ti\boot\sbl\tools\flashWriter\qspi\config. Do not change the name of the config file.
    NOTE: "config" file can be used without any modifications if bootloader and application images are renamed to "boot" and "app".
    NOTE: Do not rename the bootloader to be copied to SD card as "MLO", as MMCSD bootloader expects "MLO" and "app" to boot.
  3. Now SD card contains 3 files 1)boot 2)app 3)config files.
    config file contains the address of boot image as 0x0 and app image as 0x80000.
    Insert it into the SD card slot.
  4. Connect the board with CCS and and load the prebuilt qspi flash writer application from $(TI_PDK_INSTALL_DIR)\packages\ti\boot\sbl\tools\flashWriter\qspi\bin\<BoardName>\
  5. Run the QSPI flash writer application. You will see the following logs on the EVM's UART console.
  6. After the images have been flashed to the QSPI device disconnect from CCS and do a power reset to boot from the QSPI memory. 
PDK QSPI Flash Writer!!
Copying boot to QSPI Flash
Copying app to QSPI Flash
Changing read to quad mode
Read mode has been changed to Quad mode
SUCCESS!!!
Flashing completed
NOTE

  • The file names have to be renamed in such a way that the length of name is less than 9 characters. Any file name less than 9 characters can be used.
  • This application will flash the image at required offset without taking into consideration any overwriting to previously flashed image.
  • It is the responsibility of the user to provide proper offsets.


Test Application

SBL provides a test application to demonstrate booting of multicore application image on A15 and DSP cores.The multicore sample application uses mailbox for inter-processor communication. It is used to validate the multi-core boot-up use case.

Master application sends wake-up message to the DSP slave cores & waits for acknowledgement message from the slave cores in an infinite loop.Each slave DSP core waits for wake-up message from the master core  responds back with an acknowledgement message.

Application Image Creation

Application Image creation involves two steps.

  1. Generating the .outs of applications for individual cores
  2. Combining the .outs of individual cores to create a bootable multicore image

The steps to create the bootable image in Linux and Windows environment are listed below.

NOTE

  • Valid SOC settings are AM571x/AM572x
  • Valid BOARD settings are evmAM572x/idkAM571x/idkAM572x

Linux Environment:

Command to build the test application.

Go to cd (TI_PDK_INSTALL_DIR)\packages\ti\boot\sbl

make example BOARD=<BOARD> SOC=<SOC> to build the application
make example_clean BOARD=<BOARD>

Example:

make example BOARD=idkAM572x SOC=AM572x

To create the final bootable application image use the AM57xImageGen script and follow these steps

1. Set the following environment variable in the shell.  BIN_PATH: Pointing to the path where the AppImage needs to be generated

Ex: export BIN_PATH=$(TI_PDK_INSTALL_DIR)/packages/ti/boot/sbl/binary 

2. Edit the script file to point to the application elf files by setting the input application variables. 

 App_MPU_CPU0: Point to the path where the application .out for A15 MPU is located
 App_DSP1: Point to the path where the dsp core 1 application is located
 App_DSP2: Point to the path where the dsp core 2 application is located

export APP_MPU_CPU0=$(TI_PDK_INSTALL_DIR)/packages/ti/boot/sbl/binary/idkAM572x/example/armv7/bin/sbl_app.out

export APP_DSP1=$(TI_PDK_INSTALL_DIR)/packages/ti/boot/sbl/binary/idkAM572x/example/c66/dsp1/bin/sbl_app.xe66

export APP_DSP2=$(TI_PDK_INSTALL_DIR)/packages/ti/boot/sbl/binary/idkAM572x/example/c66/dsp2/bin/sbl_app.xe663

export APP_IPU1_CPU0=$(TI_PDK_INSTALL_DIR)/packages/ti/boot/sbl/binary/idkAM572x/example/m4/ipu1/bin/sbl_app.xem4

export APP_IPU1_CPU0=$(TI_PDK_INSTALL_DIR)/packages/ti/boot/sbl/binary/idkAM572x/example/m4/ipu2/bin/sbl_app.xem4

3. If it is not required to load an application on specific core leave the variable blank.

4. Run the script file

5. An application image by name app is created in the path pointed by BIN_PATH variable

6. Copy the Bootlaoder image(MLO) and application(app) in the SD card to boot using MMCSD boot mode.

NOTE

  • The AM57xImageGen.sh script depends on tools like mono to execute the out2rprc.exe.
  • The linux host environment needs to have this tool installed to execute this script.
  • Refer this link to download the mono tool

Windows environment:

Command to build the test application.

Go to cd (TI_PDK_INSTALL_DIR)\packages\ti\boot\sbl

gmake example BOARD=<BOARD> SOC=<SOC> to build the application 
gmake example_clean BOARD=<BOARD>

Example:

gmake example BOARD=idkAM572x SOC=AM572x

To create the final bootable application image use the AM57xImageGen script and follow these steps

1. Set the following environment variable in windows command prompt

BIN_PATH: Pointing to the path where the AppImage needs to be generated 

Ex:  set BIN_PATH=%TI_PDK_INSTALL_DIR%\packages\ti\boot\sbl\binary 

2. Edit the batch file to point to the application elf files by setting the input application variables.

  App_MPU_CPU0: Point to the path where the application .out for A15 MPU is located
  App_DSP1: Point to the path where the dsp core 1 application is located
  App_DSP2: Point to the path where the dsp core 2 application is located

set App_MPU_CPU0=%TI_PDK_INSTALL_DIR%\packages\ti\boot\sbl\binary\idkAM572x\example\armv7\bin\sbl_app.out

set App_DSP1=%TI_PDK_INSTALL_DIR%\packages\ti\boot\sbl\binary\idkAM572x\example\c66\dsp1\bin\sbl_app.xe66

set App_DSP2=%TI_PDK_INSTALL_DIR%\packages\ti\boot\sbl\binary\idkAM572x\example\c66\dsp2\bin\sbl_app.xe66

set App_IPU1_CPU0=%TI_PDK_INSTALL_DIR%\packages\ti\boot\sbl\binary\idkAM572x\example\m4\ipu1\bin\sbl_app.xem4

set App_IPU2_CPU0=%TI_PDK_INSTALL_DIR%\packages\ti\boot\sbl\binary\idkAM572x\example\m4\ipu2\bin\sbl_app.xem4 

3. If it is not required to load an application on specific core leave the variable blank.

4. Run the batch file

5. Follow the steps 4 to 6 listed above for Linux environment.

Setup Requirements

For information on board specific requirements like power supply, UART console port connections refer the Hardware User guide of the respective boards.

The configurations needed to setup UART console through a serial terminal application on host PC are listed in the next section.

UART Console Setup

PDK SBL prints messages on the UART Serial Console running on the host. Hence, a serial terminal application (like Tera Term/HyperTerminal/minicom) should be running on the host.

The host serial port must be configured at 115200 baud, no parity, 1 stop bit and no flow control.
Please ensure that the local echo setting for the terminal is turned off.

Loading the test application

Follow these steps to load the test application using a SD card on the target

copy the MLO to your SD card (located at %TI_PDK_INSTALL_DIR%\packages\ti\boot\sbl\binary\[BOARD]\mmcsd)

  1. copy the example app located at path pointed to by BIN_PATH to your SD card
  2. insert your SD card into your board and power on your board
  3. open teraterm to connect to the board's UART console
  4. press the "Hard Reset" button on your board

On Successful bootup you should see the following logs on the UART console for a AM572x based board.

 Sbl example.jpg

NOTE

MPU Core 0 example does a sequential check of mailbox messages sent from the other cores. On rare occasions, the check happens before the message is sent - the "<core> boot-up Successful" message might not be displayed even though the core(s) were booted successfully.

Application Integration

Memory Map

Table indicated below provides memory map details for SBL image in OCMC_RAM1.  For more details on pinmux and IO delay requirements refer this link Processor SDK Board Support

The SBL memory map is shown below

Sbl mem map.jpg

NOTE

  • Once the application boots and is running it is free to use the SBL_MEM region .
  • During the Board initialization, applications are not supposed to modify the first 192KBytes of the OCMC region starting from 0x40300000 to avoid pinmux data corruption.
  • The reserved memory area contains Pinmux and IO delay configurations code and data area and should not be used for other purposes.