Skip to content

Commit

Permalink
[nrf noup] Versioning with VERSION file for matter implemented
Browse files Browse the repository at this point in the history
This commit adds posibility to use VERSION file which will work properly for
DFU SMP and Matter OTA.

Signed-off-by: Patryk Lipinski <patryk.lipinski@nordicsemi.no>
  • Loading branch information
LipinskiPNordicSemi authored and LuDuda committed Jan 17, 2024
1 parent e54423d commit b6a5e9a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
2 changes: 2 additions & 0 deletions config/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ config CHIP_DEVICE_HARDWARE_VERSION_STRING
hardware version string is exposed as an attribute of the Basic
Information cluster.

if "$(APPVERSION)"=""
config CHIP_DEVICE_SOFTWARE_VERSION
int "Software version"
default 0
Expand All @@ -116,6 +117,7 @@ config CHIP_DEVICE_SOFTWARE_VERSION_STRING
software version string is exposed as an attribute of the Basic
Information cluster, and included in the header of the generated Matter
over-the-air (OTA) update image.
endif

config CHIP_DEVICE_MANUFACTURING_DATE
string "Manufacturing date (ISO 8601 format)"
Expand Down
39 changes: 27 additions & 12 deletions config/zephyr/ota-image.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,33 @@ function(chip_ota_image TARGET_NAME)
endif()

# Prepare ota_image_tool.py argument list
set(OTA_ARGS
"--vendor-id"
${CONFIG_CHIP_DEVICE_VENDOR_ID}
"--product-id"
${CONFIG_CHIP_DEVICE_PRODUCT_ID}
"--version"
${CONFIG_CHIP_DEVICE_SOFTWARE_VERSION}
"--version-str"
${CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING}
"--digest-algorithm"
"sha256"
)
if(DEFINED APPVERSION)
set(OTA_ARGS
"--vendor-id"
${CONFIG_CHIP_DEVICE_VENDOR_ID}
"--product-id"
${CONFIG_CHIP_DEVICE_PRODUCT_ID}
"--version"
${APPVERSION}
"--version-str"
${APP_VERSION_STRING}
"--digest-algorithm"
"sha256"
)
else()
set(OTA_ARGS
"--vendor-id"
${CONFIG_CHIP_DEVICE_VENDOR_ID}
"--product-id"
${CONFIG_CHIP_DEVICE_PRODUCT_ID}
"--version"
${CONFIG_CHIP_DEVICE_SOFTWARE_VERSION}
"--version-str"
${CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING}
"--digest-algorithm"
"sha256"
)
endif()

separate_arguments(OTA_EXTRA_ARGS NATIVE_COMMAND "${CHIP_OTA_IMAGE_EXTRA_ARGS}")

Expand Down
11 changes: 11 additions & 0 deletions src/platform/nrfconnect/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

#pragma once

#ifndef CONFIG_CHIP_DEVICE_SOFTWARE_VERSION
#include "app_version.h"
#endif
#include "autoconf.h"

// ==================== Platform Adaptations ====================
Expand Down Expand Up @@ -80,11 +83,19 @@
#endif

#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
#ifdef CONFIG_CHIP_DEVICE_SOFTWARE_VERSION
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION CONFIG_CHIP_DEVICE_SOFTWARE_VERSION
#else
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION APPVERSION
#endif
#endif

#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING
#ifdef CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING
#else
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING APP_VERSION_STRING
#endif
#endif

#ifdef CONFIG_NET_L2_OPENTHREAD
Expand Down

0 comments on commit b6a5e9a

Please sign in to comment.