Start bluepill skeleton and blinky project.

This commit is contained in:
2018-03-05 23:07:29 -08:00
parent 260a37f13d
commit 71eb73967b
6 changed files with 209 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
# configurables
OBJS :=
TARGET :=
# targets
ELF := $(TARGET).elf
BIN := $(TARGET).bin
# toolchain setup
ARMTC := arm-none-eabi
ARMCC := $(ARMTC)-gcc
CC := $(ARMCC)
LD := $(ARMCC)
ARMSIZE := $(ARMTC)-size
OBJCOPY := $(ARMTC)-objcopy
# compiler options
CPUFLAGS := -mcpu=cortex-m3 -mthumb
CFLAGS := -Wall -Wextra -Os -MD $(CPUFLAGS)
LDFLAGS := $(CPUFLAGS) -nostartfiles -Wl,-T,bluepill.ld
LDLIBS := -lc -lnosys
# programmer options
STARTMEM := 0x8000000
# targets
.PHONY: all
all: $(BIN)
$(ELF): $(OBJS)
$(ARMCC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
$(ARMSIZE) -A $@
$(BIN): $(ELF)
$(OBJCOPY) -O binary $< $@
.PHONY: flash
flash: $(BIN)
st-flash write $(BIN) $(STARTMEM)
.PHONY: erase
erase:
st-flash erase
.PHONY: install
install: erase flash
.PHONY: clean
clean:
rm -f *.o *.bin *.elf *.d *.map