1 | /* Linker script for mbed RZ_A1H */
|
---|
2 | PROVIDE(hardware_init_hook = 0);
|
---|
3 | PROVIDE(software_init_hook = 0);
|
---|
4 | PROVIDE(software_term_hook = 0);
|
---|
5 | PROVIDE(IRQTable = _kernel_inh_table);
|
---|
6 | PROVIDE(IRQNestLevel = _kernel_excpt_nest_count);
|
---|
7 |
|
---|
8 | /* Linker script to configure memory regions. */
|
---|
9 | MEMORY
|
---|
10 | {
|
---|
11 | ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x02000000
|
---|
12 | BOOT_LOADER (rx) : ORIGIN = 0x18000000, LENGTH = 0x00004000
|
---|
13 | SFLASH (rx) : ORIGIN = 0x18004000, LENGTH = 0x07FFC000
|
---|
14 | L_TTB (rw) : ORIGIN = 0x20000000, LENGTH = 0x00004000
|
---|
15 | RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x00700000
|
---|
16 | RAM_NC (rwx) : ORIGIN = 0x20900000, LENGTH = 0x00100000
|
---|
17 | }
|
---|
18 |
|
---|
19 | /* Linker script to place sections and symbol values. Should be used together
|
---|
20 | * with other linker script that defines memory regions FLASH and RAM.
|
---|
21 | * It references following symbols, which must be defined in code:
|
---|
22 | * Reset_Handler : Entry of reset handler
|
---|
23 | *
|
---|
24 | * It defines following symbols, which code can use without definition:
|
---|
25 | * __exidx_start
|
---|
26 | * __exidx_end
|
---|
27 | * __etext
|
---|
28 | * __data_start__
|
---|
29 | * __preinit_array_start
|
---|
30 | * __preinit_array_end
|
---|
31 | * __init_array_start
|
---|
32 | * __init_array_end
|
---|
33 | * __fini_array_start
|
---|
34 | * __fini_array_end
|
---|
35 | * __data_end__
|
---|
36 | * __bss_start__
|
---|
37 | * __bss_end__
|
---|
38 | * __end__
|
---|
39 | * end
|
---|
40 | * __HeapLimit
|
---|
41 | * __StackLimit
|
---|
42 | * __StackTop
|
---|
43 | * __stack
|
---|
44 | */
|
---|
45 | ENTRY(Reset_Handler)
|
---|
46 |
|
---|
47 | SECTIONS
|
---|
48 | {
|
---|
49 | .boot :
|
---|
50 | {
|
---|
51 | KEEP(*(.boot_loader))
|
---|
52 | } > BOOT_LOADER
|
---|
53 |
|
---|
54 | .text :
|
---|
55 | {
|
---|
56 |
|
---|
57 | Image$$VECTORS$$Base = .;
|
---|
58 | * (RESET)
|
---|
59 | Image$$VECTORS$$Limit = .;
|
---|
60 | . += 0x00000400;
|
---|
61 |
|
---|
62 | KEEP(*(.isr_vector))
|
---|
63 | *(SVC_TABLE)
|
---|
64 | *(.text*)
|
---|
65 |
|
---|
66 | KEEP(*(.init))
|
---|
67 | KEEP(*(.fini))
|
---|
68 |
|
---|
69 | /* .ctors */
|
---|
70 | *crtbegin.o(.ctors)
|
---|
71 | *crtbegin?.o(.ctors)
|
---|
72 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
---|
73 | *(SORT(.ctors.*))
|
---|
74 | *(.ctors)
|
---|
75 |
|
---|
76 | /* .dtors */
|
---|
77 | *crtbegin.o(.dtors)
|
---|
78 | *crtbegin?.o(.dtors)
|
---|
79 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
---|
80 | *(SORT(.dtors.*))
|
---|
81 | *(.dtors)
|
---|
82 |
|
---|
83 | Image$$RO_DATA$$Base = .;
|
---|
84 | *(.rodata*)
|
---|
85 | Image$$RO_DATA$$Limit = .;
|
---|
86 |
|
---|
87 | KEEP(*(.eh_frame*))
|
---|
88 | } > SFLASH
|
---|
89 |
|
---|
90 | .ARM.extab :
|
---|
91 | {
|
---|
92 | *(.ARM.extab* .gnu.linkonce.armextab.*)
|
---|
93 | } > SFLASH
|
---|
94 |
|
---|
95 | __exidx_start = .;
|
---|
96 | .ARM.exidx :
|
---|
97 | {
|
---|
98 | *(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
---|
99 | } > SFLASH
|
---|
100 | __exidx_end = .;
|
---|
101 |
|
---|
102 |
|
---|
103 | .copy.table :
|
---|
104 | {
|
---|
105 | . = ALIGN(4);
|
---|
106 | __copy_table_start__ = .;
|
---|
107 | LONG (__etext)
|
---|
108 | LONG (__data_start__)
|
---|
109 | LONG (__data_end__ - __data_start__)
|
---|
110 | LONG (__etext2)
|
---|
111 | LONG (__nc_data_start)
|
---|
112 | LONG (__nc_data_end - __nc_data_start)
|
---|
113 | __copy_table_end__ = .;
|
---|
114 | } > SFLASH
|
---|
115 |
|
---|
116 | .zero.table :
|
---|
117 | {
|
---|
118 | . = ALIGN(4);
|
---|
119 | __zero_table_start__ = .;
|
---|
120 | LONG (__bss_start__)
|
---|
121 | LONG (__bss_end__ - __bss_start__)
|
---|
122 | LONG (__nc_bss_start)
|
---|
123 | LONG (__nc_bss_end - __nc_bss_start)
|
---|
124 | __zero_table_end__ = .;
|
---|
125 | } > SFLASH
|
---|
126 |
|
---|
127 | __etext = .;
|
---|
128 |
|
---|
129 | .ttb :
|
---|
130 | {
|
---|
131 | Image$$TTB$$ZI$$Base = .;
|
---|
132 | . += 0x00004000;
|
---|
133 | Image$$TTB$$ZI$$Limit = .;
|
---|
134 | } > L_TTB
|
---|
135 |
|
---|
136 | .data : AT (__etext)
|
---|
137 | {
|
---|
138 | Image$$RW_DATA$$Base = .;
|
---|
139 | __data_start__ = .;
|
---|
140 | *(vtable)
|
---|
141 | *(.data*)
|
---|
142 | Image$$RW_DATA$$Limit = .;
|
---|
143 |
|
---|
144 | . = ALIGN(4);
|
---|
145 | /* preinit data */
|
---|
146 | PROVIDE (__preinit_array_start = .);
|
---|
147 | KEEP(*(.preinit_array))
|
---|
148 | PROVIDE (__preinit_array_end = .);
|
---|
149 |
|
---|
150 | . = ALIGN(4);
|
---|
151 | /* init data */
|
---|
152 | PROVIDE (__init_array_start = .);
|
---|
153 | KEEP(*(SORT(.init_array.*)))
|
---|
154 | KEEP(*(.init_array))
|
---|
155 | PROVIDE (__init_array_end = .);
|
---|
156 |
|
---|
157 |
|
---|
158 | . = ALIGN(4);
|
---|
159 | /* finit data */
|
---|
160 | PROVIDE (__fini_array_start = .);
|
---|
161 | KEEP(*(SORT(.fini_array.*)))
|
---|
162 | KEEP(*(.fini_array))
|
---|
163 | PROVIDE (__fini_array_end = .);
|
---|
164 |
|
---|
165 | . = ALIGN(4);
|
---|
166 | /* All data end */
|
---|
167 | __data_end__ = .;
|
---|
168 |
|
---|
169 | } > RAM
|
---|
170 |
|
---|
171 |
|
---|
172 | .bss ALIGN(0x400):
|
---|
173 | {
|
---|
174 | Image$$ZI_DATA$$Base = .;
|
---|
175 | __bss_start__ = .;
|
---|
176 | *(.bss*)
|
---|
177 | *(COMMON)
|
---|
178 | __bss_end__ = .;
|
---|
179 | Image$$ZI_DATA$$Limit = .;
|
---|
180 | } > RAM
|
---|
181 |
|
---|
182 |
|
---|
183 | .heap :
|
---|
184 | {
|
---|
185 | __end__ = .;
|
---|
186 | end = __end__;
|
---|
187 | *(.heap*)
|
---|
188 | __HeapLimit = .;
|
---|
189 | } > RAM
|
---|
190 |
|
---|
191 | /* .stack_dummy section doesn't contains any symbols. It is only
|
---|
192 | * used for linker to calculate size of stack sections, and assign
|
---|
193 | * values to stack symbols later */
|
---|
194 | .stack_dummy :
|
---|
195 | {
|
---|
196 | *(.stack)
|
---|
197 | } > RAM
|
---|
198 |
|
---|
199 | __etext2 = __etext + SIZEOF(.data);
|
---|
200 | .nc_data : AT (__etext2)
|
---|
201 | {
|
---|
202 | Image$$RW_DATA_NC$$Base = .;
|
---|
203 | __nc_data_start = .;
|
---|
204 | *(NC_DATA)
|
---|
205 |
|
---|
206 | . = ALIGN(4);
|
---|
207 | __nc_data_end = .;
|
---|
208 | Image$$RW_DATA_NC$$Limit = .;
|
---|
209 | } > RAM_NC
|
---|
210 |
|
---|
211 | .nc_bss (NOLOAD) :
|
---|
212 | {
|
---|
213 | Image$$ZI_DATA_NC$$Base = .;
|
---|
214 | __nc_bss_start = .;
|
---|
215 | *(NC_BSS)
|
---|
216 |
|
---|
217 | . = ALIGN(4);
|
---|
218 | __nc_bss_end = .;
|
---|
219 | Image$$ZI_DATA_NC$$Limit = .;
|
---|
220 | } > RAM_NC
|
---|
221 |
|
---|
222 | /* Set stack top to end of RAM, and stack limit move down by
|
---|
223 | * size of stack_dummy section */
|
---|
224 | __StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
---|
225 | __StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
---|
226 | PROVIDE(__stack = __StackTop);
|
---|
227 |
|
---|
228 | /* Check if data + heap + stack exceeds RAM limit */
|
---|
229 | ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
---|
230 |
|
---|
231 |
|
---|
232 | }
|
---|