Position independent firmware for S32K148 using IAR IDE

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

Position independent firmware for S32K148 using IAR IDE

882 Views
KiranE
Contributor I

Hi, 

I am trying to create position independent code for S32K148 using IAR option "code and read only data" as explained in the app note AN12323.Application note attached to this post.

 

KiranE_1-1635863351012.png

We have two application sections. Application1 is placed at 0x00080000 - 0x000BFFFF, application two is placed 0x00100000 - 0x0013FFFF.Each application has its own vector table. Boot is placed at 0x00000000. Memory map of whole flash is shown below image. Data flash is not being utilized.

Boot will check the latest FW and it will jump accordingly.

KiranE_2-1635863761940.png

Issue is, boot always running the application 1 which is placed at 0x80000. When I checked the assembly, the branch instruction has absolute address of application 1 section. Highlighted in the below image. I feel, BL should be base address followed by offset when ROPI option enabled.

Why code is generated with absolute address? Do I need to set any other compiler options( or linker settings) in IAR other than ROPI option to make code position independent. If you have example code for IAR compiler, please provide. It will be helpful

Please let us know in case further information needed.

KiranE_0-1635863252058.png

 

Thanks

Kiran

 

0 Kudos
2 Replies

863 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Kiran,

could you please contact IAR support? Not sure what's the root cause here...

Thanks,

Lukas

0 Kudos

773 Views
turgaykale
Contributor III

Dear @KiranE hi,

I am also trying to generate a position independent code/executable (PIC/PIE) for dual slotted bootloader in S32K148. After searching to do it manually by compiler/linker options and from the linker file management, I couldn't succeed. Then I have determined to use IAR EWB via ropi/rwpi options but couldn't build the S32DS project (after using migration tool, there are missing files after the migration process) in the IAR EWB IDE. Therefore I have tried to build the project from S32DS for ARM v2.2 with IAR Eclipse Plugin but this time I am having an error in invoking IAR compiler (v8.32.1) although I have license and can build sample projects in IAR EWB IDE. Did you face this kind of problem in your project ? How did you build your S32DS project with IAR compiler ? It will be helpful if you can share your experience.

Error message of invoking IAR compiler (v8.32.1) from S32DS for ARM v2.2 IDE :

turgaykale_0-1643198175198.png

Menu -> Windows -> Preferences -> Embedded Workbench Setup

turgaykale_1-1643198255647.png

Info about IAR EWB IDE (v8.32.1) :

turgaykale_2-1643199494668.png

Info about S32DS for ARM (v2.2) IDE :

turgaykale_3-1643199622740.png

Info about Eclipse version in S32DS for ARM (v2.2) IDE :

turgaykale_4-1643199693993.png

Regards,

Turgay

 

 

0 Kudos