integration/soc: set use_rom when cpu_reset_address is defined in a rom region.
This commit is contained in:
parent
8808c884c5
commit
ba2f31d43d
|
@ -68,7 +68,7 @@ class BaseSoC(SoCCore):
|
||||||
kwargs["integrated_sram_size"] = 0
|
kwargs["integrated_sram_size"] = 0
|
||||||
kwargs["integrated_rom_size"] = 0
|
kwargs["integrated_rom_size"] = 0
|
||||||
|
|
||||||
# Set CPU variant / reset address
|
# Set CPU variant / reset address
|
||||||
kwargs["cpu_reset_address"] = self.mem_map["spiflash"] + bios_flash_offset
|
kwargs["cpu_reset_address"] = self.mem_map["spiflash"] + bios_flash_offset
|
||||||
|
|
||||||
# CRG --------------------------------------------------------------------------------------
|
# CRG --------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -774,7 +774,6 @@ class SoC(Module):
|
||||||
self.csr.update_alignment(self.cpu.data_width)
|
self.csr.update_alignment(self.cpu.data_width)
|
||||||
# Add Bus Masters/CSR/IRQs
|
# Add Bus Masters/CSR/IRQs
|
||||||
if not isinstance(self.cpu, cpu.CPUNone):
|
if not isinstance(self.cpu, cpu.CPUNone):
|
||||||
self.cpu.use_rom = (reset_address is None)
|
|
||||||
if reset_address is None:
|
if reset_address is None:
|
||||||
reset_address = self.mem_map["rom"]
|
reset_address = self.mem_map["rom"]
|
||||||
self.cpu.set_reset_address(reset_address)
|
self.cpu.set_reset_address(reset_address)
|
||||||
|
@ -854,20 +853,20 @@ class SoC(Module):
|
||||||
|
|
||||||
# SoC CPU Check ----------------------------------------------------------------------------
|
# SoC CPU Check ----------------------------------------------------------------------------
|
||||||
if not isinstance(self.cpu, cpu.CPUNone):
|
if not isinstance(self.cpu, cpu.CPUNone):
|
||||||
for name in ["sram"] + ["rom"] if self.cpu.use_rom else []:
|
if "sram" not in self.bus.regions.keys():
|
||||||
if name not in self.bus.regions.keys():
|
self.logger.error("CPU needs {} Region to be {} as Bus or Linker Region.".format(
|
||||||
self.logger.error("CPU needs {} Region to be {} as Bus or Linker Region.".format(
|
colorer("sram"),
|
||||||
colorer(name),
|
colorer("defined", color="red")))
|
||||||
colorer("defined", color="red")))
|
self.logger.error(self.bus)
|
||||||
self.logger.error(self.bus)
|
raise
|
||||||
raise
|
|
||||||
|
|
||||||
cpu_reset_address_valid = False
|
cpu_reset_address_valid = False
|
||||||
for container in self.bus.regions.values():
|
for name, container in self.bus.regions.items():
|
||||||
if self.bus.check_region_is_in(
|
if self.bus.check_region_is_in(
|
||||||
region = SoCRegion(origin=self.cpu.reset_address, size=self.bus.data_width//8),
|
region = SoCRegion(origin=self.cpu.reset_address, size=self.bus.data_width//8),
|
||||||
container = container):
|
container = container):
|
||||||
cpu_reset_address_valid = True
|
cpu_reset_address_valid = True
|
||||||
|
if name == "rom":
|
||||||
|
self.cpu.use_rom = True
|
||||||
if not cpu_reset_address_valid:
|
if not cpu_reset_address_valid:
|
||||||
self.logger.error("CPU needs {} to be in a {} Region.".format(
|
self.logger.error("CPU needs {} to be in a {} Region.".format(
|
||||||
colorer("reset address 0x{:08x}".format(self.cpu.reset_address)),
|
colorer("reset address 0x{:08x}".format(self.cpu.reset_address)),
|
||||||
|
|
Loading…
Reference in New Issue