Skip to content

Commit 016afc9

Browse files
committed
dts: n6: Allow using axisram2 in chainloaded application
Make axisram2 which is used in fsbl mode available as well to chainloaded application in order not to loose 1M of RAM In order to avoid conflicts with bootloader, verify that code + ro data of the loaded application won't go further than bootloader start address. This is done with a linker assert. Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
1 parent 55e80e2 commit 016afc9

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

dts/arm/st/n6/stm32n657X0.dtsi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99
/ {
1010
axisram1: memory@34000000 {
11-
/* 400 kB of FLEXRAM followed by 624 kB of AXISRAM1 */
12-
reg = <0x34000000 (DT_SIZE_K(400) + DT_SIZE_K(624))>;
11+
/* This section is the RAM available to the chainloaded application */
12+
/* 400 kB of FLEXRAM followed by 624 kB of AXISRAM1 + AXISRAM2 */
13+
reg = <0x34000000 (DT_SIZE_K(400) + DT_SIZE_K(624) + DT_SIZE_M(1))>;
1314
};
1415

1516
axisram2: memory@34180400 {
17+
/* This section is the RAM available to FSBL application */
1618
reg = <0x34180400 DT_SIZE_K(511)>;
1719
};
1820
};

soc/st/stm32/stm32n6x/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ zephyr_include_directories(.)
99

1010
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")
1111

12+
zephyr_linker_sources_ifdef(CONFIG_BOOTLOADER_MCUBOOT SECTIONS ram_check.ld)
13+
1214
if(NOT CONFIG_BOOTLOADER_MCUBOOT)
1315

1416
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL Windows)

soc/st/stm32/stm32n6x/ram_check.ld

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (c) 2025 STMicroelectronics
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/devicetree.h>
8+
#include <zephyr/linker/linker-defs.h>
9+
10+
#define MCUBOOT_START_ADDR DT_PROP_BY_IDX(DT_NODELABEL(axisram2), reg, 0)
11+
12+
ASSERT((__kernel_ram_start < (MCUBOOT_START_ADDR - CONFIG_ROM_START_OFFSET)),
13+
"
14+
Image is too large to fit RAMLOAD configuration. Consider using XIP.
15+
")

0 commit comments

Comments
 (0)