此篇博客用来记录如何在使用 FreeRTOS 打印系统当前的任务列表,任务状态优先级,使用率等信息。
1. vTaskList
使用 vTaskList() 能打印
- 任务名
- 任务状态
- 优先级
- 剩余栈
- 任务序号
首先需要在 menuconfig 里打开对应的宏(menuconfig -> Component config -> FreeRTOS -> FreeRTOS to collect run time stats -> Choose the clock source for run time stats
)。如下:
使用示例如下:
void app_main()
{
//xTaskCreate(test_task, "test_task", 4096, NULL, 6, NULL); 这里可以添加 test_task 任务测试
static char InfoBuffer[512] = {
0};
while (1) {
vTaskList((