aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2010-08-31 17:39:46 -0400
committerbnewbold <bnewbold@robocracy.org>2010-08-31 17:39:46 -0400
commit02d7b08f0497096f21e41922e0efb54c4ef33bab (patch)
treea7e04293efcba70f37cffcd03c0fcc4c0be7858a /Makefile
parentb2dd49c3141d8a21a4e7c7ef51dee7329f847c30 (diff)
parente03d58f4dab4176514924baa3a1ff430bf5819b8 (diff)
downloadlibrambutan-02d7b08f0497096f21e41922e0efb54c4ef33bab.tar.gz
librambutan-02d7b08f0497096f21e41922e0efb54c4ef33bab.zip
Merge maple-native changes into portable
This compiles for both maple and maple_native but is untested.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 28 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index b1858c7..28cd4f3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,22 @@
.DEFAULT_GOAL := sketch
+# Valid BOARDs: maple, maple_native, ...
BOARD ?= maple
-MAPLE_TARGET ?= flash
+MEMORY_TARGET ?= flash
+
+# USB ID for DFU upload
+VENDOR_ID := 1EAF
+PRODUCT_ID := 0003
+
+# Guess the MCU based on the BOARD (can be overridden )
+ifeq ($(BOARD), maple)
+ MCU := STM32F103RB
+ PRODUCT_ID := 0003
+endif
+ifeq ($(BOARD), maple_native)
+ MCU := STM32F103ZE
+ PRODUCT_ID := 0003
+endif
# Useful paths
SRCROOT := $(dir)
@@ -10,8 +25,9 @@ LIBMAPLE_PATH := libmaple
# Useful variables
GLOBAL_CFLAGS := -Os -g -mcpu=cortex-m3 -mthumb -march=armv7-m -nostdlib \
- -ffunction-sections -fdata-sections -Wl,--gc-sections
-GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions -Wall
+ -ffunction-sections -fdata-sections -Wl,--gc-sections \
+ -DBOARD_$(BOARD) -DMCU_$(MCU)
+GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions -Wall -DBOARD_$(BOARD) -DMCU_$(MCU)
LDDIR := support/ld
@@ -23,20 +39,16 @@ LDFLAGS = -T$(LDDIR)/$(LDSCRIPT) -L$(LDDIR) \
include support/make/build-rules.mk
include support/make/build-templates.mk
-# Maple USB id
-VENDOR_ID := 1EAF
-PRODUCT_ID := 0003
-
# Some target specific things
-ifeq ($(MAPLE_TARGET), ram)
+ifeq ($(MEMORY_TARGET), ram)
VECT_BASE_ADDR := VECT_TAB_RAM
LDSCRIPT := ram.ld
endif
-ifeq ($(MAPLE_TARGET), flash)
+ifeq ($(MEMORY_TARGET), flash)
LDSCRIPT := flash.ld
VECT_BASE_ADDR := VECT_TAB_FLASH
endif
-ifeq ($(MAPLE_TARGET), jtag)
+ifeq ($(MEMORY_TARGET), jtag)
LDSCRIPT := jtag.ld
VECT_BASE_ADDR := VECT_TAB_BASE
endif
@@ -71,7 +83,7 @@ install: $(BUILD_PATH)/$(BOARD).bin
# Force a rebuild if the maple target changed
PREV_BUILD_TYPE = $(shell cat $(BUILD_PATH)/build-type 2>/dev/null)
build-check:
-ifneq ($(PREV_BUILD_TYPE), $(MAPLE_TARGET))
+ifneq ($(PREV_BUILD_TYPE), $(MEMORY_TARGET))
$(shell rm -rf $(BUILD_PATH))
endif
@@ -84,11 +96,11 @@ help:
@echo ""
@echo " libmaple Makefile help"
@echo " ----------------------"
- @echo " Compile targets (default MAPLE_TARGET=flash):"
+ @echo " Compile targets (default MEMORY_TARGET=flash):"
@echo " ram: Compile sketch code to ram"
@echo " flash: Compile sketch code to flash"
@echo " jtag: Compile sketch code to jtag"
- @echo " sketch: Compile sketch code to target MAPLE_TARGET"
+ @echo " sketch: Compile sketch code to target MEMORY_TARGET"
@echo " "
@echo " Programming targets:"
@echo " install: Upload code to target"
@@ -115,10 +127,10 @@ ctags:
@echo "Made tags file for VIM code browsing"
ram:
- @$(MAKE) MAPLE_TARGET=ram --no-print-directory sketch
+ @$(MAKE) MEMORY_TARGET=ram --no-print-directory sketch
flash:
- @$(MAKE) MAPLE_TARGET=flash --no-print-directory sketch
+ @$(MAKE) MEMORY_TARGET=flash --no-print-directory sketch
jtag:
- @$(MAKE) MAPLE_TARGET=jtag --no-print-directory sketch
+ @$(MAKE) MEMORY_TARGET=jtag --no-print-directory sketch