File tree Expand file tree Collapse file tree 4 files changed +60
-0
lines changed
tests/boards/native_sim/reset_hw_info Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Copyright (c) 2025 Nordic Semiconductor ASA
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ cmake_minimum_required (VERSION 3.20.0)
5
+ find_package (Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} )
6
+ project (native_reset_hw_info)
7
+
8
+ FILE (GLOB app_sources src/*.c)
9
+ target_sources (app PRIVATE ${app_sources} )
Original file line number Diff line number Diff line change
1
+ # Copyright (c) 2025 Nordic Semiconductor ASA
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ CONFIG_REBOOT=y
5
+ CONFIG_NATIVE_SIM_REBOOT=y
6
+ CONFIG_HWINFO=y
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2025 Nordic Semiconductor ASA
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ #include <stdio.h>
8
+ #include <zephyr/drivers/hwinfo.h>
9
+ #include <zephyr/sys/reboot.h>
10
+ #include <nsi_main.h>
11
+
12
+ int main (void )
13
+ {
14
+ uint32_t cause ;
15
+ int err ;
16
+
17
+ err = hwinfo_get_reset_cause (& cause );
18
+ if (err != 0 ) {
19
+ posix_print_error_and_exit ("hwinfo_get_reset_cause() failed %i\n" , err );
20
+ }
21
+
22
+ if (cause == RESET_POR ) {
23
+ printf ("This seems like the first start => Resetting\n" );
24
+ sys_reboot (SYS_REBOOT_WARM );
25
+ } else if (cause == RESET_SOFTWARE ) {
26
+ printf ("Booted after SOFTWARE reset => we are done\n" );
27
+ }
28
+ nsi_exit (0 );
29
+ }
Original file line number Diff line number Diff line change
1
+ tests :
2
+ boards.native_sim.reset_hw_info :
3
+ platform_allow :
4
+ - native_sim
5
+ - native_sim/native/64
6
+ integration_platforms :
7
+ - native_sim
8
+ harness : console
9
+ harness_config :
10
+ type : multi_line
11
+ ordered : true
12
+ regex :
13
+ - " (.*)Booting Zephyr OS build(.*)"
14
+ - " This seems like the first start => Resetting"
15
+ - " (.*)Booting Zephyr OS build(.*)"
16
+ - " Booted after SOFTWARE reset => we are done"
You can’t perform that action at this time.
0 commit comments