1- /* *
2- ******************************************************************************
3- * @file STM32L476RG_FLASH.h
4- * @author WI6LABS
5- * @version V1.0.0
6- * @date 15-February-2016
7- * @brief Linker script for STM32L476RG Device with
8- * 256KByte FLASH, 32KByte RAM
9- *
10- * Set heap size, stack size and stack location according
11- * to application requirements.
12- *
13- * Set memory bank area and size if external memory is used.
14- *
15- ******************************************************************************
16- * @attention
17- *
18- * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
19- *
20- * Redistribution and use in source and binary forms, with or without modification,
21- * are permitted provided that the following conditions are met:
22- * 1. Redistributions of source code must retain the above copyright notice,
23- * this list of conditions and the following disclaimer.
24- * 2. Redistributions in binary form must reproduce the above copyright notice,
25- * this list of conditions and the following disclaimer in the documentation
26- * and/or other materials provided with the distribution.
27- * 3. Neither the name of STMicroelectronics nor the names of its contributors
28- * may be used to endorse or promote products derived from this software
29- * without specific prior written permission.
30- *
31- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
32- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
35- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
37- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
38- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
39- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41- *
42- ******************************************************************************
43- */
1+ /*
2+ *****************************************************************************
3+ **
4+
5+ ** File : LinkerScript.ld
6+ **
7+ ** Abstract : Linker script for STM32L432KCUx Device with
8+ ** 256KByte FLASH, 64KByte RAM
9+ **
10+ ** Set heap size, stack size and stack location according
11+ ** to application requirements.
12+ **
13+ ** Set memory bank area and size if external memory is used.
14+ **
15+ ** Target : STMicroelectronics STM32
16+ **
17+ **
18+ ** Distribution: The file is distributed as is, without any warranty
19+ ** of any kind.
20+ **
21+ ** (c)Copyright Ac6.
22+ ** You may use this file as-is or modify it according to the needs of your
23+ ** project. Distribution of this file (unmodified or modified) is not
24+ ** permitted. Ac6 permit registered System Workbench for MCU users the
25+ ** rights to distribute the assembled, compiled & linked contents of this
26+ ** file as part of an application binary file, provided that it is built
27+ ** using the System Workbench for MCU toolchain.
28+ **
29+ *****************************************************************************
30+ */
4431
4532/* Entry Point */
4633ENTRY (Reset_Handler)
4734
4835/* Highest address of the user mode stack */
49- _estack = 0x20017FFF ; /* end of RAM */
36+ _estack = 0x2000c000 ; /* end of RAM */
5037/* Generate a link error if heap and stack don't fit into RAM */
51- _Min_Heap_Size = 0x200 ;; /* required amount of heap */
52- _Min_Stack_Size = 0x400 ;; /* required amount of stack */
38+ _Min_Heap_Size = 0x200 ; /* required amount of heap */
39+ _Min_Stack_Size = 0x400 ; /* required amount of stack */
5340
5441/* Specify the memory areas */
5542MEMORY
5643{
57- FLASH (rx) : ORIGIN = 0x8000000 , LENGTH = 1024K
58- RAM (xrw) : ORIGIN = 0x20000000 , LENGTH = 96K
44+ FLASH (rx) : ORIGIN = 0x08000000 , LENGTH = 256K
45+ RAM (xrw) : ORIGIN = 0x20000000 , LENGTH = 48K
46+ SRAM2 (rw) : ORIGIN = 0x10000000 , LENGTH = 16K
5947}
6048
6149/* Define output sections */
@@ -64,15 +52,15 @@ SECTIONS
6452 /* The startup code goes first into FLASH */
6553 .isr_vector :
6654 {
67- . = ALIGN (4 );
55+ . = ALIGN (8 );
6856 KEEP (*(.isr_vector )) /* Startup code */
69- . = ALIGN (4 );
57+ . = ALIGN (8 );
7058 } >FLASH
7159
7260 /* The program code and other data goes into FLASH */
7361 .text :
7462 {
75- . = ALIGN (4 );
63+ . = ALIGN (8 );
7664 *(.text ) /* .text sections (code) */
7765 *(.text *) /* .text* sections (code) */
7866 *(.glue_7 ) /* glue arm to thumb code */
@@ -82,45 +70,59 @@ SECTIONS
8270 KEEP (*(.init ))
8371 KEEP (*(.fini ))
8472
85- . = ALIGN (4 );
73+ . = ALIGN (8 );
8674 _etext = .; /* define a global symbols at end of code */
8775 } >FLASH
8876
8977 /* Constant data goes into FLASH */
90- .rodata ALIGN ( 4 ) :
78+ .rodata :
9179 {
92- . = ALIGN (4 );
80+ . = ALIGN (8 );
9381 *(.rodata ) /* .rodata sections (constants, strings, etc.) */
9482 *(.rodata *) /* .rodata* sections (constants, strings, etc.) */
95- . = ALIGN (4 );
83+ . = ALIGN (8 );
9684 } >FLASH
9785
98- .ARM.extab : { *(.ARM .extab * .gnu .linkonce .armextab .*) } >FLASH
86+ .ARM.extab :
87+ {
88+ . = ALIGN (8 );
89+ *(.ARM .extab * .gnu .linkonce .armextab .*)
90+ . = ALIGN (8 );
91+ } >FLASH
9992 .ARM : {
93+ . = ALIGN (8 );
10094 __exidx_start = .;
10195 *(.ARM .exidx *)
10296 __exidx_end = .;
97+ . = ALIGN (8 );
10398 } >FLASH
10499
105100 .preinit_array :
106101 {
102+ . = ALIGN (8 );
107103 PROVIDE_HIDDEN (__preinit_array_start = .);
108104 KEEP (*(.preinit_array *))
109105 PROVIDE_HIDDEN (__preinit_array_end = .);
106+ . = ALIGN (8 );
110107 } >FLASH
108+
111109 .init_array :
112110 {
111+ . = ALIGN (8 );
113112 PROVIDE_HIDDEN (__init_array_start = .);
114113 KEEP (*(SORT (.init_array .*)))
115114 KEEP (*(.init_array *))
116115 PROVIDE_HIDDEN (__init_array_end = .);
116+ . = ALIGN (8 );
117117 } >FLASH
118118 .fini_array :
119119 {
120+ . = ALIGN (8 );
120121 PROVIDE_HIDDEN (__fini_array_start = .);
121122 KEEP (*(SORT (.fini_array .*)))
122123 KEEP (*(.fini_array *))
123124 PROVIDE_HIDDEN (__fini_array_end = .);
125+ . = ALIGN (8 );
124126 } >FLASH
125127
126128 /* used by the startup to initialize data */
@@ -129,15 +131,34 @@ SECTIONS
129131 /* Initialized data sections goes into RAM, load LMA copy after code */
130132 .data :
131133 {
132- . = ALIGN (4 );
134+ . = ALIGN (8 );
133135 _sdata = .; /* create a global symbol at data start */
134136 *(.data ) /* .data sections */
135137 *(.data *) /* .data* sections */
136138
137- . = ALIGN (4 );
139+ . = ALIGN (8 );
138140 _edata = .; /* define a global symbol at data end */
139141 } >RAM AT> FLASH
140142
143+ _sisram2 = LOADADDR (.sram2 );
144+
145+ /* CCM-RAM section
146+ *
147+ * IMPORTANT NOTE!
148+ * If initialized variables will be placed in this section,
149+ * the startup code needs to be modified to copy the init-values.
150+ */
151+ .sram2 :
152+ {
153+ . = ALIGN (8 );
154+ _ssram2 = .; /* create a global symbol at sram2 start */
155+ *(.sram2 )
156+ *(.sram2 *)
157+
158+ . = ALIGN (8 );
159+ _esram2 = .; /* create a global symbol at sram2 end */
160+ } >SRAM2 AT> FLASH
161+
141162
142163 /* Uninitialized data section */
143164 . = ALIGN (4 );
@@ -158,12 +179,12 @@ SECTIONS
158179 /* User_heap_stack section, used to check that there is enough RAM left */
159180 ._user_heap_stack :
160181 {
161- . = ALIGN (4 );
182+ . = ALIGN (8 );
162183 PROVIDE ( end = . );
163184 PROVIDE ( _end = . );
164185 . = . + _Min_Heap_Size;
165186 . = . + _Min_Stack_Size;
166- . = ALIGN (4 );
187+ . = ALIGN (8 );
167188 } >RAM
168189
169190
0 commit comments