0

I'm developing a multi threaded application with FreeRTOS on a STM32. When I try to debug it with OpenOCD and gdb, I can do so with all threads but my main loop.

>>> info threads
  Id   Target Id         Frame 
  6    Thread 536892936 (cli) vTaskSuspend (xTaskToSuspend=<optimized out>) at /home/user1273684/dev/firmware/module/FreeRTOS/Source/tasks.c:1620
  5    Thread 536888728 (wifi_loop) vTaskSuspend (xTaskToSuspend=<optimized out>) at /home/user1273684/dev/firmware/module/FreeRTOS/Source/tasks.c:1620
  4    Thread 536884824 (Tmr Svc) xTaskResumeAll () at /home/user1273684/dev/firmware/module/FreeRTOS/Source/tasks.c:2126
  3    Thread 536905240 (main_loop) 0x00000000 in ?? ()
  2    Thread 536879832 (wifi_watchdog) xTaskResumeAll () at /home/user1273684/dev/firmware/module/FreeRTOS/Source/tasks.c:2126
* 1    Thread 536882960 (IDLE :  : Running) prvIdleTask (pvParameters=<optimized out>) at /home/user1273684/dev/firmware/module/FreeRTOS/Source/tasks.c:3145
>>> thread 3
[Switching to thread 3 (Thread 536905240)]
#0  0x00000000 in ?? ()
>>> bt
#0  0x00000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

I tried increasing the stack size (vTaskList() says there is plenty of space left, configCHECK_FOR_STACK_OVERFLOW is set to 2 and vApplicationStackOverflowHook() is never triggered) but without any change.

2017-06-20 10:34:34,217 - INFO # cli                R   1   922     5
2017-06-20 10:34:34,217 - INFO # IDLE               R   0   235     2
2017-06-20 10:34:34,218 - INFO # wifi_watchdog      B   1   231     8
2017-06-20 10:34:34,218 - INFO # main_loop          B   2   2879    6
2017-06-20 10:34:34,218 - INFO # Tmr Svc            S   4   320     3
2017-06-20 10:34:34,218 - INFO # wifi_loop          S   3   627     4

What is going on here?

user1273684
  • 1,559
  • 15
  • 24
  • Once you start RTOS kernel, there is no *main* loop anymore. STM32 has more stack pointers, do you checking the correct one? You have main stack and process stack pointer. If everything works, what is the problem actually? – unalignedmemoryaccess Jun 20 '17 at 08:38
  • `APP_MAIN_STACK_SIZE_WORDS` is set to 256 words (1kB), `APP_PROCESS_STACK_SIZE_WORDS` is set to 128 words (512B) - I tried incrementing both. `main_loop` is just the name of the thread. The problem is that this thread stops working after some time now and I want to debug it. – user1273684 Jun 20 '17 at 08:57
  • Yeah, what is going on? You need to show some code, what happens in the main thread after you start the FreeRTOS scheduler? – unwind Jun 20 '17 at 09:01

0 Answers0