Automated objdumping of test programs

This commit is contained in:
François Autin 2023-03-01 13:44:48 +01:00
parent b863315030
commit afe643170f
No known key found for this signature in database
GPG Key ID: 343F5D382E1DD77C
16 changed files with 39 additions and 48 deletions

4
test_programs/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignoring dump files
*.dump
*.o
./target

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 $@

View File

@ -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/

View File

@ -0,0 +1,4 @@
TOPDIR = ../..
include $(TOPDIR)/Makefile.dumps
dumps: comparisons.dump if.dump switch.dump

View File

@ -0,0 +1,4 @@
TOPDIR = ../..
include $(TOPDIR)/Makefile.dumps
dumps: jump.dump ret.dump

View File

@ -1,15 +0,0 @@
fe010113
00813c23
02010413
fe042623
00100793
fef42423
fec42783
00078713
fe842783
00f707bb
fef42623
00000013
01813403
02010113
00008067

View File

@ -0,0 +1,4 @@
TOPDIR = ../..
include $(TOPDIR)/Makefile.dumps
dumps: unsigned_addition.dump unsigned_division.dump unsigned_multiplication.dump unsigned_substraction.dump