Multithread debugging with chibistudio and openocd

Discussions and support about ChibiStudio, the free development environment for ARM.
nikhil
Posts: 40
Joined: Thu Jan 03, 2013 8:46 pm

Multithread debugging with chibistudio and openocd

Postby nikhil » Thu Jan 01, 2015 1:01 pm

Hello,

I am using chibistudio preview 8 with stm32f4 discovery board. I am trying to follow this guide for multithread support while debugging. I am trying with ARMCM4-STM32F407-DISCOVERY-MEMS demo. However I am not able to see threads in debug list nor chibios is being detected by openocd in openocd console I have enabled rtos support for openocd by passing -c "stm32f4x.cpu configure -rtos auto" which starting openocd.
I have checked chconf and found CH_USE_REGISTRY is set TRUE and all debug options are enabled.

Is there any way to make it working?

-nikhil

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: Multithread debugging with chibistudio and openocd

Postby steved » Thu Jan 01, 2015 2:17 pm

Are you using the chibios3 code? If so, you need to close the Chibi 2 debug window, and open the Chibi 3 one. (Window-->Show View-->Other)

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

Re: Multithread debugging with chibistudio and openocd

Postby nikhil » Thu Jan 01, 2015 2:54 pm

I am using chibios 2.6.6

--
nikhil

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

Re: Multithread debugging with chibistudio and openocd

Postby Giovanni » Thu Jan 01, 2015 3:13 pm

Probably you need to go past chSysInit() or the threads list is not yet built in memory.

Giovanni

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

Re: Multithread debugging with chibistudio and openocd

Postby nikhil » Thu Jan 01, 2015 4:02 pm

It would great if you could direct me to verify if this is going beyond chSysInit() or to check if thread list s built in memory.


--
nikhil

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

Re: Multithread debugging with chibistudio and openocd

Postby Giovanni » Thu Jan 01, 2015 4:53 pm

You need to start the application and then stop it or to put a breakpoint after chSysInit() in your main function.

Giovanni

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

Re: Multithread debugging with chibistudio and openocd

Postby colin » Tue Feb 03, 2015 11:38 pm

Just a note that ChibiOS version 3 looks like it's not supported in the current release version of OpenOCD (0.8.0).

But happily it has been committed to the Git development branch:

Code: Select all

commit 8b99681346c71b7fa6358bf79becaaecb6151f4a
Author: Christian Gudrian <christian.gudrian@gmx.de>
Date:   Tue Oct 21 22:23:40 2014 +0200

    rtos: add support for ChibiOS/RT 3.0

    In ChibiOS/RT 3.0 the ready list pointer "rlist" is now part of the system
    data structure. Since the ready list is the first element in that
    structure it can be accessed via the structure's symbol "ch".


So if you compile OpenOCD from Git yourself you can get it working with ChibiOS 3. Or you can wait for release 0.9.0.

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

Re: Multithread debugging with chibistudio and openocd

Postby Giovanni » Wed Feb 04, 2015 9:12 am

Great news, thanks.

Giovanni

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: Multithread debugging with chibistudio and openocd

Postby steved » Thu Jun 04, 2015 10:34 am

Have just got the basics of this working with ChibiOS3/ChibiStudio 10; a few things have changed, so some notes for anyone else:

1. Download the latest version of OpenOCD from http://www.freddiechopin.info/en/downlo ... penocd-dev
Expand it into the tools\openocd directory

2. Identify the openOCD file for your processor in tools\openocd\scripts\target (e.g. stm32f4x.cfg). Open in a text editor.
Find the configuration line (about line 68 for the 32f4) and add the -rtos option:

Code: Select all

$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 -rtos ChibiOS


3. Edit the relevant debug configuration - in the startup tab, insert a line at the top of the initialisation commands:

Code: Select all

file C:/ChibiStudio/workspace30/Project_Directory/build/ch.elf


(If step 3 isn't done, OpenOCD will report: Error: No symbols for ChibiOS)

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

Re: Multithread debugging with chibistudio and openocd

Postby Giovanni » Thu Jun 04, 2015 11:07 am

Hi,

Thanks for the info, I will add the new OpenOCD to the next release.

Is there a way to specify that "-rtos ChibiOS" on the command line? that would allow me to do that from the Eclipse launcher instead of having to manually change OOCD files (if not possible, it would be worth suggesting this to the OOCD team).

Giovanni


Return to “ChibiStudio”

Who is online

Users browsing this forum: No registered users and 2 guests