Skip to main content
Gabriel T
Senior
January 12, 2021
Solved

Can't use different RAM Section

  • January 12, 2021
  • 3 replies
  • 1390 views

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

This topic has been closed for replies.
Best answer by Gabriel T

Solved,

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

3 replies

PMath.4
Senior III
January 12, 2021

Try

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

Gabriel T
Gabriel TAuthor
Senior
January 13, 2021

Hi,

It is still not working with this change

Gabriel T
Gabriel TAuthorBest answer
Senior
January 13, 2021

Solved,

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