How can we decide how much size stack/heap/ and command line argument will take for a project?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-04-03 5:11 AM
I am using #[STM32 MCUs]​ #Cortex-m0​ and IDE i am using is #Iar-embedded-workbench​
I want to know, How can I decide how much size #Stack​ / #Heap​ / and #Command-line​ argument will take for my project ?
In *.icf file what size, we supposed to keep?
- Labels:
-
IAR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-04-03 5:24 AM
I guess it starts by understanding how much you use malloc/free, and the depth of your call trees and the sizes of the local/auto variables in those subroutines.
​
With the stack you can fill it with a pattern and check the maximal depth​ after heavily loading the application.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-04-03 6:00 AM
IAR has a stack usage analisys tool : https://www.iar.com/support/resources/articles/stack-usage-analysis-for-rx/
You can use it to determine the size of the stack needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-04-03 7:09 AM
Thanks for the response.
In IAR workbench map file will have STACK USAGE
Call Graph Root Category Max Use Total Use
------------------------ ------- ---------
Program entry 228 228
Uncalled function 220 1 136
For all uncalled function , they have mentioned some bytes. Are those the total bytes stored on stack.
Can we say those bytes are the size of used stack ?
I tried filling the stack with pattern in startup, before calling the main. In one run some section of the stack got written, But at that time there were few functions, which doesn't get called. Those function will get called in specific scenario only .
How we can conclude the size in that case?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-04-03 7:15 AM
sum of the byte mentioned at maximum call chain are the total byte updated on stack. ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-04-03 7:17 AM
Thanks for the response.
In IAR workbench map file will have STACK USAGE
Call Graph Root Category Max Use Total Use
------------------------ ------- ---------
Program entry 228 228
Uncalled function 220 1 136
For all uncalled function , they have mentioned some bytes. Are those the total bytes stored on stack.
Can we say those bytes are the size of used stack ?
I tried filling the stack with pattern in startup, before calling the main. In one run some section of the stack got written, But at that time there were few functions, which doesn't get called. Those function will get called in specific scenario only .
How we can conclude the size in that case?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-04-03 8:25 AM
Check the toolchain manual on how the output map file information is being computed. Does it include the ISR? It might not know the ISR priorities and depth between them (interrupt being interrupted).
If you used function pointers, check more deeply. Things could also be different if there are some RAM loaded code or fancy implementation.
