mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
Deduce APP_FW_VER from git tag
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user