SHA-256 hash verification of flash slots, pico_hash_binary, flash:: namespace, ring_buffer iterator, non-destructive log

This commit is contained in:
Ian Gulliver
2026-04-12 23:47:00 +09:00
parent cc37b711a4
commit 23587c41e2
7 changed files with 210 additions and 64 deletions

20
firmware/include/flash.h Normal file
View File

@@ -0,0 +1,20 @@
#pragma once
#include <cstdint>
#include <tuple>
namespace flash {
constexpr uint32_t FLASH_BASE = 0x10000000;
constexpr uint32_t FLASH_SIZE = 2 * 1024 * 1024;
struct slot {
bool valid;
uint32_t version;
bool hash_ok;
auto as_tuple() const { return std::tie(valid, version, hash_ok); }
auto as_tuple() { return std::tie(valid, version, hash_ok); }
};
slot scan(uint32_t flash_offset);
}