From 98701e3b9846d99e4df649c8f8a733e4ba4baffe Mon Sep 17 00:00:00 2001 From: Lowie Deferme Date: Tue, 31 Oct 2023 16:43:42 +0100 Subject: [PATCH] write logs to logdir --- .gitignore | 5 ++++- Makefile | 6 +++++- scripts/run_on_spike.sh | 7 +++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index f02509a..4a545e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ build* deploy* -log* \ No newline at end of file +log* + +# Editor specific +.vscode \ No newline at end of file diff --git a/Makefile b/Makefile index 292743d..495988f 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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) @@ -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 @@ -97,6 +100,7 @@ endif clean: rm -rf $(build_dir) + rm -rf $(log_dir) clean_objs: rm -rf $(build_dir)/**.o diff --git a/scripts/run_on_spike.sh b/scripts/run_on_spike.sh index b31787a..65da491 100755 --- a/scripts/run_on_spike.sh +++ b/scripts/run_on_spike.sh @@ -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 \ No newline at end of file +spike -l --log-commits --log=log/spike_trace.log --isa=RV64gch build/spike/rvh_test.elf &> log/spike_term.log \ No newline at end of file