Skip to content

Commit 6849e21

Browse files
stm32h750dk: Add linker script
1 parent c162ac8 commit 6849e21

File tree

3 files changed

+175
-2
lines changed

3 files changed

+175
-2
lines changed

hw/bsp/stm32h7/boards/stm32h750bdk/board.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set(MCU_VARIANT stm32h750xx)
22
set(JLINK_DEVICE stm32h750xb_m7)
33

4-
set(LD_FILE_GNU ${ST_CMSIS}/Source/Templates/gcc/linker/${MCU_VARIANT}_flash_CM7.ld)
4+
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/${MCU_VARIANT}_flash_CM7.ld)
55
set(LD_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/linker/${MCU_VARIANT}_flash_CM7.icf)
66

77
function(update_board TARGET)

hw/bsp/stm32h7/boards/stm32h750bdk/board.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PORT ?= 0
88

99
# GCC
1010
SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h750xx.s
11-
LD_FILE_GCC = $(ST_CMSIS)/Source/Templates/gcc/linker/stm32h750xx_flash_CM7.ld
11+
LD_FILE_GCC = $(BOARD_PATH)/stm32h750xx_flash_CM7.ld
1212

1313
# IAR
1414
SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32h750xx.s
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
/*
2+
******************************************************************************
3+
**
4+
5+
** File : LinkerScript.ld
6+
**
7+
**
8+
** Abstract : Linker script for STM32H7 series
9+
** 128Kbytes FLASH and 1Mbytes RAM
10+
**
11+
** Set heap size, stack size and stack location according
12+
** to application requirements.
13+
**
14+
** Set memory bank area and size if external memory is used.
15+
**
16+
** Target : STMicroelectronics STM32
17+
**
18+
** Distribution: The file is distributed �as is,� without any warranty
19+
** of any kind.
20+
**
21+
*****************************************************************************
22+
** @attention
23+
**
24+
** Copyright (c) 2019 STMicroelectronics.
25+
** All rights reserved.
26+
**
27+
** This software component is licensed by ST under BSD 3-Clause license,
28+
** the "License"; You may not use this file except in compliance with the
29+
** License. You may obtain a copy of the License at:
30+
** opensource.org/licenses/BSD-3-Clause
31+
**
32+
****************************************************************************
33+
*/
34+
35+
/* Entry Point */
36+
ENTRY(Reset_Handler)
37+
38+
/* Highest address of the user mode stack */
39+
_estack = 0x20020000; /* end of RAM */
40+
/* Generate a link error if heap and stack don't fit into RAM */
41+
_Min_Heap_Size = 0x200; /* required amount of heap */
42+
_Min_Stack_Size = 0x400; /* required amount of stack */
43+
44+
/* Specify the memory areas */
45+
MEMORY
46+
{
47+
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
48+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 1M
49+
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
50+
}
51+
52+
/* Define output sections */
53+
SECTIONS
54+
{
55+
/* The startup code goes first into FLASH */
56+
.isr_vector :
57+
{
58+
. = ALIGN(4);
59+
KEEP(*(.isr_vector)) /* Startup code */
60+
. = ALIGN(4);
61+
} >FLASH
62+
63+
/* The program code and other data goes into FLASH */
64+
.text :
65+
{
66+
. = ALIGN(4);
67+
*(.text) /* .text sections (code) */
68+
*(.text*) /* .text* sections (code) */
69+
*(.glue_7) /* glue arm to thumb code */
70+
*(.glue_7t) /* glue thumb to arm code */
71+
*(.eh_frame)
72+
73+
KEEP (*(.init))
74+
KEEP (*(.fini))
75+
76+
. = ALIGN(4);
77+
_etext = .; /* define a global symbols at end of code */
78+
} >FLASH
79+
80+
/* Constant data goes into FLASH */
81+
.rodata :
82+
{
83+
. = ALIGN(4);
84+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
85+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
86+
. = ALIGN(4);
87+
} >FLASH
88+
89+
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
90+
.ARM : {
91+
__exidx_start = .;
92+
*(.ARM.exidx*)
93+
__exidx_end = .;
94+
} >FLASH
95+
96+
.preinit_array :
97+
{
98+
PROVIDE_HIDDEN (__preinit_array_start = .);
99+
KEEP (*(.preinit_array*))
100+
PROVIDE_HIDDEN (__preinit_array_end = .);
101+
} >FLASH
102+
.init_array :
103+
{
104+
PROVIDE_HIDDEN (__init_array_start = .);
105+
KEEP (*(SORT(.init_array.*)))
106+
KEEP (*(.init_array*))
107+
PROVIDE_HIDDEN (__init_array_end = .);
108+
} >FLASH
109+
.fini_array :
110+
{
111+
PROVIDE_HIDDEN (__fini_array_start = .);
112+
KEEP (*(SORT(.fini_array.*)))
113+
KEEP (*(.fini_array*))
114+
PROVIDE_HIDDEN (__fini_array_end = .);
115+
} >FLASH
116+
117+
/* used by the startup to initialize data */
118+
_sidata = LOADADDR(.data);
119+
120+
/* Initialized data sections goes into RAM, load LMA copy after code */
121+
.data :
122+
{
123+
. = ALIGN(4);
124+
_sdata = .; /* create a global symbol at data start */
125+
*(.data) /* .data sections */
126+
*(.data*) /* .data* sections */
127+
128+
. = ALIGN(4);
129+
_edata = .; /* define a global symbol at data end */
130+
} >RAM AT> FLASH
131+
132+
133+
/* Uninitialized data section */
134+
. = ALIGN(4);
135+
.bss :
136+
{
137+
/* This is used by the startup in order to initialize the .bss secion */
138+
_sbss = .; /* define a global symbol at bss start */
139+
__bss_start__ = _sbss;
140+
*(.bss)
141+
*(.bss*)
142+
*(COMMON)
143+
144+
. = ALIGN(4);
145+
_ebss = .; /* define a global symbol at bss end */
146+
__bss_end__ = _ebss;
147+
} >RAM
148+
149+
/* User_heap_stack section, used to check that there is enough RAM left */
150+
._user_heap_stack :
151+
{
152+
. = ALIGN(8);
153+
PROVIDE ( end = . );
154+
PROVIDE ( _end = . );
155+
. = . + _Min_Heap_Size;
156+
. = . + _Min_Stack_Size;
157+
. = ALIGN(8);
158+
} >RAM
159+
160+
161+
162+
/* Remove information from the standard libraries */
163+
/DISCARD/ :
164+
{
165+
libc.a ( * )
166+
libm.a ( * )
167+
libgcc.a ( * )
168+
}
169+
170+
.ARM.attributes 0 : { *(.ARM.attributes) }
171+
}
172+
173+

0 commit comments

Comments
 (0)