@@ -50,6 +50,7 @@ def __init__(self, platform, sys_clk_freq):
5050class BaseSoC (SoCCore ):
5151 def __init__ (self , sys_clk_freq = 48e6 , toolchain = "colognechip" ,
5252 with_led_chaser = True ,
53+ with_spi_flash = True ,
5354 ** kwargs ):
5455 platform = colognechip_gatemate_evb .Platform (toolchain )
5556
@@ -63,6 +64,12 @@ def __init__(self, sys_clk_freq=48e6, toolchain="colognechip",
6364 # SoCCore ----------------------------------------------------------------------------------
6465 SoCCore .__init__ (self , platform , sys_clk_freq , ident = "LiteX SoC on GateMate EVB" , ** kwargs )
6566
67+ # SPI Flash --------------------------------------------------------------------------------
68+ if with_spi_flash :
69+ from litespi .modules import MX25R6435F
70+ from litespi .opcodes import SpiNorFlashOpCodes as Codes
71+ self .add_spi_flash (mode = "4x" , module = MX25R6435F (Codes .READ_1_1_1 ), with_master = False )
72+
6673 # Leds -------------------------------------------------------------------------------------
6774 if with_led_chaser :
6875 self .leds = LedChaser (
@@ -74,13 +81,15 @@ def __init__(self, sys_clk_freq=48e6, toolchain="colognechip",
7481def main ():
7582 from litex .build .parser import LiteXArgumentParser
7683 parser = LiteXArgumentParser (platform = colognechip_gatemate_evb .Platform , description = "LiteX SoC on Gatemate EVB" )
77- parser .add_target_argument ("--sys-clk-freq" , default = 24e6 , type = float , help = "System clock frequency." )
78- parser .add_target_argument ("--flash" , action = "store_true" , help = "Flash bitstream." )
84+ parser .add_target_argument ("--sys-clk-freq" , default = 24e6 , type = float , help = "System clock frequency." )
85+ parser .add_target_argument ("--flash" , action = "store_true" , help = "Flash bitstream." )
86+ parser .add_target_argument ("--with-spi-flash" , action = "store_true" , help = "Enable SPI Flash (MMAPed)." )
7987 args = parser .parse_args ()
8088
8189 soc = BaseSoC (
82- sys_clk_freq = args .sys_clk_freq ,
83- toolchain = args .toolchain ,
90+ sys_clk_freq = args .sys_clk_freq ,
91+ toolchain = args .toolchain ,
92+ with_spi_flash = args .with_spi_flash ,
8493 ** parser .soc_argdict )
8594 builder = Builder (soc , ** parser .builder_argdict )
8695 if args .build :
0 commit comments