Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Bootloader - what is it? Learning about i...etc.
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Bootloader - what is it? Learning about i...etc.

by qz9090 on Thu Jun 09, 2011 11:10 am

I hope I am posting this to the right area in the forums.

I have some questions about bootloaders and don't know how to address them. Incidentally,
I have a Boarduino,USBTiny and FTDI cable but I think my questions might apply to any set-up.

1) What is a boot loader?
2) what does it do?
3) Is it written in C or the Arduino sketch language?
4) Can an Atmega, for example, run without a bootloader?
5) Are there any links or other resources I can look at online that would
help me learn more about bootloaders?


Thanks.
qz9090
 
Posts: 16
Joined: Thu May 19, 2011 4:09 pm

Re: Bootloader - what is it? Learning about i...etc.

by tastewar on Thu Jun 09, 2011 12:55 pm


tastewar
 
Posts: 365
Joined: Thu Mar 17, 2011 10:16 am

Re: Bootloader - what is it? Learning about i...etc.

by qz9090 on Thu Jun 09, 2011 5:32 pm

Yes, thanks 'tasetwar'. I had seen these pages before but being new to all this, some (or shall I say most) of it is not real clear to me.

For example, what are the bootloaders written in?

I thought I had read that it is just another sketch. Is that true?

There are various bootloaders, how does one determine which one is best? ADABoot, NG, Duemillanove...?

I have also heard that you do not need a bootloader, that you can load your sketch to the Atmega with a programmer (like the USBTinyISP). Is that true?

Thanks.
qz9090
 
Posts: 16
Joined: Thu May 19, 2011 4:09 pm

Re: Bootloader - what is it? Learning about i...etc.

by tastewar on Thu Jun 09, 2011 7:15 pm

OK, I'm no expert qz9900, but the bootloader is code that resides on the uC that allows you to upload new programs to it via the USB/serial port. Without it, you need an external programmer to load code onto the uC.

tastewar
 
Posts: 365
Joined: Thu Mar 17, 2011 10:16 am

Re: Bootloader - what is it? Learning about i...etc.

by westfw on Thu Jun 09, 2011 7:27 pm

1) What is a boot loader? 2) what does it do?

A bootloader is a small piece of software for <some sort of computer> that is used to load larger pieces of software onto that computer. The phrases comes from "lifting yourself up by your own bootstraps", a rather obsolete phrase. It dates back to mainframes where you could key in a bootstrap on switches that would load a larger program from paper tape...

A bootstrap differs from "flash programming" in that it IS a program running on the destination computer, and the communications channel used and details of the destination memory/etc can be determined by the bootloader software rather than the details of the computer hardware. For example, the same bootloader can be used on on AVRs that have SPI, JTAG, or PDI based flash programming.

3) Is it written in C or the Arduino sketch language?

Theoretically, a bootloader can be written in any language. All of the current Arduino bootloaders are written in C.

4) Can an Atmega, for example, run without a bootloader?

Yes. You can program directly to the flash memory using a suitable device programmer, given the correct device programmer, and software for your host system that supports that programmer. One reason for bootloaders has been that the actual device programmers for some microcontrollers were expensive, proprietary, slow, and only supported on a single operating system.

5) Are there any links or other resources I can look at online that would help me learn more about bootloaders
?
Atmel has a couple app-notes describing self-programming and bootloaders.
http://www.atmel.com/dyn/resources/prod ... oc1644.pdf
http://www.atmel.com/dyn/resources/prod ... oc2568.pdf
(and anything that mentions the phrase "bootloader." And the datasheets where they talk about bootloader support.)

There are various bootloaders, how does one determine which one is best?

You have to have criteria for defining "best." If you want the most room for your sketch, optiboot is about 1.5k smaller than any other bootloader. But if you want to use the "board types" in the IDE menu, you should stick with whichever bootloader was originally shipped on that board...

westfw
 
Posts: 1731
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Re: Bootloader - what is it? Learning about i...etc.

by bigmessowires on Sat Nov 05, 2011 1:22 am

