Electronics > Microcontrollers

32F4 CCM memory - gotchas?

(1/4) > >>

peter-h:
My current memory map is

FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 1024K
RAM (xrw)       : ORIGIN = 0x20000000, LENGTH = 128K
CCM MEMORY (xrw): ORIGIN = 0x10000000, LENGTH - 64k - not used

The CCM memory cannot be accessed by DMA, so you can have DMA transfers running at full speed while the CPU continues to execute code. So it would seem to be a good place to put the stack (which currently is at the top of RAM). Until someone does a DMA transfer to a buffer allocated inside a function, etc.

What are the other gotchas with using the CCM block?

technix:
CCM on STM32F4 is not executable. So the best use for it would be the stack. This would allow different memory uses go different places: stack and non-DMA heap in CCM, DMA heaps in the SRAM blocks.

peter-h:
Interesting. So...

CCM MEMORY (rw)

One could also put things like serial port comms buffers in there.

It is probably most handy for stuff which doesn't need initialising, because to do that you have to add some asm code to the startup .s file. I found this which describes it
https://www.openstm32.org/Using%2BCCM%2BMemory

Are there any other gotchas with CCM? Is there anything else that needs RAM access, other than the CPU and DMA?

One concern is that the STM ethernet code uses DMA (apparently uses its own dedicated DMA controller) and if it does DMA to a buffer which is on the stack, that will break. And that library is vast.

harerod:
The most annoying feature is that the CCM and SRAM are not contiguous. The other drawbacks are listed in the manual. What to do with the CCM? Obvious choice is stack and certain data that is handled by the CPU.
In a current project I run freeRTOS with static RAM memory allocation. This goes into the 128kB SRAM segment. The CCM is used for our dynamic file system. Thinking about it, that 407 firmware has one of of the weirdest memory layouts:
128kB FLASH protected memory "Bootloader"
256kB FLASH Application
640kB FLASH Filesystem / low write/erase rate
128kB SRAM HEAP/Task memory
 64kB CCM dynamic Filesystem

thm_w:
https://www.eevblog.com/forum/microcontrollers/stm32f4xx-and-core-coupled-memory-comments/

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version