aboutsummaryrefslogtreecommitdiff
path: root/stmhal/Makefile
diff options
context:
space:
mode:
authorDave Hylands2015-08-02 10:42:09 -0700
committerDamien George2015-08-07 08:46:43 +0100
commitbe66a9ecf60eac18e08eda7bddf4b3481459c9f2 (patch)
treec65961e63c47efda30210bf775b8d2bdcc3d4f1b /stmhal/Makefile
parent4836bcc957e970c93c02bfd465a35dba5da157ee (diff)
stmhal: Generate modstm constants per build
This causes unnecessary constants to no longer be generated. Some constants (like UART_BRR) are different between the F4 and F7
Diffstat (limited to 'stmhal/Makefile')
-rw-r--r--stmhal/Makefile14
1 files changed, 13 insertions, 1 deletions
diff --git a/stmhal/Makefile b/stmhal/Makefile
index 80a7c503a..9c278cc4f 100644
--- a/stmhal/Makefile
+++ b/stmhal/Makefile
@@ -13,7 +13,7 @@ include ../py/mkenv.mk
include boards/$(BOARD)/mpconfigboard.mk
# qstr definitions (must come before including py.mk)
-QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h
+QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h $(BUILD)/modstm_qstr.h
# include py core make definitions
include ../py/py.mk
@@ -325,6 +325,18 @@ $(BUILD)/%_$(BOARD).c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h $(BUILD)/
$(BUILD)/pins_$(BOARD).o: $(BUILD)/pins_$(BOARD).c
$(call compile_c)
+GEN_STMCONST_HDR = $(HEADER_BUILD)/modstm_const.h
+GEN_STMCONST_QSTR = $(BUILD)/modstm_qstr.h
+CMSIS_MCU_LOWER = $(shell echo $(CMSIS_MCU) | tr '[:upper:]' '[:lower:]')
+CMSIS_MCU_HDR = cmsis/devinc/$(CMSIS_MCU_LOWER).h
+
+$(BUILD)/modstm.o: $(GEN_STMCONST_HDR)
+# Use a pattern rule here so that make will only call make-stmconst.py once to
+# make both modstm_const.h and modstm_qstr.h
+$(HEADER_BUILD)/%_const.h $(BUILD)/%_qstr.h: $(CMSIS_MCU_HDR) make-stmconst.py
+ $(ECHO) "Create stmconst $@"
+ $(Q)$(PYTHON) make-stmconst.py --qstr $(GEN_STMCONST_QSTR) $(CMSIS_MCU_HDR) > $(GEN_STMCONST_HDR)
+
$(GEN_CDCINF_HEADER): $(GEN_CDCINF_FILE) $(FILE2H)
$(ECHO) "Create $@"
$(Q)$(PYTHON) $(FILE2H) $< > $@