From 6abb6932010c8a73e7ac53cbfec650aca1e58870 Mon Sep 17 00:00:00 2001 From: Peter Simon Terentschenko Date: Thu, 15 May 2025 11:15:54 +0200 Subject: [PATCH] soc: rp2350: Exclude image definition block from MCUboot application images Application images intended for MCUboot should not include the .image_def section. This change adjusts the linker configuration to only include the image definition block when building standalone images. Signed-off-by: Peter Simon Terentschenko --- soc/raspberrypi/rpi_pico/rp2350/Kconfig | 2 +- soc/raspberrypi/rpi_pico/rp2350/Kconfig.defconfig | 5 ++++- soc/raspberrypi/rpi_pico/rp2350/linker.ld | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/soc/raspberrypi/rpi_pico/rp2350/Kconfig b/soc/raspberrypi/rpi_pico/rp2350/Kconfig index 28553021e2cb..afef9f0d0587 100644 --- a/soc/raspberrypi/rpi_pico/rp2350/Kconfig +++ b/soc/raspberrypi/rpi_pico/rp2350/Kconfig @@ -29,7 +29,7 @@ config SOC_RP2350B_M33 config RP2_REQUIRES_IMAGE_DEFINITION_BLOCK bool - default y + default y if FLASH_LOAD_OFFSET = 0x100 # Currently the IDF only supports using the Cortex-M33 cores. Enforce # this at build configuration time. depends on SOC_SERIES_RP2350 && CPU_CORTEX_M33 diff --git a/soc/raspberrypi/rpi_pico/rp2350/Kconfig.defconfig b/soc/raspberrypi/rpi_pico/rp2350/Kconfig.defconfig index 46b057490459..6e5cfe93e449 100644 --- a/soc/raspberrypi/rpi_pico/rp2350/Kconfig.defconfig +++ b/soc/raspberrypi/rpi_pico/rp2350/Kconfig.defconfig @@ -6,7 +6,10 @@ if SOC_SERIES_RP2350 config BUILD_OUTPUT_UF2_USE_FLASH_BASE - default y if BUILD_OUTPUT_UF2 + default y if RP2_REQUIRES_IMAGE_DEFINITION_BLOCK + +config BUILD_OUTPUT_UF2_USE_FLASH_OFFSET + default y if !RP2_REQUIRES_IMAGE_DEFINITION_BLOCK config NUM_IRQS default 52 diff --git a/soc/raspberrypi/rpi_pico/rp2350/linker.ld b/soc/raspberrypi/rpi_pico/rp2350/linker.ld index 6368409c9e27..b5ecf388f1f0 100644 --- a/soc/raspberrypi/rpi_pico/rp2350/linker.ld +++ b/soc/raspberrypi/rpi_pico/rp2350/linker.ld @@ -6,6 +6,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* + * The Image Definition Block is only linked to the app that + * resides at 0x100. This can be the application, or a bootloader + * such as mcuboot. + */ +#if CONFIG_RP2_REQUIRES_IMAGE_DEFINITION_BLOCK MEMORY { IMAGE_DEF_FLASH (r) : ORIGIN = 0x10000000, LENGTH = 128 @@ -23,5 +29,6 @@ SECTIONS LONG(0xab123579) /* PICOBIN_BLOCK_MARKER_END */ } > IMAGE_DEF_FLASH } +#endif /* CONFIG_RP2_REQUIRES_IMAGE_DEFINITION_BLOCK */ #include