From 84f267e00c4e4601fefa211090f9c3e1ee4e272d Mon Sep 17 00:00:00 2001 From: hubmartin Date: Tue, 14 Dec 2021 19:10:03 +0100 Subject: [PATCH 1/4] Change bios-flash-offset for tinyFPGA --- litex_boards/targets/tinyfpga_bx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex_boards/targets/tinyfpga_bx.py b/litex_boards/targets/tinyfpga_bx.py index 1ae85d1..ba864fe 100755 --- a/litex_boards/targets/tinyfpga_bx.py +++ b/litex_boards/targets/tinyfpga_bx.py @@ -69,7 +69,7 @@ class BaseSoC(SoCCore): def main(): parser = argparse.ArgumentParser(description="LiteX SoC on TinyFPGA BX") parser.add_argument("--build", action="store_true", help="Build bitstream") - parser.add_argument("--bios-flash-offset", default=0x60000, help="BIOS offset in SPI Flash (default: 0x60000)") + parser.add_argument("--bios-flash-offset", default=0x50000, help="BIOS offset in SPI Flash (default: 0x50000)") parser.add_argument("--sys-clk-freq", default=16e6, help="System clock frequency (default: 16MHz)") builder_args(parser) soc_core_args(parser) From 7fb225a162471793aa1be717809378c4309b9f01 Mon Sep 17 00:00:00 2001 From: Marek Materzok Date: Sun, 19 Dec 2021 15:50:52 +0100 Subject: [PATCH 2/4] Option --with-spi-flash for iCESugar-Pro --- litex_boards/targets/muselab_icesugar_pro.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/litex_boards/targets/muselab_icesugar_pro.py b/litex_boards/targets/muselab_icesugar_pro.py index 60ddde2..0ebfaab 100755 --- a/litex_boards/targets/muselab_icesugar_pro.py +++ b/litex_boards/targets/muselab_icesugar_pro.py @@ -87,7 +87,7 @@ class _CRG(Module): # BaseSoC ------------------------------------------------------------------------------------------ class BaseSoC(SoCCore): - def __init__(self, sys_clk_freq=60e6, with_led_chaser=True, + def __init__(self, sys_clk_freq=60e6, with_led_chaser=True, with_spi_flash=False, use_internal_osc=False, sdram_rate="1:1", with_video_terminal=False, with_video_framebuffer=False, **kwargs): platform = muselab_icesugar_pro.Platform() @@ -108,9 +108,10 @@ class BaseSoC(SoCCore): self.submodules.leds = LedChaser(pads=ledn, sys_clk_freq=sys_clk_freq) # SPI Flash -------------------------------------------------------------------------------- - from litespi.modules import W25Q256 - from litespi.opcodes import SpiNorFlashOpCodes as Codes - self.add_spi_flash(mode="1x", module=W25Q256(Codes.READ_1_1_1)) + if with_spi_flash: + from litespi.modules import W25Q256 + from litespi.opcodes import SpiNorFlashOpCodes as Codes + self.add_spi_flash(mode="1x", module=W25Q256(Codes.READ_1_1_1)) # SDR SDRAM -------------------------------------------------------------------------------- if not self.integrated_main_ram_size: @@ -140,6 +141,7 @@ def main(): sdopts = parser.add_mutually_exclusive_group() sdopts.add_argument("--with-spi-sdcard", action="store_true", help="Enable SPI-mode SDCard support") sdopts.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support") + parser.add_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed)") parser.add_argument("--use-internal-osc", action="store_true", help="Use internal oscillator") parser.add_argument("--sdram-rate", default="1:1", help="SDRAM Rate: 1:1 Full Rate (default), 1:2 Half Rate") viopts = parser.add_mutually_exclusive_group() @@ -155,6 +157,7 @@ def main(): use_internal_osc = args.use_internal_osc, sdram_rate = args.sdram_rate, l2_size = args.l2_size, + with_spi_flash = args.with_spi_flash, with_video_terminal = args.with_video_terminal, with_video_framebuffer = args.with_video_framebuffer, **soc_core_argdict(args) From bb92bb00a829d783d62b80819621f0828d30c9f7 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Mon, 20 Dec 2021 18:02:57 +0100 Subject: [PATCH 3/4] adding digilent_arty_z7 support --- litex_boards/platforms/digilent_arty_z7.py | 247 +++++++++++++++++++++ litex_boards/targets/digilent_arty_z7.py | 125 +++++++++++ 2 files changed, 372 insertions(+) create mode 100644 litex_boards/platforms/digilent_arty_z7.py create mode 100755 litex_boards/targets/digilent_arty_z7.py diff --git a/litex_boards/platforms/digilent_arty_z7.py b/litex_boards/platforms/digilent_arty_z7.py new file mode 100644 index 0000000..e53eaad --- /dev/null +++ b/litex_boards/platforms/digilent_arty_z7.py @@ -0,0 +1,247 @@ +# This file is Copyright (c) 2019 Michael Betz +# License: BSD + +from litex.build.generic_platform import Pins, IOStandard, Subsignal +from litex.build.xilinx import XilinxPlatform +from litex.build.openfpgaloader import OpenFPGALoader + +# IOs ---------------------------------------------------------------------------------------------- + +_io = [ + # Clk / Rst + ("clk125", 0, Pins("H16"), IOStandard("LVCMOS33")), + + # Leds + ("user_led", 0, Pins("R14"), IOStandard("LVCMOS33")), + ("user_led", 1, Pins("P14"), IOStandard("LVCMOS33")), + ("user_led", 2, Pins("N16"), IOStandard("LVCMOS33")), + ("user_led", 3, Pins("M14"), IOStandard("LVCMOS33")), + + ("rgb_led", 0, + Subsignal("r", Pins("N15")), + Subsignal("g", Pins("G17")), + Subsignal("b", Pins("L15")), + IOStandard("LVCMOS33"), + ), + ("rgb_led", 1, + Subsignal("r", Pins("M15")), + Subsignal("g", Pins("L14")), + Subsignal("b", Pins("G14")), + IOStandard("LVCMOS33"), + ), + # Switches + ("user_sw", 0, Pins("M20"), IOStandard("LVCMOS33")), + ("user_sw", 1, Pins("M19"), IOStandard("LVCMOS33")), + + # Buttons + ("user_btn", 0, Pins("D19"), IOStandard("LVCMOS33")), + ("user_btn", 1, Pins("D20"), IOStandard("LVCMOS33")), + ("user_btn", 2, Pins("L20"), IOStandard("LVCMOS33")), + ("user_btn", 3, Pins("L19"), IOStandard("LVCMOS33")), + + # Serial (ust to make CI pass) + # Unfortunately the only USB UART is hard-wired to the ARM CPU + ("serial", 0, + Subsignal("tx", Pins("Y18")), + Subsignal("rx", Pins("Y19")), + IOStandard("LVCMOS33"), + ), + + # SPI + ("spi", 0, + Subsignal("clk", Pins("H15")), + Subsignal("cs_n", Pins("F16")), + Subsignal("mosi", Pins("T12")), + Subsignal("miso", Pins("W15")), + IOStandard("LVCMOS33"), + ), + + # I2C + ("i2c", 0, + Subsignal("scl", Pins("P16")), + Subsignal("sda", Pins("P15")), + IOStandard("LVCMOS33"), + ), + + # Audio + ("audio", 0, + Subsignal("pwm", Pins("R18")), # FIXME + Subsignal("sd", Pins("T17")), # FIXME + IOStandard("LVCMOS33"), + ), + + # HDMI In + ("hdmi_in", 0, + Subsignal("clk_p", Pins("H17"), IOStandard("TMDS_33")), + Subsignal("clk_n", Pins("P19"), IOStandard("TMDS_33")), + Subsignal("data0_p", Pins("V20"), IOStandard("TMDS_33")), + Subsignal("data0_n", Pins("W20"), IOStandard("TMDS_33")), + Subsignal("data1_p", Pins("T20"), IOStandard("TMDS_33")), + Subsignal("data1_n", Pins("U20"), IOStandard("TMDS_33")), + Subsignal("data2_p", Pins("N20"), IOStandard("TMDS_33")), + Subsignal("data2_n", Pins("P20"), IOStandard("TMDS_33")), + Subsignal("scl", Pins("U14"), IOStandard("LVCMOS33")), + Subsignal("sda", Pins("U15"), IOStandard("LVCMOS33")), + Subsignal("hpd_en", Pins("T19"), IOStandard("LVCMOS33")), + Subsignal("cec", Pins("H17"), IOStandard("LVCMOS33")), + ), + + # HDMI Out + ("hdmi_out", 0, + Subsignal("clk_p", Pins("L16"), IOStandard("TMDS_33")), + Subsignal("clk_n", Pins("L17"), IOStandard("TMDS_33")), + Subsignal("data0_p", Pins("K17"), IOStandard("TMDS_33")), + Subsignal("data0_n", Pins("K18"), IOStandard("TMDS_33")), + Subsignal("data1_p", Pins("K19"), IOStandard("TMDS_33")), + Subsignal("data1_n", Pins("J19"), IOStandard("TMDS_33")), + Subsignal("data2_p", Pins("J18"), IOStandard("TMDS_33")), + Subsignal("data2_n", Pins("H18"), IOStandard("TMDS_33")), + Subsignal("scl", Pins("M17"), IOStandard("LVCMOS33")), + Subsignal("sda", Pins("M18"), IOStandard("LVCMOS33")), + Subsignal("cec", Pins("G15"), IOStandard("LVCMOS33")), + Subsignal("hdp", Pins("R19"), IOStandard("LVCMOS33")), + ), + + # PS7 + ("ps7_clk", 0, Pins(1)), + ("ps7_porb", 0, Pins(1)), + ("ps7_srstb", 0, Pins(1)), + ("ps7_mio", 0, Pins(54)), + ("ps7_ddram", 0, + Subsignal("addr", Pins(15)), + Subsignal("ba", Pins(3)), + Subsignal("cas_n", Pins(1)), + Subsignal("ck_n", Pins(1)), + Subsignal("ck_p", Pins(1)), + Subsignal("cke", Pins(1)), + Subsignal("cs_n", Pins(1)), + Subsignal("dm", Pins(4)), + Subsignal("dq", Pins(32)), + Subsignal("dqs_n", Pins(4)), + Subsignal("dqs_p", Pins(4)), + Subsignal("odt", Pins(1)), + Subsignal("ras_n", Pins(1)), + Subsignal("reset_n", Pins(1)), + Subsignal("we_n", Pins(1)), + Subsignal("vrn", Pins(1)), + Subsignal("vrp", Pins(1)), + + ), +] + +# Connectors --------------------------------------------------------------------------------------- + +_connectors = [ + # access a pin with `pmoda:N`, where N is: + # N: 0 1 2 3 4 5 6 7 + # Pin: 1 2 3 4 7 8 9 10 + # Bank 13 + ("pmoda", "Y18 Y19 Y16 Y17 U18 U19 W18 W19"), + ("pmodb", "W14 Y14 T11 T10 V16 W16 V12 W13"), + ("ck_io", { + "ck_ioa" : "Y13", + + # Outer Digital Header + "ck_io0" : "T14", + "ck_io1" : "U12", + "ck_io2" : "U13", + "ck_io3" : "V13", + "ck_io4" : "V15", + "ck_io5" : "T15", + "ck_io6" : "R16", + "ck_io7" : "U17", + "ck_io8" : "V17", + "ck_io9" : "V18", + "ck_io10" : "T16", + "ck_io11" : "R17", + "ck_io12" : "P18", + "ck_io13" : "N17", + + # Inner Digital Header + # Only for Arty Z7 20 + "ck_io26" : "U5", + "ck_io27" : "V5", + "ck_io28" : "V6", + "ck_io29" : "U7", + "ck_io30" : "V7", + "ck_io31" : "U8", + "ck_io32" : "V8", + "ck_io33" : "V10", + "ck_io34" : "W10", + "ck_io35" : "W6", + "ck_io36" : "Y6", + "ck_io37" : "Y7", + "ck_io38" : "W8", + "ck_io39" : "Y8", + "ck_io40" : "W9", + "ck_io41" : "Y9", + + # Outer Analog Header as Digital IO + # Only for Arty Z7 20 + "ck_a0" : "Y11", + "ck_a1" : "Y12", + "ck_a2" : "W11", + "ck_a3" : "V11", + "ck_a4" : "T5", + "ck_a5" : "U10", + + # Inner Analog Header as Digital IO + "ck_a6" : "F19", + "ck_a7" : "F20", + "ck_a8" : "C20", + "ck_a9" : "B20", + "ck_a10" : "B19", + "ck_a11" : "A20", + }), + ("XADC", { + # Outer Analog Header + "vaux1_p" : "E17", + "vaux1_n" : "B18", + "vaux9_p" : "E18", + "vaux9_n" : "E19", + "vaux6_p" : "K14", + "vaux6_n" : "J14", + "vaux15_p" : "K16", + "vaux15_n" : "J16", + "vaux5_p" : "J20", + "vaux5_n" : "H20", + "vaux13_p" : "G19", + "vaux13_n" : "G20", + + # Inner Analog Header + "vaux12_p" : "F19", + "vaux12_n" : "F20", + "vaux0_p" : "C20", + "vaux0_n" : "B20", + "vaux8_p" : "B19", + "vaux8_n" : "A19", + }) +] + +# Platform ----------------------------------------------------------------------------------------- + +class Platform(XilinxPlatform): + default_clk_name = "clk125" + default_clk_freq = 125e6 + + def __init__(self, variant="z7-20"): + device = { + "z7-10": "xc7z010clg400-1", + "z7-20": "xc7z020clg400-1" + }[variant] + self.board = { + "z7-10": "arty_z7_10", + "z7-20": "arty_z7_20" + }[variant] + + XilinxPlatform.__init__(self, device, _io, _connectors, + toolchain="vivado") + self.default_clk_period = 1e9 / self.default_clk_freq + + def create_programmer(self): + return OpenFPGALoader(self.board) + + def do_finalize(self, fragment): + XilinxPlatform.do_finalize(self, fragment) + self.add_period_constraint(self.lookup_request(self.default_clk_name, loose=True), + self.default_clk_period) diff --git a/litex_boards/targets/digilent_arty_z7.py b/litex_boards/targets/digilent_arty_z7.py new file mode 100755 index 0000000..8bcc4ef --- /dev/null +++ b/litex_boards/targets/digilent_arty_z7.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 + +# +# This file is part of LiteX-Boards. +# +# Copyright (c) 2021 Gwenhael Goavec-Merou +# SPDX-License-Identifier: BSD-2-Clause + +import argparse +import subprocess + +from migen import * + +from litex_boards.platforms import digilent_arty_z7 +from litex.build import tools +from litex.build.xilinx import common as xil_common +from litex.build.xilinx.vivado import vivado_build_args, vivado_build_argdict + +from litex.soc.interconnect import axi +from litex.soc.interconnect import wishbone + +from litex.soc.cores.clock import * +from litex.soc.integration.soc_core import * +from litex.soc.integration.soc import SoCRegion +from litex.soc.integration.builder import * +from litex.soc.cores.led import LedChaser + +# CRG ---------------------------------------------------------------------------------------------- + + +class _CRG(Module): + def __init__(self, platform, sys_clk_freq, use_ps7_clk=False): + self.rst = Signal() + self.clock_domains.cd_sys = ClockDomain() + + # # # + + if use_ps7_clk: + self.comb += ClockSignal("sys").eq(ClockSignal("ps7")) + self.comb += ResetSignal("sys").eq(ResetSignal("ps7") | self.rst) + else: + self.submodules.pll = pll = S7PLL(speedgrade=-1) + self.comb += pll.reset.eq(self.rst) + pll.register_clkin(platform.request(platform.default_clk_name), platform.default_clk_freq) + pll.create_clkout(self.cd_sys, sys_clk_freq) + # Ignore sys_clk to pll.clkin path created by SoC's rst. + platform.add_false_path_constraints(self.cd_sys.clk, pll.clkin) + +# BaseSoC ------------------------------------------------------------------------------------------ + + +class BaseSoC(SoCCore): + def __init__(self, variant="z7-20", sys_clk_freq=int(125e6), with_led_chaser=True, **kwargs): + platform = digilent_arty_z7.Platform(variant) + + if kwargs.get("cpu_type", None) == "zynq7000": + kwargs['integrated_sram_size'] = 0 + kwargs['with_uart'] = False + self.mem_map = { + 'csr': 0x4000_0000, # Zynq GP0 default + } + + # SoCCore ---------------------------------------------------------------------------------- + SoCCore.__init__(self, platform, sys_clk_freq, + ident = "LiteX SoC on Arty Z7", + ident_version = True, + **kwargs) + + # Zynq7000 Integration --------------------------------------------------------------------- + if kwargs.get("cpu_type", None) == "zynq7000": + preset_name = "arty_z7_20.tcl" if variant == "z7-20" else "arty_z7_10.tcl" + + os.system("wget http://kmf2.trabucayre.com/" + preset_name) + self.cpu.set_ps7(preset=preset_name) + + # Connect AXI GP0 to the SoC + wb_gp0 = wishbone.Interface() + self.submodules += axi.AXI2Wishbone( + axi = self.cpu.add_axi_gp_master(), + wishbone = wb_gp0, + base_address = self.mem_map['csr']) + self.add_wb_master(wb_gp0) + + use_ps7_clk = True + else: + use_ps7_clk = False + + # CRG -------------------------------------------------------------------------------------- + self.submodules.crg = _CRG(platform, sys_clk_freq, use_ps7_clk) + + # Leds ------------------------------------------------------------------------------------- + if with_led_chaser: + self.submodules.leds = LedChaser( + pads = platform.request_all("user_led"), + sys_clk_freq = sys_clk_freq) + +# Build -------------------------------------------------------------------------------------------- + +def main(): + parser = argparse.ArgumentParser(description="LiteX SoC on Arty Z7") + parser.add_argument("--build", action="store_true", help="Build bitstream") + parser.add_argument("--load", action="store_true", help="Load bitstream") + parser.add_argument("--variant", default="z7-20", help="Board variant: z7-20 (default) or z7-10") + parser.add_argument("--sys-clk-freq", default=125e6, help="System clock frequency (default: %(default)d)") + builder_args(parser) + soc_core_args(parser) + vivado_build_args(parser) + parser.set_defaults(cpu_type="zynq7000") + args = parser.parse_args() + + soc = BaseSoC( + variant = args.variant, + sys_clk_freq=int(float(args.sys_clk_freq)), + **soc_core_argdict(args) + ) + builder = Builder(soc, **builder_argdict(args)) + print(builder.compile_software) + builder.build(**vivado_build_argdict(args), run=args.build) + + if args.load: + prog = soc.platform.create_programmer() + prog.load_bitstream(os.path.join(builder.gateware_dir, soc.build_name + ".bit")) + +if __name__ == "__main__": + main() From 8664b59f230c3ed0aac75ff148d49960a58c4f0c Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 20 Dec 2021 21:41:12 +0100 Subject: [PATCH 4/4] targets: Fix --bios-flash-offset support and other minor cleanups. --- litex_boards/targets/1bitsquared_icebreaker.py | 4 ++-- litex_boards/targets/1bitsquared_icebreaker_bitsy.py | 4 ++-- litex_boards/targets/efinix_xyloni_dev_kit.py | 12 ++++++------ litex_boards/targets/jungle_electronics_fireant.py | 12 ++++++------ litex_boards/targets/kosagi_fomu.py | 6 +++--- litex_boards/targets/lattice_ice40up5k_evn.py | 4 ++-- litex_boards/targets/muselab_icesugar.py | 6 +++--- litex_boards/targets/qwertyembedded_beaglewire.py | 8 +++----- litex_boards/targets/tinyfpga_bx.py | 4 ++-- litex_boards/targets/trenz_tec0117.py | 6 +++--- 10 files changed, 32 insertions(+), 34 deletions(-) diff --git a/litex_boards/targets/1bitsquared_icebreaker.py b/litex_boards/targets/1bitsquared_icebreaker.py index 0ab0434..d8b6af4 100755 --- a/litex_boards/targets/1bitsquared_icebreaker.py +++ b/litex_boards/targets/1bitsquared_icebreaker.py @@ -145,14 +145,14 @@ def main(): parser.add_argument("--load", action="store_true", help="Load bitstream") parser.add_argument("--flash", action="store_true", help="Flash Bitstream") parser.add_argument("--sys-clk-freq", default=24e6, help="System clock frequency (default: 24MHz)") - parser.add_argument("--bios-flash-offset", default=0x40000, help="BIOS offset in SPI Flash (default: 0x40000)") + parser.add_argument("--bios-flash-offset", default="0x40000", help="BIOS offset in SPI Flash (default: 0x40000)") parser.add_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (with DVI PMOD)") builder_args(parser) soc_core_args(parser) args = parser.parse_args() soc = BaseSoC( - bios_flash_offset = args.bios_flash_offset, + bios_flash_offset = int(args.bios_flash_offset, 0), sys_clk_freq = int(float(args.sys_clk_freq)), with_video_terminal = args.with_video_terminal, **soc_core_argdict(args) diff --git a/litex_boards/targets/1bitsquared_icebreaker_bitsy.py b/litex_boards/targets/1bitsquared_icebreaker_bitsy.py index 65c8956..c78bc6c 100755 --- a/litex_boards/targets/1bitsquared_icebreaker_bitsy.py +++ b/litex_boards/targets/1bitsquared_icebreaker_bitsy.py @@ -119,14 +119,14 @@ def main(): parser.add_argument("--build", action="store_true", help="Build bitstream") parser.add_argument("--flash", action="store_true", help="Flash bitstream and bios") parser.add_argument("--sys-clk-freq", default=24e6, help="System clock frequency (default: 24MHz)") - parser.add_argument("--bios-flash-offset", default=0xa0000, help="BIOS offset in SPI Flash (default: 0xa0000)") + parser.add_argument("--bios-flash-offset", default="0xa0000", help="BIOS offset in SPI Flash (default: 0xa0000)") parser.add_argument("--revision", default="v1", help="Board revision 'v0' or 'v1'") builder_args(parser) soc_core_args(parser) args = parser.parse_args() soc = BaseSoC( - bios_flash_offset = args.bios_flash_offset, + bios_flash_offset = int(args.bios_flash_offset, 0), sys_clk_freq = int(float(args.sys_clk_freq)), revision = args.revision, **soc_core_argdict(args) diff --git a/litex_boards/targets/efinix_xyloni_dev_kit.py b/litex_boards/targets/efinix_xyloni_dev_kit.py index 7c4f405..354816f 100755 --- a/litex_boards/targets/efinix_xyloni_dev_kit.py +++ b/litex_boards/targets/efinix_xyloni_dev_kit.py @@ -88,18 +88,18 @@ class BaseSoC(SoCCore): def main(): parser = argparse.ArgumentParser(description="LiteX SoC on Efinix Xyloni Dev Kit") - parser.add_argument("--build", action="store_true", help="Build bitstream") - parser.add_argument("--load", action="store_true", help="Load bitstream") - parser.add_argument("--flash", action="store_true", help="Flash Bitstream") - parser.add_argument("--sys-clk-freq", default=33.333e6, help="System clock frequency (default: 33.333MHz)") - parser.add_argument("--bios-flash-offset", default=0x40000, help="BIOS offset in SPI Flash (default: 0x40000)") + parser.add_argument("--build", action="store_true", help="Build bitstream") + parser.add_argument("--load", action="store_true", help="Load bitstream") + parser.add_argument("--flash", action="store_true", help="Flash Bitstream") + parser.add_argument("--sys-clk-freq", default=33.333e6, help="System clock frequency (default: 33.333MHz)") + parser.add_argument("--bios-flash-offset", default="0x40000", help="BIOS offset in SPI Flash (default: 0x40000)") builder_args(parser) soc_core_args(parser) args = parser.parse_args() soc = BaseSoC( - bios_flash_offset = args.bios_flash_offset, + bios_flash_offset = int(args.bios_flash_offset, 0), sys_clk_freq = int(float(args.sys_clk_freq)), **soc_core_argdict(args)) builder = Builder(soc, **builder_argdict(args)) diff --git a/litex_boards/targets/jungle_electronics_fireant.py b/litex_boards/targets/jungle_electronics_fireant.py index a197fed..5795b53 100755 --- a/litex_boards/targets/jungle_electronics_fireant.py +++ b/litex_boards/targets/jungle_electronics_fireant.py @@ -103,18 +103,18 @@ class BaseSoC(SoCCore): def main(): parser = argparse.ArgumentParser(description="LiteX SoC on Jungle Electronics FireAnt") - parser.add_argument("--build", action="store_true", help="Build bitstream") - parser.add_argument("--load", action="store_true", help="Load bitstream") - parser.add_argument("--flash", action="store_true", help="Flash Bitstream") - parser.add_argument("--sys-clk-freq", default=33.333e6, help="System clock frequency (default: 33.333MHz)") - parser.add_argument("--bios-flash-offset", default=0x40000, help="BIOS offset in SPI Flash (default: 0x40000)") + parser.add_argument("--build", action="store_true", help="Build bitstream") + parser.add_argument("--load", action="store_true", help="Load bitstream") + parser.add_argument("--flash", action="store_true", help="Flash Bitstream") + parser.add_argument("--sys-clk-freq", default=33.333e6, help="System clock frequency (default: 33.333MHz)") + parser.add_argument("--bios-flash-offset", default="0x40000", help="BIOS offset in SPI Flash (default: 0x40000)") builder_args(parser) soc_core_args(parser) args = parser.parse_args() soc = BaseSoC( - bios_flash_offset = args.bios_flash_offset, + bios_flash_offset = int(args.bios_flash_offset, 0), sys_clk_freq = int(float(args.sys_clk_freq)), **soc_core_argdict(args)) builder = Builder(soc, **builder_argdict(args)) diff --git a/litex_boards/targets/kosagi_fomu.py b/litex_boards/targets/kosagi_fomu.py index af79c5b..61a1c69 100755 --- a/litex_boards/targets/kosagi_fomu.py +++ b/litex_boards/targets/kosagi_fomu.py @@ -170,7 +170,7 @@ def main(): parser = argparse.ArgumentParser(description="LiteX SoC on Fomu") parser.add_argument("--build", action="store_true", help="Build bitstream") parser.add_argument("--sys-clk-freq", default=12e6, help="System clock frequency (default: 12MHz)") - parser.add_argument("--bios-flash-offset", default=0x20000, help="BIOS offset in SPI Flash (default: 0x20000)") + parser.add_argument("--bios-flash-offset", default="0x20000", help="BIOS offset in SPI Flash (default: 0x20000)") parser.add_argument("--flash", action="store_true", help="Flash Bitstream") builder_args(parser) soc_core_args(parser) @@ -179,7 +179,7 @@ def main(): dfu_flash_offset = 0x40000 soc = BaseSoC( - bios_flash_offset = dfu_flash_offset + args.bios_flash_offset, + bios_flash_offset = dfu_flash_offset + int(args.bios_flash_offset, 0), sys_clk_freq = int(float(args.sys_clk_freq)), **soc_core_argdict(args) ) @@ -187,7 +187,7 @@ def main(): builder.build(run=args.build) if args.flash: - flash(builder.output_dir, soc.build_name, args.bios_flash_offset) + flash(builder.output_dir, soc.build_name, int(args.bios_flash_offset, 0)) if __name__ == "__main__": main() diff --git a/litex_boards/targets/lattice_ice40up5k_evn.py b/litex_boards/targets/lattice_ice40up5k_evn.py index ae9e166..55068c7 100755 --- a/litex_boards/targets/lattice_ice40up5k_evn.py +++ b/litex_boards/targets/lattice_ice40up5k_evn.py @@ -149,14 +149,14 @@ def main(): parser = argparse.ArgumentParser(description="LiteX SoC on Lattice iCE40UP5k EVN breakout board") parser.add_argument("--build", action="store_true", help="Build bitstream") parser.add_argument("--sys-clk-freq", default=12e6, help="System clock frequency (default: 12MHz)") - parser.add_argument("--bios-flash-offset", default=0x20000, help="BIOS offset in SPI Flash (default: 0x20000)") + parser.add_argument("--bios-flash-offset", default="0x20000", help="BIOS offset in SPI Flash (default: 0x20000)") parser.add_argument("--flash", action="store_true", help="Flash Bitstream") builder_args(parser) soc_core_args(parser) args = parser.parse_args() soc = BaseSoC( - bios_flash_offset = args.bios_flash_offset, + bios_flash_offset = int(args.bios_flash_offset, 0), sys_clk_freq = int(float(args.sys_clk_freq)), **soc_core_argdict(args) ) diff --git a/litex_boards/targets/muselab_icesugar.py b/litex_boards/targets/muselab_icesugar.py index cc6c920..fc3c4e3 100755 --- a/litex_boards/targets/muselab_icesugar.py +++ b/litex_boards/targets/muselab_icesugar.py @@ -118,13 +118,13 @@ def main(): parser.add_argument("--load", action="store_true", help="Load bitstream") parser.add_argument("--flash", action="store_true", help="Flash Bitstream") parser.add_argument("--sys-clk-freq", default=24e6, help="System clock frequency (default: 24MHz)") - parser.add_argument("--bios-flash-offset", default=0x40000, help="BIOS offset in SPI Flash (default: 0x40000)") + parser.add_argument("--bios-flash-offset", default="0x40000", help="BIOS offset in SPI Flash (default: 0x40000)") builder_args(parser) soc_core_args(parser) args = parser.parse_args() soc = BaseSoC( - bios_flash_offset = args.bios_flash_offset, + bios_flash_offset = int(args.bios_flash_offset, 0), sys_clk_freq = int(float(args.sys_clk_freq)), **soc_core_argdict(args) ) @@ -136,7 +136,7 @@ def main(): prog.load_bitstream(os.path.join(builder.gateware_dir, soc.build_name + ".bin")) if args.flash: - flash(args.bios_flash_offset) + flash(int(args.bios_flash_offset, 0)) if __name__ == "__main__": main() diff --git a/litex_boards/targets/qwertyembedded_beaglewire.py b/litex_boards/targets/qwertyembedded_beaglewire.py index 06f84cd..8b21d88 100755 --- a/litex_boards/targets/qwertyembedded_beaglewire.py +++ b/litex_boards/targets/qwertyembedded_beaglewire.py @@ -78,7 +78,7 @@ class BaseSoC(SoCCore): kwargs["cpu_reset_address"] = self.mem_map["spiflash"] + bios_flash_offset # SoCCore ---------------------------------------------------------------------------------- - SoCCore.__init__(self, platform, sys_clk_freq, + SoCCore.__init__(self, platform, sys_clk_freq, ident = "LiteX SoC on Beaglewire", ident_version = True, **kwargs) @@ -115,16 +115,14 @@ class BaseSoC(SoCCore): def main(): parser = argparse.ArgumentParser(description="LiteX SoC on Beaglewire") parser.add_argument("--build", action="store_true", help="Build bitstream") - parser.add_argument("--bios-flash-offset", default=0x60000, help="BIOS offset in SPI Flash (default: 0x60000)") + parser.add_argument("--bios-flash-offset", default="0x60000", help="BIOS offset in SPI Flash (default: 0x60000)") parser.add_argument("--sys-clk-freq", default=50e6, help="System clock frequency (default: 50MHz)") - parser.add_argument("--output_dir", default="build", help="Output directory of csr") - parser.add_argument("--csr_csv", default="build/csr.csv", help="csr.csv") builder_args(parser) soc_core_args(parser) args = parser.parse_args() soc = BaseSoC( - bios_flash_offset = args.bios_flash_offset, + bios_flash_offset = int(args.bios_flash_offset, 0), sys_clk_freq = int(float(args.sys_clk_freq)), **soc_core_argdict(args) ) diff --git a/litex_boards/targets/tinyfpga_bx.py b/litex_boards/targets/tinyfpga_bx.py index ba864fe..40600d6 100755 --- a/litex_boards/targets/tinyfpga_bx.py +++ b/litex_boards/targets/tinyfpga_bx.py @@ -69,14 +69,14 @@ class BaseSoC(SoCCore): def main(): parser = argparse.ArgumentParser(description="LiteX SoC on TinyFPGA BX") parser.add_argument("--build", action="store_true", help="Build bitstream") - parser.add_argument("--bios-flash-offset", default=0x50000, help="BIOS offset in SPI Flash (default: 0x50000)") + parser.add_argument("--bios-flash-offset", default="0x50000", help="BIOS offset in SPI Flash (default: 0x50000)") parser.add_argument("--sys-clk-freq", default=16e6, help="System clock frequency (default: 16MHz)") builder_args(parser) soc_core_args(parser) args = parser.parse_args() soc = BaseSoC( - bios_flash_offset = args.bios_flash_offset, + bios_flash_offset = int(args.bios_flash_offset, 0), sys_clk_freq = int(float(args.sys_clk_freq)), **soc_core_argdict(args) ) diff --git a/litex_boards/targets/trenz_tec0117.py b/litex_boards/targets/trenz_tec0117.py index 6b240fd..8283f46 100755 --- a/litex_boards/targets/trenz_tec0117.py +++ b/litex_boards/targets/trenz_tec0117.py @@ -160,7 +160,7 @@ def main(): parser = argparse.ArgumentParser(description="LiteX SoC on TEC0117") parser.add_argument("--build", action="store_true", help="Build bitstream") parser.add_argument("--load", action="store_true", help="Load bitstream") - parser.add_argument("--bios-flash-offset", default=0x0000, help="BIOS offset in SPI Flash (0x00000 default)") + parser.add_argument("--bios-flash-offset", default="0x0000", help="BIOS offset in SPI Flash (0x00000 default)") parser.add_argument("--flash", action="store_true", help="Flash Bitstream and BIOS") parser.add_argument("--sys-clk-freq", default=25e6, help="System clock frequency (default: 25MHz)") sdopts = parser.add_mutually_exclusive_group() @@ -171,7 +171,7 @@ def main(): args = parser.parse_args() soc = BaseSoC( - bios_flash_offset = args.bios_flash_offset, + bios_flash_offset = int(args.bios_flash_offset, 0), sys_clk_freq = int(float(args.sys_clk_freq)), **soc_core_argdict(args) ) @@ -191,7 +191,7 @@ def main(): if args.flash: prog = soc.platform.create_programmer() prog.flash(0, os.path.join(builder.gateware_dir, "impl", "pnr", "project.fs")) - flash(args.bios_flash_offset) + flash(int(args.bios_flash_offset, 0)) if __name__ == "__main__": main()