OTA updates for Controller A: dual-slot partitions, signed Gitea releases
- partition table: two 7.9 MB OTA slots, SPIFFS dropped, nvs/otadata offsets unchanged (tunables survived the one-time USB flash) - ota_update.cpp: manual `ota status|check|install|rollback` console; HTTPS pull from the public repo's latest release, ECDSA P-256 signature over "patrol-a|version|sha256" checked before download, streamed image must match, parked gate before download and before the slot switch, 30 s confirm-or-rollback (verifyRollbackLater override) - ota_config.h: server/repo, ISRG Root X1 + Root YR, signing public key - .gitea/workflows/firmware.yml: main -> rolling unsigned pre-release main-latest; v* tag -> signed release (needs secret FIRMWARE_SIGNING_KEY) - wiki: pages/ota-updates.md (design, decisions, B-over-ESP-NOW plan); CLAUDE.md, index, log, open-questions #12 updated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* ota_update.h - pull firmware updates from this repo's Gitea releases.
|
||||
*
|
||||
* Manual only: nothing checks or installs by itself. The `ota` serial console
|
||||
* drives it today; the planned password-gated Diagnostics screen will call the
|
||||
* same functions (wiki/pages/open-questions.md #12).
|
||||
*
|
||||
* ota status running version, slot, rollback state
|
||||
* ota check ask Gitea for the latest release, compare versions
|
||||
* ota install [force] download, verify signature, flash idle slot, reboot
|
||||
* ota rollback boot the previous slot
|
||||
*
|
||||
* Safety:
|
||||
* - refused unless the vehicle is parked (engine off, output shaft still, lever
|
||||
* not in a drive gear) - checked before the download AND again before the
|
||||
* boot slot is switched. Silent bus (bench / ignition off) counts as parked.
|
||||
* - image must match the signed manifest (sha256 + ECDSA P-256 over
|
||||
* "target|version|sha256"); otherwise the idle slot is never activated.
|
||||
* - a new image must run OTA_CONFIRM_MS before it is marked valid; a reset
|
||||
* or crash before that makes the bootloader fall back to the old slot.
|
||||
*
|
||||
* Needs Wi-Fi joined to a network with internet (Settings screen). Joining an
|
||||
* AP moves the radio channel; the ESP-NOW link to Controller B follows it.
|
||||
* See wiki/pages/ota-updates.md.
|
||||
*/
|
||||
|
||||
#ifndef OTA_UPDATE_H
|
||||
#define OTA_UPDATE_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
namespace Ota {
|
||||
|
||||
/** Log version/slot; note if this boot is an unconfirmed new image. Call early in setup(). */
|
||||
void init();
|
||||
|
||||
/** Confirms a freshly installed image once it has run long enough. Call from loop(). */
|
||||
void tick();
|
||||
|
||||
/** Console entry point (`ota ...`). Returns false if the line isn't an ota command. */
|
||||
bool handleCommand(const char* line);
|
||||
|
||||
/** Firmware version baked in at build time ("dev" for local builds). */
|
||||
const char* version();
|
||||
|
||||
} // namespace Ota
|
||||
|
||||
#endif // OTA_UPDATE_H
|
||||
Reference in New Issue
Block a user