cancel
Showing results for 
Search instead for 
Did you mean: 

CubeIDE Linker Query

SSmit.13
Senior

Hi,

I am planning to use the STM32L433VC processor in low power. I am planning to use SRAM2 for some data as this is preserved in low power mode. I have installed the latest STM32 CubeIDE on my laptop, and looking at the linker file it has the below when cerating a new project. As the RAM of the processor is 64k , and the data sheet mentions the RAM2 16k is part of the 64 k. But looking at the below it says the RAM is 96K.

Latest STM32 CubeIDE:

MEMORY

{

 RAM   (xrw)   : ORIGIN = 0x20000000,  LENGTH = 64K

 RAM2   (xrw)   : ORIGIN = 0x10000000,  LENGTH = 16K

 FLASH   (rx)   : ORIGIN = 0x8000000,  LENGTH = 256K

}

And pointed my data to SRAM2 as below.

typedef struct{

   long date;

   long time;

   short int hum;

   short int temp;

}Results;

char Buff[sizeof(Resukt2)*500] __attribute__((section(".readings_buffer")));

SECTIONS

{

 .readings_buffer :

 {

   KEEP(*(.readings_buffer))

 } >RAM2

My atollic STM32 CubeIDE I have been using in years just created the new project for the same processor:

MEMORY

{

RAM (xrw)     : ORIGIN = 0x20000000, LENGTH = 64K

FLASH (rx)     : ORIGIN = 0x8000000, LENGTH = 256K

}

Which indicates 64k ram, can someone please explain what is happening to the 96k above

Shouldnt the link file be:

MEMORY

{

 RAM   (xrw)   : ORIGIN = 0x20000000,  LENGTH = 48K <<< as RAM2 is part of the 64k

 RAM2   (xrw)   : ORIGIN = 0x10000000,  LENGTH = 16K

 FLASH   (rx)   : ORIGIN = 0x8000000,  LENGTH = 256K

}

Best Regards

Scott

1 REPLY 1
christop
ST Employee

STM32L433 has 64kB SRAM composed of SRAM1 (48KB) and SRAM2 (16kB).

As described in datasheet section 3.5:

• 48 Kbyte mapped at address 0x2000 0000 (SRAM1)

• 16 Kbyte located at address 0x1000 0000 with hardware parity check (SRAM2).

This memory is also mapped at address 0x2000 C000, offering a contiguous address space with the SRAM1 (16 Kbyte aliased by bit band)

This block is accessed through the ICode/DCode buses for maximum performance.

These 16 Kbyte SRAM can also be retained in Standby mode.

So you have 2 ways to configure the linker file for RAM space:

Option #1: RAM2 is used for code execution

MEMORY
{
  RAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 48K
  RAM2    (xrw)    : ORIGIN = 0x10000000,   LENGTH = 16K
  FLASH    (rx)    : ORIGIN = 0x8000000,   LENGTH = 256K
}

Option #2: RAM2 is used for data storage and application take benefit of the full RAM

MEMORY
{
  RAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 64K
  FLASH    (rx)    : ORIGIN = 0x8000000,   LENGTH = 256K
}

As your intent is to use SRAM2 for data storage, then I suggest you use option #2.