Forum Discussion
Printf not displaying characters
I have a problem with the printf function,
# include <stdio.h> int main() { printf("Hello from Nios II!\n"); return 0; } that is the simple program that i tried to run, however the printf function did not print the sentence to the console, i am using the nios2 IDE. does anyone know why it doesnt display the printf sentence? the console remains as this: nios2-terminal: connected to hardware target using JTAG UART on cable nios2-terminal: "USB-Blaster [USB-0]", device 1, instance 0 nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate)14 Replies
- Altera_Forum
Honored Contributor
I have the same problem. printf() does not display any characters on the console. If I place all sections in the external SRAM everything works fine. Running from within the onchip RAM the function does not display anything. Maybe printf() requires more RAM. I have only 2k left (internal RAM). In all of my last application this was no problem, but now there is ess memory. Maybe this is the reason?
Try to use more on-chip RAM. - Altera_Forum
Honored Contributor
Hi all,
I know it is very late to answer this question. However, I decided to post what I found just in case someone come by this thread or searches for this problem then he can find my notes. What I found is that printf() can work only if the related interrupt is enabled. You can put alt_irq_enable_all( 0x01 ); at the beginning of your main function and hopefully everything will go fine. - Altera_Forum
Honored Contributor
long shot...but i have the same problem after updating to windows 10...JTAG i qsys, stdio set to jtag code running(led control) but no output from alt_printf or printf but both functions returns...
thanks in advance (in case somebody sees this old thread) - Altera_Forum
Honored Contributor
Found something. Hope this helps: https://www.altera.com/support/support-resources/knowledge-base/solutions/rd12102004_5019.html