1111from litex .gen import *
1212
1313from litex_boards .platforms import digilent_zedboard
14- from litex .build .tools import write_to_file
15-
1614
1715from litex .soc .cores .clock import *
1816from litex .soc .integration .soc import *
@@ -57,7 +55,7 @@ def __init__(self, toolchain="vivado", sys_clk_freq=100e6, with_led_chaser=True,
5755 platform .add_extension (usb_pmod_io ("pmodb" ))
5856 if kwargs .get ("uart_name" , "serial" ) == "serial" : kwargs ["uart_name" ] = "usb_uart"
5957 else :
60- kwargs ["no_uart " ] = True
58+ kwargs ["with_uart " ] = False
6159
6260 # CRG --------------------------------------------------------------------------------------
6361 use_ps7_clk = (kwargs .get ("cpu_type" , None ) == "zynq7000" )
@@ -84,58 +82,18 @@ def __init__(self, toolchain="vivado", sys_clk_freq=100e6, with_led_chaser=True,
8482 linker = True )
8583 )
8684 self .constants ["CONFIG_CLOCK_FREQUENCY" ] = 666666687
85+ self .cpu .set_libxil ({
86+ "STDOUT_BASEADDRESS" : "0xE0001000" ,
87+ "XPAR_PS7_DDR_0_S_AXI_BASEADDR" : "0x00100000" ,
88+ "XPAR_PS7_DDR_0_S_AXI_HIGHADDR" : "0x3FFFFFFF" ,
89+ })
8790
8891 # Leds -------------------------------------------------------------------------------------
8992 if with_led_chaser :
9093 self .leds = LedChaser (
9194 pads = platform .request_all ("user_led" ),
9295 sys_clk_freq = sys_clk_freq )
9396
94- def finalize (self , * args , ** kwargs ):
95- super (BaseSoC , self ).finalize (* args , ** kwargs )
96- if self .cpu_type != "zynq7000" :
97- return
98-
99- libxil_path = os .path .join (self .builder .software_dir , 'libxil' )
100- os .makedirs (os .path .realpath (libxil_path ), exist_ok = True )
101- lib = os .path .join (libxil_path , 'embeddedsw' )
102- if not os .path .exists (lib ):
103- os .system ("git clone --depth 1 https://github.com/Xilinx/embeddedsw {}" .format (lib ))
104-
105- os .makedirs (os .path .realpath (self .builder .include_dir ), exist_ok = True )
106- for header in [
107- 'XilinxProcessorIPLib/drivers/uartps/src/xuartps_hw.h' ,
108- 'lib/bsp/standalone/src/common/xil_types.h' ,
109- 'lib/bsp/standalone/src/common/xil_assert.h' ,
110- 'lib/bsp/standalone/src/common/xil_io.h' ,
111- 'lib/bsp/standalone/src/common/xil_printf.h' ,
112- 'lib/bsp/standalone/src/common/xstatus.h' ,
113- 'lib/bsp/standalone/src/common/xdebug.h' ,
114- 'lib/bsp/standalone/src/arm/cortexa9/xpseudo_asm.h' ,
115- 'lib/bsp/standalone/src/arm/cortexa9/xreg_cortexa9.h' ,
116- 'lib/bsp/standalone/src/arm/cortexa9/xil_cache.h' ,
117- 'lib/bsp/standalone/src/arm/cortexa9/xparameters_ps.h' ,
118- 'lib/bsp/standalone/src/arm/cortexa9/xil_errata.h' ,
119- 'lib/bsp/standalone/src/arm/cortexa9/xtime_l.h' ,
120- 'lib/bsp/standalone/src/arm/common/xil_exception.h' ,
121- 'lib/bsp/standalone/src/arm/common/gcc/xpseudo_asm_gcc.h' ,
122- ]:
123- shutil .copy (os .path .join (lib , header ), self .builder .include_dir )
124- write_to_file (os .path .join (self .builder .include_dir , 'bspconfig.h' ),
125- '#define FPU_HARD_FLOAT_ABI_ENABLED 1' )
126- write_to_file (os .path .join (self .builder .include_dir , 'xparameters.h' ), '''
127- #ifndef __XPARAMETERS_H
128- #define __XPARAMETERS_H
129-
130- #include "xparameters_ps.h"
131-
132- #define STDOUT_BASEADDRESS 0xE0001000
133- #define XPAR_PS7_DDR_0_S_AXI_BASEADDR 0x00100000
134- #define XPAR_PS7_DDR_0_S_AXI_HIGHADDR 0x3FFFFFFF
135-
136- #endif
137- ''' )
138-
13997# Build --------------------------------------------------------------------------------------------
14098
14199def main ():
@@ -151,10 +109,6 @@ def main():
151109 ** parser .soc_argdict
152110 )
153111 builder = Builder (soc , ** parser .builder_argdict )
154- if args .cpu_type == "zynq7000" :
155- soc .builder = builder
156- builder .add_software_package ('libxil' )
157- builder .add_software_library ('libxil' )
158112 if args .build :
159113 builder .build (** parser .toolchain_argdict )
160114
0 commit comments