Skip to content

Commit f390913

Browse files
nordicjmkartben
authored andcommitted
mgmt: mcumgr: grp: os_mgmt: Support reboot without multithreading
Adds support for the OS mgmt reboot command when multithreading is disabled Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
1 parent e250838 commit f390913

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@ if REBOOT
2525
config MCUMGR_GRP_OS_RESET_MS
2626
int "Delay before executing reset command (ms)"
2727
default 250
28-
depends on REBOOT
28+
depends on MULTITHREADING
2929
help
3030
When a reset command is received, the system waits this many milliseconds
3131
before performing the reset. This delay allows time for the MCUmgr
3232
response to be delivered.
3333

3434
config MCUMGR_GRP_OS_RESET_HOOK
3535
bool "Reset hook"
36-
depends on REBOOT
3736
depends on MCUMGR_MGMT_NOTIFICATION_HOOKS
3837
help
3938
Allows applications to control and get notifications of when a reset

subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
LOG_MODULE_REGISTER(mcumgr_os_grp, CONFIG_MCUMGR_GRP_OS_LOG_LEVEL);
5959

60-
#ifdef CONFIG_REBOOT
60+
#if defined(CONFIG_REBOOT) && defined(CONFIG_MULTITHREADING)
6161
static void os_mgmt_reset_work_handler(struct k_work *work);
6262

6363
K_WORK_DELAYABLE_DEFINE(os_mgmt_reset_work, os_mgmt_reset_work_handler);
@@ -354,12 +354,14 @@ static int os_mgmt_taskstat_read(struct smp_streamer *ctxt)
354354
/**
355355
* Command handler: os reset
356356
*/
357+
#ifdef CONFIG_MULTITHREADING
357358
static void os_mgmt_reset_work_handler(struct k_work *work)
358359
{
359360
ARG_UNUSED(work);
360361

361362
sys_reboot(SYS_REBOOT_WARM);
362363
}
364+
#endif
363365

364366
static int os_mgmt_reset(struct smp_streamer *ctxt)
365367
{
@@ -398,8 +400,12 @@ static int os_mgmt_reset(struct smp_streamer *ctxt)
398400
}
399401
#endif
400402

403+
#ifdef CONFIG_MULTITHREADING
401404
/* Reboot the system from the system workqueue thread. */
402405
k_work_schedule(&os_mgmt_reset_work, K_MSEC(CONFIG_MCUMGR_GRP_OS_RESET_MS));
406+
#else
407+
sys_reboot(SYS_REBOOT_WARM);
408+
#endif
403409

404410
return 0;
405411
}

0 commit comments

Comments
 (0)