]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/TOOLCHAIN_GCC_ARM/TARGET_MCU_NORDIC_32K/NRF51822.ld
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_NORDIC / TARGET_MCU_NRF51822 / TOOLCHAIN_GCC_ARM / TARGET_MCU_NORDIC_32K / NRF51822.ld
1 /* Linker script to configure memory regions. */
2
3 MEMORY
4 {
5   FLASH (rx) : ORIGIN = 0x00018000, LENGTH = 0x28000
6   RAM (rwx) :  ORIGIN = 0x20002000, LENGTH = 0x6000
7 }
8
9 OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
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(*(.Vectors))
44                 *(.text*)
45
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
69         .ARM.extab :
70         {
71                 *(.ARM.extab* .gnu.linkonce.armextab.*)
72         } > FLASH
73
74         __exidx_start = .;
75         .ARM.exidx :
76         {
77                 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
78         } > FLASH
79         __exidx_end = .;
80
81         __etext = .;
82
83         .data : AT (__etext)
84         {
85                 __data_start__ = .;
86                 *(vtable)
87                 *(.data*)
88
89                 . = ALIGN(4);
90                 /* preinit data */
91                 PROVIDE_HIDDEN (__preinit_array_start = .);
92                 KEEP(*(.preinit_array))
93                 PROVIDE_HIDDEN (__preinit_array_end = .);
94
95                 . = ALIGN(4);
96                 /* init data */
97                 PROVIDE_HIDDEN (__init_array_start = .);
98                 KEEP(*(SORT(.init_array.*)))
99                 KEEP(*(.init_array))
100                 PROVIDE_HIDDEN (__init_array_end = .);
101
102
103                 . = ALIGN(4);
104                 /* finit data */
105                 PROVIDE_HIDDEN (__fini_array_start = .);
106                 KEEP(*(SORT(.fini_array.*)))
107                 KEEP(*(.fini_array))
108                 PROVIDE_HIDDEN (__fini_array_end = .);
109
110                 *(.jcr)
111                 . = ALIGN(4);
112                 /* All data end */
113                 __data_end__ = .;
114
115         } > RAM
116
117         .bss :
118         {
119                 . = ALIGN(4);
120                 __bss_start__ = .;
121                 *(.bss*)
122                 *(COMMON)
123                 . = ALIGN(4);
124                 __bss_end__ = .;
125         } > RAM
126
127         .heap (COPY):
128         {
129                 __end__ = .;
130                 end = __end__;
131                 *(.heap*)
132                 __HeapLimit = .;
133         } > RAM
134
135         /* .stack_dummy section doesn't contains any symbols. It is only
136          * used for linker to calculate size of stack sections, and assign
137          * values to stack symbols later */
138         .stack_dummy (COPY):
139         {
140                 *(.stack*)
141         } > RAM
142
143         /* Set stack top to end of RAM, and stack limit move down by
144          * size of stack_dummy section */
145         __StackTop = ORIGIN(RAM) + LENGTH(RAM);
146         __StackLimit = __StackTop - SIZEOF(.stack_dummy);
147         PROVIDE(__stack = __StackTop);
148
149         /* Check if data + heap + stack exceeds RAM limit */
150         ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
151 }