但是我发现累加到3662之后,CPU就会重启,然后重新累加,报错信息如下,这段程序我是按照FreeRTOS的官方手册写的,不知道有什么错误?
rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6972
ho 0 tail 12 room 4
load:0x40078000,len:14292
load:0x40080400,len:3688
0x40080400: _init at ??:?
entry 0x40080678
I (57) boot: ESP-IDF v4.3-dirty 2nd stage bootloader
I (58) boot: compile time 23:09:01
I (58) boot: chip revision: 1
I (61) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (68) boot.esp32: SPI Speed : 40MHz
I (73) boot.esp32: SPI Mode : DIO
I (78) boot.esp32: SPI Flash Size : 4MB
W (82) boot.esp32: PRO CPU has been reset by WDT.
W (87) boot.esp32: WDT reset info: PRO CPU PC=0x4008568e
0x4008568e: _xt_context_save at /Users/guosa/esp/esp-idf/components/freertos/port/xtensa/xtensa_context.S:149
W (93) boot.esp32: WDT reset info: APP CPU PC=0x4008520e
0x4008520e: panic_handler at /Users/guosa/esp/esp-idf/components/esp_system/port/panic_handler.c:146 (discriminator 1)
- void send_string(void *pvParameters){
- BaseType_t xStatus;
- int a = (int)pvParameters;
- // char output_buffer[2048] ="Hello World!";
- for(;;)
- {
- a += 1;
- xStatus = xQueueSendToBack(xQueue, &a, 0);
- if (xStatus != pdPASS)
- {
- printf("Cound not send to the queue.\n");
- }
- }
- }
- void print(void *pvParameters){
- int a;
- BaseType_t xStatus;
- const TickType_t xTicksToWait = pdMS_TO_TICKS(100);
- for(;;)
- {
- // if( uxQueueMessagesWaiting( xQueue ) != 0)
- // {
- // printf("The queue should have been empty!\n");
- // }
- xStatus = xQueueReceive( xQueue, &a, xTicksToWait);
- if ( xStatus == pdPASS)
- {
- printf("output is %d\n", a);
- }
- else
- {
- printf("Could not reveive from the queue.\n");
- }
- }
- }
- void app_main(void)
- {
- xQueue = xQueueCreate(5,sizeof(int));
- // http_connect();
- if (xQueue!=NULL)
- {
- xTaskCreate(send_string, "send_string", 10000, (void*)1, 5, NULL);
- xTaskCreate(print, "print", 10000, NULL, 6, NULL);
- vTaskStartScheduler();
- }
- }