Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12748 Discussions

Help! trace back utility for NiOS

Altera_Forum
Honored Contributor II
1,372 Views

Hi: 

 

Can someone please let me know whether there is a traceback utility in NiOS? I want to print the function call 

trace in run-time, just like gdb but without using NiOS console. I want this function call trace to be printed on 

my UART? Is there an existing function that i can call to print the stack trace or if anyone has a handy piece of 

code, can you please share.  

 

Also, if interrupts are enabled will it also print the ISR routine and the execution path during which the  

interrupt happened? 

 

BTW, there is no operating system in the system i use and its my own micro kernel, while loop checking for 

events that happens during interrupt context and processing them. 

 

Thanks and Regards, 

Balaji
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
660 Views

If you have compiled with a frame pointer then you may be able to build your own on top of the GCC function __builtin_return_address. 

 

This probably won't be able to trace back through interrupts as they use a different format of stack frame.
0 Kudos
Altera_Forum
Honored Contributor II
660 Views

Thanks for your reply, can you please let me know if there is an example code around? And what is the compiler option 

to enable frame pointer, i'm not optimising the code, will not framepointer be already there? 

 

Thanks and Regards, 

Balaji
0 Kudos
Altera_Forum
Honored Contributor II
660 Views

Sorry, no example designs for this. 

 

See the GCC documentation for details of how to enable the frame pointer. I think it's something like -fno-omit-frame-pointer but I probably spelt that wrong.
0 Kudos
Reply