cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to know if there are any examples of using STM32CubeIDE (near or current version) for creating Position Independent Code?

GreenGuy
Lead

I found one using IAR for STM32 but the tools are different enough that it is tough to determine how to do things like turn off management of the linker script by the tool. Also, the paper lacks detail regarding how to setup and manage the code.

2 REPLIES 2
S.Ma
Principal

Position independent code IMHO is marginal in MCU because there is no memory management unit as in MPU or CPU. If possible, it won't be optimised code. I assume position independent code means loading the flash binary at different start address, and still have the code running.

Pavel A.
Evangelist III

Position Independent Code has been discussed here some time ago.

If memory serves, the verdict was: not worth it, specifically on small Cortex-M MCUs because the PIC code becomes larger and slower.

The IAR compiler may compensate this by better optimization - that's is why they are still in the business?

> loading the flash binary at different start address

Someone made a proposal in the ideas area, to implement remapping or relocation of internal flash range in the code address space, to make this possible without PIC and MMU.

As Jan W. said - to be safely ignored there...