user37: I was instructed to "burn the bootloader" to my Arduino to fix an error I was getting. How can I do this? (And what exactly is the bootloader?)

user10794: What is a bootloader?

And what exactly is the bootloader? 

The bootloader is a small piece of code residing in the "high" part of program memory. Normally it is not erased when you upload new sketches. Its purpose it to be activated immediately after a reset (the fuses are configured to commence code at the bootloader address rather than address 0x0000). The bootloader will wait a short time (such as one second) to see if "programming" data is arriving on the serial port.

If so, it reads that data, and decodes it to reprogram the rest of the flash memory. Working in conjunction with the uploading program (normally avrdude) the new sketch is sent via the serial port. The bootloader erases pages of flash memory, and replaces them with the new code. Once done, it executes the new code.
If no instructions arrive, the bootloader jumps to address 0x0000 to execute the existing sketch on the board.


How to replace the bootloader
An alternative method to program a bootloader is to use a sketch I wrote a while ago which runs on a:

Uno (or similar, such as Duemilanove)
Leonardo
Mega2560

The "programming" board runs the sketch which has bootloaders for a number of boards hard-coded into it. You connect the programming board to the target board (the board wanting the bootloader) with 6 hook-up wires as shown.

That particular photo illustrates one Uno programming another one.
You run the sketch (operating via the Serial Monitor to give it commands). First it identifies the target chip:
Atmega chip programmer.
Written by Nick Gammon.
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F 
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = 0xFF 
HFuse = 0xDE 
EFuse = 0xFD 
Lock byte = 0xCF 
Bootloader address = 0x7E00
Bootloader length = 512 bytes.
Type 'L' to use Lilypad (8 MHz) loader, or 'U' for Uno (16 MHz) loader ...
Type 'G' to program the chip with the bootloader ...

The you  press G to program it.
Erasing chip ...
Writing bootloader ...
Committing page starting at 0x7E00
Committing page starting at 0x7E80
Committing page starting at 0x7F00
Committing page starting at 0x7F80
Written.
Verifying ...
No errors found.
Writing fuses ...
LFuse = 0xFF 
HFuse = 0xDE 
EFuse = 0xFD 
Lock byte = 0xCF 
Done.
Type 'C' when ready to continue with another chip ...

For a Uno this takes one second. To program a Mega2560 takes 3 seconds.
Detailed instructions at Atmega bootloader programmer
Code can be downloaded from Github: nickgammon/arduino_sketches


user37: The bootloader is a small program that is (almost) always on an Arduino. It manages uploading and starting the sketches you make, and blinks the pin 13 LED whenever the board resets.

To burn the bootloader:

Obtain an AVR ISP, USBtinyISP, ParallelProgrammer, or similar; or use another Arduino board. This will be your ISP.
Unless otherwise instructed, connect the ISP to the ICSP pins on your board.
Power your board with either a USB cable or an external power supply.
Open up the Arduino IDE.
Make sure you selected the correct board that you are burning to at Tools ► Board ► in the IDE. Double-check this even if you could upload programs correctly; uploading doesn't always require the right board.
Select the appropriate programmer at Tools ► Programmer ►.
Click Tools ► Burn Bootloader, and wait. It shouldn't take more than a minute, and often takes only a few seconds.


Sources:

http://arduino.cc/en/Hacking/Bootloader
http://arduino.cc/en/Guide/Environment


37: <p>I was instructed to "burn the bootloader" to my Arduino to fix an error I was getting. How can I do this? (And what exactly is the bootloader?)</p>
 10794: <h3>What is a bootloader?</h3>

<blockquote>
  <p>And what exactly is the bootloader? </p>
</blockquote>

<p>The bootloader is a small piece of code residing in the "high" part of program memory. Normally it is not erased when you upload new sketches. Its purpose it to be activated immediately after a reset (the fuses are configured to commence code at the bootloader address rather than address 0x0000). The bootloader will wait a short time (such as one second) to see if "programming" data is arriving on the serial port.</p>

