From a28830b8112e9965e5d6a4fcf0464d2a78c5e363 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 12 Aug 2021 15:01:44 +0200 Subject: [PATCH] linker: align __itcm_load_start / __dtcm_data_load_start linker symbols Cleanup and preparation commit for linker script generator. Zephyr linker scripts provides start and end symbols for each section, and sometimes even size and LMA start symbols. Generally, start and end symbols uses the following pattern, as: Section name: foo Section start symbol: __foo_start Section end symbol: __foo_end However, this pattern is not followed consistently. To allow for linker script generation and ensure consistent naming of symbols then the following pattern is introduced consistently to allow for cleaner linker script generation. Section name: foo Section start symbol: __foo_start Section end symbol: __foo_end Section size symbol: __foo_size Section LMA start symbol: __foo_load_start This commit aligns the symbols for __itcm_load_start and __dtcm_data_load_start to other symbols and in such a way they follow consistent pattern which allows for linker script and scatter file generation. The symbols are named according to the section name they describe. Section names are itcm and dtcm. The following symbols are aligned in this commit: - __itcm_rom_start -> __itcm_load_start - __dtcm_data_rom_start -> __dtcm_data_load_start Signed-off-by: Torsten Rasmussen --- include/arch/arm/aarch32/cortex_m/scripts/linker.ld | 4 ++-- include/linker/linker-defs.h | 4 ++-- kernel/xip.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/arch/arm/aarch32/cortex_m/scripts/linker.ld b/include/arch/arm/aarch32/cortex_m/scripts/linker.ld index 1aea06ee83a..a279b689780 100644 --- a/include/arch/arm/aarch32/cortex_m/scripts/linker.ld +++ b/include/arch/arm/aarch32/cortex_m/scripts/linker.ld @@ -398,7 +398,7 @@ GROUP_START(ITCM) } GROUP_LINK_IN(ITCM AT> ROMABLE_REGION) __itcm_size = __itcm_end - __itcm_start; - __itcm_rom_start = LOADADDR(_ITCM_SECTION_NAME); + __itcm_load_start = LOADADDR(_ITCM_SECTION_NAME); GROUP_END(ITCM) #endif @@ -433,7 +433,7 @@ GROUP_START(DTCM) __dtcm_end = .; - __dtcm_data_rom_start = LOADADDR(_DTCM_DATA_SECTION_NAME); + __dtcm_data_load_start = LOADADDR(_DTCM_DATA_SECTION_NAME); GROUP_END(DTCM) #endif diff --git a/include/linker/linker-defs.h b/include/linker/linker-defs.h index 89bb83e7131..715fb4e0dc6 100644 --- a/include/linker/linker-defs.h +++ b/include/linker/linker-defs.h @@ -291,7 +291,7 @@ extern char __ccm_end[]; extern char __itcm_start[]; extern char __itcm_end[]; extern char __itcm_size[]; -extern char __itcm_rom_start[]; +extern char __itcm_load_start[]; #endif #if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) @@ -301,7 +301,7 @@ extern char __dtcm_bss_start[]; extern char __dtcm_bss_end[]; extern char __dtcm_noinit_start[]; extern char __dtcm_noinit_end[]; -extern char __dtcm_data_rom_start[]; +extern char __dtcm_data_load_start[]; extern char __dtcm_start[]; extern char __dtcm_end[]; #endif diff --git a/kernel/xip.c b/kernel/xip.c index 2a2c89e9396..62d46785c60 100644 --- a/kernel/xip.c +++ b/kernel/xip.c @@ -36,11 +36,11 @@ void z_data_copy(void) __ccm_data_end - __ccm_data_start); #endif #if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) - (void)memcpy(&__itcm_start, &__itcm_rom_start, + (void)memcpy(&__itcm_start, &__itcm_load_start, (uintptr_t) &__itcm_size); #endif #if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) - (void)memcpy(&__dtcm_data_start, &__dtcm_data_rom_start, + (void)memcpy(&__dtcm_data_start, &__dtcm_data_load_start, __dtcm_data_end - __dtcm_data_start); #endif #ifdef CONFIG_CODE_DATA_RELOCATION