Skip to content

Commit 35df765

Browse files
committed
arch: move CODE_DATA_RELOCATION to top level
Support for CODE_DATA_RELOCATION is not inherently limited to ARM, so move the Kconfig definition to top-level so it can be used by other architectures. Since support is opt-in (requiring linker script support), add a helper symbol enabled by architecture config that gates whether CODE_DATA_RELOCATION is available instead of listing all supported systems inline. Signed-off-by: Peter Marheine <[email protected]>
1 parent d0124cc commit 35df765

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

arch/Kconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,12 @@ config ARCH_HAS_SUSPEND_TO_RAM
577577
config ARCH_HAS_THREAD_ABORT
578578
bool
579579

580+
config ARCH_HAS_CODE_DATA_RELOCATION
581+
bool
582+
help
583+
When selected, the architecture/SoC implements support for
584+
CODE_DATA_RELOCATION in its linker scripts.
585+
580586
#
581587
# Hidden CPU family configs
582588
#
@@ -755,6 +761,15 @@ config SRAM_REGION_PERMISSIONS
755761
paging, do not need memory protection, and would rather not use up
756762
RAM for the alignment between regions.
757763

764+
config CODE_DATA_RELOCATION
765+
bool "Support code/data section relocation"
766+
depends on ARCH_HAS_CODE_DATA_RELOCATION
767+
help
768+
Enable support for relocating .text, data and .bss sections from specified
769+
files and placing them in a chosen memory region. Files to relocate and
770+
the target regions should be specified in CMakeLists.txt using
771+
zephyr_code_relocate().
772+
758773
menu "Floating Point Options"
759774

760775
config FPU

arch/arm/Kconfig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ config ARM_CUSTOM_INTERRUPT_CONTROLLER
3434
family cores. The Cortex-M family cores are always equipped with
3535
the ARM Nested Vectored Interrupt Controller (NVIC).
3636

37-
config CODE_DATA_RELOCATION
38-
bool "Relocate code/data sections"
39-
depends on CPU_CORTEX_M || CPU_AARCH32_CORTEX_R
40-
help
41-
When selected this will relocate .text, data and .bss sections from
42-
the specified files and places it in the required memory region. The
43-
files should be specified in the CMakeList.txt file with
44-
a cmake API zephyr_code_relocate().
45-
4637
config CODE_DATA_RELOCATION_SRAM
4738
bool "Relocate code/data sections to SRAM"
4839
depends on CPU_CORTEX_M

arch/arm/core/aarch32/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ config CPU_CORTEX_M
2222
select ARCH_HAS_TIMING_FUNCTIONS if CPU_CORTEX_M_HAS_DWT
2323
select ARCH_SUPPORTS_ARCH_HW_INIT
2424
select ARCH_HAS_SUSPEND_TO_RAM
25+
select ARCH_HAS_CODE_DATA_RELOCATION
2526
imply XIP
2627
help
2728
This option signifies the use of a CPU of the Cortex-M family.
@@ -34,6 +35,7 @@ config CPU_AARCH32_CORTEX_R
3435
select HAS_FLASH_LOAD_OFFSET
3536
select ARCH_HAS_USERSPACE if ARM_MPU
3637
select ARCH_HAS_EXTRA_EXCEPTION_INFO
38+
select ARCH_HAS_CODE_DATA_RELOCATION
3739
help
3840
This option signifies the use of a CPU of the Cortex-R family.
3941

0 commit comments

Comments
 (0)