From 6b51fc3f9fd988a3c2ef6e33bbe7600984df3ed1 Mon Sep 17 00:00:00 2001 From: Will Hedgecock Date: Wed, 28 Aug 2024 17:21:02 -0500 Subject: [PATCH] Change Firmware Revision string to Git commit hash --- software/firmware/Makefile | 1 + software/firmware/src/app/app_config.h | 1 + software/firmware/src/tasks/bluetooth/device_info_service.c | 2 +- software/firmware/tests/Makefile | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/software/firmware/Makefile b/software/firmware/Makefile index 83b7c3b0..6dccc884 100644 --- a/software/firmware/Makefile +++ b/software/firmware/Makefile @@ -33,6 +33,7 @@ ID_FLASH_LOCATION = 0x001FFFF8 DEFINES = -D_HW_REVISION=$(REVISION) DEFINES += -D_DATETIME="\"$(shell date -u)\"" +DEFINES += -D_FW_REVISION=$(shell cd ../.. && git log --pretty=format:'%h' -n 1) DEFINES += -DPART_$(PART) DEFINES += -D$(PART_DEF) DEFINES += -D'SEGGER_RTT_SECTION="SHARED_RW"' diff --git a/software/firmware/src/app/app_config.h b/software/firmware/src/app/app_config.h index 6be878d3..e6206e48 100644 --- a/software/firmware/src/app/app_config.h +++ b/software/firmware/src/app/app_config.h @@ -66,6 +66,7 @@ typedef enum { BATTERY_EMPTY = 3500, BATTERY_CRITICAL = 3680, BATTERY_NOMINAL = #define MANUFACTURER "Lab11" #define HW_MODEL "TotTag" #define HW_REVISION "Rev. "STRINGIZE_VAL(_HW_REVISION) +#define FW_REVISION "Commit "STRINGIZE_VAL(_FW_REVISION) #define MAX_NUM_CONNECTIONS 2 diff --git a/software/firmware/src/tasks/bluetooth/device_info_service.c b/software/firmware/src/tasks/bluetooth/device_info_service.c index 25a3b56e..5b280574 100644 --- a/software/firmware/src/tasks/bluetooth/device_info_service.c +++ b/software/firmware/src/tasks/bluetooth/device_info_service.c @@ -25,7 +25,7 @@ static const uint8_t deviceInfoModelNum[] = HW_MODEL; static const uint16_t deviceInfoModelNumLen = sizeof(deviceInfoModelNum); static const uint8_t deviceInfoFirmwareVerChar[] = { ATT_PROP_READ, UINT16_TO_BYTES(DEVICE_INFO_FIRMWARE_VER_HANDLE), UINT16_TO_BYTES(ATT_UUID_FIRMWARE_REV) }; static const uint16_t deviceInfoFirmwareVerCharLen = sizeof(deviceInfoFirmwareVerChar); -static const uint8_t deviceInfoFirmwareVer[] = __DATE__; +static const uint8_t deviceInfoFirmwareVer[] = FW_REVISION; static const uint16_t deviceInfoFirmwareVerLen = sizeof(deviceInfoFirmwareVer); static const uint8_t deviceInfoHardwareVerChar[] = { ATT_PROP_READ, UINT16_TO_BYTES(DEVICE_INFO_HARDWARE_VER_HANDLE), UINT16_TO_BYTES(ATT_UUID_HARDWARE_REV) }; static const uint16_t deviceInfoHardwareVerCharLen = sizeof(deviceInfoHardwareVerChar); diff --git a/software/firmware/tests/Makefile b/software/firmware/tests/Makefile index 7dba8d15..bcb2f6aa 100644 --- a/software/firmware/tests/Makefile +++ b/software/firmware/tests/Makefile @@ -32,6 +32,7 @@ ID_FLASH_LOCATION = 0x001FFFF8 DEFINES = -D_HW_REVISION=$(REVISION) DEFINES += -D_DATETIME="\"$(shell date -u)\"" +DEFINES += -D_FW_REVISION=$(shell cd ../../.. && git log --pretty=format:'%h' -n 1) DEFINES += -DPART_$(PART) DEFINES += -D$(PART_DEF) DEFINES += -D'SEGGER_RTT_SECTION="SHARED_RW"'