
Memory Layout and Configuration
SC100 C Compiler
6-9
6.3.3 Configuring the Memory Map
The default values in the SC100 memory map are easily configurable, by modifying the linker command
file. When making such changes, it is important that you ensure that the code size and data size values that
you specify do not overlap.
The stack and the heap must be always be located together in one contiguous area of memory. The
compiler makes no assumptions about the layout of the other sections of memory, which can be split and
distributed over non-contiguous parts of memory, as required.
Section 6.3.3.1,
“
Memory map configuration example,
”
provides an example of a requirement for a
modified memory map configuration, and describes the changes to be defined in the linker command file
for this sample configuration.
6.3.3.1 Memory map configuration example
This example assumes that you have a system with non-contiguous memory, and would like to configure
the memory as follows:
All code placed in external memory (addresses
0x10000000
through
0x10100000
)
All data placed in internal memory
Some local memory reserved for the most frequently used functions and overlays (addresses
0x10000
through
0x20000
)
All data placed in the lower 64K addresses, in order to be able to use the small memory model
compilation mode
The memory map that meets these requirements is shown in Example 6-7:
Example 6-8 shows the definitions in the
crtscsmm.cmd
file that specify this memory map configuration:
Example 6-8. Modified memory configuration in the linker command file
.provide _DataSize, 0x10000
.provide _CodeStart, 0x10000000
.provide _StackStart, 0x20000
; Sets the data size.
; Sets the loader code start address.
; Sets the stack start address;
;
the stack grows upwards.
; The heap start address;
;
the heap grows downwards.
; Sets the ROM start address.
.provide _TopOfStack, 0x7fff0
.provide _ROMStart, 0x80000
Example 6-7. Modified memory map configuration
From
To
Contents
0
0x1ff
Interrupt vectors
0x200
0xfffd
Global and static variables
0x10000
0x1ffff
Local code
0x20000
0x7fff0
Stack and heap
0x80000
0xfffff
ROM
0x10000000
0x100fffff
External code