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 <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
98b186c110
commit
f3151571ba
25 changed files with 873 additions and 0 deletions
14
tests/cmake/hwm/board_extend/CMakeLists.txt
Normal file
14
tests/cmake/hwm/board_extend/CMakeLists.txt
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Copyright (c) 2024 Nordic Semiconductor ASA
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.20.0)
|
||||||
|
|
||||||
|
set(BOARD_ROOT ${CMAKE_CURRENT_LIST_DIR}/oot_root)
|
||||||
|
set(SOC_ROOT ${CMAKE_CURRENT_LIST_DIR}/oot_root)
|
||||||
|
|
||||||
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||||
|
project(native_sim_extend)
|
||||||
|
|
||||||
|
FILE(GLOB app_sources src/*.c)
|
||||||
|
target_sources(app PRIVATE ${app_sources})
|
15
tests/cmake/hwm/board_extend/Kconfig
Normal file
15
tests/cmake/hwm/board_extend/Kconfig
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Copyright (c) 2024 Nordic Semiconductor ASA
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
config BASE_BOARD_SETTING
|
||||||
|
bool "Base board test string"
|
||||||
|
help
|
||||||
|
This kconfig is set when the base board config fragment is supposed to
|
||||||
|
be sourced, that is when oot variant defines
|
||||||
|
'extends:'
|
||||||
|
' board: native_sim'
|
||||||
|
' qualifier: posix'
|
||||||
|
' inherit: 1'
|
||||||
|
|
||||||
|
source "Kconfig.zephyr"
|
1
tests/cmake/hwm/board_extend/boards/native_sim.conf
Normal file
1
tests/cmake/hwm/board_extend/boards/native_sim.conf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
CONFIG_BASE_BOARD_SETTING=y
|
|
@ -0,0 +1 @@
|
||||||
|
CONFIG_EXTENDED_VARIANT_BOARD_SETTING=y
|
|
@ -0,0 +1 @@
|
||||||
|
CONFIG_EXTENDED_VARIANT_BOARD_SETTING=y
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Copyright (c) 2017 Linaro Limited
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
config BOARD_MPS2
|
||||||
|
select SOC_MPS2_AN521_CPUTEST if BOARD_MPS2_AN521_CPUTEST
|
|
@ -0,0 +1,14 @@
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Copyright (c) 2024, Nordic Semiconductor ASA
|
||||||
|
|
||||||
|
if(CONFIG_BOARD_MPS2_AN521_CPUTEST)
|
||||||
|
set(QEMU_CPU_TYPE_${ARCH} cortex-m33)
|
||||||
|
set(QEMU_FLAGS_${ARCH}
|
||||||
|
-cpu ${QEMU_CPU_TYPE_${ARCH}}
|
||||||
|
-machine mps2-an521
|
||||||
|
-nographic
|
||||||
|
-m 16
|
||||||
|
-vga none
|
||||||
|
)
|
||||||
|
endif()
|
|
@ -0,0 +1,2 @@
|
||||||
|
board:
|
||||||
|
extend: mps2
|
|
@ -0,0 +1,191 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 Linaro Limited
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
sysclk: system-clock {
|
||||||
|
compatible = "fixed-clock";
|
||||||
|
clock-frequency = <25000000>;
|
||||||
|
#clock-cells = <0>;
|
||||||
|
};
|
||||||
|
|
||||||
|
timer0: timer@0 {
|
||||||
|
compatible = "arm,cmsdk-timer";
|
||||||
|
reg = <0x0 0x1000>;
|
||||||
|
interrupts = <3 3>;
|
||||||
|
};
|
||||||
|
|
||||||
|
timer1: timer@1000 {
|
||||||
|
compatible = "arm,cmsdk-timer";
|
||||||
|
reg = <0x1000 0x1000>;
|
||||||
|
interrupts = <4 3>;
|
||||||
|
};
|
||||||
|
|
||||||
|
dtimer0: dtimer@2000 {
|
||||||
|
compatible = "arm,cmsdk-dtimer";
|
||||||
|
reg = <0x2000 0x1000>;
|
||||||
|
interrupts = <5 3>;
|
||||||
|
};
|
||||||
|
|
||||||
|
mhu0: mhu@3000 {
|
||||||
|
compatible = "arm,mhu";
|
||||||
|
reg = <0x3000 0x1000>;
|
||||||
|
interrupts = <6 3>;
|
||||||
|
};
|
||||||
|
|
||||||
|
mhu1: mhu@4000 {
|
||||||
|
compatible = "arm,mhu";
|
||||||
|
reg = <0x4000 0x1000>;
|
||||||
|
interrupts = <7 3>;
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio0: gpio@100000 {
|
||||||
|
compatible = "arm,cmsdk-gpio";
|
||||||
|
reg = <0x100000 0x1000>;
|
||||||
|
interrupts = <68 3>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio1: gpio@101000 {
|
||||||
|
compatible = "arm,cmsdk-gpio";
|
||||||
|
reg = <0x101000 0x1000>;
|
||||||
|
interrupts = <69 3>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio2: gpio@102000 {
|
||||||
|
compatible = "arm,cmsdk-gpio";
|
||||||
|
reg = <0x102000 0x1000>;
|
||||||
|
interrupts = <70 3>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio3: gpio@103000 {
|
||||||
|
compatible = "arm,cmsdk-gpio";
|
||||||
|
reg = <0x103000 0x1000>;
|
||||||
|
interrupts = <71 3>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
wdog0: wdog@81000 {
|
||||||
|
compatible = "arm,cmsdk-watchdog";
|
||||||
|
reg = <0x81000 0x1000>;
|
||||||
|
clocks = <&sysclk>;
|
||||||
|
};
|
||||||
|
|
||||||
|
uart0: uart@200000 {
|
||||||
|
compatible = "arm,cmsdk-uart";
|
||||||
|
reg = <0x200000 0x1000>;
|
||||||
|
interrupts = <33 3 32 3>;
|
||||||
|
interrupt-names = "tx", "rx";
|
||||||
|
clocks = <&sysclk>;
|
||||||
|
current-speed = <115200>;
|
||||||
|
};
|
||||||
|
|
||||||
|
uart1: uart@201000 {
|
||||||
|
compatible = "arm,cmsdk-uart";
|
||||||
|
reg = <0x201000 0x1000>;
|
||||||
|
interrupts = <35 3 34 3>;
|
||||||
|
interrupt-names = "tx", "rx";
|
||||||
|
clocks = <&sysclk>;
|
||||||
|
current-speed = <115200>;
|
||||||
|
};
|
||||||
|
|
||||||
|
uart2: uart@202000 {
|
||||||
|
compatible = "arm,cmsdk-uart";
|
||||||
|
reg = <0x202000 0x1000>;
|
||||||
|
interrupts = <37 3 36 3>;
|
||||||
|
interrupt-names = "tx", "rx";
|
||||||
|
clocks = <&sysclk>;
|
||||||
|
current-speed = <115200>;
|
||||||
|
};
|
||||||
|
|
||||||
|
uart3: uart@203000 {
|
||||||
|
compatible = "arm,cmsdk-uart";
|
||||||
|
reg = <0x203000 0x1000>;
|
||||||
|
interrupts = <39 3 38 3>;
|
||||||
|
interrupt-names = "tx", "rx";
|
||||||
|
clocks = <&sysclk>;
|
||||||
|
current-speed = <115200>;
|
||||||
|
};
|
||||||
|
|
||||||
|
uart4: uart@204000 {
|
||||||
|
compatible = "arm,cmsdk-uart";
|
||||||
|
reg = <0x204000 0x1000>;
|
||||||
|
interrupts = <41 3 40 3>;
|
||||||
|
interrupt-names = "tx", "rx";
|
||||||
|
clocks = <&sysclk>;
|
||||||
|
current-speed = <115200>;
|
||||||
|
};
|
||||||
|
|
||||||
|
i2c_touch: i2c@207000 {
|
||||||
|
compatible = "arm,versatile-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
reg = <0x207000 0x1000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
i2c_audio_conf: i2c@208000 {
|
||||||
|
compatible = "arm,versatile-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
reg = <0x208000 0x1000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
i2c_shield0: i2c@20c000 {
|
||||||
|
compatible = "arm,versatile-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
reg = <0x20c000 0x1000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
i2c_shield1: i2c@20d000 {
|
||||||
|
compatible = "arm,versatile-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
reg = <0x20d000 0x1000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio_led0: mps2_fpgaio@302000 {
|
||||||
|
compatible = "arm,mps2-fpgaio-gpio";
|
||||||
|
|
||||||
|
reg = <0x302000 0x4>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <1>;
|
||||||
|
ngpios = <2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio_button: mps2_fpgaio@302008 {
|
||||||
|
compatible = "arm,mps2-fpgaio-gpio";
|
||||||
|
|
||||||
|
reg = <0x302008 0x4>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <1>;
|
||||||
|
ngpios = <2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio_misc: mps2_fpgaio@30204c {
|
||||||
|
compatible = "arm,mps2-fpgaio-gpio";
|
||||||
|
|
||||||
|
reg = <0x30204c 0x4>;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <1>;
|
||||||
|
ngpios = <10>;
|
||||||
|
};
|
||||||
|
|
||||||
|
eth0: eth@2000000 {
|
||||||
|
/* Linux has "smsc,lan9115" */
|
||||||
|
compatible = "smsc,lan9220";
|
||||||
|
/* Actual reg range is ~0x200 */
|
||||||
|
reg = <0x2000000 0x100000>;
|
||||||
|
interrupts = <48 3>;
|
||||||
|
};
|
|
@ -0,0 +1,130 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019 Linaro Limited
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/dts-v1/;
|
||||||
|
|
||||||
|
#include <mem.h>
|
||||||
|
#include <arm/armv8-m.dtsi>
|
||||||
|
#include <zephyr/dt-bindings/i2c/i2c.h>
|
||||||
|
#include <zephyr/dt-bindings/input/input-event-codes.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
compatible = "arm,mps2";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
aliases {
|
||||||
|
led0 = &led_0;
|
||||||
|
led1 = &led_1;
|
||||||
|
sw0 = &user_button_0;
|
||||||
|
sw1 = &user_button_1;
|
||||||
|
uart-1 = &uart1;
|
||||||
|
watchdog0 = &wdog0;
|
||||||
|
};
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
zephyr,console = &uart0;
|
||||||
|
zephyr,shell-uart = &uart0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These SRAM and flash settings give the entire available
|
||||||
|
* code and data memories to this secure firmware image.
|
||||||
|
* This may conflict with mps2_an521_remote firmware. Use
|
||||||
|
* caution when using both targets simultaneously.
|
||||||
|
*/
|
||||||
|
zephyr,sram = &ssram2_3;
|
||||||
|
zephyr,flash = &ssram1;
|
||||||
|
};
|
||||||
|
|
||||||
|
leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
led_0: led_0 {
|
||||||
|
gpios = <&gpio_led0 0>;
|
||||||
|
label = "USERLED0";
|
||||||
|
};
|
||||||
|
led_1: led_1 {
|
||||||
|
gpios = <&gpio_led0 1>;
|
||||||
|
label = "USERLED1";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio_keys {
|
||||||
|
compatible = "gpio-keys";
|
||||||
|
user_button_0: button_0 {
|
||||||
|
label = "USERPB0";
|
||||||
|
gpios = <&gpio_button 0>;
|
||||||
|
zephyr,code = <INPUT_KEY_0>;
|
||||||
|
};
|
||||||
|
user_button_1: button_1 {
|
||||||
|
label = "USERPB1";
|
||||||
|
gpios = <&gpio_button 1>;
|
||||||
|
zephyr,code = <INPUT_KEY_1>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
cpus {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
|
||||||
|
cpu@0 {
|
||||||
|
device_type = "cpu";
|
||||||
|
compatible = "arm,cortex-m33";
|
||||||
|
reg = <0>;
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
mpu: mpu@e000ed90 {
|
||||||
|
compatible = "arm,armv8m-mpu";
|
||||||
|
reg = <0xe000ed90 0x40>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The memory regions defined below are according to AN521:
|
||||||
|
* https://documentation-service.arm.com/static/5fa12fe9b1a7c5445f29017f
|
||||||
|
*
|
||||||
|
* Please see tables mentioned in individual comments below for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ssram1: memory@10000000 {
|
||||||
|
/* Table 3-2, row 6. */
|
||||||
|
compatible = "zephyr,memory-region", "mmio-sram";
|
||||||
|
reg = <0x10000000 DT_SIZE_M(4)>;
|
||||||
|
zephyr,memory-region = "SSRAM1";
|
||||||
|
};
|
||||||
|
|
||||||
|
ssram2_3: memory@38000000 {
|
||||||
|
/* Table 3-4, rows 16 and 17. */
|
||||||
|
compatible = "zephyr,memory-region", "mmio-sram";
|
||||||
|
reg = <0x38000000 DT_SIZE_M(4)>;
|
||||||
|
zephyr,memory-region = "SSRAM2_3";
|
||||||
|
};
|
||||||
|
|
||||||
|
psram: memory@80000000 {
|
||||||
|
/* Table 3-6, row 1. */
|
||||||
|
device_type = "memory";
|
||||||
|
reg = <0x80000000 DT_SIZE_M(16)>;
|
||||||
|
};
|
||||||
|
|
||||||
|
soc {
|
||||||
|
peripheral@50000000 {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
ranges = <0x0 0x50000000 0x10000000>;
|
||||||
|
|
||||||
|
#include "mps2_an521-common.dtsi"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&nvic {
|
||||||
|
arm,num-irq-priority-bits = <3>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&uart1 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
|
@ -0,0 +1,21 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018-2019 Linaro Limited
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
#CONFIG_RUNTIME_NMI=y
|
||||||
|
#CONFIG_ARM_TRUSTZONE_M=y
|
||||||
|
#CONFIG_ARM_MPU=y
|
||||||
|
CONFIG_QEMU_ICOUNT_SHIFT=6
|
||||||
|
#
|
||||||
|
## GPIOs
|
||||||
|
CONFIG_GPIO=y
|
||||||
|
|
||||||
|
# Serial
|
||||||
|
CONFIG_CONSOLE=y
|
||||||
|
CONFIG_UART_CONSOLE=y
|
||||||
|
CONFIG_SERIAL=y
|
||||||
|
|
||||||
|
# Build a non-secure firmware image
|
||||||
|
#CONFIG_TRUSTED_EXECUTION_NONSECURE=y
|
|
@ -0,0 +1,30 @@
|
||||||
|
# Copyright (c) 2024 Nordic Semiconductor ASA
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
config EXTENDED_VARIANT_BOARD_SETTING
|
||||||
|
bool "Extended variant board test string"
|
||||||
|
depends on BOARD_NATIVE_SIM_NATIVE_ONE || BOARD_NATIVE_SIM_NATIVE_64_TWO
|
||||||
|
help
|
||||||
|
This kconfig is set when the extended variant board config fragment
|
||||||
|
is supposed to be sourced, that is when oot variant defines 'extends:'
|
||||||
|
|
||||||
|
config EXTENDED_VARIANT_BOARD_ONE_SETTING_PROMPTLESS
|
||||||
|
bool
|
||||||
|
depends on BOARD_NATIVE_SIM_NATIVE_ONE
|
||||||
|
help
|
||||||
|
This kconfig is promptless and is expected to be set through the
|
||||||
|
Kconfig.defconfig for the extended board.
|
||||||
|
|
||||||
|
config EXTENDED_VARIANT_BOARD_TWO_SETTING_PROMPTLESS
|
||||||
|
bool
|
||||||
|
depends on BOARD_NATIVE_SIM_NATIVE_64_TWO
|
||||||
|
help
|
||||||
|
This kconfig is promptless and is expected to be set through the
|
||||||
|
Kconfig.defconfig for the extended board.
|
||||||
|
|
||||||
|
config EXTENDED_VARIANT_BOARD_SETTING_DEFCONFIG
|
||||||
|
bool "Extended variant board test string defconfig"
|
||||||
|
depends on BOARD_NATIVE_SIM_NATIVE_ONE || BOARD_NATIVE_SIM_NATIVE_64_TWO
|
||||||
|
help
|
||||||
|
This kconfig is set when the extended variant board defconfig fragment
|
||||||
|
is supposed to be sourced, that is when oot variant defines 'extends:'
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Copyright (c) 2024 Nordic Semiconductor ASA
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
if BOARD_NATIVE_SIM_NATIVE_ONE
|
||||||
|
|
||||||
|
config EXTENDED_VARIANT_BOARD_ONE_SETTING_PROMPTLESS
|
||||||
|
default y
|
||||||
|
|
||||||
|
endif # BOARD_NATIVE_SIM_NATIVE_ONE
|
||||||
|
|
||||||
|
if BOARD_NATIVE_SIM_NATIVE_64_TWO
|
||||||
|
|
||||||
|
config EXTENDED_VARIANT_BOARD_TWO_SETTING_PROMPTLESS
|
||||||
|
default y
|
||||||
|
|
||||||
|
endif # BOARD_NATIVE_SIM_NATIVE_64_TWO
|
|
@ -0,0 +1,7 @@
|
||||||
|
board:
|
||||||
|
extend: native_sim
|
||||||
|
variants:
|
||||||
|
- name: one
|
||||||
|
qualifier: native
|
||||||
|
- name: two
|
||||||
|
qualifier: native/64
|
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Nordic Semiconductor ASA
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "native_sim_native_one.dts"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
/delete-node/ added-by-native-one;
|
||||||
|
|
||||||
|
added-by-native-two{
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,25 @@
|
||||||
|
identifier: native_sim_native_64_two
|
||||||
|
name: Native Simulation port - 32-bit
|
||||||
|
type: native
|
||||||
|
simulation: native
|
||||||
|
arch: posix
|
||||||
|
ram: 65536
|
||||||
|
flash: 65536
|
||||||
|
toolchain:
|
||||||
|
- host
|
||||||
|
- llvm
|
||||||
|
supported:
|
||||||
|
- can
|
||||||
|
- counter
|
||||||
|
- dma
|
||||||
|
- eeprom
|
||||||
|
- netif:eth
|
||||||
|
- usb_device
|
||||||
|
- adc
|
||||||
|
- i2c
|
||||||
|
- spi
|
||||||
|
- gpio
|
||||||
|
- rtc
|
||||||
|
testing:
|
||||||
|
default: true
|
||||||
|
vendor: zephyr
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Copyright (c) 2024 Nordic Semiconductor ASA
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
CONFIG_CONSOLE=y
|
||||||
|
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000
|
||||||
|
|
||||||
|
CONFIG_EXTENDED_VARIANT_BOARD_SETTING_DEFCONFIG=y
|
|
@ -0,0 +1,218 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 Jan Van Winkel (jan.van_winkel@dxplore.eu)
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/dts-v1/;
|
||||||
|
#include <posix/posix.dtsi>
|
||||||
|
#include <zephyr/dt-bindings/adc/adc.h>
|
||||||
|
#include <zephyr/dt-bindings/i2c/i2c.h>
|
||||||
|
#include <zephyr/dt-bindings/gpio/gpio.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "Native Sim Board";
|
||||||
|
compatible = "zephyr,posix";
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
zephyr,console = &uart0;
|
||||||
|
zephyr,shell-uart = &uart0;
|
||||||
|
zephyr,uart-mcumgr = &uart0;
|
||||||
|
zephyr,flash = &flash0;
|
||||||
|
zephyr,entropy = &rng;
|
||||||
|
zephyr,flash-controller = &flashcontroller0;
|
||||||
|
zephyr,display = &sdl_dc;
|
||||||
|
zephyr,canbus = &can_loopback0;
|
||||||
|
zephyr,code-partition = &slot0_partition;
|
||||||
|
};
|
||||||
|
|
||||||
|
aliases {
|
||||||
|
eeprom-0 = &eeprom0;
|
||||||
|
i2c-0 = &i2c0;
|
||||||
|
spi-0 = &spi0;
|
||||||
|
led0 = &led0;
|
||||||
|
rtc = &rtc;
|
||||||
|
};
|
||||||
|
|
||||||
|
leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
led0: led_0 {
|
||||||
|
gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
|
||||||
|
label = "Green LED";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lvgl_pointer {
|
||||||
|
compatible = "zephyr,lvgl-pointer-input";
|
||||||
|
input = <&input_sdl_touch>;
|
||||||
|
};
|
||||||
|
|
||||||
|
cpus {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
|
||||||
|
cpu0: cpu@0 {
|
||||||
|
compatible = "zephyr,native-posix-cpu";
|
||||||
|
reg = <0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
flashcontroller0: flash-controller@0 {
|
||||||
|
compatible = "zephyr,sim-flash";
|
||||||
|
reg = <0x00000000 DT_SIZE_K(2048)>;
|
||||||
|
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
erase-value = <0xff>;
|
||||||
|
|
||||||
|
flash0: flash@0 {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "soc-nv-flash";
|
||||||
|
erase-block-size = <4096>;
|
||||||
|
write-block-size = <1>;
|
||||||
|
reg = <0x00000000 DT_SIZE_K(2048)>;
|
||||||
|
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
boot_partition: partition@0 {
|
||||||
|
label = "mcuboot";
|
||||||
|
reg = <0x00000000 0x0000C000>;
|
||||||
|
};
|
||||||
|
slot0_partition: partition@c000 {
|
||||||
|
label = "image-0";
|
||||||
|
reg = <0x0000C000 0x00069000>;
|
||||||
|
};
|
||||||
|
slot1_partition: partition@75000 {
|
||||||
|
label = "image-1";
|
||||||
|
reg = <0x00075000 0x00069000>;
|
||||||
|
};
|
||||||
|
scratch_partition: partition@de000 {
|
||||||
|
label = "image-scratch";
|
||||||
|
reg = <0x000de000 0x0001e000>;
|
||||||
|
};
|
||||||
|
storage_partition: partition@fc000 {
|
||||||
|
label = "storage";
|
||||||
|
reg = <0x000fc000 0x00004000>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
eeprom0: eeprom {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "zephyr,sim-eeprom";
|
||||||
|
size = <DT_SIZE_K(32)>;
|
||||||
|
};
|
||||||
|
|
||||||
|
i2c0: i2c@100 {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "zephyr,i2c-emul-controller";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
reg = <0x100 4>;
|
||||||
|
};
|
||||||
|
|
||||||
|
spi0: spi@200 {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "zephyr,spi-emul-controller";
|
||||||
|
clock-frequency = <50000000>;
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
reg = <0x200 4>;
|
||||||
|
};
|
||||||
|
|
||||||
|
espi0: espi@300 {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "zephyr,espi-emul-controller";
|
||||||
|
reg = <0x300 4>;
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
};
|
||||||
|
|
||||||
|
uart0: uart {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "zephyr,native-posix-uart";
|
||||||
|
/* Dummy current-speed entry to comply with serial
|
||||||
|
* DTS binding
|
||||||
|
*/
|
||||||
|
current-speed = <0>;
|
||||||
|
};
|
||||||
|
|
||||||
|
uart1: uart_1 {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "zephyr,native-posix-uart";
|
||||||
|
/* Dummy current-speed entry to comply with serial
|
||||||
|
* DTS binding
|
||||||
|
*/
|
||||||
|
current-speed = <0>;
|
||||||
|
};
|
||||||
|
|
||||||
|
rng: rng {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "zephyr,native-posix-rng";
|
||||||
|
};
|
||||||
|
|
||||||
|
counter0: counter {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "zephyr,native-posix-counter";
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio0: gpio@800 {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "zephyr,gpio-emul";
|
||||||
|
reg = <0x800 0x4>;
|
||||||
|
rising-edge;
|
||||||
|
falling-edge;
|
||||||
|
high-level;
|
||||||
|
low-level;
|
||||||
|
gpio-controller;
|
||||||
|
#gpio-cells = <2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
zephyr_udc0: udc0 {
|
||||||
|
compatible = "zephyr,native-posix-udc";
|
||||||
|
};
|
||||||
|
|
||||||
|
sdl_dc: sdl_dc {
|
||||||
|
compatible = "zephyr,sdl-dc";
|
||||||
|
height = <240>;
|
||||||
|
width = <320>;
|
||||||
|
};
|
||||||
|
|
||||||
|
input_sdl_touch: input-sdl-touch {
|
||||||
|
compatible = "zephyr,input-sdl-touch";
|
||||||
|
};
|
||||||
|
|
||||||
|
can_loopback0: can_loopback0 {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "zephyr,can-loopback";
|
||||||
|
};
|
||||||
|
|
||||||
|
can0: can {
|
||||||
|
status = "disabled";
|
||||||
|
compatible = "zephyr,native-linux-can";
|
||||||
|
/* adjust zcan0 to desired host interface or create an alternative
|
||||||
|
* name, e.g.: sudo ip link property add dev vcan0 altname zcan0
|
||||||
|
*/
|
||||||
|
host-interface = "zcan0";
|
||||||
|
};
|
||||||
|
|
||||||
|
rtc: rtc {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "zephyr,rtc-emul";
|
||||||
|
alarms-count = <2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
dma: dma {
|
||||||
|
compatible = "zephyr,dma-emul";
|
||||||
|
#dma-cells = <1>;
|
||||||
|
stack-size = <4096>;
|
||||||
|
};
|
||||||
|
|
||||||
|
added-by-native-one {
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,25 @@
|
||||||
|
identifier: native_sim_native_one
|
||||||
|
name: Native Simulation port - 32-bit
|
||||||
|
type: native
|
||||||
|
simulation: native
|
||||||
|
arch: posix
|
||||||
|
ram: 65536
|
||||||
|
flash: 65536
|
||||||
|
toolchain:
|
||||||
|
- host
|
||||||
|
- llvm
|
||||||
|
supported:
|
||||||
|
- can
|
||||||
|
- counter
|
||||||
|
- dma
|
||||||
|
- eeprom
|
||||||
|
- netif:eth
|
||||||
|
- usb_device
|
||||||
|
- adc
|
||||||
|
- i2c
|
||||||
|
- spi
|
||||||
|
- gpio
|
||||||
|
- rtc
|
||||||
|
testing:
|
||||||
|
default: true
|
||||||
|
vendor: zephyr
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Copyright (c) 2024 Nordic Semiconductor ASA
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
CONFIG_CONSOLE=y
|
||||||
|
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000
|
||||||
|
|
||||||
|
CONFIG_EXTENDED_VARIANT_BOARD_SETTING_DEFCONFIG=y
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Copyright (c) 2024, Nordic Semiconductor ASA
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
config SOC_MPS2_AN521_CPUTEST
|
||||||
|
bool
|
||||||
|
select SOC_MPS2_AN521
|
4
tests/cmake/hwm/board_extend/oot_root/soc/arm/soc.yml
Normal file
4
tests/cmake/hwm/board_extend/oot_root/soc/arm/soc.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
socs:
|
||||||
|
- extend: an521
|
||||||
|
cpuclusters:
|
||||||
|
- name: cputest
|
1
tests/cmake/hwm/board_extend/prj.conf
Normal file
1
tests/cmake/hwm/board_extend/prj.conf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
CONFIG_ZTEST=y
|
85
tests/cmake/hwm/board_extend/src/main.c
Normal file
85
tests/cmake/hwm/board_extend/src/main.c
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Nordic Semiconductor ASA
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr/ztest.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXTENDED_VARIANT_BOARD_SETTING
|
||||||
|
#define EXTENDED_BOARD_A 1
|
||||||
|
#else
|
||||||
|
#define EXTENDED_BOARD_A 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXTENDED_VARIANT_BOARD_ONE_SETTING_PROMPTLESS
|
||||||
|
#define EXTENDED_BOARD_ONE_B 1
|
||||||
|
#else
|
||||||
|
#define EXTENDED_BOARD_ONE_B 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXTENDED_VARIANT_BOARD_TWO_SETTING_PROMPTLESS
|
||||||
|
#define EXTENDED_BOARD_TWO_C 1
|
||||||
|
#else
|
||||||
|
#define EXTENDED_BOARD_TWO_C 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXTENDED_VARIANT_BOARD_SETTING_DEFCONFIG
|
||||||
|
#define EXTENDED_BOARD_D 1
|
||||||
|
#else
|
||||||
|
#define EXTENDED_BOARD_D 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_BASE_BOARD_SETTING
|
||||||
|
#define BASE_BOARD_CONFIG 1
|
||||||
|
#else
|
||||||
|
#define BASE_BOARD_CONFIG 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SOC_MPS2_AN521_CPUTEST
|
||||||
|
#define EXTENDED_SOC 1
|
||||||
|
#else
|
||||||
|
#define EXTENDED_SOC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ZTEST_SUITE(soc_board_extend, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
#if CONFIG_BOARD_NATIVE_SIM
|
||||||
|
ZTEST(soc_board_extend, test_native_sim_extend)
|
||||||
|
{
|
||||||
|
#if CONFIG_BOARD_NATIVE_SIM_NATIVE_ONE
|
||||||
|
zassert_true(EXTENDED_BOARD_A, "Expected extended board to be set");
|
||||||
|
zassert_true(EXTENDED_BOARD_ONE_B, "Expected extended board to be set");
|
||||||
|
zassert_false(EXTENDED_BOARD_TWO_C, "Did not expect extended board two to be set");
|
||||||
|
zassert_true(EXTENDED_BOARD_D, "Expected extended board to be set");
|
||||||
|
zassert_false(BASE_BOARD_CONFIG, "Did not expect base board to be set");
|
||||||
|
zassert_true(DT_NODE_EXISTS(DT_PATH(added_by_native_one)));
|
||||||
|
zassert_false(DT_NODE_EXISTS(DT_PATH(added_by_native_two)));
|
||||||
|
zassert_false(DT_NODE_EXISTS(DT_PATH(adc)));
|
||||||
|
#elif CONFIG_BOARD_NATIVE_SIM_NATIVE_64_TWO
|
||||||
|
zassert_true(EXTENDED_BOARD_A, "Expected extended board to be set");
|
||||||
|
zassert_false(EXTENDED_BOARD_ONE_B, "Did not expect extended board one to be set");
|
||||||
|
zassert_true(EXTENDED_BOARD_TWO_C, "Expected extended board to be set");
|
||||||
|
zassert_true(EXTENDED_BOARD_D, "Expected extended board to be set");
|
||||||
|
zassert_false(BASE_BOARD_CONFIG, "Did not expect base board to be set");
|
||||||
|
zassert_false(DT_NODE_EXISTS(DT_PATH(added_by_native_one)));
|
||||||
|
zassert_true(DT_NODE_EXISTS(DT_PATH(added_by_native_two)));
|
||||||
|
zassert_false(DT_NODE_EXISTS(DT_PATH(adc)));
|
||||||
|
#else
|
||||||
|
zassert_true(false, "Did not expect to build for a base native_sim board");
|
||||||
|
#endif
|
||||||
|
#elif CONFIG_BOARD_MPS2
|
||||||
|
ZTEST(soc_board_extend, test_an521_soc_extend)
|
||||||
|
{
|
||||||
|
#if CONFIG_BOARD_MPS2_AN521_CPUTEST
|
||||||
|
zassert_true(EXTENDED_SOC, "Expected extended SoC to be set");
|
||||||
|
#elif CONFIG_BOARD_MPS2
|
||||||
|
zassert_true(false, "Did not expect to build for a base mps2 board");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
ZTEST(soc_board_extend, test_failure)
|
||||||
|
{
|
||||||
|
zassert_true(false, "Did not expect to build for a regular board");
|
||||||
|
#endif
|
||||||
|
}
|
33
tests/cmake/hwm/board_extend/testcase.yaml
Normal file
33
tests/cmake/hwm/board_extend/testcase.yaml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
common:
|
||||||
|
tags:
|
||||||
|
- cmake
|
||||||
|
tests:
|
||||||
|
cmake.board.extend_one:
|
||||||
|
extra_args:
|
||||||
|
# Twister can only lookup known board roots.
|
||||||
|
# Thus platform above is set to native_sim, while at this location
|
||||||
|
# we overrule with the native_sim/native/one board.
|
||||||
|
# Test will fail if we accidentially build for the base native_sim board.
|
||||||
|
- CACHED_BOARD=native_sim/native/one
|
||||||
|
platform_allow:
|
||||||
|
- native_sim
|
||||||
|
- native_sim/native/64
|
||||||
|
integration_platforms:
|
||||||
|
- native_sim
|
||||||
|
- native_sim/native/64
|
||||||
|
cmake.board.extend_two:
|
||||||
|
extra_args:
|
||||||
|
- CACHED_BOARD=native_sim/native/64/two
|
||||||
|
platform_allow:
|
||||||
|
- native_sim
|
||||||
|
- native_sim/native/64
|
||||||
|
integration_platforms:
|
||||||
|
- native_sim
|
||||||
|
- native_sim/native/64
|
||||||
|
cmake.soc.extend_cputest:
|
||||||
|
extra_args:
|
||||||
|
- CACHED_BOARD=mps2/an521/cputest
|
||||||
|
platform_allow:
|
||||||
|
- mps2/an521/cpu0
|
||||||
|
integration_platforms:
|
||||||
|
- mps2/an521/cpu0
|
Loading…
Add table
Add a link
Reference in a new issue