Bootloader? little confused here.

A microcontroller like the AVR has no machine code in it when you buy it. I will try to explain why a bootloader is used, hope I explain it clearly enough.

Once you write your program you either compile it if you are using a high level language like C, or assemble it if you wrote it in the assembly language of a the chip. The output from doing this is the machine code.

You want to get that machine code into the microcontrollers flash memory, so that on power up the CPU in the microcontroller can start to execute the machine code.

In order to do this you have to buy or build a programmer device. The old type programmer had a socket that you plugged your microcontroller into and then downloaded the machine code into the microcontroller. Nowadays most microcontroller support in circuit programmers. Deviced that connect to the pc and to a certain pins of the microcontroller in circuit.

Now instead of using a programmer which costs money or requires skill to build you can use the serial port of a microcontroller to download the send the machine code to the microcontroller.

Since microcontroller doesnt do this by default ( because the manufacturers expect you buy a device programmer from them :wink: ) you have to write a program that will listen on the serial port and take whatever it gets and put that into the program memory area. This program is called a bootloader.

This of course requires that the microcontroller has instructions that are able to write into its program memory.

The boot loader has to be programmed into the blank chip before it can work and you need to be able to interface the serial port to the PC.

The Arduino uses this and instead of interfacing the serial port of the AVR directly to the PC, it interfaces the serial port of the AVR to the FT232 which connects to the PC via USB. This allows the Arduino environment to download code into the chip through USB, provided that the bootloader is installed.

This is one of the nice things about Arduino, because it allows you to play with a microcontroller without having to buy or build an expensive programmer. Perfect for noobies to embedded systems.

Btw I was joking about the manufacturers wanting you to buy programmers. The reason I suppose is because not everybody wants bootloader functionality and to give you a blank slate to develop your own applications.