diff --git a/boards/kws/pico2_spe/pico2_spe.dtsi b/boards/kws/pico2_spe/pico2_spe.dtsi index 87211d91effb4..899d22e7357f6 100644 --- a/boards/kws/pico2_spe/pico2_spe.dtsi +++ b/boards/kws/pico2_spe/pico2_spe.dtsi @@ -16,7 +16,6 @@ zephyr,flash = &flash0; zephyr,console = &uart0; zephyr,shell-uart = &uart0; - zephyr,code-partition = &code_partition; }; aliases { @@ -59,33 +58,6 @@ &flash0 { reg = <0x10000000 DT_SIZE_M(4)>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserved memory for an image definition block. The block is much - * smaller than 256 bytes, but in practice the linker places the vector - * table at a much larger alignment offset. - */ - image_def: partition@0 { - label = "image_def"; - reg = <0x00000000 0x100>; - read-only; - }; - - /* - * Usable flash. Starts at 0x100, after the image definition block. - * The partition size is 4MB minus the 0x100 bytes taken by the - * image definition. - */ - code_partition: partition@100 { - label = "code-partition"; - reg = <0x100 (DT_SIZE_M(4) - 0x100)>; - read-only; - }; - }; }; &uart0 { diff --git a/boards/pimoroni/pico_plus2/pico_plus2.dtsi b/boards/pimoroni/pico_plus2/pico_plus2.dtsi index 9aceca37b7ae1..b44cf839279e1 100644 --- a/boards/pimoroni/pico_plus2/pico_plus2.dtsi +++ b/boards/pimoroni/pico_plus2/pico_plus2.dtsi @@ -18,7 +18,6 @@ zephyr,flash = &flash0; zephyr,console = &uart0; zephyr,shell-uart = &uart0; - zephyr,code-partition = &code_partition; }; aliases { @@ -92,33 +91,6 @@ &flash0 { reg = <0x10000000 DT_SIZE_M(16)>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserved memory for an image definition block. The block is much - * smaller than 256 bytes, but in practice the linker places the vector - * table at a much larger alignment offset. - */ - image_def: partition@0 { - label = "image_def"; - reg = <0x00000000 0x100>; - read-only; - }; - - /* - * Usable flash. Starts at 0x100, after the image definition block. - * The partition size is 16MB minus the 0x100 bytes taken by the - * image definition. - */ - code_partition: partition@100 { - label = "code-partition"; - reg = <0x100 (DT_SIZE_M(16) - 0x100)>; - read-only; - }; - }; }; &uart0 { diff --git a/boards/raspberrypi/rpi_pico2/rpi_pico2.dtsi b/boards/raspberrypi/rpi_pico2/rpi_pico2.dtsi index 522413c94f1af..5ff15e4ec2f33 100644 --- a/boards/raspberrypi/rpi_pico2/rpi_pico2.dtsi +++ b/boards/raspberrypi/rpi_pico2/rpi_pico2.dtsi @@ -18,7 +18,6 @@ zephyr,flash = &flash0; zephyr,console = &uart0; zephyr,shell-uart = &uart0; - zephyr,code-partition = &code_partition; }; aliases { @@ -61,33 +60,6 @@ &flash0 { reg = <0x10000000 DT_SIZE_M(4)>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserved memory for an image definition block. The block is much - * smaller than 256 bytes, but in practice the linker places the vector - * table at a much larger alignment offset. - */ - image_def: partition@0 { - label = "image_def"; - reg = <0x00000000 0x100>; - read-only; - }; - - /* - * Usable flash. Starts at 0x100, after the image definition block. - * The partition size is 4MB minus the 0x100 bytes taken by the - * image definition. - */ - code_partition: partition@100 { - label = "code-partition"; - reg = <0x100 (DT_SIZE_M(4) - 0x100)>; - read-only; - }; - }; }; &uart0 { diff --git a/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2.dtsi b/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2.dtsi index 5a0959d721e65..afa2f747e1af9 100644 --- a/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2.dtsi +++ b/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2.dtsi @@ -18,7 +18,6 @@ zephyr,flash = &flash0; zephyr,console = &uart0; zephyr,shell-uart = &uart0; - zephyr,code-partition = &code_partition; }; pico_header: connector { @@ -85,29 +84,6 @@ * the second stage bootloader */ reg = <0x10000000 DT_SIZE_M(16)>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserved memory for the second stage bootloader */ - second_stage_bootloader: partition@0 { - label = "second_stage_bootloader"; - reg = <0x00000000 0x100>; - read-only; - }; - - /* - * Usable flash. Starts at 0x100, after the bootloader. The partition - * size is 16MB minus the 0x100 bytes taken by the bootloader. - */ - code_partition: partition@100 { - label = "code-partition"; - reg = <0x100 (DT_SIZE_M(16) - 0x100)>; - read-only; - }; - }; }; &uart0 { diff --git a/soc/raspberrypi/rpi_pico/rp2350/CMakeLists.txt b/soc/raspberrypi/rpi_pico/rp2350/CMakeLists.txt index 8f48fc01aba95..2910ef09e36ac 100644 --- a/soc/raspberrypi/rpi_pico/rp2350/CMakeLists.txt +++ b/soc/raspberrypi/rpi_pico/rp2350/CMakeLists.txt @@ -7,4 +7,7 @@ zephyr_library_sources(soc.c) zephyr_include_directories(.) -set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "") +# Add the image definition block if required +zephyr_linker_sources(ROM_START rom_start.ld) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/raspberrypi/rpi_pico/rp2350/Kconfig b/soc/raspberrypi/rpi_pico/rp2350/Kconfig index 35ebf8ad5809b..2fff7e33392e8 100644 --- a/soc/raspberrypi/rpi_pico/rp2350/Kconfig +++ b/soc/raspberrypi/rpi_pico/rp2350/Kconfig @@ -7,7 +7,6 @@ config SOC_SERIES_RP2350 select HAS_RPI_PICO select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE select SOC_RESET_HOOK - select XIP config SOC_RP2350A_M33 select ARM @@ -31,7 +30,7 @@ config SOC_RP2350B_M33 config RP2_REQUIRES_IMAGE_DEFINITION_BLOCK bool - default y if FLASH_LOAD_OFFSET = 0x100 + default y # 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/linker.ld b/soc/raspberrypi/rpi_pico/rp2350/linker.ld deleted file mode 100644 index 8775ef32e361f..0000000000000 --- a/soc/raspberrypi/rpi_pico/rp2350/linker.ld +++ /dev/null @@ -1,29 +0,0 @@ -/* linker.ld - Linker command/script file */ - -/* - * Copyright (c) 2024 Andrew Featherstone - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#if CONFIG_RP2_REQUIRES_IMAGE_DEFINITION_BLOCK -MEMORY -{ - IMAGE_DEF_FLASH (r) : ORIGIN = 0x10000000, LENGTH = 128 -} - -SECTIONS -{ - .image_def : { - LONG(0xffffded3) /* PICOBIN_BLOCK_MARKER_START */ - LONG(0x10210142) /* IMAGE_DEF Item */ - LONG(0x00000203) /* VECTOR_TABLE Item */ - LONG(ABSOLUTE(_vector_start)) /* - Address of the vector table in flash */ - LONG(0x000003ff) /* Last Item in Block */ - LONG(0x00000000) /* End of block loop */ - LONG(0xab123579) /* PICOBIN_BLOCK_MARKER_END */ - } > IMAGE_DEF_FLASH -} -#endif /* CONFIG_RP2_REQUIRES_IMAGE_DEFINITION_BLOCK */ - -#include diff --git a/soc/raspberrypi/rpi_pico/rp2350/rom_start.ld b/soc/raspberrypi/rpi_pico/rp2350/rom_start.ld new file mode 100644 index 0000000000000..197ccb4f523ca --- /dev/null +++ b/soc/raspberrypi/rpi_pico/rp2350/rom_start.ld @@ -0,0 +1,17 @@ +/* rom_start.ld - additional data to append at the ROM start */ + +/* + * Copyright (c) 2024 Andrew Featherstone + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#if CONFIG_RP2_REQUIRES_IMAGE_DEFINITION_BLOCK +LONG(0xffffded3) /* PICOBIN_BLOCK_MARKER_START */ +LONG(0x10210142) /* IMAGE_DEF Item */ +LONG(0x00000203) /* VECTOR_TABLE Item */ +LONG(ABSOLUTE(_vector_start)) /* - Address of the vector table in flash */ +LONG(0x000003ff) /* Last Item in Block */ +LONG(0x00000000) /* End of block loop */ +LONG(0xab123579) /* PICOBIN_BLOCK_MARKER_END */ +#endif /* CONFIG_RP2_REQUIRES_IMAGE_DEFINITION_BLOCK */