2019-12-04 00:47:19 +00:00
|
|
|
#=======================================================================
|
|
|
|
# Makefile for riscv-tests/isa
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
|
|
|
XLEN := 32
|
|
|
|
|
|
|
|
src_dir := .
|
|
|
|
|
|
|
|
include $(src_dir)/rv32ui/Makefrag
|
2020-01-02 08:12:13 +00:00
|
|
|
include $(src_dir)/rv32um/Makefrag
|
2019-12-04 00:47:19 +00:00
|
|
|
|
|
|
|
default: all
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Build rules
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
|
|
|
RISCV_PREFIX ?= ../../tools/gnu-mcu-eclipse-riscv-none-gcc-8.2.0-2.2-20190521-0004-win64/bin/riscv-none-embed-
|
|
|
|
RISCV_GCC ?= $(RISCV_PREFIX)gcc
|
|
|
|
RISCV_GCC_OPTS ?= -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles
|
|
|
|
RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump --disassemble-all
|
|
|
|
RISCV_OBJCOPY ?= $(RISCV_PREFIX)objcopy
|
|
|
|
|
|
|
|
|
|
|
|
vpath %.S $(src_dir)
|
|
|
|
|
|
|
|
#------------------------------------------------------------
|
|
|
|
# Build assembly tests
|
|
|
|
|
|
|
|
%.dump: %
|
|
|
|
$(RISCV_OBJDUMP) generated/$< > generated/$@
|
|
|
|
$(RISCV_OBJCOPY) -O verilog generated/$< generated/$<.verilog
|
|
|
|
$(RISCV_OBJCOPY) -O binary generated/$< generated/$<.bin
|
|
|
|
|
|
|
|
|
|
|
|
define compile_template
|
|
|
|
|
|
|
|
$$($(1)_p_tests): $(1)-p-%: $(1)/%.S
|
|
|
|
$$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) -I$(src_dir) -T$(src_dir)/link.ld $$< -o generated/$$@
|
|
|
|
$(1)_tests += $$($(1)_p_tests)
|
|
|
|
|
|
|
|
$(1)_tests_dump = $$(addsuffix .dump, $$($(1)_tests))
|
|
|
|
|
|
|
|
$(1): $$($(1)_tests_dump)
|
|
|
|
|
|
|
|
.PHONY: $(1)
|
|
|
|
|
|
|
|
tests += $$($(1)_tests)
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call compile_template,rv32ui,-march=rv32i -mabi=ilp32))
|
2020-01-02 08:12:13 +00:00
|
|
|
$(eval $(call compile_template,rv32um,-march=rv32im -mabi=ilp32))
|
2019-12-04 00:47:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
tests_verilog = $(addsuffix .verilog, $(tests))
|
|
|
|
tests_dump = $(addsuffix .dump, $(tests))
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------
|
|
|
|
# Default
|
|
|
|
|
|
|
|
all: $(tests_dump)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf generated/*
|
|
|
|
|