From 98773cb62ac0583679a07bf12c539d1de12016b8 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Tue, 25 Aug 2015 16:33:52 -0700 Subject: [PATCH] Make GIT_REVISION value available within code. Addresses issue #59. No idea what it'll do if the commit is also tagged as a release... --- firmware/Makefile | 8 ++++---- firmware/application/Makefile | 3 ++- firmware/application/ui_setup.hpp | 2 +- firmware/baseband/Makefile | 3 ++- firmware/bootstrap/Makefile | 1 + 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/firmware/Makefile b/firmware/Makefile index fe1faf1a..8049df9f 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -35,7 +35,7 @@ MAKE_SPI_IMAGE=tools/make_spi_image.py DFU_HACKRF=hackrf_one_usb_ram.dfu LICENSE=../LICENSE -REVISION=$(shell git log -n 1 --format=%h) +GIT_REVISION=$(shell git log -n 1 --format=%h) CP=arm-none-eabi-objcopy @@ -66,13 +66,13 @@ $(TARGET_APPLICATION).bin: $(TARGET_APPLICATION).elf $(CP) -O binary $(TARGET_APPLICATION).elf $(TARGET_APPLICATION).bin $(TARGET_BASEBAND).elf: always_check - @$(MAKE) -s -C $(PATH_BASEBAND) + @$(MAKE) -s -e GIT_REVISION=$(GIT_REVISION) -C $(PATH_BASEBAND) $(TARGET_APPLICATION).elf: always_check - @$(MAKE) -s -C $(PATH_APPLICATION) + @$(MAKE) -s -e GIT_REVISION=$(GIT_REVISION) -C $(PATH_APPLICATION) $(TARGET_BOOTSTRAP).elf: always_check - @$(MAKE) -s -C $(PATH_BOOTSTRAP) + @$(MAKE) -s -e GIT_REVISION=$(GIT_REVISION) -C $(PATH_BOOTSTRAP) clean: rm -f $(TARGET).bin diff --git a/firmware/application/Makefile b/firmware/application/Makefile index 879c2501..b212639c 100755 --- a/firmware/application/Makefile +++ b/firmware/application/Makefile @@ -254,7 +254,8 @@ CPPWARN = -Wall -Wextra # TODO: Switch -DCRT0_INIT_DATA depending on load from RAM or SPIFI? # NOTE: _RANDOM_TCC to kill a GCC 4.9.3 error with std::max argument types DDEFS = -DLPC43XX -DLPC43XX_M0 -D__NEWLIB__ -DHACKRF_ONE \ - -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D_RANDOM_TCC=0 + -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D_RANDOM_TCC=0 \ + -DGIT_REVISION=\"$(GIT_REVISION)\" # List all default ASM defines here, like -D_DEBUG=1 DADEFS = diff --git a/firmware/application/ui_setup.hpp b/firmware/application/ui_setup.hpp index b2f975bd..3b0bae08 100644 --- a/firmware/application/ui_setup.hpp +++ b/firmware/application/ui_setup.hpp @@ -190,7 +190,7 @@ private: Text text_firmware { { 0, 128, 240, 16 }, - "Firmware Version git-??????", + "Git Commit Hash " GIT_REVISION, }; Text text_cpld_hackrf { diff --git a/firmware/baseband/Makefile b/firmware/baseband/Makefile index 91add4fb..10b327ca 100755 --- a/firmware/baseband/Makefile +++ b/firmware/baseband/Makefile @@ -223,7 +223,8 @@ CPPWARN = -Wall -Wextra # TODO: Switch -DCRT0_INIT_DATA depending on load from RAM or SPIFI? # NOTE: _RANDOM_TCC to kill a GCC 4.9.3 error with std::max argument types DDEFS = -DLPC43XX -DLPC43XX_M4 -D__NEWLIB__ -DHACKRF_ONE \ - -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D_RANDOM_TCC=0 + -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D_RANDOM_TCC=0 \ + -DGIT_REVISION=\"$(GIT_REVISION)\" # List all default ASM defines here, like -D_DEBUG=1 DADEFS = diff --git a/firmware/bootstrap/Makefile b/firmware/bootstrap/Makefile index fc6e5554..85d3c738 100644 --- a/firmware/bootstrap/Makefile +++ b/firmware/bootstrap/Makefile @@ -39,6 +39,7 @@ COPT=-std=gnu99 \ -Wall -Wextra -Wstrict-prototypes \ $(CPUFLAGS) \ -DLPC43XX -DLPC43XX_M4 \ + -DGIT_REVISION=\"$(GIT_REVISION)\" \ -Os \ -ffunction-sections \ -fdata-sections \