STM32 custom Bootloader with external/seperate main app code and ISRs - two seperate programs as per examples but do not deal with ISRs
I am using STM32CubeIDE and have used the linker to change settings, so have a pretty good grasp.
I have read on custom bootloaders but not found how they deal with the following issue, as it seems ignored in the demo code. The custom bootloaders shown by ST have two programs. The bootloader/programmer and then the main code.
For example the lwip http or tftp prgrammer with seperate application code:
I am writing a bootloader to perform a startup check and possible firmware update of the main code which will be in external FLASH.
How do you make this deal with ISRs and the fixed vectors?
As I understand as is normal, the interupt vectors are fixed. So when the bootloader runs, the vectors will be used there.
But if I then jump into the main code then the ISR vectors will be to the bootloader code. That isn't any good.
How do I overcome this? Do I have to make a map in the bootloader that the main code somehow gets called?
Or should the bootloader just not have any ISRs and they are all directed to the main code - the issue being if there is a fw update of the main code going on and something fails which normally code be dealt with, it will instead jump to code that may not have been programmed.
The same question goes for if you were to run all the code in SRAM/external SDRAM ?
Are the vectors loaded into a volatile store as to where they point so you can change the point they jump to? Or always jumpt to fixed flash locations?
I.e. Does changing this change my interupt vector table so I can point it elsewhere?
/* The startup code goes first into RAM_EXEC */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >RAM_EXEC
This is also stored in the FLASH, So I assume this is stored in the FLASH then automatically loaded to the RAM_EXEC which defines the actual call vectors, so changing the RAM table will change the vectors ?
I look forward to your replies on this, it must have come up but I havent seen any articles on it, despite there being good examples of writing two seperate programs do cover this very topic.
Thanks,
Mark
