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