Skip to content

Commit f96f069

Browse files
committed
soc:arm:nxp_s32ze: Create MPU regions for separated code and data
The NXP s32ze board configs and mpu regions associate all code and data with the SRAM 0/1/ext of the architecture. There are 7 MBs of SRAMs per RTU which are dedicated to code use. Using them for the Zephyr flash target trips the MPU regions which assume a RODATA/TEXT endpoint as the beginning of the DATA/BSS section. Update to use the Code SRAMs for code and associate the MPU region with the data image start location. Signed-off-by: Matthew Christian <[email protected]>
1 parent 5249619 commit f96f069

File tree

7 files changed

+18
-3
lines changed

7 files changed

+18
-3
lines changed

boards/nxp/s32z2xxdc2/Kconfig.defconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ if BOARD_S32Z2XXDC2_S32Z270_RTU0 || BOARD_S32Z2XXDC2_S32Z270_RTU1
66
config BUILD_OUTPUT_BIN
77
default n
88

9+
config XIP
10+
default y
11+
912
if SERIAL
1013

1114
config UART_INTERRUPT_DRIVEN

boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
chosen {
1616
zephyr,sram = &sram0;
17+
zephyr,flash = &sram_code0;
1718
zephyr,canbus = &canxl0;
1819
};
1920

boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2022,2024 NXP
22
# SPDX-License-Identifier: Apache-2.0
33

4-
CONFIG_XIP=n
4+
CONFIG_XIP=y
55
CONFIG_ISR_STACK_SIZE=512
66
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000
77
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=8000000

boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
chosen {
1616
zephyr,sram = &sram1;
17+
zephyr,flash = &sram_code1;
1718
zephyr,console = &uart0;
1819
zephyr,shell-uart = &uart0;
1920
zephyr,canbus = &flexcan0;

boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2022,2024 NXP
22
# SPDX-License-Identifier: Apache-2.0
33

4-
CONFIG_XIP=n
4+
CONFIG_XIP=y
55
CONFIG_ISR_STACK_SIZE=512
66
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000
77
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=8000000

dts/arm/nxp/nxp_s32z27x_r52.dtsi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@
120120
reg = <0x35780000 DT_SIZE_M(1)>;
121121
};
122122

123+
sram_code0: memory@32100000 {
124+
compatible = "mmio-sram";
125+
reg = <0x32100000 DT_SIZE_M(7)>;
126+
};
127+
128+
sram_code1: memory@36100000 {
129+
compatible = "mmio-sram";
130+
reg = <0x36100000 DT_SIZE_M(7)>;
131+
};
132+
123133
uart0: uart@40170000 {
124134
compatible = "nxp,s32-linflexd";
125135
reg = <0x40170000 0x1000>;

soc/nxp/s32/s32ze/mpu_regions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static const struct arm_mpu_region mpu_regions[] = {
2424
REGION_RAM_RO_ATTR((uintptr_t)__rodata_region_end)),
2525

2626
MPU_REGION_ENTRY("SRAM_DATA",
27-
(uintptr_t)__rom_region_end,
27+
(uintptr_t)_image_ram_start,
2828
REGION_RAM_ATTR((uintptr_t)__kernel_ram_end)),
2929

3030
MPU_REGION_ENTRY("DEVICE",

0 commit comments

Comments
 (0)