UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
15,387 Views
Registered: ‎09-19-2014

Booting Linux + PL bitstream from Zynq QSPI

Jump to solution

This is a bit of a sequence of events, so bear with me. :)

 

I have seen the example of booting Linux from QSPI in the UG873 document (http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_7/ug873-zynq-ctt.pdf, section 5.2.5).

I set my QSPI boot image up like:

{
  [bootloader]fsbl.elf
  u-boot.elf
  [offset = 0x100000]uImage
  [offset = 0x600000]devicetree.dtb
  [offset = 0x620000]uramdisk.image.gz
}

 

I can successfully get it to boot the Linux kernel (without including the PL bitstream, as in the instructions), but then it freezes at the point where it is attempting to initialise a PL device. (This same set of bootup files works file from SD card.) The solution to that is then to get the PL bitstream working.

 

I tried adding the PL bitstream as the last partition, and it didn't seem to do anything - the kernel bootup still froze at the PL driver initialisation part.

 

I tried adding the PL bitstream just after the FSBL, but that upset all the specified offsets, and it wouldn't fit.

 

I read this thread descriping a very similar situation.

http://forums.xilinx.com/t5/Embedded-Linux/How-to-boot-Linux-from-QSPI-with-bitstream/td-p/325885

One solution there was to put the bitstream elsewhere, like on an SD card, and then initialise the PL from Linux. I'd rather not do that, as it is more complex (kernel modules, multiple storage devices, etc), and the PL takes much longer to initialise.

 

