diff options
author | Linus Nordberg <linus@nordberg.se> | 2019-12-19 12:51:30 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2020-01-21 15:50:33 +0100 |
commit | 49d39287252bf0bd2b3fd75e86d07616b56c7fd2 (patch) | |
tree | 19bdfb34d28d36eeb8068626af5ca668b4d4ba20 /src/entropy | |
parent | 6f4f2afe12e419fe5ba2705522fb3867a2452884 (diff) |
Add version and application info to ELF file
Diffstat (limited to 'src/entropy')
-rw-r--r-- | src/entropy/Makefile | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/entropy/Makefile b/src/entropy/Makefile index 68723b8..0285460 100644 --- a/src/entropy/Makefile +++ b/src/entropy/Makefile @@ -1,3 +1,19 @@ +# Application number and version info are included in the ELF file +# symbol table through two global, asbolute symbols. Use nm(1) on an +# ELF file to figure things out. Example: +# nm entropy.elf | awk '/VERSION/{print $1}' + +# Application number: +# - cc20rng: 01 +# - entropy: 02 +APPLICATION = 0x00000002 + +# Version info is four octects, from most significant to least: +# - Major version, two bytes: 00..FFFF +# - Minor version, one byte: 00..FF +# - Patch level, one byte: 00..FF +VERSION = 0x00010000 + # put your *.o targets here, make should handle the rest! SRCS = main.c stm_init.c system_stm32f4xx.c stm32f4xx_it.c stm32f4xx_hal_msp.c @@ -23,7 +39,7 @@ lib: proj: $(PROJ_NAME).elf $(PROJ_NAME).elf: $(SRCS) - $(CC) $(CFLAGS) $^ -o $@ -L$(STD_PERIPH_LIB) -lstmf4 -L$(LDSCRIPT_INC) -T$(MCU_LINKSCRIPT) -g + $(CC) $(CFLAGS) $^ -o $@ -L$(STD_PERIPH_LIB) -lstmf4 -L$(LDSCRIPT_INC) -T$(MCU_LINKSCRIPT) -g -Wl,--defsym=APPLICATION=$(APPLICATION) -Wl,--defsym=VERSION=$(VERSION) $(OBJCOPY) -O ihex $(PROJ_NAME).elf $(PROJ_NAME).hex $(OBJCOPY) -O binary $(PROJ_NAME).elf $(PROJ_NAME).bin $(OBJDUMP) -St $(PROJ_NAME).elf >$(PROJ_NAME).lst |