How do boot loaders work?

Status
Not open for further replies.

InvisiBug

Member
Please can someone help me understand how boot loaders work. I understand that they make it possible to program a chip without using the ICSP but that's about it.
Many thanks
 
Might help to know what you are interested in?

There is lots of generic information up on the web if you do a google query: How do bootloaders work

Now if you are wanting more specific information, on how it works on some specific board example one of the Teensy 3.x boards or LC or Teensy 2, it would help to know what board.

The basic ideas is, there is something that triggers the board to reboot. Often with boards who hook up using a Serial port, it is one of the other RS232 signals like DTR that changes.

Then once the board resets, the host will do some form of handshake, like send out some specific set of characters, within so long after the board resets. If the board detects this, it goes into a special mode, where the host downloads the program to the board, and the bootloader will store the new program in the appropriate place and once this is done, will reset the processor to run the new program...

But how each of these boards do it, depends on the board and... Many of the AVR based boards use a standard protocol and use a program: avrdude to do the uploading, often with these chips, the bootloader is stored on the processor itself, at a special part of memory, which the bootloader itself will not overwrite, however if you use an ICSP, it often will overwrite this portion of memory and you no longer have a bootloader. This is why in the Arduino IDE for many of these boards you have the command Burn Booloader which typically requires an ICSP to download the specific bootloader for that chip.

As for Teensy 3.x - There is a special chip on these boards that takes care of downloading new programs, which is not part of the actual processor....
 
A bootloader is started when the microcontroller starts. It contains a small program to which you can connect (through a serial connection over USB in the case of Teensy) and which contains code to download and program the main flash memory of the microcontroller. The bootloader can start the code in the flash memory by 'jumping' to it.

There are some open-source AVR bootloaders on the internet.
 
In the case of the Teensy 3.x/LC, it is a separate chip that gets control before the Teensy runs. If you build your own Teensy, you would need to buy the boot chip from PJRC if you want to use the Teensy the way it is designed.

It really depends on the inner details of the chip. Download the appropriate manual and it should say how to set up the chip at power on. Note, Teensy 3.x/LC use ARM chips not AVR chips.
 
Status
Not open for further replies.
Back
Top