Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 28 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /* |
1 | /* |
| 2 | ***************************************************************************** |
2 | ****************************************************************************** |
| 3 | ** |
3 | ** |
| 4 | 4 | ||
| 5 | ** File : LinkerScript.ld |
5 | ** File : LinkerScript.ld |
| 6 | ** |
6 | ** |
| 7 | ** Abstract : Linker script for STM32L152RETx Device with |
7 | ** Author : Auto-generated by System Workbench for STM32 |
| 8 | ** 512KByte FLASH, 80KByte RAM |
8 | ** |
| 9 | ** |
9 | ** Abstract : Linker script for STM32L152RETx series |
| 10 | ** Set heap size, stack size and stack location according |
10 | ** 512Kbytes FLASH and 80Kbytes RAM |
| 11 | ** to application requirements. |
11 | ** |
| 12 | ** |
12 | ** Set heap size, stack size and stack location according |
| 13 | ** Set memory bank area and size if external memory is used. |
13 | ** to application requirements. |
| 14 | ** |
14 | ** |
| 15 | ** Target : STMicroelectronics STM32 |
15 | ** Set memory bank area and size if external memory is used. |
| 16 | ** |
16 | ** |
| 17 | ** |
17 | ** Target : STMicroelectronics STM32 |
| 18 | ** Distribution: The file is distributed as is, without any warranty |
18 | ** |
| 19 | ** of any kind. |
19 | ** Distribution: The file is distributed “as is,” without any warranty |
| 20 | ** |
20 | ** of any kind. |
| 21 | ***************************************************************************** |
21 | ** |
| 22 | ** @attention |
22 | ***************************************************************************** |
| 23 | ** |
23 | ** @attention |
| 24 | ** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2> |
24 | ** |
| 25 | ** |
25 | ** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2> |
| 26 | ** Redistribution and use in source and binary forms, with or without modification, |
26 | ** |
| 27 | ** are permitted provided that the following conditions are met: |
27 | ** Redistribution and use in source and binary forms, with or without modification, |
| 28 | ** 1. Redistributions of source code must retain the above copyright notice, |
28 | ** are permitted provided that the following conditions are met: |
| 29 | ** this list of conditions and the following disclaimer. |
29 | ** 1. Redistributions of source code must retain the above copyright notice, |
| 30 | ** 2. Redistributions in binary form must reproduce the above copyright notice, |
30 | ** this list of conditions and the following disclaimer. |
| 31 | ** this list of conditions and the following disclaimer in the documentation |
31 | ** 2. Redistributions in binary form must reproduce the above copyright notice, |
| 32 | ** and/or other materials provided with the distribution. |
32 | ** this list of conditions and the following disclaimer in the documentation |
| 33 | ** 3. Neither the name of Ac6 nor the names of its contributors |
33 | ** and/or other materials provided with the distribution. |
| 34 | ** may be used to endorse or promote products derived from this software |
34 | ** 3. Neither the name of STMicroelectronics nor the names of its contributors |
| 35 | ** without specific prior written permission. |
35 | ** may be used to endorse or promote products derived from this software |
| 36 | ** |
36 | ** without specific prior written permission. |
| 37 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
37 | ** |
| 38 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
38 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 39 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
39 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 40 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
40 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 41 | ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
41 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 42 | ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
42 | ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 43 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
43 | ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 44 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
44 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 45 | ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
45 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 46 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
46 | ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 47 | ** |
47 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 48 | ***************************************************************************** |
48 | ** |
| 49 | */ |
49 | ***************************************************************************** |
| 50 | 50 | */ |
|
| 51 | /* Entry Point */ |
51 | |
| 52 | ENTRY(Reset_Handler) |
52 | /* Entry Point */ |
| 53 | 53 | ENTRY(Reset_Handler) |
|
| 54 | /* Highest address of the user mode stack */ |
54 | |
| 55 | _estack = 0x20014000; /* end of RAM */ |
55 | /* Highest address of the user mode stack */ |
| 56 | /* Generate a link error if heap and stack don't fit into RAM */ |
56 | _estack = 0x20014000; /* end of RAM */ |
| 57 | _Min_Heap_Size = 0x200; /* required amount of heap */ |
57 | /* Generate a link error if heap and stack don't fit into RAM */ |
| 58 | _Min_Stack_Size = 0x400; /* required amount of stack */ |
58 | _Min_Heap_Size = 0x200; /* required amount of heap */ |
| 59 | 59 | _Min_Stack_Size = 0x400; /* required amount of stack */ |
|
| 60 | /* Specify the memory areas */ |
60 | |
| 61 | MEMORY |
61 | /* Specify the memory areas */ |
| 62 | { |
62 | MEMORY |
| 63 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K |
63 | { |
| 64 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 80K |
64 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 80K |
| 65 | } |
65 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K |
| 66 | 66 | } |
|
| 67 | /* Define output sections */ |
67 | |
| 68 | SECTIONS |
68 | /* Define output sections */ |
| 69 | { |
69 | SECTIONS |
| 70 | /* The startup code goes first into FLASH */ |
70 | { |
| 71 | .isr_vector : |
71 | /* The startup code goes first into FLASH */ |
| 72 | { |
72 | .isr_vector : |
| 73 | . = ALIGN(4); |
73 | { |
| 74 | KEEP(*(.isr_vector)) /* Startup code */ |
74 | . = ALIGN(4); |
| 75 | . = ALIGN(4); |
75 | KEEP(*(.isr_vector)) /* Startup code */ |
| 76 | } >FLASH |
76 | . = ALIGN(4); |
| 77 | 77 | } >FLASH |
|
| 78 | /* The program code and other data goes into FLASH */ |
78 | |
| 79 | .text : |
79 | /* The program code and other data goes into FLASH */ |
| 80 | { |
80 | .text : |
| 81 | . = ALIGN(4); |
81 | { |
| 82 | *(.text) /* .text sections (code) */ |
82 | . = ALIGN(4); |
| 83 | *(.text*) /* .text* sections (code) */ |
83 | *(.text) /* .text sections (code) */ |
| 84 | *(.glue_7) /* glue arm to thumb code */ |
84 | *(.text*) /* .text* sections (code) */ |
| 85 | *(.glue_7t) /* glue thumb to arm code */ |
85 | *(.glue_7) /* glue arm to thumb code */ |
| 86 | *(.eh_frame) |
86 | *(.glue_7t) /* glue thumb to arm code */ |
| 87 | 87 | *(.eh_frame) |
|
| 88 | KEEP (*(.init)) |
88 | |
| 89 | KEEP (*(.fini)) |
89 | KEEP (*(.init)) |
| 90 | 90 | KEEP (*(.fini)) |
|
| 91 | . = ALIGN(4); |
91 | |
| 92 | _etext = .; /* define a global symbols at end of code */ |
92 | . = ALIGN(4); |
| 93 | } >FLASH |
93 | _etext = .; /* define a global symbols at end of code */ |
| 94 | 94 | } >FLASH |
|
| 95 | /* Constant data goes into FLASH */ |
95 | |
| 96 | .rodata : |
96 | /* Constant data goes into FLASH */ |
| 97 | { |
97 | .rodata : |
| 98 | . = ALIGN(4); |
98 | { |
| 99 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ |
99 | . = ALIGN(4); |
| 100 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ |
100 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ |
| 101 | . = ALIGN(4); |
101 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ |
| 102 | } >FLASH |
102 | . = ALIGN(4); |
| 103 | 103 | } >FLASH |
|
| 104 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH |
104 | |
| 105 | .ARM : { |
105 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH |
| 106 | __exidx_start = .; |
106 | .ARM : { |
| 107 | *(.ARM.exidx*) |
107 | __exidx_start = .; |
| 108 | __exidx_end = .; |
108 | *(.ARM.exidx*) |
| 109 | } >FLASH |
109 | __exidx_end = .; |
| 110 | 110 | } >FLASH |
|
| 111 | .preinit_array : |
111 | |
| 112 | { |
112 | .preinit_array : |
| 113 | PROVIDE_HIDDEN (__preinit_array_start = .); |
113 | { |
| 114 | KEEP (*(.preinit_array*)) |
114 | PROVIDE_HIDDEN (__preinit_array_start = .); |
| 115 | PROVIDE_HIDDEN (__preinit_array_end = .); |
115 | KEEP (*(.preinit_array*)) |
| 116 | } >FLASH |
116 | PROVIDE_HIDDEN (__preinit_array_end = .); |
| 117 | .init_array : |
117 | } >FLASH |
| 118 | { |
118 | .init_array : |
| 119 | PROVIDE_HIDDEN (__init_array_start = .); |
119 | { |
| 120 | KEEP (*(SORT(.init_array.*))) |
120 | PROVIDE_HIDDEN (__init_array_start = .); |
| 121 | KEEP (*(.init_array*)) |
121 | KEEP (*(SORT(.init_array.*))) |
| 122 | PROVIDE_HIDDEN (__init_array_end = .); |
122 | KEEP (*(.init_array*)) |
| 123 | } >FLASH |
123 | PROVIDE_HIDDEN (__init_array_end = .); |
| 124 | .fini_array : |
124 | } >FLASH |
| 125 | { |
125 | .fini_array : |
| 126 | PROVIDE_HIDDEN (__fini_array_start = .); |
126 | { |
| 127 | KEEP (*(SORT(.fini_array.*))) |
127 | PROVIDE_HIDDEN (__fini_array_start = .); |
| 128 | KEEP (*(.fini_array*)) |
128 | KEEP (*(SORT(.fini_array.*))) |
| 129 | PROVIDE_HIDDEN (__fini_array_end = .); |
129 | KEEP (*(.fini_array*)) |
| 130 | } >FLASH |
130 | PROVIDE_HIDDEN (__fini_array_end = .); |
| 131 | 131 | } >FLASH |
|
| 132 | /* used by the startup to initialize data */ |
132 | |
| 133 | _sidata = LOADADDR(.data); |
133 | /* used by the startup to initialize data */ |
| 134 | 134 | _sidata = LOADADDR(.data); |
|
| 135 | /* Initialized data sections goes into RAM, load LMA copy after code */ |
135 | |
| 136 | .data : |
136 | /* Initialized data sections goes into RAM, load LMA copy after code */ |
| 137 | { |
137 | .data : |
| 138 | . = ALIGN(4); |
138 | { |
| 139 | _sdata = .; /* create a global symbol at data start */ |
139 | . = ALIGN(4); |
| 140 | *(.data) /* .data sections */ |
140 | _sdata = .; /* create a global symbol at data start */ |
| 141 | *(.data*) /* .data* sections */ |
141 | *(.data) /* .data sections */ |
| 142 | 142 | *(.data*) /* .data* sections */ |
|
| 143 | . = ALIGN(4); |
143 | |
| 144 | _edata = .; /* define a global symbol at data end */ |
144 | . = ALIGN(4); |
| 145 | } >RAM AT> FLASH |
145 | _edata = .; /* define a global symbol at data end */ |
| 146 | 146 | } >RAM AT> FLASH |
|
| 147 | 147 | ||
| 148 | /* Uninitialized data section */ |
148 | |
| 149 | . = ALIGN(4); |
149 | /* Uninitialized data section */ |
| 150 | .bss : |
150 | . = ALIGN(4); |
| 151 | { |
151 | .bss : |
| 152 | /* This is used by the startup in order to initialize the .bss secion */ |
152 | { |
| 153 | _sbss = .; /* define a global symbol at bss start */ |
153 | /* This is used by the startup in order to initialize the .bss secion */ |
| 154 | __bss_start__ = _sbss; |
154 | _sbss = .; /* define a global symbol at bss start */ |
| 155 | *(.bss) |
155 | __bss_start__ = _sbss; |
| 156 | *(.bss*) |
156 | *(.bss) |
| 157 | *(COMMON) |
157 | *(.bss*) |
| 158 | 158 | *(COMMON) |
|
| 159 | . = ALIGN(4); |
159 | |
| 160 | _ebss = .; /* define a global symbol at bss end */ |
160 | . = ALIGN(4); |
| 161 | __bss_end__ = _ebss; |
161 | _ebss = .; /* define a global symbol at bss end */ |
| 162 | } >RAM |
162 | __bss_end__ = _ebss; |
| 163 | 163 | } >RAM |
|
| 164 | /* User_heap_stack section, used to check that there is enough RAM left */ |
164 | |
| 165 | ._user_heap_stack : |
165 | /* User_heap_stack section, used to check that there is enough RAM left */ |
| 166 | { |
166 | ._user_heap_stack : |
| 167 | . = ALIGN(8); |
167 | { |
| 168 | PROVIDE ( end = . ); |
168 | . = ALIGN(8); |
| 169 | PROVIDE ( _end = . ); |
169 | PROVIDE ( end = . ); |
| 170 | . = . + _Min_Heap_Size; |
170 | PROVIDE ( _end = . ); |
| 171 | . = . + _Min_Stack_Size; |
171 | . = . + _Min_Heap_Size; |
| 172 | . = ALIGN(8); |
172 | . = . + _Min_Stack_Size; |
| 173 | } >RAM |
173 | . = ALIGN(8); |
| 174 | 174 | } >RAM |
|
| 175 | 175 | ||
| 176 | 176 | ||
| 177 | /* Remove information from the standard libraries */ |
177 | |
| 178 | /DISCARD/ : |
178 | /* Remove information from the standard libraries */ |
| 179 | { |
179 | /DISCARD/ : |
| 180 | libc.a ( * ) |
180 | { |
| 181 | libm.a ( * ) |
181 | libc.a ( * ) |
| 182 | libgcc.a ( * ) |
182 | libm.a ( * ) |
| 183 | } |
183 | libgcc.a ( * ) |
| 184 | 184 | } |
|
| 185 | .ARM.attributes 0 : { *(.ARM.attributes) } |
185 | |
| 186 | } |
186 | .ARM.attributes 0 : { *(.ARM.attributes) } |
| 187 | 187 | } |
|
| 188 | 188 | ||
| - | 189 | ||