Merge branch 'makefiles' into main

This commit is contained in:
Ross Thompson 2022-02-03 08:33:50 -06:00
commit b642a19e12
2 changed files with 52 additions and 12 deletions

View File

@ -11,24 +11,27 @@ make all:
# *** Build old tests/imperas-riscv-tests for now;
# Delete this part when the privileged tests transition over to tests/wally-riscv-arch-test
# Also delete bin/exe2memfile at that point
make -C ../../tests/imperas-riscv-tests
make -C ../../tests/imperas-riscv-tests XLEN=64
cd ../../tests/imperas-riscv-tests; exe2memfile.pl work/*/*.elf
cd ../../tests/imperas-riscv-tests; extractFunctionRadix.sh work/*/*.elf.objdump
make -C ../../tests/imperas-riscv-tests --jobs
make -C ../../tests/imperas-riscv-tests XLEN=64 --jobs
#cd ../../tests/imperas-riscv-tests; exe2memfile.pl work/*/*.elf
#cd ../../tests/imperas-riscv-tests; extractFunctionRadix.sh work/*/*.elf.objdump
# Build riscv-arch-test 64 and 32-bit versions
make -C ../../addins/riscv-arch-test
make -C ../../addins/riscv-arch-test XLEN=32
cd ../../addins/riscv-arch-test; elf2hex.sh
cd ../../addins/riscv-arch-test; extractFunctionRadix.sh work/*/*/*.elf.objdump
make -C ../../addins/riscv-arch-test --jobs
make -C ../../addins/riscv-arch-test XLEN=32 --jobs
#cd ../../addins/riscv-arch-test; elf2hex.sh
#cd ../../addins/riscv-arch-test; extractFunctionRadix.sh work/*/*/*.elf.objdump
# extractFunctionRadix. ***
# Build wally-riscv-arch-test
make -C ../../tests/wally-riscv-arch-test/
make -C ../../tests/wally-riscv-arch-test/ XLEN=32
cd ../../tests/wally-riscv-arch-test; elf2hex.sh
cd ../../tests/wally-riscv-arch-test; extractFunctionRadix.sh work/*/*/*.elf.objdump
make -C ../../tests/wally-riscv-arch-test/ --jobs
make -C ../../tests/wally-riscv-arch-test/ XLEN=32 --jobs
# build the memfiles and address files.
make -f makefile-memfile wally-sim-files --jobs
#cd ../../tests/wally-riscv-arch-test; elf2hex.sh
#cd ../../tests/wally-riscv-arch-test; extractFunctionRadix.sh work/*/*/*.elf.objdump
# ***extractFunctionRadix
# Only compile Imperas tests if they are installed locally.

View File

@ -0,0 +1,37 @@
ROOT := ../..
SUFFIX := work
ARCHDIR := $(ROOT)/addins/riscv-arch-test
WALLYDIR:= $(ROOT)/tests/wally-riscv-arch-test
IMPERASDIR := $(ROOT)/tests/imperas-riscv-tests
ALLDIRS := $(ARCHDIR)/$(SUFFIX) $(WALLYDIR)/$(SUFFIX) $(IMPERASDIR)/$(SUFFIX)
ELFFILES ?= $(shell find $(ALLDIRS) -type f -regex ".*\.elf")
MEMFILES ?= $(ELFFILES:.elf=.elf.memfile)
ADDRFILES ?= $(ELFFILES:.elf=.elf.objdump.addr)
print:
echo "files in $(ALLDIRS) are $(ELFFILES)."
echo "memfiles are $(MEMFILES)"
.PHONY: all wally-sim-files
all: wally-sim-files
wally-sim-files: $(MEMFILES) $(ADDRFILES)
echo "$@"
# 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: %.elf
riscv64-unknown-elf-elf2hex --bit-width $(if $(findstring rv64,$*),64,32) --input $< --output $@
%.elf.objdump.addr: %.elf.objdump
extractFunctionRadix.sh $<
.PHONY: clean
clean: