Makefile 770 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. CROSS = riscv-none-embed-
  2. CC = $(CROSS)gcc
  3. OBJCOPY = $(CROSS)objcopy
  4. ICEPROG = iceprog
  5. CFLAGS=-Wall -Os -march=rv32i -mabi=ilp32 -ffreestanding -flto -nostartfiles -fomit-frame-pointer -Wl,--gc-section
  6. HEADERS=\
  7. config.h \
  8. console.h \
  9. mini-printf.h \
  10. usb_priv.h \
  11. usb_desc_data.h
  12. SOURCES=\
  13. start.S \
  14. console.c \
  15. firmware.c \
  16. mini-printf.c \
  17. usb.c \
  18. usb_ep0.c \
  19. usb_desc.c
  20. firmware.elf: lnk-app.lds $(HEADERS) $(SOURCES)
  21. $(CC) $(CFLAGS) -Wl,-Bstatic,-T,lnk-app.lds,--strip-debug -o $@ $(SOURCES)
  22. boot.elf: lnk-boot.lds boot.S
  23. $(CC) $(CFLAGS) -Wl,-Bstatic,-T,lnk-boot.lds,--strip-debug -o $@ boot.S
  24. %.hex: %.bin
  25. ./bin2hex.py $< $@
  26. %.bin: %.elf
  27. $(OBJCOPY) -O binary $< $@
  28. prog_fw: firmware.bin
  29. $(ICEPROG) -o 1M $<
  30. clean:
  31. rm -f *.bin *.hex *.elf