Skip to content

os reset: add boot_mode (enter MCUboot serial recovery) #100

Description

@JPHutchins

Summary

smpmgr os reset should expose the MCUmgr boot_mode field so a client can ask the device to reboot into the bootloader (MCUboot serial recovery), not just into the application.

Background

The MCUmgr OS-management reset command accepts an optional boot_mode field, gated by Zephyr's CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE (which depends on CONFIG_RETENTION_BOOT_MODE). When set to 1 (BOOT_MODE_TYPE_BOOTLOADER), the server writes the retained boot mode and resets; an MCUboot built with CONFIG_BOOT_SERIAL_BOOT_MODE reads the flag on the next boot and stays in its serial-recovery SMP server.

  • Zephyr handler: subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c decodes a boot_mode key in the reset request.
  • Zephyr Kconfig: MCUMGR_GRP_OS_RESET_BOOT_MODE (subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig).

Request

Add an option to smpmgr os reset, e.g.:

smpmgr os reset --boot-mode bootloader   # or: --boot-mode 1

so the reset request carries boot_mode.

Note on the dependency chain

This likely spans the stack:

  • smp (v4.0.0): smp.os_management.ResetWriteRequest currently models only the force field — boot_mode would need to be added there first.
  • smpclient: surface the field on its reset call.
  • smpmgr: expose the CLI flag.

Use case

intercreate/smp-server-fixtures is building a single "do-it-all" emulated (mps2 / QEMU) test fixture: an MCUboot RAM_LOAD image whose running application exposes every MCUmgr command group, and which can be told to reboot into serial recovery via os reset boot_mode=1. That lets one image exercise all groups, DFU, and the bootloader's recovery path from a single connection. Driving recovery entry from integration tests / the CLI needs this field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions