aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 15 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 1f19f37..c632ee8 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,12 @@ BOARD_INCLUDE_DIR := $(MAKEDIR)/board-includes
BOARD ?= maple
MEMORY_TARGET ?= flash
+# Chooses the bootloader, available: maple and robotis
+BOOTLOADER ?= maple
+
+# This is the serial port used by robotis bootloader
+ROBOTIS_PORT ?= /dev/ttyACM0
+
# $(BOARD)- and $(MEMORY_TARGET)-specific configuration
include $(MAKEDIR)/target-config.mk
@@ -56,7 +62,8 @@ TARGET_FLAGS += -I$(LIBMAPLE_PATH)/include/libmaple \
TARGET_FLAGS += -I$(LIBRARIES_PATH) # for internal lib. includes, e.g. <Wire/WireBase.h>
GLOBAL_CFLAGS := -Os -g3 -gdwarf-2 -nostdlib \
-ffunction-sections -fdata-sections \
- -Wl,--gc-sections $(TARGET_FLAGS)
+ -Wl,--gc-sections $(TARGET_FLAGS) \
+ -DBOOTLOADER_$(BOOTLOADER)
GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions -Wall $(TARGET_FLAGS)
GLOBAL_ASFLAGS := -x assembler-with-cpp $(TARGET_FLAGS)
LDFLAGS = $(TARGET_LDFLAGS) $(TOOLCHAIN_LDFLAGS) -mcpu=cortex-m3 -mthumb \
@@ -101,12 +108,19 @@ include $(SRCROOT)/build-targets.mk
# USB ID for DFU upload -- FIXME: do something smarter with this
BOARD_USB_VENDOR_ID := 1EAF
BOARD_USB_PRODUCT_ID := 0003
+
+ifeq ($(BOOTLOADER),maple)
UPLOAD_ram := $(SUPPORT_PATH)/scripts/reset.py && \
sleep 1 && \
$(DFU) -a0 -d $(BOARD_USB_VENDOR_ID):$(BOARD_USB_PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R
UPLOAD_flash := $(SUPPORT_PATH)/scripts/reset.py && \
sleep 1 && \
$(DFU) -a1 -d $(BOARD_USB_VENDOR_ID):$(BOARD_USB_PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R
+endif
+
+ifeq ($(BOOTLOADER),robotis)
+UPLOAD_flash := $(SUPPORT_PATH)/scripts/robotis-loader.py $(ROBOTIS_PORT) $(BUILD_PATH)/$(BOARD).bin
+endif
# Conditionally upload to whatever the last build was
install: INSTALL_TARGET = $(shell cat $(BUILD_PATH)/build-type 2>/dev/null)