Makefile 732 B

1234567891011121314151617181920212223242526272829303132
  1. #
  2. # This Source Code Form is subject to the terms of the MIT License.
  3. # If a copy of the MIT License was not distributed with this file,
  4. # you can obtain one at https://opensource.org/licenses/MIT
  5. #
  6. #compiler flags
  7. CFLAGS = -mthumb -mcpu=cortex-m4 -g3 -O0 -Wall -Wextra
  8. #linker flags
  9. LDFLAGS = -T link.ld -nostartfiles
  10. #cross compiler
  11. CC = arm-none-eabi-gcc
  12. all: main.o swd.o target.o uart.o startup.o system.o
  13. $(CC) $(LDFLAGS) $(CFLAGS) $^ -o img.elf
  14. image.bin: img.elf
  15. arm-none-eabi-objcopy -O binary img.elf $@
  16. flash: image.bin
  17. sudo st-flash write $^ 0x08000000
  18. bin: image.bin
  19. dfu: image.bin
  20. sudo dfu-util --alt 0 -D image.bin --dfuse-address 0x08000000
  21. clean:
  22. rm -f *.o st/startup_stm32f0.o *.elf image.bin tags