Connection closed by the GDB server

cancel
Showing results for 
Search instead for 
Did you mean: 

Connection closed by the GDB server

Jump to solution
7,200 Views
Contributor III

Hello everyone,

 

I was working on my project just fine this morning, and all of a sudden I am no longer able to debug and download code into my FRDM-K22F device.

Looking at the console, I get the following messages:

 

From JLinkGDBServerCL console:

 

SEGGER J-Link GDB Server V4.96a Command Line Version  JLinkARM.dll V4.96a (DLL compiled Jan 14 2015 09:32:38)  -----GDB Server start settings----- GDBInit file:                  none GDB Server Listening port:     2331 SWO raw output listening port: 2332 Terminal I/O port:             2333 Accept remote connection:      localhost only Generate logfile:              off Verify download:               on Init regs on start:            on Silent mode:                   off Single run mode:               on Target connection timeout:     0 ms ------J-Link related settings------ J-Link Host interface:         USB J-Link script:                 none J-Link settings file:          none ------Target related settings------ Target device:                 MK22FN512xxx12 Target interface:              SWD Target interface speed:        1000kHz Target endian:                 little  Connecting to J-Link... J-Link is connected. Firmware: J-Link OpenSDA 2 compiled Nov 28 2014 10:35:51 Hardware: V1.00 S/N: 621000000 Checking target voltage... Target voltage: 3.30 V Listening on TCP/IP port 2331 Connecting to target...Connected to target Waiting for GDB connection...Connected to 127.0.0.1 Reading all registers Read 4 bytes @ address 0x00000000 (Data = 0x20010000) Target interface speed set to 1000 kHz Resetting target Halting target CPU... ...Target halted (PC = 0x00000530) R0 = 00000000, R1 = 00000000, R2 = 00000000, R3 = 00000000 R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000 R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000 R12= 00000000, R13= 20010000, MSP= 20010000, PSP= 00000000 R14(LR) = FFFFFFFF, R15(PC) = 00000530 XPSR 01000000, APSR 00000000, EPSR 01000000, IPSR 00000000 CFBP 00000000, CONTROL 00, FAULTMASK 00, BASEPRI 00, PRIMASK 00 Reading all registers Select auto target interface speed (1429 kHz) Flash breakpoints enabled Semi-hosting enabled (VectorAddr = 0x08) Semihosting I/O set to TELNET Client Downloading 1024 bytes @ address 0x00000000 - Verified OK Downloading 16 bytes @ address 0x00000400 - Verified OK Downloading 16080 bytes @ address 0x00000410 - Verified OK Downloading 1124 bytes @ address 0x000042E0 - Verified OK Downloading 4 bytes @ address 0x00004744 - Verified OK Downloading 4 bytes @ address 0x00004748 - Verified OK Downloading 680 bytes @ address 0x0000474C - Verified OK Read 4 bytes @ address 0x00000530 (Data = 0x480AB672) Read 2 bytes @ address 0x0000176C (Data = 0xF000) Read 2 bytes @ address 0x0000176C (Data = 0xF000) Read 2 bytes @ address 0x00000000 (Data = 0x0000) Read 2 bytes @ address 0x00000002 (Data = 0x2001) Read 2 bytes @ address 0x00000004 (Data = 0x0531) Read 2 bytes @ address 0x00000006 (Data = 0x0000) Read 2 bytes @ address 0x00000008 (Data = 0x0569) Read 2 bytes @ address 0x0000000A (Data = 0x0000) Read 2 bytes @ address 0x0000000C (Data = 0x0569) Read 2 bytes @ address 0x0000000E (Data = 0x0000) Read 2 bytes @ address 0x00000010 (Data = 0x0569) Read 2 bytes @ address 0x00000012 (Data = 0x0000) Read 2 bytes @ address 0x00000014 (Data = 0x0569) Read 2 bytes @ address 0x00000016 (Data = 0x0000) Read 2 bytes @ address 0x00000018 (Data = 0x0569) Read 2 bytes @ address 0x0000001A (Data = 0x0000) Read 2 bytes @ address 0x0000001C (Data = 0x0000) Read 2 bytes @ address 0x0000001E (Data = 0x0000) Read 2 bytes @ address 0x00000020 (Data = 0x0000) Read 2 bytes @ address 0x00000022 (Data = 0x0000) Read 2 bytes @ address 0x00000024 (Data = 0x0000) Read 2 bytes @ address 0x00000026 (Data = 0x0000) Read 2 bytes @ address 0x00000028 (Data = 0x0000) Read 2 bytes @ address 0x0000002A (Data = 0x0000) Read 2 bytes @ address 0x0000002C (Data = 0x0569) Read 2 bytes @ address 0x0000002E (Data = 0x0000) Read 2 bytes @ address 0x00000030 (Data = 0x0569) Read 2 bytes @ address 0x00000032 (Data = 0x0000) Read 2 bytes @ address 0x00000034 (Data = 0x0000) Read 2 bytes @ address 0x00000036 (Data = 0x0000) Read 2 bytes @ address 0x00000038 (Data = 0x0569) Read 2 bytes @ address 0x0000003A (Data = 0x0000) Read 2 bytes @ address 0x0000003C (Data = 0x0569) Read 2 bytes @ address 0x0000003E (Data = 0x0000) GDB closed TCP/IP connection

 

 

