New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32 Define start of stack separately from heap end. #4789
Conversation
@dpgeorge This format clearly shows the stack and heap size and highlights some anomalies. For example some parts with 256k RAM have 16k stack and other have 32k. H7 with 512k RAM has 16k stack. |
i would like to clean up the MEMORY section of the linker scripts to be more consistent and make it more obvious what the RAM block sizes are and what they are used for. The reason is to make it easier to configure custom ports that need variations of the linker script, eg to use small cache for external FS, move stack to CCRAM, etc. It won't change any memory allocations. Should that be another commit, or a separate PR? |
A given board can easily use its own linker script to declare the MEMORY section, it doesn't need to use any of the shared provided ones. See #4043 for a related discussion.
Let's do it a step at a time, so please make it a separate PR. |
Note that the STM32F769DISC board doesn't build with this patch. |
boards/*.ld Add _sstack symbol. Define stack and heap in a clearer way. gccollect.h, main.c, pybthread.c, stm32_it.c Use _sstackk instead of _heap_end modmachine.c machine.info() print _sstack.
All ports compile error free. |
Please hold off merging this yet. I have an improved layout in the STM32L452 port: `MEMORY /* produce a link error if there is not this amount of RAM for these sections */ /* Define the top end of the stack. The stack is full descending so begins just /* RAM extents for the garbage collector */ _ram_fs_cache_end = _ram_end; _estack = _ram_fs_cache_start; _heap_end = _sstack; /* heap = 142K, tunable by adjusting stack size / _flash_fs_start = ORIGIN(FLASH_FS); There are are two changes that improve clarity:
Would you like me to remove the minimum heap and stack size checks. These don't work when the heap or stack are moved into other memory regions (CCRAM, DRAM, etc)? |
I'll have to have a good look at it first. I don't want to make too many changes at once. |
This PR was merged in 14cf91f |
boards/*.ld Add _sstack symbol. Define stack and heap in a clearer way.
gccollect.h, main.c, pybthread.c, stm32_it.c Use _sstackk instead of _heap_end
modmachine.c machine.info() print _sstack.