1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-17 20:02:53 +08:00

Adding offset removal to script

-Allows us to remove the pesky 0x80000000 from the RV infrastucture
-They refuse to fix the boot sequence in spike for bare metal
-This is the workaround
This commit is contained in:
Andreas.Olofsson 2020-03-26 12:18:59 -04:00
parent 3c8da0f727
commit bf277f3d2f

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
#############################################################################
# hex2hex <inputfile> <outputfile> <memory-width> [-emf] [-offset]
# hex2hex <inputfile> <outputfile> <memory-width> <offset>
#
# Script uses objcopy to dump a Verilog comptatible hex file
#
@ -8,6 +8,8 @@
#
# Script also supports creating EMF transactions with one address per data
#
# Offset to remove from all hex addresses
#
#############################################################################
import sys
import re
@ -15,8 +17,8 @@ import re
hexin = sys.argv[1]
hexout = sys.argv[2]
width = int(int(sys.argv[3])/8) #needed for both
offset = int(sys.argv[4],16)
emf = 0 # emf
offset = 0 #TODO: specify as hex offset, only for emf
###################################################
# Read file into list and strip off trail junk
@ -27,7 +29,7 @@ list = [line.rstrip(' \n') for line in open(hexin)]
fileout=open(hexout,"w")
for line in list:
if (~line.find('@')): #detects new memory section
address = offset + int(int(line.replace('@','',1),16)/8)
address = int((int(line.replace('@','',1),16)-offset)/8)
if(emf):
print ("Not Implemented")
else: