diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index 499a9b93e6..1737c23a8b 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -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 @@ -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)" diff --git a/config/zephyr/ota-image.cmake b/config/zephyr/ota-image.cmake index bd7735648f..a0eb984671 100644 --- a/config/zephyr/ota-image.cmake +++ b/config/zephyr/ota-image.cmake @@ -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}") diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index 0af6436cd0..b4351e6914 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -23,6 +23,9 @@ #pragma once +#ifndef CONFIG_CHIP_DEVICE_SOFTWARE_VERSION +#include "app_version.h" +#endif #include "autoconf.h" // ==================== Platform Adaptations ==================== @@ -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