i am using an STM32F103RB Controller and the KEIL uVision 5 IDE (5.17) and STM32CubeMX.
My bootloader resides in the first 16kB of the Flash 0x08000000 to 0x08003FFF, The data Data RAM-Region is shiftet to 0x20004000.
I wanted to copy the Bootloader to RAM before jumping to SystemInit function.
The Plan was to copy the whole Bootloader to RAM and afterwards change the Interrupt-Vectors in RAM from 0x08xxxxx to 0x20xxxxxx, then Jump to the SystemInitFunction in RAM.
The Assembled Code uses PC - relative Adressing, so i thought it should be possible.
As a first test, i compiled the Bootloader once for Flash and afterwards for RAM and compared the HEX-Files.
I noticed that there are a few places in the File which seems to use absolute Adresses, not only in the Vector-Table where i expected it, but only a few places.
Does anybody know if there is a possibility to make the whole compile relative, or is there a better way to transfer the Loader to RAM?
I use interrupts in the bootloader for UART, CAN and a timer.
Thank you for helping me!
You need to know the start and end of the bootloader. The section start and end values are linker generated.
Like |Load$$bootloader$$Base| and |Image$$bootloader$$Length|.Check the map file, you'll see some of these.