mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Finally got Makefile working for Quads on GCC 14
This commit is contained in:
parent
b64f3f05f8
commit
0f571045b9
@ -1,36 +1,43 @@
|
|||||||
CEXT := c
|
# Disable builtin rules because they are a shorter (but incorrect) path that Make will use by default
|
||||||
CPPEXT := cpp
|
MAKEFLAGS += --no-builtin-rules
|
||||||
AEXT := s
|
SRCDIR := .
|
||||||
SEXT := S
|
SRCEXT := S
|
||||||
SRCEXT := \([$(CEXT)$(AEXT)$(SEXT)]\|$(CPPEXT)\)
|
AEXT := s
|
||||||
#SRCS = $(wildcard *.S)
|
OBJEXT := o
|
||||||
#PROGS = $(patsubst %.S,%,$(SRCS))
|
EXEEXT := elf
|
||||||
SRCDIR = .
|
|
||||||
SRCEXT = S
|
|
||||||
SOURCES ?= $(shell find $(SRCDIR) -type f -regex ".*\.$(SRCEXT)" | sort)
|
SOURCES ?= $(shell find $(SRCDIR) -type f -regex ".*\.$(SRCEXT)" | sort)
|
||||||
OBJEXT = elf
|
ELFS := $(SOURCES:.$(SRCEXT)=.$(EXEEXT))
|
||||||
OBJECTS := $(SOURCES:.$(SEXT)=.$(OBJEXT))
|
OBJDUMPS := $(addsuffix .objdump, $(ELFS))
|
||||||
|
MEMFILES := $(addsuffix .memfile, $(ELFS))
|
||||||
|
|
||||||
all: $(OBJECTS)
|
all: $(OBJDUMPS) $(MEMFILES)
|
||||||
|
|
||||||
elf.o.objdump: %.elf
|
# Create dissassembly
|
||||||
|
%.elf.objdump: %.elf
|
||||||
|
riscv64-unknown-elf-objdump -S -D $< > $@
|
||||||
|
extractFunctionRadix.sh $@
|
||||||
|
|
||||||
# Change many things if bit width isn't 64
|
# Create memfile
|
||||||
%.elf: $(SRCDIR)/%.$(SEXT) WALLY-init-lib.h Makefile
|
%.elf.memfile: %.elf
|
||||||
riscv64-unknown-elf-gcc -E -Wall -g -o $*.s -march=rv64gqc_zfa_zba_zbb_zbc_zbs_zfh_zicboz_zicbop_zicbom_zbkb_zbkx_zknd_zkne_zknh -mabi=lp64 -mcmodel=medany -nostartfiles -T../../examples/link/link.ld $<
|
riscv64-unknown-elf-elf2hex --bit-width 64 --input $< --output $@
|
||||||
riscv64-unknown-elf-as -g -o $*.o -march=rv64gqc_zfa_zba_zbb_zbc_zbs_zfh_zicboz_zicbop_zicbom_zbkb_zbkx_zknd_zkne_zknh -mabi=lp64 $*.s
|
|
||||||
riscv64-unknown-elf-gcc -g -o $@ -mabi=lp64 -mcmodel=medany -nostartfiles -T../../examples/link/link.ld $*.o
|
|
||||||
riscv64-unknown-elf-objdump -S -D $@ > $@.objdump
|
|
||||||
riscv64-unknown-elf-elf2hex --bit-width 64 --input $@ --output $@.memfile
|
|
||||||
extractFunctionRadix.sh $@.objdump
|
|
||||||
|
|
||||||
sim: %.elf
|
# Link object file to create executable
|
||||||
|
.PRECIOUS: %.$(EXEEXT)
|
||||||
|
%.$(EXEEXT): %.$(OBJEXT)
|
||||||
|
riscv64-unknown-elf-gcc -g -o $@ -mcmodel=medany -nostartfiles -T../../examples/link/link.ld $*.o
|
||||||
|
|
||||||
|
# Assemble into object files
|
||||||
|
%.$(OBJEXT): %.$(AEXT)
|
||||||
|
riscv64-unknown-elf-as -g -o $@ -march=rv64gqc_zfa_zba_zbb_zbc_zbs_zfh_zicboz_zicbop_zicbom_zbkb_zbkx_zknd_zkne_zknh -mabi=lp64 $<
|
||||||
|
|
||||||
|
# Preprocess assembly files
|
||||||
|
%.$(AEXT): %.$(SRCEXT) WALLY-init-lib.h
|
||||||
|
riscv64-unknown-elf-gcc -E -g -o $@ $<
|
||||||
|
|
||||||
|
sim: %.$(EXEEXT)
|
||||||
spike +signature=%.signature.output +signature-granularity=8 %.elf
|
spike +signature=%.signature.output +signature-granularity=8 %.elf
|
||||||
diff --ignore-case %.signature.output %.reference_output || exit
|
diff --ignore-case %.signature.output %.reference_output || exit
|
||||||
echo "Signature matches! Success!"
|
echo "Signature matches! Success!"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.elf *.objdump *.signature.output *.addr *.lab *.memfile *.o *.s
|
rm -f *.elf *.objdump *.signature.output *.addr *.lab *.memfile *.o *.s
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user