2019-12-03 10:02 PM
Hello I want to understand allocating stack and heap size, I am using stm32f767zi with 512Kbyte RAM memory (0x80000 bytes) so what I understand is this memory should be split between only the stack and heap (if there is something else please tell me) so I gave the stack 0x60000 and the heap 0x20000 as in the attached photo. I am using IAR v8.
2019-12-03 10:28 PM
No.
You need RAM also for global and static variables.
Stack is where the return addresses and register content and some other "helper" data are stored when calling subroutines, together with variables declared locally in functions (without static specifier).
Heap is where dynamically allocated (usually through calling malloc()) variables are stored.
JW
2019-12-03 11:03 PM
> Heap is where dynamically allocated (usually through calling malloc()) variables are stored.
Actually, most toolchains set a default value of zero for the heap size. Many embedded projects do not use dynamic memory allocation at all.
2019-12-04 01:34 AM
So the RAM for only (global/static) (stack) (heap) is there something else?
2019-12-04 03:18 AM
You can read up about C language memory/section management (variable placement) in general C tutorials.
And virtually all toolchains can create a map file during the linker run, an exhausting list of object (variable, code) sizes and placement.