Skip to content

Commit

Permalink
Merge pull request #521 from josuah/crosslink_nx_spi_flash
Browse files Browse the repository at this point in the history
platforms/crosslink_nx_evn: add SPI flash support
  • Loading branch information
enjoy-digital authored Aug 28, 2023
2 parents efb7613 + 2c3d77b commit 387e361
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions litex_boards/targets/lattice_crosslink_nx_evn.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,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,
with_uartbone = False,
**kwargs):
platform = lattice_crosslink_nx_evn.Platform(device=device, toolchain=toolchain)
Expand Down Expand Up @@ -98,6 +99,12 @@ def __init__(self, sys_clk_freq=75e6, device="LIFCL-40-9BG400C", toolchain="radi
if with_uartbone:
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 --------------------------------------------------------------------------------------------

Expand All @@ -110,13 +117,15 @@ 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).")
parser.add_target_argument("--with-uartbone", action="store_true", help="Add UartBone on 1st serial.")
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,
with_uartbone = args.with_uartbone,
**parser.soc_argdict
)
Expand Down

0 comments on commit 387e361

Please sign in to comment.