MARCH ?= rv32imacbzicntr_zicond_zicsr_zifencei_zihintpause_zilsd_zclsd_zabha_zacas_zbkb_zbkx_zcb_zcmp_zcmt

.PHONY: all dump load clean

all: xh3bextm-test.hex

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

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

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

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

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

clean:
	rm -f xh3bextm-test.bin xh3bextm-test.elf xh3bextm-test.o

