In SSP 1.0, ThreadX introduced the use of the HW stack monitor (enabled by default), so each time a thread is run, the HW stack monitor is programmed with the limits of the stack for that task. If the stack pointer goes outside the region that is set in the HW stack monitor, an NMI will occur (R_ICU->NMISR_b.SPEST). If the debugger tries to run some code to program the new image into flash of the Synergy device, and uses a stack location that is outside the value that is in the HW stack monitor, then the debugger monitor will fail, and the debug connection will fail. This scenario only happens after ThreadX has been run on the processor and the HW stack monitor has be setup, so in a run->code modify and rebuild->re-download situation. There has been an update to the Segger JLink SW that fixes the problem when the HW stack monitor has been initialised. You will need to download the latest version of the JLink SW from www.segger.com/jlink-software.html, install it, and manually copy the file JlinkARM.dll from the Segger JLink installation directory (C:\Program Files\SEGGER\JLink_V510s default for the latest version) to C:\Renesas\e2_studio\DebugComp\ARM\Segger (this assumes the default installation path for e2studio), the new Segger might also do a firmware update to the on board JLink.
After doing this DLL update, you might still find the GDB server crashing after the download has completed, this is caused by the code in flash being changed, and the GDB server having difficulty decoding the new code in flash, with the current PC settings. To get around this issue, I use a simple GDB script, that resets the processor before doing the re-download, then does a reset after the download, and a single instruction step so the GUI and actual device are in sync:-
#for subsequent downloads, after connected, pre noentry_load command
define hook-noentry_load
#Reset the device before the download
monitor reset
end
#for subsequent downloads, after connected, post noentry_load command
define hookpost-noentry_load
#Reset the device before the next run
monitor reset
nexti
end
Copy this into a text file, and specify the location of that file in Window->Preferences->C/C++->Debug->GDB under the GDB Command file entry.
This problem with the GDB server should be fixed in an up coming release of e2studio (I don't know the exact version that will fix it though).