From afe643170f561669fdabe977032e541844ea4368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Autin?= Date: Wed, 1 Mar 2023 13:44:48 +0100 Subject: [PATCH] Automated objdumping of test programs --- test_programs/.gitignore | 4 +++ test_programs/Makefile | 9 +++---- test_programs/Makefile.config | 5 ++-- test_programs/Makefile.dumps | 12 +++++++++ test_programs/Makefile.objdumps | 24 ------------------ test_programs/riscv_instructions/Makefile | 6 +++-- .../riscv_instructions/boolean_logic/Makefile | 4 +++ .../jump_instructions/Makefile | 4 +++ .../simple_arithmerics/unsigned_addition.hex | 15 ----------- .../simple_arithmerics/unsigned_addition.o | Bin 1088 -> 0 bytes .../simple_arithmetics/Makefile | 4 +++ .../README.md | 0 .../unsigned_addition.c | 0 .../unsigned_division.c | 0 .../unsigned_multiplication.c | 0 .../unsigned_substraction.c | 0 16 files changed, 39 insertions(+), 48 deletions(-) create mode 100644 test_programs/.gitignore create mode 100644 test_programs/Makefile.dumps delete mode 100644 test_programs/Makefile.objdumps create mode 100644 test_programs/riscv_instructions/boolean_logic/Makefile create mode 100644 test_programs/riscv_instructions/jump_instructions/Makefile delete mode 100644 test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.hex delete mode 100644 test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.o create mode 100644 test_programs/riscv_instructions/simple_arithmetics/Makefile rename test_programs/riscv_instructions/{simple_arithmerics => simple_arithmetics}/README.md (100%) rename test_programs/riscv_instructions/{simple_arithmerics => simple_arithmetics}/unsigned_addition.c (100%) rename test_programs/riscv_instructions/{simple_arithmerics => simple_arithmetics}/unsigned_division.c (100%) rename test_programs/riscv_instructions/{simple_arithmerics => simple_arithmetics}/unsigned_multiplication.c (100%) rename test_programs/riscv_instructions/{simple_arithmerics => simple_arithmetics}/unsigned_substraction.c (100%) diff --git a/test_programs/.gitignore b/test_programs/.gitignore new file mode 100644 index 0000000..0a0178a --- /dev/null +++ b/test_programs/.gitignore @@ -0,0 +1,4 @@ +# Ignoring dump files +*.dump +*.o +./target \ No newline at end of file diff --git a/test_programs/Makefile b/test_programs/Makefile index e15867e..662a888 100644 --- a/test_programs/Makefile +++ b/test_programs/Makefile @@ -4,11 +4,10 @@ include $(TOPDIR)/Makefile.config # # Main targets # -objdumps: - $(MAKE) -C riscv_instructions - -programs: - $(MAKE) -C programs +dumps: + $(MAKE) dumps -C riscv_instructions/ + mkdir -p ${TOPDIR}/target + find . -name '*.dump' -exec mv {} ${TOPDIR}/target \; clean: rm -rf $(TOPDIR)/target \ No newline at end of file diff --git a/test_programs/Makefile.config b/test_programs/Makefile.config index fca5849..47436e8 100644 --- a/test_programs/Makefile.config +++ b/test_programs/Makefile.config @@ -11,8 +11,9 @@ RISCV_PREFIX=/opt/riscv/bin/ RISCV_AS = $(RISCV_PREFIX)riscv64-unknown-elf-gcc -x assembler-with-cpp -march=rv64imfd RISCV_GCC = $(RISCV_PREFIX)riscv64-unknown-elf-gcc RISCV_LD = $(RISCV_PREFIX)riscv64-unknown-elf-ld -RISCV_OBJDUMP = $(RISCV_PREFIX)riscv64-unknown-elf-objdump +RISCV_OBJCOPY = $(RISCV_PREFIX)riscv64-unknown-elf-objcopy +DUMP_FORMAT = ihex RISCV_ASFLAGS = $(RISCV_CPPFLAGS) RISCV_CPPFLAGS = #nil RISCV_CFLAGS = -Wall $(RISCV_CPPFLAGS) -march=rv64imfd -RISCV_LDFLAGS = #nil +RISCV_LDFLAGS = #nil \ No newline at end of file diff --git a/test_programs/Makefile.dumps b/test_programs/Makefile.dumps new file mode 100644 index 0000000..a9824c1 --- /dev/null +++ b/test_programs/Makefile.dumps @@ -0,0 +1,12 @@ +include $(TOPDIR)/Makefile.config + +%.o: %.c + $(RISCV_GCC) $(RISCV_CFLAGS) -c $< + + +%.dump: %.o + $(RISCV_OBJCOPY) -j .text -O $(DUMP_FORMAT) $< $@ + +clean: + rm -rf *.o 2> /dev/null + rm -rf *.dump 2> /dev/null \ No newline at end of file diff --git a/test_programs/Makefile.objdumps b/test_programs/Makefile.objdumps deleted file mode 100644 index 78a4520..0000000 --- a/test_programs/Makefile.objdumps +++ /dev/null @@ -1,24 +0,0 @@ -include $(TOPDIR)/Makefile.config - -COVERAGE = $(TOPDIR)/riscv_instructions - -AS = $(RISCV_AS) -c -GCC = $(RISCV_GCC) -LD = $(RISCV_LD) - -INCPATH += -I$(TOPDIR) -I$(COVERAGE) -ASFLAGS = $(RISCV_ASFLAGS) $(INCPATH) -CFLAGS = $(RISCV_CFLAGS) $(INCPATH) - -# Rules -%.a: - $(AR) rcv $@ $^ - -%.o: %.c - $(GCC) $(CFLAGS) -c $< - -%.o: %.s - $(AS) $(ASFLAGS) -c $< - -$(PROGRAMS): - $(LD) $+ -o $@ \ No newline at end of file diff --git a/test_programs/riscv_instructions/Makefile b/test_programs/riscv_instructions/Makefile index 29df4bd..c134d5f 100644 --- a/test_programs/riscv_instructions/Makefile +++ b/test_programs/riscv_instructions/Makefile @@ -1,2 +1,4 @@ -TOPDIR = ../ -include $(TOPDIR)/Makefile.objdumps +dumps: + make dumps -C boolean_logic/ + make dumps -C jump_instructions/ + make dumps -C simple_arithmetics/ \ No newline at end of file diff --git a/test_programs/riscv_instructions/boolean_logic/Makefile b/test_programs/riscv_instructions/boolean_logic/Makefile new file mode 100644 index 0000000..2150f14 --- /dev/null +++ b/test_programs/riscv_instructions/boolean_logic/Makefile @@ -0,0 +1,4 @@ +TOPDIR = ../.. +include $(TOPDIR)/Makefile.dumps + +dumps: comparisons.dump if.dump switch.dump \ No newline at end of file diff --git a/test_programs/riscv_instructions/jump_instructions/Makefile b/test_programs/riscv_instructions/jump_instructions/Makefile new file mode 100644 index 0000000..75b887b --- /dev/null +++ b/test_programs/riscv_instructions/jump_instructions/Makefile @@ -0,0 +1,4 @@ +TOPDIR = ../.. +include $(TOPDIR)/Makefile.dumps + +dumps: jump.dump ret.dump \ No newline at end of file diff --git a/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.hex b/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.hex deleted file mode 100644 index d5a8502..0000000 --- a/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.hex +++ /dev/null @@ -1,15 +0,0 @@ -fe010113 -00813c23 -02010413 -fe042623 -00100793 -fef42423 -fec42783 -00078713 -fe842783 -00f707bb -fef42623 -00000013 -01813403 -02010113 -00008067 \ No newline at end of file diff --git a/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.o b/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.o deleted file mode 100644 index 3d69445f952a67be3ab705cbfff4767457813b8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1088 zcmbtTPfG$(5TE^H>dlfOs6bJ)ARen}M0hZyy!0Jp)y4L(tGG`w2uck40A2hdow{`B zL-aKwq1)CxdoLd^>EgidZ{|1id-G=4y*g?AqtcHefS*xgiLN0CQ)aU#u{q$&K(BzTJ1Eo-zhpy z*(n`aR^j9zRVb1ovEVF)`Mw*phM;YsYbGN7;c>|=_N<17FQoo8HiHT8U(1S&F4UDh7Vwc6_JZu-k2yx?P{NAUgujc6|U6 zTzk}RBGUd3UI~vnBMPK#QyWM#2!OP@p6B?;&9_NxO8aheK%GEzS_yYh&9<szKHD3M2@Ol;0jpwl-wu1f;wd_pwgA)CBF(;eoFR+YByn9csVg8g8X(b_a zf@ZPwYY7@&xc9~}ipb_<4>R`NFpJ}(?vC+O-e`{nlBxaIF}FpF diff --git a/test_programs/riscv_instructions/simple_arithmetics/Makefile b/test_programs/riscv_instructions/simple_arithmetics/Makefile new file mode 100644 index 0000000..d775b97 --- /dev/null +++ b/test_programs/riscv_instructions/simple_arithmetics/Makefile @@ -0,0 +1,4 @@ +TOPDIR = ../.. +include $(TOPDIR)/Makefile.dumps + +dumps: unsigned_addition.dump unsigned_division.dump unsigned_multiplication.dump unsigned_substraction.dump \ No newline at end of file diff --git a/test_programs/riscv_instructions/simple_arithmerics/README.md b/test_programs/riscv_instructions/simple_arithmetics/README.md similarity index 100% rename from test_programs/riscv_instructions/simple_arithmerics/README.md rename to test_programs/riscv_instructions/simple_arithmetics/README.md diff --git a/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.c b/test_programs/riscv_instructions/simple_arithmetics/unsigned_addition.c similarity index 100% rename from test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.c rename to test_programs/riscv_instructions/simple_arithmetics/unsigned_addition.c diff --git a/test_programs/riscv_instructions/simple_arithmerics/unsigned_division.c b/test_programs/riscv_instructions/simple_arithmetics/unsigned_division.c similarity index 100% rename from test_programs/riscv_instructions/simple_arithmerics/unsigned_division.c rename to test_programs/riscv_instructions/simple_arithmetics/unsigned_division.c diff --git a/test_programs/riscv_instructions/simple_arithmerics/unsigned_multiplication.c b/test_programs/riscv_instructions/simple_arithmetics/unsigned_multiplication.c similarity index 100% rename from test_programs/riscv_instructions/simple_arithmerics/unsigned_multiplication.c rename to test_programs/riscv_instructions/simple_arithmetics/unsigned_multiplication.c diff --git a/test_programs/riscv_instructions/simple_arithmerics/unsigned_substraction.c b/test_programs/riscv_instructions/simple_arithmetics/unsigned_substraction.c similarity index 100% rename from test_programs/riscv_instructions/simple_arithmerics/unsigned_substraction.c rename to test_programs/riscv_instructions/simple_arithmetics/unsigned_substraction.c