]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U24_301/LPC11U24.ld
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_NXP / TARGET_LPC11UXX / TOOLCHAIN_GCC_ARM / TARGET_LPC11U24_301 / LPC11U24.ld
1 /* Linker script for mbed LPC1768 */
2
3 /* Linker script to configure memory regions. */
4 MEMORY
5 {
6   FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 32K
7   RAM (rwx) : ORIGIN = 0x100000C0, LENGTH = 0x1740
8   USB_RAM (rwx): ORIGIN = 0x20004000, LENGTH = 0x800
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  */
37 ENTRY(Reset_Handler)
38
39 SECTIONS
40 {
41     .text :
42     {
43         KEEP(*(.isr_vector))
44         *(.text.Reset_Handler)
45         *(.text.SystemInit)
46         
47         /* Only vectors and code running at reset are safe to be in first 512
48            bytes since RAM can be mapped into this area for RAM based interrupt
49            vectors. */
50         . = 0x00000200;
51         *(.text*)
52
53         KEEP(*(.init))
54         KEEP(*(.fini))
55
56         /* .ctors */
57         *crtbegin.o(.ctors)
58         *crtbegin?.o(.ctors)
59         *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
60         *(SORT(.ctors.*))
61         *(.ctors)
62
63         /* .dtors */
64         *crtbegin.o(.dtors)
65         *crtbegin?.o(.dtors)
66         *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
67         *(SORT(.dtors.*))
68         *(.dtors)
69
70         *(.rodata*)
71
72         KEEP(*(.eh_frame*))
73     } > FLASH
74
75     .ARM.extab : 
76     {
77         *(.ARM.extab* .gnu.linkonce.armextab.*)
78     } > FLASH
79
80     __exidx_start = .;
81     .ARM.exidx :
82     {
83         *(.ARM.exidx* .gnu.linkonce.armexidx.*)
84     } > FLASH
85     __exidx_end = .;
86
87     __etext = .;
88         
89     .data : AT (__etext)
90     {
91         __data_start__ = .;
92         *(vtable)
93         *(.data*)
94
95         . = ALIGN(4);
96         /* preinit data */
97         PROVIDE (__preinit_array_start = .);
98         KEEP(*(.preinit_array))
99         PROVIDE (__preinit_array_end = .);
100
101         . = ALIGN(4);
102         /* init data */
103         PROVIDE (__init_array_start = .);
104         KEEP(*(SORT(.init_array.*)))
105         KEEP(*(.init_array))
106         PROVIDE (__init_array_end = .);
107
108
109         . = ALIGN(4);
110         /* finit data */
111         PROVIDE (__fini_array_start = .);
112         KEEP(*(SORT(.fini_array.*)))
113         KEEP(*(.fini_array))
114         PROVIDE (__fini_array_end = .);
115
116         . = ALIGN(4);
117         /* All data end */
118         __data_end__ = .;
119
120     } > RAM
121
122     .bss :
123     {
124         __bss_start__ = .;
125         *(.bss*)
126         *(COMMON)
127         __bss_end__ = .;
128     } > RAM
129     
130     .heap :
131     {
132         __end__ = .;
133         end = __end__;
134         *(.heap*)
135         __HeapLimit = .;
136     } > RAM
137
138     /* .stack_dummy section doesn't contains any symbols. It is only
139      * used for linker to calculate size of stack sections, and assign
140      * values to stack symbols later */
141     .stack_dummy :
142     {
143         *(.stack)
144     } > RAM
145
146     /* Set stack top to end of RAM, and stack limit move down by
147      * size of stack_dummy section */
148     __StackTop = ORIGIN(RAM) + LENGTH(RAM);
149     __StackLimit = __StackTop - SIZEOF(.stack_dummy);
150     PROVIDE(__stack = __StackTop);
151     
152     /* Check if data + heap + stack exceeds RAM limit */
153     ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
154 }