mirror of
https://github.com/openhwgroup/cvw.git
synced 2025-06-28 09:36:01 -04:00
Replace fixBinMem.c with objcopy
This commit is contained in:
parent
425da11157
commit
80f3b94057
4 changed files with 3 additions and 50 deletions
|
@ -60,7 +60,7 @@ install: check_write_permissions check_environment
|
||||||
|
|
||||||
dumptvs: check_write_permissions check_environment
|
dumptvs: check_write_permissions check_environment
|
||||||
$(SUDO) mkdir -p $(RISCV)/linux-testvectors
|
$(SUDO) mkdir -p $(RISCV)/linux-testvectors
|
||||||
cd testvector-generation; ./genInitMem.sh
|
./genInitMem.sh
|
||||||
@echo "Testvectors successfully generated."
|
@echo "Testvectors successfully generated."
|
||||||
|
|
||||||
generate: $(DTB) $(IMAGES)
|
generate: $(DTB) $(IMAGES)
|
||||||
|
|
|
@ -46,9 +46,8 @@ echo "Launching QEMU in replay mode!"
|
||||||
-ex "q"
|
-ex "q"
|
||||||
|
|
||||||
echo "Changing Endianness"
|
echo "Changing Endianness"
|
||||||
make fixBinMem
|
objcopy --reverse-bytes=8 -F binary "$rawRamFile" "$ramFile"
|
||||||
./fixBinMem "$rawRamFile" "$ramFile"
|
objcopy --reverse-bytes=8 -F binary "$rawBootmemFile" "$bootmemFile"
|
||||||
./fixBinMem "$rawBootmemFile" "$bootmemFile"
|
|
||||||
rm -f "$rawRamFile" "$rawBootmemFile" "$rawUntrimmedBootmemFile"
|
rm -f "$rawRamFile" "$rawBootmemFile" "$rawUntrimmedBootmemFile"
|
||||||
|
|
||||||
echo "genInitMem.sh completed!"
|
echo "genInitMem.sh completed!"
|
|
@ -1,13 +0,0 @@
|
||||||
SHELL = /bin/sh
|
|
||||||
|
|
||||||
CFLAG = -Wall -g
|
|
||||||
CC = gcc
|
|
||||||
|
|
||||||
all: fixBinMem
|
|
||||||
|
|
||||||
fixBinMem: fixBinMem.c
|
|
||||||
${CC} ${CFLAGS} fixBinMem.c -o fixBinMem
|
|
||||||
chmod +x fixBinMem
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm -f fixBinMem
|
|
|
@ -1,33 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
if (argc < 3){
|
|
||||||
fprintf(stderr, "Expected 2 arguments: <raw GDB dump> <output binary>\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
char* rawGDBfilePath = argv[1];
|
|
||||||
FILE* rawGDBfile;
|
|
||||||
if ((rawGDBfile = fopen(rawGDBfilePath,"rb"))==NULL) {
|
|
||||||
fprintf(stderr, "File not found: %s\n",rawGDBfilePath);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
char* outFilePath = argv[2];
|
|
||||||
FILE* outFile = fopen(outFilePath,"w");
|
|
||||||
uint64_t qemuWord;
|
|
||||||
uint64_t verilogWord;
|
|
||||||
int bytesReturned=0;
|
|
||||||
do {
|
|
||||||
bytesReturned=fread(&qemuWord, 8, 1, rawGDBfile);
|
|
||||||
verilogWord = (((qemuWord>>0 )&0xff)<<56 |
|
|
||||||
((qemuWord>>8 )&0xff)<<48 |
|
|
||||||
((qemuWord>>16)&0xff)<<40 |
|
|
||||||
((qemuWord>>24)&0xff)<<32 |
|
|
||||||
((qemuWord>>32)&0xff)<<24 |
|
|
||||||
((qemuWord>>40)&0xff)<<16 |
|
|
||||||
((qemuWord>>48)&0xff)<<8 |
|
|
||||||
((qemuWord>>56)&0xff)<<0);
|
|
||||||
fwrite(&verilogWord, 8, 1, outFile);
|
|
||||||
} while(bytesReturned!=0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue