Skip to content

Commit 1e2d422

Browse files
Wayne Renioannisg
authored andcommitted
boards: nsim: add initial support of normal/non-secure application
normal/non-secure application: nsim_sem_normal Signed-off-by: Wayne Ren <[email protected]>
1 parent 5bb1f4f commit 1e2d422

9 files changed

+95
-7
lines changed

boards/arc/nsim/arc_mpu_regions.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#include <arch/arc/v2/mpu/arc_mpu.h>
1010
#include <linker/linker-defs.h>
1111

12+
/*
13+
* for secure firmware, MPU entries are only set up for secure world.
14+
* All regions not listed here are shared by secure world and normal world.
15+
*/
1216
static struct arc_mpu_region mpu_regions[] = {
1317
#if DT_ICCM_SIZE > 0
1418
/* Region ICCM */
@@ -24,11 +28,19 @@ static struct arc_mpu_region mpu_regions[] = {
2428
DT_DCCM_SIZE * 1024,
2529
REGION_KERNEL_RAM_ATTR | REGION_DYNAMIC),
2630
#endif
31+
32+
/*
33+
* Region peripheral is shared by secure world and normal world by default,
34+
* no need a static mpu entry. If some peripherals belong to secure world,
35+
* add it here.
36+
*/
37+
#ifndef CONFIG_ARC_SECURE_FIRMWARE
2738
/* Region Peripheral */
2839
MPU_REGION_ENTRY("PERIPHERAL",
2940
0xF0000000,
3041
64 * 1024,
3142
REGION_KERNEL_RAM_ATTR),
43+
#endif
3244
};
3345

3446
struct arc_mpu_config mpu_config = {

boards/arc/nsim/nsim_sem.dts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
/*
2-
* Copyright (c) 2018, 2019, Synopsys, Inc. All rights reserved.
2+
* Copyright (c) 2018, Synopsys, Inc. All rights reserved.
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
78
/dts-v1/;
89

910
#include "nsim_em.dtsi"
1011

1112
/ {
12-
model = "snps,nsim_sem";
13+
14+
model = "nsim_sem";
1315
compatible = "snps,nsim_sem";
14-
};
1516

16-
&cpu0 {
17-
clock-frequency = <5000000>;
17+
iccm0: iccm@0 {
18+
device_type = "memory";
19+
compatible = "arc,iccm";
20+
reg = <0x0 0x40000>;
21+
};
22+
23+
dccm0: dccm@80000000 {
24+
device_type = "memory";
25+
compatible = "arc,dccm";
26+
reg = <0x80000000 0x40000>;
27+
};
28+
29+
chosen {
30+
zephyr,sram = &dccm0;
31+
};
1832
};

boards/arc/nsim/nsim_sem_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ CONFIG_CONSOLE=y
1616
CONFIG_UART_CONSOLE=y
1717
CONFIG_SERIAL=y
1818
CONFIG_ARC_EXCEPTION_DEBUG=y
19+
CONFIG_TRUSTED_EXECUTION_SECURE=y

boards/arc/nsim/nsim_sem_mpu_stack_guard_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ CONFIG_CONSOLE=y
1717
CONFIG_UART_CONSOLE=y
1818
CONFIG_SERIAL=y
1919
CONFIG_ARC_EXCEPTION_DEBUG=y
20+
CONFIG_TRUSTED_EXECUTION_SECURE=y
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2018, Synopsys, Inc. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include <mem.h>
10+
#include "nsim_em.dtsi"
11+
12+
/ {
13+
14+
model = "nsim_sem_normal";
15+
compatible = "snps,nsim_sem_normal";
16+
17+
iccm0: iccm@0 {
18+
device_type = "memory";
19+
compatible = "arc,iccm";
20+
reg = <0x40000 DT_SIZE_K(256)>;
21+
};
22+
23+
dccm0: dccm@80000000 {
24+
device_type = "memory";
25+
compatible = "arc,dccm";
26+
reg = <0x80040000 DT_SIZE_K(256)>;
27+
};
28+
29+
chosen {
30+
zephyr,sram = &dccm0;
31+
};
32+
33+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
identifier: nsim_sem_normal
2+
name: SEM in normal mode of Nsim simulator
3+
type: mcu
4+
arch: arc
5+
simulation: nsim
6+
toolchain:
7+
- zephyr
8+
testing:
9+
ignore_tags:
10+
- net
11+
- bluetooth
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CONFIG_ARC=y
2+
CONFIG_CPU_ARCEM=y
3+
CONFIG_SOC_NSIM=y
4+
CONFIG_SOC_NSIM_SEM=y
5+
CONFIG_BOARD_NSIM=y
6+
CONFIG_SYS_CLOCK_TICKS_PER_SEC=100
7+
CONFIG_XIP=n
8+
CONFIG_BUILD_OUTPUT_BIN=n
9+
CONFIG_PRINTK=y
10+
CONFIG_ARCV2_INTERRUPT_UNIT=y
11+
CONFIG_ARCV2_TIMER=y
12+
CONFIG_CONSOLE=y
13+
CONFIG_UART_CONSOLE=y
14+
CONFIG_SERIAL=y
15+
CONFIG_ARC_EXCEPTION_DEBUG=y
16+
CONFIG_TRUSTED_EXECUTION_NONSECURE=y

soc/arc/snps_nsim/Kconfig.defconfig.em

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ config NUM_IRQ_PRIO_LEVELS
1616

1717
config NUM_IRQS
1818
# must be > the highest interrupt number used
19-
default 20
19+
default 30
2020

2121
config ARC_MPU_VER
2222
default 2

soc/arc/snps_nsim/Kconfig.defconfig.sem

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ config NUM_IRQ_PRIO_LEVELS
1616

1717
config NUM_IRQS
1818
# must be > the highest interrupt number used
19-
default 22
19+
default 30
2020

2121
config ARC_MPU_VER
2222
default 3

0 commit comments

Comments
 (0)