AnsweredAssumed Answered

Position Independent Code in STM32F479

Question asked by Manoj Chandran on Jan 29, 2018



We are using STM32F479 processor with RTX OS. The project is a C++ based code build in Keil. We want to design firmware upgrade. We are planning to have two slots,  Slot 1 at  0x8008000 and Slot 2 at 0x8080000. The firmware upgrade is done via Bluetooth interface.


The code will be compiled and linked for location 0x8008000 and the hex will be converted to binary.


If the application is in slot 1 and when the device receive the firmware upgrade, the new firmware will be flashed to slot 2 and vice versa. Once the flashing is successfully completed,  a particular flash location is updated with active slot number and the system will restart. On restart, the boot loader will read the flash location  to get the active slot details and jumps to the particular run address.


I want to generate position independent code so that the same binary will run in both Slot 1 and Slot 2 without rebuilding. Is it possible to generate a position independent  code using Keil and STM32F4.


Is there any other option to use the same code in different flash location without rebuilding?



Manoj Chandran R