sahandKashani / SoC-FPGA-Design-Guide

Tutorial for using the DE1-SoC/DE0-Nano-SoC boards for bare-metal and linux programming
The Unlicense
64 stars 17 forks source link

Testing setup #5

Closed nuraalkhateeb closed 7 years ago

nuraalkhateeb commented 8 years ago

Hi Sahand,

I'm currently coming across this error when manually running each command and by running your 'create_linux_system.h' script

U-Boot 2016.07-rc1-dirty (Jun 30 2016 - 15:19:44 -0400)

CPU: Altera SoCFPGA Platform
FPGA: Altera Cyclone V, SE/A5 or SX/C5 or ST/D5, version 0x0
BOOT: SD/MMC Internal Transceiver (3.0V)
Watchdog enabled
I2C: ready
DRAM: 1 GiB
MMC: dwmmc0@ff704000: 0
In: serial
Out: serial
Err: serial
Model: Altera SOCFPGA Cyclone V SoC Development Kit
Net:
Error: ethernet@ff702000 address not set.
No ethernet found.

I did see this in the log you posted as well, but for some reason autoboot keeps happening on my side. So I haven't been able to log in with username and password or even get to that screen. Let me know if I missed something or doing something wrong.

When it reboots it pauses at the error below for a bit as well

Kernel image @ 0x1000000 [ 0x000000 - 0x3d52e8 ]
FDT and ATAGS support not compiled in - hanging
.### ERROR ### Please RESET the board ###

Thanks, ~Nora

sahandKashani commented 8 years ago

Hi,

I've unfortunately never had that error message before.

Can you post the full log from the moment you turn on the board until it hangs? Is it hanging in uboot, or is the linux kernel hanging? (I think it is uboot, but just to be sure).

nuraalkhateeb commented 8 years ago

Hi Sahand,

I'm honestly not 100% sure but here is the full log

Welcome to minicom 2.7

OPTIONS: I18n
Compiled on Jan 1 2014, 17:13:19.
Port /dev/ttyUSB0, 10:57:23

Press CTRL-A Z for help on special keys

U-Boot SPL 2013.01.01 (Jun 30 2016 - 15:19:39)
BOARD : Altera SOCFPGA Cyclone V Board
CLOCK: EOSC1 clock 25000 KHz
CLOCK: EOSC2 clock 25000 KHz
CLOCK: F2S_SDR_REF clock 0 KHz
CLOCK: F2S_PER_REF clock 0 KHz
CLOCK: MPU clock 925 MHz
CLOCK: DDR clock 400 MHz
CLOCK: UART clock 100000 KHz
CLOCK: MMC clock 50000 KHz
CLOCK: QSPI clock 370000 KHz RESET: COLD INFO : Watchdog enabled SDRAM: Initializing MMR registers
SDRAM: Calibrating PHY
SEQ.C: Preparing to start memory calibration
SEQ.C: CALIBRATION PASSED
SDRAM: 1024 MiB
ALTERA DWMMC: 0
reading u-boot.img
reading u-boot.img

U-Boot 2016.07-rc1-dirty (Jun 30 2016 - 15:19:44 -0400)

CPU: Altera SoCFPGA Platform
FPGA: Altera Cyclone V, SE/A5 or SX/C5 or ST/D5, version 0x0
BOOT: SD/MMC Internal Transceiver (3.0V)
Watchdog enabled
I2C: ready
DRAM: 1 GiB
MMC: dwmmc0@ff704000: 0
In: serial
Out: serial
Err: serial
Model: Altera SOCFPGA Cyclone V SoC Development Kit
Net:
Error: ethernet@ff702000 address not set.
No ethernet found.
Hit any key to stop autoboot: 0
reading zImage
4018920 bytes read in 220 ms (17.4 MiB/s)
fatload - load binary file from a dos filesystem

Usage:
fatload [<dev[:part]> [ [ [bytes [pos]]]]]

Usage:
mmc info - display info of the current MMC device
mmc read addr blk# cnt
mmc write addr blk# cnt
mmc erase blk# cnt
mmc rescan
mmc part - lists available partition on current mmc device
mmc dev [dev] [part] - show or set current mmc device [partition]
mmc list - lists available devices
mmc hwpartition [args...] - does hardware partitioning
arguments (sizes in 512-byte blocks):
[user [enh start cnt] [wrrel {on|off}]] - sets user data area attributes
[gp1|gp2|gp3|gp4 cnt [enh] [wrrel {on|off}]] - general purpose partition
[check|set|complete] - mode, complete set partitioning completed
WARNING: Partitioning is a write-once setting once it is set to complete.
Power cycling is required to initialize partitions after set to complete.
mmc setdsr - set DSR register value

Kernel image @ 0x1000000 [ 0x000000 - 0x3d52e8 ]
FDT and ATAGS support not compiled in - hanging

