Slot management tools. More...

Detailed Description

Slot management tools.

Author
Kaspar Schleiser kaspa.nosp@m.r@sc.nosp@m.hleis.nosp@m.er.d.nosp@m.e
Francisco Acosta franc.nosp@m.isco.nosp@m..acos.nosp@m.ta@i.nosp@m.nria..nosp@m.fr

Definition in file slot.h.

#include <stddef.h>
#include "riotboot/hdr.h"
+ Include dependency graph for slot.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int riotboot_slot_current (void)
 Get currently running image slot. More...
 
int riotboot_slot_other (void)
 Get currently not running image slot. More...
 
uint32_t riotboot_slot_get_image_startaddr (unsigned slot)
 Get jump-to address of image slot. More...
 
void riotboot_slot_jump (unsigned slot)
 Boot into image in slot slot. More...
 
const riotboot_hdr_triotboot_slot_get_hdr (unsigned slot)
 Get header from a given flash slot. More...
 
static const riotboot_hdr_triotboot_slot_get_current_hdr (void)
 Get header from currently running image slot. More...
 
static int riotboot_slot_validate (unsigned slot)
 Validate slot. More...
 
static void riotboot_slot_print_hdr (unsigned slot)
 Print formatted slot header to STDIO. More...
 
size_t riotboot_slot_offset (unsigned slot)
 Get the offset (in flash, in bytes) for a given slot.
 
void riotboot_slot_dump_addrs (void)
 Dump the addresses of all configured slots.
 
void riotboot_slot_confirm (void)
 Confirm the currently running image slot. More...
 
void riotboot_slot_activate_other (bool active)
 Activate or deactivate the other slot. More...
 
static size_t riotboot_slot_size (unsigned slot)
 Get the size of a slot. More...
 

Variables

const unsigned riotboot_slot_numof
 Number of configured firmware slots (incl. More...
 
const riotboot_hdr_t *const riotboot_slots []
 Storage for header pointers of the configured slots.
 

Function Documentation

◆ riotboot_slot_activate_other()

void riotboot_slot_activate_other ( bool  active)

Activate or deactivate the other slot.

This function sets the image state to ACTIVATED or DEACTIVATED in the header of the non-running image slot.

A deactivated slot can be activated but an activated slot cannot be deactivated.

Parameters
[in]activeif true, set to ACTIVATED, else set to INACTIVE

◆ riotboot_slot_confirm()

void riotboot_slot_confirm ( void  )

Confirm the currently running image slot.

This function sets the image state to CONFIRMED in the header of the currently running image, if it is in ACTIVATED state. It must be called manually if not module riotboot_hdr_auto_confirm is used.

◆ riotboot_slot_current()

int riotboot_slot_current ( void  )

Get currently running image slot.

Returns
nr of currently active slot

◆ riotboot_slot_get_current_hdr()

static const riotboot_hdr_t* riotboot_slot_get_current_hdr ( void  )
inlinestatic

Get header from currently running image slot.

Returns
header of current image

Definition at line 79 of file slot.h.

◆ riotboot_slot_get_hdr()

const riotboot_hdr_t* riotboot_slot_get_hdr ( unsigned  slot)

Get header from a given flash slot.

Parameters
[in]slotslot nr to work on
Returns
header of image slot nr slot

◆ riotboot_slot_get_image_startaddr()

uint32_t riotboot_slot_get_image_startaddr ( unsigned  slot)

Get jump-to address of image slot.

Parameters
[in]slotslot nr to work on
Returns
address of first byte of slot

◆ riotboot_slot_jump()

void riotboot_slot_jump ( unsigned  slot)

Boot into image in slot slot.

Parameters
[in]slotslot nr to jump to

◆ riotboot_slot_other()

int riotboot_slot_other ( void  )

Get currently not running image slot.

Returns
nr of currently inactive slot

◆ riotboot_slot_print_hdr()

static void riotboot_slot_print_hdr ( unsigned  slot)
inlinestatic

Print formatted slot header to STDIO.

Parameters
[in]slotslot nr to work on

Definition at line 106 of file slot.h.

◆ riotboot_slot_size()

static size_t riotboot_slot_size ( unsigned  slot)
inlinestatic

Get the size of a slot.

Parameters
[in]slotslot nr to get the size from
Returns
The slot size in bytes

Definition at line 150 of file slot.h.

◆ riotboot_slot_validate()

static int riotboot_slot_validate ( unsigned  slot)
inlinestatic

Validate slot.

Parameters
[in]slotslot nr to work on
Returns
0 if ok.

Definition at line 95 of file slot.h.

Variable Documentation

◆ riotboot_slot_numof

const unsigned riotboot_slot_numof
extern

Number of configured firmware slots (incl.

bootloader slot)