How to share code and data between two cores in S32 Studio applications?

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

How to share code and data between two cores in S32 Studio applications?

Jump to solution
3,384 Views
umsteigen
Contributor II

Now we try to develop application for MPC5745R in S32 studio. When building the default project for MPC5745R, two binary files (ELF file) are generated respectively. Each contains the code and data for the dedicated core. Then I have the question: how to share code and data between two cores?

 

Define a section for the share code, put all the shared code in this section and compile all the shared core into both ELF files?

 

Or is there any method to generate only one ELF file which contains code and data for both cores?

Labels (1)
0 Kudos
Reply
1 Solution
2,910 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

1) There is not #pragma in gcc compiler. You have to use __attribute__ instead of pragma.

2) Please look at the following link:

GCC online documentation- GNU Project - Free Software Foundation (FSF) 

If you have any other questions, please feel free to write me back.

Regards,

Martin

View solution in original post

5 Replies
2,910 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

from my point of view, you should always create shared sections, where the shared data and code will be placed. It does not matter if you use one .elf file or two elf. files. If you use just one elf file, linker file will be more complicated.

I have created example for MPC5775K, which shows, how to create shared RAM memory section for data. This solution should be usable also for shared code. You have to create shared section in flash and use it by both cores (but I do not try it yet).

Example MPC5775K Semaphores S32DS 

In case you would like to use only one elf file, S32 Design Studio v1.1 contains example which shows, how to create project with one .elf file. This project is created for MPC5748G, but it should be possible to use it as a reference example for MPC5745R. This example is placed in S32DS installation folder (S32_Power_v1.1\S32DS\Examples\MPC5748G). 

If you have any other questions, please feel free to write me back.

Regards,

Martin

0 Kudos
Reply
2,910 Views
umsteigen
Contributor II

Dear Martin,

thank you for your professional reply.

I have two more questions:

(1) The S32 studio uses the GCC compiler, but how to allocate code/data in a predefined section, as following?

const uint32 __attribute__ ((section (".intc_vector_table"))) Vector_addrTablePFA[] = {...};

We always have to use the "__attribute__ ((section (".section_name"))) "?  This is inconvenient for AUTOSAR projects.

I used GreenHill and Codewarrior before, and pragmas are valid for these two compilers. But for GCC compiler, there is no such way?

(2) Is there any reference or user manual for the GCC compiler? It is very difficult to find more features of the compiler.

Regards,

Cheng FANG

0 Kudos
Reply
2,911 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

1) There is not #pragma in gcc compiler. You have to use __attribute__ instead of pragma.

2) Please look at the following link:

GCC online documentation- GNU Project - Free Software Foundation (FSF) 

If you have any other questions, please feel free to write me back.

Regards,

Martin

2,910 Views
umsteigen
Contributor II

Dear Martin,

thanks a lot for your help.

Last question: how to keep unreferenced variables for GCC?

In codewarrior, the pragma "#pragma force_active on" has this function.

Best regards,

0 Kudos
Reply
2,910 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

 

you can use following construction instead of pragma: __attribute__((used))

Example:
char srcvers[] __attribute__((used)) = "VERSION/foo.c/1.01/09.04.15";

If you have any other questions, please feel free to write me back.

Regards,
Martin

0 Kudos
Reply