2019-04-03 05: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?
2019-04-03 05: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.
2019-04-03 06: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.
2019-04-03 07: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?
2019-04-03 07:15 AM
sum of the byte mentioned at maximum call chain are the total byte updated on stack. ?
2019-04-03 07: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?
2019-04-03 08: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.