diff --git a/arch/arm/core/aarch32/mpu/arm_core_mpu.c b/arch/arm/core/aarch32/mpu/arm_core_mpu.c index 5ad66fe5968..5f2e9d2cd21 100644 --- a/arch/arm/core/aarch32/mpu/arm_core_mpu.c +++ b/arch/arm/core/aarch32/mpu/arm_core_mpu.c @@ -82,8 +82,8 @@ static const struct z_arm_mpu_partition static_regions[] = { #if defined(CONFIG_ARCH_HAS_RAMFUNC_SUPPORT) { /* Special RAM area for program text */ - .start = (uint32_t)&_ramfunc_ram_start, - .size = (uint32_t)&_ramfunc_ram_size, + .start = (uint32_t)&__ramfunc_start, + .size = (uint32_t)&__ramfunc_size, .attr = K_MEM_PARTITION_P_RX_U_RX, }, #endif /* CONFIG_ARCH_HAS_RAMFUNC_SUPPORT */ diff --git a/arch/common/ramfunc.ld b/arch/common/ramfunc.ld index b22579ec8ce..1fe92f55d59 100644 --- a/arch/common/ramfunc.ld +++ b/arch/common/ramfunc.ld @@ -9,12 +9,12 @@ SECTION_DATA_PROLOGUE(.ramfunc,,) { - MPU_ALIGN(_ramfunc_ram_size); - _ramfunc_ram_start = .; + MPU_ALIGN(__ramfunc_size); + __ramfunc_start = .; *(.ramfunc) *(".ramfunc.*") - MPU_ALIGN(_ramfunc_ram_size); - _ramfunc_ram_end = .; + MPU_ALIGN(__ramfunc_size); + __ramfunc_end = .; } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) -_ramfunc_ram_size = _ramfunc_ram_end - _ramfunc_ram_start; -_ramfunc_rom_start = LOADADDR(.ramfunc); +__ramfunc_size = __ramfunc_end - __ramfunc_start; +__ramfunc_load_start = LOADADDR(.ramfunc); diff --git a/include/linker/linker-defs.h b/include/linker/linker-defs.h index d28f3c39c9b..848692a4449 100644 --- a/include/linker/linker-defs.h +++ b/include/linker/linker-defs.h @@ -336,10 +336,10 @@ extern char _nocache_ram_size[]; * section, stored in RAM instead of FLASH. */ #ifdef CONFIG_ARCH_HAS_RAMFUNC_SUPPORT -extern char _ramfunc_ram_start[]; -extern char _ramfunc_ram_end[]; -extern char _ramfunc_ram_size[]; -extern char _ramfunc_rom_start[]; +extern char __ramfunc_start[]; +extern char __ramfunc_end[]; +extern char __ramfunc_size[]; +extern char __ramfunc_load_start[]; #endif /* CONFIG_ARCH_HAS_RAMFUNC_SUPPORT */ /* Memory owned by the kernel. Memory region for thread privilege stack buffers, diff --git a/kernel/xip.c b/kernel/xip.c index 0498ae6bcd8..2a2c89e9396 100644 --- a/kernel/xip.c +++ b/kernel/xip.c @@ -28,8 +28,8 @@ void z_data_copy(void) (void)memcpy(&__data_region_start, &__data_region_load_start, __data_region_end - __data_region_start); #ifdef CONFIG_ARCH_HAS_RAMFUNC_SUPPORT - (void)memcpy(&_ramfunc_ram_start, &_ramfunc_rom_start, - (uintptr_t) &_ramfunc_ram_size); + (void)memcpy(&__ramfunc_start, &__ramfunc_load_start, + (uintptr_t) &__ramfunc_size); #endif /* CONFIG_ARCH_HAS_RAMFUNC_SUPPORT */ #if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) (void)memcpy(&__ccm_data_start, &__ccm_data_rom_start, diff --git a/tests/arch/arm/arm_ramfunc/src/arm_ramfunc.c b/tests/arch/arm/arm_ramfunc/src/arm_ramfunc.c index 378bc8527bf..74948fbf2e1 100644 --- a/tests/arch/arm/arm_ramfunc/src/arm_ramfunc.c +++ b/tests/arch/arm/arm_ramfunc/src/arm_ramfunc.c @@ -26,22 +26,22 @@ void test_arm_ramfunc(void) * inside SRAM, and that arm_ram_function(.) is located inside * the .ramfunc section. */ - zassert_true((uint32_t)&_ramfunc_ram_size != 0, + zassert_true((uint32_t)&__ramfunc_size != 0, ".ramfunc linker section is empty"); - zassert_true(((uint32_t)&_ramfunc_ram_start >= (uint32_t)&_image_ram_start) - && ((uint32_t)&_ramfunc_ram_end < (uint32_t)&_image_ram_end), + zassert_true(((uint32_t)&__ramfunc_start >= (uint32_t)&_image_ram_start) + && ((uint32_t)&__ramfunc_end < (uint32_t)&_image_ram_end), ".ramfunc linker section not in RAM"); zassert_true( - (((uint32_t)&_ramfunc_ram_start) <= (uint32_t)arm_ram_function) && - (((uint32_t)&_ramfunc_ram_end) > (uint32_t)arm_ram_function), + (((uint32_t)&__ramfunc_start) <= (uint32_t)arm_ram_function) && + (((uint32_t)&__ramfunc_end) > (uint32_t)arm_ram_function), "arm_ram_function not loaded into .ramfunc"); /* If we build with User Mode support, verify that the * arm_ram_function(.) is user (read) accessible. */ #if defined(CONFIG_USERSPACE) - zassert_true(arch_buffer_validate((void *)&_ramfunc_ram_start, - (size_t)&_ramfunc_ram_size, 0) == 0 /* Success */, + zassert_true(arch_buffer_validate((void *)&__ramfunc_start, + (size_t)&__ramfunc_size, 0) == 0 /* Success */, ".ramfunc section not user accessible"); #endif /* CONFIG_USERSPACE */