From 2f035613992230c7fcefe4c4911d3fb940ec724c Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Thu, 17 Oct 2024 15:32:41 +0300 Subject: [PATCH] soc: adi: Extract max32 flashprog section to a dedicated linker script Extracts the max32 flashprog linker section to a dedicated linker script that is conditionally included only when the flash driver is enabled. This prepares max32 soc family to set SOC_LINKER_SCRIPT directly to the common arm cortex-m linker script. Signed-off-by: Maureen Helm --- soc/adi/max32/CMakeLists.txt | 2 ++ soc/adi/max32/flash.ld | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 soc/adi/max32/flash.ld diff --git a/soc/adi/max32/CMakeLists.txt b/soc/adi/max32/CMakeLists.txt index 9941c670e8b..9761cdcf0b3 100644 --- a/soc/adi/max32/CMakeLists.txt +++ b/soc/adi/max32/CMakeLists.txt @@ -5,4 +5,6 @@ zephyr_include_directories(${ZEPHYR_BASE}/drivers) zephyr_include_directories(common) zephyr_sources(soc.c) +zephyr_linker_sources_ifdef(CONFIG_SOC_FLASH_MAX32 SECTIONS flash.ld) + set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/adi/max32/flash.ld b/soc/adi/max32/flash.ld new file mode 100644 index 00000000000..2014e209ea7 --- /dev/null +++ b/soc/adi/max32/flash.ld @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2023 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +SECTION_DATA_PROLOGUE(.flashprog,, SUBALIGN(4)) +{ + KEEP(*(.flashprog*)) /* Flash program */ +}