Debugging - GNU ARM Bare Metal Development

2

I am trying to debug a sample code given by Atmel. I have built the program successfully.

For debugging, I am using eclipse plusgdb plus JlinkGDBServer plus onboard Jtag.

Although the program can be downloaded to the board and is running well, I can't debug the program. Everytime I launch a debug session, the JLinkGDBServer will be terminated with an error as below:

enter image description here

Below are the messages shown in the console for each program termination:

JLinkGDBServer

SEGGER J-Link GDB Server V4.96g Command Line Version

JLinkARM.dll V4.96g (DLL compiled Feb  6 2015 17:54:32)

-----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:              on
Verify download:               on
Init regs on start:            on
Silent mode:                   off
Single run mode:               on
Target connection timeout:     5 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 Cortex-A5
Target interface:              JTAG
Target interface speed:        1000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link OB-SAM3U128 V1 compiled Nov 28 2014 10:24:11
Hardware: V1.00
S/N: 480300770
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 2331
Connecting to target...
J-Link found 1 JTAG device, Total IRLen = 4
JTAG ID: 0x4BA00477 (Cortex-A5)
Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x00000000 (Data = 0xE59FF070)
Target interface speed set to 1000 kHz
Resetting target
Halting target CPU...
...Target halted (PC = 0x00000000)
PC = 00000000, CPSR = 000001D3 (SVC mode, ARM FIQ dis. IRQ dis.)
R0 = 00000004, R1 = 0031E0C3, R2 = 00016AAD, R3 = 00016965
R4 = 0031FFA0, R5 = C0542A08, R6 = C0512000, R7 = C051DA90
USR: R8 =C051DD80, R9 =410FC051, R10=C0512000, R11 =0031FF94, R12 =003020C0
     R13=BEBF5C70, R14=B6F12F1C
FIQ: R8 =9ABE0586, R9 =7E72A55E, R10=73DBFC6B, R11 =4F6717CF, R12 =05EDA809
     R13=5AC81462, R14=24683958, SPSR=370D2C67
SVC: R13=0031FF80, R14=00300620, SPSR=000001D3
ABT: R13=C0542B4C, R14=C000DC80, SPSR=A0000193
IRQ: R13=00320000, R14=80000053, SPSR=80000053
UND: R13=C0542B58, R14=C000DB60, SPSR=60000093
Reading all registers
Select auto target interface speed (1000 kHz)
Flash breakpoints enabled
Semi-hosting enabled (VectorAddr = 0x08)
Semihosting I/O set to TELNET and GDB Client
Downloading 15488 bytes @ address 0x00300000 - Verified OK
Writing register (PC = 0x00300080)
GDB closed TCP/IP connection
Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x00300080 (Data = 0xF1080100)
Resetting target
Writing register (PC = 0x00300000)
Writing register (PC = 0x00300000)
Starting target CPU...
GDB closed TCP/IP connection

arm-none-eabi-gdb

Warning: the current language does not match this frame.
The target endianness is set automatically (currently little endian)

Semihosting and SWV

SEGGER J-Link GDB Server V4.96g - Terminal output channel
Connection closed by the GDB server.

The following is my debugging configuration: enter image description here enter image description here enter image description here

Under the Run Commands, the commands in the box are as below:

target remote localhost:2331
monitor reset
load
mon reg pc = 0x300000
mon reg pc = 0x300000
end

I dont know what root cause is. I suspect that it is arm-none-eabi-gdb that causes the JLinkGDBServer to terminate with an exit code of -1.

Please help.

Edit 1

FYI, I am using SAMA5D3x-EK development board.

eclipse
debugging
arm
gdb
segger-jlink
asked on Stack Overflow Feb 15, 2015 by user3792371 • edited Mar 16, 2020 by Frant

1 Answer

0

It is difficult to say, but looks like if the processor is having an exception while loading your code. I suggest to verify the load address of the sections of your ELF file, and review the linker settings of your project.

Hope it helps...

answered on Stack Overflow Feb 23, 2016 by juansolsona

User contributions licensed under CC BY-SA 3.0