Skip to content

Commit

Permalink
make build script compatible with vivado/vitis 2022.1
Browse files Browse the repository at this point in the history
(should also work for all version 2020.1 and above)
  • Loading branch information
menkueclab committed Jun 30, 2022
1 parent a1c2ce7 commit f77f964
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 28 deletions.
23 changes: 10 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,30 +130,27 @@ build/rootfs.cpio.gz: buildroot/output/images/rootfs.cpio.gz | build
build/$(TARGET).itb: u-boot-xlnx/tools/mkimage build/zImage build/rootfs.cpio.gz $(TARGET_DTS_FILES) build/system_top.bit
u-boot-xlnx/tools/mkimage -f scripts/$(TARGET).its $@

build/system_top.hdf: | build
build/system_top.xsa: | build
ifeq (1, ${HAVE_VIVADO})
bash -c "source $(VIVADO_SETTINGS) && make -C hdl/projects/$(TARGET) && cp hdl/projects/$(TARGET)/$(TARGET).sdk/system_top.hdf $@"
bash -c "source $(VIVADO_SETTINGS) && make -C hdl/projects/$(TARGET) && cp hdl/projects/$(TARGET)/$(TARGET).sdk/system_top.xsa $@"
unzip -l $@ | grep -q ps7_init || cp hdl/projects/$(TARGET)/$(TARGET).srcs/sources_1/bd/system/ip/system_sys_ps7_0/ps7_init* build/
else ifneq ($(HDF_FILE),)
cp $(HDF_FILE) $@
else ifneq ($(HDF_URL),)
wget -T 3 -t 1 -N --directory-prefix build $(HDF_URL)
else ifneq ($(XSA_FILE),)
cp $(XSA_FILE) $@
else ifneq ($(XSA_URL),)
wget -T 3 -t 1 -N --directory-prefix build $(XSA_URL)
endif

### TODO: Build system_top.hdf from src if dl fails - need 2016.2 for that ...
### TODO: Build system_top.xsa from src if dl fails ...

build/sdk/fsbl/Release/fsbl.elf build/sdk/hw_0/system_top.bit : build/system_top.hdf
build/sdk/fsbl/Release/fsbl.elf build/system_top.bit : build/system_top.xsa
rm -Rf build/sdk
ifeq (1, ${HAVE_VIVADO})
bash -c "source $(VIVADO_SETTINGS) && xsdk -batch -source scripts/create_fsbl_project.tcl"
bash -c "source $(VIVADO_SETTINGS) && xsct scripts/create_fsbl_project.tcl"
else
mkdir -p build/sdk/hw_0
unzip -o build/system_top.hdf system_top.bit -d build/sdk/hw_0
unzip -o build/system_top.xsa system_top.bit -d build/sdk/hw_0
endif

build/system_top.bit: build/sdk/hw_0/system_top.bit
cp $< $@

build/boot.bin: build/sdk/fsbl/Release/fsbl.elf build/u-boot.elf
@echo img:{[bootloader] $^ } > build/boot.bif
bash -c "source $(VIVADO_SETTINGS) && bootgen -image build/boot.bif -w -o $@"
Expand Down
20 changes: 5 additions & 15 deletions scripts/create_fsbl_project.tcl
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
hsi open_hw_design build/system_top.hdf
hsi open_hw_design build/system_top.xsa
set cpu_name [lindex [hsi get_cells -filter {IP_TYPE==PROCESSOR}] 0]

sdk setws ./build/sdk
sdk createhw -name hw_0 -hwspec build/system_top.hdf

# Workaround for broken write_sysdev in vivado 2018.2
catch {
set copyfiles [glob ./build/ps7_init*]
if {[llength $copyfiles]} {
file copy {*}$copyfiles ./build/sdk/hw_0/
}
}
sdk createapp -name fsbl -hwproject hw_0 -proc $cpu_name -os standalone -lang C -app {Zynq FSBL}
configapp -app fsbl build-config release
sdk projects -build -type all
#xsdk -batch -source create_fsbl_project.tcl
setws ./build/sdk
app create -name fsbl -hw build/system_top.xsa -proc $cpu_name -os standalone -lang C -template {Zynq FSBL}
app config -name fsbl -set build-config release
app build -name fsbl

0 comments on commit f77f964

Please sign in to comment.