This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Eclipse is not FLASHING before Debug

Originally, this was a complaint about SIGTRAP 0xffffffe while using GDB. But I've discovered the actual issue is related to a lack of erase/programming of FLASH.

My environment:

  • Mac OSX
  • SDK for nRF52832: PCA10040 (for nRF52832_xxAA)
  • Eclipse Neon V3 IDE for C++ developers (I've read postings that V3 works on OSX)
  • GNU ARM Eclipse Plug-in
  • GNU ARM Tools (6-2017-q1-update)
  • SEGGER JLINK tools

I have successfully done the following:

  1. Built the blinky (blank) sample project with 'make'

  2. FLASH'd the SDK with the resulting nrf52832_xxaa.hex file.

  3. Witnessed the LED's blinking as they should.

  4. Followed Nordic tutorial on how to wrap eclipse around an existing Makefile

  5. Successfully built the ble_app_beacon sample project using Eclipse (as a Makefile managed project).

When I attempted to Debug the project, the Eclipse debugger seemed to be running but didn't breakpoint at the start of main, where I expected. And, I noticed that the SDK board (PCA10040) was still doing the Blinky project behavior. So, clearly it still had the earlier project still in flash.

If, I use the JLink tools to erase the target flash, first, and then attempt to do Eclipse Debug (ble_app_beacon), I receive SIGTRAP 0xfffffffe (GDB found a difference between what was in FLASH and what it was expecting to see).

If I use the JLink tools to flash the device with my ble_app_beacon hex, and then run the Eclipse Debug on ble_app_beacon, it works as expected.

Why is the FLASH not getting erased and programmed by the Eclipse Debug mechanism? After the FLASH has been manually erased (with JLink tool), I attempt to run Eclipse Debug of the ble_app_beacon project. Below is the console output. As you can see, it claims that erasing and programming were performed. But it is clearly doing neither.

What advice can you give?

SEGGER J-Link GDB Server V6.14c Command Line Version

JLinkARM.dll V6.14c (DLL compiled Mar 31 2017 17:42:10)

-----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:                 nRF52832_xxAA
Target interface:              SWD
Target interface speed:        auto
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Mar  2 2017 12:22:13
Hardware: V1.00
S/N: 682262600
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 = 0xFFFFFFFF)
Read 2 bytes @ address 0x00000000 (Data = 0xFFFF)
Target interface speed set to 1000 kHz
Resetting target
Halting target CPU...
...Target halted (PC = 0xFFFFFFFE)
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= FFFFFFFC, MSP= FFFFFFFC, PSP= 00000000
R14(LR) = FFFFFFFF, R15(PC) = FFFFFFFE
XPSR 01000000, APSR 00000000, EPSR 01000000, IPSR 00000000
CFBP 00000000, CONTROL 00, FAULTMASK 00, BASEPRI 00, PRIMASK 00
Reading all registers
Read 4 bytes @ address 0xFFFFFFFE (Data = 0xFFFFFFFF)
Read 2 bytes @ address 0xFFFFFFFE (Data = 0x0000)
Select auto target interface speed (1000 kHz)
Flash breakpoints enabled
Semi-hosting enabled (Handle on BKPT)
Semihosting I/O set to TELNET Client
SWO disabled succesfully.
SWO enabled succesfully.
Read 4 bytes @ address 0xFFFFFFFE (Data = 0xFFFF0000)
Read 2 bytes @ address 0xFFFFFFFE (Data = 0x0000)
Downloading 16064 bytes @ address 0x0001F000 - Verified OK
Downloading 4564 bytes @ address 0x00022EC0 - Verified OK
Downloading 8 bytes @ address 0x00024094 - Verified OK
Downloading 136 bytes @ address 0x0002409C - Verified OK
Comparing flash   [....................] Done.
Erasing flash     [....................] Done.
Programming flash [....................] Done.
Verifying flash   [....................] Done.
Writing register (PC = 0x48320200)
Read 4 bytes @ address 0x00023248 (Data = 0x4A074906)
Read 2 bytes @ address 0x00023248 (Data = 0x4906)
Read 2 bytes @ address 0x000226DE (Data = 0xF7FF)
Read 2 bytes @ address 0x000226DE (Data = 0xF7FF)
Resetting target
Halting target CPU...
...Target halted (PC = 0xFFFFFFFE)
Resetting target
Read 2 bytes @ address 0x000226DE (Data = 0xF7FF)
Read 2 bytes @ address 0x000226DE (Data = 0xF7FF)
Read 2 bytes @ address 0x000226DE (Data = 0xF7FF)
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= FFFFFFFC, MSP= FFFFFFFC, PSP= 00000000
R14(LR) = FFFFFFFF, R15(PC) = FFFFFFFE
XPSR 01000000, APSR 00000000, EPSR 01000000, IPSR 00000000
CFBP 00000000, CONTROL 00, FAULTMASK 00, BASEPRI 00, PRIMASK 00
Reading all registers
Read 4 bytes @ address 0xFFFFFFFE (Data = 0x4A07F7FF)
Read 2 bytes @ address 0xFFFFFFFE (Data = 0x0000)
Setting breakpoint @ address 0x000226DE, Size = 2, BPHandle = 0x0001
Starting target CPU...
...Target halted (DBGRQ, PC = 0xFFFFFFFE)
Reading all registers
Read 4 bytes @ address 0xFFFFFFFE (Data = 0x7E9366B8)
Read 2 bytes @ address 0xFFFFFFFE (Data = 0x0000)
Removing breakpoint @ address 0x000226DE, Size = 2
Read 4 bytes @ address 0xFFFFFFF4 (Data = 0x00000000)
Reading 64 bytes @ address 0xFFFFFFC0
Read 4 bytes @ address 0x00000000 (Data = 0xFFFFFFFF)
Read 4 bytes @ address 0x00000000 (Data = 0xFFFFFFFF)
Read 4 bytes @ address 0x00000000 (Data = 0xFFFFFFFF)
Reading 64 bytes @ address 0x00000000
Reading 64 bytes @ address 0x00000040
Reading 64 bytes @ address 0x00000080
Reading 64 bytes @ address 0xFFFFFF80
Related