Skip to content

Commit 5eb75b8

Browse files
taricarlescufi
authored andcommitted
arm: rename default RAM region from 'SRAM' to 'RAM'
It's useful for RAMABLE_REGION to have a uniform name when CODE_DATA_RELOCATION is supported, because otherwise the build system needs to be aware of how the region name differs between architectures. Since architectures tend to prefer one of 'SRAM' or 'RAM' for that region, prefer to use 'RAM' as the more general term. Signed-off-by: Peter Marheine <[email protected]>
1 parent c82d66f commit 5eb75b8

File tree

8 files changed

+22
-37
lines changed

8 files changed

+22
-37
lines changed

arch/arm/core/aarch32/mpu/arm_core_mpu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ uint32_t z_arm_mpu_stack_guard_and_fpu_adjust(struct k_thread *thread);
5555
#endif
5656

5757
#if defined(CONFIG_CODE_DATA_RELOCATION_SRAM)
58-
extern char __sram_text_start[];
59-
extern char __sram_text_size[];
58+
extern char __ram_text_start[];
59+
extern char __ram_text_size[];
6060
#endif
6161

6262
static const struct z_arm_mpu_partition static_regions[] = {
@@ -89,8 +89,8 @@ static const struct z_arm_mpu_partition static_regions[] = {
8989
#if defined(CONFIG_CODE_DATA_RELOCATION_SRAM)
9090
{
9191
/* RAM area for relocated text */
92-
.start = (uint32_t)&__sram_text_start,
93-
.size = (uint32_t)&__sram_text_size,
92+
.start = (uint32_t)&__ram_text_start,
93+
.size = (uint32_t)&__ram_text_size,
9494
.attr = K_MEM_PARTITION_P_RX_U_RX,
9595
},
9696
#endif /* CONFIG_CODE_DATA_RELOCATION_SRAM */

cmake/linker/ld/target_relocation.cmake

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,7 @@ macro(toolchain_ld_relocation)
99
set(MEM_RELOCATION_SRAM_BSS_LD
1010
"${PROJECT_BINARY_DIR}/include/generated/linker_sram_bss_relocate.ld")
1111
set(MEM_RELOCATION_CODE "${PROJECT_BINARY_DIR}/code_relocation.c")
12-
if(CONFIG_ARM)
13-
set(MEM_REGION_DEFAULT_RAM SRAM)
14-
elseif(CONFIG_RISCV)
15-
set(MEM_REGION_DEFAULT_RAM RAM)
16-
else()
17-
# Name must be configured for newly-supported architectures
18-
message(SEND_ERROR "Default RAM region name is unknown for target architecture")
19-
endif()
12+
set(MEM_REGION_DEFAULT_RAM RAM)
2013

2114
add_custom_command(
2215
OUTPUT ${MEM_RELOCATION_CODE} ${MEM_RELOCATION_LD}

drivers/flash/Kconfig.mcux

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ config FLASH_MCUX_FLEXSPI_XIP_MEM_ITCM
124124
select CODE_DATA_RELOCATION
125125

126126
config FLASH_MCUX_FLEXSPI_XIP_MEM_SRAM
127-
bool "SRAM"
127+
bool "RAM"
128128
select CODE_DATA_RELOCATION_SRAM
129129

130130
endchoice
131131

132132
config FLASH_MCUX_FLEXSPI_XIP_MEM
133133
string
134134
default "ITCM" if FLASH_MCUX_FLEXSPI_XIP_MEM_ITCM
135-
default "SRAM" if FLASH_MCUX_FLEXSPI_XIP_MEM_SRAM
135+
default "RAM" if FLASH_MCUX_FLEXSPI_XIP_MEM_SRAM
136136

137137
endif # FLASH_MCUX_FLEXSPI_XIP
138138

include/zephyr/arch/arm/aarch32/cortex_a_r/scripts/linker.ld

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121
/* physical address of RAM */
2222
#ifdef CONFIG_XIP
2323
#define ROMABLE_REGION FLASH
24-
#define RAMABLE_REGION SRAM
2524
#else
26-
#define ROMABLE_REGION SRAM
27-
#define RAMABLE_REGION SRAM
25+
#define ROMABLE_REGION RAM
2826
#endif
27+
#define RAMABLE_REGION RAM
2928

3029
#if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0)
3130
#define ROM_ADDR RAM_ADDR
@@ -79,7 +78,7 @@ _region_min_align = 4;
7978
MEMORY
8079
{
8180
FLASH (rx) : ORIGIN = ROM_ADDR, LENGTH = ROM_SIZE
82-
SRAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE
81+
RAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE
8382
LINKER_DT_REGIONS()
8483
/* Used by and documented in include/linker/intlist.ld */
8584
IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K
@@ -243,7 +242,7 @@ SECTIONS
243242
GROUP_START(RAMABLE_REGION)
244243

245244
. = RAM_ADDR;
246-
/* Align the start of image SRAM with the
245+
/* Align the start of image RAM with the
247246
* minimum granularity required by MPU.
248247
*/
249248
. = ALIGN(_region_min_align);

include/zephyr/arch/arm/aarch32/cortex_m/scripts/linker.ld

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121
/* physical address of RAM */
2222
#ifdef CONFIG_XIP
2323
#define ROMABLE_REGION FLASH
24-
#define RAMABLE_REGION SRAM
2524
#else
26-
#define ROMABLE_REGION SRAM
27-
#define RAMABLE_REGION SRAM
25+
#define ROMABLE_REGION RAM
2826
#endif
27+
#define RAMABLE_REGION RAM
2928

3029
#if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0)
3130
#define ROM_ADDR RAM_ADDR
@@ -79,7 +78,7 @@ _region_min_align = 4;
7978
MEMORY
8079
{
8180
FLASH (rx) : ORIGIN = ROM_ADDR, LENGTH = ROM_SIZE
82-
SRAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE
81+
RAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE
8382
LINKER_DT_REGIONS()
8483
/* Used by and documented in include/linker/intlist.ld */
8584
IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K
@@ -227,7 +226,7 @@ SECTIONS
227226
GROUP_START(RAMABLE_REGION)
228227

229228
. = RAM_ADDR;
230-
/* Align the start of image SRAM with the
229+
/* Align the start of image RAM with the
231230
* minimum granularity required by MPU.
232231
*/
233232
. = ALIGN(_region_min_align);

samples/application_development/code_relocation_nocopy/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ target_sources_ifdef(CONFIG_NRFX_QSPI app PRIVATE boards/nrf5340dk_nrf5340_cpuap
1212
# Run ext_code from the external flash (XIP). No need to copy.
1313
zephyr_code_relocate(src/ext_code.c EXTFLASH_TEXT NOCOPY)
1414

15-
# But still relocate (copy) the data to SRAM
16-
zephyr_code_relocate(src/ext_code.c SRAM_DATA)
15+
# But still relocate (copy) the data to RAM
16+
zephyr_code_relocate(src/ext_code.c RAM_DATA)
1717

1818
# sram_code instead runs entirely from SRAM after being copied there.
19-
zephyr_code_relocate(src/sram_code.c SRAM)
19+
zephyr_code_relocate(src/sram_code.c RAM)

soc/arm/nxp_imx/rt5xx/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ zephyr_linker_sources_ifdef(CONFIG_NXP_IMX_RT5XX_BOOT_HEADER
2424
zephyr_linker_sources_ifdef(CONFIG_USB_DEVICE_DRIVER
2525
SECTIONS usb.ld)
2626

27-
zephyr_code_relocate(flash_clock_setup.c SRAM)
27+
zephyr_code_relocate(flash_clock_setup.c RAM)

tests/application_development/code_relocation/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,16 @@ project(code_relocation)
88
FILE(GLOB app_sources src/*.c)
99
target_sources(app PRIVATE ${app_sources})
1010

11-
if (CONFIG_ARM)
12-
set(RAM_SECTION SRAM)
13-
else()
14-
set(RAM_SECTION RAM)
15-
endif()
16-
1711
# Code relocation feature
1812
zephyr_code_relocate(src/test_file1.c SRAM2)
1913

20-
zephyr_code_relocate(src/test_file2.c ${RAM_SECTION})
14+
zephyr_code_relocate(src/test_file2.c RAM)
2115

2216
zephyr_code_relocate(src/test_file3.c SRAM2_TEXT)
23-
zephyr_code_relocate(src/test_file3.c ${RAM_SECTION}_DATA)
17+
zephyr_code_relocate(src/test_file3.c RAM_DATA)
2418
zephyr_code_relocate(src/test_file3.c SRAM2_BSS)
2519

26-
zephyr_code_relocate(../../../kernel/sem.c ${RAM_SECTION})
20+
zephyr_code_relocate(../../../kernel/sem.c RAM)
2721

2822
if (CONFIG_RELOCATE_TO_ITCM)
2923
zephyr_code_relocate(../../../lib/libc/minimal/source/string/string.c ITCM_TEXT)

0 commit comments

Comments
 (0)