Skip to content

Provide build and run flow for spike, rev, and host #378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/syscalls/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.tmp
*.dSYM
*.spike
*.d
6 changes: 5 additions & 1 deletion test/syscalls/mkinc/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ else
$(error unknown TARG $(TARG))
endif

.PHONY: clean
clean:
rm -f $(TESTNAME).exe $(TESTNAME).d StatisticOutput.csv $(TESTNAME).spike

.PHONY: help
help:
@echo "# REV defaults"
@echo "make clean & make"
@echo "make clean run"
@echo "# Alternate targets"
@echo "make TARG=host clean run"
@echo "TODO make TARG=spike clean run"
@echo "make TARG=spike clean run"

#-- EOF
3 changes: 2 additions & 1 deletion test/syscalls/mkinc/rev.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#

ifndef REVHOME
$(error REVHOME not defined)
$(error REVHOME not defined)
endif

REV_ARCH ?= rv64imafdc
Expand All @@ -24,6 +24,7 @@ CC="${RVCC}"
CCOPTS += -march=$(REV_ARCH) $(INCLUDES)
CCOPTS += -I$(REVHOME)/common/syscalls
CCOPTS += -I$(REVHOME)/test/include
CCOPTS += -DREV_TARGET

.PHONY: run

Expand Down
38 changes: 37 additions & 1 deletion test/syscalls/mkinc/spike.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,42 @@
# See LICENSE in the top level directory for licensing details
#

$(error SPIKE NOT SUPPORTED YET)
SPIKE ?= spike

ifeq (, $(shell which $(SPIKE)))
$(error $(SPIKE) not found)
endif

SPIKE_ARCH ?= rv64imafdc

CC="${RVCC}"
CCOPTS += -march=$(SPIKE_ARCH) $(INCLUDES)
CCOPTS += -I$(REVHOME)/common/syscalls
CCOPTS += -I$(REVHOME)/test/include
CCOPTS += -DSPIKE_TARGET

.PHONY: run

all: $(TESTNAME).exe

STATIC = -static
$(TESTNAME).exe: $(SOURCES)
$(CC) $(CCOPTS) -o $(TESTNAME).exe $^ $(STATIC)

ifdef RVOBJDUMP
all: $(TESTNAME).d
$(TESTNAME).d: $(TESTNAME).exe
$(RVOBJDUMP) -dC -Mno-aliases --source $< > $@
endif

#SPIKE_OPTS=

run: $(TESTNAME).spike

ifdef ARGS
PROG_ARGS = $(ARGS)
endif
$(TESTNAME).spike: $(TESTNAME).exe
$(SPIKE) $(SPIKE_OPTS) -l --log=$@ --isa=$(SPIKE_ARCH) pk $(TESTNAME).exe $(PROG_ARGS)

#-- EOF
2 changes: 1 addition & 1 deletion test/syscalls/open/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <string.h>
#include <unistd.h>

#ifndef HOST_TARGET
#ifdef REV_TARGET
// REV fast printf and tracing macros
#include "rev-macros.h"
#include "syscalls.h"
Expand Down
5 changes: 0 additions & 5 deletions test/syscalls/printf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,9 @@ REV_VERBOSE?=0

ifndef REVHOME
$(error REVHOME is not defined)
else
$(info REVHOME is $(REVHOME))
endif

include $(REVHOME)/test/syscalls/mkinc/common.mk

.PHONY: clean
clean:
rm -f $(TESTNAME).exe $(TESTNAME).d StatisticOutput.csv

#-- EOF
2 changes: 1 addition & 1 deletion test/syscalls/printf/printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stdlib.h>
#include <unistd.h>

#ifndef HOST_TARGET
#ifdef REV_TARGET
#include "rev-macros.h"
#include "rev-printf.h"
#undef assert
Expand Down