1MEMORY
2{
3    RAM (xrw)       : ORIGIN = 0x00000000, LENGTH = 0x008000 /* 32 KB */
4}
5
6SECTIONS {
7    /* The program code and other data goes into FLASH */
8    .text :
9    {
10        . = ALIGN(4);
11        *(.text)           /* .text sections (code) */
12        *(.text*)          /* .text* sections (code) */
13        *(.rodata)         /* .rodata sections (constants, strings, etc.) */
14        *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
15        *(.srodata)        /* .rodata sections (constants, strings, etc.) */
16        *(.srodata*)       /* .rodata* sections (constants, strings, etc.) */
17        _etext = .;        /* define a global symbol at end of code */
18        _sidata = _etext;  /* This is used by the startup in order to initialize the .data secion */
19    } >RAM
20
21
22    /* This is the initialized data section
23    The program executes knowing that the data is in the RAM
24    but the loader puts the initial values in the ROM (inidata).
25    It is one task of the startup to copy the initial values from ROM to RAM. */
26    .data : AT ( _sidata )
27    {
28        . = ALIGN(4);
29        _sdata = .;        /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
30        _ram_start = .;    /* create a global symbol at ram start for garbage collector */
31        . = ALIGN(4);
32        *(.data)           /* .data sections */
33        *(.data*)          /* .data* sections */
34        *(.sdata)           /* .sdata sections */
35        *(.sdata*)          /* .sdata* sections */
36        . = ALIGN(4);
37        _edata = .;        /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
38    } >RAM
39
40    /* Uninitialized data section */
41    .bss :
42    {
43        . = ALIGN(4);
44        _sbss = .;         /* define a global symbol at bss start; used by startup code */
45        *(.bss)
46        *(.bss*)
47        *(.sbss)
48        *(.sbss*)
49        *(COMMON)
50
51        . = ALIGN(4);
52        _ebss = .;         /* define a global symbol at bss end; used by startup code */
53    } >RAM
54
55    /* this is to define the start of the heap, and make sure we have a minimum size */
56    .heap :
57    {
58        . = ALIGN(4);
59        _heap_start = .;    /* define a global symbol at heap start */
60    } >RAM
61}
62