Become a leader in the IoT community!

Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.

Step 1 of 5

CREATE YOUR PROFILE *Required

OR
Step 2 of 5

WHAT BRINGS YOU TO DEVHEADS? *Choose 1 or more

Connect & collaborate 🀝with other tech professionals
Learn & Grow πŸ“š
Contribute Experience & Expertise πŸ”§
Step 3 of 5

WHAT'S YOUR INTEREST OR EXPERTISE? *Choose 1 or more

Hardware Design πŸ’‘
Embedded Software πŸ’»
Edge Networking ⚑
Step 4 of 5

Personalize your profile

Step 5 of 5

Read & agree to our COMMUNITY RULES

  1. We want this server to be a welcoming space! Treat everyone with respect. Absolutely no harassment, witch hunting, sexism, racism, or hate speech will be tolerated.
  2. If you see something against the rules or something that makes you feel unsafe, let staff know by messaging @admin in the "support-tickets" tab in the Live DevChat menu.
  3. No age-restricted, obscene or NSFW content. This includes text, images, or links featuring nudity, sex, hard violence, or other graphically disturbing content.
  4. No spam. This includes DMing fellow members.
  5. You must be over the age of 18 years old to participate in our community.
  6. You agree to our Terms of Service (https://www.devheads.io/terms-of-service/) and Privacy Policy (https://www.devheads.io/privacy-policy)
By clicking "Finish", you have read and agreed to the our Terms of Service and Privacy Policy.

Calculating Stack Size for Tasks in FreeRTOS

Can anyone tell me how do you decide or calculate the stack size for the task(thread) when you do xTaskCreate() in freeRTOS.?

  1. sageboy0918#0000

    Having this issue!!

  2. sageboy0918#0000
  3. umeshlokhande#0000

    This requires understanding of exact memory resources of an mcu. Then depending on what intended task is doing and how much memory it requires to perform its operation you gauge some number and assign stack size. Later on it’s a good practice to use advance debugger to know real time requirement of stack size so you can add or remove unused allocated space.

  4. sageboy0918#0000

    And my program is working with stack size of 2024 but not with 1024 and in the tutorial his programing is working with 1024 stack size

  5. umeshlokhande#0000

    its possible perhaps in tutorial different microcontroller been used from the same vendor. I mean it depends

  6. sageboy0918#0000

    It is for esp32 c3 and i have esp32

  7. umeshlokhande#0000

    Hope you know here ur dealing with 2 different architecture. esp32-c3 is RISC V and generic esp32 uses xtensa LX. So this difference is obvious

  8. sageboy0918#0000

    Oh i haven’t notice this

  9. sageboy0918#0000

    But still i check esp32 have more ram and stack size than c3 still i have to give 2024 in my esp32

  10. sageboy0918#0000

    20250217_220730.jpg

  11. sageboy0918#0000

    and 1024 in c3

  12. umeshlokhande#0000

    this could be why RISC V-based mcu is preferred over xtensa. Maybe be it has to do with its internal memory structure.

  13. sageboy0918#0000

    Damm… do i have to study architect to understand this?

  14. umeshlokhande#0000

    depends but just knowing memory size and layout is mandatory

  15. undefined2001#0000

    the problem of esp is they use various architecture. arm, xtensa, risc-v

  16. undefined2001#0000

    but you can determine guess how much to give depending on how many variables, arrays you are using in your code also even if you are using data type like uint8_t there is a good chance thats taking 32bit in memory

  17. undefined2001#0000

    because cpu can access a word of memory in a cycle efficiently thats important to keep the performance

  18. sageboy0918#0000

    It was just a hello world task print value int 1 passed through the pointer

  19. sageboy0918#0000

    And now i can see the practical difference with the rics-v and xtensa πŸ™‚, rics architecture really have reduced instruction ig thats why they are taking less stack memory than xtensa

  20. undefined2001#0000

    that could be the case. dont have much idea on risc or xtensa

  21. sageboy0918#0000

    Me to, but i have seen some ricsv assembly instruction there are very big not like 8051 assembly instruction, but they are able to much thing in less instruction as compared to older assembly instruction.

  22. sageboy0918#0000

    Esp32 have efuse

  23. sageboy0918#0000

    Damm this is cool
    20250219_005519.jpg

CONTRIBUTE TO THIS THREAD

Browse other questions tagged 

Leaderboard

RANKED BY XP

All time
  • 1.
    Avatar
    @Nayel115
    1620 XP
  • 2.
    Avatar
    @UcGee
    650 XP
  • 3.
    Avatar
    @melta101
    600 XP
  • 4.
    Avatar
    @chitour
    600 XP
  • 5.
    Avatar
    @lifegochi
    250 XP
  • 6.
    Avatar
    @Youuce
    180 XP