This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hi everyone,
I started to use the FreeRTOS on a ESP-WROOM-32 dev board.
I started with a simple code to avoid to debug other thing.
the code is :
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "driver/gpio.h"
#include "rom/gpio.h"
#include "nvs_flash.h"
#define BLINK_GPIO 23
void hello_task(void *pvParameter)
{
while(1)
{
printf("Hello world!\n");
vTaskDelay(100 / portTICK_PERIOD_MS);
}
}
void blinky(void *pvParameter)
{
gpio_pad_select_gpio(BLINK_GPIO);
/* Set the GPIO as a push/pull output */
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
while(1) {
/* Blink off (output low) */
gpio_set_level(BLINK_GPIO, 0);
vTaskDelay(1000 / portTICK_PERIOD_MS);
/* Blink on (output high) */
gpio_set_level(BLINK_GPIO, 1);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
void app_main()
{
xTaskCreate(&hello_task, "hello_task", 2048, NULL, 5, NULL);
xTaskCreate(&blinky, "blinky", 1024 ,NULL,5,NULL ); // no stack issue
//xTaskCreate(&blinky, "blinky", 512 ,NULL,5,NULL ); // stack issue
}
So, with the 512 bytes stack, I have this issue:
I (308) cpu\_start: Starting scheduler on PRO CPU.
I (0) cpu\_start: Starting scheduler on APP CPU.
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
\*\*\*ERROR\*\*\* A stack overflow in task blinky has been detected.
Backtrace: 0x40081af6:0x3ffb6fe0 0x400856f5:0x3ffb7000 0x4008832a:0x3ffb7020 0x40087213:0x3ffb70a0 0x400857f0:0x3ffb70c0 0x400857a2:0x3ff000dc |<-CORRUPTED
0x40081af6: panic\_abort at /home/dev/esp/esp-idf/components/esp\_system/panic.c:412
0x400856f5: esp\_system\_abort at /home/dev/esp/esp-df/components/esp\_system/esp\_system.c:135
And the system restart. with this message, it look like the stack grow continuously but I don't understand why. technically, the blinky function should be always the same size.
someone had an idea?
Thanks :)
Post Details
- Posted
- 7 months ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/esp32/comme...