AM18XX SitaraWare Booting And Flashing

Important Note:

'The software found on this site is available for download, but is no longer being actively developed and maintained. This wiki is in maintenance mode and the software is supported on Sitara E2E forum'



Flashing
Two types of images can be flashed to the SPI flash. A bootstrap image and a application binary image. The application can be in usual raw binary format (.bin) and can be flashed. However, the bootstrap image is required to be in a special format called the AIS format. This can be generated using the AIS Gen utility which is part of the package (SitaraWare_xx_yy_mm_pp/tools/ais_gen/).  NOTE AISGen is only supported on Windows host Follow the below steps to generate a .ais file from a .out file.


 * Specify the Boot loader file with the location of the ELF file .out and the location of .ais file name for AIS binary Image.
 * Click on Generate AIS. The binary image in AIS format will now be available in the specified folder.

Given below is the screenshot of AIS generator with the default settings, generating AIS image from boot.out file.

Flashing using Serial Flasher

 * Required
 * Microsoft Dot Net Framework
 * The Serial flasher (/tools/flash_writer/sfh_OMAP-L138.exe)
 * Serial port of the EVM connected to the host serial port via NULL modem cable
 * Image of bootloader in AIS format (Generated using /tools/ais_gen/AISgen_d800k006_Install_v1.5.exe)
 * Binary Image of the application
 * How To Flash :
 * Configure the BOOT pins for UART Boot mode. (see Boot Modes)
 * Erase the target by executing the command "sfh_OMAP-L138.exe -erase". On request for reset, reset the EVM. It will erase the entire FLASH.
 * Flash the boot loader and binary application using the command "sfh_OMAP-L138.exe -flash "&lt;Boot_loader.ais&gt;" "&lt;Binary_Application.bin&gt;".
 * Configure the BOOT pins for SPI boot mode (see Boot Modes) and reboot the EVM. The application starts running.

Flashing using CCS

 * Required
 * SPI flash writer Object file spi_flash_writer.out (available in /tools/flash_writer/).
 * How To Flash :
 * Configure the BOOT pins for Emulation boot mode (see Boot Modes).
 * Load the GEL file AM1808.gel (available in /tools/gel)
 * GEL updates can be checked from LOGIC PD website
 * Connect to the target
 * Execute the GEL function
 * Go to the menu toolbar, Scripts-&gt;Full EVM-&gt;SPI1_PinMux.
 * Load the spi_flash_writer.out onto the EVM.
 * It will be prompted for binary AIS Bootloader file name. Update the file path with the path of .ais binary image which we need to flash.
 * It will be prompted again for application file name. Provide file path of the application.
 * Once SPI flash writing completes, disconnect from CCS and put the boot mode pins in the SPI boot mode (see Boot Modes).
 * Reboot the EVM.

Boot Modes
The device supports variety of boot modes through ARM ROM Bootloader. Boot mode selection is determined by the state of the BOOT pins. States of BOOT pins on AM1808 EVM for UART, SPI and Emulation boot modes are given below.


 * UART Boot Mode


 * SPI Boot Mode


 * Emulation Boot Mode

Bootloader
SitaraWare AM18XX provides a simple bootloader, which can be flashed to the on board SPI flash, which after a power-on-reset can bootstrap the board. Additionally it can load an application from the flash to DDR and transfer the control to the application. This can be used for out-of-box experience. At present, only SPIflash based boot loading is supported.

Upon board power on, the RBL [Read Only Memory BootLoader], residing in the ROM of the AM18XX kickstarts. RBL checks the boot mode setting (which should be SPI mode in case of SitaraWare bootloading) and depending upon the boot mode setting it copies boot loader from the respective flash device. RBL requires boot loader to be in .ais format. “AIS gen for D800k006” is the tool used to convert to .ais format from .out. RBL copies the boot loader to On chip-RAM location 0x80000000 and gives control to it. Boot loader initializes PLL0 and PLL1 for all the devices and then it initializes DDR. Once all the initialization is done, it copies the application from flash to the DDR and transfers the control to the application. The application starts to execute from DDR.

Execution Flow

 * 1) Entry point to the bootloader is the function Entry which is inside the file bl_init.s (src/gcc). This function initializes stack and bss.
 * 2) Invokes bl_start, which is in the file bl_main.c.
 * 3) This invokes DeviceConfig, an EVM dependent function, for AM1808, function will be present in the file bl_devam1808.c.This calls PLL and DDR initialization functions.
 * 4) PLLInit Initializes PLL0 and PLL1.
 * 5) DDRInit function initializes the DDR.
 * 6) Initializes the UART by calling UartConfigure.
 * 7) Executes Imagecopy function which is present in the device independent file bl_copy.c .Depending upon the defined boot mode it calls one of the SPIBootcopy/ NANDBootcopy/ NorBootcopy function. This function copies the application to the DDR and makes the processor to execute from this location (Refer memory layout of DDR).

SPI FLash Memory Layout
The following diagram represents the blocks of memory and its contents in SPI Flash.

On-chip RAM
Below diagram represents On-chip memory contents.

DDR
Below diagram represents DDR memory contents.