From 4de4954d5e4cec46abc6f4c69a291c84b078b52f Mon Sep 17 00:00:00 2001 From: Eric Evenchick Date: Wed, 28 Jan 2015 11:38:05 -0500 Subject: [PATCH] added build number tagging --- .travis.yml | 2 +- Makefile | 2 ++ Src/usbd_desc.c | 10 +++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6b7c926..cb4682c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,4 @@ before_script: - echo $PATH - @echo 'Installed gcc-arm-none-eabi.' -script: make \ No newline at end of file +script: make BUILD_NUMBER=%{build_number} \ No newline at end of file diff --git a/Makefile b/Makefile index 3a19698..32f9486 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ # user configuration: ####################################### +BUILD_NUMBER ?= 0 # SOURCES: list of sources in the user application SOURCES = main.c usbd_conf.c usbd_cdc_if.c usb_device.c usbd_desc.c stm32f0xx_hal_msp.c stm32f0xx_it.c system_stm32f0xx.c can.c slcan.c @@ -23,6 +24,7 @@ LD_SCRIPT = STM32F042C6_FLASH.ld # USER_DEFS user defined macros USER_DEFS = -D HSI48_VALUE=48000000 -D HSE_VALUE=16000000 +USER_DEFS += -D CANTACT_BUILD_NUMBER=$(BUILD_NUMBER) # USER_INCLUDES: user defined includes USER_INCLUDES = diff --git a/Src/usbd_desc.c b/Src/usbd_desc.c index c7674a5..61bd520 100644 --- a/Src/usbd_desc.c +++ b/Src/usbd_desc.c @@ -56,7 +56,15 @@ /** @defgroup USBD_DESC_Private_Defines * @{ */ -#define CANTACT_SW_VER "v0.1" +#define STRINGIZE_(x) #x +#define STRINGIZE(x) STRINGIZE_(x) + +#if CANTACT_BUILD_NUMBER == 0 + #define CANTACT_SW_VER "dev" +#else + #define CANTACT_SW_VER "b" STRINGIZE(CANTACT_BUILD_NUMBER) +#endif + #define USBD_VID 0xad50 #define USBD_LANGID_STRING 1033 #define USBD_MANUFACTURER_STRING "CANtact"