add ability to flash bootloader and compile for maple mini

forumslader-logger
King Kévin 7 years ago
parent f7e1a0b430
commit 845067f513
  1. 18
      Makefile

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

Loading…
Cancel
Save