diff --git a/cube/Makefile b/cube/Makefile index 365e0ae..d831d26 100644 --- a/cube/Makefile +++ b/cube/Makefile @@ -26,6 +26,9 @@ ifndef NETWORK $(error NETWORK is not set) endif +VERSION := $(shell git rev-parse --short=8 HEAD) + + ###################################### # target ###################################### @@ -178,7 +181,7 @@ endif # compile gcc flags ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -Werror -fdata-sections -ffunction-sections -CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -DNETWORK=$(NETWORK) -Wall -Werror -fdata-sections -ffunction-sections +CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -DNETWORK=$(NETWORK) -DVERSION="\"$(VERSION)\"" -Wall -Werror -fdata-sections -ffunction-sections ifeq ($(DEBUG), 1) CFLAGS += -g -gdwarf-2 diff --git a/cube/User/Src/main2.c b/cube/User/Src/main2.c index 69b5cb2..cce4a54 100644 --- a/cube/User/Src/main2.c +++ b/cube/User/Src/main2.c @@ -35,6 +35,7 @@ void my_setup_2() { show(LED_RED, OFF); show(LED_GREEN, BLINK); logMsg("Application starting"); + logMsg("Version: " VERSION); eepromInit();