Multicore variables sharing via header/source file

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Multicore variables sharing via header/source file

1,202 Views
dingelen
Contributor III

Hi,

I'm using the dualcore LPC55S69 for a project. It's configured so that CORE0 uses flash to executed code and SRAM0/1 for RAM, CORE1 uses SRAMX to exectued code and SRAM2 for RAM. I'm planning to uses SRAM3 (= SHARED_RAM) as a type of shared memory which is initialised by CORE0 (before CORE1 is started) and used by CORE1 during execution. Two projects are created, one for each core. On compilation, first CORE1 gets compiled and next CORE0.

There will be a lot of variables in the SHARED_RAM and it feels easiest if they are all contained in one header/source file being shared by both projects. 

How should I go about creating such a file, making sure that these variables point to the SHARED_RAM region, and for both compilation processes allocate the same address for each variable?

Thanks!

Tom

Labels (1)
Tags (2)
0 Kudos
Reply
3 Replies

1,113 Views
converse
Senior Contributor V

Use a typedef structure and a pointer. You can then easily initialise the pointer in both set of code

0 Kudos
Reply

1,113 Views
dingelen
Contributor III

Will this work for large amounts variables, arrays and mixed types? Will both compilers allocate the same position to all the variables even with different compiler settings (optimised speed vs size vs debug).

I was thinking of an approach where you could just declare your varaibles as ussual and surround them with some pre-compiler derectives about memory regions, packing, ... 

0 Kudos
Reply

1,113 Views
converse
Senior Contributor V

If the structure is defined in a header and that header is included in both programs, then of course it will work! Don't forget you're using the same compiler! If that didn't work, there would be a lot more than your program that would fail.

0 Kudos
Reply