aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common.mk4
-rw-r--r--src/cc20rng/Makefile19
-rw-r--r--src/entropy/Makefile19
3 files changed, 36 insertions, 6 deletions
diff --git a/common.mk b/common.mk
index 9006feb..0d4ecdd 100644
--- a/common.mk
+++ b/common.mk
@@ -35,12 +35,12 @@ OPENOCD_PROC_FILE ?= stm32f4discovery.cfg
# MCU selection parameters
#
-# For the rev08 or rev09 board with an STM32F401RBT6, set -DSTM32F401xC
+# For rev08 and later boards with an STM32F401RBT6, set -DSTM32F401xC
# For Nucleo board with an STM32F401RET6, set -DSTM32F401xE
#
STDPERIPH_SETTINGS ?= -DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F401xC
#
-# For the rev08 or rev09 board (hardware compatible), use rev08.ld.
+# For rev08 and later boards (hardware compatible), use rev08.ld.
# For the Nucleo board, use nucleo.ld.
MCU_LINKSCRIPT ?= rev08.ld
diff --git a/src/cc20rng/Makefile b/src/cc20rng/Makefile
index 6c274be..bc5fce5 100644
--- a/src/cc20rng/Makefile
+++ b/src/cc20rng/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 cc20rng.elf | awk '/VERSION/{print $1}'
+
+# Application number:
+# - cc20rng: 01
+# - entropy: 02
+APPLICATION = 0x00000001
+
+# 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 cc20_prng.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
@@ -34,7 +50,6 @@ c-format:
clang-format-4.0 -style="{IndentWidth: 2}" -i main.c
clean:
- find ./ -name '*~' | xargs rm -f
rm -f *.o
rm -f $(PROJ_NAME).elf
rm -f $(PROJ_NAME).hex
diff --git a/src/entropy/Makefile b/src/entropy/Makefile
index b4c02b3..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,14 +39,13 @@ 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
$(SIZE) $(PROJ_NAME).elf
clean:
- find ./ -name '*~' | xargs rm -f
rm -f *.o
rm -f $(PROJ_NAME).elf
rm -f $(PROJ_NAME).hex