westfw wrote:One reason for bootloaders has been that the actual device programmers for some microcontrollers were expensive, proprietary, slow, and only supported on a single operating system.


That's always been my understanding too. But at least in the Arduino/AVR world, the cost of a "real" programmer is no more than the cost of the hardware needed to use with a bootloader. So I've never understood the popularity of using bootloaders. Especially since if you use a bootloader, you must permanently give up some of your device's program memory space for it.

Adafruit's USBTinyISP is a real programmer for $22. http://www.adafruit.com/category/16
The FTDI USB-to-Serial cable traditionally used for bootloading AVRs is $20. https://www.adafruit.com/products/70
bigmessowires
 
Posts: 69
Joined: Sun Jun 05, 2011 7:34 pm
Location: San Francisco

Re: Bootloader - what is it? Learning about i...etc.

by westfw on Sat Nov 05, 2011 2:34 am

at least in the Arduino/AVR world, the cost of a "real" programmer is no more than the cost of the hardware needed to use with a bootloader.

That's NOW, and for a "hobbyist class" programmer at that. I remember being overjoyed to be able to buy a 6805 development board (roughly comparable to Arduino; (builtin) bootloader based) for $68.05 :-) A more traditional device programmer would be something like an STK-500 at about $85, STK-600 at $200, USBProg2 (for PICs) at $125, and similar...

And the (Arduino) bootloader also works with $1 worth of analog components on a serial port (if you still have one.) No expensive USB cable required. (And the official FTDI USB cable is very comparable in pricing strategy/etc to the "real" programmers I mention.)

Not all bootloaders take up flash space, BTW. Some chips give you a bit of old-style ROM containing a bootloader...

westfw
 
Posts: 1731
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Re: Bootloader - what is it? Learning about i...etc.

by meseta on Sun Nov 13, 2011 2:46 pm

Not all bootloaders take up flash space, BTW. Some chips give you a bit of old-style ROM containing a bootloader...


We use microcontrollers that have a USB bootloader in ROM, never have to worry about the bootloader again. It's the NXP LPC1343, an 32-bit ARM Cortex-M3 chip clocked at 72MHz. Cost about $5. Add three resistors and a USB port, and you've got yourself a microcontroller that pops up on the computer as a flash drive ready for you to drop compiled firmware into.

The ROM even has a simple USB HID and HID MSC (mass storage) implementation in it, so you can easily make raw USB HID applications, and USB storage applications without using extra flash space for either bootloader or USB stack.

No need for a separate programmer, or special cable, or special USB-serial IC.

THAT is the state of modern microcontrollers. I hear Arduino are bringing their line of products upt to date, but we're not waiting for that, we have our own boards.
meseta
 
Posts: 82
Joined: Tue Aug 02, 2011 7:57 pm

Re: Bootloader - what is it? Learning about i...etc.

by westfw on Sun Nov 13, 2011 8:57 pm

Did you hear that the latest NXP USB Drivers are a port of Dean Camera's LUFA (Lightweight USB Framework for AVRs) (originally developed for Atmel 8bit chips.)

That's SO cool in so many ways...

http://www.avrfreaks.net/index.php?name ... c&t=113573

A bunch of 8051-class and 6805-like microcontrollers had serial bootloaders in ROM, a long time ago. Except they had other obnoxious programming requirements, like needing a high voltage, a particular crystal frequency, and obscure serial data protocols. (OK, not really that different than an AVR bootloader, but ... not replaceable and not recompilable by a customer for different parameters.

westfw
 
Posts: 1731
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Re: Bootloader - what is it? Learning about i...etc.

by meseta on Mon Nov 14, 2011 8:26 am

Yeah I heard. Neat. Except I had already developed my own USB stack for the LPC1343. But, the LUFA port to NXP devices didn't support the LPC1343, so I may be contributing my code if one doesn't turn up at some point.
meseta
 
Posts: 82
Joined: Tue Aug 02, 2011 7:57 pm

Please be positive and constructive with your questions and comments.