Skip to content

Snake-Sanders/fw-updater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fw-updater

Firmware updater over SPI

Priorities

  1. define a rough control flow for the update.
  2. have a general SPI interface easy to inject as mock to be able to write tests.
  3. write the happy path first.
  4. consider pending features and write down TODOS.

TODOS

  • Integrate function calls to the Bootloader.
  • Make sure the size of the spi frame is not too big, otherwise writing the incoming data to flash might take too long and miss the next incoming frame.
  • ensure memory alignment for the data in the SPI frame, maybe the size should match the memory pages sizes.
  • The function to write to memory provided by the bootloader assumes fix address, and it is not required to be send via SPI, although it is more convenient.
  • Add error handling for clear error logs and reporting.
  • User standarized error types for SPI instead of a general one.
  • Consider that the SPI might be also used to access the Flash.
  • add plausibility check for the setup, example: address boundaries, maximum number of blocks, etc.
  • use constant to reference fields in buffers instead of indices.

Run

  • Build with cargo build
  • Run tests with cargo test

Example

use fw_updater::{run, SpiSlave, SpiError};

let mut spi_config = spi::Config::default();
// configure HW specific SPI driver as slave
// set parameters to spi_config...frequency, phase, polarity...

// probably the SPI is also used to access the flash therefore it has to be
// shared.
let spi = Spi::new_blocking(p.SPI1, clk, mosi, miso, spi_config.clone());
// create instance implementing SpiSlave trait

let mut spi_slave = MySpiSlave::new(&mut spi);
run(&mut spi_slave);

References

About

Firmware updater over SPI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages