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