Introduction:
Hello all, here I am going to explain one of the important topics, it’s called boot loader .I think this information will be useful for those who are working on embedded system based projects. Most of the people knows the boot loader, but the type of boot loader used in automotive domain its different. The boot loader code is capable of flashing the user code into the program memory. Boot loader allows flash the firmware to the micro-controller Via any protocol. After it is loaded, the new user application is able to run in the MCU, In automotive domain mostly we use CAN (control area network), and LIN (Local Interconnect Network). The more details you can find below.
Boot Loader basic:
Without boot loader the system works as per diagram, after the MCU reset controller will start from reset vector and directly give the control to the application. here we need to flash the MCU using debugger. because we don't have boot loader in the MCU.
Below we have implemented boot loader. In this case once reset comes the control goes to primary boot loader and primary boot-loader will wait if any request from external tool, if not than the primary boot loader will pass control to the application. if there is request from tool it will request to the tool to flash the secondary boot-loader in the RAM and pass the control to the secondary boot loader. here tool will use the secondary boot loader or flashing purpose and start the application.
Remember we need to shift the Reset vector & interrupt table for the application. there is two main function and two startup code used.
Remember we need to shift the Reset vector & interrupt table for the application. there is two main function and two startup code used.
The boot loader is divided in to two parts primary and secondary, most of the people thinks there secondary boot loader is backup plan but it is not like this. Whenever the hard reset comes to the micro-controller it starts from reset vector after reset vector.
Primary Bootloader: After the MCU reset control comes to the primary boot-loader . Primary bootloader will have the CAN protocol. Primary boot loader initializes the CAN controller to be used for the software download with the correct CAN speed. Now the primary boot loader will wait here for some define time (30ms as per requirements) it will check here any programming request from the test tool (this is external tool which is install in the computer. with the help of this tool we can flash the software in the ECU). If there is no request from the tool it will give control to the application main() function.
Secondary Bootloader: The secondary boot loader is not a backup of primary boot loader. Primary boot loader will load the secondary boot loader in to the RAM. Secondary boot loader at run only will get flash from the software download tool to the RAM. The use of secondary boot-loader is to download the software from the software down-loader tool. After a power on reset the secondary boot loader will get disappear. Secondary boot-loader will have flash write, read, erase routine. When the secondary boot loader has been downloaded into RAM the boot loader will use the routines for erasing and programming to the flash memory. After each programmed area a check-sum is calculated and compared to check-sum in the tester to make sure that the programming went well. When programming is ready and all the check-sum are correct the boot loader will reset the hardware. After the reset again primary boot loader will take the control and again will check any programming request or not if not, than it will start the application.
Once the application started it never come to the boot loader except hard reset or if you want to flash the software u need to reset the MCU in programming session.
Once the application started it never come to the boot loader except hard reset or if you want to flash the software u need to reset the MCU in programming session.
In automotive domain we use tool for flashing this tool can be develop using .net, C#,VB, python, etc.
The more details about how to write boot loader can be find at below location
Please provide feedback below
Thanks you:)