Balance side (uart_ota.c): downloads io-firmware.bin from Gitea to RAM, computes SHA256, then streams to IO over UART1 (GPIO17/18, 460800 baud) as OTA_BEGIN/OTA_DATA/OTA_END frames with CRC8 + per-chunk ACK/retry (×3). IO side (uart_ota_recv.c): receives frames, writes to inactive OTA partition via esp_ota_write, verifies SHA256 on OTA_END, sets boot partition, reboots. IO board main.c + CMakeLists.txt scaffold included. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
479 B
C
21 lines
479 B
C
#pragma once
|
|
/* uart_ota_recv.h — IO board: receives OTA firmware from Balance (bd-21hv) */
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef enum {
|
|
IO_OTA_IDLE = 0,
|
|
IO_OTA_RECEIVING,
|
|
IO_OTA_VERIFYING,
|
|
IO_OTA_APPLYING,
|
|
IO_OTA_REBOOTING,
|
|
IO_OTA_FAILED,
|
|
} io_ota_state_t;
|
|
|
|
extern volatile io_ota_state_t g_io_ota_state;
|
|
extern volatile uint8_t g_io_ota_progress;
|
|
|
|
/* Start listening for OTA frames on UART0 */
|
|
void uart_ota_recv_init(void);
|