While looking for ways to reduce memory usage on the STM32F4 chip, I discovered that MicroPython was only accessing 128K of the total 192K. Which at first confused me until I dug deeply and read in the chip specification about the 64K of CCM memory.
After some testing based on the ideas from reading this post , I changed the memory mapping to have the stack contained in the CCM portion of memory instead. This appears to work without issue.
My question is, should this be changed to be the default on this chipset, as it saves 16K of RAM, or is there a specific reason why this is a bad idea that I'm not aware of?
STM32F405 Default Memory Mapping
Re: STM32F405 Default Memory Mapping
The 64K of CCM memory is used when micropython needs to read/write from the flash file system.
Your stack will be ok until micropython needs to use all 64K (which will happen when it needs to update a 64K flash block) and then your program will die in a somewhat unpredictable manner.
This is where the symbols are created:
https://github.com/micropython/micropyt ... ld#L32-L33
And this is the code that uses them:
https://github.com/micropython/micropyt ... .c#L44-L50
Your stack will be ok until micropython needs to use all 64K (which will happen when it needs to update a 64K flash block) and then your program will die in a somewhat unpredictable manner.
This is where the symbols are created:
https://github.com/micropython/micropyt ... ld#L32-L33
And this is the code that uses them:
https://github.com/micropython/micropyt ... .c#L44-L50