idf:4.5.
使用freertos历程配置
会重启,报错
0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
代码如下
Code: Select all
/* FreeRTOS Example
*/
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "freertos/event_groups.h"
#include "freertos/queue.h"
#include "esp_task_wdt.h"
#include "esp_err.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void test_task(void *pvParam)
{
int num = 0;
while (1)
{
num++;
num *= 1;
if (num > 1000000 && ((num / 10) % 2) == 1)
{
ESP_LOGI("test_task FUN", "doing : %d", num++);
num = 0;
}
}
}
void Main_Init(void);
void Build_task(void);
void app_main(void)
{
Main_Init();
Build_task();
char *temp_array;
temp_array = malloc(300);
while (1)
{
vTaskList(temp_array);
printf("-------------------------------------------------->\n");
printf(" Name state Priority task num\n");
printf("%s \n",temp_array);
vTaskDelay(pdMS_TO_TICKS(3000));
}
}
TaskHandle_t test_taskhanlde;
void Build_task(void)
{
test_taskhanlde = NULL;
xTaskCreate(test_task, "test task", 4096, NULL, 1, &test_taskhanlde);
}
void Main_Init(void)
{
// Allow other core to finish initialization
vTaskDelay(pdMS_TO_TICKS(100));
}
Code: Select all
I (5060) test_task FUN: doing : 1000010
E (10492) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (10492) task_wdt: - IDLE (CPU 1)
E (10492) task_wdt: Tasks currently running:
E (10492) task_wdt: CPU 0: IDLE
E (10492) task_wdt: CPU 1: test task
E (10492) task_wdt: Aborting.