I decided another way to try would be to put the bitstream after the FSBL (which seems like the right spot from the examples of booting from QSPI with PL + baremetal), but then shift all the offsets up a lot. My boot image then looks like (I confirmed there's sufficient space for each element):

 

{
  [bootloader]fsbl.elf
  zynq_rc_x4g1_top.bit
  u-boot.elf
  [offset = 0xF00000]uImage
  [offset = 0x1400000]devicetree.dtb
  [offset = 0x1410000]uramdisk.image.gz
}

 

Changing the offsets means changing the corresponding offsets in U-Boot:

 

setenv qspiboot 'echo Copying Linux from QSPI flash to RAM... && sf probe 0 0 0 && sf read 0x3000000 0xF00000 ${kernel_size} && sf read 0x2A00000 0x1400000 ${devicetree_size} && echo Copying ramdisk... && sf read 0x2000000 0x1410000 ${ramdisk_size} && bootm 0x3000000 0x2000000 0x2A00000'

(It would also need changes to the device tree QSPI offsets, but I haven't got to that point yet.)

 

The problem is now that it halts when loading the kernel from the QSPI partition:

zynq-uboot> run qspiboot
Copying Linux from QSPI flash to RAM...
SF: Detected S25FL129P_64K with page size 128 KiB, total 32 MiB

 It freezes at this point.

 

 

I broke down the qspiboot command and did some experimenting:

 

sf probe 0 0 0    (initialise the QSPI)

sf read 0x3000000 0xF00000 0x500000 **FREEZES**

sf read 0x3000000 0xF00000 0x10 FINE

sf read 0x3000000 0xFFFFF0 0x10 FINE

sf read 0x3000000 0xFFFFF0 0x11 **FREEZES**

(Where 0xFFFFFF is 16MB)

It appeared to not like reading from the upper 16MB of the QSPI.

But....

 

zynq-uboot> sf probe 0 0 0
SF: Detected S25FL129P_64K with page size 128 KiB, total 32 MiB
zynq-uboot> sf read 0x3000000 0x1F00000 0x100
zynq-uboot> sf read 0x3000000 0x1E00000 0x100
zynq-uboot> sf read 0x3000000 0x1900000 0x100
zynq-uboot> sf read 0x3000000 0x1800000 0x100
zynq-uboot> sf read 0x3000000 0x1700000 0x100
zynq-uboot> sf read 0x3000000 0x1600000 0x100
zynq-uboot> sf read 0x3000000 0x1500000 0x100
zynq-uboot> sf read 0x3000000 0x1400000 0x100
zynq-uboot> sf read 0x3000000 0x1300000 0x100
zynq-uboot> sf read 0x3000000 0x1200000 0x100
zynq-uboot> sf read 0x3000000 0x1100000 0x100
zynq-uboot> sf read 0x3000000 0x1000000 0x100 **FREEZES HERE**

 It can read the top parts (17MB-32MB) of the QSPI fine.

 

 

So the questions are:

Why does U-Boot freeze when reading the very middle part of the 32MB QSPI? How do I fix it?

 

or

 

Is there a better way to have Linux + PL bitstream boot from QSPI?

0 Kudos
1 Solution

Accepted Solutions
Adventurer
Adventurer
24,265 Views
Registered: ‎09-19-2014

Re: Booting Linux + PL bitstream from Zynq QSPI

Jump to solution

I put my own uboot.elf in the image and tried again.

 

It actually looks like it's grabbing the latest master version of U-Boot rather than v2013.7 as OpenEmbedded suggests:

U-Boot 2014.01 (Aug 29 2014 - 08:57:53)

 

It has detected the QSPI differently too:

SF: Detected S25FL128S_64K with page size 512 Bytes, erase size 128 KiB, total 32 MiB

(though still not the same as what you said.)

 

The good news is that this U-Boot version makes that 16-17MB section of QSPI actually work and not freeze during reading!! Very pleased.

 

So therefore the kernel boots from the QSPI. It even gets past the first blockage mentioned earlier (from when the PL bitstream wasn't working) - it does initialise the PCIe device in the PL, which means the bitstream is working! Excellent.

 

[    0.493807] xaxi_pcie_init_port: LINK IS UP
[    0.497909] AXI PCIe Root Port Probe Successful

 

This has progressed further than before.

 

The problem is now the same as what made me give up (temporarily) on my own U-Boot binary - it has a kernel panic near the end of the booting process:

 

...
[ 2.769886] VFS: Mounted root (ext4 filesystem) on device 1:0. [ 2.776662] devtmpfs: mounted [ 2.779949] Freeing unused kernel memory: 192K (c068d000 - c06bd000) ¡+r?"ºêKernel panic - not syncing: Attempted to kill init! exitcode=0x000000070 @hr?¢ÊºÊê[<c0015498>] (unwind_backtrace) from [<c00118b4>] (show_stack+0x10/0x14P[ 2.932733] [<c00118b4>] (show_stack) from [<c049eb54>] (dump_stack+0x7c/0xc([ 2.953531] [<c0023f1c>] (do_exit) from [<c0025550>] (do_group_exit+0x4c/0xb([ 2.960756] [<c0025550>] (do_group_exit) from [<c0031f68>] (get_signal_to_de([ 2.969367] [<c0031f68>] (get_signal_to_deliver) from [<c0010e84>] (do_signa([ 2.977543] [<c0010e84>] (do_signal) from [<c00112e8>] (do_work_pending+0x5c([ 2.985111] [<c00112e8>] (do_work_pending) from [<c000e578>] (work_pending+0P[ 3.002227] [<c0015498>] (unwind_backtrace) from [<c00118b4>] (show_stack+0xP[ 3.009974] [<c00118b4>] (show_stack) from [<c049eb54>] (dump_stack+0x7c/0xc([ 3.017201] [<c049eb54>] (dump_stack) from [<c0013d38>] (ipi_cpu_stop+0x3c/0([ 3.024594] [<c0013d38>] (ipi_cpu_stop) from [<c0014368>] (handle_IPI+0x64/0([ 3.031989] [<c0014368>] (handle_IPI) from [<c0008548>] (gic_handle_irq+0x58([ 3.039558] [<c0008548>] (gic_handle_irq) from [<c0012344>] (__irq_svc+0x44/[ 3.052078] ff00: 00000([ 3.060250] ff20: 00000000 c06c94f0 00000001 eefd3448 acb74686 00000000 b1ae([ 3.068426] ff40: 00000000 00000000 00000008 c06bff60 c005f064 c03728ec 2007P[ 3.076616] [<c0012344>] (__irq_svc) from [<c03728ec>] (cpuidle_enter_state+P[ 3.084534] [<c03728ec>] (cpuidle_enter_state) from [<c0372a5c>] (cpuidle_id([ 3.093240] [<c0372a5c>] (cpuidle_idle_call) from [<c000f16c>] (arch_cpu_idl([ 3.101242] [<c000f16c>] (arch_cpu_idle) from [<c00694dc>] (cpu_startup_entrP[ 3.109421] [<c00694dc>] (cpu_startup_entry) from [<c068dac8>] (start_kernel+0x320/0x37c)

 

 

This looks like U-Boot definitely needs some modifications to fix. Any ideas on where to begin here? I might check if OpenEmbedded has any recipe fixes since I checked out my workspace.

0 Kudos
11 Replies
Scholar trenz-al
Scholar
15,374 Views
Registered: ‎11-09-2013

Re: Booting Linux + PL bitstream from Zynq QSPI

Jump to solution

Hi

 

SF: Detected S25FL256S_64K with page size 256 Bytes, erase size 64 KiB, total 32 MiB

32MByte SPI flash 2014.2 vivado+petalinux no custom patches works.

 

IMPORTANT - PS QSPI IP core is very "sensitive", many many things that you can normally do with any SPI IP Core, when try with PS7 QSPI will just freeze. I been that path.

 

SF: Detected S25FL129P_64K with page size 128 KiB, total 32 MiB

129P is OBSOLETED, why are you using it?

 

Wait a moment, did you enable at all the 32Mbyte support in UBOOT? It will not work if you dont enable it!

 

129P is 16MByte part?

 

#define CONFIG_SPI_FLASH_BAR

 

this must be defined!

 

 

 

 

 

 

0 Kudos
Adventurer
Adventurer
15,360 Views
Registered: ‎09-19-2014

Re: Booting Linux + PL bitstream from Zynq QSPI

Jump to solution

Thanks trenz-al for your reply.

 

I assume your U-Boot binary is the one that says:

SF: Detected S25FL256S_64K with page size 256 Bytes, erase size 64 KiB, total 32 MiB

 ?

 

I meant to say before but I forgot... my U-Boot is:

U-Boot 2013.04 (Jun 25 2013 - 10:26:13)

 

... which is actually a binary I didn't build myself, but took from an example reference design:

PCIe Root Complex Reference Design for Mini-ITX 7Z045 PCIe Design - Vivado 2014.2:

http://zedboard.org/support/design/2056/17

 

I did try building the U-Boot binary myself, but for some reason it caused the Linux kernel to halt halfway through bootup. That is something on the todo list to get working still. I'm using the example reference binary, because I thought it was generic enough.

I'm building U-Boot and the Linux kernel using OpenEmbedded. It gets the U-Boot v2013.07 sources from git://git.denx.de/u-boot.git. I haven't done any customisations on top of whatever openembedded-core gives me in their recipes:

https://github.com/openembedded/oe-core/tree/master/meta/recipes-bsp/u-boot

It doesn't fully work yet, as I said before. The customisations are something I haven't explored properly.

 

That is unusual/sad that the PS QSPI is so sensitive! How do you know what's safe/unsafe to do? It sounds very much like trial-and-error rather than a well-documented thing.

 

Is 129P the device or the driver for the QSPI? I didn't mention before, but I'm using the Mini-ITX board from Zedboard.org, and that's what's on there. The driver is presumably built into the U-Boot binary which is their example reference binary.

I don't know what is or isn't enabled in the binary, but I can tell you that I could successfully read from the 17MB-32MB section of the QSPI, so I suggest that 32MB support is working to some degree.

129P doesn't really sound like a 16MB part, unless it's referring to two 16MB parts in parallel (I choose the qspi_dual_parallel flash type in Program Flash Memory tool in Xilinx SDK). In any case, as I said, I could read from the 17MB-32MB section of the QSPI. I haven't tried a very fine granularity in working out exactly which region causes freezes when reading. It could be a lot small than a full MB around 16-17MB.

 

Any further ideas here? I think I'll attempt to get my own U-Boot building again.

0 Kudos
Adventurer
Adventurer
24,266 Views
Registered: ‎09-19-2014

Re: Booting Linux + PL bitstream from Zynq QSPI

Jump to solution

I put my own uboot.elf in the image and tried again.

 

It actually looks like it's grabbing the latest master version of U-Boot rather than v2013.7 as OpenEmbedded suggests:

U-Boot 2014.01 (Aug 29 2014 - 08:57:53)

 

It has detected the QSPI differently too:

SF: Detected S25FL128S_64K with page size 512 Bytes, erase size 128 KiB, total 32 MiB

(though still not the same as what you said.)

 

The good news is that this U-Boot version makes that 16-17MB section of QSPI actually work and not freeze during reading!! Very pleased.

 

So therefore the kernel boots from the QSPI. It even gets past the first blockage mentioned earlier (from when the PL bitstream wasn't working) - it does initialise the PCIe device in the PL, which means the bitstream is working! Excellent.

 

[    0.493807] xaxi_pcie_init_port: LINK IS UP
[    0.497909] AXI PCIe Root Port Probe Successful

 

This has progressed further than before.

 

The problem is now the same as what made me give up (temporarily) on my own U-Boot binary - it has a kernel panic near the end of the booting process:

 

...
[ 2.769886] VFS: Mounted root (ext4 filesystem) on device 1:0. [ 2.776662] devtmpfs: mounted [ 2.779949] Freeing unused kernel memory: 192K (c068d000 - c06bd000) ¡+r?"ºêKernel panic - not syncing: Attempted to kill init! exitcode=0x000000070 @hr?¢ÊºÊê[<c0015498>] (unwind_backtrace) from [<c00118b4>] (show_stack+0x10/0x14P[ 2.932733] [<c00118b4>] (show_stack) from [<c049eb54>] (dump_stack+0x7c/0xc([ 2.953531] [<c0023f1c>] (do_exit) from [<c0025550>] (do_group_exit+0x4c/0xb([ 2.960756] [<c0025550>] (do_group_exit) from [<c0031f68>] (get_signal_to_de([ 2.969367] [<c0031f68>] (get_signal_to_deliver) from [<c0010e84>] (do_signa([ 2.977543] [<c0010e84>] (do_signal) from [<c00112e8>] (do_work_pending+0x5c([ 2.985111] [<c00112e8>] (do_work_pending) from [<c000e578>] (work_pending+0P[ 3.002227] [<c0015498>] (unwind_backtrace) from [<c00118b4>] (show_stack+0xP[ 3.009974] [<c00118b4>] (show_stack) from [<c049eb54>] (dump_stack+0x7c/0xc([ 3.017201] [<c049eb54>] (dump_stack) from [<c0013d38>] (ipi_cpu_stop+0x3c/0([ 3.024594] [<c0013d38>] (ipi_cpu_stop) from [<c0014368>] (handle_IPI+0x64/0([ 3.031989] [<c0014368>] (handle_IPI) from [<c0008548>] (gic_handle_irq+0x58([ 3.039558] [<c0008548>] (gic_handle_irq) from [<c0012344>] (__irq_svc+0x44/[ 3.052078] ff00: 00000([ 3.060250] ff20: 00000000 c06c94f0 00000001 eefd3448 acb74686 00000000 b1ae([ 3.068426] ff40: 00000000 00000000 00000008 c06bff60 c005f064 c03728ec 2007P[ 3.076616] [<c0012344>] (__irq_svc) from [<c03728ec>] (cpuidle_enter_state+P[ 3.084534] [<c03728ec>] (cpuidle_enter_state) from [<c0372a5c>] (cpuidle_id([ 3.093240] [<c0372a5c>] (cpuidle_idle_call) from [<c000f16c>] (arch_cpu_idl([ 3.101242] [<c000f16c>] (arch_cpu_idle) from [<c00694dc>] (cpu_startup_entrP[ 3.109421] [<c00694dc>] (cpu_startup_entry) from [<c068dac8>] (start_kernel+0x320/0x37c)

 

 

This looks like U-Boot definitely needs some modifications to fix. Any ideas on where to begin here? I might check if OpenEmbedded has any recipe fixes since I checked out my workspace.

0 Kudos
Scholar trenz-al
Scholar
15,347 Views
Registered: ‎11-09-2013

Re: Booting Linux + PL bitstream from Zynq QSPI

Jump to solution

Hi

 

ITX probably has 2 x 16MB in parallel = 32MB total.

 

I really think you should give petalinux 2014.2 a try, it should build and boot everything without any problems.

 

I have made NEW designs for NEW never tested PCBs maybe 6 different now, every time from scratch.

 

vivado - handout - petalinux 2014.2

 

in ALL times EVERY time the systems did boot til linux prompt FIRST TIME tried.

 

no patching of any kind in any source code.

 

It is amazing that you can build SoC systems and matching bootloader-uboot-linux that just works "as designed" first time tried. Ok, I have admit I am doing electronics since 1979 so I have some mileage on the way.

0 Kudos
Adventurer
Adventurer
15,323 Views
Registered: ‎09-19-2014

Re: Booting Linux + PL bitstream from Zynq QSPI

Jump to solution

Thanks for the suggestion. I've been tossing around the idea of trying Petalinux, but haven't yet. It's good to hear it works out of the box. I've had some OpenEmbedded experience, so I started using what I was familiar with. The biggest issue for me is that I've done fairly heavy customisations to my OpenEmbedded Linux kernel and image. I haven't yet got a grasp of how well I can customise Petalinux to do the same. So I'm not certain it would fill my requirements yet. So it's not so much a "works first time out of the box" issue, but does it still work when I apply my customisations? (Although, I admit I haven't customised U-Boot, and it doesn't work out of the box.)

It feels like OpenEmbedded is flexible enough to be a superset of Petalinux, if you know what I mean. For example, the kernel sources are here:

https://github.com/Xilinx/linux-xlnx/releases/tag/petalinux-v2014.2-final

But it would need matching recipes too.

 

I realised the U-Boot version I'm using is actually v2014.01. This recipe overrides the one I linked to earlier.

https://github.com/Xilinx/meta-xilinx/tree/master/recipes-bsp/u-boot

0 Kudos
Visitor skoxilinx
Visitor
15,311 Views
Registered: ‎07-08-2014

Re: Booting Linux + PL bitstream from Zynq QSPI

Jump to solution

Hi

I am using Vivado/petalinux 2014.2 and have customised the PL. I built the petalinux selecting SD in the configuration submenus and this built fine. I copied the BOOT.BIN and image.ub files onto an SD card, selected the board switches (I am using a Zedboard) and it booted fine. I then selected the Flash options in the configuration submenus and rebuilt. Below is a list of all the files in the tftp folder;

 

BOOT.BIN

System.map.linux

PL_wrapper.bit

image.elf

image.ub

output.bif

rootfs.cpio

rootfs.cpio.gz

system.dtb

u-boot-s.bin

u-boot-s.elf

u-boot-s.srec

u-boot.bin

u-boot.elf

u-boot.srec

urootfs.cpio.gz

vmlinux

zImage.bin

zynq_fsbl.elf

 

I used the Xilinx SDK “Create Zynq Boot Image” option, adding the following files, to create a BOOT.mcs file.

 

zynq_fsbl.elf

PL_wrapper.bit

u-boot.elf

zImage.bin

system.dtb

rootfs.cpio.gz

 

I then used the SDK’s “Program Flash” option over the JTAG to program the flash. Unfortunately when I set the switches to boot from Flash nothing happens, even the PL does not load. Am I using the correct files or is there some option in the build I need to make. Any help would be appreciated.

 

Steve

0 Kudos
Scholar trenz-al
Scholar
15,292 Views
Registered: ‎11-09-2013

Re: Booting Linux + PL bitstream from Zynq QSPI

Jump to solution

nornally you need

 

fsbl

.bit

u-boot.elf

image.ub

 

for image.ub you probably need add correct offset when generating flash image

 

but: FPGA PL should be loaded as soon as you have fsbl and bit file, so maybe something else is wrong too

0 Kudos
Adventurer
Adventurer
15,279 Views
Registered: ‎09-19-2014

Re: Booting Linux + PL bitstream from Zynq QSPI

Jump to solution

Hi Steve,

 

It looks like you were trying to achieve the same thing I was. I'm assuming "booting from flash" means the same as my "booting from QSPI". When you're creating your BOOT.mcs file, try to follow the steps I had at the top, including following the PDF guide I had a link to. In particular, you need to correct order and offsets for the files/partitions added to the BOOT.mcs, such as (the .bif file will look like this):

 

{
  [bootloader]fsbl.elf
  PL_wrapper.bit
  u-boot.elf
  [offset = 0xF00000]zImage.bin
  [offset = 0x1400000]system.dtb
  [offset = 0x1410000]rootfs.cpio.gz
}

 

The order you have is correct, but you need to specify offsets for the partitions (for the bottom three like I did). The exact offsets differ for you, but you of course need to ensure you have enough space for all the partitions/sections before it (do some hex maths).

Then these offsets need to match what U-Boot thinks they are. Do printenv at the U-Boot prompt to see all variable values, which should tell you the offsets in qspiboot. Set this as appropriate (as I mentioned above). Then "run qspiboot".

 

I'm a bit surprised you didn't get any output at all. I would have thought at least U-Boot would have said something. Maybe remove the PL bitstream and see if you get some output. Maybe even do just the fsbl, then u-boot, and that's it. It should be enough to show you some U-Boot output. If that still doesn't work, then you can blame one of those two.

 

Also, with the Linux image file, there's a few requirements. It needs to be gziped (which you did), and it needs to be U-Boot compatible (which.. I don't think yours is). So perhaps urootfs.cpio.gz is the one that's actually U-Boot compatible.

 

trenz-al, I'm not sure exactly what the image.ub file is (assuming it's the Linux rootfs image), but it seems you missed out the Linux kernel file there.

0 Kudos
Adventurer
Adventurer
15,026 Views
Registered: ‎09-19-2014

Re: Booting Linux + PL bitstream from Zynq QSPI

Jump to solution

I did manage to resolve that kernel panic on bootup... somehow.

I suspected it was related to something in the devicetree not being quite right.

I didn't end up trying Petalinux, but I did pull the latest of all the OpenEmbedded layer repositories, and tried that, and it eventually worked. :)

Thanks trenz-al for your help!

0 Kudos
Newbie gjswalling
Newbie
5,924 Views
Registered: ‎10-15-2014

Re: Booting Linux + PL bitstream from Zynq QSPI

Jump to solution

FYI

S25FL129P is still in production.  It's a single 16MByte (128 Mbit) device, here's the data sheet:

http://www.spansion.com/Support/Datasheets/S25FL129P_00.pdf

0 Kudos
Participant diy_a
Participant
1,270 Views
Registered: ‎03-20-2017

what are the offset values to be given during creating Zynq boot image and flashing it through QSPI ?

Jump to solution

Hi,
I have successfully load fsbl.elf,bit-stream file,u-boot file in my zynq board.

what should be the offset values i have to given for linux kernel image,device tree file and ramdisk file during the creation of zynq boot image..?

I have found some offset values in environmental varibales as follows.
kernel load address 0x100000
devicetree load address 0x600000
ramdisk load address 0x620000

while giving these offsets, i am getting error in creating the boot image. and while reading these memory address,it is displaying some junk data.

How could i find the correct offset values for kernal image, device tree and ramdisk to create a successfull boot image..? here by i attached the error message screenshot..

Screenshot (4).png
Screenshot (5).png
0 Kudos