SWD adapter for OpenOCD and ChibiOS/RT RTOS-aware debugging

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess

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

SWD adapter for OpenOCD and ChibiOS/RT RTOS-aware debugging

Postby colin » Wed Feb 12, 2014 10:41 pm

What is a good SWD adapter to use with OpenOCD and ChibiOS/RT RTOS-awareness (threads)?

I currently use a Segger J-Link and use their GDB server on my workstation. This is very reliable and easy to use. But it doesn't allow me to get the ChibiOS/RT thread awareness and other goodness that I understand is available in OpenOCD.

Can anyone recommend a JTAG adapter with SWD support that is well supported by OpenOCD? I expect to program/debug STM32 and Freescale Kinetis parts, primarily, and I don't want to mess JTAG, only SWD for me.

Abhishek
Posts: 266
Joined: Wed May 23, 2012 3:15 pm
Location: India

Re: SWD adapter for OpenOCD and ChibiOS/RT RTOS-aware debugg

Postby Abhishek » Sat Feb 15, 2014 4:54 am

If I am not wrong, someone had once pointed out that the ST-LINK v2 is capable of debugging any SWD target MCU, not just the STM32.

Could you try and check if you are able to use the ST-LINK v2 for debugging Kinetis also?

Regards
Abhishek

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: SWD adapter for OpenOCD and ChibiOS/RT RTOS-aware debugg

Postby Giovanni » Sat Feb 15, 2014 9:26 am

ST-Link is probably the best option for STM32, I think you need to understand which one has the best support in OpenOCD if you need an universal adapter.

Giovanni

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

Re: SWD adapter for OpenOCD and ChibiOS/RT RTOS-aware debugg

Postby colin » Mon Mar 03, 2014 11:23 pm

So I will try the ST-Link V2 and see how it works. Is it best to use it with OpenOCD then to get ChibiOS/RT RTOS-aware debugging in gdb/Eclipse? I see the document Using an ST-Link with Chibios and Eclipse on Linux / Mac OS X but it is using the Texane stlink tool, not openocd, so I doubt whether ChibiOS/RT RTOS-awareness is supported.

Can you just use openocd + gdb with the ST-Link/V2 and get ChibiOS RTOS-awareness?

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: SWD adapter for OpenOCD and ChibiOS/RT RTOS-aware debugg

Postby Giovanni » Tue Mar 04, 2014 9:04 am

The RTOS awareness should work using any HW under OpenOCD, I haven't tested it for a while, please let me go how it goes.

I saw on the ST web site that now there is also an opto-isolated variant of the ST-Link.

Giovanni

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

Re: SWD adapter for OpenOCD and ChibiOS/RT RTOS-aware debugg

Postby colin » Wed Mar 05, 2014 10:42 pm

Abhishek wrote:If I am not wrong, someone had once pointed out that the ST-LINK v2 is capable of debugging any SWD target MCU, not just the STM32.

Could you try and check if you are able to use the ST-LINK v2 for debugging Kinetis also?

Regards
Abhishek


I haven't tried on Kinetis yet, but the article cortex-m0+ SWD debugging on the cheap describes how to program and debug an NXP LPC812 using an STM32F0 Discovery board using OpenOCD and gdb. Pretty cool.

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

Re: SWD adapter for OpenOCD and ChibiOS/RT RTOS-aware debugg

Postby colin » Wed Mar 05, 2014 10:47 pm

Giovanni wrote:The RTOS awareness should work using any HW under OpenOCD, I haven't tested it for a while, please let me go how it goes.

I saw on the ST web site that now there is also an opto-isolated variant of the ST-Link.

Giovanni


It works well. Tested ChibiOS/RT 2.6.3 demos on both STM32F0DISCOVERY (STM32F051) and STM32F4DISCOVERY (STM32F407).

Right now I'm on a Windows 7 machine running VirtualBox hosting Debian Linux 7.4 as a guest OS. I use the GCC ARM Embedded toolchain on Debian to get arm-none-eabi-gcc, gdb, etc. I run OpenOCD 0.7.0 on the host OS (Win7 64bit). Then I run gdb in Debian and connect to the openocd instance that runs on the host Win7 OS. I run Eclipse in the Debian guest OS as well.

It works great! I think I'll use the ST-LINK/V2 now, or possibly J-Link when it works. Thanks!

ogi
Posts: 8
Joined: Tue Nov 04, 2014 6:54 pm

Re: SWD adapter for OpenOCD and ChibiOS/RT RTOS-aware debugg

Postby ogi » Tue Nov 04, 2014 7:02 pm

Sorry for posting in an old port, but I've been unable to send messages through the SWD (ITM) interface with a STM3240G-EVAL board (STlink V2 embedded in the board), I can program the board, run the code using OpenOCD and, debug setting breakpoints, but no luck sending trace messages. ¿ Can somebody help me with the openocd .cfg files ?, I made mine from the STM3220G-EVAL file, this contains:

Code: Select all

# STM3241G-EVAL: This is an STM32F4 eval board with a single STM32F417IGH6
# (1024KB) chip.
# http://www.st.com/internet/evalboard/product/252216.jsp
#
# This is for using the onboard STLINK/V2

source [find interface/stlink-v2.cfg]

# increase working area to 128KB
set WORKAREASIZE 0x20000

# chip name
set CHIPNAME STM32F407IGH6V

# parametros stlink hla
#targets
#trace 168000000
#hla newtap STM32F407IGH6V cpu -expected-id 0x10016413
#transport select hla_swd

source [find target/stm32f4x_stlink.cfg]

# use hardware reset, connect under reset
reset_config srst_only srst_nogate



Some time ago I made it using a JLink clone adapter, but it doesn't work any longer and I like the STLink because it's easy to find and legal.

Thanks in advance,

Olgierd


colin wrote:
Giovanni wrote:The RTOS awareness should work using any HW under OpenOCD, I haven't tested it for a while, please let me go how it goes.

I saw on the ST web site that now there is also an opto-isolated variant of the ST-Link.

Giovanni


It works well. Tested ChibiOS/RT 2.6.3 demos on both STM32F0DISCOVERY (STM32F051) and STM32F4DISCOVERY (STM32F407).

Right now I'm on a Windows 7 machine running VirtualBox hosting Debian Linux 7.4 as a guest OS. I use the GCC ARM Embedded toolchain on Debian to get arm-none-eabi-gcc, gdb, etc. I run OpenOCD 0.7.0 on the host OS (Win7 64bit). Then I run gdb in Debian and connect to the openocd instance that runs on the host Win7 OS. I run Eclipse in the Debian guest OS as well.

It works great! I think I'll use the ST-LINK/V2 now, or possibly J-Link when it works. Thanks!


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 41 guests