1- /*
2- ******************************************************************************
3- **
4- ** File : LinkerScript.ld
5- **
6- ** Abstract : Linker script for STM32MP1 series
7- **
8- ** Set heap size, stack size and stack location according
9- ** to application requirements.
10- **
11- ** Set memory bank area and size if external memory is used.
12- **
13- ** Target : STMicroelectronics STM32
14- **
15- ** Distribution: The file is distributed “as is,” without any warranty
16- ** of any kind.
17- **
18- *****************************************************************************
19- ** @attention
20- **
21- ** <h2><center>© Copyright (c) 2019 STMicroelectronics.
22- ** All rights reserved.</center></h2>
23- **
24- ** This software component is licensed by ST under BSD 3-Clause license,
25- ** the License; You may not use this file except in compliance with the
26- ** License. You may obtain a copy of the License at:
27- ** opensource.org/licenses/BSD-3-Clause
28- **
29- *****************************************************************************
30- */
1+ /* *
2+ ******************************************************************************
3+ * @file LinkerScript.ld
4+ * @author Auto-generated by STM32CubeIDE
5+ * @brief Linker script for STM32MP157xAC series
6+ * 128Kbytes FLASH
7+ * 128Kbytes RAM1
8+ * 128Kbytes RAM2
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+ * @attention
16+ *
17+ * <h2><center>© Copyright (c) 2021 STMicroelectronics.
18+ * All rights reserved.</center></h2>
19+ *
20+ * This software component is licensed by ST under BSD 3-Clause license,
21+ * the "License"; You may not use this file except in compliance with the
22+ * License. You may obtain a copy of the License at:
23+ * opensource.org/licenses/BSD-3-Clause
24+ *
25+ ******************************************************************************
26+ */
3127
3228/* Entry Point */
3329ENTRY (Reset_Handler)
3430
3531/* Highest address of the user mode stack */
36- _estack = 0x10040000; /* end of RAM */
32+ _estack = ORIGIN(RAM1_data) + LENGTH(RAM1_data); /* end of "RAM1_data" Ram type memory */
3733
38- _Min_Heap_Size = 0x200 ; /* required amount of heap */
39- _Min_Stack_Size = 0x400 ; /* required amount of stack */
34+ _Min_Heap_Size = 0x200 ; /* required amount of heap */
35+ _Min_Stack_Size = 0x400 ; /* required amount of stack */
4036
4137/* Memories definition */
4238MEMORY
4339{
44- m_interrupts ( RX) : ORIGIN = 0x00000000 , LENGTH = 0x00000298
45- m_text ( RX) : ORIGIN = 0x10000000 , LENGTH = 0x00020000
46- m_data ( RW) : ORIGIN = 0x10020000 , LENGTH = 0x00020000
47- m_ipc_shm ( RW) : ORIGIN = 0x10040000 , LENGTH = 0x00008000
40+ RETRAM_interrupts ( xrw) : ORIGIN = 0x00000000 , LENGTH = 0x00000298
41+ FLASH_text ( rx) : ORIGIN = 0x10000000 , LENGTH = 128K
42+ RAM1_data ( xrw) : ORIGIN = 0x10020000 , LENGTH = 128K
43+ RAM2_ipc_shm ( xrw) : ORIGIN = 0x10040000 , LENGTH = 0x00008000
4844}
4945
5046 /* Symbols needed for OpenAMP to enable rpmsg */
51- __OPENAMP_region_start__ = ORIGIN (m_ipc_shm );
52- __OPENAMP_region_end__ = ORIGIN (m_ipc_shm )+LENGTH (m_ipc_shm );
47+ __OPENAMP_region_start__ = ORIGIN (RAM2_ipc_shm );
48+ __OPENAMP_region_end__ = ORIGIN (RAM2_ipc_shm )+LENGTH (RAM2_ipc_shm );
5349
5450/* Sections */
5551SECTIONS
5652{
57- /* The startup code into ROM memory */
53+ /* The startup code into "RETRAM_interrupts" Ram type memory */
5854 .isr_vector :
5955 {
6056 . = ALIGN (4 );
6157 KEEP (*(.isr_vector )) /* Startup code */
6258 . = ALIGN (4 );
63- } > m_interrupts
64-
59+ } >RETRAM_interrupts
6560
66- /* The program code and other data into ROM memory */
61+ /* The program code and other data into "FLASH_text" Rom type memory */
6762 .text :
6863 {
6964 . = ALIGN (4 );
@@ -78,30 +73,30 @@ SECTIONS
7873
7974 . = ALIGN (4 );
8075 _etext = .; /* define a global symbols at end of code */
81- } > m_text
76+ } >FLASH_text
8277
83- /* Constant data into ROM memory*/
78+ /* Constant data into "FLASH_text" Rom type memory */
8479 .rodata :
8580 {
8681 . = ALIGN (4 );
8782 *(.rodata ) /* .rodata sections (constants, strings, etc.) */
8883 *(.rodata *) /* .rodata* sections (constants, strings, etc.) */
8984 . = ALIGN (4 );
90- } > m_text
85+ } >FLASH_text
9186
92- .ARM.extab : {
87+ .ARM.extab : {
9388 . = ALIGN (4 );
9489 *(.ARM .extab * .gnu .linkonce .armextab .*)
9590 . = ALIGN (4 );
96- } > m_text
97-
91+ } >FLASH_text
92+
9893 .ARM : {
9994 . = ALIGN (4 );
10095 __exidx_start = .;
10196 *(.ARM .exidx *)
10297 __exidx_end = .;
10398 . = ALIGN (4 );
104- } > m_text
99+ } >FLASH_text
105100
106101 .preinit_array :
107102 {
@@ -110,8 +105,8 @@ SECTIONS
110105 KEEP (*(.preinit_array *))
111106 PROVIDE_HIDDEN (__preinit_array_end = .);
112107 . = ALIGN (4 );
113- } > m_text
114-
108+ } >FLASH_text
109+
115110 .init_array :
116111 {
117112 . = ALIGN (4 );
@@ -120,8 +115,8 @@ SECTIONS
120115 KEEP (*(.init_array *))
121116 PROVIDE_HIDDEN (__init_array_end = .);
122117 . = ALIGN (4 );
123- } > m_text
124-
118+ } >FLASH_text
119+
125120 .fini_array :
126121 {
127122 . = ALIGN (4 );
@@ -130,13 +125,13 @@ SECTIONS
130125 KEEP (*(.fini_array *))
131126 PROVIDE_HIDDEN (__fini_array_end = .);
132127 . = ALIGN (4 );
133- } > m_text
128+ } >FLASH_text
134129
135130 /* Used by the startup to initialize data */
136131 __DATA_ROM = .;
137132 _sidata = LOADADDR (.data );
138133
139- /* Initialized data sections */
134+ /* Initialized data sections into "RAM1_data" Ram type memory */
140135 .data : AT(__DATA_ROM)
141136 {
142137 . = ALIGN (4 );
@@ -146,21 +141,21 @@ SECTIONS
146141
147142 . = ALIGN (4 );
148143 _edata = .; /* define a global symbol at data end */
149- } > m_data
144+ } >RAM1_data
145+
146+ __DATA_END = __DATA_ROM + (_edata - _sdata);
147+ text_end = ORIGIN (FLASH_text) + LENGTH (FLASH_text);
148+ ASSERT (__DATA_END <= text_end, " region FLASH_text overflowed with text and data" )
150149
151- __DATA_END = __DATA_ROM + (_edata - _sdata);
152- text_end = ORIGIN (m_text) + LENGTH (m_text);
153- ASSERT (__DATA_END <= text_end, " region m_text overflowed with text and data" )
154150
155151 .resource_table :
156152 {
157153 . = ALIGN (4 );
158154 KEEP (*(.resource_table *))
159155 . = ALIGN (4 );
160- } > m_data
161-
156+ } >RAM1_data
162157
163- /* Uninitialized data section into RAM memory */
158+ /* Uninitialized data section into "RAM1_data" Ram type memory */
164159 . = ALIGN (4 );
165160 .bss :
166161 {
@@ -174,9 +169,9 @@ SECTIONS
174169 . = ALIGN (4 );
175170 _ebss = .; /* define a global symbol at bss end */
176171 __bss_end__ = _ebss;
177- } > m_data
172+ } >RAM1_data
178173
179- /* User_heap_stack section, used to check that there is enough RAM left */
174+ /* User_heap_stack section, used to check that there is enough "RAM1_data" Ram type memory left */
180175 ._user_heap_stack :
181176 {
182177 . = ALIGN (8 );
@@ -185,9 +180,7 @@ SECTIONS
185180 . = . + _Min_Heap_Size;
186181 . = . + _Min_Stack_Size;
187182 . = ALIGN (8 );
188- } > m_data
189-
190-
183+ } >RAM1_data
191184
192185 /* Remove information from the compiler libraries */
193186 /DISCARD/ :
@@ -198,5 +191,4 @@ SECTIONS
198191 }
199192
200193 .ARM .attributes 0 : { *(.ARM .attributes ) }
201-
202194}
0 commit comments