|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The application slots over esp_ota_ops. More...
#include "fw_ota.h"#include <stdio.h>#include <string.h>#include "esp_app_desc.h"#include "esp_attr.h"#include "esp_log.h"#include "esp_ota_ops.h"#include "esp_partition.h"#include "esp_system.h"Data Structures | |
| struct | ota_ctx_t |
| One write into the slot that is not running. More... | |
| struct | restart_note_t |
| The note fw_ota_note_restart() leaves for the next start. More... | |
Macros | |
| #define | NOTE_MAGIC 0x52435550u |
| A note that holds a version: "RCUP". | |
Functions | |
| uint32_t | fw_ota_slot_bytes (void) |
| The slot an update writes. | |
| bool | fw_ota_running (fw_image_info_t *out) |
| The running build: version and ELF (executable and linkable format) SHA-256, as fw_offer() compares them. | |
| static bool | ota_begin (void *ctx, uint32_t bytes) |
Open the slot that is not running for bytes. | |
| static bool | ota_write (void *ctx, uint32_t off, const uint8_t *src, uint32_t len) |
| Write the next piece, at the offset the last one ended. | |
| static bool | ota_finish (void *ctx) |
| Check the written slot and name it in otadata. | |
| static void | ota_abort (void *ctx) |
| Drop a write under way. | |
| const fw_flash_t * | fw_ota_flash (void) |
| The slot that is not running, for fw_install_begin(). | |
| static uint32_t | note_check (const restart_note_t *n) |
| FNV-1a (Fowler-Noll-Vo) over the note's version text. | |
| void | fw_ota_note_restart (const char *version) |
| Before the restart into a written slot: what the next start reports when that build does not stay. Kept in memory a software restart keeps and a power cut clears. | |
| static bool | boot_pending (void *ctx) |
| Whether the running build is pending verify. | |
| static void | boot_mark_invalid (void *ctx) |
| Mark the running build invalid and restart into the one before. | |
| static bool | boot_mark_valid (void *ctx) |
| Keep the running build: otadata says valid. | |
| static void | boot_restart (void *ctx) |
| Restart. | |
| static bool | boot_last_invalid (void *ctx) |
| Whether a slot is marked invalid by a start that went back. | |
| bool | fw_ota_trial_pending (void) |
| Whether the running build is on its first start after an update (pending verify), and fw_ota_boot_check() still settles it. | |
| fw_boot_t | fw_ota_boot_check (bool ui_up, char *other, uint32_t other_cap) |
Once per start: with ui_up false at the display or touch failing, or with ui_up true once the start is known to work (fw_trial.h). | |
Variables | |
| static const char * | TAG = "fw_ota" |
| The console tag. | |
| static ota_ctx_t | s_ctx |
| The write under way; one at a time. | |
| static const fw_flash_t | k_flash |
| The writer fw_install_begin() drives. | |
| static RTC_NOINIT_ATTR restart_note_t | s_note |
| Kept across esp_restart() and a panic; a power cut clears it. | |
| static const fw_boot_ops_t | k_boot |
| The calls fw_boot_decide() makes. | |
The application slots over esp_ota_ops.
SPDX-License-Identifier: MIT
|
static |
Whether a slot is marked invalid by a start that went back.
| ctx | Unused. |
|
static |
Mark the running build invalid and restart into the one before.
| ctx | Unused. |
|
static |
Keep the running build: otadata says valid.
| ctx | Unused. |
|
static |
Whether the running build is pending verify.
| ctx | Unused. |
|
static |
Restart.
| ctx | Unused. |
| fw_boot_t fw_ota_boot_check | ( | bool | ui_up, |
| char * | other, | ||
| uint32_t | other_cap ) |
Once per start: with ui_up false at the display or touch failing, or with ui_up true once the start is known to work (fw_trial.h).
On a build's first start after an update: ui_up keeps it (FW_BOOT_UPDATED, or FW_BOOT_UNCONFIRMED when otadata could not be written), otherwise the panel restarts into the build before it and this does not return (fw_boot_decide()). After a start that went back: FW_BOOT_ROLLED_BACK with the written build's version in other, when fw_ota_note_restart() was called before it and no power cut came between.
| ui_up | Whether the start is kept (true) or goes back (false). |
| other | Where the written build's version goes; may be NULL with other_cap 0. |
| other_cap | Bytes at other. |
| const fw_flash_t * fw_ota_flash | ( | void | ) |
The slot that is not running, for fw_install_begin().
| void fw_ota_note_restart | ( | const char * | version | ) |
Before the restart into a written slot: what the next start reports when that build does not stay. Kept in memory a software restart keeps and a power cut clears.
| version | The written build's version. |
| bool fw_ota_running | ( | fw_image_info_t * | out | ) |
The running build: version and ELF (executable and linkable format) SHA-256, as fw_offer() compares them.
| out | Where they go. |
| uint32_t fw_ota_slot_bytes | ( | void | ) |
The slot an update writes.
| bool fw_ota_trial_pending | ( | void | ) |
Whether the running build is on its first start after an update (pending verify), and fw_ota_boot_check() still settles it.
|
static |
FNV-1a (Fowler-Noll-Vo) over the note's version text.
| n | The note. |
|
static |
Drop a write under way.
| ctx | The ota_ctx_t. |
|
static |
Open the slot that is not running for bytes.
| ctx | The ota_ctx_t. |
| bytes | The image's size. |
|
static |
Check the written slot and name it in otadata.
| ctx | The ota_ctx_t. |
|
static |
Write the next piece, at the offset the last one ended.
| ctx | The ota_ctx_t. |
| off | The piece's offset in the image. |
| src | The bytes. |
| len | Bytes at src. |
|
static |
The calls fw_boot_decide() makes.
|
static |
The writer fw_install_begin() drives.