Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 1 month ago.
STM32L4 Stack and Heap overlap (Disco)
For the new STM32L4 I found out a major problem, the first 4k of the heap overlap with the stack!
A few lines diag program can be found here: https://developer.mbed.org/users/Helmut64/code/StackHeapCodeDataInfo/file/29ed9d142ea8/main.cpp
main=0x080039b5 data=0x20000188 stack=0x20000b80 heap=0x20000418-0x20001418 (first 4k via new char[4096] overlaps with the stack)
The STM32L4 MCU has two memory areas:
SRAM2 (32k) @0x10000000 (with max. performance, hardware parity check, retained in standby mode)
SRAM1 (96k) @0x20000000 (the size may decrease/increases with newer L4 MCU modules)
I recommend to use the SRAM2 for the stack and as well for the heap and the heap should continue using SRAM1.
I figured out existing problem on the STM32L4 Disco board, the same problem may exists on the STM32L4 Nucleo board.
Thank you for looking into it.
1 Answer
9 years, 1 month ago.
Thanks for reporting. This might be better track on github as an issue as the development is happening there. We can assign/label presons who gets notifications for example.
Hi Martin, I cloned mbedmicro/mbed.git, however where can I file bugs? Is there a Bugzilla or other tracking system? Thank you, regards Helmut
posted by 22 Sep 2015Hi Martin, I believe I found the problem in startup_stm32l476xx.s (Disco & Nucleo)
The following line must be inserted/changed: (TOOLCHAIN_ARM_STD + TOOLCHAIN_ARM_MIKRO) initial_sp EQU 0x20018000 ; Top of RAM1 96k
This would at least enable the 96k of RAM1, however there is another 32k SRAM2 at 0x10000000-0x10008000
An initial fix would be appreciated.
Regards Helmut
posted by 23 Sep 2015