Electronics > Microcontrollers

32F4 CCM memory - gotchas?

<< < (4/4)

technix:

--- Quote from: peter-h on May 14, 2021, 07:54:18 am ---There is a dramatic performance improvement too. Since I am not currently using ethernet (which has its own DMA controller and uses static buffers in BSS) this is probably due to the CPU doing stuff like cache filling without affecting data operations. On one metric there is a 5x speedup.

--- End quote ---
This is very expected, as by moving stacks and some of the heap into CCM, you killed a lot of CPU-DMA bus contention.


--- Quote from: peter-h on May 14, 2021, 07:54:18 am ---It does look like FreeRTOS doesn't like its own stack memory (which is now allocated out of a 48k static buffer sitting in CCM) to be in a different section (lower address) than the general stack (which is also now in CCM). I was seeing the MSP at 0x1... and the PSP at 0x2... and it didn't like that.

--- End quote ---
You may want to file this as a bug.

peter-h:
Even with no DMA, the speedup could presumably be due to cache refilling not blocking access to the CCM for stack accesses.

The price paid for this is that the CCM is not executable :)

Re my above comment about the RTOS, it actually seems to work now. The issue was with _sbrk which assumed heap and stack are adjacent, and did a trap if the two met.

There are so many pitfalls with using CCM because all the tools make the above assumption. The linker script likewise.

technix:

--- Quote from: peter-h on May 14, 2021, 01:36:18 pm ---Even with no DMA, the speedup could presumably be due to cache refilling not blocking access to the CCM for stack accesses.

--- End quote ---
I don't think so, as the cache-equipped Flash interfaces and the SRAM blocks are different downstream ports on the bus matrix.


--- Quote from: peter-h on May 14, 2021, 01:36:18 pm ---The price paid for this is that the CCM is not executable :)

--- End quote ---
Not on those older STM32F4 parts, but for newer parts like STM32F3, G4 and F7 the CCM is executable.


--- Quote from: peter-h on May 14, 2021, 01:36:18 pm ---There are so many pitfalls with using CCM because all the tools make the above assumption. The linker script likewise.

--- End quote ---
It is why I have multiple implementations for _sbrk for my projects to fit the needs of this.

Navigation

[0] Message Index

[*] Previous page

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