Commit adbe1cfb authored by Erwan Gouriou's avatar Erwan Gouriou Committed by Dominik Ermel
Browse files

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: default avatarErwan Gouriou <erwan.gouriou@st.com>
parent 93c2b50a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -536,6 +536,10 @@ if((CONFIG_BOOT_SWAP_USING_SCRATCH OR CONFIG_BOOT_SWAP_USING_MOVE OR CONFIG_BOOT
  zephyr_library_sources(flash_check.c)
endif()

if(CONFIG_BOOT_RAM_LOAD)
  zephyr_library_sources(ram_load.c)
endif()

if(SYSBUILD)
  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)
    # TODO: RAM LOAD support
+4 −0
Original line number Diff line number Diff line
@@ -134,6 +134,10 @@
#define IMAGE_EXECUTABLE_RAM_SIZE CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE
#endif

#ifdef CONFIG_SOC_SERIES_STM32N6X
#define MULTIPLE_EXECUTABLE_RAM_REGIONS
#endif

#ifdef CONFIG_LOG
#define MCUBOOT_HAVE_LOGGING 1
#endif

boot/zephyr/ram_load.c

0 → 100644
+35 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2025 STMicroelectonics
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "../bootutil/include/bootutil/bootutil.h"
#include "../bootutil/include/bootutil/ramload.h"

#include <zephyr/devicetree.h>

#ifdef MULTIPLE_EXECUTABLE_RAM_REGIONS
int boot_get_image_exec_ram_info(uint32_t image_id,
                                 uint32_t *exec_ram_start,
                                 uint32_t *exec_ram_size)
{

#ifdef CONFIG_SOC_SERIES_STM32N6X
    *exec_ram_start = DT_PROP_BY_IDX(DT_NODELABEL(axisram1), reg, 0);
    *exec_ram_size = DT_PROP_BY_IDX(DT_NODELABEL(axisram1), reg, 1);
#endif

    return 0;
}
#endif /* MULTIPLE_EXECUTABLE_RAM_REGIONS */