Skip to main content
Associate
July 1, 2024
Solved

SPC58 data sharing between two cores

  • July 1, 2024
  • 2 replies
  • 2238 views

I've been using for a bit a SPC58 eval-board and i was wondering how to share global variables between the two cores. I searched around on the internet finding nothing useful. Is "volatile int" enough even for a rough and dirty data sharing or should I use something like SRAM and its shared memory location?

Best answer by Erwan YVIN

Hello Mark ,

take a look in SPC58xNxx_RLA TripleCore Test Application for start

yes , volatile is not enough.

you should create a sort of shared SRAM in application.ld and define :

// Define shared variables in shared SRAM
volatile int sharedvar __attribute__((section(".shared_sram")));

After checking , you should define a sort of SpinLock before accessing or writing it. 

          Best regards

                      Erwan

2 replies

Erwan YVIN
Erwan YVINBest answer
ST Employee
July 10, 2024

Hello Mark ,

take a look in SPC58xNxx_RLA TripleCore Test Application for start

yes , volatile is not enough.

you should create a sort of shared SRAM in application.ld and define :

// Define shared variables in shared SRAM
volatile int sharedvar __attribute__((section(".shared_sram")));

After checking , you should define a sort of SpinLock before accessing or writing it. 

          Best regards

                      Erwan

Associate
July 11, 2024

Hi Erwan,

thank you for answer.

How should I choose parameters for that section? I don't want to mess with already used memory partitions.

SPC58xNxx_RLA TripleCore Test Application does not implement data sharing between cores but only starting the additional cores and make the onboard LED blink. Are there any other sources from where I can get more info about this topic?

Thanks in advance, Mark

Associate
January 20, 2025

Hello Mark,

 

I am working on a similar task of sharing data between two cores. Did this solution work for you? If so, were there any challenges you encountered while implementing this approach?


Thanks in advance, 

Rohit.

Erwan YVIN
ST Employee
July 11, 2024

Hello Mark ,

Sorry , we have no example.

You have no choice you should update your linker script copy application.ld  by user.ld

and try to create a shared ram data in user.ld

 

MEMORY
{ 
 ...........
 shared_sram : org = tbd, len = 16k /* Define shared SRAM region */
 ...........
}

SECTION
{
 .......
 .shared_sram : 
 {
 . = ALIGN(4);
 *(.shared_sram)
 . = ALIGN(4);
 } > shared_sram
 ....
}

 

   Best regards

              Erwan