As part of the port to the STM32G4, I'm in stm32_allocateheap.c and
trying to understand the correct definitions for this chip. As a
starting point, I am following the patterns elsewhere in this file.

In terms of RAM, the STM32G47xx has:

    * 96KiB of internal RAM in 2 banks
    * 32 KiB of CCM SRAM (Routine Booster)
    * Possibility of external RAM via FSMC

All internal RAM is contiguous from 0x2000:0000 thru 0x2001:FFFF
(inclusive) but is implemented as separate regions:

    SRAM:
    * 80 KiB SRAM1 mapped at 0x2000:0000 thru 0x2001:3FFF.
    * 16 KiB SRAM2 mapped at 0x2001:4000 thru 0x2001:7FFF.

    CCM SRAM:
    * 32 KiB CCM SRAM     at 0x1000:0000 thru 0x1000:7FFF
      but also aliased    at 0x2001:8000 thru 0x2001:FFFF
      to be contiguous with SRAM1 and SRAM2.

The other MCUs in this file that have CCM SRAM have this to say about
it:

   "As a complication, CCM SRAM cannot be used for DMA.  So, if STM32
    DMA is enabled, CCM SRAM should probably be excluded from the heap
    or the application must take extra care to ensure that DMA buffers
    are not allocated in CCM SRAM."

However, I believe that in the STM32G47xx, CCM SRAM *is* accessible to
DMA, based on the following text from the Reference Manual, RM0440
revision 2, section 2.1.3, DMA-Bus:

   "This bus connects the AHB master interface of the DMA to the
    BusMatrix. The targets of this bus are the SRAM1, SRAM2 and CCM
    SRAM..."

Then, should we exclude CCM SRAM from the heap like the other chips
do?

Furthermore, since all of this memory is contiguous, how should
CONFIG_MM_REGIONS be setup? Is this considered one region or two?

Thanks,
Nathan

Reply via email to