forked from Github_Repos/cvw
		
	changed fix_mem to not use hardcoded file names
This commit is contained in:
		
							parent
							
								
									bb84354a47
								
							
						
					
					
						commit
						3a520cb540
					
				@ -1,11 +1,14 @@
 | 
				
			|||||||
#! /usr/bin/python3
 | 
					#! /usr/bin/python3
 | 
				
			||||||
test_dir = '../'
 | 
					import sys,os
 | 
				
			||||||
gdbMemfileDir = '../linux-testvectors/intermediate-outputs/'
 | 
					
 | 
				
			||||||
fixedMemfileDir = '../linux-testvectors/'
 | 
					if len(sys.argv) != 3:
 | 
				
			||||||
infiles = ['bootmemGDB.txt', 'ramGDB.txt']
 | 
					    sys.exit('Error fix_mem.py expects 2 args:\n fix_mem.py <input filename> <output filename>')
 | 
				
			||||||
outfiles = ['bootmem.txt', 'ram.txt']
 | 
					inputFile = sys.argv[1]
 | 
				
			||||||
for i in range(len(infiles)):
 | 
					outputFile = sys.argv[2]
 | 
				
			||||||
    with open(f'{gdbMemfileDir}{infiles[i]}', 'r') as f:
 | 
					if not os.path.exists(inputFile):
 | 
				
			||||||
        with open(f'{fixedMemfileDir}{outfiles[i]}', 'w') as w:
 | 
					    sys.exit('Error input file '+inputFile+'not found')
 | 
				
			||||||
            for l in f:
 | 
					print('Translating '+os.path.basename(inputFile)+' to '+os.path.basename(outputFile))
 | 
				
			||||||
                w.write(f'{"".join([x[2:] for x in l.split()[:0:-1]])}\n')
 | 
					with open(inputFile, 'r') as f:
 | 
				
			||||||
 | 
					    with open(outputFile, 'w') as w:
 | 
				
			||||||
 | 
					        for l in f:
 | 
				
			||||||
 | 
					            w.write(f'{"".join([x[2:] for x in l.split()[:0:-1]])}\n')
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,8 @@ then
 | 
				
			|||||||
    ($customQemu -M virt -nographic -bios $imageDir/fw_jump.elf -kernel $imageDir/Image -append "root=/dev/vda ro" -initrd $imageDir/rootfs.cpio -d nochain,cpu,in_asm -serial /dev/null -singlestep -gdb tcp::1235 -S 2>/dev/null >/dev/null) &
 | 
					    ($customQemu -M virt -nographic -bios $imageDir/fw_jump.elf -kernel $imageDir/Image -append "root=/dev/vda ro" -initrd $imageDir/rootfs.cpio -d nochain,cpu,in_asm -serial /dev/null -singlestep -gdb tcp::1235 -S 2>/dev/null >/dev/null) &
 | 
				
			||||||
    riscv64-unknown-elf-gdb -x gdbinit_mem
 | 
					    riscv64-unknown-elf-gdb -x gdbinit_mem
 | 
				
			||||||
    echo "Translating Mem from GDB to Questa format"
 | 
					    echo "Translating Mem from GDB to Questa format"
 | 
				
			||||||
    ./fix_mem.py
 | 
					    ./fix_mem.py "$testVecDir/intermediate-outputs/bootmemGDB.txt" "$testVecDir/bootmem.txt"
 | 
				
			||||||
 | 
					    ./fix_mem.py "$testVecDir/intermediate-outputs/ramGDB.txt" "$testVecDir/ram.txt"
 | 
				
			||||||
    echo "Done"
 | 
					    echo "Done"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    echo "Creating debugging objdump of linux image"
 | 
					    echo "Creating debugging objdump of linux image"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user