2025-05-07 7:19 AM
I am working with a dual core STM32H755 and attempting to create a shared memory location for the two cores to access. I am attempting to do this by modifying the linker script. I have added the following lines to the M7 core linker script, in the SECTIONS block:
/* Shared Memory section for inter core comms */
.sharedRAMsection 0x30040000 :
{
.= ALIGN(4);
KEEP(*(.sharedRAMsection))
. = ALIGN(4);
} > RAM_D2
Then in one of my .c files, I have declared the following global variable:
RegisterMap_t __attribute__((section(".sharedRAMsection"))) g_RegisterMap;
However, when I debug I can see the address of this variable has been assigned to memory location 0x24000064, as seen in the watch window:
I am using visual studio and visual GDB, and I am debugging with 2 separate VS instances for the two cores.
Is there something else that I need to do in order to get this variable into the correct memory location?
Thanks
2025-05-07 7:38 AM
How is RAM_D2 define in the memory section?
Use the .MAP or objdump to see how the symbol is defined
KEEP(*(.sharedRAMsection))
KEEP(*(.sharedRAMsection*)) /* check if it needs to pull suffix variants ie .sharedRAMsection.data */
2025-05-07 7:53 AM
RAM_D2 is defined as starting at 0x30000000 and having a size of 288K, which I think has it running up to 0x30048000.
/* Memories definition */
MEMORY
{
RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* Memory is divided. Actual start is 0x8000000 and actual length is 2048K */
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
}
Adding the wildcard to sharedRAMsection has no effect.
2025-05-07 8:27 AM
doesn't the attribute go after the variable name?
hth
KnarfB