Skip to content

Commit 1b05dc5

Browse files
committed
stm32cube: stm32n6: Allow building a chainloaded secure application
When chain loading a secure application after FSBL, some actions should be avoided at reset. Update _fsbl.c file to do this. Prepare CMakeLists.txt if this should be done in _s.c file (which would require configuring secure image which is not available yet). Signed-off-by: Erwan Gouriou <[email protected]>
1 parent 02d82ee commit 1b05dc5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

stm32cube/stm32n6xx/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Copyright (c) 2025 STMicroelectronics
22
#
33
# SPDX-License-Identifier: Apache-2.0
4-
4+
#if(CONFIG_BOOTLOADER_MCUBOOT)
5+
# zephyr_include_directories(soc)
6+
# zephyr_include_directories(soc/Templates)
7+
# zephyr_library_sources(soc/system_stm32n6xx_s.c)
8+
#else()
59
zephyr_library_sources(soc/system_stm32n6xx_fsbl.c)
10+
#endif()
611
zephyr_library_sources(drivers/src/stm32n6xx_hal.c)
712
zephyr_library_sources(drivers/src/stm32n6xx_hal_rcc.c)
813
zephyr_library_sources(drivers/src/stm32n6xx_hal_rcc_ex.c)

stm32cube/stm32n6xx/soc/system_stm32n6xx_fsbl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ void SystemInit(void)
190190
SCB->VTOR = INTVECT_START;
191191
#endif /* USER_VECT_TAB_ADDRESS */
192192

193+
#if !defined(CONFIG_BOOTLOADER_MCUBOOT)
193194
/* RNG reset */
194195
RCC->AHB3RSTSR = RCC_AHB3RSTSR_RNGRSTS;
195196
RCC->AHB3RSTCR = RCC_AHB3RSTCR_RNGRSTC;
@@ -221,6 +222,7 @@ void SystemInit(void)
221222
SAU->RNR = 7;
222223
SAU->RBAR = 0;
223224
SAU->RLAR = 0;
225+
#endif
224226

225227
/* System configuration setup */
226228
RCC->APB4ENSR2 = RCC_APB4ENSR2_SYSCFGENS;
@@ -230,6 +232,7 @@ void SystemInit(void)
230232
/* Set default Vector Table location after system reset or return from Standby */
231233
SYSCFG->INITSVTORCR = SCB->VTOR;
232234

235+
#if !defined(CONFIG_BOOTLOADER_MCUBOOT)
233236
/* Enable VDDADC CLAMP */
234237
PWR->SVMCR3 |= PWR_SVMCR3_ASV;
235238
PWR->SVMCR3 |= PWR_SVMCR3_AVMEN;
@@ -255,6 +258,7 @@ void SystemInit(void)
255258

256259
/* Deactivate GPIOG clock */
257260
RCC->AHB4ENCR = RCC_AHB4ENCR_GPIOGENC;
261+
#endif
258262

259263
/* Read back the value to make sure it is written before deactivating SYSCFG */
260264
(void) SYSCFG->INITSVTORCR;

0 commit comments

Comments
 (0)