SIGLOST problem - Blackmagic Probe, LPC1768

Hey, I’m looking for some help in regard to create one basic program that blinks an LED, that doesn’t use the Mbed framework(which actually works fine).

Could someone tell me, why when I start debugging the program I get an instant crash?

platformio.ini:

[env:lpc1768]
platform = nxplpc
board = lpc1768

; Blackmagic Probe
upload_protocol = blackmagic
upload_port = /dev/cu.usbmodem79AC68971

debug_tool = blackmagic
debug_port = /dev/cu.usbmodem79AC68971

done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = blackmagic
PlatformIO: Initializing remote target...
Target voltage: 3.3V
Available Targets:
No. Att Driver
 1      LPC17xx
0x10000010 in ?? ()
Temporary breakpoint 1 at 0x80ea: file src/main.cpp, line 14.
Loading section .init, size 0xc lma 0x8000
Loading section .text, size 0x22c lma 0x800c
Loading section .fini, size 0xc lma 0x8238
Loading section .rodata, size 0x4 lma 0x8244
Loading section .ARM.exidx, size 0x8 lma 0x8248
Loading section .eh_frame, size 0x4 lma 0x8250
Loading section .init_array, size 0x4 lma 0x18254
Loading section .fini_array, size 0x4 lma 0x18258
Loading section .data, size 0x60 lma 0x1825c
Start address 0x8074, load size 700
Transfer rate: 697 bytes/sec, 77 bytes/write.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> http://bit.ly/pio-debug
Note: automatically using hardware breakpoints for read-only addresses.

Program terminated with signal 
SIGLOST, Resource lost.
The program no longer exists.

Even when I simply create an empty main function, it just throws the same error.

Have you tried debugging an mbed-os firmware using the blackmagic tool? Then you could make sure that it’s independent of the firmware loaded on the MCU.

