aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile13
-rw-r--r--support/make/target-config.mk15
2 files changed, 19 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index c2a60dd..2525c2e 100644
--- a/Makefile
+++ b/Makefile
@@ -41,24 +41,19 @@ include $(MAKEDIR)/target-config.mk
## Compilation flags
##
-GLOBAL_FLAGS := -D$(VECT_BASE_ADDR) \
- -DBOARD_$(BOARD) -DMCU_$(MCU) \
- -DERROR_LED_PORT=$(ERROR_LED_PORT) \
- -DERROR_LED_PIN=$(ERROR_LED_PIN) \
- -D$(DENSITY)
# FIXME: the following allows for deprecated include style, e.g.:
# #include "libmaple.h"
# or
# #include "wirish.h"
# It slows compilation noticeably; remove after 1 release.
-GLOBAL_FLAGS += -I$(LIBMAPLE_PATH)/include/libmaple \
+TARGET_FLAGS += -I$(LIBMAPLE_PATH)/include/libmaple \
-I$(WIRISH_PATH)/include/wirish
GLOBAL_CFLAGS := -Os -g3 -gdwarf-2 -mcpu=cortex-m3 -mthumb -march=armv7-m \
-nostdlib -ffunction-sections -fdata-sections \
- -Wl,--gc-sections $(GLOBAL_FLAGS)
-GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions -Wall $(GLOBAL_FLAGS)
+ -Wl,--gc-sections $(TARGET_FLAGS)
+GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions -Wall $(TARGET_FLAGS)
GLOBAL_ASFLAGS := -mcpu=cortex-m3 -march=armv7-m -mthumb \
- -x assembler-with-cpp $(GLOBAL_FLAGS)
+ -x assembler-with-cpp $(TARGET_FLAGS)
LDFLAGS = -T$(LDDIR)/$(LDSCRIPT) -L$(LDDIR) \
-mcpu=cortex-m3 -mthumb -Xlinker -L $(LD_FAMILY_PATH) \
--gc-sections --print-gc-sections --march=armv7-m -Wall
diff --git a/support/make/target-config.mk b/support/make/target-config.mk
index 1ca6057..ea81b3b 100644
--- a/support/make/target-config.mk
+++ b/support/make/target-config.mk
@@ -1,3 +1,7 @@
+# TARGET_FLAGS are to be passed while compiling, assembling, linking.
+
+TARGET_FLAGS :=
+
# Board-specific configuration values. Flash and SRAM sizes in bytes.
ifeq ($(BOARD), maple)
@@ -6,6 +10,7 @@ ifeq ($(BOARD), maple)
ERROR_LED_PORT := GPIOA
ERROR_LED_PIN := 5
DENSITY := STM32_MEDIUM_DENSITY
+ TARGET_FLAGS += -D$(DENSITY)
endif
ifeq ($(BOARD), maple_native)
@@ -14,6 +19,7 @@ ifeq ($(BOARD), maple_native)
ERROR_LED_PORT := GPIOC
ERROR_LED_PIN := 15
DENSITY := STM32_HIGH_DENSITY
+ TARGET_FLAGS += -D$(DENSITY)
endif
ifeq ($(BOARD), maple_mini)
@@ -22,6 +28,7 @@ ifeq ($(BOARD), maple_mini)
ERROR_LED_PORT := GPIOB
ERROR_LED_PIN := 1
DENSITY := STM32_MEDIUM_DENSITY
+ TARGET_FLAGS += -D$(DENSITY)
endif
ifeq ($(BOARD), maple_RET6)
@@ -30,6 +37,7 @@ ifeq ($(BOARD), maple_RET6)
ERROR_LED_PORT := GPIOA
ERROR_LED_PIN := 5
DENSITY := STM32_HIGH_DENSITY
+ TARGET_FLAGS += -D$(DENSITY)
endif
ifeq ($(BOARD), olimex_stm32_h103)
@@ -38,8 +46,13 @@ ifeq ($(BOARD), olimex_stm32_h103)
ERROR_LED_PORT := GPIOC
ERROR_LED_PIN := 12
DENSITY := STM32_MEDIUM_DENSITY
+ TARGET_FLAGS += -D$(DENSITY)
endif
+TARGET_FLAGS += -DBOARD_$(BOARD) -DMCU_$(MCU) \
+ -DERROR_LED_PORT=$(ERROR_LED_PORT) \
+ -DERROR_LED_PIN=$(ERROR_LED_PIN)
+
# STM32 family-specific configuration values.
# NB: these only work for STM32F1 performance line chips, but those
@@ -63,3 +76,5 @@ ifeq ($(MEMORY_TARGET), jtag)
LDSCRIPT := $(BOARD)/jtag.ld
VECT_BASE_ADDR := VECT_TAB_BASE
endif
+
+TARGET_FLAGS += -D$(VECT_BASE_ADDR)