2 MAKEFLAGS += --no-print-dir
8 CFLAGS += -Wall -Wextra -Werror -Wno-char-subscripts\
9 $(OPT_FLAGS) -std=gnu99 -g3 -MD \
11 LDFLAGS += $(OPT_FLAGS)
17 CROSS_COMPILE ?= arm-none-eabi-
18 CC = $(CROSS_COMPILE)gcc
19 OBJCOPY = $(CROSS_COMPILE)objcopy
22 CFLAGS += -mcpu=cortex-m3 -mthumb \
23 -DSTM32F1 -DDISCOVERY_STLINK \
24 -I../libopencm3/include \
26 LDFLAGS_BOOT := $(LDFLAGS) --specs=nano.specs \
27 -lopencm3_stm32f1 -Wl,--defsym,_stack=0x20005000 \
28 -Wl,-T,bluepill.ld -nostartfiles -lc \
29 -Wl,-Map=mapfile -mthumb -mcpu=cortex-m3 -Wl,-gc-sections \
31 LDFLAGS = $(LDFLAGS_BOOT)
33 LDFLAGS += --specs=nosys.specs
44 $(Q)$(CC) -o $@ $(OBJ) $(LDFLAGS)
48 $(Q)$(CC) $(CFLAGS) -c $< -o $@
52 $(Q)$(OBJCOPY) -O binary $^ $@
56 $(Q)$(OBJCOPY) -O ihex $^ $@
58 .PHONY: clean host_clean FORCE
62 -$(Q)$(RM) -f *.o *.d *~ *.elf *.bin $(HOSTFILES)