FIRMWARE_PATH = ../common GCC_PATH?=/var/tmp/xtang/riscv32i/bin GCC_PREFIX?=riscv32-unknown-elf .SUFFIXES: PATTERN = scff_test_caravel all: ${PATTERN:=.hex} hex: ${PATTERN:=.hex} %.elf: %.c $(FIRMWARE_PATH)/sections.lds $(FIRMWARE_PATH)/start.s ${GCC_PATH}/${GCC_PREFIX}-gcc -march=rv32imc -mabi=ilp32 -Wl,-Bstatic,-T,$(FIRMWARE_PATH)/sections.lds,--strip-debug -ffreestanding -nostdlib -o $@ $(FIRMWARE_PATH)/start.s $< %.hex: %.elf ${GCC_PATH}/${GCC_PREFIX}-objcopy -O verilog $< $@ # to fix flash base address sed -i 's/@10000000/@00000000/g' $@ %.bin: %.elf ${GCC_PATH}/${GCC_PREFIX}-objcopy -O binary $< /dev/stdout | tail -c +1048577 > $@ # ---- Clean ---- clean: rm -f *.elf *.hex *.bin *.vvp *.vcd *.log .PHONY: clean hex all