Skip to content

Commit

Permalink
write logs to logdir
Browse files Browse the repository at this point in the history
  • Loading branch information
defermelowie authored and josecm committed Dec 19, 2023
1 parent 2580b65 commit 98701e3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
build*
deploy*
log*
log*

# Editor specific
.vscode
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ $(error Undefined platform)
endif
endif

log_dir:=log
build_dir:=build/$(PLAT)
plat_dir:=platform/$(PLAT)
ifeq ($(wildcard $(plat_dir)),)
$(error unsupported platform $(PLAT))
else
$(shell mkdir -p $(log_dir))
$(shell mkdir -p $(build_dir))
endif

Expand Down Expand Up @@ -59,8 +61,8 @@ ifdef GCCVERSION
else
GENERIC_FLAGS += -march=rv64imac
endif

GENERIC_FLAGS += -mabi=lp64 -g3 -mcmodel=medany -O3 $(inc_dirs)

ASFLAGS = $(GENERIC_FLAGS)
CFLAGS = $(GENERIC_FLAGS)
LDFLAGS = -ffreestanding -nostartfiles -static $(GENERIC_FLAGS)
Expand All @@ -73,6 +75,7 @@ $(TARGET).bin: $(TARGET).elf
$(TARGET).elf: $(objs) $(ld_file_final)
$(CC) $(LDFLAGS) -T$(ld_file_final) $(objs) -o $@
$(OBJDUMP) -S $@ > $(TARGET).asm
$(OBJDUMP) -D $@ > $(TARGET).dump
$(READELF) -a -W $@ > $(@).txt

$(build_dir)/%.o: %.[c,S] $(build_dir)/%.d
Expand All @@ -97,6 +100,7 @@ endif

clean:
rm -rf $(build_dir)
rm -rf $(log_dir)

clean_objs:
rm -rf $(build_dir)/**.o
Expand Down
7 changes: 3 additions & 4 deletions scripts/run_on_spike.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
# Assumes spike is in PATH

# Build tests
make clean;
export PLAT=spike LOG_LEVEL=LOG_WARNING;
make clean
export PLAT=spike LOG_LEVEL=LOG_WARNING
make

# Run tests
mkdir -p log
spike -l --log-commits --log=log/spike.log --isa=RV64gch build/spike/rvh_test.elf
spike -l --log-commits --log=log/spike_trace.log --isa=RV64gch build/spike/rvh_test.elf &> log/spike_term.log

0 comments on commit 98701e3

Please sign in to comment.