1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #20523 from MrKevinWeiss/pr/guard_shell_pm

core|sys: Guard periph_pm calls
This commit is contained in:
Marian Buschsieweke 2024-04-09 12:04:12 +00:00 committed by GitHub
commit 93b05d5dc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 1 deletions

View File

@ -81,7 +81,7 @@ static void *main_trampoline(void *arg)
}
#endif
if (IS_ACTIVE(CONFIG_CORE_EXIT_WITH_MAIN)) {
if (IS_ACTIVE(CONFIG_CORE_EXIT_WITH_MAIN) && IS_USED(MODULE_PERIPH_PM)) {
pm_off();
}

View File

@ -183,7 +183,9 @@ __attribute__((used)) void _fini(void)
__attribute__((used)) void _exit(int n)
{
LOG_INFO("#! exit %i: powering off\n", n);
#ifdef MODULE_PERIPH_PM
pm_off();
#endif
while (1) {}
}

View File

@ -117,7 +117,9 @@ void __attribute__((__noreturn__))
_exit(int n)
{
LOG_INFO("#! exit %i: powering off\n", n);
#ifdef MODULE_PERIPH_PM
pm_off();
#endif /* MODULE_PERIPH_PM */
for (;;) {
}
}

View File

@ -30,6 +30,7 @@
#include "riotboot/slot.h"
#endif
#ifdef MODULE_PERIPH_PM
static int _reboot_handler(int argc, char **argv)
{
(void) argc;
@ -41,6 +42,7 @@ static int _reboot_handler(int argc, char **argv)
}
SHELL_COMMAND(reboot, "Reboot the node", _reboot_handler);
#endif /* MODULE_PERIPH_PM */
#ifdef MODULE_USB_BOARD_RESET
static int _bootloader_handler(int argc, char **argv)