I did read your article and it was very helpful, however Iâm still having problems. The application was using D7 and just disabled it, please see below.
^C and then c suspends and resumes application but it doesnât break on breakpoints âŠ
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x08025072 in SparkProtocol::set_key (this=0x200018a0, signed_encrypted_credentials=0xa5a5a5a5 ââ) at src/spark_protocol.cpp:1608
1608 calculate_ciphertext_hmac(signed_encrypted_credentials, credentials, hmac);
(gdb) b applications/can/application.cpp:75
Breakpoint 3 at 0x80a0280: file applications/can/application.cpp, line 75.
(gdb) c
Continuing.
cd modules
make clean all -s PLATFORM=photon COMPILE_LTO=n APP=can MODULAR=n PARTICLE_DEVELOP=1 program-dfu USE_SWD_JTAG=y DEBUG_BUILD=y
~/Downloads/particle/scripts/sync_20152012.bash
#!/bin/bash -v
READELF=arm-none-eabi-readelf
GDB=arm-none-eabi-gdb
COMMON_BUILD=~/Downloads/particle/20151220/firmware/build
PLATFORM_ID=6
LTO=
function elf {
echo $COMMON_BUILD/target/$1/platform-$PLATFORM_ID-m$LTO/$1.elf
}
SYSTEM_PART1_ELF=$(elf system-part1)
elf system-part1
SYSTEM_PART2_ELF=$(elf system-part2)
elf system-part2
USER_PART_ELF=/home/randal/Downloads/particle/20151220/firmware/build/target/user-part/platform-6-m/can.elf
function text_section_address {
$READELF $1 --headers | grep .text | head -n 1 | sed âs/.PROGBITS \([^ ]\)./0x\1/â
}
SYSTEM_PART1_ADDRESS=$(text_section_address $SYSTEM_PART1_ELF)
text_section_address $SYSTEM_PART1_ELF
SYSTEM_PART2_ADDRESS=$(text_section_address $SYSTEM_PART2_ELF)
text_section_address $SYSTEM_PART2_ELF
USER_PART_ADDRESS=$(text_section_address $USER_PART_ELF)
text_section_address $USER_PART_ELF
$GDB
-ex âtarget remote localhost:4242â
-ex âset confirm offâ
-ex âadd-symbol-file $SYSTEM_PART1_ELF $SYSTEM_PART1_ADDRESSâ
-ex âadd-symbol-file $SYSTEM_PART2_ELF $SYSTEM_PART2_ADDRESSâ
-ex âadd-symbol-file $USER_PART_ELF $USER_PART_ADDRESSâ
-ex âset confirm onâ \
GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
Copyright © 2014 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=x86_64-unknown-linux-gnu --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â.
Remote debugging using localhost:4242
0x00000000 in ?? ()
add symbol table from file â/home/randal/Downloads/particle/20151220/firmware/build/target/system-part1/platform-6-m/system-part1.elfâ at
.text_addr = 0x80201b0
Reading symbols from /home/randal/Downloads/particle/20151220/firmware/build/target/system-part1/platform-6-m/system-part1.elfâŠdone.
add symbol table from file â/home/randal/Downloads/particle/20151220/firmware/build/target/system-part2/platform-6-m/system-part2.elfâ at
.text_addr = 0x80601d8
Reading symbols from /home/randal/Downloads/particle/20151220/firmware/build/target/system-part2/platform-6-m/system-part2.elfâŠdone.
add symbol table from file â/home/randal/Downloads/particle/20151220/firmware/build/target/user-part/platform-6-m/can.elfâ at
.text_addr = 0x80a0018
Reading symbols from /home/randal/Downloads/particle/20151220/firmware/build/target/user-part/platform-6-m/can.elfâŠdone.
(gdb) b loop
Breakpoint 1 at 0x8060554: loop. (2 locations)
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y
1.1 y 0x08060554 in loop() at âŠ/âŠ/âŠ/modules/shared/stm32f2xx/inc/system_part2_loader.c:64
1.2 y 0x080a0200 in loop() at applications/can/application.cpp:52
(gdb) disable 1.1
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
^C
Program received signal SIGINT, Interrupt.
0x08025072 in SparkProtocol::set_key (this=0x200018a0, signed_encrypted_credentials=0xa5a5a5a5 ââ) at src/spark_protocol.cpp:1608
1608 calculate_ciphertext_hmac(signed_encrypted_credentials, credentials, hmac);
(gdb) monitor reset halt
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08002e2c msp: 0x20020000
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y
1.1 n 0x08060554 in loop() at âŠ/âŠ/âŠ/modules/shared/stm32f2xx/inc/system_part2_loader.c:64
1.2 y 0x080a0200 in loop() at applications/can/application.cpp:52
(gdb) c
Continuing.
openocd -s ~/EmbeddedArm/openocd-bin/share/openocd/scripts/ -f board/photon.cfg
-c âgdb_port 4242â -c "$_TARGETNAME configure -rtos FreeRTOS"
Open On-Chip Debugger 0.9.0 (2015-12-19-11:23)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport âhla_swdâ. To override use 'transport select '.
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.253438
Info : stm32f2x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting âgdbâ connection on tcp/4242
Info : device id = 0x20036411
Info : flash size = 1024kbytes
undefined debug reason 7 - target needs reset
Warn : RTOS FreeRTOS not detected. (GDB could not find symbol âpxCurrentTCBâ)
Error: Error allocating memory for -1291820781 threads
Error: Error allocating memory for -1291820781 threads
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08002e2c msp: 0x20020000
Error: Error allocating memory for -1291820781 threads
Error: Error allocating memory for -1291820781 threads
Info : dropped âgdbâ connection
Info : accepting âgdbâ connection on tcp/4242
Warn : RTOS FreeRTOS not detected. (GDB could not find symbol âpxCurrentTCBâ)
Error: Error allocating memory for -1291820781 threads
Error: Error allocating memory for -1291820781 threads
Error: Error allocating memory for -1291820781 threads
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08002e2c msp: 0x20020000
Error: Error allocating memory for -1291820781 threads
Error: Error allocating memory for -1291820781 threads