Skip to content

Commit

Permalink
FOTA configs for safer firmware matching
Browse files Browse the repository at this point in the history
  • Loading branch information
rbaron committed May 12, 2024
1 parent b2376a4 commit 18f4914
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
22 changes: 19 additions & 3 deletions code/nrf-connect/samples/zigbee/prj_fota.conf
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,29 @@ CONFIG_ASSERT=y
##

# 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
CONFIG_ZIGBEE_FOTA=y
CONFIG_ZIGBEE_FOTA_HW_VERSION=52

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"

# Ensure an MCUboot-compatible binary is generated.
Expand Down
4 changes: 3 additions & 1 deletion code/nrf-connect/samples/zigbee/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static void confirm_image(void) {
static void ota_evt_handler(const struct zigbee_fota_evt *evt) {
switch (evt->id) {
case ZIGBEE_FOTA_EVT_PROGRESS:
prst_led_flash(1);
LOG_INF("OTA progress: %d%%", evt->dl.progress);
break;
case ZIGBEE_FOTA_EVT_FINISHED:
LOG_INF("Reboot application.");
Expand Down Expand Up @@ -386,6 +386,8 @@ int main(void) {
power_down_unused_ram();

#ifdef CONFIG_ZIGBEE_FOTA
LOG_INF("Firmware version: %s", CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION);

/* Initialize Zigbee FOTA download service. */
zigbee_fota_init(ota_evt_handler);

Expand Down

0 comments on commit 18f4914

Please sign in to comment.