From bf277f3d2f96761dc506e0cf1f349b068a24d406 Mon Sep 17 00:00:00 2001 From: "Andreas.Olofsson" Date: Thu, 26 Mar 2020 12:18:59 -0400 Subject: [PATCH] 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 --- scripts/hex2hex | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/hex2hex b/scripts/hex2hex index 0ad0f6a..8776c5a 100755 --- a/scripts/hex2hex +++ b/scripts/hex2hex @@ -1,6 +1,6 @@ #!/usr/bin/env python3 ############################################################################# -# hex2hex [-emf] [-offset] +# hex2hex # # 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: