Skip to content
Snippets Groups Projects
Commit b8b4631d authored by Michael DM Dryden's avatar Michael DM Dryden
Browse files

Include firmware git revision in version.

parent 6e4bb2b0
No related merge requests found
Pipeline #101 passed with stage
in 31 seconds
......@@ -193,7 +193,7 @@ arflags-gnu-y := $(ARFLAGS)
asflags-gnu-y := $(ASFLAGS)
cflags-gnu-y := $(CFLAGS)
cxxflags-gnu-y := $(CXXFLAGS)
cppflags-gnu-y := $(CPPFLAGS)
cppflags-gnu-y := $(CPPFLAGS) -D GIT_COMMIT=$(shell cd . && printf "%d" 0x$(shell git rev-parse --short HEAD))
cpuflags-gnu-y :=
dbgflags-gnu-y := $(DBGFLAGS)
libflags-gnu-y := $(foreach LIB,$(LIBS),-l$(LIB))
......@@ -325,7 +325,7 @@ ifeq ($(target_type),lib)
all: $(target) $(project).lss $(project).sym
else
ifeq ($(target_type),elf)
all: prebuild $(target) $(project).lss $(project).sym $(project).hex $(project).bin postbuild
all: getver prebuild $(target) $(project).lss $(project).sym $(project).hex $(project).bin postbuild
endif
endif
......@@ -497,3 +497,8 @@ dfu: AVRDUDE_FLAGS = -p $(AVRDUDE_DEV) -c flip2 -U application:w:$(TARGET):e
flash: $(TARGET)
avrdude $(AVRDUDE_FLAGS)
# get git version
getver:
# $(eval GIT_COMMIT = $(shell printf "%d" 0x$(shell git rev-parse --short HEAD)))
@echo 'GIT_COMMIT = $(GIT_COMMIT)'
......@@ -86,7 +86,10 @@ read_data:
break;
case 'V': //check version
printf("V%u.%u\n", BOARD_VER_MAJOR, BOARD_VER_MINOR);
#define STRING2(x) #x
#define STRING(x) STRING2(x)
#pragma message "GIT_COMMIT = " STRING(GIT_COMMIT)
printf("V%u.%u.%lu\n", BOARD_VER_MAJOR, BOARD_VER_MINOR, GIT_COMMIT);
break;
default:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment