Pages: [1]   Go Down
Author Topic: what is a bootloader?  (Read 424 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 2
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My question is what exactly is a bootloader? From my understanding, it is some sort of program that lets you program your MCU with a serial connection, is that right? What are the advantages of a bootloader and how does one go about writing one? I know in Arduino it's as simple as clicking the "burn bootloader" button but I'm wondering what actually goes on, so I can implement it in other AVR programs (for example, when using chips that aren't supported by Arduino, or maybe if I decide to experiment with other microcontroller families).

Thanks!  smiley
Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you are correct

when you write one to the arduino what happens is that it loads up as a normal program at the beginning of program memory, then a couple fuses are set to "lock" the first X bytes so when you upload another program though it, it will not get overwritten.
Logged


Offline Offline
Jr. Member
**
Karma: 2
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh, so that's what stops it from being overwritten! What does it actually do though?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26350
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Oh, so that's what stops it from being overwritten! What does it actually do though?
The bootloader occupies a section of memory protected from being overwritten by the controller's hardware, i.e. the bootloader cannot overwrite itself, but an external programmer can.
Program code running in the rest of memory cannot overwrite either itself or the bootloader.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Jr. Member
**
Karma: 2
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was wondering about that. If I were to compile a program for the atmega328 with AVR-GCC, then upload it to the board using WINAVR and an   ISP, would the bootloader be erased then?
Logged

Poole, Dorset, UK
Offline Offline
Edison Member
*
Karma: 52
Posts: 2316
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A bootloader or bootstrap program is a short simple program which is run by a computer on startup (the one for a PC is called the BIOS).

The arduino bootload runs when the chip is restart it waits to see if a new program is being send from the PC, if so it loads it and starts it running, if not it gives control to the last program loaded.

Mark
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was wondering about that. If I were to compile a program for the atmega328 with AVR-GCC, then upload it to the board using WINAVR and an   ISP, would the bootloader be erased then?
Hi, I have a similar question but with a bit of a twist.
If I have an arduino (bootloader) loaded atmega328 and I write a program in the AVR-GCC...now is it possible to burn the code in the chip using the arduino bootloader? I mean, without using the arduino IDE and without using an ISP.....if I set the programmer as avrdude in the makefile then is it possible?
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18810
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, because the IDE uses avrdude to do exactly that. It uploads a .hex file using the bootloader, if requested.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, because the IDE uses avrdude to do exactly that. It uploads a .hex file using the bootloader, if requested.
Thanks Nick!  smiley

I have one more query, does the arduino bootloader for ATmega168 will work for ATmega16 without any changes?
If it won't, can you give me a hint as to what things need to be changed?
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18810
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not sure. The signature would be different. If it is running at 16 MHz it may not need much or any change to the actual bootloader.
Logged


Pages: [1]   Go Up
Jump to: