Mabl,
To run the code yesterday, I downloaded the latest Chibios from GitHub and added a test application I was using. It appeared to be running OK.
The code has a shell, and number of GPIO interrupts set up so perhaps it was potentially confusing, adding problems with new kernal/application integration.
I went back to the demo code ARMCM3-STM32F103 with some i/o changes to match my board in the new kernal. The selftest code all ran fine.
This may be helpful for others trying to test the code as well a check.
I then tried that with your openOCD and it looks much better. At startup.
Code: Select all
openOCD_test Default [GDB Hardware Debugging]
ch.elf
Thread [3] 536875472 (blinker : : SLEEPING) (Suspended : Container)
chSchGoSleepS() at chschd.c:122 0x8000990
chSchGoSleepTimeoutS() at chschd.c:190 0x8000a6a
chThdSleep() at chthreads.c:290 0x8000ed8
Thread1() at main.c:37 0x8009ea6
_port_thread_start() at chcore_v7m.c:255 0x80003cc
Thread [2] 536873192 (idle : : CURRENT) (Suspended : Container)
_idle_thread() at chsys.c:61 0x8000508
_port_thread_start() at chcore_v7m.c:255 0x80003cc
Thread [1] 536873384 (main : : SLEEPING) (Suspended : User Request)
0x8000508
chSchGoSleepTimeoutS() at chschd.c:190 0x8000a6a
chThdSleep() at chthreads.c:290 0x8000ed8
main() at main.c:77 0x8009f14
gdb
The last entry in Thread 1 does not look complete
After Resume Pause
Code: Select all
openOCD_test Default [GDB Hardware Debugging]
ch.elf
Thread [3] 536875472 (blinker : : SLEEPING) (Suspended : Signal : SIGINT:Interrupt)
chSchGoSleepS() at chschd.c:122 0x8000990
chSchGoSleepTimeoutS() at chschd.c:190 0x8000a6a
chThdSleep() at chthreads.c:290 0x8000ed8
Thread1() at main.c:35 0x8009e90
_port_thread_start() at chcore_v7m.c:255 0x80003cc
Thread [2] 536873192 (idle : : CURRENT) (Suspended : Container)
_idle_thread() at chsys.c:61 0x8000508
_port_thread_start() at chcore_v7m.c:255 0x80003cc
Thread [1] 536873384 (main : : SLEEPING) (Suspended : Container)
chSchGoSleepS() at chschd.c:122 0x8000990
chSchGoSleepTimeoutS() at chschd.c:190 0x8000a6a
chThdSleep() at chthreads.c:290 0x8000ed8
main() at main.c:77 0x8009f14
gdb
All looks as expected
After resuming to a breakpoint in blinker
Code: Select all
openOCD_test Default [GDB Hardware Debugging]
ch.elf
Thread [4] 536873472 (\250\t : : READY) (Suspended : Container)
Thread1() at main.c:36 0x8009e90
_port_thread_start() at chcore_v7m.c:255 0x80003cc
Thread [3] 536875472 (blinker : : CURRENT) (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)
chSchGoSleepS() at chschd.c:122 0x8000990
chSchGoSleepTimeoutS() at chschd.c:190 0x8000a6a
chThdSleep() at chthreads.c:290 0x8000ed8
Thread1() at main.c:35 0x8009e90
_port_thread_start() at chcore_v7m.c:255 0x80003cc
Thread [2] 536873192 (idle : : READY) (Suspended : Container)
chSchDoRescheduleBehind() at chschd.c:309 0x8000b88
chSchDoReschedule() at chschd.c:363 0x8000c36
_port_switch_from_isr() at chcore_v7m.c:203 0x8000394
gdb
So far so good.
Then removing the breakpoint and resume then pause
Code: Select all
openOCD_test Default [GDB Hardware Debugging]
ch.elf
Thread [5] 536873384 (main : : SLEEPING) (Suspended : Container)
chSchGoSleepS() at chschd.c:122 0x8000990
chSchGoSleepTimeoutS() at chschd.c:190 0x8000a6a
chThdSleep() at chthreads.c:290 0x8000ed8
main() at main.c:77 0x8009f14
Thread [3] 536875472 (blinker : : SLEEPING) (Suspended : Signal : SIGINT:Interrupt)
chSchGoSleepS() at chschd.c:122 0x8000990
chSchGoSleepTimeoutS() at chschd.c:190 0x8000a6a
chThdSleep() at chthreads.c:290 0x8000ed8
Thread1() at main.c:35 0x8009e90
_port_thread_start() at chcore_v7m.c:255 0x80003cc
Thread [2] 536873192 (idle : : CURRENT) (Suspended : Container)
_idle_thread() at chsys.c:61 0x8000508
_port_thread_start() at chcore_v7m.c:255 0x80003cc
gdb
Looks good.
Now there is one issue I do not understand and it does not appear correct.
When running openOCD with gdb in the past, going Resume Pause virtually always ended in _idle_thread as expected as the processor is doing very little.
Now however doing the same ends in the chSchGoSleepS in the main loop every time I try.
Does the openOCD RTOS code modify the idle thread?
I also notice that I cannot break in the idle thread.
I setup to run the old openOCD with the same code and openOCD configuration files. It stops in the loop in _idle_thread every time I try.
Now comparing with my application, I have a number of Debug flags set in chconfig.h, so I trided the same flags in ths simple code and setting
results in the same behaviour as my application code.
Just for completeness I tested the following
Code: Select all
CH_DBG_SYSTEM_STATE_CHECK TRUE NO GOOD
CH_DBG_ENABLE_CHECKS TRUE OK
CH_DBG_ENABLE_ASSERTS TRUE OK
CH_DBG_ENABLE_TRACE TRUE OK
CH_DBG_ENABLE_STACK_CHECK TRUE OK
CH_DBG_FILL_THREADS TRUE OK
CH_DBG_THREADS_PROFILING TRUE OK
When running in the state with CH_DBG_SYSTEM_STATE_CHECK set, if I continue to run to breakpoints, it keeps creating new threads, like Thread 4 in the breakpoint case above, but a new one every time.
I do not know if having that flag set is valid when running openOCD.
I hope this helps.
Regards