26#ifndef RCBENCH_FW_IMAGE_H
27#define RCBENCH_FW_IMAGE_H
40#define FW_HEAD_BYTES 288u
41#define FW_IMAGE_MAGIC 0xE9u
44#define FW_CHIP_ESP32P4 0x0012u
45#define FW_DESC_MAGIC 0xABCD5432uL
47#define FW_PROJECT "rcbench-panel"
49#define FW_TEXT_MAX 32u
51#define FW_MAX_SEGMENTS 16u
87 uint8_t elf_sha[FW_SHA256_BYTES];
bool fw_version_parse(const char *text, size_t n, fw_version_t *out)
Parses "MAJOR.MINOR.PATCH" from at most n bytes of text: digits only, each number 0 to 65535,...
Definition fw_image.c:65
fw_offer_t fw_offer(const fw_image_info_t *running, const fw_image_info_t *image)
Classifies a checked image against the panel running now.
Definition fw_image.c:215
const char * fw_err_str(fw_err_t e)
The English name of e, for the console.
Definition fw_image.c:40
int fw_version_cmp(fw_version_t a, fw_version_t b)
Compares two versions.
Definition fw_image.c:100
fw_err_t fw_image_head(const uint8_t *head, uint32_t have, uint32_t bytes, uint32_t slot, fw_image_info_t *out)
Checks the first have bytes of an image of bytes in all, for a slot of slot bytes: size,...
Definition fw_image.c:114
fw_err_t fw_image_check(const uint8_t *img, uint32_t bytes, uint32_t slot, fw_image_info_t *out)
Checks a whole image of bytes at img for a slot of slot bytes: everything fw_image_head() checks,...
Definition fw_image.c:189
bool fw_offer_installable(fw_offer_t o)
Whether an offer is one INSTALL may act on.
Definition fw_image.c:230
fw_err_t
Definition fw_image.h:61
@ FW_ERR_NOT_IMAGE
Definition fw_image.h:66
@ FW_ERR_VERSION
Definition fw_image.h:70
@ FW_ERR_EMPTY
Definition fw_image.h:63
@ FW_ERR_HASH
Definition fw_image.h:73
@ FW_ERR_CHIP
Definition fw_image.h:67
@ FW_ERR_SHORT
Definition fw_image.h:64
@ FW_ERR_READ
Definition fw_image.h:74
@ FW_ERR_TOO_BIG
Definition fw_image.h:65
@ FW_ERR_FLASH
Definition fw_image.h:77
@ FW_ERR_MEMORY
Definition fw_image.h:76
@ FW_ERR_BUSY
Definition fw_image.h:78
@ FW_ERR_RUNNING
Definition fw_image.h:75
@ FW_ERR_NO_HASH
Definition fw_image.h:71
@ FW_ERR_PROJECT
Definition fw_image.h:69
@ FW_ERR_LENGTH
Definition fw_image.h:72
@ FW_ERR_NO_DESC
Definition fw_image.h:68
#define FW_TEXT_MAX
esp_app_desc_t.version and .project_name, terminator included.
Definition fw_image.h:49
fw_offer_t
What a checked image is to the panel running now.
Definition fw_image.h:158
@ FW_OFFER_INSTALLED
Definition fw_image.h:162
@ FW_OFFER_NEWER
Definition fw_image.h:159
@ FW_OFFER_OLDER
Definition fw_image.h:160
@ FW_OFFER_REBUILD
Definition fw_image.h:161
SHA-256 (Secure Hash Algorithm, 256 bit), FIPS 180-4, in portable C.