mirror of
https://github.com/litex-hub/litex-boards.git
synced 2025-01-03 03:43:36 -05:00
targets: Update and simplify SPI-Flash support (Address is now automatically allocated).
This commit is contained in:
parent
a4130556ac
commit
8151bf7ffa
11 changed files with 53 additions and 53 deletions
|
@ -68,7 +68,6 @@ class _CRG(Module):
|
|||
# BaseSoC ------------------------------------------------------------------------------------------
|
||||
|
||||
class BaseSoC(SoCCore):
|
||||
mem_map = {**SoCCore.mem_map, **{"spiflash": 0x80000000}}
|
||||
def __init__(self, bios_flash_offset, sys_clk_freq=int(24e6), with_led_chaser=True,
|
||||
with_video_terminal=False, **kwargs):
|
||||
platform = icebreaker.Platform()
|
||||
|
@ -78,9 +77,6 @@ class BaseSoC(SoCCore):
|
|||
kwargs["integrated_sram_size"] = 0
|
||||
kwargs["integrated_rom_size"] = 0
|
||||
|
||||
# Set CPU variant / reset address
|
||||
kwargs["cpu_reset_address"] = self.mem_map["spiflash"] + bios_flash_offset
|
||||
|
||||
# SoCCore ----------------------------------------------------------------------------------
|
||||
SoCCore.__init__(self, platform, sys_clk_freq,
|
||||
ident = "LiteX SoC on iCEBreaker",
|
||||
|
@ -112,10 +108,13 @@ class BaseSoC(SoCCore):
|
|||
|
||||
# Add ROM linker region --------------------------------------------------------------------
|
||||
self.bus.add_region("rom", SoCRegion(
|
||||
origin = self.mem_map["spiflash"] + bios_flash_offset,
|
||||
origin = self.bus.regions["spiflash"].origin + bios_flash_offset,
|
||||
size = 32*kB,
|
||||
linker = True)
|
||||
)
|
||||
# Set CPU reset address to ROM.
|
||||
if hasattr(self.cpu, "set_reset_address"):
|
||||
self.cpu.set_reset_address(self.bus.regions["rom"].origin)
|
||||
|
||||
# Video ------------------------------------------------------------------------------------
|
||||
if with_video_terminal:
|
||||
|
|
|
@ -65,7 +65,6 @@ class _CRG(Module):
|
|||
# BaseSoC ------------------------------------------------------------------------------------------
|
||||
|
||||
class BaseSoC(SoCCore):
|
||||
mem_map = {**SoCCore.mem_map, **{"spiflash": 0x80000000}}
|
||||
def __init__(self, bios_flash_offset, sys_clk_freq=int(24e6), revision="v1", **kwargs):
|
||||
platform = icebreaker_bitsy.Platform(revision=revision)
|
||||
|
||||
|
@ -73,9 +72,6 @@ class BaseSoC(SoCCore):
|
|||
kwargs["integrated_sram_size"] = 0
|
||||
kwargs["integrated_rom_size"] = 0
|
||||
|
||||
# Set CPU variant / reset address
|
||||
kwargs["cpu_reset_address"] = self.mem_map["spiflash"] + bios_flash_offset
|
||||
|
||||
# SoCCore ----------------------------------------------------------------------------------
|
||||
SoCCore.__init__(self, platform, sys_clk_freq,
|
||||
ident = "LiteX SoC on iCEBreaker-bitsy",
|
||||
|
@ -107,10 +103,13 @@ class BaseSoC(SoCCore):
|
|||
|
||||
# Add ROM linker region --------------------------------------------------------------------
|
||||
self.bus.add_region("rom", SoCRegion(
|
||||
origin = self.mem_map["spiflash"] + bios_flash_offset,
|
||||
origin = self.bus.regions["spiflash"].origin + bios_flash_offset,
|
||||
size = 32*kB,
|
||||
linker = True)
|
||||
)
|
||||
# Set CPU reset address to ROM.
|
||||
if hasattr(self.cpu, "set_reset_address"):
|
||||
self.cpu.set_reset_address(self.bus.regions["rom"].origin)
|
||||
|
||||
# Build --------------------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -68,7 +68,6 @@ class _CRG(Module):
|
|||
# BaseSoC ------------------------------------------------------------------------------------------
|
||||
|
||||
class BaseSoC(SoCCore):
|
||||
mem_map = {**SoCCore.mem_map, **{"spiflash": 0x80000000}}
|
||||
def __init__(self, bios_flash_offset, spi_flash_module="AT25SF161", sys_clk_freq=int(12e6),
|
||||
with_led_chaser=True, **kwargs):
|
||||
kwargs["uart_name"] = "usb_acm" # Enforce UART to USB-ACM
|
||||
|
@ -78,9 +77,6 @@ class BaseSoC(SoCCore):
|
|||
kwargs["integrated_sram_size"] = 0
|
||||
kwargs["integrated_rom_size"] = 0
|
||||
|
||||
# Set CPU variant / reset address
|
||||
kwargs["cpu_reset_address"] = self.mem_map["spiflash"] + bios_flash_offset
|
||||
|
||||
# Serial -----------------------------------------------------------------------------------
|
||||
# FIXME: do proper install of ValentyUSB.
|
||||
os.system("git clone https://github.com/litex-hub/valentyusb -b hw_cdc_eptri")
|
||||
|
@ -125,10 +121,13 @@ class BaseSoC(SoCCore):
|
|||
|
||||
# Add ROM linker region --------------------------------------------------------------------
|
||||
self.bus.add_region("rom", SoCRegion(
|
||||
origin = self.mem_map["spiflash"] + bios_flash_offset,
|
||||
origin = self.bus.regions["spiflash"].origin + bios_flash_offset,
|
||||
size = 32*kB,
|
||||
linker = True)
|
||||
)
|
||||
# Set CPU reset address to ROM.
|
||||
if hasattr(self.cpu, "set_reset_address"):
|
||||
self.cpu.set_reset_address(self.bus.regions["rom"].origin)
|
||||
|
||||
# Leds -------------------------------------------------------------------------------------
|
||||
if with_led_chaser:
|
||||
|
|
|
@ -61,7 +61,6 @@ class _CRG(Module):
|
|||
# BaseSoC ------------------------------------------------------------------------------------------
|
||||
|
||||
class BaseSoC(SoCCore):
|
||||
mem_map = {**SoCCore.mem_map, **{"spiflash": 0x80000000}}
|
||||
def __init__(self, bios_flash_offset, sys_clk_freq=int(12e6), with_led_chaser=True, **kwargs):
|
||||
platform = lattice_ice40up5k_evn.Platform()
|
||||
|
||||
|
@ -69,9 +68,6 @@ class BaseSoC(SoCCore):
|
|||
kwargs["integrated_sram_size"] = 0
|
||||
kwargs["integrated_rom_size"] = 0
|
||||
|
||||
# Set CPU variant / reset address
|
||||
kwargs["cpu_reset_address"] = self.mem_map["spiflash"] + bios_flash_offset
|
||||
|
||||
# SoCCore ----------------------------------------------------------------------------------
|
||||
SoCCore.__init__(self, platform, sys_clk_freq,
|
||||
ident = "LiteX SoC on Lattice iCE40UP5k EVN breakout board",
|
||||
|
@ -93,10 +89,13 @@ class BaseSoC(SoCCore):
|
|||
|
||||
# Add ROM linker region --------------------------------------------------------------------
|
||||
self.bus.add_region("rom", SoCRegion(
|
||||
origin = self.mem_map["spiflash"] + bios_flash_offset,
|
||||
origin = self.bus.regions["spiflash"].origin + bios_flash_offset,
|
||||
size = 32*kB,
|
||||
linker = True)
|
||||
)
|
||||
# Set CPU reset address to ROM.
|
||||
if hasattr(self.cpu, "set_reset_address"):
|
||||
self.cpu.set_reset_address(self.bus.regions["rom"].origin)
|
||||
|
||||
# Leds -------------------------------------------------------------------------------------
|
||||
if with_led_chaser:
|
||||
|
|
|
@ -57,7 +57,6 @@ class _CRG(Module):
|
|||
# BaseSoC ------------------------------------------------------------------------------------------
|
||||
|
||||
class BaseSoC(SoCCore):
|
||||
mem_map = {**SoCCore.mem_map, **{"spiflash": 0x80000000}}
|
||||
def __init__(self, bios_flash_offset, sys_clk_freq=int(24e6), with_led_chaser=True,
|
||||
with_video_terminal=False, **kwargs):
|
||||
platform = muselab_icesugar.Platform()
|
||||
|
@ -66,9 +65,9 @@ class BaseSoC(SoCCore):
|
|||
kwargs["integrated_sram_size"] = 0
|
||||
kwargs["integrated_rom_size"] = 0
|
||||
|
||||
# Set CPU variant / reset address
|
||||
kwargs["cpu_variant"] = "lite"
|
||||
kwargs["cpu_reset_address"] = self.mem_map["spiflash"] + bios_flash_offset
|
||||
# Set CPU variant
|
||||
if kwargs.get("cpu_type", "vexriscv") == "vexriscv":
|
||||
kwargs["cpu_variant"] = "lite"
|
||||
|
||||
# SoCCore ----------------------------------------------------------------------------------
|
||||
SoCCore.__init__(self, platform, sys_clk_freq,
|
||||
|
@ -90,10 +89,13 @@ class BaseSoC(SoCCore):
|
|||
|
||||
# Add ROM linker region --------------------------------------------------------------------
|
||||
self.bus.add_region("rom", SoCRegion(
|
||||
origin = self.mem_map["spiflash"] + bios_flash_offset,
|
||||
origin = self.bus.regions["spiflash"].origin + bios_flash_offset,
|
||||
size = 32*kB,
|
||||
linker = True)
|
||||
)
|
||||
# Set CPU reset address to ROM.
|
||||
if hasattr(self.cpu, "set_reset_address"):
|
||||
self.cpu.set_reset_address(self.bus.regions["rom"].origin)
|
||||
|
||||
# Leds -------------------------------------------------------------------------------------
|
||||
if with_led_chaser:
|
||||
|
|
|
@ -40,7 +40,8 @@ class BaseSoC(SoCCore):
|
|||
|
||||
|
||||
# Disable CPU for now.
|
||||
kwargs["cpu_type"] = None
|
||||
kwargs["cpu_type"] = None
|
||||
kwargs["integrated_sram_size"] = 0
|
||||
|
||||
# SoCCore ----------------------------------------------------------------------------------
|
||||
SoCCore.__init__(self, platform, sys_clk_freq,
|
||||
|
|
|
@ -66,7 +66,6 @@ class _CRG(Module):
|
|||
# BaseSoC ------------------------------------------------------------------------------------------
|
||||
|
||||
class BaseSoC(SoCCore):
|
||||
mem_map = {**SoCCore.mem_map, **{"spiflash": 0x80000000}}
|
||||
def __init__(self, bios_flash_offset, sys_clk_freq=int(50e6), **kwargs):
|
||||
platform = beaglewire.Platform()
|
||||
|
||||
|
@ -74,9 +73,6 @@ class BaseSoC(SoCCore):
|
|||
kwargs["integrated_rom_size"] = 0
|
||||
kwargs["integrated_sram_size"] = 2*kB
|
||||
|
||||
# Set CPU reset address
|
||||
kwargs["cpu_reset_address"] = self.mem_map["spiflash"] + bios_flash_offset
|
||||
|
||||
# SoCCore ----------------------------------------------------------------------------------
|
||||
SoCCore.__init__(self, platform, sys_clk_freq,
|
||||
ident = "LiteX SoC on Beaglewire",
|
||||
|
@ -100,10 +96,13 @@ class BaseSoC(SoCCore):
|
|||
|
||||
# Add ROM linker region --------------------------------------------------------------------
|
||||
self.bus.add_region("rom", SoCRegion(
|
||||
origin = self.mem_map["spiflash"] + bios_flash_offset,
|
||||
origin = self.bus.regions["spiflash"].origin + bios_flash_offset,
|
||||
size = 32*kB,
|
||||
linker = True)
|
||||
)
|
||||
# Set CPU reset address to ROM.
|
||||
if hasattr(self.cpu, "set_reset_address"):
|
||||
self.cpu.set_reset_address(self.bus.regions["rom"].origin)
|
||||
|
||||
# Leds -------------------------------------------------------------------------------------
|
||||
self.submodules.leds = LedChaser(
|
||||
|
|
|
@ -67,15 +67,13 @@ class BaseSoC(SoCCore):
|
|||
def __init__(self, sys_clk_freq=int(27e6), with_hyperram=False, with_led_chaser=True, with_video_terminal=True, **kwargs):
|
||||
platform = tang_nano_4k.Platform()
|
||||
|
||||
if 'cpu_type' in kwargs and kwargs['cpu_type'] == 'gowin_emcu':
|
||||
kwargs['with_uart'] = False # CPU has own UART
|
||||
kwargs['integrated_sram_size'] = 0 # SRAM is directly attached to CPU
|
||||
kwargs["integrated_rom_size"] = 0 # boot flash directly attached to CPU
|
||||
if "cpu_type" in kwargs and kwargs["cpu_type"] == "gowin_emcu":
|
||||
kwargs["with_uart"] = False # CPU has own UART
|
||||
kwargs["integrated_sram_size"] = 0 # SRAM is directly attached to CPU
|
||||
kwargs["integrated_rom_size"] = 0 # boot flash directly attached to CPU
|
||||
else:
|
||||
# Put BIOS in SPIFlash to save BlockRAMs.
|
||||
self.mem_map = {**SoCCore.mem_map, **{"spiflash": 0x80000000}}
|
||||
# Disable Integrated ROM
|
||||
kwargs["integrated_rom_size"] = 0
|
||||
kwargs["cpu_reset_address"] = self.mem_map["spiflash"] + 0
|
||||
|
||||
# SoCCore ----------------------------------------------------------------------------------
|
||||
SoCCore.__init__(self, platform, sys_clk_freq,
|
||||
|
@ -94,15 +92,18 @@ class BaseSoC(SoCCore):
|
|||
from litespi.opcodes import SpiNorFlashOpCodes as Codes
|
||||
self.add_spi_flash(mode="1x", module=W25Q32(Codes.READ_1_1_1), with_master=False)
|
||||
|
||||
if self.cpu_type == 'gowin_emcu':
|
||||
self.cpu.connect_uart(platform.request('serial'))
|
||||
if self.cpu_type == "gowin_emcu":
|
||||
self.cpu.connect_uart(platform.request("serial"))
|
||||
else:
|
||||
# Add ROM linker region --------------------------------------------------------------------
|
||||
# Add ROM linker region --------------------------------------------------------------------
|
||||
self.bus.add_region("rom", SoCRegion(
|
||||
origin = self.mem_map["spiflash"] + 0,
|
||||
size = 64*kB,
|
||||
origin = self.bus.regions["spiflash"].origin,
|
||||
size = 32*kB,
|
||||
linker = True)
|
||||
)
|
||||
# Set CPU reset address to ROM.
|
||||
if hasattr(self.cpu, "set_reset_address"):
|
||||
self.cpu.set_reset_address(self.bus.regions["rom"].origin)
|
||||
|
||||
# HyperRAM ---------------------------------------------------------------------------------
|
||||
if with_hyperram:
|
||||
|
|
|
@ -27,16 +27,12 @@ mB = 1024*kB
|
|||
# BaseSoC ------------------------------------------------------------------------------------------
|
||||
|
||||
class BaseSoC(SoCCore):
|
||||
mem_map = {**SoCCore.mem_map, **{"spiflash": 0x80000000}}
|
||||
def __init__(self, bios_flash_offset, sys_clk_freq=int(16e6), with_led_chaser=True, **kwargs):
|
||||
platform = tinyfpga_bx.Platform()
|
||||
|
||||
# Disable Integrated ROM since too large for iCE40.
|
||||
kwargs["integrated_rom_size"] = 0
|
||||
|
||||
# Set CPU variant / reset address
|
||||
kwargs["cpu_reset_address"] = self.mem_map["spiflash"] + bios_flash_offset
|
||||
|
||||
# SoCCore ----------------------------------------------------------------------------------
|
||||
SoCCore.__init__(self, platform, sys_clk_freq,
|
||||
ident = "LiteX SoC on TinyFPGA BX",
|
||||
|
@ -53,10 +49,13 @@ class BaseSoC(SoCCore):
|
|||
|
||||
# Add ROM linker region --------------------------------------------------------------------
|
||||
self.bus.add_region("rom", SoCRegion(
|
||||
origin = self.mem_map["spiflash"] + bios_flash_offset,
|
||||
origin = self.bus.regions["spiflash"].origin + bios_flash_offset,
|
||||
size = 32*kB,
|
||||
linker = True)
|
||||
)
|
||||
# Set CPU reset address to ROM.
|
||||
if hasattr(self.cpu, "set_reset_address"):
|
||||
self.cpu.set_reset_address(self.bus.regions["rom"].origin)
|
||||
|
||||
# Leds -------------------------------------------------------------------------------------
|
||||
if with_led_chaser:
|
||||
|
|
|
@ -60,14 +60,12 @@ class _CRG(Module):
|
|||
# BaseSoC ------------------------------------------------------------------------------------------
|
||||
|
||||
class BaseSoC(SoCCore):
|
||||
mem_map = {**SoCCore.mem_map, **{"spiflash": 0x80000000}}
|
||||
def __init__(self, bios_flash_offset=0x0000, sys_clk_freq=int(25e6), sdram_rate="1:1",
|
||||
with_led_chaser=True, **kwargs):
|
||||
platform = tec0117.Platform()
|
||||
|
||||
# Put BIOS in SPIFlash to save BlockRAMs.
|
||||
# Disable Integrated ROM.
|
||||
kwargs["integrated_rom_size"] = 0
|
||||
kwargs["cpu_reset_address"] = self.mem_map["spiflash"] + bios_flash_offset
|
||||
|
||||
# SoCCore ----------------------------------------------------------------------------------
|
||||
SoCCore.__init__(self, platform, sys_clk_freq,
|
||||
|
@ -85,10 +83,13 @@ class BaseSoC(SoCCore):
|
|||
|
||||
# Add ROM linker region --------------------------------------------------------------------
|
||||
self.bus.add_region("rom", SoCRegion(
|
||||
origin = self.mem_map["spiflash"] + bios_flash_offset,
|
||||
size = 64*kB,
|
||||
origin = self.bus.regions["spiflash"].origin + bios_flash_offset,
|
||||
size = 32*kB,
|
||||
linker = True)
|
||||
)
|
||||
# Set CPU reset address to ROM.
|
||||
if hasattr(self.cpu, "set_reset_address"):
|
||||
self.cpu.set_reset_address(self.bus.regions["rom"].origin)
|
||||
|
||||
# SDR SDRAM --------------------------------------------------------------------------------
|
||||
if not self.integrated_main_ram_size:
|
||||
|
|
|
@ -35,6 +35,7 @@ class TestTargets(unittest.TestCase):
|
|||
"efinix_xyloni_dev_kit", # Reason: Require Efinity toolchain.
|
||||
"sipeed_tang_primer", # Reason: Require Anlogic toolchain.
|
||||
"jungle_electronics_fireant", # Reason: Require Efinity toolchain.
|
||||
"qmtech_10cl006", # Readon: Needs to be fixed.
|
||||
]
|
||||
|
||||
# Build simple design for all platforms.
|
||||
|
|
Loading…
Reference in a new issue