Makefile.fe310 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. VPATH += :$(HALPATH)/fe310
  2. VPATH += :$(HALPATH)/fe310/freedom-metal-201908/src
  3. VPATH += :$(HALPATH)/fe310/freedom-metal-201908/src/drivers
  4. VPATH += :$(HALPATH)/fe310/freedom-metal-201908/gloss
  5. EXTRAINCDIRS += $(HALPATH)/fe310 $(HALPATH)/fe310/freedom-metal-201908
  6. #Our hal
  7. SRC += fe310_hal.c
  8. #Rest of freedom metal stuff
  9. SRC += button.c cache.c clock.c cpu.c gpio.c \
  10. interrupt.c led.c lock.c memory.c pmp.c \
  11. privilege.c shutdown.c spi.c switch.c timer.c \
  12. tty.c uart.c time.c synchronize_harts.c
  13. #watchdog.c
  14. SRC += fixed-clock.c fixed-factor-clock.c \
  15. inline.c riscv_clint0.c riscv_cpu.c \
  16. riscv_plic0.c sifive_ccache0.c sifive_fe310-g000_hfrosc.c \
  17. sifive_fe310-g000_hfxosc.c sifive_fe310-g000_lfrosc.c \
  18. sifive_fe310-g000_pll.c \
  19. sifive_fe310-g000_prci.c sifive_fu540-c000_l2.c \
  20. sifive_global-external-interrupts0.c \
  21. sifive_gpio0.c sifive_gpio-buttons.c sifive_gpio-leds.c \
  22. sifive_gpio-switches.c sifive_local-external-interrupts0.c \
  23. sifive_spi0.c sifive_test0.c sifive_uart0.c
  24. SRC += sys_exit.c
  25. #I guess some ASM is cool too
  26. ASRC += entry.S trap.S vector.S crt0.S
  27. MCU_FLAGS = -march=rv32imac -mabi=ilp32 -mcmodel=medlow
  28. CC = riscv64-unknown-elf-gcc
  29. OBJCOPY = riscv64-unknown-elf-objcopy
  30. OBJDUMP = riscv64-unknown-elf-objdump
  31. SIZE = riscv64-unknown-elf-size
  32. AR = riscv64-unknown-elf-ar rcs
  33. NM = riscv64-unknown-elf-nm
  34. #Output Format = Binary for this target
  35. FORMAT = binary
  36. CFLAGS += -ffunction-sections
  37. CPPFLAGS += -ffunction-sections
  38. ASFLAGS += -ffunction-sections
  39. CFLAGS_LAST = -Wno-strict-prototypes
  40. LDFLAGS += --specs=nano.specs -T $(HALPATH)/fe310/metal.default.lds -Wl,--gc-sections -lm -nostartfiles -nostdlib
  41. LDFLAGS += -Wl,--start-group -lc -lgcc -Wl,--end-group
  42. #-lmetal -lmetal-gloss