json2renode: Use spiflash->base instead of flash_boot_address

This commit is contained in:
Mateusz Karlic 2022-09-22 14:41:05 +02:00 committed by Mateusz Karlic
parent 860ca8673e
commit 55dcee16c3
1 changed files with 3 additions and 3 deletions

View File

@ -811,16 +811,16 @@ connector Connect ethmac switch
connector Connect host.tap switch connector Connect host.tap switch
""".format(args.configure_network) """.format(args.configure_network)
elif flash_binaries: elif flash_binaries:
if 'flash_boot_address' not in csr['constants']: if 'spiflash' not in csr['memories']:
print('Warning! There is no flash memory to load binaries to') print('Warning! There is no flash memory to load binaries to')
else: else:
# load binaries to spiflash to boot from there # load binaries to spiflash to boot from there
for offset in flash_binaries: for offset in flash_binaries:
path = flash_binaries[offset] path = flash_binaries[offset]
flash_boot_address = int(csr['constants']['flash_boot_address'], 0) + offset flash_boot_address = int(csr['memories']['spiflash']['base']) + offset
firmware_data = open(path, 'rb').read() firmware_data = open(os.path.expanduser(path), 'rb').read()
crc32 = zlib.crc32(firmware_data) crc32 = zlib.crc32(firmware_data)
result += 'sysbus WriteDoubleWord {} {}\n'.format(hex(flash_boot_address), hex(len(firmware_data))) result += 'sysbus WriteDoubleWord {} {}\n'.format(hex(flash_boot_address), hex(len(firmware_data)))