Skip to content

Commit

Permalink
[nrfconnect] Add support for Zephyr's version management (project-chi…
Browse files Browse the repository at this point in the history
…p#33216)

* [nrfconnect] Versioning with VERSION file for matter implemented

This commit adds posibility to use VERSION file which will work properly for
DFU SMP and Matter OTA.

Signed-off-by: Patryk Lipinski <[email protected]>

* [nrfconnect] Use version string with tweak

This commit modifies the string format of versioning to include tweak.

Signed-off-by: Łukasz Duda <[email protected]>

---------

Signed-off-by: Patryk Lipinski <[email protected]>
Signed-off-by: Łukasz Duda <[email protected]>
Co-authored-by: Patryk Lipinski <[email protected]>
  • Loading branch information
2 people authored and kkasperczyk-no committed May 8, 2024
1 parent 4ee8d4e commit 42e5ceb
Show file tree
Hide file tree
Showing 3 changed files with 43 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_TWEAK_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
14 changes: 14 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 All @@ -33,8 +36,19 @@
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME CONFIG_CHIP_DEVICE_PRODUCT_NAME
#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION CONFIG_CHIP_DEVICE_HARDWARE_VERSION
#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING CONFIG_CHIP_DEVICE_HARDWARE_VERSION_STRING

#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

#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_TWEAK_STRING
#endif

#define CHIP_DEVICE_CONFIG_TEST_MANUFACTURING_DATE CONFIG_CHIP_DEVICE_MANUFACTURING_DATE
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER CONFIG_CHIP_DEVICE_SERIAL_NUMBER
#define CHIP_DEVICE_CONFIG_DEVICE_TYPE CONFIG_CHIP_DEVICE_TYPE
Expand Down

0 comments on commit 42e5ceb

Please sign in to comment.