This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
debug_freertos [2016/01/29 11:18] superstage [Openocd rtos awareness] |
debug_freertos [2018/05/22 10:33] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Debug Freertos ====== | ||
+ | ===== vTaskList ===== | ||
+ | To display the list of tasks states : | ||
+ | <code c> | ||
+ | //Approximately 40 bytes per task should be sufficient | ||
+ | char buffer[400]; | ||
+ | vTaskList(buffer); | ||
+ | /* example of output */ | ||
+ | |||
+ | // Name State Priority Stack Num | ||
+ | //************************************* | ||
+ | // CANAPP R 2 178 3 | ||
+ | // DBG R 1 42 1 | ||
+ | // IDLE R 0 116 5 | ||
+ | // LED B 1 238 4 | ||
+ | // MCTRL B 4 202 2 | ||
+ | </code> | ||
+ | [[http://www.freertos.org/a00021.html#vTaskList|For more information]]. | ||
+ | |||
+ | ===== configASSERT ===== | ||
+ | Enable you to check your config with a debugger. | ||
+ | <code c> | ||
+ | /* Define configASSERT() to disable interrupts and sit in a loop. */ | ||
+ | #define configASSERT(x) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } | ||
+ | </code> | ||
+ | |||
+ | [[http://www.freertos.org/a00110.html#configASSERT|For more information]]. | ||
+ | ===== Openocd rtos awareness ===== | ||
+ | |||
+ | Openocd is able to give you information about your system's tasks. For example, for the QuimDC we have added : | ||
+ | <code shell> | ||
+ | $_TARGETNAME configure -rtos auto | ||
+ | </code> | ||
+ | to "common/make/quimesis_stm32f10x.cfg". | ||
+ | |||
+ | |||
+ | |||
+ | You must also add [[https://github.com/arduino/OpenOCD/blob/master/contrib/rtos-helpers/FreeRTOS-openocd.c|OpenOCD/contrib/rtos-helpers/FreeRTOS-openocd.c]] to your project and this line : | ||
+ | <code shell> | ||
+ | LDFLAGS += -Wl,--undefined=uxTopUsedPriority | ||
+ | </code> | ||
+ | when using gcc as specified in "common/lib/freertos/FreeRTOS-openocd.c" | ||
+ | |||
+ | [[http://openocd.org/doc/html/GDB-and-OpenOCD.html|For more information]]. | ||
+ | ===== Hook Functions and Trace Hook Macros ===== | ||
+ | * [[http://www.freertos.org/a00016.html|Hook Functions Documentation]] | ||
+ | * [[http://www.freertos.org/rtos-trace-macros.html|Trace Hook Macros Documentation]] | ||
+ | |||
+ | |||
+ | ===== Remove compiler optimization ===== | ||
+ | |||
+ | To remove the compiler optimization step for debugging add **-O0** to all the compile commands. You can also add **virtual** to some variable to be able to see their value in the debugger. |