Skip to content

MiroslavVitkov/megaboot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Purpose
A minimalistic bootloader for the  Atmel mega168 microcontroller.

Advantages
+ Works out of the box for atmega168 under recent ubuntu.
+ Any serial terminal, that supports xmodem can be used. Tested with minicom. 
+ Fits into 512 bytes.
+ Reasonable error checking.
+ Fewer components and wires compared to an in system programmer. 
- Invoked through the application, thus loosing the ruggedness of an unchangable bootloader.
- Not universal at all. Try avrub for a configurable project, targeting many chips.
- Non-automatable program upload (at lest with minicom).

Preparation
sudo apt-get install cu lrzsz srecord gcc-avr avr-libc

Hardware
Connect Tx and Rx lines to a PC.
Use MAX232 for serial port communication.
Alternatively use an FT232 for USB communication.
The makefile programs the atmega8 to 8MHz internal oscillator - hence no need for external crystal.

Uploading
You need to move the chip to a separate PCB, connected to an In Circuit Programmer.
make
make fuses
make upload
Now the bootloader is programmed into the higher section of the flash (the application still begins at 0x0).
A minimal test program is programmed into the applications section.
This application will wait for a while and jump to the bootloader.
Before the countdawn expires, you need to initiate firmware transfer from the connected PC (that's how xmodem works).
The transferred file will overwrite the test application and from now on will be responsible for jumping to the bootloader.
If you application becomes corrupted for any reason and can't jump to the bootloader, you will need to use the serial programmer and repeat installing the bootloader.
You can use build/test.bin to test the xmodem upload process.

Building your application
avr-gcc yourapp.c
avr-objcopy -j .text -j .data -O binary yourapp.out yourapp.bin
The file that you send to the bootloader is yourapp.bin.

Contact
For any recommendations or questions:
Miroslav Vitkov
sir.vorac@gmail.com

Releases

No releases published

Packages

No packages published