mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	add simple debug test for riscv-none-elf-gdb
This commit is contained in:
		
							parent
							
								
									4fad0b0249
								
							
						
					
					
						commit
						c3243caacf
					
				
							
								
								
									
										15
									
								
								tests/debug/simple/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								tests/debug/simple/Makefile
									
									
									
									
									
										Normal file
									
								
							@ -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
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								tests/debug/simple/simple
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/debug/simple/simple
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										19
									
								
								tests/debug/simple/simple.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								tests/debug/simple/simple.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
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);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user