K-FSW v1.2.1-59-gcaca356
KFSW: modular flight software on Zephyr, for small satellites
Loading...
Searching...
No Matches

Public Headers

file  boot.h
 

Data Structures

struct  kfsw_boot_diagnostics
 

Macros

#define KFSW_BOOT_IMAGE_ID_SIZE   32U
 
#define KFSW_BOOT_PARAM_TABLE_ID   32U
 
#define KFSW_BOOT_PARAM_TABLE_NAME   "boot"
 

Enumerations

enum  kfsw_boot_revert_reason { KFSW_BOOT_REVERT_NONE = 0 , KFSW_BOOT_REVERT_UNCONFIRMED_REPLACED = 1 , KFSW_BOOT_REVERT_REPLACED_UNKNOWN = 2 }
 
enum  kfsw_event_boot_id { KFSW_EVENT_BOOT_READY = 1 , KFSW_EVENT_BOOT_LASTWORDS = 2 }
 

Functions

void kfsw_boot_get_diagnostics (struct kfsw_boot_diagnostics *value)
 
int kfsw_boot_diagnostics_start (void)
 
int kfsw_boot_record_image (const uint8_t image[KFSW_BOOT_IMAGE_ID_SIZE], bool confirmed, bool revert_pending)
 
int kfsw_boot_confirm_image (void)
 
void kfsw_boot_service_start (void)
 
uint32_t kfsw_boot_get_reset_cause (void)
 
const char * kfsw_boot_get_image_version (void)
 
const char * kfsw_boot_get_revisions (void)
 
const char * kfsw_boot_get_hardware_id (void)
 
void kfsw_boot_count_restart (void)
 
uint32_t kfsw_boot_get_count (void)
 

Variables

const struct kfsw_param_definition_set kfsw_boot_param_definitions
 

Description

Boot and readiness markers.

Macro Documentation

◆ KFSW_BOOT_IMAGE_ID_SIZE

#define KFSW_BOOT_IMAGE_ID_SIZE   32U

#include <boot.h>

SHA256 identity of the signed running image.

◆ KFSW_BOOT_PARAM_TABLE_ID

#define KFSW_BOOT_PARAM_TABLE_ID   32U

#include <boot.h>

Parameter table of this service, in the service band.

◆ KFSW_BOOT_PARAM_TABLE_NAME

#define KFSW_BOOT_PARAM_TABLE_NAME   "boot"

#include <boot.h>

Parameter table name.

Enumeration Documentation

◆ kfsw_boot_revert_reason

#include <boot.h>

Cause established by the service, not a bootloader verdict.

Enumerator
KFSW_BOOT_REVERT_UNCONFIRMED_REPLACED 

An unconfirmed image with revert pending was replaced.

KFSW_BOOT_REVERT_REPLACED_UNKNOWN 

An unconfirmed image was replaced without an observed pending revert.

◆ kfsw_event_boot_id

#include <boot.h>

Event IDs of the boot service.

IDs are never reused.

Enumerator
KFSW_EVENT_BOOT_READY 

Startup finished.

Payload: reset cause big-endian u32, then a byte that is non-zero when the cause could not be read.

KFSW_EVENT_BOOT_LASTWORDS 

The previous run left a note.

Payload: reason byte, then detail, uptime in milliseconds and boot count, each a big-endian u32.

Function Documentation

◆ kfsw_boot_confirm_image()

int kfsw_boot_confirm_image ( void  )

#include <boot.h>

Confirm the running image and update trial diagnostics.

Never refill the budget.

◆ kfsw_boot_count_restart()

void kfsw_boot_count_restart ( void  )

#include <boot.h>

Count a restart.

Called after the snapshot is restored, so the count continues from the saved value. The count saturates.

◆ kfsw_boot_diagnostics_start()

int kfsw_boot_diagnostics_start ( void  )

#include <boot.h>

Record one startup after storage mount, before starting other services.

◆ kfsw_boot_get_count()

uint32_t kfsw_boot_get_count ( void  )

#include <boot.h>

Restarts recorded across the life of the node.

◆ kfsw_boot_get_diagnostics()

void kfsw_boot_get_diagnostics ( struct kfsw_boot_diagnostics *  value)

#include <boot.h>

Copy the diagnostics, including their validity indication.

◆ kfsw_boot_get_hardware_id()

const char * kfsw_boot_get_hardware_id ( void  )

#include <boot.h>

The chip's unique ID, read at boot.

Never NULL; empty when the SoC has none.

◆ kfsw_boot_get_image_version()

const char * kfsw_boot_get_image_version ( void  )

#include <boot.h>

Version of the running image, from the build.

◆ kfsw_boot_get_reset_cause()

uint32_t kfsw_boot_get_reset_cause ( void  )

#include <boot.h>

Reset cause latched at boot.

Zero before the service has run.

◆ kfsw_boot_get_revisions()

const char * kfsw_boot_get_revisions ( void  )

#include <boot.h>

Short revision of every repository compiled into this image.

Formatted as app:<sha> plat:<sha> svc:<sha> comms:<sha> mod:<sha>, with a trailing + on a repository that had uncommitted changes when it was built. The image version identifies only k-fsw; this string also identifies its dependencies.

◆ kfsw_boot_record_image()

int kfsw_boot_record_image ( const uint8_t  image[KFSW_BOOT_IMAGE_ID_SIZE],
bool  confirmed,
bool  revert_pending 
)

#include <boot.h>

Record an observed image boot in the existing persistent filesystem.

Parameters
imageSHA256 image identity.
confirmedWhether the running image is confirmed.
revert_pendingWhether MCUboot currently schedules a revert. A record that fails its checks (-EBADMSG: size, magic, field range or CRC) is renamed to boot-trial.bad, replacing the previous rejected record, before a fresh KBT1 record starts. An open or read error keeps the record and fails. An unconfirmed image starts at attempt one; a confirmed image starts at zero.
Returns
0 after an atomic save, including after quarantine. If quarantine fails, the original load error is returned and the rejected record is kept. Other failures return negative errno. Diagnostics are invalid on failure.

◆ kfsw_boot_service_start()

void kfsw_boot_service_start ( void  )

#include <boot.h>

Emit the boot and readiness markers.

Variable Documentation

◆ kfsw_boot_param_definitions

const struct kfsw_param_definition_set kfsw_boot_param_definitions
extern

#include <boot.h>

Image identity and last reset reason.