- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am running into segmentation faults using either alt_printf or printf to output debug messages from a nios 2 application via the nios2-terminal application.
The code runs fine without the debug print messages, and also runs fine with the debug print messages in debug mode with breakpoints at the troublesome debug print statements.
I will add that some debug print messages are printed normally, so it is not a systematic issue with printf / alt_printf. Changing the messages that fail still leads to a segmentation fault (reducing the size of the message or the nature of it - integer vs string for example).
It cannot be a code issue since it's running fine in debug mode. I am a bit lost here.
My RAM should be more than large enough:
$ nios2-elf-size nios_app.elf
text data bss dec hex filename
34892 884 376 36152 8d38 nios_app.elf
$ nios2-stackreport nios_app.elf
Info: (nios_app.elf) 35 KBytes program size (code + initialized data).
Info: 91 KBytes free for stack + heap.
I have the feeling that the issue comes from the JTAG uart. I have seen suggestions online to flush the stdout with fflush, but Eclipse fails to resolve the reference to fflush although stdio.h is included. Could be because I am running the economical Nios implementation?
Increasing the JTAG uart buffer size or decreasing it does not seem to make a difference.
Thank you for any suggestions!
Bertrand
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
This is a weird behaviour.
In the BSP setting did you select the JTAG Uart as the stdout for the print function?
Regards
Jingyang, Teh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Yes, stdout is the JTAG uart.
Thank you,
Bertrand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
That is very weird.
One thing could you try is to run just a simple hello world to see if it is working?
If it is fine with you could you share your project and I can try to have a look at it?
Regards
Jingyang, Teh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Sorry for the late reply.
A simple 'hello world' works fine.
It seems that changing the size of the stdout uart buffer solved the problem. A too large buffer causes the segmentation fault. Reducing the buffer size eliminated the issue (with the exact same code otherwise!).
Thank you,
Bertrand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Do you have any update on this case?
Regards
Jingyang, Teh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Sorry for the late reply.
It seems that changing the size of the stdout uart buffer solved the problem. A too large buffer causes the segmentation fault. Reducing the buffer size eliminated the issue (with the exact same code otherwise!).
Thank you,
Bertrand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
As we do not receive any response from you on the previous question/reply/answer that we have provided. Please login to ‘https://supporttickets.intel.com/s/?language=en_US’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.
Regards
Jingyang, Teh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
If you mind sharing, what was the buffer size that you use initially? and what was the reduced size that managed to get it to work?
Regards
Jingyang, Teh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Do you have any update from the previous comment?
Regards
Jingyang, Teh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
As we did not receive any response from you on the previous question/reply/answer that we have provided. Please login to ‘https://supporttickets.intel.com/s/?language=en_US’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.
Regards
Jingyang, Teh

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page