Loading...
 
Skip to main content

System Workbench for STM32


STM32F407VET6 "RAM overflow" while using only 2/3 of it (afaik)

I need to declare ~153 KB buffer as a framebuffer for display (more precisely at least two buffers, as one must be in CCMRAM to have enough space) and as this MCU has 192 KB RAM in total, it clearly should be possible. But as soon as I declare buffer in CCMRAM (framebuffer2) to be of size 65536 and buffer in normal RAM more than 63798 (framebuffer1), linker gives me "RAM overflowed by ..." error.

I'm pretty new to this, so I don't know exactly why is this happening, whether it is wrong linker definition, or some debug features taking up space, or something else. I'm working with CubeMX generated HAL project.

output.map and linker definition:
https://drive.google.com/open?id=0BynchtWoOt7aZzhXOFlDVURjMUE

After investigating output.map I found, that the problem was simple typo. I had buffer declared as

Copy to clipboard
uint8_t buffer2[64000] __attribute__((section("ccmram")));


which I blindly copied from some example on this site and was probably for some different version of HAL. As the correct identifier of core coupled memory in my HAL is .ccmram, not ccmram, linker was putting the buffer into normal RAM, therefore "RAM overflow". Correct definition is:

Copy to clipboard
uint8_t buffer2[64000] __attribute__((section(".ccmram")));


with which buffer is placed into correct memory:

Copy to clipboard
*(.ccmram) .ccmram 0x0000000010000000 0xfa00 Src/main.o 0x0000000010000000 buffer2 *(.ccmram*)


Sorry for mistake.