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
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: