]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/Core/src/core_linker_sct.md
Update README.md (#73)
[cmsis] / CMSIS / DoxyGen / Core / src / core_linker_sct.md
1 # Scatter-Loading description file \<device\>_ac6.sct {#linker_sct_pg}
2
3 A scatter file for linking is required when using a \ref startup_c_pg.
4
5 The \ref linker_sct_pg contains regions for:
6  - Code (read-only data, execute-only data)
7  - RAM (read/write data, zero-initialized data)
8  - Stack
9  - Heap
10  - Stack seal (for Armv8-M/v8.1-M)
11  - CMSE veneer (for Armv8-M/v8.1-M)
12
13 Within the scatter file, the user needs to specify a set of macros. The scatter file is passed through the
14 C preprocessor which uses these macros to calculate the start address and the size of the different regions.
15
16 ```
17 /*--------------------- Flash Configuration ----------------------------------
18 ; <h> Flash Configuration
19 ;   <o0> Flash Base Address <0x0-0xFFFFFFFF:8>
20 ;   <o1> Flash Size (in Bytes) <0x0-0xFFFFFFFF:8>
21 ; </h>
22  *----------------------------------------------------------------------------*/
23 #define __ROM_BASE      0x00000000
24 #define __ROM_SIZE      0x00080000
25
26 /*--------------------- Embedded RAM Configuration ---------------------------
27 ; <h> RAM Configuration
28 ;   <o0> RAM Base Address    <0x0-0xFFFFFFFF:8>
29 ;   <o1> RAM Size (in Bytes) <0x0-0xFFFFFFFF:8>
30 ; </h>
31  *----------------------------------------------------------------------------*/
32 #define __RAM_BASE      0x20000000
33 #define __RAM_SIZE      0x00040000
34
35 /*--------------------- Stack / Heap Configuration ---------------------------
36 ; <h> Stack / Heap Configuration
37 ;   <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
38 ;   <o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
39 ; </h>
40  *----------------------------------------------------------------------------*/
41 #define __STACK_SIZE    0x00000200
42 #define __HEAP_SIZE     0x00000C00
43
44 /*--------------------- CMSE Veneer Configuration ---------------------------
45 ; <h> CMSE Veneer Configuration
46 ;   <o0>  CMSE Veneer Size (in Bytes) <0x0-0xFFFFFFFF:32>
47 ; </h>
48  *----------------------------------------------------------------------------*/
49 #define __CMSEVENEER_SIZE    0x200
50 ```
51
52 \note
53 The stack is placed at the end of the available RAM and is growing downwards 
54 whereas the Heap is placed after the application data and growing upwards.
55
56 ## Preprocessor command {#linker_sct_preproc_sec}
57
58 The scatter file uses following preprocessor command for Arm Compiler v6
59 ```
60 #! armclang -E --target=arm-arm-none-eabi -mcpu=&lt;mcpu&gt; -xc
61 ```