Dear fellow RIOTing developers,
OpenOCD-RTOS support is coming to RIOT but needs your help. But first what am I talking about?
When debugging a RIOT application via GDB you will be able to get an overview of all running threads and their states:
(gdb) info threads [New Thread 2] [New Thread 3] Id Target Id Frame 3 Thread 3 (at86rfxx : : Blocked receive) 0x00004104 in _msg_receive (m=m@entry=0x20000f00 <_lwmac_stacks+860>, block=block@entry=1) at .../RIOT/core/msg.c:329 2 Thread 2 (main : : Blocked mutex) mutex_lock (mutex=mutex@entry=0x20000a6c <main_stack+1388>) at .../RIOT/core/mutex.c:53 * 1 Thread 1 (idle : : Running) lpm_arch_set (target=target@entry=LPM_IDLE) at .../RIOT/cpu/samd21/lpm_arch.c:98
You can switch the current thread and investigate the stackframe:
(gdb) thr 2 [Switching to thread 2 (Thread 2)] #0 mutex_lock (mutex=mutex@entry=0x20000a6c <main_stack+1388>) at .../RIOT/core/mutex.c:53 (gdb) bt #0 mutex_lock (mutex=mutex@entry=0x20000a6c <main_stack+1388>) at .../RIOT/core/mutex.c:53 #1 0x00002c96 in _xtimer_sleep (offset=396000, long_offset=long_offset@entry=0) at .../RIOT/sys/xtimer/xtimer.c:53 #2 0x00000fa4 in xtimer_usleep (offset=<optimized out>) at .../RIOT/sys/include/xtimer.h:487 #3 main () at .../main.c:79
All you need to get this working is my yet unmerged PR [1] in RIOT and a modified version of OpenOCD. But the OpenOCD patches need reviewing at their code review tool and I was told to send some RIOT developers to actually do that reviewing because nobody @ OpenOCD is using RIOT. So to get this upstream please head over to their Gerrit [2] and do the reviewing if you want this feature. You can directly login with your Github account via OAuth here [3].
To test this on your system you need to compile OpenOCD yourself:
$ git clone https://github.com/daniel-k/openocd.git $ cd openocd $ git checkout riot_patched $ ./bootstrap $ ./configure $ sudo make install
Then merge my PR to your code and try it out.
Cheers, Daniel
[1] https://github.com/RIOT-OS/RIOT/pull/4058 [2] http://openocd.zylin.com/#/c/3000/ [3] http://openocd.zylin.com/login/%23%2Fregister%2Fq%2Fstatus%3Aopen?id=gerrit-oauth-provider_-github-oauth