platforms/crosslink_nx_evn: add SPI flash support

This commit is contained in:
Josuah Demangeon 2023-08-11 16:46:52 +02:00
parent 3903cdee92
commit 2e5c6eb7a7
1 changed files with 9 additions and 0 deletions

View File

@ -68,6 +68,7 @@ class BaseSoC(SoCCore):
}
def __init__(self, sys_clk_freq=75e6, device="LIFCL-40-9BG400C", toolchain="radiant",
with_led_chaser = True,
with_spi_flash = False,
**kwargs):
platform = lattice_crosslink_nx_evn.Platform(device=device, toolchain=toolchain)
@ -97,6 +98,12 @@ class BaseSoC(SoCCore):
if debug_uart:
self.add_uartbone()
# SPI Flash --------------------------------------------------------------------------------
if with_spi_flash:
from litespi.modules import MX25L12833F
from litespi.opcodes import SpiNorFlashOpCodes as Codes
self.add_spi_flash(mode="4x", clk_freq=100_000, module=MX25L12833F(Codes.READ_4_4_4), with_master=True)
# Build --------------------------------------------------------------------------------------------
@ -109,12 +116,14 @@ def main():
parser.add_target_argument("--programmer", default="radiant", help="Programmer (radiant or ecpprog).")
parser.add_target_argument("--address", default=0x0, help="Flash address to program bitstream at.")
parser.add_target_argument("--prog-target", default="direct", help="Programming Target (direct or flash).")
parser.add_target_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed).")
args = parser.parse_args()
soc = BaseSoC(
sys_clk_freq = args.sys_clk_freq,
device = args.device,
toolchain = args.toolchain,
with_spi_flash = args.with_spi_flash,
**parser.soc_argdict
)
builder = Builder(soc, **parser.builder_argdict)