Skip to main content
Visitor II
March 12, 2025
Question

Stack overflow in freeartos and ethernet

  • March 12, 2025
  • 2 replies
  • 799 views

Hi
I am using the evaluation board stm32743
And testing the firmware that include freeartos and ethernet
If enabled the "check_for_stack_overflow" in cubeMx freeartos this will result
in vApplicationStackOverflowhook to inhabit.

checking sp register when the firmware start(at main) shows that sp = 0x2407ffe8.
Once the start and reaches to the first task and the only one the stack pointer sp reigster = 0x24005af0
and on the next step vApplicationStackOverflowhook inhabit.
for some reason the stack uses a lot of memory right from the start of the first task

 

    This topic has been closed for replies.

    2 replies

    Super User
    March 12, 2025

    Each task has its own stack - separate from the stack that is used for main().  If FreeRTOS is calling the stack overflow hook, then you need to increase the size of your stack for that task.  The CubeMX default task size is WAY too small for anything running Ethernet stacks.

    dorongAuthor
    Visitor II
    March 12, 2025

    HI BOb thank you for your replay
    I found the problem when I found that the semaphore handle, which is a part of freeartos
    was erased by the stack overflow, so it is not a problem of defining the stack size of each task
    it is a problem of freeartos

     

    Doron

    Super User
    March 13, 2025

    > so it is not a problem of defining the stack size of each task it is a problem of freeartos

    No - it is absolutely a problem of defining stack sizes for each task.  It is not FreeRTOS's fault that the stack overflowed and corrupted data.  It is your fault for not giving tasks a big enough stack space, or not verifying that the CubeMX provided stack size was big enough.

    dorongAuthor
    Visitor II
    March 16, 2025

    Hi
    what can cause stack pointer in firmware that include only freeartos
    when just starting the StartDefaultTask the stack pointer goes from 0x2407ff98 to 0x240010a0
    the default stack size for the StartDefaultTask is just 128 words