Skip to content

Commit

Permalink
Makefile: Update to Vivado Version 2021.1
Browse files Browse the repository at this point in the history
This requires some adjustments since the handover file is no longer
in the HDF format but instead is called XSA.
We build FPGA/HDL with 2021.1 but our GCC (arm-linux-gnueabihf-gcc)
is still from:

Xilinx/SDK/2019.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin

This is due to buildroot complaining about an compatibility issue with
gcc from 2021.1

Signed-off-by: Michael Hennerich <[email protected]>
  • Loading branch information
mhennerich committed Jul 11, 2022
1 parent 693b863 commit 315422d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 31 deletions.
31 changes: 16 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#PATH=$PATH:/opt/Xilinx/SDK/2015.4/gnu/arm/lin/bin

VIVADO_VERSION ?= 2019.1
VIVADO_VERSION ?= 2021.1
CROSS_COMPILE ?= arm-linux-gnueabihf-

HAVE_CROSS=$(shell which $(CROSS_COMPILE)gcc | wc -l)
Expand Down Expand Up @@ -130,31 +130,32 @@ 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 - need 2016.2 for that ...

build/sdk/fsbl/Release/fsbl.elf build/sdk/hw_0/system_top.bit : build/system_top.hdf
build/sdk/hw0/zynq_fsbl/fsbl.elf build/sdk/hw0/hw/system_top.bit : build/system_top.xsa
rm -Rf build/sdk
pwd
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
mkdir -p build/sdk/hw0
unzip -o build/system_top.xsa system_top.bit -d build/sdk/hw0
endif

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

build/boot.bin: build/sdk/fsbl/Release/fsbl.elf build/u-boot.elf
build/boot.bin: build/sdk/hw0/zynq_fsbl/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 Expand Up @@ -217,7 +218,7 @@ dfu-ram: build/$(TARGET).dfu
dfu-util -D build/$(TARGET).dfu -a firmware.dfu
dfu-util -e

jtag-bootstrap: build/u-boot.elf build/sdk/hw_0/ps7_init.tcl build/sdk/hw_0/system_top.bit scripts/run.tcl
jtag-bootstrap: build/u-boot.elf build/sdk/hw0/hw/ps7_init.tcl build/sdk/hw0/hw/system_top.bit scripts/run.tcl
$(CROSS_COMPILE)strip build/u-boot.elf
zip -j build/$(ZIP_ARCHIVE_PREFIX)-$@-$(VERSION).zip $^

Expand Down
19 changes: 3 additions & 16 deletions scripts/create_fsbl_project.tcl
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
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
platform create -name hw0 -hw build/system_top.xsa -os standalone -out ./build/sdk -proc $cpu_name
platform generate

0 comments on commit 315422d

Please sign in to comment.