Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FreeRTOS task how to use the stack? #9414

JC-jack-h started this conversation in Question - Community Help
Discussion options

Board

ESP32-S3-WROOM-1U

Device Description

I create a task in my app,the task just have a single loop,but when I check it's space used,it used 576 Byte stack ? I want to konw more detils about the situation for optmize source used. The idf version: V4.4.1
QQ截图20240322164155

Hardware Configuration

when I set the same situation in helloworld example,also used may by 618 Byte.

Version

other

IDE Name

esp-idf V4.4.1

Operating System

Window 10

Flash frequency

80MHz

PSRAM enabled

yes

Upload speed

115200

Description

I want to use resources more economically, because it is possible to run a stack task with a size of only 128 bytes on STM32, why does ESP32 use hundreds of bytes?

Sketch

void chint_key_task(void* args)
{
 while(1)
 {
 vTaskDelay(2000);
 }
}
TaskHandle_t chint_key_task_Handler;
xTaskCreate(chint_key_task, "cnt_key_task", 1024 * 2, NULL, 5, &chint_key_task_Handler);
ESP_LOGW("tag","useed = %d\n", 1024 * 2 - uxTaskGetStackHighWaterMark(chint_key_task_Handler));

Debug Message

"tag","useed = 576

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
You must be logged in to vote

Replies: 4 comments 1 reply

Comment options

Such questions will best be explained by our experts in the ESP-IDF repo.

You have access to plenty or RAM, so that 2/4K stacks are not an issue. You could run a small stack, just make sure you are not printing inside or do other things that would use the stack.

You must be logged in to vote
0 replies
Comment options

Note that this is architecture dependent. This code only uses 232 bytes on a -C3, and over 728 on an -S3. Are you testing this on a dual-core STM32?

You must be logged in to vote
0 replies
Comment options

Hello, I would like to know if there is any clear information or documentation that can explain the difference between the resource consumption of ESP32 dual-core architecture and single-core when running RTOS, or the details of dual-core architecture? Because from the experience of single-core development, it is estimated that the resources of an empty task are too large.In fact, I found that the Bluetooth and Wi-Fi resources consumed in the program are more than 100K, but I don't know enough about these 2 parts and how to optimize the resources, even if the menuconfig chooses to prioritize the allocation of WiFi Bluetooth resources to the PSRAM, but it doesn't work. So I focused on other seemingly simple tasks.

You must be logged in to vote
1 reply
Comment options

I found that the Bluetooth and Wi-Fi resources consumed in the program are more than 100K, but I don't know enough about these 2 parts and how to optimize the resources, even if the menuconfig chooses to prioritize the allocation of WiFi Bluetooth resources to the PSRAM, but it doesn't work.

The 100K is HEAP, not Stack.

I would like to know if there is any clear information or documentation that can explain the difference between the resource consumption of ESP32 dual-core architecture and single-core when running RTOS, or the details of dual-core architecture?

https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32/api-reference/system/freertos.html
https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32/api-guides/performance/ram-usage.html
https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32/api-guides/freertos-smp.html

Comment options

This forum is for fixing issues with the code contained in the the repo. For general discussion and questions, please use https://esp32.com

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Question Only question
Converted from issue

This discussion was converted from issue #9402 on March 24, 2024 21:39.

AltStyle によって変換されたページ (->オリジナル) /