Skip to content

Commit 887026f

Browse files
tejlmand57300
authored andcommitted
[nrf fromtree] tests: add twister tests for CMake board and SoC extension
This commit adds new tests for verifying the functionality of the board and SoC extension feature. It does so by defining: - A new CPU cluster on an existing SoC - Two new board variants on top of an existing board The new board variants are defined on top of the existing `native_sim` board, so that the following native_sim board targets are available for the test. Existing board targets: - native_sim/native - native_sim/native/64 Extended board targets: - native_sim/native/one - native_sim/native/64/two The new CPU cluster is defined for the existing `an521` SoC. Existing CPU Clusters on an521: - cpu0 - cpu1 New CPU Cluster: - cputest For SoC tests the mps2 board is used. This means that for testing, the following board targets using the an521 SoC are: - mps2/an521/cpu0 - mps2/an521/cpu1 - mps2/an521/cputest Signed-off-by: Torsten Rasmussen <[email protected]> (cherry picked from commit f315157)
1 parent e9e9a1c commit 887026f

25 files changed

+873
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright (c) 2024 Nordic Semiconductor ASA
4+
5+
cmake_minimum_required(VERSION 3.20.0)
6+
7+
set(BOARD_ROOT ${CMAKE_CURRENT_LIST_DIR}/oot_root)
8+
set(SOC_ROOT ${CMAKE_CURRENT_LIST_DIR}/oot_root)
9+
10+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
11+
project(native_sim_extend)
12+
13+
FILE(GLOB app_sources src/*.c)
14+
target_sources(app PRIVATE ${app_sources})
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2024 Nordic Semiconductor ASA
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
config BASE_BOARD_SETTING
6+
bool "Base board test string"
7+
help
8+
This kconfig is set when the base board config fragment is supposed to
9+
be sourced, that is when oot variant defines
10+
'extends:'
11+
' board: native_sim'
12+
' qualifier: posix'
13+
' inherit: 1'
14+
15+
source "Kconfig.zephyr"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_BASE_BOARD_SETTING=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_EXTENDED_VARIANT_BOARD_SETTING=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_EXTENDED_VARIANT_BOARD_SETTING=y
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2017 Linaro Limited
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_MPS2
5+
select SOC_MPS2_AN521_CPUTEST if BOARD_MPS2_AN521_CPUTEST
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright (c) 2024, Nordic Semiconductor ASA
4+
5+
if(CONFIG_BOARD_MPS2_AN521_CPUTEST)
6+
set(QEMU_CPU_TYPE_${ARCH} cortex-m33)
7+
set(QEMU_FLAGS_${ARCH}
8+
-cpu ${QEMU_CPU_TYPE_${ARCH}}
9+
-machine mps2-an521
10+
-nographic
11+
-m 16
12+
-vga none
13+
)
14+
endif()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
board:
2+
extend: mps2
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
/*
2+
* Copyright (c) 2019 Linaro Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
sysclk: system-clock {
8+
compatible = "fixed-clock";
9+
clock-frequency = <25000000>;
10+
#clock-cells = <0>;
11+
};
12+
13+
timer0: timer@0 {
14+
compatible = "arm,cmsdk-timer";
15+
reg = <0x0 0x1000>;
16+
interrupts = <3 3>;
17+
};
18+
19+
timer1: timer@1000 {
20+
compatible = "arm,cmsdk-timer";
21+
reg = <0x1000 0x1000>;
22+
interrupts = <4 3>;
23+
};
24+
25+
dtimer0: dtimer@2000 {
26+
compatible = "arm,cmsdk-dtimer";
27+
reg = <0x2000 0x1000>;
28+
interrupts = <5 3>;
29+
};
30+
31+
mhu0: mhu@3000 {
32+
compatible = "arm,mhu";
33+
reg = <0x3000 0x1000>;
34+
interrupts = <6 3>;
35+
};
36+
37+
mhu1: mhu@4000 {
38+
compatible = "arm,mhu";
39+
reg = <0x4000 0x1000>;
40+
interrupts = <7 3>;
41+
};
42+
43+
gpio0: gpio@100000 {
44+
compatible = "arm,cmsdk-gpio";
45+
reg = <0x100000 0x1000>;
46+
interrupts = <68 3>;
47+
gpio-controller;
48+
#gpio-cells = <2>;
49+
};
50+
51+
gpio1: gpio@101000 {
52+
compatible = "arm,cmsdk-gpio";
53+
reg = <0x101000 0x1000>;
54+
interrupts = <69 3>;
55+
gpio-controller;
56+
#gpio-cells = <2>;
57+
};
58+
59+
gpio2: gpio@102000 {
60+
compatible = "arm,cmsdk-gpio";
61+
reg = <0x102000 0x1000>;
62+
interrupts = <70 3>;
63+
gpio-controller;
64+
#gpio-cells = <2>;
65+
};
66+
67+
gpio3: gpio@103000 {
68+
compatible = "arm,cmsdk-gpio";
69+
reg = <0x103000 0x1000>;
70+
interrupts = <71 3>;
71+
gpio-controller;
72+
#gpio-cells = <2>;
73+
};
74+
75+
wdog0: wdog@81000 {
76+
compatible = "arm,cmsdk-watchdog";
77+
reg = <0x81000 0x1000>;
78+
clocks = <&sysclk>;
79+
};
80+
81+
uart0: uart@200000 {
82+
compatible = "arm,cmsdk-uart";
83+
reg = <0x200000 0x1000>;
84+
interrupts = <33 3 32 3>;
85+
interrupt-names = "tx", "rx";
86+
clocks = <&sysclk>;
87+
current-speed = <115200>;
88+
};
89+
90+
uart1: uart@201000 {
91+
compatible = "arm,cmsdk-uart";
92+
reg = <0x201000 0x1000>;
93+
interrupts = <35 3 34 3>;
94+
interrupt-names = "tx", "rx";
95+
clocks = <&sysclk>;
96+
current-speed = <115200>;
97+
};
98+
99+
uart2: uart@202000 {
100+
compatible = "arm,cmsdk-uart";
101+
reg = <0x202000 0x1000>;
102+
interrupts = <37 3 36 3>;
103+
interrupt-names = "tx", "rx";
104+
clocks = <&sysclk>;
105+
current-speed = <115200>;
106+
};
107+
108+
uart3: uart@203000 {
109+
compatible = "arm,cmsdk-uart";
110+
reg = <0x203000 0x1000>;
111+
interrupts = <39 3 38 3>;
112+
interrupt-names = "tx", "rx";
113+
clocks = <&sysclk>;
114+
current-speed = <115200>;
115+
};
116+
117+
uart4: uart@204000 {
118+
compatible = "arm,cmsdk-uart";
119+
reg = <0x204000 0x1000>;
120+
interrupts = <41 3 40 3>;
121+
interrupt-names = "tx", "rx";
122+
clocks = <&sysclk>;
123+
current-speed = <115200>;
124+
};
125+
126+
i2c_touch: i2c@207000 {
127+
compatible = "arm,versatile-i2c";
128+
clock-frequency = <I2C_BITRATE_STANDARD>;
129+
#address-cells = <1>;
130+
#size-cells = <0>;
131+
reg = <0x207000 0x1000>;
132+
};
133+
134+
i2c_audio_conf: i2c@208000 {
135+
compatible = "arm,versatile-i2c";
136+
clock-frequency = <I2C_BITRATE_STANDARD>;
137+
#address-cells = <1>;
138+
#size-cells = <0>;
139+
reg = <0x208000 0x1000>;
140+
};
141+
142+
i2c_shield0: i2c@20c000 {
143+
compatible = "arm,versatile-i2c";
144+
clock-frequency = <I2C_BITRATE_STANDARD>;
145+
#address-cells = <1>;
146+
#size-cells = <0>;
147+
reg = <0x20c000 0x1000>;
148+
};
149+
150+
i2c_shield1: i2c@20d000 {
151+
compatible = "arm,versatile-i2c";
152+
clock-frequency = <I2C_BITRATE_STANDARD>;
153+
#address-cells = <1>;
154+
#size-cells = <0>;
155+
reg = <0x20d000 0x1000>;
156+
};
157+
158+
gpio_led0: mps2_fpgaio@302000 {
159+
compatible = "arm,mps2-fpgaio-gpio";
160+
161+
reg = <0x302000 0x4>;
162+
gpio-controller;
163+
#gpio-cells = <1>;
164+
ngpios = <2>;
165+
};
166+
167+
gpio_button: mps2_fpgaio@302008 {
168+
compatible = "arm,mps2-fpgaio-gpio";
169+
170+
reg = <0x302008 0x4>;
171+
gpio-controller;
172+
#gpio-cells = <1>;
173+
ngpios = <2>;
174+
};
175+
176+
gpio_misc: mps2_fpgaio@30204c {
177+
compatible = "arm,mps2-fpgaio-gpio";
178+
179+
reg = <0x30204c 0x4>;
180+
gpio-controller;
181+
#gpio-cells = <1>;
182+
ngpios = <10>;
183+
};
184+
185+
eth0: eth@2000000 {
186+
/* Linux has "smsc,lan9115" */
187+
compatible = "smsc,lan9220";
188+
/* Actual reg range is ~0x200 */
189+
reg = <0x2000000 0x100000>;
190+
interrupts = <48 3>;
191+
};
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
/*
2+
* Copyright (c) 2018-2019 Linaro Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include <mem.h>
10+
#include <arm/armv8-m.dtsi>
11+
#include <zephyr/dt-bindings/i2c/i2c.h>
12+
#include <zephyr/dt-bindings/input/input-event-codes.h>
13+
14+
/ {
15+
compatible = "arm,mps2";
16+
#address-cells = <1>;
17+
#size-cells = <1>;
18+
19+
aliases {
20+
led0 = &led_0;
21+
led1 = &led_1;
22+
sw0 = &user_button_0;
23+
sw1 = &user_button_1;
24+
uart-1 = &uart1;
25+
watchdog0 = &wdog0;
26+
};
27+
28+
chosen {
29+
zephyr,console = &uart0;
30+
zephyr,shell-uart = &uart0;
31+
32+
/*
33+
* These SRAM and flash settings give the entire available
34+
* code and data memories to this secure firmware image.
35+
* This may conflict with mps2_an521_remote firmware. Use
36+
* caution when using both targets simultaneously.
37+
*/
38+
zephyr,sram = &ssram2_3;
39+
zephyr,flash = &ssram1;
40+
};
41+
42+
leds {
43+
compatible = "gpio-leds";
44+
led_0: led_0 {
45+
gpios = <&gpio_led0 0>;
46+
label = "USERLED0";
47+
};
48+
led_1: led_1 {
49+
gpios = <&gpio_led0 1>;
50+
label = "USERLED1";
51+
};
52+
};
53+
54+
gpio_keys {
55+
compatible = "gpio-keys";
56+
user_button_0: button_0 {
57+
label = "USERPB0";
58+
gpios = <&gpio_button 0>;
59+
zephyr,code = <INPUT_KEY_0>;
60+
};
61+
user_button_1: button_1 {
62+
label = "USERPB1";
63+
gpios = <&gpio_button 1>;
64+
zephyr,code = <INPUT_KEY_1>;
65+
};
66+
};
67+
68+
cpus {
69+
#address-cells = <1>;
70+
#size-cells = <0>;
71+
72+
cpu@0 {
73+
device_type = "cpu";
74+
compatible = "arm,cortex-m33";
75+
reg = <0>;
76+
#address-cells = <1>;
77+
#size-cells = <1>;
78+
79+
mpu: mpu@e000ed90 {
80+
compatible = "arm,armv8m-mpu";
81+
reg = <0xe000ed90 0x40>;
82+
};
83+
};
84+
};
85+
86+
/*
87+
* The memory regions defined below are according to AN521:
88+
* https://documentation-service.arm.com/static/5fa12fe9b1a7c5445f29017f
89+
*
90+
* Please see tables mentioned in individual comments below for details.
91+
*/
92+
93+
ssram1: memory@10000000 {
94+
/* Table 3-2, row 6. */
95+
compatible = "zephyr,memory-region", "mmio-sram";
96+
reg = <0x10000000 DT_SIZE_M(4)>;
97+
zephyr,memory-region = "SSRAM1";
98+
};
99+
100+
ssram2_3: memory@38000000 {
101+
/* Table 3-4, rows 16 and 17. */
102+
compatible = "zephyr,memory-region", "mmio-sram";
103+
reg = <0x38000000 DT_SIZE_M(4)>;
104+
zephyr,memory-region = "SSRAM2_3";
105+
};
106+
107+
psram: memory@80000000 {
108+
/* Table 3-6, row 1. */
109+
device_type = "memory";
110+
reg = <0x80000000 DT_SIZE_M(16)>;
111+
};
112+
113+
soc {
114+
peripheral@50000000 {
115+
#address-cells = <1>;
116+
#size-cells = <1>;
117+
ranges = <0x0 0x50000000 0x10000000>;
118+
119+
#include "mps2_an521-common.dtsi"
120+
};
121+
};
122+
};
123+
124+
&nvic {
125+
arm,num-irq-priority-bits = <3>;
126+
};
127+
128+
&uart1 {
129+
status = "okay";
130+
};

0 commit comments

Comments
 (0)