UDP-Stack crashes when J-Link not attached

Hi, I have ported the FreeRTOS UDP-Stack to LPC1769 and I am running the Standard socket implementation (no Zero Copy).
Everything works perfect as long as I have my J-Link SWV Debugger attached and I run a Debug session with gdb.
I am not using any ITM-Channel.
Once I let the program run without the Debugger, it crashes after about 2.4 seconds. (The HardFault-Handler is being called. I know this by letting a LED light up, when this happens) I think this should be about the time, where the DHCP-Request is made. The problem now is to debug this without a debugger:) Has anybody experienced something like this? My next move will be to try to get the program counter value of the crash within the hardfault out of the MCU without using the debugger. Any help or suggestions would be very appreciated. Best Regards,
Dude.

UDP-Stack crashes when J-Link not attached

Depending on your tools, you may be able to connect the debugger after the crash without the board resetting or being re-flashed.  If you are able to do that you will be able to follow the instructions here to work out the program counter position. Do you have configASSERT() defined?  If not I would recommend defining it because it may allow you to trap the problem *before* the hard fault. Assuming you are running the same code, I can’t think off hand what difference having the debugger connected would make.  Is it possible the code is built with semi-hosting libraries?  If so, it would be worth turning semi-hosting off completely. Regards.

UDP-Stack crashes when J-Link not attached

Dear Mr. Barry, thank you for the quick response. I am using Atollic True Studio and I have turned of resetting and res-flashing, but the debugger hangs then and I am not able to read any core registers.
I am not using any semi-hosting libraries – just the Newlib standard library. (But I don’t use any printf or any other instruction, that would send stuff to the debugger)
I use the configASSERT() with the forever loop which is provided in FreeRTOSConfig.h + LED-Output, but the LED stays off.
I have used tcpdump to see, if the DHCP-Request is sent out, before the crash and it is. The DHCP-Server responds and this might be the point, where it crashes.
I will try to dig deeper. Best Regards,
Dude.

UDP-Stack crashes when J-Link not attached

P.S. It may be interesting to mention, that when I boot the device with the debugger and then just unplug it after a view seconds without stopping the debugging-process everything works fine. So the crash has to have something to do with the initialization process.

UDP-Stack crashes when J-Link not attached

Does the atollic debugger run any scripts when it connects to or downloads to the target?  like the IAR debugger does. Maybe it is doing some configuration in a debug script rather than in the source files.

UDP-Stack crashes when J-Link not attached

Thanks for the suggestion edwards3, you are right. There is a script for the debugger. I have played around with it and reduced its functionality to a minimum, but the result is still the same. When I don’t initialize the network, the program runs just fine.
I will take a closer look at the network drivers on the weekend and I will try to program some debugging interface on the serial port to get a little bit more information out of the microcontroller. Best Regards,
Dude.