Multicore variables sharing via header/source file

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Multicore variables sharing via header/source file

1,201件の閲覧回数
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

ラベル(1)
タグ(2)
0 件の賞賛
返信
3 返答(返信)

1,112件の閲覧回数
converse
Senior Contributor V

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

0 件の賞賛
返信

1,112件の閲覧回数
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 件の賞賛
返信

1,112件の閲覧回数
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 件の賞賛
返信