- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
I've encountered a strange behaviour of prinf function. The code is a simple "hello world" example:#include <stdio.h>
int main()
{
printf("Hello 1\n");
printf("HELLO 2\n");
return 0;
}
It works and the result are two lines in console. But once i remove the second printf, it does not show up a line. When I run debug, it seem that processor executes something and does not even reach the main function. The QSys system is Nios(50MHz)+JTAG UART(50MHz)->clock bridge(50 to 143MHz)->SDRAM controller(143MHz), and timing constraints are met. Just found out that it works if there is no \n symbol.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try with a delay loop just before the return or even with a while(1) after the last printf.
Functions like printf are non-blocking: the string is sent to the jtag uart buffer, but transmission will take place when the interface is ready, thus it could be delayed. Terminating the program before transmission has completed could prevent data from being received by your terminal.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page