- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to put my Nios II software project into my FPGA bitstream. I have an idea on how to do it, please comment:
1) Build software .elf file 2) In Nios console, use elf2hex to make hex file 3) Copy hex file into FPGA project directory 4) In on-chip memory initialization in SOPC builder, specify the right file name for the hex file 5) Generate SOPC system 6) Build FPGA Is this about right? Thanks, -BradLink Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if you are using all on board RAM to run your Nios C code, all you have to do is compile the C code in Nios IDE and then recompile the quartus project, it should pick up the last compiled elf file.
I'm assuming Quartus looks for the elf file that is associated with the .sopc file you specified in Nios IDE. I don't know the exact details of it since it has just worked for me. Have you configured the fpga with you .sof or other config file then run your C code using the nios ide debugger?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Spaugh,
Thanks for the reply. I didn't think it was possible to just let Quartus pick up an elf. I don't think elfs can be put in the FPGA directly. I later looked in the Nios II Software Developer Handbook at http://www.altera.com/literature/hb/nios2/n2sw_nii5v2.pdf p.51, Creating an Internal Boot Memory Initialization File. This calls for running the mem_init_install Make Target in Eclipse to produce all memory init files, including Intel .hex files for the software. When I went to do this, there did not appear to be a Make Target listed for mem_init_install. I created one with the name and make target of mem_init_install and ran that one. It built all the memory initialization files. I then rebuilt my Quartus FPGA project and booted up my board--success, software ran by itself with no debug connection. So you haven't had to do this, eh? Come to think of it, I'm not sure I even tried it before I followed this procedure, I assumed there was something extra you had to do. -Brad- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The answer depends on the version of the tools you are using. In the old days it was true that compiling your software would automatically generate the .hex file and all you'd have to do is run your Quartus project. However, let's assume you are up to date on tools.
What I would do ... 1) Generate SoPC system (you can potentially re-order this) 2) Build your software (produce your .elf file) 3) The makefile includes a make target called "mem_init_install". If you make this target it will convert the .elf to a .hex and copy the file to the folder where the onchip ram variation is located (the same directory where your SoPC system is located). 4) Compile your FPGA project in Quartus. Now I haven't actually used 10.0 yet. It's possible they've returned to making the mem_init_install step automatic. I doubt it though. Jake- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm running Quartus 9.1 build 222 and Nios IDE 9.1 build 222 It is picking up my software and bundling it into my .sof and .rbf files that it generates for me every time I do a VHDL build.
I can do a software compile in NIOS IDE. Then do a Quartus build and my new software is included automatically in the .sof file. There is a .hex file that is generated and placed in the same directory as my .ptf (sopc file) and the other files SOPC builder outputs. In your system library settings in NIOS IDE you have to tell the tool which .ptf file you are targeting your software to. Also you need to tell the tool which memory segment your code sections reside in. I have all of my code in an onchip memory called "onchip_memory". NIOS IDE is creating a file called "onchip_memory.hex" in the SOPC directory and it seems Quartus is picking this file up and including the code to load my hex file from the EPCS device into onchip memory automatically. Works great. I'd suggest starting with a clean project and giving it a shot.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yeah that surprises me. I don't know how that's occurring. Here are a few bits of info on the subject:
http://www.altera.com/support/kdb/solutions/rd07082010_98.html and page 2-25 of this: http://www.altera.com/literature/hb/nios2/n2sw_nii5v2.pd Jake- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Its been working this way for my co workers and I since version 7 of Quartus and Nios IDE I believe. It has worked this way since we started using Altera products and Nios. Works the same way on several of our PC's at work running different versions of Quartus and Nios IDE and Windows. They are all picking up the .hex files and including them in our Quartus builds automatically.
when you setup a memory in SOPC builder, it asks you about initialization of the memory.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using the deprecated NIOS II IDE .. or the newer NIOS II Software Build Tools? It's true that the deprecated NIOS II IDE did this for you automatically (that's what I meant by the "old days"). However, the NIOS II SBT does not.
Jake- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm still using that ancient IDE tool. :D I downloaded it a couple of months ago.
Is there an advantage to use the SBT version? I think we tried using it and had some problems with the BSP portion. I'm the only guy here doing the work of a team of people so I just use whatever works as I don't have much time to spend learning new tools. But yes, I see that we are using legacy software (IDE). It seems to work well.- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page