8
\$\begingroup\$

I am very new to embedded world. I had been till now working only on S/W

Can anyone please explain me the use of the Arduino Bootloader? I want Arduino to perform some simple mathematics using some additional components that have to be put in to the chip.

Do I necessarily need a bootloader?

\$\endgroup\$
10
\$\begingroup\$

The Arduino is basically just an Atmel AVR microcontroller, with just enough support electronics to allow it to operate. The AVR has built-in flash to allow it to keep programs with the power off, but to program an AVR chip directly you need a tool like the STK-500 to do the job. The Arduino overcomes this by also having a small USB interface on the board, and the Arduino boot-loader code already on the chip. This allows the PC side application to transfer your programs to the device, and in essence, have it flash itself.

So, bottom line, if you get an Arduino, the boot-loader is already there, and does its job automatically. You code your program on the PC, press the 'upload' button on the IDE, and within a few moments your program is running on the Arduino. The boot-loader does its job completely transparently.

fwiw, I personally have an Arduino 2009, and an STK-500 and can do on-the-metal programming on AVRs, but have found no need to bypass the Arduino's bootloader.

\$\endgroup\$
  • \$\begingroup\$ I'd love to see more info about using an Arduino to program an AVR. \$\endgroup\$ – Greg Jul 2 '10 at 16:49
  • \$\begingroup\$ news.jeelabs.org/2010/07/02/fixing-a-faulty-atmega-arduino \$\endgroup\$ – Toby Jaffey Jul 2 '10 at 18:05
  • \$\begingroup\$ @Greg there is actually an arduino supported sketch for the duemilanove to flash the bootloader onto a bare atmega328. Obviously, this functionality could be extended to flash any program onto a bare atmega328. You do not need an ISP connector. Essentially you turn your arduino micro into an ISP. \$\endgroup\$ – NickHalden Jun 15 '11 at 3:37
5
\$\begingroup\$

The Arduino needs a bootloader in order to program your sketches over serial/USB. Without it you need an AVR In-System-Programmer (ISP) to program the flash memory in the AVR chip directly.

If you buy an Arduino, it'll come with the bootloader already burnt into the AVR chip. You only need to worry about it if you're building your own board.

This should help: I don't get the Arduino concept

\$\endgroup\$
4
\$\begingroup\$

I'll give a slightly more theoretical answer; the other answers are quite good from a practical perspective. A bootloader is code that resides in a special segment of flash memory. Code that resides in that segment is allowed to execute Self-Programming Instructions, making it possible to modify flash memory (i.e. where user code resides) without a conventional programmer (i.e. In-System Programming ISP or High-Voltage Programming HVP) like the STK500 or AVRISP mkII.

In principle, the UART Recieve Data Interrupt Service Routine (ISR) makes a function call into the bootloader code that copies the program image being sent serially into the user program space in flash memory. At startup, whatever program is on the chip starts running, but if appropriately formed serial data is received early on, the AVR goes into a sort of self-programming mode. There is some logic in the UART ISR that only defers to the bootloader code for a short period of time during startup. The details are a bit more complicated than that, but that's the basic idea.

The beauty of this is that you can buy an Arduino, and nothing else, download the free Integrated Development Environment (IDE), and start writing Arduino Sketches (programs), and download them onto the AVR just like that, over USB no less thanks to the fancy little FTDI IC chip that's integrated into the Arduino board.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.