From the arm-none-eabi-gdb console:

monitor clrbp monitor reset monitor halt monitor regs flushreg Register cache flushed. monitor semihosting enable Warning: the current language does not match this frame. The target endianness is set automatically (currently little endian) No source file named C:\\Freescale\\workspaces\\SPI_Master_test\\Sources\\SPI_Master.c. No source file named C:\\Freescale\\workspaces\\SPI_Slave_test\\Sources\\SPI_Slave.c. No source file named C:\\Freescale\\workspaces\\SPI_Master_v2\\Sources\\SPI_M_v2.c.

 

It was working fine a couple hours ago, and it just started giving me this error.

When I try loading another project, the other project loads well, leading me to believe there is something wrong with this particular project. I am attaching the project

Original Attachment has been moved to: hello_world_frdmk22f.zip

Labels (1)
Tags (3)
0 Kudos
1 Solution
405 Views
NXP Employee
NXP Employee

Hi Christian,

the messages are not matching when I had such a problem (Failed to Debug with GDB: Breakpoints or Expressions on non-existing Locations | MCU on Eclipse), but it might be worthwile to remove/delete all breakpoints/watchpoints?

The GDB used in KDS has an issue in this area.

I hope this helps,

Erich

View solution in original post

0 Kudos
7 Replies
405 Views
Contributor I

I have the same problem.  It should have been fixed by now.

0 Kudos
405 Views
Contributor III

Just an update this this issue:

I have tried using all bootloaders that I have, the CMIS, PNE, and JLINK and they all have issues.

Tried with the CMIS and I get the following error:

monitor halt

Warning: the current language does not match this frame.

The target endianness is set automatically (currently little endian)

No source file named C:\\Freescale\\workspaces\\SPI_Master_test\\Sources\\SPI_Master.c.

No source file named C:\\Freescale\\workspaces\\SPI_Master_test\\Sources\\SPI_Master.c.

No source file named C:\\Freescale\\workspaces\\SPI_Master_v2\\Sources\\SPI_M_v2.c.

No source file named C:\\Freescale\\workspaces\\SPI_Slave_test\\Sources\\SPI_Slave.c.

Open On-Chip Debugger 0.8.0-dev (2014-10-31-11:10)

Licensed under GNU GPL v2

For bug reports, read

    http://openocd.sourceforge.net/doc/doxygen/bugs.html

Info : only one transport option; autoselect 'cmsis-dap'

Info : CMSIS-DAP: SWD  Supported

Info : CMSIS-DAP: Interface Initialised (SWD)

Info : add flash_bank kinetis kinetis.flash

cortex_m reset_config sysresetreq

adapter speed: 1000 kHz

Info : CMSIS-DAP: FW Version = 1.0

Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1

Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0)

Info : CMSIS-DAP: Interface ready

Info : clock speed 1000 kHz

Info : IDCODE 0x2ba01477

Info : kinetis.cpu: hardware has 6 breakpoints, 4 watchpoints

Info : accepting 'gdb' connection from 3333

Info : Probing flash info for bank 0

Warn : acknowledgment received, but no packet pending

undefined debug reason 7 - target needs reset

Info : Disabling Kinetis watchdog (initial WDOG_STCTRLH = 0x1d3)

Info : WDOG_STCTRLH = 0x1d2

target state: halted

target halted due to undefined, current mode: Thread

xPSR: 0x01000000 pc: 0x00001f08 msp: 0x2000fe70

semihosting is enabled

Warn : Any changes to flash configuration field will not take effect until next reset

Info : Kinetis: FLASH Write ...

Info : dropped 'gdb' connection

Tried with the PNE and this is the error:

Warning: the current language does not match this frame.

The target endianness is set automatically (currently little endian)

No source file named C:\\Freescale\\workspaces\\SPI_Master_test\\Sources\\SPI_Master.c.

P&E GDB Server, Version 5.13.02.00

Copyright 2014, P&E Microcomputer Systems Inc, All rights reserved

