User guide

6.6 Using both scatter loading and remapping
This section describes how to convert the application in Loading the ROM image at address 0 into a more complex
scatter-loading application. This example uses memory remapping to exchange the ROM and RAM regions after the
application has started.
The code for this example is in install_directory\Examples\Embedded.
6.6.1 Memory map
Figure 6-5 shows:
FLASH is at 0x24000000. An aliased copy of the FLASH appears at 0x0 on reset.
After remapping, 32-bit RAM is at 0x0 to hold the exception vectors.
Figure 6-5 Memory map for remapping
6.6.2 Scatter-load description file
The scatter-load description file shown in Example 6-7 defines one load region (FLASH) and five execution regions:
FLASH (at 0x24000000) contains all the read-only code and data
32bitRAM (at 0x0) contains the vector table from vectors.o
HEAP (immediately above the RW/ZI data) is the start of the heap
STACKS (at 0x40000) is the top of the stack
UART0 (at 0x16000000) contains memory-mapped I/O.
Example 6-7 scat_c.scf
FLASH 0x24000000 0x4000000 ; The load region starts at 0x24000000 and has
; a maximum size of 0x4000000 bytes.
{
FLASH 0x24000000 0x4000000 ; The load and execution addresses are the same.
; Execution region size is less than 0x4000000.
{
init.o (Init, +First) ; The initialization code is placed first.
* (+RO) ; All other RO code and data are placed next.
} ; Library code also goes here.
32bitRAM 0x0000 ; RAM starts at address 0x0.
{
vectors.o (Vect, +First) ; The vector table is placed first in RAM.
* (+RW,+ZI) ; All other RW and ZI regions go after vectors.
}
Writing Code for ROM
Copyright ?1999 2001 ARM Limited 6-15