Forum Discussion
Getting started with bare-metal application development with the Cyclone V
First post!
Hello fellow FPGA enthusiasts. This is my first foray into the wide world of SoC development. A bit of background. I'm pretty much fresh out from University and work for a consumer product development firm. I'm a fairly good C coder. I did mess around with Verilog in school on a Spartan-3E FPGA but it never got very complex and thats been a few years. Anyway, I've been instructed to build familiarity with the Cyclone V. I was given the helio cyclone v soc evaluation board. My question is this, How do I get started? The quick start guide that comes with the device pretty much only tells me how to get started with Linux. I'm looking to start some tutorials that will help me blink some LED's or write 'Hello World' out a serial port. I've searched around and haven't found anything that useful. I've got Quartus installed but haven't been able to use it yet. Where can I get sample code to run? This looks pretty overwhelming from where I sit. Thank you so much for helping out a newb. I did try and search the site for questions of this nature and didn't have much luck.14 Replies
- ALTERA-INSUPPORT22
New Contributor
Assistance Needed: Trouble Running Bare-Metal Code on Cyclone 5 HPS
I am working on intel cyclone 5 hps I have two cores in a processor Core 0 core 1, I want two code to run on two different cores core 0 and core 1 in bare metal .
When I run in jtag mode it works, for jtag i first debug using core 0 where i take core 1 out of reset it, than debug core 1 usign jtag it work
BUT, When i want to run both core usign qspi it only run core 0 not core 1
Here is the step i followedFirsly, loading preloader
quartus_hps -c 1 -o P preloader-mkpimage.binI make an image from bin file of core 0 and place it to qspi
mkimage -A arm -O u-boot -T standalone -C none -a 0x00060000 -e 0 -n "baremetal image" -d core0.bin core0.img
quartus_hps -c 1 -o P -a 0x00060000 core0.img
I make an image from bin file of core 1 and place it to qspi
mkimage -A arm -O u-boot -T standalone -C none -a 0x00100000 -e 0 -n "baremetal image" -d core1.bin core1.img
quartus_hps -c 1 -o P -a 0x00100000 core1.bin
When i restart board only that code work which is in core 0, core 1 code not executingI am setting cpu1startaddress 100000 apart from that in the code of core 0 also i am using alt_qspi function to to place bin file data in ddr,
I want to run in smp mode so I also set required aux_control_register smp and fw bit as stated in tech ref manual
alt_qspi_read((uint32_t *)BL_START/*ddr3 address*/, 0x100000/*qspi address*/, 0x40000);
In linker/scat file core 0 entry point is 0x60000 andlinker/scat file core 1 entry point is 0x100000
- Altera_Forum
Honored Contributor
--- Quote Start --- Thanks so much! I'll probably need a bit to digest all of this and run through those tutorials. But I just wanted to pop on and say thank you! --- Quote End --- Easier way is to follow some example design walk through from the soc eds guide document. You will able to get more idea from there. https://www.altera.com/literature/ug/ug_soc_eds.pdf - Altera_Forum
Honored Contributor
Here are some other bare-metal resources I found:
getting started with arm ds-5 http://ds.arm.com/developer-resources/tutorials/getting-started-with-arm-ds-5-development-studio/ Some good getting started info on DS-5, like licenses, creating a bare metal app from scratch. Goes thru building an output image, but not downloading to the board and running. Goes into "Debugging the application on a Fixed Virtual Platform (FVP)". launch and debug a bare metal application on the arrow sockit board http://rocketboards.org/foswiki/view/projects/launchanddebugabaremetalapplicationonthearrowsockitboard I sometimes had some odd problems in DS-5 with this process, like I was getting "Target Message: Count not determine target state." building bare-metal applications in ds-5 using gcc compiler http://ds.arm.com/debugging-bare-metal-applications-on-fvps-using-ds-5-and-gcc-compiler/ Uses GCC compiler but recommends ARM Compiler. tutorial: altera cyclone5 soc baremetal from scratch, from sam skalicky https://samskalicky.wordpress.com/2014/06/06/tutorial-altera-cyclone5-soc-baremetal-from-scratch/ May be a good procedure but includes no content for a C file. I added my own Hello World C file. - Altera_Forum
Honored Contributor
Attached is a process for launching and debugging a bare-metal app. I believe the document came from an Arrow/ARM workshop and I have modified it to make sense to me, and have removed those parts that I did not need. Also attached is a zip file with about 40 examples. The one used in the procedure is called "Altera-Cyclone-V_RAM," which runs a Hello World app from RAM on a dev board. This was intended for the Altera SoCkit board, but I believe you can easily adapt it to other dev boards. You will need ARM's DS-5 Altera Edition software, also known as Eclipse apparently. I don't know if straight DS-5, not Altera Edition, will work.
The zip file came from an Arrow/Altera FAE. Keep in mind, the process in the .docx shows you how to run the app in debug. I have not figured out how to run the app in Release mode, or how to cause the board to boot and run the code by itself, presumably from the QSPI flash. Please let me know if you know how to do that. Ron - Altera_Forum
Honored Contributor
Hi there,
I am looking for the same. Any updates/news here? Thanks, Marcelo. - Altera_Forum
Honored Contributor
--- Quote Start --- Thanks so much! I'll probably need a bit to digest all of this and run through those tutorials. But I just wanted to pop on and say thank you! --- Quote End --- Hi ttustudent, Have you made any progress yet? Could you please share your experience with us? I'm in a similar situation like you when you started this post. Thanks - Altera_Forum
Honored Contributor
Thanks so much!
I'll probably need a bit to digest all of this and run through those tutorials. But I just wanted to pop on and say thank you! - Altera_Forum
Honored Contributor
--- Quote Start --- Thanks again for replying so fast slacker man. You're right U-Boot is bare metal code. I guess I'm just a bit overwhelmed with everything. I'm trying to look for something that will let me start playing with examples. Lets say you were just starting out with the Cyclone V, what would you do? Are there basic bare-metal tutorials in existence? They have to be really really basic as I've never coded in VHDL OR coded with an Arm Processor. --- Quote End --- Yes, the bare-metal tutorials are in the examples directory that I mentioned in my last post. They are documented. There is one hardware reference design called the GHRD or GSRD. --- Quote Start --- We have to certify all the code that goes on the ARM and Linux can never be certified so that's whey we can't use it. I'm really a hardware guy but I'm looking to get int SoC's. What I don't know :- How the ARM interfaces with the FPGA --- Quote End ---
- How to assign pins to VHDL code --- Quote End ---
- Running anything on my Eval Board --- Quote End ---
- Altera_Forum
Honored Contributor
Well, I can now at the very least blink an LED on my Helio board when I push a button. This tells me I have it hooked up correctly and have an extremely basic yet correct understanding of Quartus II! This is only using the FPGA but at the very least it is a start. :)
- Altera_Forum
Honored Contributor
People discount bare metal development, but anything that needs higher levels of certification won't be using Linux so far as I've been able to tell. Lot of cars and planes out there to casually dismiss the bare metal market... Not to mention medical devices, factory/robot automation controls, etc.
I'm somewhat in your position. I'm a software guy that needs to look into the FPGA end. I haven't seen anything special about ARM that would make it harder to do bare metal development than any other modern chip. Not simple but certainly doable. The software documented in C:\altera\13.1\embedded\altera\hps\altera_hps\doc would be a good place to start. Also look in the Altera EDS documentation. The ARM interfaces to the FPGA over AXI 3. Altera provides IP which will can convert it to the Avalon bus used in Nios. I've decided to use Avalon because it looks simpler than AXI. See the Avalon bus specification for details. I'm planning to create a component in QSYS with a slave Avalon interface. I'm currently trying to write some Verilog code to talk to the ARM. You assign pins to your FPGA with a sdc file. There are plenty of examples for that. Don't restrict yourself to looking at the Helios board only. I've been writing my code and FPGA images to an SD card. The preloader programs the FPGA at power on, then runs my ARM code. Lots of examples on how to do this too.