S32DS code allocation

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

S32DS code allocation

Jump to solution
4,693 Views
cthhk
NXP Employee
NXP Employee

Dear Team:

 

I'm using S32DS and I want to allocate my code and variables into specific memory area, however I did not find any description how to use mem and ld file.

Could you give an example how to do this?

Appreciate your support!

 

Best Regards,

Wang

Labels (2)
1 Solution
3,121 Views
martin_kovar
NXP Employee
NXP Employee

Hi Wang,

at first, look at this example. There is shown, how to create section in linker file and how to place function to the created section.

Example MPC5748G PretendedNetworkingCAN S32DS

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

Regards,

Martin

View solution in original post

7 Replies
3,122 Views
martin_kovar
NXP Employee
NXP Employee

Hi Wang,

at first, look at this example. There is shown, how to create section in linker file and how to place function to the created section.

Example MPC5748G PretendedNetworkingCAN S32DS

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

Regards,

Martin

3,121 Views
feigao
Contributor I

Dear Martin:

Thank you for your example!

I got your example and tyied on my project. I allocated my ocde into a new section in linker file,and I modified the stratup.s. to init the code,I found the code had been put into the memory that I need, but the porjecet didn't work,after I press the run or next step  in Debug mode, came out en error,  “No source available for "__init() at 0x10030b0" ” . I don't know the reason,could you help me about this

Thanks and Best Regards,

Gao

0 Kudos
Reply
3,121 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

which version of S32 Design Studio you use?

Regards,

Martin

3,121 Views
feigao
Contributor I

It’s S32 DS for power v1.2 ,the project is for MPC5744P

Thank you

发自我的iPhone

0 Kudos
Reply
3,121 Views
cthhk
NXP Employee
NXP Employee

Dear Martin:

I got your example project and it's quite clear. Thanks.

Two further questions:

Q1) What is the meaning of the key word "KEEP"? Do we have some document about the key words of .ld file?

Q2) How to allocate a group of variables? For example, if I wrote as below:

__attribute__ ((section(".MyRamData")))                // place data below into .MyRamCode section

unsigned long my_test_data_0;

unsigned long my_test_data_1;

unsigned long my_test_data_2;

Then only my_test_data_0 was allocated into .MyRamData, however my_test_data_1/2 were allocated into default RAM area.

Do we have something like "#pragma CODE_SEG xxx" in legacy Codewarrior?

Thanks and Best Regards,

Wang

0 Kudos
Reply
3,121 Views
martin_kovar
NXP Employee
NXP Employee

Hi Wang,

1) Detailed description is GNU Linker documentation

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&sqi=2&ved=0ahUKEwiswvaPxqnMAhVsJMAKH...

KEEP is the same as FORCEACTIVE in CodeWarrior. It will ensure that the section will not be stripped by linker garbage collector (for example if the section is unused).

2) You have to place __attribute__ above every line you want to place to the specified section. There is nothing like #pragma in CodeWarrior. But it is possible that linker will place the variables in different order. In that case, you can create structure and place the variables to this structure. Then you can place the structure to the specific section.

Regards,

Martin

3,121 Views
cthhk
NXP Employee
NXP Employee

Dear Martin:

Got it and thank you very much!

Best Regards,

Wang

0 Kudos
Reply