Debugging against the RedBear Duo


#1

There have been numerous threads about debugging the RedBear Duo but none of them are conclusive, despite the [SOLVED] tag.

On the OpenOCDterminal window

$ ~/Library/Arduino15/packages/arduino/tools/openocd/0.10.0-arduino1-static/bin/openocd -f ~/Library/Arduino15/packages/RedBear/hardware/STM32F2/0.3.1/variants/RedBear_Duo/openocd_scripts/redbear_duo.cfg
Open On-Chip Debugger 0.10.0-00004-g0e78f263 (2017-02-20-13:15)
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_assert_srst
Unlock
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 v24 API v2 SWIM v11 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.259987
Info : stm32f2x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting ‘gdb’ connection on tcp/3333
Info : device id = 0x20036411
Warn : STM32 flash size failed, probe inaccurate - assuming 1024k flash
Info : flash size = 1024kbytes
undefined debug reason 7 - target needs reset
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08003c10 msp: 0x20020000
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08003c10 msp: 0x20020000
Error: jtag status contains invalid mode value - communication failure
Warn : target stm32f2x.cpu is not halted
Polling target stm32f2x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Warn : target not halted
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f2x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 300ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f2x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 700ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f2x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 1500ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f2x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 3100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f2x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 6300ms

On the arm-none-eabi-gdb terminal window

$ ~/Library/Arduino15/packages/RedBear/tools/arm-none-eabi-gcc-redbear/4.9-2015-q3/bin/arm-none-eabi-gdb
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-apple-darwin10 --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”.
(gdb) set remotetimeout 2000
(gdb) target extended :3333
Remote debugging using :3333
0x00000000 in ?? ()
(gdb) monitor reset halt
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08003c10 msp: 0x20020000
(gdb) file ~/Library/Developer/Xcode/DerivedData/RedBear-Duo-Debug-dehltyhzdcalwibqbuutkwmfljzt/Build/Products/Debug/embeddedcomputing.elf
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from ~/Library/Developer/Xcode/DerivedData/RedBear-Duo-Debug-dehltyhzdcalwibqbuutkwmfljzt/Build/Products/Debug/embeddedcomputing.elf…done.
(gdb) monitor reset init
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08003c10 msp: 0x20020000
(gdb) l loop
117 /// @brief Loop
118 /// @details Call blink
119 ///
120 // Add loop code
121 void loop()
122 {
123 blink(myLED, 3, 333);
124 delay(1000);
125 }
(gdb) br 123
Breakpoint 1 at 0x80c00b2: file RedBear_Duo_Debug.ino, line 123.
(gdb) info br
Num Type Disp Enb Address What
1 breakpoint keep y 0x080c00b2 in loop()
at RedBear_Duo_Debug.ino:123
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
jtag status contains invalid mode value - communication failure

[Remote target] #1 stopped.
0x08003c10 in ?? ()
(gdb)

Could you please provide an official procedure on how to debug against the RedBear Duo with the RBLink? Thank you!


Disabling all low power modes on Duo [SOLVED]
#2

Hi @reivilo, since the duo firmware architecture is organized as partition, it’s hard to debug with OpenOCD. We haven’t dug this further. The Duo firmware is similar with Particle Photon, you can browse the Particle community for answers as well.