Deduce APP_FW_VER from git tag

This commit is contained in:
Philippe Teuwen
2023-09-25 23:32:01 +02:00
parent 2b4e8b2940
commit 963d4d62f1
3 changed files with 16 additions and 3 deletions
+4 -1
View File
@@ -26,7 +26,10 @@ CHAMELEON_LITE := lite
CURRENT_DEVICE_TYPE ?= ${CHAMELEON_ULTRA}
# Versioning information
GIT_VERSION := "$(shell git describe --abbrev=7 --dirty --always --tags)"
GIT_VERSION := $(shell git describe --abbrev=7 --dirty --always --tags)
APP_FW_SEMVER := $(subst v,,$(shell git describe --tags --abbrev=0 --match "v*.*"))
APP_FW_VER_MAJOR := $(word 1,$(subst ., ,$(APP_FW_SEMVER)))
APP_FW_VER_MINOR := $(word 2,$(subst ., ,$(APP_FW_SEMVER)))
# Enable NRF_LOG on SWO pin as UART TX
NRF_LOG_UART_ON_SWO_ENABLED := 0
+7
View File
@@ -401,6 +401,13 @@ CFLAGS += -fno-builtin -fshort-enums
# Versioning flags
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
ifndef APP_FW_VER_MAJOR
$(error APP_FW_VER_MAJOR is not defined, please define it)
endif
ifndef APP_FW_VER_MINOR
$(error APP_FW_VER_MINOR is not defined, please define it)
endif
CFLAGS += -DAPP_FW_VER_MAJOR=$(APP_FW_VER_MAJOR) -DAPP_FW_VER_MINOR=$(APP_FW_VER_MINOR)
# C++ flags common to all targets
CXXFLAGS += $(OPT)
+5 -2
View File
@@ -2,8 +2,11 @@
// version code, 1byte, max = 0 -> 255
#define APP_FW_VER_MAJOR 2
#define APP_FW_VER_MINOR 0
//#define APP_FW_VER_MAJOR 2
//#define APP_FW_VER_MINOR 0
#if !(defined APP_FW_VER_MAJOR && defined APP_FW_VER_MINOR)
#error You need to define APP_FW_VER_MAJOR and APP_FW_VER_MINOR
#endif
// Merge major and minor version code to U16 value.
#define FW_VER_NUM VER_CODE_TO_NUM(APP_FW_VER_MAJOR, APP_FW_VER_MINOR)