diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 9571d374a32..79ca4249792 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -571,14 +571,6 @@ config BOOTLOADER_BOSSA_ADAFRUIT_UF2 endchoice -config REBOOT - bool "Reboot functionality" - select SYSTEM_CLOCK_DISABLE - help - Enable the sys_reboot() API. Enabling this can drag in other subsystems - needed to perform a "safe" reboot (e.g. SYSTEM_CLOCK_DISABLE, to stop the - system clock before issuing a reset). - config MISRA_SANE bool "MISRA standards compliance features" help diff --git a/arch/arm/core/aarch32/nmi.c b/arch/arm/core/aarch32/nmi.c index 34741e9bc92..45e51a54cb1 100644 --- a/arch/arm/core/aarch32/nmi.c +++ b/arch/arm/core/aarch32/nmi.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include diff --git a/arch/x86/core/reboot_rst_cnt.c b/arch/x86/core/reboot_rst_cnt.c index 1de24fbb348..e6dc91ce222 100644 --- a/arch/x86/core/reboot_rst_cnt.c +++ b/arch/x86/core/reboot_rst_cnt.c @@ -11,7 +11,7 @@ */ #include -#include +#include /* reboot through Reset Control Register (I/O port 0xcf9) */ diff --git a/doc/reference/settings/index.rst b/doc/reference/settings/index.rst index 0f7ed6257e3..6871bf3c854 100644 --- a/doc/reference/settings/index.rst +++ b/doc/reference/settings/index.rst @@ -207,7 +207,7 @@ up from where it was before restart. .. code-block:: c #include - #include + #include #include #include #include diff --git a/drivers/watchdog/wdt_cmsdk_apb.c b/drivers/watchdog/wdt_cmsdk_apb.c index 2324d94ea81..8351014cc9e 100644 --- a/drivers/watchdog/wdt_cmsdk_apb.c +++ b/drivers/watchdog/wdt_cmsdk_apb.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include struct wdog_cmsdk_apb { /* offset: 0x000 (r/w) watchdog load register */ diff --git a/include/power/reboot.h b/include/sys/reboot.h similarity index 76% rename from include/power/reboot.h rename to include/sys/reboot.h index 84e25353068..5e9aef79efb 100644 --- a/include/power/reboot.h +++ b/include/sys/reboot.h @@ -8,11 +8,11 @@ * @file * @brief Common target reboot functionality * - * @details See misc/Kconfig and the reboot help for details. + * @details See subsys/os/Kconfig and the reboot help for details. */ -#ifndef ZEPHYR_INCLUDE_POWER_REBOOT_H_ -#define ZEPHYR_INCLUDE_POWER_REBOOT_H_ +#ifndef ZEPHYR_INCLUDE_SYS_REBOOT_H_ +#define ZEPHYR_INCLUDE_SYS_REBOOT_H_ #ifdef __cplusplus extern "C" { @@ -39,4 +39,4 @@ extern void sys_reboot(int type); } #endif -#endif /* ZEPHYR_INCLUDE_POWER_REBOOT_H_ */ +#endif /* ZEPHYR_INCLUDE_SYS_REBOOT_H_ */ diff --git a/lib/os/CMakeLists.txt b/lib/os/CMakeLists.txt index dcd7b4930fd..5e460cbbb44 100644 --- a/lib/os/CMakeLists.txt +++ b/lib/os/CMakeLists.txt @@ -39,6 +39,8 @@ zephyr_sources_ifdef(CONFIG_MPSC_PBUF mpsc_pbuf.c) zephyr_sources_ifdef(CONFIG_SCHED_DEADLINE p4wq.c) +zephyr_sources_ifdef(CONFIG_REBOOT reboot.c) + zephyr_library_include_directories( ${ZEPHYR_BASE}/kernel/include ${ZEPHYR_BASE}/arch/${ARCH}/include diff --git a/lib/os/Kconfig b/lib/os/Kconfig index 481bd47bc7a..50d8f1a0b52 100644 --- a/lib/os/Kconfig +++ b/lib/os/Kconfig @@ -75,6 +75,14 @@ config MPSC_CLEAR_ALLOCATED When enabled packet space is zeroed before returning from allocation. endif +config REBOOT + bool "Reboot functionality" + select SYSTEM_CLOCK_DISABLE + help + Enable the sys_reboot() API. Enabling this can drag in other subsystems + needed to perform a "safe" reboot (e.g. SYSTEM_CLOCK_DISABLE, to stop the + system clock before issuing a reset). + rsource "Kconfig.cbprintf" endmenu diff --git a/subsys/power/reboot.c b/lib/os/reboot.c similarity index 96% rename from subsys/power/reboot.c rename to lib/os/reboot.c index 805cf79184b..5ebf9e6ba48 100644 --- a/subsys/power/reboot.c +++ b/lib/os/reboot.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include extern void sys_arch_reboot(int type); extern void sys_clock_disable(void); diff --git a/samples/subsys/canbus/canopen/src/main.c b/samples/subsys/canbus/canopen/src/main.c index 4847265c611..8f5cf6688e2 100644 --- a/samples/subsys/canbus/canopen/src/main.c +++ b/samples/subsys/canbus/canopen/src/main.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include diff --git a/samples/subsys/nvs/src/main.c b/samples/subsys/nvs/src/main.c index 2b098e41f69..100079b1185 100644 --- a/samples/subsys/nvs/src/main.c +++ b/samples/subsys/nvs/src/main.c @@ -39,7 +39,7 @@ #include -#include +#include #include #include #include diff --git a/samples/subsys/task_wdt/src/main.c b/samples/subsys/task_wdt/src/main.c index 4b2dea92968..ac7338e37da 100644 --- a/samples/subsys/task_wdt/src/main.c +++ b/samples/subsys/task_wdt/src/main.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/subsys/mgmt/hawkbit/hawkbit.c b/subsys/mgmt/hawkbit/hawkbit.c index 92f6d5ed863..771add8e93c 100644 --- a/subsys/mgmt/hawkbit/hawkbit.c +++ b/subsys/mgmt/hawkbit/hawkbit.c @@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(hawkbit); #include #include #include -#include +#include #include #include #include diff --git a/subsys/mgmt/hawkbit/shell.c b/subsys/mgmt/hawkbit/shell.c index 2a502a0e734..2d4c7d509c8 100644 --- a/subsys/mgmt/hawkbit/shell.c +++ b/subsys/mgmt/hawkbit/shell.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include "mgmt/hawkbit.h" #include "hawkbit_firmware.h" #include "hawkbit_device.h" diff --git a/subsys/mgmt/updatehub/updatehub.c b/subsys/mgmt/updatehub/updatehub.c index 2eb7b13d22a..666b4823d6a 100644 --- a/subsys/mgmt/updatehub/updatehub.c +++ b/subsys/mgmt/updatehub/updatehub.c @@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(updatehub, CONFIG_UPDATEHUB_LOG_LEVEL); #include #include #include -#include +#include #include #include #include diff --git a/subsys/net/lib/openthread/platform/misc.c b/subsys/net/lib/openthread/platform/misc.c index b940c999413..a8b4f7d1415 100644 --- a/subsys/net/lib/openthread/platform/misc.c +++ b/subsys/net/lib/openthread/platform/misc.c @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include diff --git a/subsys/power/CMakeLists.txt b/subsys/power/CMakeLists.txt index ba02f41218e..6dc9fc8a6df 100644 --- a/subsys/power/CMakeLists.txt +++ b/subsys/power/CMakeLists.txt @@ -4,5 +4,4 @@ zephyr_sources_ifdef(CONFIG_PM power.c) zephyr_sources_ifdef(CONFIG_PM pm_ctrl.c) zephyr_sources_ifdef(CONFIG_PM_DEVICE device.c) zephyr_sources_ifdef(CONFIG_PM_DEVICE_IDLE device_pm.c) -zephyr_sources_ifdef(CONFIG_REBOOT reboot.c) add_subdirectory(policy) diff --git a/subsys/shell/modules/kernel_service.c b/subsys/shell/modules/kernel_service.c index 8b00556edf5..f21b63e6b78 100644 --- a/subsys/shell/modules/kernel_service.c +++ b/subsys/shell/modules/kernel_service.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/subsys/task_wdt/task_wdt.c b/subsys/task_wdt/task_wdt.c index 9daa7e4f69c..d21086376a0 100644 --- a/subsys/task_wdt/task_wdt.c +++ b/subsys/task_wdt/task_wdt.c @@ -7,7 +7,7 @@ #include "task_wdt/task_wdt.h" #include -#include +#include #include #include diff --git a/subsys/testsuite/ztest/src/ztest.c b/subsys/testsuite/ztest/src/ztest.c index 4013ba733d7..e884bf6c528 100644 --- a/subsys/testsuite/ztest/src/ztest.c +++ b/subsys/testsuite/ztest/src/ztest.c @@ -10,7 +10,7 @@ #ifdef CONFIG_USERSPACE #include #endif -#include +#include #ifdef KERNEL static struct k_thread ztest_thread; diff --git a/tests/arch/arm/arm_runtime_nmi/src/arm_runtime_nmi.c b/tests/arch/arm/arm_runtime_nmi/src/arm_runtime_nmi.c index 8ac2faead7d..feffb0f10d3 100644 --- a/tests/arch/arm/arm_runtime_nmi/src/arm_runtime_nmi.c +++ b/tests/arch/arm/arm_runtime_nmi/src/arm_runtime_nmi.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include diff --git a/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c b/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c index 5a139e2e8ee..025f9e58c38 100644 --- a/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c +++ b/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include