annotate Small_CPU/CPU2-RTE.ld @ 38:5f11787b4f42

include in ostc4 repository
author heinrichsweikamp
date Sat, 28 Apr 2018 11:52:34 +0200
parents
children da86a7adc4fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /* ---------------------------------------------------------------------------- */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /* Em::Blocks embedded development Support */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 /* ---------------------------------------------------------------------------- */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /* Copyright (c) 2014, EmBlocks */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /* All rights reserved. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 /* Redistribution and use in source and binary forms, with or without */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /* modification, are permitted provided that the following condition is met: */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /* - Redistributions of source code must retain the above copyright notice, */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 /* this list of conditions and the disclaimer below. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 /* EmBlocks's name may not be used to endorse or promote products derived from */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /* this software without specific prior written permission. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY EBLOCKS "AS IS" AND ANY EXPRESS OR */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /* DISCLAIMED. IN NO EVENT SHALL EMBLOCKS BE LIABLE FOR ANY DIRECT, INDIRECT, */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 /* ---------------------------------------------------------------------------- */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /*------------------------------------------------------------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 * Linker script for running in internal FLASH on the STM32F401RE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 *----------------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 OUTPUT_ARCH(arm)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 SEARCH_DIR(.)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 /* Memory Spaces Definitions */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 MEMORY
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 ROM (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* 80000 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 96K
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 /* Linker script to place sections and symbol values. Should be used together
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 * with other linker script that defines memory regions FLASH and RAM.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 * It references following symbols, which must be defined in code:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 * Reset_Handler : Entry of reset handler
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 * It defines following symbols, which code can use without definition:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 * __exidx_start
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 * __exidx_end
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 * __etext
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 * __data_start__
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 * __preinit_array_start
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 * __preinit_array_end
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 * __init_array_start
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 * __init_array_end
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 * __fini_array_start
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 * __fini_array_end
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 * __data_end__
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 * __bss_start__
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 * __bss_end__
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 * __end__
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 * end
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 * __HeapLimit
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 * __StackLimit
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 * __StackTop
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 * __stack
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 SECTIONS
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 /* Place FirmwareData at absolute address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 .firmware_data 0x08005000:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 cpu2_FirmwareData = 0x08005000;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 } > ROM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 .text ORIGIN(ROM) :
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 KEEP(*(.isr_vector))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 *(.text*)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 KEEP(*(.init))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 KEEP(*(.fini))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 /* .ctors */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 *crtbegin.o(.ctors)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 *crtbegin?.o(.ctors)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 *(SORT(.ctors.*))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 *(.ctors)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 /* .dtors */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 *crtbegin.o(.dtors)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 *crtbegin?.o(.dtors)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 *(SORT(.dtors.*))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 *(.dtors)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 *(.rodata*)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 KEEP(*(.eh_frame*))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 } > ROM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 .ARM.extab :
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 *(.ARM.extab* .gnu.linkonce.armextab.*)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 } > ROM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 __exidx_start = .;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 .ARM.exidx :
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 } > ROM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 __exidx_end = .;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 __etext = .;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 .data : AT (__etext)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 __data_start__ = .;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 *(vtable)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 *(.data*)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 . = ALIGN(4);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 /* preinit data */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 PROVIDE_HIDDEN (__preinit_array_start = .);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 KEEP(*(.preinit_array))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 PROVIDE_HIDDEN (__preinit_array_end = .);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 . = ALIGN(4);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 /* init data */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 PROVIDE_HIDDEN (__init_array_start = .);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 KEEP(*(SORT(.init_array.*)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 KEEP(*(.init_array))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 PROVIDE_HIDDEN (__init_array_end = .);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 . = ALIGN(4);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 /* finit data */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 PROVIDE_HIDDEN (__fini_array_start = .);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 KEEP(*(SORT(.fini_array.*)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 KEEP(*(.fini_array))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 PROVIDE_HIDDEN (__fini_array_end = .);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 . = ALIGN(4);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 /* All data end */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 __data_end__ = .;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 } > RAM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 .bss (NOLOAD):
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 __bss_start__ = .;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 *(.bss*)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 *(COMMON)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 __bss_end__ = .;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 } > RAM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 .heap (NOLOAD):
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 __end__ = .;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 end = __end__;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 *(.heap*)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 __HeapLimit = .;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 } > RAM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 /* .stack_dummy section doesn't contains any symbols. It is only
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 * used for linker to calculate size of stack sections, and assign
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 * values to stack symbols later */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 .stack_dummy (NOLOAD):
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 *(.stack)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 } > RAM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 /* Set stack top to end of RAM, and stack limit move down by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 * size of stack_dummy section */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 __StackTop = ORIGIN(RAM) + LENGTH(RAM);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 __StackLimit = __StackTop - SIZEOF(.stack_dummy);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 PROVIDE(__stack = __StackTop);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 /* Check if data + heap + stack exceeds RAM limit */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 }