Makefile-ARM: get uploading to work.

This commit is contained in:
Markus Hitter 2015-07-12 11:30:13 +02:00
parent 3cc81cdba8
commit 9e9e946c6d
1 changed files with 17 additions and 23 deletions

View File

@ -67,31 +67,19 @@ TOOLCHAIN = arm-none-eabi-
# #
##############################################################################
# avrdude, typical for AVR-based architectures.
# Unlike with AVR, there is no one tool for uploading to all chips. Some
# need 'lpc21isp', others (e.g. Arduinos) need 'bossac'.
#
# Flags:
# -c <programmer-type> Typically stk500 or stk500v2.
# -b <baudrate> Upload baud rate. Depends on the bootloader in
# use. Not used for USB programmers.
# -p <mcu type> See MCU above.
# -P <port> Serial port the electronics is connected to.
# -C <config file> Optional, default is /etc/avrdude.conf.
# To deal with this, we simply define the port here and do the rest directly
# in the rules for the 'program' target.
UPLOADER ?= avrdude
# UPLOADER = <path-to-arduino-folder>/hardware/tools/avrdude
ifndef UPLOADER_FLAGS
UPLOADER_FLAGS = -c stk500v2
# UPLOADER_FLAGS += -b 19200
# UPLOADER_FLAGS += -b 57600
UPLOADER_FLAGS += -b 115200
UPLOADER_FLAGS += -p $(MCU)
# UPLOADER_FLAGS += -P COM1
# UPLOADER_FLAGS += -P /dev/ttyACM0
UPLOADER_FLAGS += -P /dev/ttyUSB0
# UPLOADER_FLAGS += -C <path-to-arduino-folder>/hardware/tools/avrdude.conf
endif
# Frequency of the on-chip R/C oscillator or the on-board quartz crystal.
F_CRYSTAL ?= 12000000
# Serial port the electronics is connected to.
UPLOADER_PORT ?= /dev/ttyUSB0
#UPLOADER_PORT ?= /dev/ttyACM0
#UPLOADER_PORT ?= com1
##############################################################################
# #
@ -149,7 +137,13 @@ LIBS = -lm
all: $(PROGRAM).hex $(BUILDDIR)/$(PROGRAM).lst $(BUILDDIR)/$(PROGRAM).sym size
program: $(PROGRAM).hex config.h
$(UPLOADER) $(UPLOADER_FLAGS) -U flash:w:$(PROGRAM).hex
@echo
@echo "To let the bootloader complete his work, connect now PIO0_1 to GND,"
@echo "then press Reset for a moment. The bootloader should begin uploading."
@echo "After being done, disconnect PIO0_1 and press reset again. On a"
@echo "Gen7-ARM, PIO0_1 is the Step pin of the Z stepper driver."
@echo
lpc21isp -control $< $(UPLOADER_PORT) 115200 $(F_CRYSTAL)
$(BUILDDIR)/teacup.elf: $(BUILDDIR)/startup.o