Skip to content

Commit 6681f8d

Browse files
manuarguenashif
authored andcommitted
soc: nxp: s32k3: configure missing mpu regions
This fixes a regression introduced in c316402 where all regions except Flash and RAM where left unmapped. Before introducing region 0 that prevents speculative access to the entire memory space, we were relying on the architectural background map to access them. Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
1 parent 63ebf4d commit 6681f8d

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

dts/arm/nxp/nxp_s32k344_m7.dtsi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 NXP
2+
* Copyright 2023-2025 NXP
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -8,6 +8,7 @@
88
#include <mem.h>
99
#include <zephyr/dt-bindings/clock/nxp_s32k344_clock.h>
1010
#include <zephyr/dt-bindings/i2c/i2c.h>
11+
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>
1112

1213
/ {
1314
cpus {
@@ -45,12 +46,14 @@
4546
compatible = "zephyr,memory-region", "arm,itcm";
4647
reg = <0x00000000 DT_SIZE_K(64)>;
4748
zephyr,memory-region = "ITCM";
49+
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_FLASH) )>;
4850
};
4951

5052
dtcm: memory@20000000 {
5153
compatible = "zephyr,memory-region", "arm,dtcm";
5254
reg = <0x20000000 DT_SIZE_K(128)>;
5355
zephyr,memory-region = "DTCM";
56+
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM) )>;
5457
};
5558

5659
sram0_1: sram0_1@20400000 {

soc/nxp/s32/s32k3/mpu_regions.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@
1212
extern char _rom_attr[];
1313
#endif
1414

15+
#define REGION_PERIPHERAL_BASE_ADDRESS 0x40000000
16+
#define REGION_PERIPHERAL_SIZE REGION_512M
17+
#define REGION_PPB_BASE_ADDRESS 0xE0000000
18+
#define REGION_PPB_SIZE REGION_1M
19+
1520
static struct arm_mpu_region mpu_regions[] = {
1621

1722
/* ERR011573: use first region to prevent speculative access in entire memory space */
1823
{
19-
.name = "BACKGROUND",
24+
.name = "UNMAPPED",
2025
.base = 0,
2126
.attr = {REGION_4G | MPU_RASR_XN_Msk | P_NA_U_NA_Msk},
2227
},
@@ -42,6 +47,18 @@ static struct arm_mpu_region mpu_regions[] = {
4247
.attr = {(uint32_t)_rom_attr},
4348
},
4449
#endif
50+
51+
{
52+
.name = "PERIPHERALS",
53+
.base = REGION_PERIPHERAL_BASE_ADDRESS,
54+
.attr = REGION_IO_ATTR(REGION_PERIPHERAL_SIZE),
55+
},
56+
57+
{
58+
.name = "PPB",
59+
.base = REGION_PPB_BASE_ADDRESS,
60+
.attr = REGION_PPB_ATTR(REGION_PPB_SIZE),
61+
},
4562
};
4663

4764
const struct arm_mpu_config mpu_config = {

0 commit comments

Comments
 (0)