Skip to content

Commit

Permalink
Merge pull request #20244 from benpicco/sys/shell/cmds-version
Browse files Browse the repository at this point in the history
sys/shell: add firmware version to version cmd
  • Loading branch information
benpicco authored Jan 11, 2024
2 parents 714958a + 235d3f0 commit 0c80553
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions boards/samd20-xpro/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart

FEATURES_PROVIDED += riotboot
1 change: 1 addition & 0 deletions boards/samd21-xpro/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ FEATURES_PROVIDED += periph_usbdev

# Put other features for this board (in alphabetical order)
FEATURES_PROVIDED += tinyusb_device
FEATURES_PROVIDED += riotboot
11 changes: 11 additions & 0 deletions sys/shell/cmds/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
#ifdef MODULE_USB_BOARD_RESET
#include "usb_board_reset.h"
#endif
#ifdef MODULE_RIOTBOOT_SLOT
#include "riotboot/slot.h"
#endif

static int _reboot_handler(int argc, char **argv)
{
Expand Down Expand Up @@ -60,6 +63,14 @@ static int _version_handler(int argc, char **argv)

puts(RIOT_VERSION);

#ifdef MODULE_RIOTBOOT_SLOT
int slot = riotboot_slot_current();
if (slot >= 0) {
const riotboot_hdr_t *hdr = riotboot_slot_get_hdr(slot);
printf("%s v%"PRIu32", slot %u\n", RIOT_APPLICATION, hdr->version, slot);
}
#endif

return 0;
}

Expand Down

0 comments on commit 0c80553

Please sign in to comment.