MARCH ?= rv32imacbzicntr_zicond_zicsr_zifencei_zihintpause_zilsd_zclsd_zabha_zacas_zbkb_zbkx_zcb_zcmp_zcmt

.PHONY: all dump load clean

all: timer-test.hex

timer-test.o: timer-test.S
	riscv32-none-elf-as -I../rvcontroller-libraries -march=${MARCH} -o timer-test.o timer-test.S

timer-test.elf:  timer-test.o
	riscv32-none-elf-ld -T rvcontroller.ld --no-warn-rwx-segments -o timer-test.elf timer-test.o

dump: timer-test.elf
	riscv32-none-elf-objdump -d timer-test.elf

timer-test.hex: timer-test.elf
	riscv32-none-elf-objcopy -O ihex timer-test.elf timer-test.hex

load: timer-test.hex
	bash -c "wl-copy < timer-test.hex"

clean:
	rm -f timer-test.hex timer-test.elf timer-test.o

