MARCH ?= rv32imacbzicboz_zicfilp_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zilsd_zimop_zabha_zacas_zalasr_zawrs_zcb_zclsd_zcmop_zcmp_zcmt_zbc_zk_zkr_zks_xh3bextm1p0_xh3misa1p0

.PHONY: all dump load clean

all: clmultest.hex

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

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

dump: clmultest.elf
	riscv32-none-elf-objdump -d clmultest.elf

clmultest.hex: clmultest.elf
	riscv32-none-elf-objcopy -O ihex clmultest.elf clmultest.hex

load: clmultest.hex
	bash -c "wl-copy < clmultest.hex"

clean:
	rm -f clmultest.hex clmultest.elf clmultest.o

