Write init files that respect CPU's endianness.
This is required for PicoRV32 support. We also drive-by enable explicit specification of run= in Builder.build() by callers.
This commit is contained in:
parent
7176492231
commit
cf74c781f4
|
@ -130,12 +130,16 @@ class Builder:
|
||||||
def _initialize_rom(self):
|
def _initialize_rom(self):
|
||||||
bios_file = os.path.join(self.output_dir, "software", "bios",
|
bios_file = os.path.join(self.output_dir, "software", "bios",
|
||||||
"bios.bin")
|
"bios.bin")
|
||||||
|
endianness = cpu_interface.cpu_endianness[self.soc.cpu_type]
|
||||||
with open(bios_file, "rb") as boot_file:
|
with open(bios_file, "rb") as boot_file:
|
||||||
boot_data = []
|
boot_data = []
|
||||||
while True:
|
while True:
|
||||||
w = boot_file.read(4)
|
w = boot_file.read(4)
|
||||||
if not w:
|
if not w:
|
||||||
break
|
break
|
||||||
|
if endianness == 'little':
|
||||||
|
boot_data.append(struct.unpack("<I", w)[0])
|
||||||
|
else:
|
||||||
boot_data.append(struct.unpack(">I", w)[0])
|
boot_data.append(struct.unpack(">I", w)[0])
|
||||||
self.soc.initialize_rom(boot_data)
|
self.soc.initialize_rom(boot_data)
|
||||||
|
|
||||||
|
@ -157,9 +161,11 @@ class Builder:
|
||||||
|
|
||||||
if self.gateware_toolchain_path is not None:
|
if self.gateware_toolchain_path is not None:
|
||||||
toolchain_path = self.gateware_toolchain_path
|
toolchain_path = self.gateware_toolchain_path
|
||||||
|
|
||||||
|
if 'run' not in kwargs:
|
||||||
|
kwargs['run'] = self.compile_gateware
|
||||||
vns = self.soc.build(build_dir=os.path.join(self.output_dir, "gateware"),
|
vns = self.soc.build(build_dir=os.path.join(self.output_dir, "gateware"),
|
||||||
run=self.compile_gateware, toolchain_path=toolchain_path,
|
toolchain_path=toolchain_path, **kwargs)
|
||||||
**kwargs)
|
|
||||||
return vns
|
return vns
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue