diff --git a/tests/debug/simple/Makefile b/tests/debug/simple/Makefile new file mode 100644 index 000000000..be8214e5e --- /dev/null +++ b/tests/debug/simple/Makefile @@ -0,0 +1,15 @@ +TARGET = simple + +$(TARGET).objdump: $(TARGET) + riscv64-unknown-elf-objdump -S -D $(TARGET) > $(TARGET).objdump + spike $(TARGET) + +$(TARGET): $(TARGET).c Makefile + riscv64-unknown-elf-gcc -o $(TARGET) -g\ + -march=rv64gc -mabi=lp64d -mcmodel=medany \ + -nostdlib -static -lm -fno-tree-loop-distribute-patterns \ + -T../../../examples/C/common/test.ld -I../../../examples/C/common/ \ + $(TARGET).c ../../../examples/C/common/crt.S ../../../examples/C/common/syscalls.c + +clean: + rm -f $(TARGET) $(TARGET).objdump diff --git a/tests/debug/simple/simple b/tests/debug/simple/simple new file mode 100755 index 000000000..7b6435aa9 Binary files /dev/null and b/tests/debug/simple/simple differ diff --git a/tests/debug/simple/simple.c b/tests/debug/simple/simple.c new file mode 100644 index 000000000..b284830d6 --- /dev/null +++ b/tests/debug/simple/simple.c @@ -0,0 +1,19 @@ +#include + +int main() { + + // This is just random simple instructions + // to test the RISC-V debug gdb + asm("li a0, 0x1000"); + asm("addi a1, a0, 0x100"); + asm("addi a2, a1, 0x200"); + asm("li a3, 0x4000000"); + asm("sw a0, 0(a3)"); + asm("sw a1, 4(a3)"); + asm("lw a4, 0(a3)"); + asm("lw a5, 4(a3)"); + asm("lw a5, 4(a3)"); + asm("nop"); + while(1); + +}