U-boot spl for De0 Nano SoC Kit

Hi, I used your instructions to build an image for De0 Nano Soc Kit, and it works well.
However, the uboot-with-spl.sfp, while it works to boot to Linux, does not manage the loading of FPGA *.rbf file.
If I have an FPGA file I want to load on boot, the “normal” approach from Intel/Altera as recommended by the GSRD releases is to use their SoCEDS tools to generae a makepimage.bin for the SPL and build Uboot from their local tar of an old/Altera modded uboot. I want to use the latest U-boot, but these modifications to allow FPGA loading (including the FPGA handoff code/etc) does not appear to be in your patches.

Is this possible on the latest U-boot, or do I need to revert to the older Altera/Intel toolchain?

@petesmudge, sadly today we still have to use the older Altera/Intel toolchain. Patches have been posted to the u-boot mailing list, but last i checked they haven’t been fully integrated yet. So we are getting “very” close to FPGA loading on mainline u-boot…

Regards,

1 Like

Thanks for the reply - I would be very interested to see this become available, as it would make maintaining the codebase more optimal if I can just patch settings changed by the FPGA to my u-Boot tree and build it all in uBoot without having to do a full SoCEDS install and manual/GUI based steps.

Hello Robert! First of all, thank you so much for this article - it really helped and saved a lot of time. I used it to create Linux image for our De0-Nano-based hardware, and Linux part was launched and is working without any problem - everything just fine.
My question is the same as the Pete’s… how can we init FPGA with custom RBF-configuration on a u-boot stage now? As far as I figured out Intel/Altera’s codebase is a bit behind u-boot’s “trunk”. Anyway, could you please point me how to make our new U-boot/Linux system and FPGA behave like friends? Pete had mentioned about Altera’s toolchain but I’m really new to this topic and need a huge kick in a right direction.

Thanks in advance!

@AlexeyG, i just updated that page for u-boot v2019.01-rc2… I think the fpga patches got merged:

 => version 
U-Boot 2019.01-rc2-dirty (Jan 03 2019 - 11:19:36 -0600)

arm-linux-gnueabihf-gcc (Linaro GCC 6.4-2018.05) 6.4.1 20180425 [linaro-6.4-2018.05 revision 7b15d0869c096fe39603ad63dc19ab7cf035eb70]
GNU ld (Linaro_Binutils-2018.05) 2.27.0.20161229
=> fpga 
fpga - loadable FPGA image support

Usage:
fpga [operation type] [device number] [image address] [image size]
fpga operations:
  dump	[dev] [address] [size]	Load device to memory buffer
  info	[dev]			list known device information
  load	[dev] [address] [size]	Load device from memory buffer
  loadb	[dev] [address] [size]	Load device from bitstream buffer (Xilinx only)

=> fpga info
Altera Device
Descriptor @ 0x3ffcae14
Family:        	SoC FPGA
Interface type:	Fast Passive Parallel (FPP)
Device Size:   	4294967295 bytes
Cookie:        	0x0 (0)
No Device Function Table.

Do you have a bit-stream to try? Didn’t Terasic have an arduino example at one time?

Regards,

@AlexeyG, i used the DE0_NANO_SOC_ARDUINO.sof this archive DE0_NANO_SOC_ARDUINO.zip, located here: http://download.terasic.com/downloads/cd-rom/de0-nano-soc/

Use the quartus_cfp tool to convert it to *.rbf

quartus/bin/quartus_cpf -c DE0_NANO_SOC_ARDUINO.sof DE0_NANO_SOC_ARDUINO.rbf

Then from u-boot:

load mmc 0:2 0x2000000 /boot/deo.rbf
fpga load 0 0x2000000 ${filesize}
=> load mmc 0:2 0x2000000 /boot/deo.rbf
4244820 bytes read in 224 ms (18.1 MiB/s)
=> fpga load 0 0x2000000 ${filesize}
=> fpga info
Altera Device
Descriptor @ 0x3ffcae14
Family:        	SoC FPGA
Interface type:	Fast Passive Parallel (FPP)
Device Size:   	4294967295 bytes
Cookie:        	0x0 (0)
No Device Function Table.

So it seems to have loaded… Just make sure the MSEL switch settings are in the rbf format (up-up-down-up-up-up = uncompressed rbf)

Regards,

@RobertCNelson, I followed your instructions from here https://www.digikey.com/eewiki/display/linuxonarm/DE0-Nano-SoC+Kit

When I boot with SD card, it hangs in u-boot prompt

U-Boot SPL 2019.01 (Feb 08 2019 - 13:35:06 +1300)
Trying to boot from MMC1

U-Boot 2019.01 (Feb 08 2019 - 13:35:06 +1300)

CPU: Altera SoCFPGA Platform
FPGA: Altera Cyclone V, SE/A4 or SX/C4, version 0x0
BOOT: SD/MMC Internal Transceiver (3.0V)
DRAM: 1 GiB

