- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First, some background. I am using MicroC/OS-II and one of my tasks (the start task, if it matters) does the following:
for (;;)
{
OSTimeDly(OS_TICKS_PER_SEC * 2);
printf("CPU Usage = %d\n", OSCPUUsage);
}
I use this mainly as a sanity check to make sure that something is running. I recently switched to Nios II 1.1. After this, some strange things started happening to my boards. LEDs would light for no reason, switches would be read for no reason. After some investigation, it seems that printf is writing into memory. Were there any changes made to the printf functionality? I am using the jtag uart and all output is directed to the jtag uart. Any ideas?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This looks like a stack overflow to me. How large is the stack for this task?
The standard printf uses a surprisingly large amount of stack space (at least 1.5kB) - ticking the small printf option makes it use less. I don't remember there being any deliberate changes to printf, but the compiler was upgraded between 1.0 and 1.1 (and with it the newlib implementation of printf) so that might have increased the stack usage enough to tip your task over the edge.
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