All the links (4 in total found by google) suggest either an old BMP firmware or that the software remaps JTAG / SWD pins (TARGET LOST while flashing LPC824 minimal schematic · Issue #406 · blackmagic-debug/blackmagic · GitHub). Also the github issue suggests that there is debug output on another port (/dev/ttyACM1 in the issue) that might give hints on some error messages.

The Mbed framework build and works fine, but debugging seems to fail as well with the same error.


done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = blackmagic
PlatformIO: Initializing remote target...
Target voltage: 3.3V
Available Targets:
No. Att Driver
 1      LPC17xx
0x10000010 in ?? ()
Temporary breakpoint 1 at 0x236c: file src/main.cpp, line 5.
Loading section .text, size 0x803c lma 0x0
Loading section .ARM.exidx, size 0x8 lma 0x803c
Loading section .data, size 0xad0 lma 0x8044
Loading section .heap, size 0x6120 lma 0x8e40
Start address 0x173c, load size 60468
Transfer rate: 21 KB/sec, 944 bytes/write.
Warning: the current language does not match this frame.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> http://bit.ly/pio-debug

I had to downgrade my BPM firmware, as the latest nightly doesn’t correctly recognize my microcontroller, so basically I gotta try different BMP firmware now.

Honestly, with that much trouble the BMP is giving you (and it seems to currently be a fault in the BMP probe or the GDB server it spawns) you might be better of with your old ulink2 or a plain simple ST-Linkv2 clone for ~5€ from ebay, these have never ever given me any problems.

Though you could go an and test it without the PIO part, meaning connect the BMP to the target, make it spawn a GDB server and connect to it manually using arm-none-eabi-gdb. If this basic config fails, only the BMP people can help you (or a different debugger) :confused:

Oh actually now that I think about it, maybe a problem is that it doesn’t have the debugging symbols enabled? Can you retry by adding

build_flags = -Og -ggdb3 
build_unflags = -Os

in the platformio.ini and retry debugging.

Even with the extra build flags I get this here:

I flashed every commit starting from the latest going down to the first one that detects the firmware correctly in a bruteforce way.

But I still get weird errors and can’t debug the firmware properly… even tho flashing works fine.

Basically I’m being told in the issue, that I’m building the firmware incorrectly?

I do not see any BMP specific problem here. The target is recognized, 
you can program flash. Keep in mind that LPC has some place where 
a checksum or some other magic number is stored. Siglost happens, 
when your target does special things, perhaps remap SWD pins or go 
to deep sleep.

Changing the platformio.ini file to this allows me to debug the Mbed framework, but my own stuff throws a segmentation fault before the program is even being executed.

[env:lpc1768]
platform = nxplpc
board = lpc1768
framework = mbed


;Blackmagic Probe
upload_protocol = blackmagic
upload_port = /dev/cu.usbmodem79AC68971

debug_tool = custom
debug_port = /dev/cu.usbmodem79AC68971
debug_init_cmds =
  target extended-remote $DEBUG_PORT
  monitor swdp_scan
  attach 1
  set mem inaccessible-by-default off
  $INIT_BREAK
  $LOAD_CMDS

What exact error message do you get?

it’s this here

Reading symbols from /Users/john/Documents/PlatformIO/Projects/Testing_MCB1768/.pio/build/lpc1768/firmware.elf...
done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = custom
PlatformIO: Initializing remote target...
Target voltage: 3.3V
Available Targets:
No. Att Driver
 1      LPC17xx M3/M4
0x100000d0 in ?? ()
Temporary breakpoint 1 at 0x80f8
Loading section .init, size 0xc lma 0x8000
Loading section .text, size 0x13c lma 0x800c
Loading section .fini, size 0xc lma 0x8148
Loading section .rodata, size 0x4 lma 0x8154
Loading section .ARM.exidx, size 0x8 lma 0x8158
Loading section .eh_frame, size 0x4 lma 0x8160
Loading section .init_array, size 0x4 lma 0x18164
Loading section .fini_array, size 0x4 lma 0x18168
Loading section .data, size 0x60 lma 0x1816c
Start address 0x8074, load size 460
Transfer rate: 507 bytes/sec, 51 bytes/write.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> http://bit.ly/pio-debug
Note: automatically using hardware breakpoints for read-only addresses.

Program
 received signal SIGSEGV, Segmentation fault.
0xfffffffe in ?? ()

This is my current code:

Will these lines of code

Affect the SWD pins? Are they on the same port? Have you tested an empty main or just a delay loop?

Replacing the whole main function
with

int main() {
   int x = 0;
   return 0;
   while(true)
   {
       delay_ms(1000);
       x++;
   }
}

results in the same error:

Error log
Reading symbols from /Users/john/Documents/PlatformIO/Projects/Testing_MCB1768/.pio/build/lpc1768/firmware.elf...
done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = custom
PlatformIO: Initializing remote target...
Target voltage: 3.3V
Available Targets:
No. Att Driver
1 LPC17xx M3/M4
0x10000160 in ?? ()
Temporary breakpoint 1 at 0x80e8: file src/main.cpp, line 24.
Loading section .init, size 0xc lma 0x8000
Loading section .text, size 0x13c lma 0x800c
Loading section .fini, size 0xc lma 0x8148
Loading section .rodata, size 0x4 lma 0x8154
Loading section .ARM.exidx, size 0x8 lma 0x8158
Loading section .eh_frame, size 0x4 lma 0x8160
Loading section .init_array, size 0x4 lma 0x18164
Loading section .fini_array, size 0x4 lma 0x18168
Loading section .data, size 0x60 lma 0x1816c
Start address 0x8074, load size 460
Transfer rate: 522 bytes/sec, 51 bytes/write.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> http://bit.ly/pio-debug
Note: automatically using hardware breakpoints for read-only addresses.

Program

received signal SIGSEGV, Segmentation fault.

0xfffffffe in ?? ()

btw. The answer to this is that the same as the ULINK-ME, the J-Link and the Black magic Probe, all of them need the firmware to be patched before it is being flashed to the target micro controller.