I have used the PetaLinux tools to add an application to the system image and built it. I am now attempting to add it into the bitstream file so that I can program it into my FPGA.
I am using a Trenz electronic TE0841 with an XCKU040. I have not made any changes to the reference design code yet so I'm just using the prebuilt bitstream file provided by Trenz. I have only added a small application in PetaLinux.
I have been following UG1144 (https://docs.xilinx.com/r/2021.2-English/ug1144-petalinux-tools-reference-guide/Overview) as closely as I can.
First I created a project with
petalinux-create --type project --template microblaze --name <PROJECT_NAME>
Then I imported the HW configuration supplied by Trenz Electronic in the prebuilt directory of their reference design
petalinux-config --get-hw-description <PATH-TO_XSA>
I found that petalinux-package would fail when I got to that step due to the partition layout. So while in the configuration menu, I modified the partition table to fit the various components based on the error output of petalinux-package. Then I save the configuration.
I created and enabled an application and then added my code to it
petalinux-create -t apps --name <APP-NAME> --enable
Then I built the system image
petalinux-build
That populated the images/linux directory with the various build outputs.
Finally, I tried to add the system image to the bitstream supplied by Trenz Electronic with the petalinux-package command
petalinux-package --boot --flash-size 64 --flash-intf SPIx4 --fpga /home/kyle/petalinux/bsps/test_board_02_40_1i_2gb.bit --u-boot --kernel
And this is the output I get
kyle@DESKTOP-U0P8IUP:~/petalinux/projects/plnx-rad-test$ petalinux-package --boot --flash-size 64 --flash-intf SPIx4 --fpga /home/kyle/petalinux/bsps/test_board_02_40_1i_2gb.bit --u-boot --kernel
[INFO] Sourcing buildtools
WARNING: Auto detecting MMI file with XSA
INFO: Creating download.bit...
INFO: Fpga bitstream: /home/kyle/petalinux/bsps/test_board_02_40_1i_2gb.bit
INFO: Fpga bitstream MMI file: /tmp/tmp.a5s1iUmgk8/test_board_02_40_1i_2gb.mmi
INFO: Fsbl file: /home/kyle/petalinux/projects/plnx-rad-test/images/linux/fs-boot.elf
INFO: Output download.bit: /home/kyle/petalinux/projects/plnx-rad-test/images/linux/download.bit
INFO: Getting system flash information...
WARNING: Failed to detect SPI width from bitstream.
WARNING: Using default one: SPIx1.
WARNING: User specified Flash interface SPIx4 is different to the auto detected one SPIx1. Will use the user specified one.
INFO: Add bitstream "/home/kyle/petalinux/projects/plnx-rad-test/images/linux/download.bit" to 0.
INFO: Add datafile "/home/kyle/petalinux/projects/plnx-rad-test/images/linux/u-boot-s.bin" to 0x640000.
INFO: Add datafile "/home/kyle/petalinux/projects/plnx-rad-test/images/linux/image.ub" to 0x720000.
INFO: Add datafile "/home/kyle/petalinux/projects/plnx-rad-test/images/linux/boot.scr" to 0x1f00000.
INFO: Generating MCS file...
ERROR: [Bitstream 40-51] Unsupported part xcku040-sfva784-1-i in bitfile /home/kyle/petalinux/projects/plnx-rad-test/images/linux/download.bit.
ERROR: [Writecfgmem 68-7] Could not load bitfile /home/kyle/petalinux/projects/plnx-rad-test/images/linux/download.bit.
#-----------------------------------------------------------
# Vivado v2021.2 (64-bit)
# SW Build 3367213 on Tue Oct 19 02:47:39 MDT 2021
# IP Build 3369179 on Thu Oct 21 08:25:16 MDT 2021
# Start of session at: Fri Oct 20 08:29:00 2023
# Process ID: 107470
# Current directory: /home/kyle/petalinux/projects/plnx-rad-test/build/package-boot
# Command line: vivado -log /home/kyle/petalinux/projects/plnx-rad-test/build/package-boot//cfgmem.log -jou /home/kyle/petalinux/projects/plnx-rad-test/build/package-boot//cfgmem.jou -mode batch -s /home/kyle/petalinux/projects/plnx-rad-test/build/package-boot//write_cfgmem_hsm.tcl
# Log file: /home/kyle/petalinux/projects/plnx-rad-test/build/package-boot//cfgmem.log
# Journal file: /home/kyle/petalinux/projects/plnx-rad-test/build/package-boot//cfgmem.jou
# Running On: DESKTOP-U0P8IUP, OS: Linux, CPU Frequency: 2687.999 MHz, CPU Physical cores: 10, Host memory: 16634 MB
#-----------------------------------------------------------
source /home/kyle/petalinux/projects/plnx-rad-test/build/package-boot//write_cfgmem_hsm.tcl
# write_cfgmem -force -format MCS -size 64 -interface SPIx4 -loadbit " up 0 /home/kyle/petalinux/projects/plnx-rad-test/images/linux/download.bit" -loaddata " up 0x640000 /home/kyle/petalinux/projects/plnx-rad-test/images/linux/u-boot-s.bin up 0x720000 /home/kyle/petalinux/projects/plnx-rad-test/images/linux/image.ub up 0x1f00000 /home/kyle/petalinux/projects/plnx-rad-test/images/linux/boot.scr" /home/kyle/petalinux/projects/plnx-rad-test/images/linux/boot.mcs
Command: write_cfgmem -force -format MCS -size 64 -interface SPIx4 -loadbit { up 0 /home/kyle/petalinux/projects/plnx-rad-test/images/linux/download.bit} -loaddata { up 0x640000 /home/kyle/petalinux/projects/plnx-rad-test/images/linux/u-boot-s.bin up 0x720000 /home/kyle/petalinux/projects/plnx-rad-test/images/linux/image.ub up 0x1f00000 /home/kyle/petalinux/projects/plnx-rad-test/images/linux/boot.scr} /home/kyle/petalinux/projects/plnx-rad-test/images/linux/boot.mcs
Creating config memory files...
Creating bitstream load up from address 0x00000000
Loading bitfile /home/kyle/petalinux/projects/plnx-rad-test/images/linux/download.bit
ERROR: [Bitstream 40-51] Unsupported part xcku040-sfva784-1-i in bitfile /home/kyle/petalinux/projects/plnx-rad-test/images/linux/download.bit.
ERROR: [Writecfgmem 68-7] Could not load bitfile /home/kyle/petalinux/projects/plnx-rad-test/images/linux/download.bit.
0 Infos, 0 Warnings, 0 Critical Warnings and 2 Errors encountered.
write_cfgmem failed
ERROR: [Common 17-39] 'write_cfgmem' failed due to earlier errors.
while executing
"write_cfgmem -force -format MCS -size 64 -interface SPIx4 -loadbit " up 0 /home/kyle/petalinux/projects/plnx-rad-test/images/linux/download.bit" -load..."
(file "/home/kyle/petalinux/projects/plnx-rad-test/build/package-boot//write_cfgmem_hsm.tcl" line 1)
INFO: [Common 17-206] Exiting Vivado at Fri Oct 20 08:29:06 2023...
ERROR: Failed to run Vivado write_cfgmem command.
What does this error mean? How can I debug this further?
QuoteUnsupported part xcku040-sfva784-1-i in bitfile
I have followed the same procedure using the 02_35_2i_2gb prebuilt images and the petalinux-package command will then complete without an error. I do not have a KU035 board to test if it successfully inserted my petalinux build and application into the bitstream. But in any case, I do not receive the error that I do when trying to use the KU040.
I have installed a 30 day evaluation of the Enterprise license. However, when I went to check that this was installed correctly by opening the GUI, I've just been using command line tools up to this point) I get the an error trying to open the Trenz Electronic reference design project (see attached).
I can open and synthesize the TE reference design project on Windows. However, PetaLinux tooling requires Linux to run. So I've set up a WSL environment for PetaLinux and also installed Vivado there as well. However, in the WSL run Vivado, the KU040 part is not available. I am not sure why this is and cannot find instructions on how to update the part database.
Do you have instructions on how to update the Vivado parts list to include the parts you use on your boards? Do you have instructions on creating the MCS file from Vivado?