2024-11-14 03:44 AM - edited 2024-11-14 03:48 AM
Hi,
My uC (STM32F30K6T6) is full in RAM memory.
To optimize the RAM size, I have planned to reduce the Heap Size Memory (initial Heap size is 0x400).
I do not use any manual memory allocation so, I think I will set it to a quarter of it (0x100), just in case.
It leads me two interrogrations about heap and stack :
2024-11-14 04:28 AM
You're using the IAR version of runtime library, so better ask IAR support (maybe they have a KB article on this).
2024-11-15 03:41 AM
Pavel A., Thank for your reply but maybe you could try a litle bit to help me since I am using STM32 and I have seen other posts in which users got some replies even if they used IAR.
To help those who will be interested in, the linker compiler file (.icf) places the heap and stack in an arbitrary order. This can be fixed using
define block FIXED_ORDER_RAM with fixed order { block CSTACK, block HEAP};
place in RAM_region { readwrite, last block FIXED_ORDER_RAM };
instead of the initial
place in RAM_region { readwrite, block CSTACK, block HEAP };
Nevertheless, I still do not see any 1K range of Heap memory at the end of my RAM memory ranged (I can see it from the debugger and the stack usage tool which place a pattern before running).
And this obversation is coherent with the fact that when I reduce the heap size, my issue is not fixed (my RAM is still considered as full)
Is there any way that, despite the size is specified, that the compiler/linker (for some reason) do not implement heap at all ?
Thank you in advance,
2024-11-15 03:49 AM
@JGreg.2 Unfortunately my IAR license timed out after end of project, so I cannot any longer ask IAR support. Stack Overflow is another place where IAR questions can be answered.
2024-11-15 05:32 AM
Yes, I also did that few hours ago.
I have read "Actually, most toolchains set a default value of zero for the heap size. Many embedded projects do not use dynamic memory allocation at all." see ST post at this link
Do you think it means that, even if the size is defined, the toolchain could not add the heat memory at all ?
2024-11-15 06:12 AM
Allright, answer is yes (if no function related to dynamic allocation has been detected into the code). See post here