cancel
Showing results for 
Search instead for 
Did you mean: 

Can't use different RAM Section

Gabriel T
Senior

Hello,

I'm working with STM32H7 and STM32 Cube IDE,

I add this in linker script :

/* Memories definition */
MEMORY
{
  DTCMRAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 128K
  ITCMRAM    (xrw)    : ORIGIN = 0x00000000,   LENGTH = 64K
  RAM_D1    (xrw)    : ORIGIN = 0x24000000,   LENGTH = 512K
  RAM_D2    (xrw)    : ORIGIN = 0x30000000,   LENGTH = 288K
  RAM_D3    (xrw)    : ORIGIN = 0x38000000,   LENGTH = 64K
  FLASH    (rx)    : ORIGIN = 0x8000000,   LENGTH = 1024K
}
 
/* Sections */
SECTIONS
{
  .ramd2block :
  {
    . = ALIGN(4);
    _sramd2block = .;       /* create a global symbol at ccmram start */
    *(.ramd2block)
    *(.ramd2block*)
    
    . = ALIGN(4);
    _eramd2block = .;       /* create a global symbol at ccmram end */
  } > RAM_D2
  
  .ramd3block (NOLOAD) :
  {
    KEEP(*(.ramd3section))
  } > RAM_D3

But it keeps locating this buffer in DTCM RAM :

uint8_t  SPI1_TxBuffer[READBACK_LENGTH] __attribute__(( section(".ramd2block") )); // SPI Tx

When I look in .map :

.ramd2block     0x00000000200001f8       0x1b load address 0x000000000800e2f4
 .ramd2block    0x00000000200001f8       0x1b Core/Src/main.o
                0x00000000200001f8                SPI1_TxBuffer
                0x0000000020000214                . = ALIGN (0x4)

0x2000000 is in DTCM RAM

Any idea why isn't the linker locating my buffer in RAM_D2

1 ACCEPTED SOLUTION

Accepted Solutions
Gabriel T
Senior

Solved,

The file where to put custom RAM section is "STM32H743ZITX_FLASH.ld" and not "STM32H743ZITX_RAM.ld"

View solution in original post

3 REPLIES 3
PMath.4
Senior III

Try

    uint8_t   __attribute__(( section(".ramd2block"))) SPI1_TxBuffer[READBACK_LENGTH]; // SPI Tx

Gabriel T
Senior

Hi,

It is still not working with this change

Gabriel T
Senior

Solved,

The file where to put custom RAM section is "STM32H743ZITX_FLASH.ld" and not "STM32H743ZITX_RAM.ld"