]> mj.ucw.cz Git - home-hw.git/blobdiff - mk/bluepill.mk
Programming using serial boot loader
[home-hw.git] / mk / bluepill.mk
index bce93a30ddb46501a61f88e195d81fe75968ce05..e762525e6dbfbd79e562154677c595695292906d 100644 (file)
@@ -56,14 +56,14 @@ OBJDUMP             := $(PREFIX)-objdump
 GDB            := $(PREFIX)-gdb
 OPT            := -Os
 DEBUG          := -ggdb3
-CSTD           ?= -std=c99
+CSTD           ?= -std=gnu99
 
 TGT_CFLAGS     += $(OPT) $(CSTD) $(DEBUG)
 TGT_CFLAGS     += $(ARCH_FLAGS)
 TGT_CFLAGS     += -Wall -Wextra -Wshadow -Wimplicit-function-declaration
-TGT_CFLAGS     += -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes
+TGT_CFLAGS     += -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -Wno-parentheses
 TGT_CFLAGS     += -fno-common -ffunction-sections -fdata-sections
-TGT_CFLAGS     += -I. -I../lib
+TGT_CFLAGS     += -I. -I$(ROOT)/lib
 
 TGT_CPPFLAGS   += -MD
 
@@ -105,15 +105,30 @@ ifdef WITH_DFU_FLASH
 
 else
 
+ifdef WITH_SERIAL_FLASH
+
+BOOT_SERIAL ?= /dev/ttyUSB0
+
 %.flash: %.bin
        @printf "  FLASH  $<\n"
-       $(Q)$(ROOT)/bin/st-flash write $(*).bin 0x8000000
+       $(Q)$(ROOT)/bin/stm32flash $(BOOT_SERIAL) -i 'dtr,-dtr' -w $< -g 0
 
 .PHONY: reset
 reset: all
+       $(Q)$(ROOT)/bin/stm32flash $(BOOT_SERIAL) -i 'dtr,-dtr' -g 0
+
+else
+
+%.flash: %.bin
+       @printf "  FLASH  $<\n"
+       $(Q)$(ROOT)/bin/st-flash write $(*).bin 0x8000000
+
+.PHONY: reset
+reset:
        $(ROOT)/bin/st-flash reset
 
 endif
+endif
 
 .SECONDEXPANSION:
 .SECONDARY: