SatNOGS-COMMS  4.1.0
A COMMS subsystem for CubeSats
Loading...
Searching...
No Matches
satnogs::comms::ota Class Reference

#include <ota.hpp>

Classes

class  start_tlc
class  data_tlc
class  fin_tlc
class  response_tlm
class  session
class  inval_session

Public Types

enum class  subsys : uint8_t {
  MCU_SLOT0 , MCU_SLOT1 , FPGA_WIC , MCU_LITTLEFS ,
  FPGA_LITTLEFS
}
 Destination target for a firmware file. More...
enum class  status : uint8_t {
  OK , INVALID_SEQ , INVALID_SESSION , INVALID_DST ,
  INVALID_SLOT , INVALID_HASH , INVALID_SIZE , INVALID_STATE ,
  INVALID_DATA , NO_SESSIONS_LEFT , FIN_OPERATION_PENDING , INTERNAL_ERROR ,
  CURRENT_IMG_NOT_CONFIRMED
}

Public Member Functions

 ota (ota const &)=delete
void operator= (ota const &)=delete
void reset_session (uint32_t id)
void reset_sessions ()
void start (const start_tlc &req, response_tlm &tlm)
void recv (const data_tlc &tlc, response_tlm &tlm)
void finalize (const fin_tlc &tlc, response_tlm &tlm, int wdgid)
void confirm_image ()
 Sets the running firmware as confirmed.
bool get_session_info (uint8_t id, session &out) const

Static Public Member Functions

static otaget_instance ()

Static Public Attributes

static constexpr size_t MAX_FILE_LEN = 64
 The maximum supported filename length.
static constexpr const char * LITTLEFS_MCU_DIR = "/SD/ota-mcu/"
static constexpr const char * LITTLEFS_FPGA_DIR = "/SD/ota-fpga/"

Protected Member Functions

 ota ()

Static Protected Attributes

static constexpr size_t OTA_RETENTION_MEM_SIZE = 1752
 The available retention memory for the OTA service.

Detailed Description

Note
Directly writing to the MCU Boot partitions should be avoided. It can be used only as last resort in case of catastrophic failure of the eMMC

Definition at line 37 of file ota.hpp.

Member Enumeration Documentation

◆ status

enum class satnogs::comms::ota::status : uint8_t
strong
Enumerator
OK 
INVALID_SEQ 
INVALID_SESSION 
INVALID_DST 
INVALID_SLOT 
INVALID_HASH 
INVALID_SIZE 
INVALID_STATE 
INVALID_DATA 
NO_SESSIONS_LEFT 
FIN_OPERATION_PENDING 
INTERNAL_ERROR 
CURRENT_IMG_NOT_CONFIRMED 

Definition at line 78 of file ota.hpp.

◆ subsys

enum class satnogs::comms::ota::subsys : uint8_t
strong

Destination target for a firmware file.

Enumerator
MCU_SLOT0 

MCU MCUBoot Slot 0.

MCU_SLOT1 

MCU MCUBoot Slot 1.

FPGA_WIC 

A Yocto/Petalinux WIC file that is placed in the start of the eMMC

MCU_LITTLEFS 

MCU firmware file stored in a dedicated directory of the LittleFS

FPGA_LITTLEFS 

FPGA firmware file stored in a dedicated directory of the LittleFS

Definition at line 66 of file ota.hpp.

Constructor & Destructor Documentation

◆ ota() [1/2]

satnogs::comms::ota::ota ( ota const & )
delete

◆ ota() [2/2]

satnogs::comms::ota::ota ( )
protected

Definition at line 351 of file ota.cpp.

Member Function Documentation

◆ confirm_image()

void satnogs::comms::ota::confirm_image ( )

Sets the running firmware as confirmed.

Warning
After this call, there is no going back. The confirmed image will run even if it has any logical issue. The bootloader will fallback to another shot only in case the runnning slot gets corrupted
Note
If an image is not confirmed, at next reboot the bootloader will revert to the previous one

Definition at line 346 of file ota.cpp.

◆ finalize()

void satnogs::comms::ota::finalize ( const fin_tlc & tlc,
response_tlm & tlm,
int wdgid )

Definition at line 280 of file ota.cpp.

◆ get_instance()

ota & satnogs::comms::ota::get_instance ( )
inlinestatic

Definition at line 51 of file ota.hpp.

◆ get_session_info()

bool satnogs::comms::ota::get_session_info ( uint8_t id,
session & out ) const

Definition at line 74 of file ota.cpp.

◆ operator=()

void satnogs::comms::ota::operator= ( ota const & )
delete

◆ recv()

void satnogs::comms::ota::recv ( const data_tlc & tlc,
response_tlm & tlm )

Definition at line 214 of file ota.cpp.

◆ reset_session()

void satnogs::comms::ota::reset_session ( uint32_t id)

Definition at line 54 of file ota.cpp.

◆ reset_sessions()

void satnogs::comms::ota::reset_sessions ( )

Definition at line 66 of file ota.cpp.

◆ start()

void satnogs::comms::ota::start ( const start_tlc & req,
response_tlm & tlm )

Definition at line 84 of file ota.cpp.

Member Data Documentation

◆ LITTLEFS_FPGA_DIR

const char* satnogs::comms::ota::LITTLEFS_FPGA_DIR = "/SD/ota-fpga/"
staticconstexpr

Definition at line 48 of file ota.hpp.

◆ LITTLEFS_MCU_DIR

const char* satnogs::comms::ota::LITTLEFS_MCU_DIR = "/SD/ota-mcu/"
staticconstexpr

Definition at line 47 of file ota.hpp.

◆ MAX_FILE_LEN

size_t satnogs::comms::ota::MAX_FILE_LEN = 64
staticconstexpr

The maximum supported filename length.

Note
filenames are utilized only for the LittleFS targets

Definition at line 45 of file ota.hpp.

◆ OTA_RETENTION_MEM_SIZE

size_t satnogs::comms::ota::OTA_RETENTION_MEM_SIZE = 1752
staticconstexprprotected

The available retention memory for the OTA service.

@warming This amount is manually calculated. Any modification on the retention memory may invalidate this number

Definition at line 216 of file ota.hpp.


The documentation for this class was generated from the following files: