News:

Attention: For security reasons,please choose a user name *different* from your login name.
Also make sure to choose a secure password and change it regularly.

Main Menu

Running a linux application when booting from QSPI flash.

Started by RichardH, January 13, 2022, 12:18:02 PM

Previous topic - Next topic

RichardH

Hello

I am currently working with a TE0803 SoM and a TEBF0808 baseboard for some development work, however will soon be moving to a custom board which will not have an SD card (it will have qspi flash and eMMc memory). Therefore I am trying to boot from the QSPI flash.

I have been able to  program the qspi flash with a linux image created with Petalinux and boot this successfully, accessing it via a serial port. My boot image at this point consists of the following partitions in order:
- FSBL
- PMU firmware
- .bit file for PL
- ATF (bl31.elf)
- u-boot.elf
- image.ub
- boot.scr

Now I have built an application in vitis, that I would like to run on Linux, I have built the elf file for it (hello_world.elf), I would like to include it into my build so that it will run after linux has started up. How would I approach this? When booting from the SD card, I could include the hello_world.elf on the SD card and find it from linux. I tried to include hello_word.elf into my boot image after boot.scr, however did not see it run or was not able to find it on linux after it booted.






JH

Hi,
You must change PS setup form the ZynqMP IP, when you use the module on an carrier with other MIO configuration (other interfaces). And create new Vitis/Petalinux project with this XSA file. Otherwhise it can happens that FSBL stops booting in case some of the interfaces is not available.

When you use baremetal app, mostly only FSBL, bitstream, and app is needed. See BIF file of our reference designs for baremetal appl, for example(inlcuded in the prebuilt folder):

/* bare-metal */
/*auto-generated on 2021/07/19 08:49:54 */
//arch = zynqmp; split = false; format = BIN
the_ROM_image:
{
  [bootloader, destination_cpu= a53-0 ]../../../software/3eg_4gb/fsbl.elf
  [destination_device = pl]../../../hardware/3eg_4gb/test_board_3eg_4gb.bit
  [destination_cpu = a53-0]../../../software/3eg_4gb/hello_te0803.elf
}


br
John

DR

Hello RichardH,

I am attempting to do a similar thing as you ... namely boot from QSPI without the SD card.

It looks like you have been successful. If you have a few moments, can you share the steps you took to get there.

I have successfully created the test_board Reference design, built the petalinux project, and tried creating the BOOT.bin using the same files you list in your post. However, the board does not boot. It just hangs at power up with no messages on the UART.

Thanks much for your help.

Dave

JH

Hi,
you has uart on correct MIO (depends on your carrier)? Test board design use MIO like for TEBF0808 carrier. Which carrier did you use?
Boot mode is correct? Which did you select?
Does  Hello world boot?
br
John

RichardH

Hi  Dave

Are you using Vitis to generate the BOOT.bin and program the device? Did you get any errors when programming the QSPI?
I pretty much followed the instruction here:
https://xilinx.github.io/Embedded-Design-Tutorials/docs/2020.2/docs/Introduction/ZynqMPSoC-EDT/8-boot-and-configuration.html#boot-sequence-for-qspi-boot-mode
(modifying the parts that are board specific to work with the TEBF0808 carrier)

The Petalinux configuration also requires modification for when booting from QSPI, have a look here:
https://xilinx.github.io/Embedded-Design-Tutorials/docs/2020.2/docs/Introduction/ZynqMPSoC-EDT/8-boot-and-configuration.html#creating-linux-images-using-petalinux-for-qspi-flash


DR

Yes - Using Vitis to generate the BOOT.bin

Using Vivado HW manager to program
I don't get any errors when programming, but a warning about "not supporting QSPI32" - but is seems to work anyway
I have not modified the petalinux configuration, so most likely this is my problem.

I am so glad to have someone respond - Glad to know that someone has already gone down this road and been successful!
Once I get through those two pages you linked, I'll let you know how it goes.

Thanks much!

JH

Hi,
Quotewarning about "not supporting QSPI32" -
that's strange can you share the whole log file?
QuoteI have not modified the petalinux configuration, so most likely this is my problem.
In this case you should see minimums FSBL, FSBL is normaly the same for baremetal and linux.
You can get problems on PMU and  ATF firmware (but this works mostly), normally Uboot, in case you did not change file search location.
Which Vivado/Petalinux Version did you use?
Xilinx has changed flow with 2020.2 version, see also:
https://wiki.trenz-electronic.de/display/PD/PetaLinux
https://wiki.trenz-electronic.de/display/PD/Distro+Boot+with+Boot.scr

br
John

DR

Hello again John and Richard,

Thank you again for your help.

I am currently trying to use Vivado 2021.2, Vitis 2021.2 and Petalinux 2021.2

Also using all the reference design files for 2021.2

I feel like I am making a little progress in understanding the steps to creating a BOOT.bin for booting from QSPI.
I have been following the instructions on the xilinx github page here:
https://xilinx.github.io/Embedded-Design-Tutorials/docs/2021.2/build/html/docs/Introduction/ZynqMPSoC-EDT/8-boot-and-configuration.html?highlight=qspi

