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

Cannot seem to run code through the debugger

Altera_Forum
Honored Contributor II
1,145 Views

Hello, 

 

I was handed a project to work on am pretty much on my own to get a few changes incorporated and have the system tested. I was shown where to find the source code and have installed the Nios II IDE on my XP machine. Having said that, I cannot seem to get to execute (step through) any code in the debugger. When I attempt to open the debugger, the download will take place and I will get the following line in the debug window: 

 

<terminated, exit value:0> Nios II Download output (1/9/07, 9:00 AM) 

 

It will then display that Thread[0] is running. If I attempt to halt it, the PC&#39;s CPU hits 100% and after 30 seconds or so, the program comes back with the following line: 

 

Thread[0] (Suspended) <Stack is not available: Target is not responding (timed out).> 

 

I have a breakpoint set right at the beginning of main, which is never hit. Also, inside the configuration options (under the debugger tab), I have selected to break at main(). However, if I select to break at program entry, it will open up the disassembly window and will stop immediately after the program begins to execute. It seems to go off in the weeds between program start and main(). I have searched through the project options trying to see if a particular option could be causing this, but I have been unsuccessful in locating one to this point. If there are any suggestions, please let me know.  

 

I should also mention that running it appears to work great, however debugging it seems to cause it some problems. Are there any major differences between debugging it and outright running it on the processor? 

 

Any help would be greatly appreciated and thanks in advance, 

Tom
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
451 Views

If you have any large local data structures try making them global to see if the problem goes away. 

 

So instead of this: 

 

int main() 

int big_array[1024*1024]; 

..... 

 

 

Make the array global: 

 

int big_array[1024*1024]; 

 

int main() 

..... 

 

I hope that helps
0 Kudos
Altera_Forum
Honored Contributor II
451 Views

 

--- Quote Start ---  

originally posted by badomen@Jan 9 2007, 01:50 PM 

if you have any large local data structures try making them global to see if the problem goes away. 

 

so instead of this: 

 

int main() 

  int big_array[1024*1024]; 

  ..... 

 

 

make the array global: 

 

int big_array[1024*1024]; 

 

int main() 

  ..... 

 

i hope that helps 

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

--- quote end ---  

 

--- Quote End ---  

 

BadOmen, Thanks for the reply. However, I tried your suggestion and there was no difference in the outcome.  

 

I have been continuing to dig as deep as possible and I found out a little more information. If can successfully have it halt at program start (<_start>) and can manually step through until the call to the alt_main. When I make the call, it appears to go into the weeds. The exact line that appears to cause the failure is: 

 

0x00000044 <_start+68>: call 0xe5b4c <alt_main> 

 

I have unsuccessfully tried to set breakpoints in alt_main to find out where it fails, but it doesn&#39;t permit me to. Maybe I&#39;m looking at the wrong file containing the alt_main function. I would also like to find out where the map file is (or equivalent) that would allow me to see which functions are loaded and their corresponding addresses in memory. What is this file called and where abouts would it be located? I figure that it wouldn&#39;t hurt to look through here to see if there is anything that catches my eye. 

 

I did come across another thread talking about the differences between alt_main and main and it appears that calling main assumes that everything is initialized already. I am not sure if this may be my problem or not, but I will start looking into this as well. 

 

Any help or advice would be greatly appreciated. 

 

Thanks, 

Tom
0 Kudos
Reply