]> mj.ucw.cz Git - home-hw.git/blobdiff - mk/bluepill.mk
Programming using serial boot loader
[home-hw.git] / mk / bluepill.mk
index d6146abd72cfbeb495c1999dcfa7f4cf815d722b..e762525e6dbfbd79e562154677c595695292906d 100644 (file)
@@ -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: