Stack overflow in freeartos and ethernet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-12 9:59 AM
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
- Labels:
-
FreeRTOS
-
LwIP
-
STM32H7 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-12 11:29 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-12 12:37 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-12 7:43 PM
> 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-16 8:46 AM - edited ‎2025-03-16 8:55 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-17 10:24 AM
> what can cause stack pointer in firmware that include only freeartos
Every task switch causes jumps of task stack pointer (PSP). LwIP creates its own tasks so you always have several of them. The default task stack size is too small, you need to increase it or specify larger sizes per task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-18 5:01 AM
Thank for your replay
I have tested this on a new firmware which does not include any other task
Other then the freeartos ONLY
