2027659_en-US

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

2027659_en-US

2027659_en-US

I cannot get a Position Independent Executable (PIE) for S32K3

I’m trying to get a position independent executable (PIE) for simple embedded application (led blinking) that uses SDK. The application runs on EVB equipped with S32K311. I’m using IDE S32DS 3.5 and I’ve set the gcc  option -fPIC, -fPIE  for compiler and -pie for the linker and I’ve modified the linker script in order to place the got table. However the generated executable doesn’t work as PIE. It means that if I try to load it in an address other than the one for which it was built, it doesn’t work anymore.

In order to investigate the issue, I did some analysis about the generated .elf file with readelf commands. Following I summarize the results:

File Type is “EXEC” (Should be type “DYN”?)
Entry point address is an absolute address while an offset is expected
On the other hand, I’ve found some features related to a PIC/PIE executable:

In the Program Header there is a dynamic interpreter:
INTERP         0x011140 0x00401140 0x00401140 0x00011 0x00011 R   0x1

      [Requesting program interpreter: /usr/lib/ld.so.1]

Section FLAGS_1 value: PIE
Section .rel.dyn exists and contains several items (more than 300) type R_ARM_RELATIVE
Section .got present
Can anyone help me to understand what is the problem? Why the executable .elf is not "DYN" although the -fPIC, -fPIE -pie  options have been set in the IDE? Is the Type "DYN" really mandatory instead of "EXEC" to be a position independent executable? In attached the .elf file. Furthermore, why I cannot find the options -fPIC -fPIE neither in the makefile (automatically generated) nor in the relative .args file? While -pie is present in .args file I can find -fPIC -fPIE only in .cproject file. So, are those options really applied? In attached you can find my whole project.

I also tried to set the -shared option, but it doesn't affect the .elf file.

Note: I've already had a look at the picExample:

EXAMPLE S32K144 Position Independent Code - NXP Community 

but there are some differences: it refers to a previous IDE version, different micro family (S32K1xx)and the used application is without SDK.

Many thanks in advance for supporting.

Re: I cannot get a Position Independent Executable (PIE) for S32K3Hi @VaneB,
yes, normally I would like to include RTD in my application(s), however the threads you've shared could be useful.
Thank you very much for the information.
Best Regards
FabrikSal
Re: I cannot get a Position Independent Executable (PIE) for S32K3

Hi @FabrikSal 

According to the software team, the RTD driver has not been verified with the PIC and is not intended for integration with it. However, if RTDs are not part of your plans, you may find helpful information in the community threads where this topic has been discussed.

What are the Steps after activating Position Independ Code (PIC) for A/B Swaping?

How to create flash driver for S32K3xx as independent position code

Re: I cannot get a Position Independent Executable (PIE) for S32K3Hi @VaneB
Ok, it's clear. Instead, does the example related to S32K144 built in S32DS ARM 2.2 tools (https://community.nxp.com/t5/S32-Design-Studio-Knowledge-Base/EXAMPLE-S32K144-Position-Independent-C...) work in embedded application without OS? in case yes, is there any reason why this feature has not been ported to S32K3XX platform and S32DS 3.5?
Thank you very much for supporting.
Best regards
FabrikSal
Re: I cannot get a Position Independent Executable (PIE) for S32K3

Hi @FabrikSal 

Based on the information provided by our internal team, the functionality you are requesting will not work without an operating system that supports it. As previously mentioned, this feature is typically related to Linux OS and is generally used in the development of desktop applications running under such an OS environment.

Unfortunately, we do not have any additional information, resources, or documentation available for this specific application. Therefore, the implementation and functionality of the feature will be entirely dependent on your own development and how you choose to implement it within your system.

Re: I cannot get a Position Independent Executable (PIE) for S32K3Does it mean that IDE S32DS 3.5 actually cannot generate a PIE executable for S32K3XX, or simply that there is no available example for it? In the last case, any answer to my different questions could be useful in continuing to investigate the issue on my own.
Thank you!
FabrikSal
Re: I cannot get a Position Independent Executable (PIE) for S32K3

Hi @FabrikSal 

While PIE is commonly used in general-purpose computing environments (e.g., Linux), its application in embedded systems or microcontroller development is less frequent due to the constraints of these environments.

Unfortunately, we do not have a working example for creating a Position-Independent Executable (PIE) in this context.


BR, VaneB

タグ(1)
評価なし
バージョン履歴
最終更新日:
‎11-21-2025 11:49 AM
更新者: