From 31330226dff55c725e4a96064b1508176ae477e5 Mon Sep 17 00:00:00 2001 From: Erwin Pan Date: Fri, 21 Apr 2023 09:42:25 +0800 Subject: [PATCH] [Chef] Fix compile -a doesn't work on ESP32 (#26095) * [Chef] Fix compile -a doesn't work on ESP32 with `chef.py --automated_test_stamp` we can assign timestamp as software version string when compiling chef sample device. However, this failed on ESP32. On ESP32, I found that it uses PROJECT_VER to overwrite CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING, so I set it in the esp32's CMakeLists.txt * chef.py set default sw_ver_string from "v1.0" to"" * Add comment in examples/chef/esp32/CMakeLists.txt --- examples/chef/chef.py | 5 +++-- examples/chef/esp32/CMakeLists.txt | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index e69d3418fa021d..930309f8ddc07a 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -615,10 +615,11 @@ def main() -> int: f"\"{truncated_sw_ver_string}\" due to 64 bytes limitation") sw_ver_string = truncated_sw_ver_string - flush_print("Building...") - + flush_print(f"Software Version String: \"{sw_ver_string}\"") flush_print( f"Product ID 0x{options.pid:02X} / Vendor ID 0x{options.vid:02X}") + flush_print("Building...") + shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}") if (options.build_target == "esp32") or (options.build_target == "nrfconnect") or (options.build_target == "ameba"): diff --git a/examples/chef/esp32/CMakeLists.txt b/examples/chef/esp32/CMakeLists.txt index f4ea7c13eefede..950e07c59e9d90 100644 --- a/examples/chef/esp32/CMakeLists.txt +++ b/examples/chef/esp32/CMakeLists.txt @@ -46,8 +46,10 @@ idf_build_set_property(COMPILE_OPTIONS "-DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID=$ if(NOT ${CONFIG_DEVICE_PRODUCT_NAME} STREQUAL "") idf_build_set_property(COMPILE_OPTIONS "-DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME=\"${CONFIG_DEVICE_PRODUCT_NAME}\"" APPEND) endif() +# Forwarding the customized software version string to the ESP32 firmware image if(NOT ${CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING} STREQUAL "") idf_build_set_property(COMPILE_OPTIONS "-DCHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING}\"" APPEND) + set(PROJECT_VER ${CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING}) endif() idf_build_set_property(COMPILE_OPTIONS "-DCHIP_PLATFORM_ESP32=1" APPEND)