Skip to content

Commit e4539aa

Browse files
Dat-NguyenDuynashif
authored andcommitted
board: s32z2xxdc2: allow the code to be executed from code RAM
- Trace32 runner: no need to configure TE bit in CFG_CORE register in the cmm start-up script, it can be configured at Zephyr start-up code when required (via SCTRL register) - MPU static regions also needs to be updated for XIP and non-XIP Signed-off-by: Dat Nguyen Duy <[email protected]>
1 parent 56cd16e commit e4539aa

File tree

5 files changed

+32
-20
lines changed

5 files changed

+32
-20
lines changed

boards/nxp/s32z2xxdc2/Kconfig.defconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,20 @@ config NET_L2_ETHERNET
3030

3131
endif # NETWORKING
3232

33+
if XIP
34+
# Offset between CRAM AXIM and CRAM AXIF, code will be downloaded
35+
# over AXIM interface
36+
config BUILD_OUTPUT_ADJUST_LMA
37+
default "-0x47800000"
38+
39+
config CPU_CORTEX_R52_CACHE_SEGREGATION
40+
default y
41+
42+
config CPU_CORTEX_R52_ICACHE_FLASH_WAY
43+
default 4
44+
45+
config CPU_CORTEX_R52_DCACHE_FLASH_WAY
46+
default 1
47+
endif # XIP
48+
3349
endif # BOARD_S32Z2XXDC2_S32Z270_RTU0 || BOARD_S32Z2XXDC2_S32Z270_RTU1

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_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/support/startup.cmm

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,17 @@
2020
; - Core0 and Core2 (redundancy) operate as a lockstep pair *
2121
; - Core1 and Core3 (redundancy) operate as a lockstep pair *
2222
; default: yes *
23-
; - thumb set to "yes" to select the T32 instruction set at reset *
24-
; default: no *
2523
; *
2624
;*******************************************************************************
2725

2826
ENTRY %LINE &args
29-
LOCAL &rtuStartAddr &cfgCoreAddr &coreId &rtuId &thumbBit &spltLckBit
27+
LOCAL &rtuStartAddr &cfgCoreAddr &coreId &rtuId &spltLckBit
3028

3129
&command=STRing.SCANAndExtract("&args","command=","debug")
3230
&elfFile=STRing.SCANAndExtract("&args","elfFile=","")
3331
&rtu=STRing.SCANAndExtract("&args","rtu=","0")
3432
&core=STRing.SCANAndExtract("&args","core=","0")
3533
&lockstep=STRing.SCANAndExtract("&args","lockstep=","yes")
36-
&thumb=STRing.SCANAndExtract("&args","thumb=","no")
3734

3835
IF ("&elfFile"=="")
3936
(
@@ -59,12 +56,6 @@ IF (&core<0||&core>3)
5956
ENDDO
6057
)
6158

62-
; select ARMv8 instruction set at reset for all Cortex-R52 cores (CFG_CORE.THUMB bit)
63-
IF ("&thumb"=="yes")
64-
&thumbBit="1"
65-
ELSE
66-
&thumbBit="0"
67-
6859
; select lock-step or split-lock mode (CFG_CORE.SPLT_LCK bit)
6960
IF ("&lockstep"=="yes")
7061
&spltLckBit="0"
@@ -126,8 +117,8 @@ GOSUB EnableRTU1
126117
; Init RTU SRAM
127118
DO ~~/demo/arm/hardware/s32z27/misc/s32z27_init_rtu&(rtu)_sram.cmm
128119

129-
; Set reset value for TE bit and split-lock mode
130-
Data.Set EZAXI:&cfgCoreAddr %Long 0yXXXXxxxxXXXXxxxxXXXXxxxxXXXXx&(thumbBit)x&(spltLckBit) ; CFG_CORE
120+
; Set reset value for split-lock mode
121+
Data.Set EZAXI:&cfgCoreAddr %Long 0yXXXXxxxxXXXXxxxxXXXXxxxxXXXXxxx&(spltLckBit) ; CFG_CORE
131122

132123
; Write loop to self instruction
133124
Data.Set EAXI:&rtuStartAddr %Long 0xFFFEF7FF

soc/nxp/s32/s32ze/mpu_regions.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,25 @@
1111
#define DEVICE_REGION_END 0x76FFFFFFUL
1212

1313
static const struct arm_mpu_region mpu_regions[] = {
14-
MPU_REGION_ENTRY("vector",
15-
(uintptr_t)_vector_start,
16-
REGION_RAM_TEXT_ATTR((uintptr_t)_vector_end)),
17-
1814
MPU_REGION_ENTRY("SRAM_TEXT",
19-
(uintptr_t)__text_region_start,
15+
(uintptr_t)__rom_region_start,
2016
REGION_RAM_TEXT_ATTR((uintptr_t)__rodata_region_start)),
2117

2218
MPU_REGION_ENTRY("SRAM_RODATA",
2319
(uintptr_t)__rodata_region_start,
24-
REGION_RAM_RO_ATTR((uintptr_t)__rodata_region_end)),
20+
#ifdef CONFIG_XIP
21+
REGION_RAM_RO_ATTR(CONFIG_FLASH_BASE_ADDRESS + KB(CONFIG_FLASH_SIZE))
22+
#else
23+
REGION_RAM_RO_ATTR((uintptr_t)__rodata_region_end)
24+
#endif
25+
),
2526

2627
MPU_REGION_ENTRY("SRAM_DATA",
28+
#ifdef CONFIG_XIP
29+
(uintptr_t)_image_ram_start,
30+
#else
2731
(uintptr_t)__rom_region_end,
32+
#endif
2833
REGION_RAM_ATTR((uintptr_t)__kernel_ram_end)),
2934

3035
MPU_REGION_ENTRY("DEVICE",

0 commit comments

Comments
 (0)