]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC15XX/TOOLCHAIN_GCC_ARM/LPC1549.ld
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_NXP / TARGET_LPC15XX / TOOLCHAIN_GCC_ARM / LPC1549.ld
1 /* Linker script for mbed LPC1549 */
2
3 /* Linker script to configure memory regions. */
4 MEMORY
5 {
6   /* Define each memory region */
7   FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K
8   Ram0_16 (rwx) : ORIGIN = 0x2000000 + 0x100, LENGTH = (16K - 0x100)
9   Ram1_16 (rwx) : ORIGIN = 0x2004000, LENGTH = 16K
10   Ram2_4 (rwx) : ORIGIN = 0x2008000, LENGTH = 4K
11
12 }
13
14 /* Linker script to place sections and symbol values. Should be used together
15  * with other linker script that defines memory regions FLASH and RAM.
16  * It references following symbols, which must be defined in code:
17  *   Reset_Handler : Entry of reset handler
18  * 
19  * It defines following symbols, which code can use without definition:
20  *   __exidx_start
21  *   __exidx_end
22  *   __etext
23  *   __data_start__
24  *   __preinit_array_start
25  *   __preinit_array_end
26  *   __init_array_start
27  *   __init_array_end
28  *   __fini_array_start
29  *   __fini_array_end
30  *   __data_end__
31  *   __bss_start__
32  *   __bss_end__
33  *   __end__
34  *   end
35  *   __HeapLimit
36  *   __StackLimit
37  *   __StackTop
38  *   __stack
39  */
40 ENTRY(Reset_Handler)
41
42 SECTIONS
43 {
44     .text :
45     {
46         KEEP(*(.isr_vector))
47         *(.text*)
48
49         KEEP(*(.init))
50         KEEP(*(.fini))
51
52         /* .ctors */
53         *crtbegin.o(.ctors)
54         *crtbegin?.o(.ctors)
55         *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
56         *(SORT(.ctors.*))
57         *(.ctors)
58
59         /* .dtors */
60         *crtbegin.o(.dtors)
61         *crtbegin?.o(.dtors)
62         *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
63         *(SORT(.dtors.*))
64         *(.dtors)
65
66         *(.rodata*)
67
68         KEEP(*(.eh_frame*))
69     } > FLASH
70
71     .ARM.extab : 
72     {
73         *(.ARM.extab* .gnu.linkonce.armextab.*)
74     } > FLASH
75
76     __exidx_start = .;
77     .ARM.exidx :
78     {
79         *(.ARM.exidx* .gnu.linkonce.armexidx.*)
80     } > FLASH
81     __exidx_end = .;
82
83     __etext = .;
84         
85     .data : AT (__etext)
86     {
87         __data_start__ = .;
88         Image$$RW_IRAM1$$Base = .;
89         *(vtable)
90         *(.data*)
91
92         . = ALIGN(4);
93         /* preinit data */
94         PROVIDE (__preinit_array_start = .);
95         KEEP(*(.preinit_array))
96         PROVIDE (__preinit_array_end = .);
97
98         . = ALIGN(4);
99         /* init data */
100         PROVIDE (__init_array_start = .);
101         KEEP(*(SORT(.init_array.*)))
102         KEEP(*(.init_array))
103         PROVIDE (__init_array_end = .);
104
105
106         . = ALIGN(4);
107         /* finit data */
108         PROVIDE (__fini_array_start = .);
109         KEEP(*(SORT(.fini_array.*)))
110         KEEP(*(.fini_array))
111         PROVIDE (__fini_array_end = .);
112
113         . = ALIGN(4);
114         /* All data end */
115         __data_end__ = .;
116
117     } > Ram0_16
118
119     
120     .bss :
121     {
122         __bss_start__ = .;
123         *(.bss*)
124         *(COMMON)
125         __bss_end__ = .;
126         Image$$RW_IRAM1$$ZI$$Limit = . ;
127     } > Ram0_16
128
129     
130     .heap :
131     {
132         __end__ = .;
133         end = __end__;
134         *(.heap*)
135         __HeapLimit = .;
136     } > Ram0_16
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     } > Ram0_16
145
146     /* Set stack top to end of RAM, and stack limit move down by
147      * size of stack_dummy section */
148     __StackTop = ORIGIN(Ram0_16) + LENGTH(Ram0_16);
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 }