REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches

The Flasher-X over-the-air firmware upgrade process is a small code snippet originally dating from https://github.com/joepasquariello/FlasherX. More...

#include <flasher.h>

Collaboration diagram for loader::FirmwareBuffer:

Public Member Functions

bool transfer_completed ()
 
 FirmwareBuffer ()
 
 ~FirmwareBuffer ()
 

Public Attributes

std::string name
 only used for name association
 
size_t imagelen =0
 Size of image as defined by user, for checking after transmission.
 
utils::sha256_t upstream_hash
 Hash as defined by user, for checking after transmission.
 
size_t bytes_transmitted =0
 
uint32_t buffer_addr =0
 buffer on flash for new image
 
uint32_t buffer_size =0
 identical to imagelen but increaed to next sector boundary
 

Detailed Description

The Flasher-X over-the-air firmware upgrade process is a small code snippet originally dating from https://github.com/joepasquariello/FlasherX.

The basic idea is to use the free flash image as a buffer since the RAM is (typically) not big enough to hold the new firmware. The swap is then done in an "atomic" step and the teensy is subsequently rebooted. All this happens without the dedicated teensy flashing chip, which also means that if this method miserably fails, the teensy can just be flashed via ordinary USB and no hardware damage can happen.

This FirmwareBuffer class represents a running upgrade process and the second firmware image stored within the upper flash region during a running upgrade process. Given that only one flash OTA upgrade can run per time, this is a singleton.

The primary interface to the over-the-air firmware upgrade are the messages below, so this class is actually only exposed to make a bit more transparent to the user what kind of data are stored during an update.

Definition at line 30 of file flasher.h.

Constructor & Destructor Documentation

◆ FirmwareBuffer()

loader::FirmwareBuffer::FirmwareBuffer ( )

Definition at line 100 of file flasher.cpp.

References buffer_addr, buffer_size, and firmware_buffer_init().

◆ ~FirmwareBuffer()

loader::FirmwareBuffer::~FirmwareBuffer ( )

Definition at line 105 of file flasher.cpp.

References firmware_buffer_free().

Member Function Documentation

◆ transfer_completed()

bool loader::FirmwareBuffer::transfer_completed ( )
inline

Definition at line 36 of file flasher.h.

References bytes_transmitted, and imagelen.

Member Data Documentation

◆ buffer_addr

uint32_t loader::FirmwareBuffer::buffer_addr =0

buffer on flash for new image

Definition at line 38 of file flasher.h.

Referenced by FirmwareBuffer().

◆ buffer_size

uint32_t loader::FirmwareBuffer::buffer_size =0

identical to imagelen but increaed to next sector boundary

Definition at line 39 of file flasher.h.

Referenced by FirmwareBuffer().

◆ bytes_transmitted

size_t loader::FirmwareBuffer::bytes_transmitted =0

Definition at line 35 of file flasher.h.

Referenced by transfer_completed().

◆ imagelen

size_t loader::FirmwareBuffer::imagelen =0

Size of image as defined by user, for checking after transmission.

Definition at line 32 of file flasher.h.

Referenced by transfer_completed().

◆ name

std::string loader::FirmwareBuffer::name

only used for name association

Definition at line 31 of file flasher.h.

◆ upstream_hash

utils::sha256_t loader::FirmwareBuffer::upstream_hash

Hash as defined by user, for checking after transmission.

Definition at line 33 of file flasher.h.


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