ERROR ### Please RESET the board

sahandKashani commented 8 years ago

Hi,

It looks like u-boot is not running the code contained in the script, but is instead following some default internal commands (I see this, because it is starting by loading zImage, instead of setting environment variables as is done in the u-boot.scr script).

It is difficult to tell like this, but I would try to delete the sw/hps/u-boot directory and to launch the script to perform the compile_uboot function, and the partition_sdcaard and write_sdcard functions only. I would like to see if some encoding issue happened somewhere in the middle.

It is also possible that the sdcard you are using has issues. I have seen this on a few sdcards. U-boot doesn't work on them as intended (I have no idea why). I currently have one such sdcard in the lab, but haven't had the time to jump into it to see what is specifically wrong. If you have another sdcard available, try that one for your design to try to isolate the problem with the current setup.

If that still doesn't work, then I could somehow send you a working sdcard image from the original design in the tutorial. You could then dd the image onto your sdcard to check if it is indeed a faulty sdcard, or a design problem.

sahandKashani commented 8 years ago

Hi,

Were you able to solve the issue?

nuraalkhateeb commented 8 years ago

Sorry, we were off for the holiday. Reading your comments now and will try getting it to work today or tomorrow. I'll keep you updated and thank you for following up.

nuraalkhateeb commented 8 years ago

I haven't had a chance to look at the errors yet. As soon as I do I'll get back with the results.

sahandKashani commented 8 years ago

Try to stop the u-boot boot process by pressing any button when it starts. Then type the following at the u-boot command line.

env default -a
saveenv

Then restart the board and see what happens.

nuraalkhateeb commented 7 years ago

Hi Sahand,

Is it possible to only update the preloader each time the hps side in qsys gets changed? I'm currently using the SD card image that Terasic has on their site for the DE0-Nano board and was hoping I didn't have to mess with boot loader, linux kernel, and the filesystem on the sdcard.

sahandKashani commented 7 years ago

Yes, but you have to regenerate the preloader manually each time you change the HPS configuration in Qsys. You can just invoke the bsp-editor as is done in part 13.1 of the guide. You will then need to manually overwrite it on the sdcard by using something like dd if=preloader-mkpimage.bin of=/dev/sdxN bs=64K seek=0.

You'll have to see what N corresponds to in /dev/sdxN by using fdisk. I haven't tried this personally though since it has been a very long time since I've used the terasic sdcards.

nuraalkhateeb commented 7 years ago

Thanks.

I used fdisk - l screenshot from 2017-01-17 15 33 39

Would the below command be correct according to the image I attached? dd if=preloader-mkpimage.bin of=/dev/sdd3 bs=2K seek=0

nuraalkhateeb commented 7 years ago

I executed the command above and got capture

sahandKashani commented 7 years ago

It's difficult to say where the problem comes from as there are many variables.

The first thing I would do is use the same version of the preloader that terasic uses in their sdcard (since you want to use their sdcard). I've noticed that some versions of the preloader don't work with certain bootloaders, so you would need to find the source for the specific preloader used (which is normally in your altera installation folder somewhere) and use it to create your preloader.

I don't know how you would do this, but you should first check what options terasic's preloader is using to be sure you are using the same ones for the transition to the bootloader to be successful. Specifically what I'm thinking of is whether the FAT SUPPORT is enabled, although others are also applicable and need to be known.

It would be useful to know what err -1 means specifically. You can search through the source code of the said preloader to find that out. Unfortunately I can't do the search myself at the time due to other work on multiple fronts.

nuraalkhateeb commented 7 years ago

I realized there was an error when compiling the preloader with the make command. I fixed it but now when I try to boot the DE0-Nano board from the sd card it pauses at I2C: ready

capture

Let me know if you have any ideas to why this would happen.

Thank you

nuraalkhateeb commented 7 years ago

I also tried updating the u-boot image as well but it pauses at I2C: ready. I thought maybe updating the a2 partition with both the preloader and the u-boot image would solve it rather than just updating the preloader.

nuraalkhateeb commented 7 years ago

I was able to pass I2C: ready by getting a later version of u-boot

capture2

Now linux hangs on starting kernel....

capture

I may have to also update the linux kernel.

nuraalkhateeb commented 7 years ago

Linux is working now, I had to update the preloader, bootloader, linux image, and the device tree blob. Not sure if there was a mismatch with just updating the preloader initially. I'll try updating only the preloader the next time I update the HPS side and see if that works now that I have the latest versions of the files.

Thank you

sahandKashani commented 7 years ago

At the end of the day, you had to update everything.

nuraalkhateeb commented 7 years ago

Now it works, I just updated the preloader alone without any of the other files and Linux did not hang.

Thanks Sahand.