makefile 513 B

12345678910111213141516171819202122232425
  1. CC=arm-none-eabi-gcc
  2. CFLAGS=-Wall -mcpu=cortex-m0 -mthumb -nostartfiles -g -Os
  3. LDFLAGS=-T stm32.lnk -static
  4. # some recommend -lnosys --specs=nosys.spec, but they don't seem effective
  5. SOURCES=demo.c crt1.c
  6. OBJECTS=$(SOURCES:.c=.o)
  7. .c.o:
  8. $(CC) $(CFLAGS) -c $<
  9. demo: $(OBJECTS)
  10. $(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) -o $@
  11. all:
  12. klm
  13. clean:
  14. rm $(OBJECTS)
  15. load: demo
  16. arm-none-eabi-objcopy $< -O binary demo.bin
  17. # st-flash write demo.bin 0x08000000
  18. stm32loader -p /dev/ttyUSB0 -e -w -v -V demo.bin