cvw/tests/riscof/makefile-memfile

25 lines
1.1 KiB
Plaintext
Raw Normal View History

WORKDIR ?= $(WALLY)/tests/riscof/work/
2022-02-03 01:15:11 +00:00
ELFFILES ?= $(shell find $(WORKDIR) -type f -regex ".*\.elf")
OBJDUMPFILES ?= $(shell find $(WORKDIR) -type f -regex ".*\.elf.objdump")
2022-02-03 01:15:11 +00:00
MEMFILES ?= $(ELFFILES:.elf=.elf.memfile)
ADDRFILES ?= $(OBJDUMPFILES:.objdump=.objdump.addr)
2022-02-03 01:15:11 +00:00
.PHONY: wally-sim-files
wally-sim-files: $(MEMFILES) $(ADDRFILES)
2022-02-03 01:15:11 +00:00
# notes to self on how this works.
# The find command locates all of the *.elf files in directory DIR1. A list of .memfiles and
# .addr files are generated from the .elf. These are used as targets.
# % is a wildcard in a make target which is then referenced as % in the depenecies and $*
# in the recipe.
# because elf2hex requires a bit width we use findstring to figure out if the compiled directory
# is XLEN=64 or 32. This is hacky and will likely break in the future.
# the .addr is a separate target so make can split into more jobs and more parallism.
%.elf.memfile: BITWIDTH ?= $(if $(findstring rv64,$*),64,32)
2022-02-03 01:15:11 +00:00
%.elf.memfile: %.elf
riscv64-unknown-elf-elf2hex --bit-width $(BITWIDTH) --input $< --output $@
2022-02-03 01:15:11 +00:00
%.elf.objdump.addr: %.elf.objdump
extractFunctionRadix.sh $<