====== Debug Freertos ======
===== vTaskList =====
To display the list of tasks states :
//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
[[http://www.freertos.org/a00021.html#vTaskList|For more information]].
===== configASSERT =====
Enable you to check your config with a debugger.
/* Define configASSERT() to disable interrupts and sit in a loop. */
#define configASSERT(x) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
[[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 :
$_TARGETNAME configure -rtos auto
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 :
LDFLAGS += -Wl,--undefined=uxTopUsedPriority
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.