Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

Baremetal examples which uses u-boot doesnt work

Hello I am trying to run Baremetal appication on Cyclone V SoC on SoCrates 1.2 board.

Simple applications like Altera-SoCFPGA-HelloWorld-Baremetal works, but as I get to Altera-SocFPGA-HardwareLib-FPGA example it just hangs on waiting for spl_boot_device breakpoint, then I have to push reset button to make it do anything.

I have tried also replacing u-boot with u-boot that ist working for linux on the same board with no results. I've tried both ARMCC and GCC compilers.

I've tried to work from HelloWorld example but there are two limitations, applications can by only 64K and there is no access to memory out of 0xFFFF0000 to 0xFFFFFFF region and memory mapped devices in FPGA on AXI bus.

There is log from Commands window of DS-5:

Target has been resetExecution stopped at: S:0x00002FA8
S:0x00002FA8   TST      r1,#4
+stop
WARNING(CMD315): Target is not running
+wait 30s
+set semihosting enabled false
+loadfile "$sdir/u-boot-spl.axf" 0x0
Loaded section .text: S:0xFFFF0000 ~ S:0xFFFF9543 (size 0x9544)
Loaded section .rodata: S:0xFFFF9544 ~ S:0xFFFFAF33 (size 0x19F0)
Loaded section .data: S:0xFFFFAF38 ~ S:0xFFFFBDFF (size 0xEC8)
Loaded section .bss: S:0xFFFFBE00 ~ S:0xFFFFBEA7 (size 0xA8)
Loaded section .malloc: S:0xFFFFBEA8 ~ S:0xFFFFD2A7 (size 0x1400)
Loaded section .stack: S:0xFFFFD2A8 ~ S:0xFFFFE2A7 (size 0x1000)
Loaded section .spl_irq_stack: S:0xFFFFE2A8 ~ S:0xFFFFE6AF (size 0x408)
Entry point S:0xFFFF0000
+set semihosting enabled true
Semihosting server socket created at port 8000
+delete
All user breakpoints deleted
+tbreak spl_boot_device
Breakpoint 1 at S:0xFFFF0F8C
    on file spl.c, line 67
    on file spl.c, line 75
+run
Starting target with image /home/bruno/DS-5-Workspace/Altera-SoCFPGA-HardwareLib-FPGA-CV-ARMCC/u-boot-spl.axf
Running from entry point
+wait

Is there anyway to fix hangs when using u-boot and baremetal or to not use u-boot at all and get access to memory mapped devices?

Thank you.

7 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The preloader is what initializes main memory. You don't seem to be using it. If you use the preloader and have it load u-boot off of flash or SDcard, you will be able to use all of memory.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    I'm having a similar issue. Could you please elaborate your answer and help describe the flow?

    I have generated the preloader using the bsp-editor and ran a "make" command to generate the bin file. Using the preloader here means using the (.ds) file?

    Thanks in advance.

    Best Regards,

    Nitin.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    There are a number of guides and tutorials at http://rocketboards.org/foswiki/documentation/webhome. They go into more detail than the SOC Arrow training does. Most are not for the socrates board, but the same principles apply. See "Generating and Compiling the Preloader" near the bottom for info on updating the individual parts of the SD card.

    I would stick with GCC for uboot and preloader. That is what they were developed with. Make sure you use the bare metal gcc version given in the tutorial not the linux version. Also, make sure you are using the tutorial version for the quartus EDS version you are using. It usually doesn't matter, but it can occasionally trip you up.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for your reply. I did generate and update the SD card with the preloader and the uboot image. When I checked the makefile, the compiler used for this process was the arm-altera-eabi-gcc which is the baremetal version of gcc for altera.

    Could you please help describe the next step for baremetal debugging? I have written and application in the Altera DS-5 eclipse and programmed the FPGA with the hardware image. I'm not sure on how to link the application with the underlying image so that it breaks at the main() function.

    I believe a (.ds) script with appropriate commands is needed which runs the pre-loader and stops at the main function. But i'm not completely sure on what commands/steps are to be followed. Please advise.

    Thanks in advance. Awaiting your reply.

    Best Regards,

    Nitin.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I don't have the paid version of DS-5 so I can't help you with using it. Altera has some videos on their youtube channel that demo debugging bare metal. The demos of debugging uboot and linux booting would also help. You are correct in saying that a .ds file is needed to initialize the hardware. I believe one is generated for you if you pick the correct bare metal project type when creating your DS-5 project. Makefile and linker script are also created for you.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    Thanks for your reply. After trying out multiple examples I realized that the examples are designed for Altera version of cyclone V and is not compatible with Arrow SoCkit. Even the preloaders that was generated by the hardware I designed doesn't work.

    Hopefully this is my last question.

    I found an example from rocket boards which worked. Hence I tried to replace the executable in the example by my application and loaded the FPGA with the hardware I had built instead of the example program. It seems to work.

    I believe preloader functions are almost common. Is running my application with example program's environment legit?

    Thanks and Regards,

    Nitin.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    For the Arrow SoCkit I always start with the GSRD design found on rocketboards.org as well. That works for me. In theory, it should be possible to start from scratch and make a project that will work with the SocKit. I've tried it a bit and didn't get anywhere. If I have time I'd like to have another try at some point. I think that the only differences are the SDRAM settings and what HPS devices are brought out and what pins they are connected to.

    I've used the GSRD preloader to load applications other than UBOOT. As long as you create a correctly formed image and update the SD card it will load. Mine ran slower because it doesn't initialize like UBOOT/linux does. But that didn't matter in what I was doing. I haven't looked into what UBOOT/linux do to speed up processing that I could duplicate in a standalone app.