add ability to flash bootloader and compile for maple mini

This commit is contained in:
King Kévin 2016-01-28 22:59:56 +01:00
parent f7e1a0b430
commit 845067f513
1 changed files with 15 additions and 3 deletions

View File

@ -12,8 +12,8 @@
## along with this library. If not, see <http://www.gnu.org/licenses/>. ## along with this library. If not, see <http://www.gnu.org/licenses/>.
## ##
## this file is based on Makefile from libopencm3 examples ## the make file provide rule to compile and flash firmware for STM32F1 micro-controllers
## available at https://github.com/libopencm3/libopencm3-examples ## it uses libopencm3 and STM32duino-bootloader
# be silent per default, but 'make V=1' will show all compiler calls. # be silent per default, but 'make V=1' will show all compiler calls.
ifneq ($(V),1) ifneq ($(V),1)
@ -24,6 +24,10 @@ endif
# the final binary name (without extension) # the final binary name (without extension)
BINARY = firmware BINARY = firmware
# which development board is used
# supported are: SYSTEM_BOARD, MAPLE_MINI
BOARD = MAPLE_MINI
# source files # source files
LIBS = lib LIBS = lib
CSRC = $(wildcard *.c) CSRC = $(wildcard *.c)
@ -67,7 +71,11 @@ CFLAGS += -I. -I$(INCLUDE_DIR) $(patsubst %,-I%,$(LIBS))
CFLAGS += $(DEFS) CFLAGS += $(DEFS)
# linker script # linker script
ifeq ($(BOARD),SYSTEM_BOARD)
LDSCRIPT = stm32f103x8-dfu.ld LDSCRIPT = stm32f103x8-dfu.ld
else ifeq ($(BOARD),MAPLE_MINI)
LDSCRIPT = stm32f103xb-dfu.ld
endif
# linker flags # linker flags
LDFLAGS += --static -nostartfiles LDFLAGS += --static -nostartfiles
@ -99,7 +107,11 @@ ACMPORT = /dev/ttyACM0
# board specific USB DFU bootloader # board specific USB DFU bootloader
BOOTLOADERS = STM32duino-bootloader BOOTLOADERS = STM32duino-bootloader
ifeq ($(BOARD),SYSTEM_BOARD)
BOOTLOADER = $(BOOTLOADERS)/STM32F1/binaries/generic_boot20_pa1.bin BOOTLOADER = $(BOOTLOADERS)/STM32F1/binaries/generic_boot20_pa1.bin
else ifeq ($(BOARD),MAPLE_MINI)
BOOTLOADER = $(BOOTLOADERS)/STM32F1/binaries/maple_mini_boot20.bin
endif
# verify if STM32duino-bootloader has been downloaded # verify if STM32duino-bootloader has been downloaded
BOOTLOADER_EXISTS = $(shell [ -f $(BOOTLOADER) ] && echo 1 || echo 0 ) BOOTLOADER_EXISTS = $(shell [ -f $(BOOTLOADER) ] && echo 1 || echo 0 )
@ -160,7 +172,7 @@ flash-swd: $(BINARY).hex
# reset device by setting the data width to 5 bis on the USB CDC ACM port # reset device by setting the data width to 5 bis on the USB CDC ACM port
reset: reset:
$(Q)stty --file /dev/ttyACM0 115200 raw cs5 $(Q)stty --file $(ACMPORT) 115200 raw cs5
$(Q)sleep 0.5 $(Q)sleep 0.5
flash-dfu: $(BINARY).bin reset flash-dfu: $(BINARY).bin reset