E.3.9. Loading and running an application from NOR flash

To run an image from NOR flash:

  1. Build the application as described in Building an application with the platform library and specify a link address suitable for flash. There are the following options for selecting the address:

    Load region in flash

    The image is linked such that its load region, though not necessarily its execution region, is in flash. The load region specified when the image was linked is used as the location in flash and the FLASH_ADDRESS option is ignored. If the blocks in flash are not free, the command fails. Use the FLASH RUN command to run the image.

    Load region not in flash and image location not specified

    The image is programmed into the first available contiguous set of blocks in flash that is large enough to hold the image. Use the FLASH LOAD and then the FLASH RUN commands to load and run the image.

    Load region not in flash, but image stored at a specified flash address

    Use the FLASH_ADDRESS option to specify the location of the image in flash. If the option is not used, the image is programmed into the first available contiguous set of blocks in flash that is large enough to hold the image. Use the FLASH LOAD or FLASH RUN commands to load and run the image.

    Note

    Images with multiple load regions are not supported.

    If the image is loaded into flash, but the FLASH RUN command relocates code to DRAM for execution, the execution address must not be in the top 4MBytes of DRAM since this is used by the Boot Monitor.

  2. The image must be programmed into flash using the Boot Monitor. Flash support is implemented in the Boot Monitor image.

    Run the Boot Monitor image from the debugger and enter the flash subsystem, type FLASH at the prompt:

    >FLASH
    flash>
    
  3. The command used to program the image depends on the type of image:

    • The entry point and load address for ELF images are taken from the image itself. To program the ELF image into flash, use the following command line:

      flash> WRITE IMAGE elf_file_name NAME name FLASH_ADDRESS address
      

    • The entry point and load address for ELF images are taken from the command line options. To program a binary image into flash, use the following command line:

      flash> WRITE BINARY image_file_name NAME name FLASH_ADDRESS address1
      LOAD_ADDRESS address2 ENTRY_POINT address3
      

    Note

    name is a short name for the image. If the NAME option is not used at the command prompt, name will be derived from the file name.

  4. The image is now in flash and can be run by the Boot Monitor. At the prompt, type:

    flash> RUN name
    
Copyright © 2008-2011 ARM Limited. All rights reserved.ARM DUI 0417D