1
- /* Based on the linker script from CMSIS for GCC for ARM Embedded Processors.
2
- * Should be included after memory layout script.
3
- */
4
-
5
- /* Library configurations */
6
- GROUP (libgcc.a libc.a libm.a )
7
-
8
- /* Linker script to place sections and symbol values. Should be used together
9
- * with other linker script that defines memory regions FLASH and RAM.
10
- * It references following symbols, which must be defined in code :
11
- * Reset_Handler : Entry of reset handler
12
- *
13
- * It defines following symbols, which code can use without definition :
14
- * __exidx_start
15
- * __exidx_end
16
- * __etext
17
- * __data_start__
18
- * __preinit_array_start
19
- * __preinit_array_end
20
- * __init_array_start
21
- * __init_array_end
22
- * __fini_array_start
23
- * __fini_array_end
24
- * __data_end__
25
- * __bss_start__
26
- * __bss_end__
27
- * __end__
28
- * end
29
- * __HeapLimit
30
- * __StackLimit
31
- * __StackTop
32
- * __stack
33
- */
34
-
35
- /* Used in QEMU, the embedded images entry point is in the interrupts table */
36
- ENTRY (Reset_Handler )
1
+ /*
2
+ Default linker script for STM32F10x_1024K_1024K
3
+ Copyright RAISONANCE S.A.S. 2008
4
+ */
5
+
6
+ /* include the common STM32F10x sub-script */
7
+
8
+ /* Common part of the linker scripts for STM32 devices*/
9
+
10
+
11
+ /* default stack sizes.
12
+
13
+ These are used by the startup in order to allocate stacks for the different modes.
14
+ */
15
+
16
+ __Stack_Size = 1024 ;
17
+
18
+ PROVIDE ( _Stack_Size = __Stack_Size ) ;
19
+
20
+ __Stack_Init = _estack - __Stack_Size ;
21
+
22
+ /*"PROVIDE " allows to easily override these values from an object file or the commmand line.*/
23
+ PROVIDE ( _Stack_Init = __Stack_Init ) ;
24
+
25
+ /*
26
+ There will be a link error if there is not this amount of RAM free at the end.
27
+ */
28
+ _Minimum_Stack_Size = 0x100 ;
29
+
30
+
31
+
32
+ /* include the sections management sub-script for FLASH mode */
33
+
34
+ /* Sections Definitions */
37
35
38
36
SECTIONS
39
37
{
40
- .text :
41
- {
42
- KEEP(*(.core_isr_vectors))
43
- KEEP(*(.family_isr_vectors))
44
- KEEP(*(.device_isr_vectors))
45
- KEEP(*(.isr_vector))
46
- *(.text*)
47
-
48
- KEEP(*(.init))
49
- KEEP(*(.fini))
50
-
51
- /* .ctors */
52
- *crtbegin.o (.ctors)
53
- *crtbegin?.o (.ctors)
54
- *(EXCLUDE_FILE (*crtend?.o *crtend.o ) .ctors)
55
- *(SORT(.ctors.*))
56
- *(.ctors)
57
-
58
- /* .dtors */
59
- *crtbegin.o (.dtors)
60
- *crtbegin?.o (.dtors)
61
- *(EXCLUDE_FILE (*crtend?.o *crtend.o ) .dtors)
62
- *(SORT(.dtors.*))
63
- *(.dtors)
64
-
65
- . = ALIGN (4);
66
- /* preinit data */
67
- PROVIDE_HIDDEN (__preinit_array_start = .);
68
- KEEP(*(.preinit_array))
69
- PROVIDE_HIDDEN (__preinit_array_end = .);
70
-
71
- . = ALIGN (4);
72
- /* init data */
73
- PROVIDE_HIDDEN (__init_array_start = .);
74
- KEEP(*(SORT(.init_array.*)))
75
- KEEP(*(.init_array))
76
- PROVIDE_HIDDEN (__init_array_end = .);
77
-
78
-
79
- . = ALIGN (4);
80
- /* finit data */
81
- PROVIDE_HIDDEN (__fini_array_start = .);
82
- KEEP(*(SORT(.fini_array.*)))
83
- KEEP(*(.fini_array))
84
- PROVIDE_HIDDEN (__fini_array_end = .);
85
-
86
- *(.rodata*)
87
-
88
- KEEP(*(.eh_frame*))
89
- } > FLASH
90
-
91
- .ARM.extab :
92
- {
93
- *(.ARM.extab* .gnu.linkonce.armextab.*)
94
- } > FLASH
95
-
96
- __exidx_start = .;
97
- .ARM.exidx :
98
- {
99
- *(.ARM.exidx* .gnu.linkonce.armexidx.*)
100
- } > FLASH
101
- __exidx_end = .;
102
-
103
- __etext = .;
104
- _sidata = .; /* STM libs specifics */
105
-
106
- /* The initialised data section is stored immediately
107
- at the end of the text section */
108
- .data : AT (__etext)
109
- {
110
- __data_start__ = .;
111
- _sdata = .; /* STM libs specifics */
112
-
113
- *(vtable)
114
- *(.data*)
115
-
116
- . = ALIGN (4);
117
- /* init_array/fini_array moved to flash, align preserved */
118
-
119
- KEEP(*(.jcr*))
120
- . = ALIGN (4);
121
- /* All data end */
122
-
123
- __data_end__ = .;
124
- _edata = .; /* STM libs specifics */
125
-
126
- } > RAM
127
-
128
- .bss :
129
- {
130
- . = ALIGN (4);
131
- __bss_start__ = .;
132
- _sbss = .; /* STM libs specifics */
133
-
134
- *(.bss*)
135
- *(COMMON)
136
- . = ALIGN (4);
137
- __bss_end__ = .;
138
- _ebss = .; /* STM libs specifics */
139
-
140
- } > RAM
141
-
142
- .heap (COPY) :
143
- {
144
- __end__ = .;
145
- end = __end__;
146
- *(.heap*)
147
- __HeapLimit = .;
148
- } > RAM
149
-
150
- /* .stack_dummy section doesn't contains any symbols. It is only
151
- * used for linker to calculate size of stack sections, and assign
152
- * values to stack symbols later */
153
- .stack_dummy (COPY) :
154
- {
155
- *(.stack*)
156
- } > RAM
157
-
158
- /* Set stack top to end of RAM, and stack limit move down by
159
- * size of stack_dummy section */
160
- __StackTop = ORIGIN (RAM) + LENGTH (RAM);
161
- __StackLimit = __StackTop - SIZEOF (.stack_dummy);
162
-
163
- PROVIDE (__stack = __StackTop);
164
- PROVIDE (_estack = __StackTop); /* STM libs specifics */
165
-
166
- /* Check if data + heap + stack exceeds RAM limit */
167
- ASSERT (__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
168
-
169
-
170
- /* The following is from F4 linker scripts */
171
-
172
- /* after that it's only debugging information. */
38
+ /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */
39
+ .isr_vector :
40
+ {
41
+ . = ALIGN (4);
42
+ KEEP(*(.isr_vector)) /* Startup code */
43
+ . = ALIGN (4);
44
+ } >FLASH
45
+
46
+ /* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */
47
+ .flashtext :
48
+ {
49
+ . = ALIGN (4);
50
+ *(.flashtext) /* Startup code */
51
+ . = ALIGN (4);
52
+ } >FLASH
53
+
54
+
55
+ /* the program code is stored in the .text section, which goes to Flash */
56
+ .text :
57
+ {
58
+ . = ALIGN (4);
59
+
60
+ *(.text) /* remaining code */
61
+ *(.text.*) /* remaining code */
62
+ *(.rodata) /* read-only data (constants) */
63
+ *(.rodata*)
64
+ *(.glue_7)
65
+ *(.glue_7t)
66
+
67
+ . = ALIGN (4);
68
+ _etext = .;
69
+ /* This is used by the startup in order to initialize the .data secion */
70
+ _sidata = _etext;
71
+ } >FLASH
72
+
73
+
74
+
75
+ /* This is the initialized data section
76
+ The program executes knowing that the data is in the RAM
77
+ but the loader puts the initial values in the FLASH (inidata).
78
+ It is one task of the startup to copy the initial values from FLASH to RAM. */
79
+ .data : AT ( _sidata )
80
+ {
81
+ . = ALIGN (4);
82
+ /* This is used by the startup in order to initialize the .data secion */
83
+ _sdata = . ;
84
+
85
+ *(.data)
86
+ *(.data.*)
87
+
88
+ . = ALIGN (4);
89
+ /* This is used by the startup in order to initialize the .data secion */
90
+ _edata = . ;
91
+ } >RAM
92
+
93
+
94
+
95
+ /* This is the uninitialized data section */
96
+ .bss :
97
+ {
98
+ . = ALIGN (4);
99
+ /* This is used by the startup in order to initialize the .bss secion */
100
+ _sbss = .;
101
+
102
+ *(.bss)
103
+ *(COMMON)
104
+
105
+ . = ALIGN (4);
106
+ /* This is used by the startup in order to initialize the .bss secion */
107
+ _ebss = . ;
108
+ } >RAM
109
+
110
+ PROVIDE ( end = _ebss );
111
+ PROVIDE ( _end = _ebss );
112
+
113
+ /* This is the user stack section
114
+ This is just to check that there is enough RAM left for the User mode stack
115
+ It should generate an error if it's full.
116
+ */
117
+ ._usrstack :
118
+ {
119
+ . = ALIGN (4);
120
+ _susrstack = . ;
121
+
122
+ . = . + _Minimum_Stack_Size ;
123
+
124
+ . = ALIGN (4);
125
+ _eusrstack = . ;
126
+ } >RAM
127
+
128
+
129
+
130
+ /* this is the FLASH Bank1 */
131
+ /* the C or assembly source must explicitly place the code or data there
132
+ using the "section" attribute */
133
+ .b1text :
134
+ {
135
+ *(.b1text) /* remaining code */
136
+ *(.b1rodata) /* read-only data (constants) */
137
+ *(.b1rodata*)
138
+ } >FLASHB1
139
+
140
+ /* this is the EXTMEM */
141
+ /* the C or assembly source must explicitly place the code or data there
142
+ using the "section" attribute */
143
+
144
+ /* EXTMEM Bank0 */
145
+ .eb0text :
146
+ {
147
+ *(.eb0text) /* remaining code */
148
+ *(.eb0rodata) /* read-only data (constants) */
149
+ *(.eb0rodata*)
150
+ } >EXTMEMB0
151
+
152
+ /* EXTMEM Bank1 */
153
+ .eb1text :
154
+ {
155
+ *(.eb1text) /* remaining code */
156
+ *(.eb1rodata) /* read-only data (constants) */
157
+ *(.eb1rodata*)
158
+ } >EXTMEMB1
159
+
160
+ /* EXTMEM Bank2 */
161
+ .eb2text :
162
+ {
163
+ *(.eb2text) /* remaining code */
164
+ *(.eb2rodata) /* read-only data (constants) */
165
+ *(.eb2rodata*)
166
+ } >EXTMEMB2
167
+
168
+ /* EXTMEM Bank0 */
169
+ .eb3text :
170
+ {
171
+ *(.eb3text) /* remaining code */
172
+ *(.eb3rodata) /* read-only data (constants) */
173
+ *(.eb3rodata*)
174
+ } >EXTMEMB3
175
+
176
+
177
+
178
+ /* after that it's only debugging information. */
173
179
174
180
/* remove the debugging information from the standard libraries */
175
181
DISCARD :
@@ -178,8 +184,7 @@ SECTIONS
178
184
libm.a ( * )
179
185
libgcc.a ( * )
180
186
}
181
-
182
-
187
+
183
188
/* Stabs debugging sections. */
184
189
.stab 0 : { *(.stab) }
185
190
.stabstr 0 : { *(.stabstr) }
@@ -212,6 +217,5 @@ SECTIONS
212
217
.debug_weaknames 0 : { *(.debug_weaknames) }
213
218
.debug_funcnames 0 : { *(.debug_funcnames) }
214
219
.debug_typenames 0 : { *(.debug_typenames) }
215
- .debug_varnames 0 : { *(.debug_varnames) }
216
-
220
+ .debug_varnames 0 : { *(.debug_varnames) }
217
221
}
0 commit comments