However, when I get to the step of:
Select Subsystem AUTO Hardware Settings.
Under the advanced bootable images storage settings, do the following:

There is no option for me with "advanced bootable images storage settings"

After a bit of searching - it seems everyone else gets this option - I must be missing a step.

Do you know how to enable the "advanced bootable images storage settings" option in the configuration wizard?

Thanks again.
Dave

JH

Hi,
I don't know this tutorial and I know that Xilinx changed a little bit boot flow (from u-boot up to linux) since 2020.2 and newer --> see boot.scr link from me.
Boot barmetal hello World is the same for SD and QSP --> use the same boot.bin only change boot mode.
Linux in at the beginning the same (FSBL, PMU, ATF(BL31), Uboot). When you use the the same boot.bin which you use for SD Boot on QSPI, that it should start up to uboot and uboot try to search boot.scr and image.ub (in case you didn't split rootfs, kernel, device tree) on SD card. When you want to boot all from SD, than you must put everything on QSPI (easiest way put everything into the boot.bin).  But uboot still search on SD, so you must change this. Since 2020.2 Xilinx has used boot.scr for this purpose, so you must modify boot.scr to seach on correct place on the QSPI flash. Boot.scr is very new, as far as I know uboot search on different locations for boot.scr and a default boot.scr integrated, which looks everywhere for any sources. If you boot everything from QSPI you must change put your boot.scr on this place on QSPI where uboot search for boot.scr or change this location on petalinux (I'm currently not sure if basic petalinux config or uboot config)

Little alternative. TE0820 has USB, with boot.scr you can also put image.ub and boot.scr on USB, see:
https://wiki.trenz-electronic.de/display/PD/Distro+Boot+with+Boot.scr
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/749142017/Using+Distro+Boot+With+Xilinx+U-Boot#UsingDistroBootWithXilinxU-Boot-BootTargets

br
John

DR

Hello John and Richard,

I greatly appreciate your help on my project. After spending a considerable time with the tools and documentation (and with your advice), I was finally able to boot the test_board petalinux project entirely from QSPI.
There were several issues that needed to be addressed:

1) When working with Petalinux 2020 version - there were several broken files, and I could not get the petalinux project to build out-of-the-box. Many multiple definitions and missing references. I suspect that there is a difference in the older vs newer gcc libraries that was causing me grief.
In short, I was never able to build the test_board petalinux project under any circumstances using 2020 Vivado, Vitis and Petalinux with updated Ubuntu and packages.

2) My next problem was with the 2021 versions of everything. I was able to fully build everything for booting from SD - but could not get it to boot from QSPI.
The Xilinx instructions for modifying the process were unclear at best, and wrong in many instances when using 2021 versions of everything.

3) I managed to get the attention form someone at Xilinx, and he pointed me to this page:
https://support.xilinx.com/s/article/000033588?language=en_US

This page replaces the instructions for building the petalinux project, and worked perfectly for me.

4) I also found one issue with the Trenz provided tools that tripped me up.
Specifically, when programming the QSPI with the Vivado HW manager, and selecting the option to "Update the Entire Device", the flash process consistently failed (using fsbl_flash.elf)
I chose this option because I wanted to erase the entire flash, but it looks like the fsbl flash elf does not do this. However, when selecting the option to update only the size of the configuration file, then the programming completed correctly.
I think there is a bug in the generated special fsbl flash elf that does not work correctly when attempting to erase the entire QSPI device. It stops erasing at 0x4000000 - which is not the entire device and not sufficient for the BOOT.bin file.
"sf erase 0 4000000"

Thank you again for your help.
Dave Rector
*:^)

JH

Hi,
glad to hear it's working now!

Quote4) I also found one issue with the Trenz provided tools that tripped me up.
Specifically, when programming the QSPI with the Vivado HW manager, and selecting the option to "Update the Entire Device", the flash process consistently failed (using fsbl_flash.elf)
I chose this option because I wanted to erase the entire flash, but it looks like the fsbl flash elf does not do this. However, when selecting the option to update only the size of the configuration file, then the programming completed correctly.
I think there is a bug in the generated special fsbl flash elf that does not work correctly when attempting to erase the entire QSPI device. It stops erasing at 0x4000000 - which is not the entire device and not sufficient for the BOOT.bin file.
"sf erase 0 4000000"
That's interesting.  Thank you for sharing this information!

I know, that fsbl_flash not longer works with 21.2, but normal one works now. With older Vivado versions it was the other way around. :-)
fsbl_flash is like normal FSBL, we only set boot mode hard to jtag and have disabled DDR (up to 20.2 reference design, on 21.2 we have leave DDR setup default, to check if it helps with the problem above).
In summer we will probably change to one, we will leave the fsbl_flash for the time being, in case the behavior changes again in future Vivado versions.

br

John