Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17268 Discussions

problem printf with de2 basic board

Altera_Forum
Honored Contributor II
2,228 Views

Hi everyone, 

 

I have some trouble with my DE2 basic board. I can't do a printf using Nios II processor, Eclipse always return that the on-chip memory is overflow but with the DE2 basic the maximum space of the Cyclone II EP2C35F672C6N on-chip memory is 64KB (the size I'm using). I haven't find any tutorial for a simple hello world (with the printf function) for the DE2 Basic board.  

So someone can help me please ? I'm using Quartus II 13.0sp1, I have created the qsys component (Nios 2 processor, Jtag_uart and 64KB on-chip memory).  

 

Regards, 

 

J.
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
889 Views

The DE2 board has external memory on it. You can use the 512 kbyte SRAM and the 8 Mbyte SDRAM. There are several examples for using each of these chips on the CD. You may need to download the latest CD from Terasic because it has QSYS examples as well as the obsolete SOPC builder. Make sure your program is compiled to load into SRAM/SDRAM. 

 

Alternately, I think that the software runtime library can be compiled so that is uses less memory. I don't know how that works but I remember seeing it somewhere.
0 Kudos
Altera_Forum
Honored Contributor II
889 Views

Hi Galfonz,  

 

Thank you for your reply and your help. I will try it. 

I have another question, do you know the size of the printf function ? Just to know and compare with others program.  

 

Thanks, 

 

J.
0 Kudos
Altera_Forum
Honored Contributor II
889 Views

You can find out how big an executable file is by creating a simple hello world program and then using the nios2-elf-size program on it from the Nios II EDS command shell. That will give you the approximate size of the runtime needed to support printf.

0 Kudos
Altera_Forum
Honored Contributor II
889 Views

I've tried with the SDRAM (8MBytes), I had no error until I start the Nios II program which said "Downloading ELF Process failed". So I've decided to see how much size the .elf file takes (right click on the .elf then properties) and I have "Size : 432 148 bytes". I do a simple printf("Hello Wolrd !"); 

 

So now I don't know why the .elf file can't be downloaded. If you have another suggestion. 

 

Thanks a lot ! 

 

J.
0 Kudos
Altera_Forum
Honored Contributor II
889 Views

Start with an example that uses SDRAM. Make sure the configuration file built by terasic works. This tells you your hardware is OK.  

 

After that, build that example and make sure it runs. Then make small incremental changes and test them every time. Keep copies of each stage and make notes so you can understand things if you go back to them later.
0 Kudos
Altera_Forum
Honored Contributor II
889 Views

Okay I'll try this. The Terasic SDRAM program works so I do something wrong. I've found another solution using only the on-chip memory. In Nios II right click on the bsp folder then properties and under Nios II BSP Properties check the reduced device drivers box and the small C library box then apply and run and in my case that works.  

 

I have one solution but I really want to make SDRAM works for my projet so I'll continue.  

 

Thank you for your replies. 

 

J.
0 Kudos
Reply