Any help is appreciated

@ankurt, What is the model number and revision printed on the pcb of this board?

Since it’s failing during DDR init, can you please double check with a 2nd microSD, just in case it’s a was a corrupted flash issue.

Regards,

@RobertCNelson, it is DE0-Nano-SoC kit rev D0. This is what printed on PCB:
10-01411050-D0 1826 F 94V-0

Thanks @ankurt, I do have a few of those at work, so i can double check it tomorrow morning when i get back into the office.

Regards,

Thanks @RobertCNelson for your prompt replies, I will also try will another SD card

@ankurt, can you please try both of these builds:

wget -c https://github.com/eewiki/u-boot-testing/raw/master/socfpga_de0_nano_soc/u-boot-2019.01-with-spl.sfp
sudo dd if=./u-boot-2019.01-with-spl.sfp of=${DISK}1
wget -c https://github.com/eewiki/u-boot-testing/raw/master/socfpga_de0_nano_soc/u-boot-2018.07-with-spl.sfp
sudo dd if=./u-boot-2018.07-with-spl.sfp of=${DISK}1

Both where tested with my DE0_NANO

Regards,

@RobertCNelson, I tried both your images but it seems something is not correct when writing to SD card.
I have tried different SD card and with that one I can’t see any log on console.

I do this on every SD card

sudo dd if=/dev/zero of=${DISK} bs=1M count=64
sudo sfdisk ${DISK} <<-__EOF__
1M,1M,0xA2,
2M,,,*
__EOF__
sudo dd if=./u-boot/u-boot-with-spl.sfp of=${DISK}1

Are above steps correct ?

@ankurt, yes those are correct for sfdisk newer then 2.26.x.

Are you using a virtual machine? Or are you running linux natively on your desktop pc?

Regards,

I am running native Linux, Ubuntu 18 64bit

@RobertCNelson, I tried with another SD card and still getting the same problem with your images as well

U-Boot SPL 2019.01-dirty (Feb 08 2019 - 10:08:31 -0600)
Trying to boot from MMC1

U-Boot 2019.01-dirty (Feb 08 2019 - 10:08:31 -0600)

CPU: Altera SoCFPGA Platform
FPGA: Altera Cyclone V, SE/A4 or SX/C4, version 0x0
BOOT: SD/MMC Internal Transceiver (3.0V)
DRAM: 1 GiB

U-Boot SPL 2018.07-dirty (Feb 08 2019 - 10:18:57 -0600)
Trying to boot from MMC1

U-Boot 2018.07-dirty (Feb 08 2019 - 10:18:57 -0600)

CPU: Altera SoCFPGA Platform
FPGA: Altera Cyclone V, SE/A4 or SX/C4, version 0x0
BOOT: SD/MMC Internal Transceiver (3.0V)
Watchdog enabled
DRAM: 1 GiB

This is the log of SD card tasks:

nws@ubuntu:~/Documents$ export DISK=/dev/sdb

nws@ubuntu:~/Documents$ sudo dd if=/dev/zero of=${DISK} bs=1M count=64

64+0 records in
64+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 15.2335 s, 4.4 MB/s

nws@ubuntu:~/Documents$ sudo sfdisk ${DISK} <<-EOF

1M,1M,0xA2,
2M,*
EOF

Checking that no-one is using this disk right now … OK

Disk /dev/sdb: 3.7 GiB, 3904897024 bytes, 7626752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Created a new DOS disklabel with disk identifier 0x681993a3.
/dev/sdb1: Created a new partition 1 of type ‘Unknown’ and of size 1 MiB.
/dev/sdb2: Created a new partition 2 of type ‘Linux’ and of size 3.7 GiB.
/dev/sdb3: Done.

New situation:
Disklabel type: dos
Disk identifier: 0x681993a3

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 4095 2048 1M a2 unknown
/dev/sdb2 * 4096 7626751 7622656 3.7G 83 Linux

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
nws@ubuntu:~/Documents$ sudo dd if=./altera/rcn/u-boot-2019.01-with-spl.sfp of=${DISK}1
1606+1 records in
1606+1 records out
822649 bytes (823 kB, 803 KiB) copied, 0.913883 s, 900 kB/s

And then I take SD card out of USB card reader and insert in the SD card slot of DE0-Nano-SoC kit

Thanks for testing @ankurt, this is starting to look like a hardware change introduced in Rev D boards. What images currently work for you? I’ve started digging thru terasic’s docs: downloads

Edit, i don’t see any changes to the memory interface or the modules utilized.

Regards,

Currently I can only boot with the SD card that came with the kit and it had terasic image in it. It is an old version of uboot (2014).

It is quite weird that SPL is getting loaded from MMC and when u-boot is running it is getting stuck in detecting MMC interface.

@ankurt, when did you purchase this board? We are trying to figure out when the rev d’s entered the channel.

Regards,