]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/TOOLCHAIN_GCC_ARM/STM32L152XC.ld
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32L1 / TARGET_MOTE_L152RC / TOOLCHAIN_GCC_ARM / STM32L152XC.ld
1 /* Linker script to configure memory regions. */
2 MEMORY
3 {
4   /* 256KB FLASH, 32KB RAM, Reserve up till 0x13C. There are 0x73 vectors = 292
5    * bytes (0x124) in RAM. But all GCC scripts seem to require BootRAM @0x138
6    */
7   FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256k
8   RAM (rwx) : ORIGIN = 0x2000013C, LENGTH = 0x8000-0x13C
9 }
10
11 /* Linker script to place sections and symbol values. Should be used together
12  * with other linker script that defines memory regions FLASH and RAM.
13  * It references following symbols, which must be defined in code:
14  *   Reset_Handler : Entry of reset handler
15  *
16  * It defines following symbols, which code can use without definition:
17  *   __exidx_start
18  *   __exidx_end
19  *   __etext
20  *   __data_start__
21  *   __preinit_array_start
22  *   __preinit_array_end
23  *   __init_array_start
24  *   __init_array_end
25  *   __fini_array_start
26  *   __fini_array_end
27  *   __data_end__
28  *   __bss_start__
29  *   __bss_end__
30  *   __end__
31  *   end
32  *   __HeapLimit
33  *   __StackLimit
34  *   __StackTop
35  *   __stack
36  *   _estack
37  */
38 ENTRY(Reset_Handler)
39
40 SECTIONS
41 {
42     .text :
43     {
44         KEEP(*(.isr_vector))
45         *(.text*)
46         KEEP(*(.init))
47         KEEP(*(.fini))
48
49         /* .ctors */
50         *crtbegin.o(.ctors)
51         *crtbegin?.o(.ctors)
52         *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
53         *(SORT(.ctors.*))
54         *(.ctors)
55
56         /* .dtors */
57         *crtbegin.o(.dtors)
58         *crtbegin?.o(.dtors)
59         *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
60         *(SORT(.dtors.*))
61         *(.dtors)
62
63         *(.rodata*)
64
65         KEEP(*(.eh_frame*))
66     } > FLASH
67
68     .ARM.extab : 
69     {
70         *(.ARM.extab* .gnu.linkonce.armextab.*)
71     } > FLASH
72
73     __exidx_start = .;
74     .ARM.exidx :
75     {
76         *(.ARM.exidx* .gnu.linkonce.armexidx.*)
77     } > FLASH
78     __exidx_end = .;
79
80     __etext = .;
81     _sidata = .;
82
83     .data : AT (__etext)
84     {
85         __data_start__ = .;
86         _sdata = .;
87         *(vtable)
88         *(.data*)
89
90         . = ALIGN(4);
91         /* preinit data */
92         PROVIDE_HIDDEN (__preinit_array_start = .);
93         KEEP(*(.preinit_array))
94         PROVIDE_HIDDEN (__preinit_array_end = .);
95
96         . = ALIGN(4);
97         /* init data */
98         PROVIDE_HIDDEN (__init_array_start = .);
99         KEEP(*(SORT(.init_array.*)))
100         KEEP(*(.init_array))
101         PROVIDE_HIDDEN (__init_array_end = .);
102
103
104         . = ALIGN(4);
105         /* finit data */
106         PROVIDE_HIDDEN (__fini_array_start = .);
107         KEEP(*(SORT(.fini_array.*)))
108         KEEP(*(.fini_array))
109         PROVIDE_HIDDEN (__fini_array_end = .);
110
111         KEEP(*(.jcr*))
112         . = ALIGN(4);
113         /* All data end */
114         __data_end__ = .;
115         _edata = .;
116
117     } > RAM
118
119     .bss :
120     {
121         . = ALIGN(4);
122         __bss_start__ = .;
123         _sbss = .;
124         *(.bss*)
125         *(COMMON)
126         . = ALIGN(4);
127         __bss_end__ = .;
128         _ebss = .;
129     } > RAM
130
131     .heap (COPY):
132     {
133         __end__ = .;
134         end = __end__;
135         *(.heap*)
136         __HeapLimit = .;
137     } > RAM
138
139     /* .stack_dummy section doesn't contains any symbols. It is only
140      * used for linker to calculate size of stack sections, and assign
141      * values to stack symbols later */
142     .stack_dummy (COPY):
143     {
144         *(.stack*)
145     } > RAM
146
147     /* Set stack top to end of RAM, and stack limit move down by
148      * size of stack_dummy section */
149     __StackTop = ORIGIN(RAM) + LENGTH(RAM);
150     _estack = __StackTop;
151     __StackLimit = __StackTop - SIZEOF(.stack_dummy);
152     PROVIDE(__stack = __StackTop);
153
154     /* Check if data + heap + stack exceeds RAM limit */
155     ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
156 }