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
Solved! Go to Solution.
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
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
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
Hello,
which version of S32 Design Studio you use?
Regards,
Martin
It’s S32 DS for power v1.2 ,the project is for MPC5744P
Thank you
发自我的iPhone
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
Hi Wang,
1) Detailed description is GNU Linker documentation
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
Dear Martin:
Got it and thank you very much!
Best Regards,
Wang