Bootloader? little confused here.

The use of a bootloader allows us to avoid the use of external hardware programmers. 
(Burning the bootloader onto the chip, however, requires one of these external programmers.)

Isn’t the Arduino board itself the external hardware?
So why would you need a bootloader then?

It means “External” to the Arduino.
ICSP = In-circuit serial programmer.

The bootloader is a small program in s apsecial area of the AVR’s flash mmory that exploits the AVR’s self-programming capabilities, avoiding having to use an ICSP all the time to put a program into the Arduino.

So what if I buy a seperate ATmega chip, I can’t use it on Arduino then because I need to put a bootloader on it?

I can’t use it on Arduino then because I need to put a bootloader on it?

Correct, in that case you need a programmer to put the boot loader into your blank chip. see the playground for many solutions of how to do this.

Ok, thank you very much!
So actually, the Arduino(let’s say the Duemilanove) is actually a board that makes you connect parts easily to the chip and allows updating of the code quickly?

No, the Arduino is the board AND an AVR chip with a bootloader.
Without the board, the AVR wouldn’t have serial comms, and without the AVR the board wouldn’t do anything.

So what if I buy a seperate ATmega chip, I can’t use it on Arduino then because I need to put a bootloader on it?

There many vendors that sell for a few pounds/bucks Atmega168 and 328 chips with the Bootloader already programmed onto it.

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.

That is pretty good explanation zageek, but I have a couple of clarifications.

Some microcontrollers (including AVRs from Atmel) do in fact ship from the manufacturer with a bootloader already burned into the chip. A classic example is the USB capable AVRs such as the AT90USB162. It is true that none of the AVRs used by Arduino have a manufacturer installed bootloader.

A couple of reasons for not using a bootloader are:

  • Not having a bootloader provides extra room in flash (2K for Arduino). In fact most smaller AVRs (4 or 8K flash) do not even provide bootloader capability.
  • Production devices may not want a bootloader to prevent overwriting of the shipped application code. In these cases the lock bits are often also set to prevent unauthorised reading or writing of the flash image on the chip. Note that you can set the lock bits but yet still have a bootloader. This is useful in the environment where you want to do “controlled” upgrades to a production platform.

Thank you very much people!
I’m gonna start a few projects in my house this summer.
But in the Nederlands here I can buy one of those programmers for about 30 bucks. totally worth it.

I would like to thank everyone for replying!
I understand the bootloader now!