aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile24
-rw-r--r--build-targets.mk2
-rw-r--r--support/make/footer.mk18
-rw-r--r--support/make/header.mk4
-rw-r--r--support/make/target-config.mk6
6 files changed, 40 insertions, 15 deletions
diff --git a/.gitignore b/.gitignore
index f394b3c..ec1e96b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ TAGS
*.swp
arm
cscope*
+.gdbinit
diff --git a/Makefile b/Makefile
index 4b82958..29a03a5 100644
--- a/Makefile
+++ b/Makefile
@@ -51,9 +51,9 @@ GLOBAL_CFLAGS := -Os -g3 -gdwarf-2 -mcpu=cortex-m3 -mthumb -march=armv7-m \
GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions -Wall $(TARGET_FLAGS)
GLOBAL_ASFLAGS := -mcpu=cortex-m3 -march=armv7-m -mthumb \
-x assembler-with-cpp $(TARGET_FLAGS)
-LDFLAGS = $(TARGET_LDFLAGS) -mcpu=cortex-m3 -mthumb -Xlinker \
- --gc-sections --print-gc-sections --march=armv7-m -Wall
-
+LDFLAGS = $(TARGET_LDFLAGS) -mcpu=cortex-m3 -mthumb \
+ -Xlinker --gc-sections -Xlinker --print-gc-sections \
+ -Xassembler --march=armv7-m -Wall
##
## Build rules and useful templates
##
@@ -65,23 +65,23 @@ include $(MAKEDIR)/build-templates.mk
## Set all submodules here
##
-# Try to keep LIBMAPLE_MODULES a simply-expanded variable
-ifeq ($(LIBMAPLE_MODULES),)
- LIBMAPLE_MODULES := $(SRCROOT)/libmaple
-else
- LIBMAPLE_MODULES += $(SRCROOT)/libmaple
-endif
+LIBMAPLE_MODULES += $(SRCROOT)/libmaple
LIBMAPLE_MODULES += $(SRCROOT)/libmaple/usb # The USB module is kept separate
LIBMAPLE_MODULES += $(LIBMAPLE_MODULE_SERIES) # STM32 series submodule in libmaple
LIBMAPLE_MODULES += $(SRCROOT)/wirish
-Official libraries:
+
+# Official libraries:
LIBMAPLE_MODULES += $(SRCROOT)/libraries/Servo
LIBMAPLE_MODULES += $(SRCROOT)/libraries/LiquidCrystal
LIBMAPLE_MODULES += $(SRCROOT)/libraries/Wire
-
-Experimental libraries:
+# Experimental libraries:
LIBMAPLE_MODULES += $(SRCROOT)/libraries/FreeRTOS
+# User modules:
+ifneq ($(USER_MODULES),)
+LIBMAPLE_MODULES += $(USER_MODULES)
+endif
+
# Call each module's rules.mk:
$(foreach m,$(LIBMAPLE_MODULES),$(eval $(call LIBMAPLE_MODULE_template,$(m))))
diff --git a/build-targets.mk b/build-targets.mk
index fb8edc0..aaff2d0 100644
--- a/build-targets.mk
+++ b/build-targets.mk
@@ -1,5 +1,5 @@
# main project target
-$(BUILD_PATH)/main.o: main.cpp
+$(BUILD_PATH)/main.o: $(SRCROOT)/main.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/libmaple.a: $(BUILDDIRS) $(TGT_BIN)
diff --git a/support/make/footer.mk b/support/make/footer.mk
new file mode 100644
index 0000000..2242416
--- /dev/null
+++ b/support/make/footer.mk
@@ -0,0 +1,18 @@
+sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%)
+cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%)
+cppFILES_$(d) := $(cppSRCS_$(d):%=$(d)/%)
+
+OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) \
+ $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) \
+ $(cppFILES_$(d):%.cpp=$(BUILD_PATH)/%.o)
+DEPS_$(d) := $(OBJS_$(d):%.o=%.d)
+
+$(OBJS_$(d)): TGT_CFLAGS := $(CFLAGS_$(d))
+$(OBJS_$(d)): TGT_CXXFLAGS := $(CXXFLAGS_$(d))
+$(OBJS_$(d)): TGT_ASFLAGS := $(ASFLAGS_$(d))
+
+TGT_BIN += $(OBJS_$(d))
+
+-include $(DEPS_$(d))
+d := $(dirstack_$(sp))
+sp := $(basename $(sp))
diff --git a/support/make/header.mk b/support/make/header.mk
new file mode 100644
index 0000000..c85594a
--- /dev/null
+++ b/support/make/header.mk
@@ -0,0 +1,4 @@
+sp := $(sp).x
+dirstack_$(sp) := $(d)
+d := $(dir)
+BUILDDIRS += $(BUILD_PATH)/$(d)
diff --git a/support/make/target-config.mk b/support/make/target-config.mk
index ea5dfd9..278ca3f 100644
--- a/support/make/target-config.mk
+++ b/support/make/target-config.mk
@@ -32,8 +32,10 @@ ifeq ($(MCU_SERIES), stm32f1)
LD_SERIES_PATH := $(LD_SERIES_PATH)/$(MCU_F1_LINE)
endif
-TARGET_LDFLAGS += -T$(LD_SCRIPT_PATH) -L $(LD_SERIES_PATH) \
- -L $(LD_MEM_PATH) -L$(LDDIR)
+TARGET_LDFLAGS += -Xlinker -T$(LD_SCRIPT_PATH) \
+ -Xlinker -L $(LD_SERIES_PATH) \
+ -Xlinker -L $(LD_MEM_PATH) \
+ -Xlinker -L$(LDDIR)
TARGET_FLAGS += -DBOARD_$(BOARD) -DMCU_$(MCU) \
-DERROR_LED_PORT=$(ERROR_LED_PORT) \
-DERROR_LED_PIN=$(ERROR_LED_PIN) \