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

Multiple Application Code with Bootloader

Hello,

Looking for some pointers on the scenario below. I'm fairly new to firmware and bare-metal programming.

In the system I'm working on, I am looking to get a bootloader and 2 application programs compiled. The 2 application programs will be placed in FLASH but they maybe overriden by a firmware update depending on which firmware is invalid. The location of the bootloader is fixed and with the firmware update scenario 2 application programs do not have a known physical location.

How would I get the 2 application programs compiled given that I am not able to determine what is the final locations during compile time. Is there a way to make it relocatable via some linking or compile switches?

I'm using the ARM GCC Toolchain on Linux and working on a Cortex M0 MCU.

Thanking everybody in advance.

Parents
  • I am not sure I understand why firmware update will make application physical location undecided. But if it is genuinely need to go with location known, the position independent code is what you need. The way it work in bare-metal is following two options:

    1. -fPIC in compile and linker option to make applications compiled for position independent

    2. -msingle-pic-base -mpic-register=r9 in compile option makes r9 pointing to your GOT table for relocation in your application

    3. bootloader sets r9 to the GOT table location before invoking the application

Reply
  • I am not sure I understand why firmware update will make application physical location undecided. But if it is genuinely need to go with location known, the position independent code is what you need. The way it work in bare-metal is following two options:

    1. -fPIC in compile and linker option to make applications compiled for position independent

    2. -msingle-pic-base -mpic-register=r9 in compile option makes r9 pointing to your GOT table for relocation in your application

    3. bootloader sets r9 to the GOT table location before invoking the application

Children