94typedef enum : uint32_t {
125typedef enum : uint32_t {
133typedef enum : uint8_t {
143typedef enum : uint8_t {
186 "image header must be exactly one 32-byte MRAM page");
315void ra8_dfu_launch(uintptr_t src, uint32_t img_len, uint32_t entry);
376ra8_dfu_boot_decide(
bool dfu_trigger,
bool a_valid, uint32_t a_seq,
bool b_valid, uint32_t b_seq);
ra8_err_t ra8_dfu_program_commit(ra8_dfu_slot_t inactive, uint32_t img_len, uint32_t seq)
Finalize a slot: CRC the programmed body, then program the header.
ra8_err_t ra8_dfu_slot_seq(ra8_dfu_slot_t slot, uint32_t *out_seq)
Read a slot header's sequence number (0 if the magic is wrong).
ra8_dfu_slot_t
Application-slot identifier.
@ k_ra8_dfu_slot_b
Slot B (0x02090000).
@ k_ra8_dfu_slot_a
Slot A (0x02020000).
@ k_ra8_dfu_slot_none
No valid slot present.
ra8_dfu_slot_t ra8_dfu_select_slot(bool a_valid, uint32_t a_seq, bool b_valid, uint32_t b_seq)
Pick the active slot from the two slots' validity + sequence.
ra8_dfu_action_t
Outcome of the reset-time boot decision.
@ k_ra8_dfu_action_jump_b
Jump to the Slot B application.
@ k_ra8_dfu_action_dfu
Enter the DFU device; do not jump.
@ k_ra8_dfu_action_jump_a
Jump to the Slot A application.
uint32_t ra8_dfu_crc32(const uint8_t *data, uint32_t len)
Compute the IEEE-802.3 CRC32 of a byte range (software).
bool ra8_dfu_hdr_valid(const ra8_dfu_img_hdr_t *hdr, uint32_t computed_crc)
Decide whether a slot header describes a valid bootable image.
ra8_dfu_layout_t
Fixed MRAM bank-layout addresses and image-header constants.
@ k_ra8_dfu_page_size
MRAM program page (32 bytes).
@ k_ra8_dfu_trigger_magic
No-init SRAM DFU-request magic.
@ k_ra8_dfu_hdr_offset
Header offset (slot's last page).
@ k_ra8_dfu_slot_a_base
Slot A base (app vectors here).
@ k_ra8_dfu_hdr_magic
Valid-image header magic ("RA8D").
@ k_ra8_dfu_slot_size
Per-slot size (448 KiB).
@ k_ra8_dfu_bl_size
Immutable bootloader size (128K).
@ k_ra8_dfu_mram_size
Code-MRAM window size (1 MiB).
@ k_ra8_dfu_slot_b_base
Slot B base (app vectors here).
@ k_ra8_dfu_mram_base
Code-MRAM window base.
@ k_ra8_dfu_hdr_size
Image header size (32 bytes).
@ k_ra8_dfu_img_max
Max image bytes (slot - header).
ra8_err_t ra8_dfu_program_image(ra8_dfu_slot_t inactive, uint32_t img_offset, const uint8_t *data, uint32_t len)
Program one image chunk into the inactive slot's body.
ra8_err_t ra8_dfu_read_header(ra8_dfu_slot_t slot, ra8_dfu_img_hdr_t *out_hdr)
Copy a slot's 32-byte header out of MRAM.
bool ra8_dfu_run_target_valid(uint32_t entry, uint32_t img_len)
Decide whether a validated slot's image may be copied-to-run.
uintptr_t ra8_dfu_slot_base(ra8_dfu_slot_t slot)
Return the MRAM base address of a slot.
ra8_dfu_action_t ra8_dfu_boot_decide(bool dfu_trigger, bool a_valid, uint32_t a_seq, bool b_valid, uint32_t b_seq)
Reset-time boot decision: jump to a slot, or enter DFU.
ra8_err_t ra8_dfu_program_prepare(ra8_dfu_slot_t inactive)
Open ra8_flash and fence all writes to one slot's window.
ra8_dfu_slot_t ra8_dfu_other_slot(ra8_dfu_slot_t slot)
Return the opposite slot (A<->B).
ra8_err_t ra8_dfu_program_verify(ra8_dfu_slot_t slot)
Read-back verify: re-CRC a slot's body against its stored header.
ra8_dfu_run_t
Fixed SRAM copy-to-run execution base.
@ k_ra8_dfu_run_base
SRAM copy-to-run / payload link base.
void ra8_dfu_launch(uintptr_t src, uint32_t img_len, uint32_t entry)
Copy an image to the SRAM run base and branch to it (copy-to-run).
bool ra8_dfu_slot_valid(ra8_dfu_slot_t slot)
Validate a slot live: header magic/length/CRC over its real image.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
32-byte application-image header at the base of each slot.
uint32_t img_crc32
CRC32 (IEEE) over the image body.
uint32_t rsv0
Reserved; programmed 0.
uint32_t rsv2
Reserved; programmed 0.
uint32_t magic
Must equal k_ra8_dfu_hdr_magic.
uint32_t rsv1
Reserved; programmed 0.
uint32_t seq
Monotonic sequence; higher valid slot wins.
uint32_t entry
SRAM run base (== k_ra8_dfu_run_base).
uint32_t img_len
Image body length in bytes (32-byte multiple).