2018-02-14 09:41 PM
The microcontroller we are working on is STM32F303CC. Lets say you have large project with multiple threads and peripherals attached to the system ? How can we determine the maximum CSTACK and HEAP value for microcontroller , So we can achieve system stability and avoid run time crashes and system instability.
PS: I am new Embedded world, I am Sorry if this question has been asked before. Love the ST ecosystem. CubeMX makes life easier for beginners. #stack-overflow #cstack #address #heap #out-of-rangeSolved! Go to Solution.
2018-02-14 10:52 PM
Some toolchains do a static analysis to guess the stack usage, but are far from perfect.
So it finally amounts to Trial-And-Error, and experience.
Heap is required if you use malloc() and the like, i.e. allocate memory dynamically.
A great number of MCU projects has a heap size of zero.
Both values can be safely be oversized, only you waste RAM then.
Lets say you have large project with multiple threads...
Threads imply an OS (probably RTOS), which usually assign a separate stack to each task.
These stacks are separate from the core stack.
2018-02-14 10:52 PM
Some toolchains do a static analysis to guess the stack usage, but are far from perfect.
So it finally amounts to Trial-And-Error, and experience.
Heap is required if you use malloc() and the like, i.e. allocate memory dynamically.
A great number of MCU projects has a heap size of zero.
Both values can be safely be oversized, only you waste RAM then.
Lets say you have large project with multiple threads...
Threads imply an OS (probably RTOS), which usually assign a separate stack to each task.
These stacks are separate from the core stack.
2018-02-15 06:56 AM
How can we determine the maximum CSTACK and HEAP value for microcontroller
Easy: they must be less that the total availa RAM of that microcontroller!
Seriously, this has nothing specifically to do with the microcontroller - it's about managing your software.
As in any software development, you define your software's resource usage!
2018-02-16 02:10 AM
I knew I would be roasted for asking newbie/noobie/Inexperience question.
He who asks a
questionis a
foolfor five minutes; he who does not
aska
question remainsa
foolforever.