<ul>
<li><p>If so, it reads that data, and decodes it to reprogram the rest of the flash memory. Working in conjunction with the uploading program (normally avrdude) the new sketch is sent via the serial port. The bootloader erases pages of flash memory, and replaces them with the new code. Once done, it executes the new code.</p></li>
<li><p>If no instructions arrive, the bootloader jumps to address 0x0000 to execute the existing sketch on the board.</p></li>
</ul>

<hr>

<h3>How to replace the bootloader</h3>

<p>An alternative method to program a bootloader is to use a sketch I wrote a while ago which runs on a:</p>

<ul>
<li>Uno (or similar, such as Duemilanove)</li>
<li>Leonardo</li>
<li>Mega2560</li>
</ul>

<p>The "programming" board runs the sketch which has bootloaders for a number of boards hard-coded into it. You connect the programming board to the target board (the board wanting the bootloader) with 6 hook-up wires as shown.</p>

<p><img src="https://i.stack.imgur.com/WA4yE.jpg" alt="Bootloader programmer for Uno"></p>

<p>That particular photo illustrates one Uno programming another one.</p>

<p>You run the sketch (operating via the Serial Monitor to give it commands). First it identifies the target chip:</p>

<pre><code>Atmega chip programmer.
Written by Nick Gammon.
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F 
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = 0xFF 
HFuse = 0xDE 
EFuse = 0xFD 
Lock byte = 0xCF 
Bootloader address = 0x7E00
Bootloader length = 512 bytes.
Type 'L' to use Lilypad (8 MHz) loader, or 'U' for Uno (16 MHz) loader ...
Type 'G' to program the chip with the bootloader ...
</code></pre>

<p>The you  press <strong>G</strong> to program it.</p>

<pre><code>Erasing chip ...
Writing bootloader ...
Committing page starting at 0x7E00
Committing page starting at 0x7E80
Committing page starting at 0x7F00
Committing page starting at 0x7F80
Written.
Verifying ...
No errors found.
Writing fuses ...
LFuse = 0xFF 
HFuse = 0xDE 
EFuse = 0xFD 
Lock byte = 0xCF 
Done.
Type 'C' when ready to continue with another chip ...
</code></pre>

<p>For a Uno this takes one second. To program a Mega2560 takes 3 seconds.</p>

<p>Detailed instructions at <a href="http://www.gammon.com.au/bootloader" rel="noreferrer">Atmega bootloader programmer</a></p>

<p>Code can be downloaded from <a href="https://github.com/nickgammon/arduino_sketches" rel="noreferrer">Github: nickgammon/arduino_sketches
</a></p>
 37: <p>The bootloader is a small program that is (almost) always on an Arduino. It manages uploading and starting the sketches you make, and blinks the pin 13 LED whenever the board resets.</p>
<hr />
<p>To burn the bootloader:</p>
<ol>
<li>Obtain an AVR ISP, <a href="http://learn.adafruit.com/usbtinyisp" rel="nofollow noreferrer">USBtinyISP</a>, <a href="http://arduino.cc/en/Hacking/ParallelProgrammer" rel="nofollow noreferrer">ParallelProgrammer</a>, or similar; or use <a href="http://arduino.cc/en/Tutorial/ArduinoISP" rel="nofollow noreferrer">another Arduino board</a>. This will be your ISP.</li>
<li>Unless otherwise instructed, connect the ISP to the ICSP pins on your board.</li>
<li>Power your board with either a USB cable or an external power supply.</li>
<li>Open up the Arduino IDE.</li>
<li>Make sure you selected the correct board that you are burning to at <code>Tools ► Board ►</code> in the IDE. Double-check this even if you could upload programs correctly; uploading doesn't always require the right board.</li>
<li>Select the appropriate programmer at <code>Tools ► Programmer ►</code>.</li>
<li>Click <code>Tools ► Burn Bootloader</code>, and wait. It shouldn't take more than a minute, and often takes only a few seconds.</li>
</ol>
<hr />
<p>Sources:</p>
<ul>
<li><a href="http://arduino.cc/en/Hacking/Bootloader" rel="nofollow noreferrer">http://arduino.cc/en/Hacking/Bootloader</a></li>
<li><a href="http://arduino.cc/en/Guide/Environment" rel="nofollow noreferrer">http://arduino.cc/en/Guide/Environment</a></li>
</ul>
