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

Data Structures

struct  kfsw_fwu_lite_message
 

Macros

#define KFSW_FWU_LITE_VERSION   1U
 
#define KFSW_FWU_LITE_REQUEST   0U
 
#define KFSW_FWU_LITE_REPLY   1U
 
#define KFSW_FWU_LITE_HEADER_SIZE   28U
 
#define KFSW_FWU_LITE_DESCRIPTOR_SIZE   42U
 
#define KFSW_FWU_LITE_RECEIPT_SIZE   56U
 
#define KFSW_FWU_LITE_MAX_BLOCK_SIZE   CONFIG_KFSW_FWU_LITE_BLOCK_SIZE
 
#define KFSW_FWU_LITE_MAX_PAYLOAD_SIZE
 
#define KFSW_FWU_LITE_WIRE_SIZE   (KFSW_FWU_LITE_HEADER_SIZE + KFSW_FWU_LITE_MAX_PAYLOAD_SIZE)
 

Enumerations

enum  kfsw_fwu_lite_opcode {
  KFSW_FWU_LITE_OP_BEGIN = 1 , KFSW_FWU_LITE_OP_BLOCK = 2 , KFSW_FWU_LITE_OP_STATUS = 3 , KFSW_FWU_LITE_OP_VERIFY = 4 ,
  KFSW_FWU_LITE_OP_START_FLASHING = 5 , KFSW_FWU_LITE_OP_ABORT = 6
}
 
enum  kfsw_fwu_lite_status {
  KFSW_FWU_LITE_STATUS_OK = 0 , KFSW_FWU_LITE_STATUS_INVALID = 1 , KFSW_FWU_LITE_STATUS_OUT_OF_ORDER = 2 , KFSW_FWU_LITE_STATUS_BAD_BLOCK = 3 ,
  KFSW_FWU_LITE_STATUS_BAD_IMAGE = 4 , KFSW_FWU_LITE_STATUS_TOO_LARGE = 5 , KFSW_FWU_LITE_STATUS_BUSY = 6 , KFSW_FWU_LITE_STATUS_FAILED = 7 ,
  KFSW_FWU_LITE_STATUS_OWNER = 8 , KFSW_FWU_LITE_STATUS_STALE = 9 , KFSW_FWU_LITE_STATUS_NOT_FOUND = 10
}
 

Functions

int kfsw_fwu_lite_encode (const struct kfsw_fwu_lite_message *message, uint8_t *buffer, size_t buffer_size, size_t *encoded_size)
 
int kfsw_fwu_lite_decode (const uint8_t *buffer, size_t size, struct kfsw_fwu_lite_message *message)
 
void kfsw_fwu_lite_pack_image (const struct kfsw_fwu_image *image, uint8_t *data)
 
int kfsw_fwu_lite_unpack_image (const uint8_t *data, size_t size, struct kfsw_fwu_image *image)
 
int kfsw_fwu_lite_receipt (const struct kfsw_fwu_lite_message *reply, struct kfsw_fwu_status *status)
 
bool kfsw_fwu_lite_same_image (const struct kfsw_fwu_image *a, const struct kfsw_fwu_image *b)
 
int kfsw_fwu_lite_handle_peer (uint16_t peer, const struct kfsw_fwu_lite_message *request, struct kfsw_fwu_lite_message *reply, uint8_t *receipt_data)
 
const char * kfsw_fwu_lite_status_name (uint8_t status)
 

Description

Powered-receiver resume with explicit validation and activation.

Transport supplies the principal; the wire never supplies an owner. No legacy format.

Macro Documentation

◆ KFSW_FWU_LITE_HEADER_SIZE

#define KFSW_FWU_LITE_HEADER_SIZE   28U

#include <fwu_lite.h>

Fixed big-endian header: version/direction/op/status (one byte each), request/transfer/generation/offset/CRC (uint32), payload length (uint16), reserved zero (uint16).

Offsets are artifact byte offsets.

◆ KFSW_FWU_LITE_MAX_PAYLOAD_SIZE

#define KFSW_FWU_LITE_MAX_PAYLOAD_SIZE

#include <fwu_lite.h>

Value:
((KFSW_FWU_LITE_MAX_BLOCK_SIZE > KFSW_FWU_LITE_RECEIPT_SIZE) \
? KFSW_FWU_LITE_MAX_BLOCK_SIZE \
: KFSW_FWU_LITE_RECEIPT_SIZE)

Enumeration Documentation

◆ kfsw_fwu_lite_opcode

#include <fwu_lite.h>

Explicit operations; upload never implicitly verifies or activates.

◆ kfsw_fwu_lite_status

#include <fwu_lite.h>

Stable wire errors, independent of errno.

Function Documentation

◆ kfsw_fwu_lite_encode()

int kfsw_fwu_lite_encode ( const struct kfsw_fwu_lite_message *  message,
uint8_t *  buffer,
size_t  buffer_size,
size_t *  encoded_size 
)

#include <fwu_lite.h>

Encode/decode with exact lengths and shape validation before narrowing.

Returns -EINVAL for NULL, -EMSGSIZE for excess size, -EBADMSG for illegal wire fields or request shape. Decode payload remains owned by the caller.

◆ kfsw_fwu_lite_handle_peer()

int kfsw_fwu_lite_handle_peer ( uint16_t  peer,
const struct kfsw_fwu_lite_message *  request,
struct kfsw_fwu_lite_message *  reply,
uint8_t *  receipt_data 
)

#include <fwu_lite.h>

Apply a request using transport-supplied stable peer identity.

Reply payload is written to caller-owned receipt_data (at least 56 bytes). Direct calls enforce the same shape checks as the decoder. No session state lives here.

◆ kfsw_fwu_lite_pack_image()

void kfsw_fwu_lite_pack_image ( const struct kfsw_fwu_image *  image,
uint8_t *  data 
)

#include <fwu_lite.h>

Encode the mandatory digest-bearing BEGIN descriptor into 42 bytes.

◆ kfsw_fwu_lite_receipt()

int kfsw_fwu_lite_receipt ( const struct kfsw_fwu_lite_message *  reply,
struct kfsw_fwu_status *  status 
)

#include <fwu_lite.h>

Decode a reply receipt, including descriptor and exact identity.

◆ kfsw_fwu_lite_same_image()

bool kfsw_fwu_lite_same_image ( const struct kfsw_fwu_image *  a,
const struct kfsw_fwu_image *  b 
)

#include <fwu_lite.h>

Compare artifact descriptors, including mandatory digest and block size.

◆ kfsw_fwu_lite_status_name()

const char * kfsw_fwu_lite_status_name ( uint8_t  status)

#include <fwu_lite.h>

Stable lowercase status name, or "unknown".

◆ kfsw_fwu_lite_unpack_image()

int kfsw_fwu_lite_unpack_image ( const uint8_t *  data,
size_t  size,
struct kfsw_fwu_image *  image 
)

#include <fwu_lite.h>

Decode an exact BEGIN descriptor, rejecting missing size or block mismatch.