Skip to content

Commit 3657f90

Browse files
committed
STM32Cube_FW_WB_V1.4.0 - STM32WB55xx part
1 parent 7a5da61 commit 3657f90

File tree

2 files changed

+43
-23
lines changed

2 files changed

+43
-23
lines changed

targets/TARGET_STM/TARGET_STM32WB/TARGET_STM32WB55xx/TOOLCHAIN_GCC_ARM/startup_stm32wb55xx.S

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,29 @@ defined in linker script */
4444
.word _sbss
4545
/* end address for the .bss section. defined in linker script */
4646
.word _ebss
47-
48-
.section .text.Reset_Handler
49-
.weak Reset_Handler
50-
.type Reset_Handler, %function
51-
Reset_Handler:
52-
ldr r0, =_estack
53-
mov sp, r0 /* set stack pointer */
54-
55-
/* Copy the data segment initializers from flash to SRAM */
56-
ldr r0, =_sdata
57-
ldr r1, =_edata
58-
ldr r2, =_sidata
47+
/* start address for the .MB_MEM2 section. defined in linker script */
48+
.word _sMB_MEM2
49+
/* end address for the .MB_MEM2 section. defined in linker script */
50+
.word _eMB_MEM2
51+
52+
/* INIT_BSS macro is used to fill the specified region [start : end] with zeros */
53+
.macro INIT_BSS start, end
54+
ldr r0, =\start
55+
ldr r1, =\end
5956
movs r3, #0
60-
b LoopCopyDataInit
57+
bl LoopFillZerobss
58+
.endm
59+
60+
/* INIT_DATA macro is used to copy data in the region [start : end] starting from 'src' */
61+
.macro INIT_DATA start, end, src
62+
ldr r0, =\start
63+
ldr r1, =\end
64+
ldr r2, =\src
65+
movs r3, #0
66+
bl LoopCopyDataInit
67+
.endm
6168

69+
.section .text.data_initializers
6270
CopyDataInit:
6371
ldr r4, [r2, r3]
6472
str r4, [r0, r3]
@@ -67,21 +75,31 @@ CopyDataInit:
6775
LoopCopyDataInit:
6876
adds r4, r0, r3
6977
cmp r4, r1
70-
bcc CopyDataInit
71-
72-
/* Zero fill the bss segment. */
73-
ldr r2, =_sbss
74-
ldr r4, =_ebss
75-
movs r3, #0
76-
b LoopFillZerobss
78+
bcc CopyDataInit
79+
bx lr
7780

7881
FillZerobss:
79-
str r3, [r2]
80-
adds r2, r2, #4
82+
str r3, [r0]
83+
adds r0, r0, #4
8184

8285
LoopFillZerobss:
83-
cmp r2, r4
86+
cmp r0, r1
8487
bcc FillZerobss
88+
bx lr
89+
90+
.section .text.Reset_Handler
91+
.weak Reset_Handler
92+
.type Reset_Handler, %function
93+
Reset_Handler:
94+
ldr r0, =_estack
95+
mov sp, r0 /* set stack pointer */
96+
97+
/* Copy the data segment initializers from flash to SRAM */
98+
INIT_DATA _sdata, _edata, _sidata
99+
100+
/* Zero fill the bss segments. */
101+
INIT_BSS _sbss, _ebss
102+
INIT_BSS _sMB_MEM2, _eMB_MEM2
85103

86104
/* Call the clock system intitialization function.*/
87105
bl SystemInit

targets/TARGET_STM/TARGET_STM32WB/TARGET_STM32WB55xx/TOOLCHAIN_GCC_ARM/stm32wb55xx.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ SECTIONS
206206

207207
.ble_shared_no_ret (NOLOAD) :
208208
{
209+
_sMB_MEM2 = . ;
209210
*(MB_MEM2);
211+
_eMB_MEM2 = . ;
210212
} >RAM2b
211213

212214
/* Set stack top to end of RAM, and stack limit move down by

0 commit comments

Comments
 (0)