Firmware debugging breaks with SIGINT - Photon Programmer Shield

Open source ARM Debugger

Moderator: phalanx

Post Reply
JohnKoz
Posts: 6
Joined: Mon Feb 06, 2017 4:24 pm

Firmware debugging breaks with SIGINT - Photon Programmer Shield

Post by JohnKoz » Sat Dec 09, 2017 1:00 pm

Hi folks,

First time using the Photon Programmer Shield, and I spent some time following the guidance to build and flash the firmware and configured OpenOCD and GDB to debug.
[5 steps to setup and use a debugger with the Photon](https://community.particle.io/t/5-steps ... oton/14437)
[Debugging Particle on Windows](https://medium.com/@jvanier/debugging-p ... b418efd76f)

It seems like it's mostly working, but not having seen the happy path before I don't know what to expect.

I've launched OpenOCD as follows, and it produced this output:

Code: Select all

openocd -f particle-ftdi.cfg -f stm32f2x.cfg -c "gdb_port 3333"

Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
none separate
cortex_m reset_config sysresetreq
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : clock speed 1000 kHz
Info : JTAG tap: stm32f2x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f2x.bs tap/device found: 0x06411041 (mfg: 0x020 (STMicroelectronics), part: 0x6411, ver: 0x0)
Info : stm32f2x.cpu: hardware has 6 breakpoints, 4 watchpoints
(I noticed the libusb_open error, but after re-checking several times that Zadig installed the correct USB driver, I gave up as the debugger seems to be connecting anyway).

Then, I launched the debugger and it immediately broke at 0x08068b30:

Code: Select all

c:\particle\toolchain\gcc-arm\bin\arm-none-eabi-gdb -ex "target remote localhost:3333" target/homesensor.elf'
    
GNU gdb (GNU Tools for ARM Embedded Processors) 7.10.1.20160923-cvs
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from target/homesensor.elf...done.
Remote debugging using localhost:3333
0x08068b30 in ?? ()
(gdb)
When the debugger attached, the OpenOCD window generated a few more errors:

Code: Select all

Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x201f6411
Error: JTAG-DP STICKY ERROR
Error: Failed to read memory at 0x1fff7a24
Warn : STM32 flash size failed, probe inaccurate - assuming 1024k flash
Info : flash size = 1024kbytes
Error: JTAG-DP STICKY ERROR
Error: Failed to read memory at 0x08068b34
Error: JTAG-DP STICKY ERROR
Error: Failed to read memory at 0x08068b32
With the debugger connected, I tried to continue ("c"). It again breaks with a SIGINT interrupt.

Code: Select all

(gdb) c
Continuing.
stm32f2x.cpu -- clearing lockup after double fault

Program received signal SIGINT, Interrupt.
0x08068b30 in ?? ()
(gdb)
I looked up that memory location in the system-part2.lst and found the HardFault_Handler().

Code: Select all

08068b30 <HardFault_Handler>:
}


void HardFault_Handler(void)
{
    __asm volatile
 8068b30:	f01e 0f04 	tst.w	lr, #4
 8068b34:	bf0c      	ite	eq
 8068b36:	f3ef 8008 	mrseq	r0, MSP
 8068b3a:	f3ef 8009 	mrsne	r0, PSP
 8068b3e:	6981      	ldr	r1, [r0, #24]
 8068b40:	4a00      	ldr	r2, [pc, #0]	; (8068b44 <handler2_address_const>)
 8068b42:	4710      	bx	r2

08068b44 <handler2_address_const>:
 8068b44:	08068c15 	.word	0x08068c15
Am I doing something wrong? What is this SIGINT error? It seems like a timer interrupt for the main loop() method or something.

-John

Post Reply