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...
This commit is contained in:
Jared Boone 2015-08-25 16:33:52 -07:00
parent 4fe145b61d
commit 98773cb62a
5 changed files with 10 additions and 7 deletions

View File

@ -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

View File

@ -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 =

View File

@ -190,7 +190,7 @@ private:
Text text_firmware {
{ 0, 128, 240, 16 },
"Firmware Version git-??????",
"Git Commit Hash " GIT_REVISION,
};
Text text_cpld_hackrf {

View File

@ -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 =

View File

@ -39,6 +39,7 @@ COPT=-std=gnu99 \
-Wall -Wextra -Wstrict-prototypes \
$(CPUFLAGS) \
-DLPC43XX -DLPC43XX_M4 \
-DGIT_REVISION=\"$(GIT_REVISION)\" \
-Os \
-ffunction-sections \
-fdata-sections \