Loading library C:\Freescale\KDS_2.0.0\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_1.1.8.201411191655\win32\gdi\unit_ngs_arm_internal.dll ... Done.

Command line arguments: -device=K22FN512M12 -startserver -singlesession -serverport=7224 -interface=OPENSDA -speed=5000 -port=USB1 -USE_CYCLONEPRO_RELAYS=0 -FORCE_MASS_ERASE=0

Device selected is k22fn512m12

User Specified Hardware Selection : Interface=OPENSDA and Port=USB1

Connecting to target.

OpenSDA detected - Flash Version 1.08

Device is K22FN512M12.

Mode is In-Circuit Debug.

'Kinetis' is a registered trademark of Freescale.

(C)opyright 2012, P&E Microcomputer Systems, Inc. (www.pemicro.com)

API version is 101

Server running on 127.0.0.1:7224

Connection from "127.0.0.1" via 127.0.0.1

Copyright 2012 P&E Microcomputer Systems,Inc.

Command Line :C:\Freescale\KDS_2.0.0\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_1.1.8.201411191655\win32\pegdbserver_console -device=K22FN512M12 -startserver -singlesession -serverport=7224 -interface=OPENSDA -speed=5000 -port=USB1 -USE_CYCLONEPRO_REL

CMD>RE

Initializing.

Target has been RESET and is active.

CMD>CM C:\Freescale\KDS_2.0.0\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_1.1.8.201411191655\win32\gdi\P&E\freescale_k22fn512m12_1x32x128k_pflash.arp

Initializing.

Initialized.

;version 1.00, 04/11/2014, Copyright P&E Microcomputer Systems, www.pemicro.com [kv_31f512_n_pflash]

;device freescale, k22fn512m12, 1x32x128k, desc=pflash

;begin_cs device=$00000000, length=$00080000, ram=$20000000

Loading programming algorithm ...

Done.

CMD>EM

Erasing.

Module has been erased.

Initializing.

Initialized.

;version 1.00, 04/11/2014, Copyright P&E Microcomputer Systems, www.pemicro.com [kv_31f512_n_pflash]

;device freescale, k22fn512m12, 1x32x128k, desc=pflash

;begin_cs device=$00000000, length=$00080000, ram=$20000000

Loading programming algorithm ...

Done.

CMD>PM

Programming.

Processing Object File Data ...

                               

.

Programmed.

CMD>VC

Verifying object file CRC-16 to device ranges ...

   block 00000000-000049F3 ...

Ok.

   Checksum Verification Successful. (Cumulative CRC-16=$AD0C)

CMD>RE

Initializing.

Target has been RESET and is active.

Disconnected from "127.0.0.1" via 127.0.0.1

Target Disconnected.

I also tried using a different board, thinking this could be the issue, but the message is the same regardless.

I can load the Demo projects without any problem, it is only when I load my project is that I am having issues. Please advice, as I don't understand how it was working OK 2 hours ago, and now it is not.

0 Kudos
406 Views
NXP Employee
NXP Employee

Hi Christian,

the messages are not matching when I had such a problem (Failed to Debug with GDB: Breakpoints or Expressions on non-existing Locations | MCU on Eclipse), but it might be worthwile to remove/delete all breakpoints/watchpoints?

The GDB used in KDS has an issue in this area.

I hope this helps,

Erich

View solution in original post

0 Kudos
405 Views
Contributor III

HOLY MOTHER OF BREAKPOINTS!!!

I did as you said, and removed all breakpoints, and it actually runs now! I owe you much gratitude.

Any insight as to why this happen?

0 Kudos
405 Views
NXP Employee
NXP Employee

:-)

I think what happens is this: gdb tries to set a breakpoint on a debug/line information entry which does not exist any more (e.g. code got optimized out).

GDB internally traps/raises an exception, and as a result the connection gets terminated.

The good thing is that with the Q4_2014 launchpad tools (see Switching ARM GNU Tool Chain and Libraries in Kinetis Design Studio | MCU on Eclipse) that issue in gdb is fixed (at least I was not able to reproduce it any more.

Erich

0 Kudos
405 Views
Contributor III

Eric,

Thank you so much for the help. I did notice that whenever i put a breakpoint, and then i change the code (add/remove lines) the breakpoints dont move with the lines!!! This is crazy to me, as I am used to the breakpoints moving with the source code.

This is good to know and to keep in mind for the future.

0 Kudos
405 Views
NXP Employee
NXP Employee

It depends how you set the breakpoints. If you are using the Source view, then breakpoints are identified by file name/line number:

pastedImage_0.png

you can use the gdb commands (e.g. 'break') to set the breakpoints on functions/etc.

Erich

0 Kudos