Commit 19a85bcd authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

sdbfs: generate sdbfs flash image also for SVEC

parent e7b79118
......@@ -21,10 +21,9 @@ import shutil
#class CSDBGenerator :
SDBFS_MAC = "{path}sdbfs-{type}/mac-address"
SDBFS_BSTR = "{path}sdbfs-flash/bitstream"
SDBFS_BSTR = "{path}sdbfs-{type}/bitstream"
SDBFS_IMG = "{path}sdbfs-{type}-{mac}.bin"
GEN_FLASH_CMD = "{path}./gensdbfs -b 65536 {path}sdbfs-flash {img}"
GEN_EEPROM_CMD = "{path}./gensdbfs {path}sdbfs-eeprom {img}"
GEN_FLASH_CMD = "{path}./gensdbfs -b 65536 {path}sdbfs-{type} {img}"
###########################################################
......@@ -37,7 +36,7 @@ def check_mac(mac):
###########################################################
# type can be either "flash" or "eeprom"
# type can be either "spec" or "svec"
def gen_sdb_image(type, mac, bstr, output=None):
if mac and not check_mac(mac):
......@@ -46,7 +45,7 @@ def gen_sdb_image(type, mac, bstr, output=None):
# Translate MAC to be always in XX-XX-XX-XX-XX-XX format
mac = mac.replace(':', '-')
# Get the absolute path where this script resides. This lets us have always
# access to the sdbfs-flash/eeprom structure, no matter where this script is
# access to the sdbfs-spec/svec structure, no matter where this script is
# called.
abs_path = os.path.dirname(os.path.abspath(__file__)) + '/'
......@@ -60,25 +59,20 @@ def gen_sdb_image(type, mac, bstr, output=None):
f.close()
# 2. copy bitstream to SDBFS, if needed
sdbfs_bstr = SDBFS_BSTR.format(path=abs_path) #<abs_path>/sdbfs-flash/bitstream
if type == "flash" and bstr:
sdbfs_bstr = SDBFS_BSTR.format(path=abs_path, type=type) #<abs_path>/sdbfs-<type>/bitstream
if bstr:
print "Including bitstream " + bstr
shutil.copy(bstr, sdbfs_bstr)
elif type == "flash":
#truncate bitstream file if not given for flash
else:
#truncate bitstream file if not given
f = open(sdbfs_bstr, 'wb')
f.truncate()
f.close()
# 3. generate SDBFS image
sdbfs_img = SDBFS_IMG.format(path=abs_path, type=type, mac=mac)
if type == "flash":
# gensdbfs for flash
cmd = GEN_FLASH_CMD.format(path=abs_path, img=sdbfs_img)
elif type == "eeprom":
# gensdbfs for eeprom
cmd = GEN_EEPROM_CMD.format(path=abs_path, img=sdbfs_img)
# gensdbfs for spec/svec
cmd = GEN_FLASH_CMD.format(path=abs_path, type=type, img=sdbfs_img)
subprocess.Popen(cmd, shell=True).wait()
print "Generated " + sdbfs_img
# 4. Copy generated SDBFS image to <output>
......@@ -90,13 +84,13 @@ def gen_sdb_image(type, mac, bstr, output=None):
if __name__ == "__main__":
if len(sys.argv) < 3:
print "Wrong syntax"
print sys.argv[0] + " <flash/eeprom> <mac> [bitstream]"
print sys.argv[0] + " <spec/svec> <mac> [bitstream]"
sys.exit()
type = sys.argv[1]
if type != "flash" and type != "eeprom":
if type != "spec" and type != "svec":
print "Wrong syntax"
print sys.argv[0] + " <flash/eeprom> <mac> [bitstream]"
print sys.argv[0] + " <spec/svec> <mac> [bitstream]"
sys.exit()
#mac = check_mac(sys.argv[2])
......
#
# Even though in I2C eeproms we are going to be a subdirectory, not starting
# at offset zero at all, we want to start at zero *wihin* our space.
# This is actually the default, but stating it is better.
.
position = 0
# Then, we have a number of writable files. By default (i.e. no config)
# all existing files are created as read-only files with current contents
# and exact size.
#
# Allocation granularity is 64 bytes
mac-address
write = 1
maxsize = 6
wr-init
write = 1
maxsize = 256
# each sfp takes 29 bytes, 4 of them fit in 128 bytes
sfp-database
write = 1
maxsize = 128
# I don't know what this is
calibration
write = 1
maxsize = 128
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment