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++

eCos and the Nios IDE 6.0

Altera_Forum
Honored Contributor II
1,257 Views

I am having tremendous problems using the Nios IDE to perform debugging on an eCos based Nios 2 design. Most of the breakpoints I put in do not stop the processor (unless I put them in from the "disassembly window). Also, once the processor is paused, it doesn't single step correctly. Also, even though I enabled GDB support for multithread debugging, the IDE doesn't show any information on any threads (it just says one thread starting from "no symbol". 

 

Does anyone else out there have these problems? Is there a configuration for GDB stuff that works good? Do other people use completely different tools for debugging their eCos Nios applications?  

 

I am really stuck here as I have printf statements scattered all over my code as there is no other way for me to perform the debugging. Please help.
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
333 Views

That sounds like you are trying to single-step through optimised code. ecos sets the optimisation level to 3 by default, which changes the code execution order and makes single stepping difficult to do. If you haven't done this already then change the optimisation to zero in the ecos configuration tool, then do a clean build of ecos and your application. 

 

The optimisation level is set in the "Global build options" folder in the ecos configuration tool. Change the global compiler flags from -O3 to -O0 to switch off the optimisation. 

 

Mike
0 Kudos
Altera_Forum
Honored Contributor II
333 Views

 

--- Quote Start ---  

originally posted by snadden@Sep 21 2006, 07:41 AM 

that sounds like you are trying to single-step through optimised code. ecos sets the optimisation level to 3 by default, which changes the code execution order and makes single stepping difficult to do. if you haven't done this already then change the optimisation to zero in the ecos configuration tool, then do a clean build of ecos and your application. 

 

the optimisation level is set in the "global build options" folder in the ecos configuration tool. change the global compiler flags from -o3 to -o0 to switch off the optimisation. 

 

mike 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=18378) 

--- quote end ---  

 

--- Quote End ---  

 

Yeah, I found that out first. I am now running with O0 as the optimizations. Still having the same problems (although the disassembled code is easier to follow now).
0 Kudos
Altera_Forum
Honored Contributor II
333 Views

OK. Sorry, but I don&#39;t have any more ideas to suggest! I find that I can&#39;t set breakpoints in the ecos source code at all. I can only step into the ecos source code form map app using the debugger which is really tedious. If you find a good solution then please post it to the forum. 

 

Mike
0 Kudos
Altera_Forum
Honored Contributor II
333 Views

 

--- Quote Start ---  

originally posted by seanbacon@Sep 21 2006, 07:33 AM 

most of the breakpoints i put in do not stop the processor (unless i put them in from the "disassembly window).  

--- Quote End ---  

 

Silly question, do the sources you see in the IDE and the one you use to compile match? 

 

 

--- Quote Start ---  

originally posted by seanbacon@Sep 21 2006, 07:33 AM 

also, once the processor is paused, it doesn&#39;t single step correctly.  also, even though i enabled gdb support for multithread debugging, the ide doesn&#39;t show any information on any threads (it just says one thread starting from "no symbol". 

--- Quote End ---  

 

What connection do you use for debugging? If you use the IDE default way, you debug over an jtag server that connects to the processor debug interface. 

 

Ecos enables an gdb stub, that communictates over a serial line or network with gdb. As I understand this, if you enable multithreading support in ecos the ALTERA debug server doesn&#39;t know about it. 

 

You can set breakpoints in the gdb console. In the console view in the title bar there is an icon that lets you switch consoles. You can view download output, stdout, jtag server messages and the standard (comand line) gdb interface. Just open the gdb console and type &#39;b <my function>&#39; and you set a breakpoint. 

 

Bye,  

Wolfgang
0 Kudos
Altera_Forum
Honored Contributor II
333 Views

 

--- Quote Start ---  

originally posted by wpaulus+sep 25 2006, 04:33 am--><div class='quotetop'>quote (wpaulus @ sep 25 2006, 04:33 am)</div> 

--- quote start ---  

<!--quotebegin-seanbacon@Sep 21 2006, 07:33 AM 

most of the breakpoints i put in do not stop the processor (unless i put them in from the "disassembly window).  

--- Quote End ---  

 

Silly question, do the sources you see in the IDE and the one you use to compile match? 

 

Yes, my sources seem to match. And the disassembly matches the object dump of the elf file. 

 

 

--- Quote Start ---  

originally posted by seanbacon@Sep 21 2006, 07:33 AM 

also, once the processor is paused, it doesn&#39;t single step correctly.  also, even though i enabled gdb support for multithread debugging, the ide doesn&#39;t show any information on any threads (it just says one thread starting from "no symbol". 

--- Quote End ---  

 

What connection do you use for debugging? If you use the IDE default way, you debug over an jtag server that connects to the processor debug interface. 

 

Ecos enables an gdb stub, that communictates over a serial line or network with gdb. As I understand this, if you enable multithreading support in ecos the ALTERA debug server doesn&#39;t know about it. 

 

You can set breakpoints in the gdb console. In the console view in the title bar there is an icon that lets you switch consoles. You can view download output, stdout, jtag server messages and the standard (comand line) gdb interface. Just open the gdb console and type &#39;b <my function>&#39; and you set a breakpoint. 

 

I may try this method. Thanks. 

 

Bye,  

Wolfgang 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=18435)</div> 

[/b] 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
333 Views

hi seanbacon, 

 

how do you "build" your ecos-project? do you use a separate makefile or did you configure the IDE-builder? 

i usually create the ecos library first (with &#39;nios2ecosconfig&#39;) and let the IDE compile with my own makefile, which also links against this lib. 

 

...maybe there is something wrong with the compiler flags or your debug module on the target...  

 

regards martin
0 Kudos
Reply