59#ifndef RIOTBOOT_FLASHWRITE_H
60#define RIOTBOOT_FLASHWRITE_H
72#ifndef CONFIG_RIOTBOOT_FLASHWRITE_RAW
73#define CONFIG_RIOTBOOT_FLASHWRITE_RAW 1
79#if CONFIG_RIOTBOOT_FLASHWRITE_RAW
81#if (FLASHPAGE_WRITE_BLOCK_SIZE < 4)
82#define RIOTBOOT_FLASHPAGE_BUFFER_SIZE 4
84#define RIOTBOOT_FLASHPAGE_BUFFER_SIZE FLASHPAGE_WRITE_BLOCK_SIZE
89#define RIOTBOOT_FLASHPAGE_BUFFER_SIZE FLASHPAGE_SIZE
96#define RIOTBOOT_FLASHPAGE_BUFFER_ATTRS \
97 __attribute__((aligned(FLASHPAGE_WRITE_BLOCK_ALIGNMENT)))
116#if CONFIG_RIOTBOOT_FLASHWRITE_RAW || DOXYGEN
129#define RIOTBOOT_FLASHWRITE_SKIPLEN sizeof(RIOTBOOT_MAGIC)
187 const uint8_t *bytes,
size_t len,
bool more);
209 const uint8_t *bytes,
size_t len);
274 size_t img_size,
int target_slot);
Low-level flash page peripheral driver interface.
#define RIOTBOOT_FLASHPAGE_BUFFER_ATTRS
Extra attributes required for the firmware intermediate buffer.
static int riotboot_flashwrite_init(riotboot_flashwrite_t *state, int target_slot)
Initialize firmware update (riotboot version)
int riotboot_flashwrite_verify_sha256(const uint8_t *sha256_digest, size_t img_size, int target_slot)
Verify the digest of an image.
int riotboot_flashwrite_invalidate(int slot)
Invalidate a slot header (riotboot version)
size_t riotboot_flashwrite_slotsize(const riotboot_flashwrite_t *state)
Get a slot's size.
int riotboot_flashwrite_init_raw(riotboot_flashwrite_t *state, int target_slot, size_t offset)
Initialize firmware update (raw version)
int riotboot_flashwrite_finish_raw(riotboot_flashwrite_t *state, const uint8_t *bytes, size_t len)
Finish a firmware update (raw version)
int riotboot_flashwrite_flush(riotboot_flashwrite_t *state)
Force flush the buffer onto the flash.
#define RIOTBOOT_FLASHWRITE_SKIPLEN
Amount of bytes to skip at initial write of first page.
#define RIOTBOOT_FLASHPAGE_BUFFER_SIZE
Intermediate buffer size for firmware image data.
int riotboot_flashwrite_invalidate_latest(void)
Invalidate the latest firmware version (riotboot version)
static int riotboot_flashwrite_finish(riotboot_flashwrite_t *state)
Finish a firmware update (riotboot version)
int riotboot_flashwrite_putbytes(riotboot_flashwrite_t *state, const uint8_t *bytes, size_t len, bool more)
Feed bytes into the firmware writer.
firmware update state structure
size_t offset
update is at this position
unsigned flashpage
update is at this flashpage
int target_slot
update targets this slot