This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Position Indepedent Startup Function

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

Parents
  • 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.
    

Reply
  • 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.
    

Children
No data