Boot swap - technique to reprogram bootloader itself
But what if we have found some bug in the bootloader itself and want to reprogram the bootloader ?
Some options are
But what about embedded systems in which controller is not accessable and the only option is reprogramming itself using the bootloader ?
This is possible if
Brief note about bootloader
Layout of a simple bootloader
Bootloader with option for reprogramming the bootloader itself
I will explain this with the help of the microcontroller v850 series microcontroller from Renesas.
Flash Layout of v850 Series controllers - Reprogramming the entire flash Memory (Boot Swap)
A) Always the entire flash memory is reflashed.
In this cas there will not be seperate bootloader/application. So download is done in two stages. Also it is ensured that the code for downloading and the dependencies are present in the lower two bocks. Steps involved will be.
B) Simple architecture is followed, special code with bootloader(Bootswapper) will be downloaded to update the bootloader.
Updation of bootloader using bootswapper
In this case bootloader will work same as that of the simple bootloader. But if we want to update the bootlaoder, then we can download a special code (say Bootswapper). This special code will contain the code for the new boot loader which is offsetted to some other adderss. After complete download, bootloader will pass the control to the application(here the special code - bootswapper). Now this special code will execute from RAM and copy the address offseted new bootloader to the bock 2 and 3. After that it will swap the blocks to have the new bootloader in the blocks 0 and 1.