Skip to content

Commit adbe1cf

Browse files
erwangode-nordic
authored andcommitted
boot: stm32n6: Define specific executable region
On STM32N6, MCUBoot is loaded by the BootROM to axisram2 and, when running in RAMLOAD configuration, application image is loaded in axisram1. To support this, define MULTIPLE_EXECUTABLE_RAM_REGIONS and implement boot_get_image_exec_ram_info() which provides the right executable address and size based on axisram1 node definition. Signed-off-by: Erwan Gouriou <[email protected]>
1 parent 93c2b50 commit adbe1cf

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

boot/zephyr/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,10 @@ if((CONFIG_BOOT_SWAP_USING_SCRATCH OR CONFIG_BOOT_SWAP_USING_MOVE OR CONFIG_BOOT
536536
zephyr_library_sources(flash_check.c)
537537
endif()
538538

539+
if(CONFIG_BOOT_RAM_LOAD)
540+
zephyr_library_sources(ram_load.c)
541+
endif()
542+
539543
if(SYSBUILD)
540544
if(CONFIG_SINGLE_APPLICATION_SLOT OR CONFIG_BOOT_FIRMWARE_LOADER OR CONFIG_BOOT_SWAP_USING_SCRATCH OR CONFIG_BOOT_SWAP_USING_MOVE OR CONFIG_BOOT_SWAP_USING_OFFSET OR CONFIG_BOOT_UPGRADE_ONLY OR CONFIG_BOOT_DIRECT_XIP OR CONFIG_BOOT_RAM_LOAD)
541545
# TODO: RAM LOAD support

boot/zephyr/include/mcuboot_config/mcuboot_config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@
134134
#define IMAGE_EXECUTABLE_RAM_SIZE CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE
135135
#endif
136136

137+
#ifdef CONFIG_SOC_SERIES_STM32N6X
138+
#define MULTIPLE_EXECUTABLE_RAM_REGIONS
139+
#endif
140+
137141
#ifdef CONFIG_LOG
138142
#define MCUBOOT_HAVE_LOGGING 1
139143
#endif

boot/zephyr/ram_load.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2025 STMicroelectonics
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include "../bootutil/include/bootutil/bootutil.h"
18+
#include "../bootutil/include/bootutil/ramload.h"
19+
20+
#include <zephyr/devicetree.h>
21+
22+
#ifdef MULTIPLE_EXECUTABLE_RAM_REGIONS
23+
int boot_get_image_exec_ram_info(uint32_t image_id,
24+
uint32_t *exec_ram_start,
25+
uint32_t *exec_ram_size)
26+
{
27+
28+
#ifdef CONFIG_SOC_SERIES_STM32N6X
29+
*exec_ram_start = DT_PROP_BY_IDX(DT_NODELABEL(axisram1), reg, 0);
30+
*exec_ram_size = DT_PROP_BY_IDX(DT_NODELABEL(axisram1), reg, 1);
31+
#endif
32+
33+
return 0;
34+
}
35+
#endif /* MULTIPLE_EXECUTABLE_RAM_REGIONS */

0 commit comments

Comments
 (0)