2023-03-22 18:17:17 +00:00
|
|
|
CEXT := c
|
|
|
|
CPPEXT := cpp
|
|
|
|
AEXT := s
|
|
|
|
SEXT := S
|
|
|
|
SRCEXT := \([$(CEXT)$(AEXT)$(SEXT)]\|$(CPPEXT)\)
|
|
|
|
#SRCS = $(wildcard *.S)
|
|
|
|
#PROGS = $(patsubst %.S,%,$(SRCS))
|
|
|
|
SRCDIR = .
|
|
|
|
SRCEXT = S
|
|
|
|
SOURCES ?= $(shell find $(SRCDIR) -type f -regex ".*\.$(SRCEXT)" | sort)
|
|
|
|
OBJEXT = elf
|
|
|
|
OBJECTS := $(SOURCES:.$(SEXT)=.$(OBJEXT))
|
2023-03-21 13:57:03 +00:00
|
|
|
|
2023-03-22 18:17:17 +00:00
|
|
|
all: $(OBJECTS)
|
2023-03-21 13:57:03 +00:00
|
|
|
|
2023-03-22 18:17:17 +00:00
|
|
|
%.elf.objdump: %.elf
|
|
|
|
|
2023-03-23 17:55:32 +00:00
|
|
|
# Change many things if bit width isn't 64
|
2023-03-22 18:17:17 +00:00
|
|
|
%.elf: $(SRCDIR)/%.$(SEXT) WALLY-init-lib.h Makefile
|
2023-03-29 04:13:25 +00:00
|
|
|
riscv64-unknown-elf-gcc -g -o $@ -march=rv64gqc_zba_zbb_zbc_zbs_zfh -mabi=lp64 -mcmodel=medany \
|
2023-03-22 18:17:17 +00:00
|
|
|
-nostartfiles -T../../examples/link/link.ld $<
|
2023-03-23 17:55:32 +00:00
|
|
|
riscv64-unknown-elf-objdump -S $@ > $@.objdump
|
2023-03-22 20:00:10 +00:00
|
|
|
riscv64-unknown-elf-elf2hex --bit-width 64 --input $@ --output $@.memfile
|
2023-03-22 18:17:17 +00:00
|
|
|
extractFunctionRadix.sh $@.objdump
|
2023-03-22 11:37:13 +00:00
|
|
|
|
|
|
|
sim: %.elf
|
|
|
|
spike +signature=%.signature.output +signature-granularity=8 %.elf
|
|
|
|
diff --ignore-case %.signature.output %.reference_output || exit
|
2023-03-21 13:57:03 +00:00
|
|
|
echo "Signature matches! Success!"
|
|
|
|
|
|
|
|
clean:
|
2023-03-22 20:00:10 +00:00
|
|
|
rm -f *.elf *.objdump *.signature.output *.addr *.lab *.memfile
|
2023-03-21 13:57:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|