diff --git a/examples/lighting-app/qpg/include/CHIPProjectConfig.h b/examples/lighting-app/qpg/include/CHIPProjectConfig.h old mode 100755 new mode 100644 index 4ad78040b734f0..98f0f4f8992918 --- a/examples/lighting-app/qpg/include/CHIPProjectConfig.h +++ b/examples/lighting-app/qpg/include/CHIPProjectConfig.h @@ -49,14 +49,18 @@ * * 0xFFF1: Test Vendor. */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID #define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1 +#endif // CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID /** * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID * * 0x8005: example lighting app */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8005 +#endif // CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID /** * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION diff --git a/examples/lock-app/qpg/include/CHIPProjectConfig.h b/examples/lock-app/qpg/include/CHIPProjectConfig.h old mode 100755 new mode 100644 index eab7fbbc758070..cd3121bab0be33 --- a/examples/lock-app/qpg/include/CHIPProjectConfig.h +++ b/examples/lock-app/qpg/include/CHIPProjectConfig.h @@ -47,14 +47,18 @@ * * 0xFFF1: Test vendor. */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID #define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1 +#endif // CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID /** * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID * * 0x8006: example lock-app */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8006 +#endif // CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID /** * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION diff --git a/examples/persistent-storage/qpg/BUILD.gn b/examples/persistent-storage/qpg/BUILD.gn index 355f4bb2a6865b..683a5ede278cff 100644 --- a/examples/persistent-storage/qpg/BUILD.gn +++ b/examples/persistent-storage/qpg/BUILD.gn @@ -38,6 +38,7 @@ qpg_executable("persistent_storage_app") { output_name = "chip-${qpg_target_ic}-persistent_storage-example.out" deps = [] + defines = [] public_deps = [ ":sdk", diff --git a/examples/persistent-storage/qpg/include/CHIPProjectConfig.h b/examples/persistent-storage/qpg/include/CHIPProjectConfig.h old mode 100755 new mode 100644 index ea44ed3d315329..e3de1e833ec4c6 --- a/examples/persistent-storage/qpg/include/CHIPProjectConfig.h +++ b/examples/persistent-storage/qpg/include/CHIPProjectConfig.h @@ -45,14 +45,18 @@ * * 0xFFF1: Test vendor. */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID #define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1 +#endif // CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID /** * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID * * 0x8009: example persistent-storage */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8009 +#endif // CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID /** * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION diff --git a/examples/shell/qpg/include/CHIPProjectConfig.h b/examples/shell/qpg/include/CHIPProjectConfig.h index 3df895ea838856..8656d8ae542fbf 100644 --- a/examples/shell/qpg/include/CHIPProjectConfig.h +++ b/examples/shell/qpg/include/CHIPProjectConfig.h @@ -51,14 +51,18 @@ * * 0xFFF1: Test vendor. */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID #define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1 +#endif // CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID /** * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID * * 0x8009: example shell */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8012 +#endif // CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID /** * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION diff --git a/third_party/qpg_sdk/qpg_executable.gni b/third_party/qpg_sdk/qpg_executable.gni index 4950939182b1b4..b7f3fe2dc4eedb 100644 --- a/third_party/qpg_sdk/qpg_executable.gni +++ b/third_party/qpg_sdk/qpg_executable.gni @@ -19,6 +19,13 @@ import("${build_root}/toolchain/flashable_executable.gni") import("${chip_root}/src/platform/device.gni") import("qpg_sdk.gni") +declare_args() { + matter_device_vid = "" + matter_device_pid = "" + matter_device_software_version_string = "" + matter_device_software_version = "" +} + # Run the generator script that takes a .HEX file and adds the OTA header to it. # # This requires a Python script, given by ota_header_generator, @@ -66,6 +73,25 @@ template("qpg_executable") { objcopy_image_format = "ihex" objcopy = "arm-none-eabi-objcopy" + defines = [] + if (defined(invoker.defines)) { + defines += invoker.defines + } + + # Overrule CHIPProjectConfig.h settings + if (matter_device_vid != "") { + defines += [ "CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID=${matter_device_vid}" ] + } + if (matter_device_pid != "") { + defines += [ "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID=${matter_device_pid}" ] + } + if (matter_device_software_version_string != "") { + defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${matter_device_software_version_string}\"" ] + } + if (matter_device_software_version != "") { + defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=${matter_device_software_version}" ] + } + # Copy flashing dependencies to the output directory so that the output # is collectively self-contained; this allows flashing to work reliably # even if the build and flashing steps take place on different machines @@ -124,6 +150,22 @@ template("qpg_executable") { "--pem_password=test1234", "--sign", ] + + # Use build-time overrules in OTA header creation + # Normally taken from CHIPProjectConfig.h by scripting + if (matter_device_vid != "") { + ota_header_options += [ "-vid=${matter_device_vid}" ] + } + if (matter_device_pid != "") { + ota_header_options += [ "-pid=${matter_device_pid}" ] + } + if (matter_device_software_version != "") { + ota_header_options += [ "-vn=${matter_device_software_version}" ] + } + if (matter_device_software_version_string != "") { + ota_header_options += + [ "-vs=\"${matter_device_software_version_string}\"" ] + } deps = [ ":$executable_target_name" ] } }