Hi,
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!
Chris
chrisKConti said:Maybe it is a easier way to compile completly for RAM and only try to start the reset-handler out of Flash for copying and starting up.
That's really the easiest way. The linker can generate symbols for start and end of this part, so copying is quiet easy.
how can i get a symbol for the last byte of this pre-bootloader to see where the main Bootloader starts?
I plan to compile the different Projects and merge the bin-fiiles together with srec_cat.
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.