ChibiOS OpenOCD support

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: ChibiOS OpenOCD support

Post by mabl »

Hi Prof.

did you try out the Windows build? Or are using Linux?

Prof. Dr. YoMan wrote:Will this be backported to 2.4.3 (which is due to release?)?

It's up to Giovanni, the impact will limited - i see no issue with back-porting.

Prof. Dr. YoMan wrote:And what about M4-F enabled? Where is the problem with the FPU?

With FPU enabled, the FPU registers will alsp be saved on the stack on context switch. OpenOCD will have to know about the changed stack as well. I've already added FPU detection to ChibiOS - so there is no problem here. But the floating point register stuff is not yet final in OpenOCD itself - so i just decided to skip it for now.

What i *could do* is to at faux stacking information for the FPU registers - basically the content of your floating point variables might be messed up in that case - but at least you would get backtraces...
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS OpenOCD support

Post by Giovanni »

I can release 2.4.3 in any moment, the branch has been just collecting bug fixes for a while now (and I can backport the feature).

Giovanni
User avatar
Prof. Dr. YoMan
Posts: 57
Joined: Thu May 24, 2012 11:00 am
Been thanked: 1 time

Re: ChibiOS OpenOCD support

Post by Prof. Dr. YoMan »

Mabl, I am on windows. But I never tried anything but 2.4.2.

If the openocd-thread support would be in 2.4.3 I will use an test it for sure.

Right now I am in "playing" time with ChibiOS. Lots of other stuff to do with other projects.

BUT, it would be much easier to get ChibiOS as "default" for most if not all of our pending CortexM3/M4 projects if I could point out the ease of debugging the threaded environment.

Right now we are using some FreeRTOS but most of our software is IRQ-driven with "one" statemaschine. It "sucks" :)

I did not find any showstoppers with 2.4.2 with what I have tested and tried right now, but I have seen the bug- and changeslist pretty long.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS OpenOCD support

Post by Giovanni »

Duh, most of them are marginal fixes in the HAL, there is nothing compromising stability except for the stated defect. The kernel hasn't seen a serious bug in years.

If there was anything serious 2.4.3 would have already been released.

Giovanni
User avatar
Prof. Dr. YoMan
Posts: 57
Joined: Thu May 24, 2012 11:00 am
Been thanked: 1 time

Re: ChibiOS OpenOCD support

Post by Prof. Dr. YoMan »

No offence. :) I stand corrected: The changes ans feature list is long. :)
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: ChibiOS OpenOCD support

Post by mabl »

Prof. Dr. YoMan wrote:BUT, it would be much easier to get ChibiOS as "default" for most if not all of our pending CortexM3/M4 projects if I could point out the ease of debugging the threaded environment.

To be fair, tough: openocd supports thread view for ChibiOS, FreeRTOS, ThreadX, eCos and Linux - no guarantee that these work though :-D The code looks unreliable :twisted:
szkkteam
Posts: 4
Joined: Thu Dec 24, 2015 2:23 pm

Re: ChibiOS OpenOCD support

Post by szkkteam »

Hello. I'm relativly new with Chibios. I've downloaded the Chibios 3.0. from the site, and I'm developing my custom application. My code works fine, but when I try to debug it, the openocd cannot detect ChibiOS, and when I set a breakpoint into a task, the software running does not stop, when hit the breakpoint.

I'm running Ubuntu with Eclipse Mars ide.
I configured the openocd, and the Eclipse by this tutorial:
http://vedder.se/2012/12/debugging-the- ... d-eclipse/

My openocd config file is the following

Code: Select all

source [find interface/stlink-v2.cfg]
source [find target/stm32f4x.cfg]
$_TARGETNAME configure -rtos ChibiOS
reset_config srst_only srst_nogate


The openocd works fine with a non chibios based software, but when i connect to the openocd it show the following:

Code: Select all

GNU ARM Eclipse 32-bits Open On-Chip Debugger 0.10.0-dev-00141-g09aeb96-dirty (2015-10-28-12:05)
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 <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v14 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.897285
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x10076413
Info : flash size = 1024kbytes
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080001f0 msp: 0x20000400
Warn : RTOS ChibiOS not detected. (GDB could not find symbol 'ch_debug')
Warn : RTOS ChibiOS not detected. (GDB could not find symbol 'ch_debug')
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080001f0 msp: 0x20000400
Error: Memory signature identifier does not contain magic bytes.
Error: Reading the memory signature of ChibiOS/RT failed


I've tried to set the config file to -rtos auto but doesnt helped. I also triple checked my .elf file contains the ch_debug symbol!!!
But my main problem is, why does not stop the software running, when i set a breakpoint inside a thread? Until i put it into the main sequnce (initialisaion) it works, but noting in the thread.
I put here my main.c code, the main loop does nothing, just sleep.

Code: Select all

/*
 * Application entry point.
 */
int main(void) {
   /******************************************************************************/
   /* @Description : Initialization of Chibios subsystems.                       */
   /******************************************************************************/
   vidInitSubSys();

   chThdSleepMilliseconds(1000);

   /******************************************************************************/
   /* @Description : Initialization of user applications.                        */
   /******************************************************************************/
   vidInitApplications();

  /*
   * Normal main() thread activity, in this demo it does nothing except
   * sleeping in a loop and check the button state.
   */
  while (true) {

       chThdSleepMilliseconds(500);

  }
}


Any idea??
Last edited by szkkteam on Thu Dec 24, 2015 4:43 pm, edited 1 time in total.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS OpenOCD support

Post by Giovanni »

Hi

Try to compile using -O0 instead of -O2 (default).

Giovanni
szkkteam
Posts: 4
Joined: Thu Dec 24, 2015 2:23 pm

Re: ChibiOS OpenOCD support

Post by szkkteam »

Thank you Giovanni now it's working. :)

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

Re: ChibiOS OpenOCD support

Post by nikhil »

Hi

I believe FPU support has been added to openocd for chibios/rt. (https://github.com/ntfreak/openocd/comm ... 9e0762a2c1)

When I tried to use chibios plugin within eclipse (with use_fpu=hard, -O0, all debug option enabled in chconf), I can see the thread list in eclipse debug window when pause the program. However when I try to refresh plugin, I get error that says 'Failed to read memory at 0x55555556' with following message in oocd console.

Code: Select all

Info : Successfully loaded memory map of ChibiOS/RT target running version 2.6.5
Error: JTAG-DP STICKY ERROR
Error: MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x55555556
Error: Failed to read memory at 0x55555556
Error: JTAG-DP STICKY ERROR
Error: MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x55555556
Error: Failed to read memory at 0x55555556


Please let me know if there is any way to get it work with plugin. Is there any other method to check stack usage of individual threads with FPU on?


--
nikhil
Post Reply