Makefile 931 B

1234567891011121314151617181920212223242526272829303132
  1. CC = arm-none-eabi-gcc
  2. LD = arm-none-eabi-gcc -v
  3. CP = arm-none-eabi-objcopy
  4. OD = arm-none-eabi-objdump
  5. CFLAGS = -I./ -I./lib -I./inc -c -fno-common -O0 -g -mcpu=cortex-m3 -mthumb
  6. LFLAGS = -Tstm32_flash.ld -nostartfiles
  7. ODFLAGS = -S
  8. AR+= -rcs
  9. all: test
  10. clean: -rm build/main.lst build/startup_stm32f10x_ld.o build/main.o build/main.elf build/main.lst build/main.bin
  11. test: main.elf
  12. @ echo "...copying"
  13. $(CP) -O binary build/main.elf build/main.bin
  14. $(CP) -O ihex build/main.elf build/main.hex
  15. $(OD) $(ODFLAGS) build/main.elf > build/main.lst
  16. main.elf: main.o startup.o stm32_flash.ld
  17. @ echo "..linking"
  18. $(LD) $(LFLAGS) -o build/main.elf build/main.o build/startup_stm32f10x_ld.o
  19. main.o: main.c
  20. @ echo ".compiling"
  21. $(CC) $(CFLAGS) main.c -o build/main.o
  22. startup.o: source/startup_stm32f10x_ld.s
  23. @ echo ".compiling"
  24. $(CC) $(CFLAGS) source/startup_stm32f10x_ld.s -o build/startup_stm32f10x_ld.o