From e1c46687c66f58041a2c4c7f444420f7dda9b117 Mon Sep 17 00:00:00 2001 From: Mark Nolan Date: Thu, 2 Jul 2026 10:15:15 +0100 Subject: [PATCH 1/2] DEV-833/DEV-834 Print firmware version in factory test report; make version.h include-safe Add the firmware version (compile-time FW_VERSION_STRING) as the first line of the factory test report, right after TEST START, so a captured report records exactly which build tested the unit. Shared by every firmware that uses this common report code (Shimmer3, Shimmer3R). Move the fw_version_struct definition out of the generated version.h: the generator now emits an extern declaration and each firmware defines the single instance in its main.c. This stops the .version-section object being duplicated across every translation unit that includes version.h (it is pulled in widely via shimmer_definitions.h). Co-Authored-By: Claude Opus 4.8 --- Test/shimmer_test.c | 6 ++++++ scripts/increment_version.sh | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Test/shimmer_test.c b/Test/shimmer_test.c index 36cfb6ab..79b469ba 100644 --- a/Test/shimmer_test.c +++ b/Test/shimmer_test.c @@ -12,6 +12,7 @@ #include #include "log_and_stream_includes.h" +#include "version.h" factory_test_target_t factoryTestTarget = PRINT_TO_DEBUGGER; factory_test_t factoryTestToRun; @@ -23,6 +24,11 @@ uint32_t ShimFactoryTest_run(void) ShimFactoryTest_sendReport("//**************************** TEST START " "************************************//\r\n"); + /* Record the firmware version running this test so the captured report + * documents exactly which build was used for testing. FW_VERSION_STRING is the + * compile-time version baked into this binary. Prints on every report. */ + ShimFactoryTest_sendReport("Firmware version: " FW_VERSION_STRING "\r\n"); + shimmerStatus.testResult = 0; if (factoryTestToRun == FACTORY_TEST_LED_STATES) diff --git a/scripts/increment_version.sh b/scripts/increment_version.sh index cd16b756..f4088ff0 100644 --- a/scripts/increment_version.sh +++ b/scripts/increment_version.sh @@ -109,8 +109,10 @@ typedef struct uint8_t patch; } firmware_version_t; -__attribute__((section(".version"), used)) static const firmware_version_t fw_version_struct - = { .major = FW_VERSION_MAJOR, .minor = FW_VERSION_MINOR, .patch = FW_VERSION_PATCH }; +/* The definition lives in each firmware's main.c so this header can be included + * by multiple translation units without emitting a duplicate object into the + * .version linker section. */ +extern const firmware_version_t fw_version_struct; #endif //VERSION_H EOF From 813f6e084309dc23549ac31fe42bf07234d8dbc8 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2026 09:15:37 +0000 Subject: [PATCH 2/2] Committing clang-format changes --- Test/shimmer_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Test/shimmer_test.c b/Test/shimmer_test.c index 79b469ba..7a58c91e 100644 --- a/Test/shimmer_test.c +++ b/Test/shimmer_test.c @@ -25,8 +25,8 @@ uint32_t ShimFactoryTest_run(void) "************************************//\r\n"); /* Record the firmware version running this test so the captured report - * documents exactly which build was used for testing. FW_VERSION_STRING is the - * compile-time version baked into this binary. Prints on every report. */ + * documents exactly which build was used for testing. FW_VERSION_STRING is + * the compile-time version baked into this binary. Prints on every report. */ ShimFactoryTest_sendReport("Firmware version: " FW_VERSION_STRING "\r\n"); shimmerStatus.testResult = 0;