Skip to content

Commit 93b5546

Browse files
committed
samples: spm: Remove deleted console configs
Rely on DT instead. Signed-off-by: Robert Lubos <[email protected]>
1 parent 3559a89 commit 93b5546

File tree

8 files changed

+44
-38
lines changed

8 files changed

+44
-38
lines changed

samples/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ if (CONFIG_SPM)
2424
spm
2525
${NRF_DIR}/samples/spm/spm_ns_handler_from_spm_fault.conf
2626
)
27+
28+
add_overlay_dts(
29+
mcuboot
30+
${NRF_DIR}/samples/spm/spm_uart.overlay
31+
)
2732
endif()
2833

2934
if (CONFIG_BOARD_ENABLE_CPUNET)

samples/spm/boards/nrf5340dk_nrf5340_cpuapp.overlay

Lines changed: 0 additions & 11 deletions
This file was deleted.

samples/spm/boards/thingy91_nrf9160.overlay

Lines changed: 0 additions & 11 deletions
This file was deleted.

samples/spm/nrf9160dk_nrf9160.overlay

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,3 @@
1010
&pwm3 {
1111
status = "okay";
1212
};
13-
14-
&uart0 {
15-
status = "okay";
16-
17-
spm_uart: nrf-spm-uart {
18-
compatible = "nordic,nrf-spm-uart";
19-
status = "okay";
20-
label = "SPM_UART";
21-
};
22-
};

samples/spm/sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ tests:
1616
- nrf5340dk_nrf5340_cpuapp
1717
- nrf9160dk_nrf9160
1818
tags: ci_build
19+
extra_args: DTC_OVERLAY_FILE="spm_uart.overlay"
1920
extra_configs:
2021
- CONFIG_SPM_SHARE_CONSOLE_UART=y
21-
- CONFIG_UART_CONSOLE_ON_DEV_NAME="SPM_UART"

samples/spm/spm_ns_handler_from_spm_fault.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
# When enabled, spm can print to UARTE0 even after switching to non-secure, e.g.
1111
# from secure fault handler.
1212
CONFIG_SPM_SHARE_CONSOLE_UART=y
13-
CONFIG_UART_CONSOLE_ON_DEV_NAME="SPM_UART"
1413

1514
# When enabled, spm, in fault handler, will call non-secure fatal error handler.
1615
CONFIG_SPM_SERVICE_NS_HANDLER_FROM_SPM_FAULT=y

samples/spm/spm_uart.overlay

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */
2+
3+
/ {
4+
chosen {
5+
zephyr,console = &spm_uart;
6+
};
7+
};
8+
9+
&uart0 {
10+
status = "okay";
11+
12+
spm_uart: nrf-spm-uart {
13+
compatible = "nordic,nrf-spm-uart";
14+
status = "okay";
15+
label = "SPM_UART";
16+
};
17+
};
18+
19+
/* This is a workaround for a problem that it's not possible to merge
20+
* board-specific and DTC_OVERLAY_FILE defined overlays. Originally PWM was
21+
* only enabled for nrf9160dk_nrf9160, but since enabling it only for that board
22+
* would make spm_uart overlay selection problematic.
23+
*/
24+
&pwm1 {
25+
status = "okay";
26+
};
27+
28+
&pwm2 {
29+
status = "okay";
30+
};
31+
32+
&pwm3 {
33+
status = "okay";
34+
};

subsys/spm/spm_uart.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static int spm_uart_init(const struct device *dev)
6565
return 0;
6666
}
6767

68-
DEVICE_DEFINE(spm_uart, DT_PROP(DT_NODELABEL(spm_uart), label), spm_uart_init,
69-
NULL, NULL, &spm_uart_config,
70-
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
71-
&spm_uart_api);
68+
DEVICE_DT_DEFINE(DT_NODELABEL(spm_uart), spm_uart_init,
69+
NULL, NULL, &spm_uart_config,
70+
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
71+
&spm_uart_api);

0 commit comments

Comments
 (0)