E.3.7. Building an application with the platform library

The platform library on the CD provides all required initialization code to bring the baseboard up from reset. The library is used by the Boot Monitor, but it can be used by an application independently of the other code in the Boot Monitor.


It is not necessary to build your application with the platform library. You can instead let the Boot Monitor run at power on and remap the memory. After the remap has finished, you can load a typical application built with RVDS that is linked at address 0x8000 and uses semihosting.

The platform library supports:

To build an image that uses the I/O and memory control features present in the platform library:

  1. Write the application as normal. There must be a main() routine in the application.


    Linking an application with the platform requires that the application is built using RVCT V2.1 or greater. If you are using RVCT V2.0 or ADS it is not possible to link the application with the platform library, however an application can still utilize the hardware on the board through semihosting.

  2. Link the application against the Boot Monitor platform library file platform.a. The file platform.a is in one of the target build subdirectories (install_dir\software\firmware\Platform\Builds\target_build).

    Choose the Builds subdirectory that matches your application. For example, Release_ARM_Little_Endian for ARM code. If the subdirectory does not exist, see Rebuilding the Boot Monitor or platform library for details on rebuilding platform.a.


    If you are not using the platform.a library, you must provide your own initialization and I/O routines.

    You can also build the platform library functionality directly into your application without building the platform code as a separate library. This might be useful, for example, if you are using an IDE to develop your application.

    See the filelist.txt file in the software directory for more details on software included on the CD. The selftest directory, for example, contains source files that can be used as a starting point for your own application.

  3. If required, select the link time platform library options.

    Platform selection uses special symbols in your application:

    From C
    #pragma import(_platform_option_xxxxx)
    From assembler
    IMPORT _platform_option_xxxxx

    The platform options are listed in Table E.2.

    Table E.2. platform library options

    _platform_option_no_cacheStops the cache from being enabled by default
    _platform_option_no_lcd_kbdDisables LCD & Keyboard support and stops the driver code from being loaded
    _platform_option_no_mmuStops the MMU from being initialized by default.

  4. Scatter loading is supported for applications using the platform library, however the scatter file must follow Example E.1. The execution regions INIT and SDRAM must be present, the execution regions ITCM and DTCM are optional, if they are present, the relevant Tightly Coupled Memory (TCM) is enabled and the base address must be set to the address supplied in the scatter file. The sys_vectors.o object must be located at address zero. Additional execution regions, such as one for the SSRAM, can be added. An example scatter loading application can be found in the examples directory.

    Example E.1. Scatter loading

    LR_ROOT 0x8000
        INIT +0 FIXED
            sys_boot.o (!!!_platform_area_boot, +FIRST)
         SDRAM +0
        ITCM 0x0
            sys_vectors.o(_platform_area_vectors, +FIRST)
            ‘application code’.o(+RO)
        DTCM 0x08000000
            ‘application code’.o(+RW,+ZI)

  5. To run the image from RAM, load the image with a debugger and execute as normal. The image uses the procedure described in Redirecting character output to hardware devices to redirect standard I/O either to the debugger or to be handled by the application itself.

    See Loading and running an application from NOR flash for more information on running from flash.


If the platform library encounters a fatal error, all the user LEDs flash at a one-second interval and an error message is output on UART-0.

Copyright © 2008-2011 ARM Limited. All rights reserved.ARM DUI 0417D