Im working on STM32l412kb uc (40 kb RAM Size) .My code uses 32kb of data still we have 8KB RAM.But there is one issue with our results i.e stack size overflow we dont get desired output that is only due to stack size overflow.We also optimise(by optimise variable ,structure etc) our code but still stuck on same issue.
Please suggest How do I optimise this issue? ,is there any settings to utilize full memory?
I played around with the stack and heap, on the L432 this week
using USB device, it was using 0x800 on the stack and 0xA00 on the heap and just worked but flaky.
set it back to 0x1000 for both and everything is fine.
that's your 8K.
The L432 has 64K ram, that could be an upgrade path if you need it.
The linker file and startup script dictate where data and the stack are stored. Typically it is configured to use the largest continuous RAM available for both, with the stack located at the end.
Since SRAM1 and SRAM2 are not contiguous on this chip, you'll need to manually place items into each of them. Or one option would be to locate the stack in SRAM2 while keeping other data in SRAM1 by changing the _estack variable in the linker script.
Actually, looks like it can be contiguous, in which can you just need to edit your linker script to include both regions.
• 32 Kbyte mapped at address 0x2000 0000 (SRAM1)
• 8 Kbyte located at address 0x1000 0000 with hardware parity check (SRAM2).
This memory is also mapped at address 0x2000 8000, offering a contiguous address
space with the SRAM1 (8 Kbyte aliased by bit band)
This block is accessed through the ICode/DCode buses for