Hi
I want to create a position independent application in Keil for an EFM32 device (Cortex-M3). The application should be loaded by a bootloader. I use the ROPI option when compiling the C-code and the bootloader takes care of updating the interrupt vectors.
The problem I have is that the startup code (__main) still seems to use fixed addressing. Is there a way to make __main position independent or is there another startup function I can use?
Best regards Filip
With the changes in the scatter file I made it work. Thank you so much for your help!
Glad to hear it. Your thanks are why people like me read and post here. That and the chance to show off :-)
Hi,
I am reopening this thread as I am having a problem similar to Clive's one. I am working on the STM32F207 Keil development board and I am also having trouble getting the __main compatible with position independence. For example, in the __scatterload we can read such assembly instructions:
BNE 0x0800001E
which is not very nice when you want position independent code. Has anyone got an idea?
PS: Here are some linker error examples I am getting:
.\build\Blinky.axf: Error: L6248E: startup_stm32f2xx.o(.text) in PI region 'ER_IROM1' cannot have address type relocation to __main in PI region 'ER_IROM1'. .\build\Blinky.axf: Error: L6285E: Non-relocatable Load region LR_IROM1 contains R-Type dynamic relocations. First R-Type dynamic relocation found in startup_stm32f2xx.o(.text) at offset 0xe4.