How determine maximum CSTACK and HEAP which a microcontroller support ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-14 9: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.Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-15 6: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!
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-16 2: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.
