Page 2 of 4
Re: Debug Build failure
Posted: Mon Oct 13, 2014 9:36 am
by SeeCwriter
I am going through the Eclipse Getting Started Guide. On page 21, paragraph 5.1.2 it says:
"To automatically create a run configuration, click on your project in the Project Explorer window. Once selected, simply click on the Run button (a white play in a green circle). Your project will automatically be compiled, built and loaded onto your board. Creating debug configuration works much the same. Click on your project in the Project Explorer window. Once selected, simply click on the Debug button (a green bug). This will compile, build, load and connect the debugger to your device."
The first 3-sentences refer to a Release configuration, and that works as described. The last 4-sentences are for a Debug configuration. In the last sentence the first two events occur as described. The example project is compiled and built. But the load and connect fail. Is there something else I need to do? The guide doesn't appear to indicate that. But maybe I missed something.
Steve
Re: Debug Build failure
Posted: Mon Oct 13, 2014 11:22 am
by SeeCwriter
So I skipped past section 5 and went to section 8 of the Getting Started Guide, which is "Debugging With Eclipse". It's in this section where I learn that I need a debug header and a debugger function call in the program. They didn't say that is section 5.
In any case, I created the example program in section 8 for using the debugger. It's very basic.
Code: Select all
#define _DEBUG
#include <NetworkDebug.h>
void UserMain( void * pd)
{
InitializeStack();
if ( EthernetIP == 0 ) GetDHCPAddress();
#ifdef _DEBUG
InitializeNetworkGDB();
#endif
OSChangePrio( MAIN_PRIO );
EnableAutoUpdate();
EnableTaskMonitor();
EnableSmartTraps();
iprintf( "%s application started\r\n", AppName );
int n=0;
while(1) {
OSTimeDly(20);
n++;
}
}
I can set a breakpoint at "n++" per the guide, and the program stops at the breakpoint and displays the value of "n". But I can't "Resume" or "Step". When I do, all the debug buttons except for Terminate turn grey, and the program never stops at the breakpoint again. When I click "Terminate" I return the edit mode and then I get an error message that says "Terminate failed", followed by another error message that says "Execution is suspended because of an error."
I load the debug program again and break one time at the breakpoint again, but that's it. No stepping allowed. No resuming. Nothing.
I'm using the NANO dev kit with IDE v 2.6.8.
Steve
Re: Debug Build failure
Posted: Tue Oct 14, 2014 9:46 am
by SeeCwriter
Today I rolled back to IDE v2.6.7, and now the Release build of the example program runs. It doesn't run with v2.6.8. I then tried a Debug build. I still can't single step. But interestingly, when I click Step-Over, the thread of Main changes status to Stepping, but the application is actually running because it is blinking the leds on the carrier board. It acts as if I clicked "Resume". And, as with v2.6.8, at this point all the debug buttons are greyed out except for Terminate. And when I click Terminate, I get the same error messages as before, "Target request failed: Failed to interrupt" and "Execution suspended because of error."
Steve
Re: Debug Build failure
Posted: Thu Oct 16, 2014 12:57 pm
by rnixon
Can't say what your issue is, but I ran a quick test today of the debug app in section 8 and it worked fine in my 2.6.7.
Re: Debug Build failure
Posted: Thu Oct 16, 2014 3:36 pm
by SeeCwriter
Ok, so I switched to the ledBinaryCounter.cpp example project. It's in one of the manuals, and I copied it out word-for-word. Did a Release build and downloaded it to my Nano dev kit. Works like a champ.
I then added the debug code, which consists of 2-lines of code, #include <NetworkDebug.h>, and a call to InitializeNetworkGDB() right after it gets a DHCP ip address.
Did a debug build and download it to the Nano dev kit. The programs loads without error, and it's running because the leds are busy counting, but then I get an error message that is different from what I got before. This error says:
10.250.5.54:2159: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Notice the IP Address at the beginning. I don't know what that address is. My PC is at 10.250.7.106 and the Nano is at 10.250.7.122. And if I go into the Debug Configuration screen, it has the correct IP address of the Nano, otherwise it wouldn't have been able to download. I don't know if this is a different problem than what I had before because the error is different. But still the debugger doesn't work. And I'm still using v2.6.7 of the IDE.
Any ideas on how to correct this?
Steve
Re: Debug Build failure
Posted: Thu Oct 16, 2014 4:12 pm
by SeeCwriter
I found this particular problem. Apparently there is yet another place to enter an IP Address for the device, in the Debugger tab of the Debug Configuration screen. I guess you can never have too many places to enter an IP address.
With that corrected, I can now single-step through the LedBinaryCounter program.
Back to my original example program, DSPISerial. It still runs the Release build just fine, even the Debug build runs, I just can't break and single-step. The debugger crashes when I try. So I went through the program and commented out all the code, leaving the only the include files, an empty while loop, and the Ethernet initialization. Now when I compile I get linker error "undefined reference to 'InitializeNetworkGDB'". Seems like another missing library file. Did another "Rebuild All System Files". Tried again. Same linker error.
Steve
Re: Debug Build failure
Posted: Thu Oct 16, 2014 4:22 pm
by rnixon
There are two places to enter IP addresses: one for debug and one for release. You do not have to debug on the same network interface you use for data, so it makes sense to have two, although if you only have one I guess it can seem redundant.
Put a delay after the init gdb call
You probably getting the undefined reference because you forgot to add the #include.
Re: Debug Build failure
Posted: Thu Oct 16, 2014 5:21 pm
by SeeCwriter
I have the include. I don't think the program would compile if the include were missing. The error is with the linker not being able to resolve the function. I will add the delay tomorrow when I get to work. But that won't help the linker error.
Thanks,
Steve
Re: Debug Build failure
Posted: Fri Oct 17, 2014 7:38 am
by SeeCwriter
Adding a delay didn't solve the linker error. These are the include files in the program:
#include "predef.h"
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <startnet.h>
#include <autoupdate.h>
#include <dhcpclient.h>
#include <taskmon.h>
#include <smarttrap.h>
#include <NetworkDebug.h>
#include <serial.h>
#include <pins.h>
#include <dspi.h>
Also, I changed function InitializeNetworkGDB() to InitializeNetworkGDB_and_Wait() and get an additional linker error:
C:\nburn\NANO54415\system/netwait.cpp:30: undefined reference to `GDBDebugConnected()'
C:\nburn\NANO54415\system/netwait.cpp:32: undefined reference to `InitializeNetworkGDB'
Steve
Re: Debug Build failure
Posted: Fri Oct 17, 2014 1:40 pm
by rnixon
Which example are you following that says to add #define _DEBUG to your code?