FOTA configs for safer firmware matching

This commit is contained in:
rbaron 2024-05-12 14:50:51 +02:00
parent b2376a4050
commit 18f4914f37
2 changed files with 22 additions and 4 deletions

View file

@ -76,13 +76,29 @@ CONFIG_ASSERT=y
## ##
# Software build version in the basic_attrs cluster. # Software build version in the basic_attrs cluster.
CONFIG_PRST_ZB_SOFTWARE_VERSION="test-sw-1" CONFIG_PRST_ZB_SOFTWARE_VERSION="dev"
# Enable Zigbee FOTA library # Enable Zigbee FOTA library
CONFIG_ZIGBEE_FOTA=y CONFIG_ZIGBEE_FOTA=y
CONFIG_ZIGBEE_FOTA_HW_VERSION=52
CONFIG_ZIGBEE_FOTA_ENDPOINT=5 CONFIG_ZIGBEE_FOTA_ENDPOINT=5
CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="1.0.0" CONFIG_ZIGBEE_FOTA_LOG_LEVEL_DBG=y
# DIY Zigbee FOTA manufacturer ID.
CONFIG_ZIGBEE_FOTA_MANUFACTURER_ID=0xDB15
# This must be BOARD_REVISION_CODE.
# TODO: move this to Kconfig.
CONFIG_ZIGBEE_FOTA_HW_VERSION=4
# Set for which hardware versions this FOTA image is valid.
CONFIG_ENABLE_ZIGBEE_FOTA_MIN_HW_VERSION=y
CONFIG_ZIGBEE_FOTA_MIN_HW_VERSION=0x00
CONFIG_ENABLE_ZIGBEE_FOTA_MAX_HW_VERSION=y
CONFIG_ZIGBEE_FOTA_MAX_HW_VERSION=0xff
# 0.0.0 is a safe default for development.
CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="0.0.0"
CONFIG_ZIGBEE_FOTA_COMMENT="b-parasite" CONFIG_ZIGBEE_FOTA_COMMENT="b-parasite"
# Ensure an MCUboot-compatible binary is generated. # Ensure an MCUboot-compatible binary is generated.

View file

@ -149,7 +149,7 @@ static void confirm_image(void) {
static void ota_evt_handler(const struct zigbee_fota_evt *evt) { static void ota_evt_handler(const struct zigbee_fota_evt *evt) {
switch (evt->id) { switch (evt->id) {
case ZIGBEE_FOTA_EVT_PROGRESS: case ZIGBEE_FOTA_EVT_PROGRESS:
prst_led_flash(1); LOG_INF("OTA progress: %d%%", evt->dl.progress);
break; break;
case ZIGBEE_FOTA_EVT_FINISHED: case ZIGBEE_FOTA_EVT_FINISHED:
LOG_INF("Reboot application."); LOG_INF("Reboot application.");
@ -386,6 +386,8 @@ int main(void) {
power_down_unused_ram(); power_down_unused_ram();
#ifdef CONFIG_ZIGBEE_FOTA #ifdef CONFIG_ZIGBEE_FOTA
LOG_INF("Firmware version: %s", CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION);
/* Initialize Zigbee FOTA download service. */ /* Initialize Zigbee FOTA download service. */
zigbee_fota_init(ota_evt_handler); zigbee_fota_init(ota_evt_handler);