From 6e55a2050ed531848a2d451ed93b9606763aeb22 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Mon, 26 May 2025 17:12:01 +0200 Subject: [PATCH] sys/riotboot/slot: add riotboot_slot_get_current_hdr() --- sys/include/riotboot/slot.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/include/riotboot/slot.h b/sys/include/riotboot/slot.h index f5cdb9c631..2f0ff116c7 100644 --- a/sys/include/riotboot/slot.h +++ b/sys/include/riotboot/slot.h @@ -71,6 +71,20 @@ void riotboot_slot_jump(unsigned slot); */ const riotboot_hdr_t *riotboot_slot_get_hdr(unsigned slot); +/** + * @brief Get header from currently running image slot + * + * @returns header of current image + */ +static inline const riotboot_hdr_t *riotboot_slot_get_current_hdr(void) +{ + int slot = riotboot_slot_current(); + if (slot < 0) { + return NULL; + } + return riotboot_slot_get_hdr(slot); +} + /** * @brief Validate slot *