Debugger for chibios

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
nikhil
Posts: 40
Joined: Thu Jan 03, 2013 8:46 pm

Debugger for chibios

Post by nikhil »

Hello,

I would like to know what are the debugger devices being used by chibios users which support chibios debug messages and are copatible with chibios eclipse plugin.


--
Nikhil
colin
Posts: 149
Joined: Thu Dec 22, 2011 7:44 pm

Re: Debugger for chibios

Post by colin »

I have used two configurations:

1. ST-Link/V2 with OpenOCD 0.8.0 - both with STM32 and Freescale Kinetis MCU targets. With ChibiOS/RT 2.x, OpenOCD provides RTOS integration and will show separate stack of each the ChibiOS/RT thread -- super useful. The ST-Link/V2 costs only about 20.00 USD and is small and handy.

2. Segger J-Link with Segger's GDB Server - both with STM32 and Freescale Kinetis MCU targets. No RTOS integration without OpenOCD. J-Link is reliable and fast but is proprietary and expensive. Cost 300.00 USD for standard one. But 50.00 "educational" one is available. I'd rather use OpenOCD if possible just for its openness, all else being equal.

I also have used the Versaloon Mini. It's an open source project. I ordered a couple from the author, Simon, in China. They are based on STM32 MCU and have both a custom "vsprog" program for quick flashing etc. and also OpenOCD support for debugging. It should work in ChibiStudio since it works with GDB.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Debugger for chibios

Post by Giovanni »

ST-Link works with Kinetis? really? is it also able to flash?

Giovanni
colin
Posts: 149
Joined: Thu Dec 22, 2011 7:44 pm

Re: Debugger for chibios

Post by colin »

Yes, ST-Link/V2 is tested and verified working with FRDM-KL25Z. Flashing and debugging works. Seems decently fast also (for the Kinetis L, which apparently doesn't have as fast of flash write capability as other MCUs), at least in brief test it shows 14 KB/sec. (Using the Keil CMSIS-DAP firmware on the OpenSDA chip onboard the Freedom board resulted in much slower performance.)

Configuration:
  • FRDM-KL25Z: KL25 USB plugged into PC; OpenSDA USB not plugged in. This means onboard OpenSDA is powered down.
  • ST-Link/V2: Connected to J6 "Cortex Debug" 10-pin header on the FRDM-KL25Z (via Olimex ARM-JTAG-20-10 adapter)
  • OpenOCD 0.8.0
  • gdb 7.6 from the gcc-arm-embedded project

OpenOCD startup:

Code: Select all

$ bin-x64/openocd-x64-0.8.0.exe -f interface/stlink-v2.cfg -f target/kl25z_hla.cfg
Open On-Chip Debugger 0.8.0 (2014-04-28-08:42)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : add flash_bank kinetis pflash
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.222991
Info : kl25z.cpu: hardware has 2 breakpoints, 2 watchpoints


gdb invocation to load and debug ChibiOS 3 demo:

Code: Select all

~/Code/ChibiOS-RT/demos/KINETIS/RT-FREEDOM-KL25Z (master) $ arm-none-eabi-gdb -ex "target extended-remote vboxhost:3333" build/ch.elf
GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20140529-cvs
Copyright (C) 2013 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-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/cbennett/Code/ChibiOS-RT/demos/KINETIS/RT-FREEDOM-KL25Z/build/ch.elf...done.
Remote debugging using vboxhost:3333
0x00000688 in _idle_thread (p=0x0 <_vectors>) at ../../../os/rt/src/chsys.c:76
76     chRegSetThreadName("idle");
(gdb) bt
#0  0x00000688 in _idle_thread (p=0x0 <_vectors>) at ../../../os/rt/src/chsys.c:76
#1  0x00000436 in _port_thread_start ()
#2  0x00000436 in _port_thread_start ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) load
Loading section .isr, size 0xc0 lma 0x0
Loading section .cfmprotect, size 0x10 lma 0x400
Loading section .text, size 0x6368 lma 0x410
Loading section .data, size 0xb8 lma 0x6778
Start address 0x510, load size 25840
Transfer rate: 14 KB/sec, 5168 bytes/write.
(gdb) monitor reset halt
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x41000000 pc: 0x00000510 msp: 0x1ffff400
(gdb) c
Continuing.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Debugger for chibios

Post by Giovanni »

Very interesting, thanks for sharing Colin. The standalone ST-Link looks like a good solution.

Giovanni
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Debugger for chibios

Post by barthess »

I am use ARM-USB-OCD by Olimex and some china made J-link clones. All variants works flawlessly with OpenOCD. My hand made ST-Link (SWD only) works fine too.
colin
Posts: 149
Joined: Thu Dec 22, 2011 7:44 pm

Re: Debugger for chibios

Post by colin »

Barthess does the Olimex ARM-USB-OCD work with SWD?

Do you notice any speed difference between JLink, ARM-USB-OCD, and ST-Link?

I suppose the unlimited flash breakpoints feature of JLink is not suuported in OpenOCD but only with Segger JLink GDB Server? It seems like a simple feature actually, I wonder if OpenOCD/gdb can support this generally? (Reprogram flash sector on the fly to insert/remove BKPT instruction.)
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Debugger for chibios

Post by barthess »

colin wrote:does the Olimex ARM-USB-OCD work with SWD?

No. JTAG only.
colin wrote:Do you notice any speed difference between JLink, ARM-USB-OCD, and ST-Link?

I can not observe any meaningful difference.
colin wrote:I suppose the unlimited flash breakpoints feature of JLink is not suuported in OpenOCD

Is this feature works when you run program from flash of from RAM? Reprogramming flash on the fly looks painfully slow, especially on huge pages in stm32f4xx
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Debugger for chibios

Post by barthess »

colin
Posts: 149
Joined: Thu Dec 22, 2011 7:44 pm

Re: Debugger for chibios

Post by colin »

Hi barthess, thanks for the response. I always use SWD anymore so ARM-USB-OCD isn't an option then.

barthess wrote:
colin wrote:I suppose the unlimited flash breakpoints feature of JLink is not suuported in OpenOCD

Is this feature works when you run program from flash of from RAM? Reprogramming flash on the fly looks painfully slow, especially on huge pages in stm32f4xx


It works when running from flash, of course, it's called "unlimited flash breakpoints". :)
Yes, I'm sure it would be less than ideal on a STM32F4 with huge sectors.
SEGGER J-Link Unlimited Flash Breakpoints wrote:J-Link is capable of supplying an unlimited number of breakpoints in flash memory. Setting the breakpoints in flash is executed very fast using a RAM code specifically designed for this purpose; on chips with fast flash, the difference between breakpoints in RAM and flash is unnoticeable. This feature requires an additional license from SEGGER.
Post Reply