Česká verze stránky o bootloaderu
Bootloader for ATmega8 and AVRprog
Content: Introduction - Features -
How to use it - Download
The presented bootloader (BootloaderDL5NEG.asm) for ATmega8 originates from the
http://www.dl5neg.de/bootloader/bootloader.html webpage, and I have modified it for my needs.
Bootloader enables to change contents of both program memory and EEPROM using AVRprog (AVR studio).
From AVRprog (AVR studio) viewpoint, the application together with bootloader looks like a programmer,
which can program only a single microcontroller (= self).
Before assembling and "burning" the bootloader, the user can choose:
- crystal frequency (in file BootloaderDL5NEG.asm parameter fCK)
- output for a LED (in file BootloaderDL5NEG.asm parametres LEDport / LEDbit)
- active level for the LED (in file BootloaderDL5NEG.asm parameter ActiveStatLED)
- control input to skip the bootloader (in file BootloaderDL5NEG.asm parametres TestPort / TestBit).
LEDport/LEDbit and TestPort/TestBit can of course be the same pin!
How to get the bootloader into the microcontroller
The basic problem is, that we need to get somehow the bootloader into ATmega8 first. For that, we need some other
programmer. As I did not have biprog yet, I used TSP-IC. As IC-prog does not support newer AVR processors,
I had to use PonyProg. To use PonyProg, I made an adapter.
Description of TSP-IC - PonyProg adapter:
REMARK: For TSP-IC in PonyProg user interface, inversion of RESET signal has to be switched on!
| || ||2||connect to 12
| || ||12||connect to 2
When programming the bootloader, PonyProg has to be set in the following way:
How to use the microcontroller with bootloader
Bootloader is used ideally in those applications, which are naturally connected to PC via serial port. An example of such is
biprog. I will use it as an example for the description, but it is similar for the other applications, too.
Here, I shall remark, that biprog is not the best example application for bootloader presentation anyway. It is a peculiar
application, being a programmer itself, and there are several LEDs to indicate its states while running, and also for possible
reuse for other applications. One of the LEDs (LED6) is dedicated for the bootloader. In "normal" applications, it is enough
to have a single LED, as described for the basic version of bootloader (BootloaderDL5NEG.asm). Biprog uses a different,
modified version of the bootloader - you can find it in the Download section.
Back to the bootloader description. Let's assume that we need to change the firmware of an application. The stk500.ebn
file cannot be used for the ATmega8-based HW, of course. I will not go into details with how to write or modify
an application firmware, but will assume that we already have a new version of the fimware in file "new_version.hex".
Now we have two options, how to "burn" the new fimware into the microcontroller, using the bootloader.
a) Using STK500 plugin menu command
In the Board window, click on the Upgrade button. The STK500 application ends and on biprog, LED1 and LED4 flash
momentarily. As soon as AVRProg starts, LED4 and LED6 light on permanently and on the monitor, the following
Using the Browse button, select the needed file (on picture, the file is already selected) and press button Program in Flash
window. The progress of programming is displayed, then a message on successful programming. Then press button Exit
and close the window using the right upper "x" (close window) icon. Firmware is successfully upgraded and we can try it.
If you want to use this method in your application, a jump to address THIRDBOOTSTART+3 has to be incorporated
to the application. Those who are knowledgeable enough to use it, will surely know how.
b) Pressing a button while resetting the microcontroller
After each reset, the microcontroller jumps to the beginning of the bootloader. A short routine there checks, whether
a button on input TestPort/TestBit is pressed (in case of biprog this is pin PC0). If the button is pressed, the bootloader
will go active. Otherwise, the program jumps to address 0, i.e. the beginning of the "firmware" - in this case
the microcontroller behaves as if no bootloader is present.
So, let's assume, that the button is pressed during reset. In this case, LED1 and LED4 start to flash and biprog will wait
for several seconds for AVRprog to be run. If run in time, LED4 and LED6 will be lit permanently, and the upgrade
can be made in exactly the same way as in case a).
If you are interested, download file BootloaderDL5NEG.asm .
Click the right mouse button and choose "Save target as ...".
99% of the file originates from Herbert Dingfelder, DL5NEG. The modified places are marked by the following comment:
Bootloader assembled with parameters set for biprog is in file BootloaderDL5NEG-biprog.hex.
Modified sources for biprog are in file
Again use the right mouse button and choose "Save target as ...".
Statistics since 16. 5. 2007
Sockets and supply board for "ISP" programming
Egon - Tiny USB-connected IR Receiver for Remote Control of PC
Please write your questions and remarks to the following address: firstname.lastname@example.org
Last updated 16. 5. 2007
Translated by wek at efton dot sk