aboutsummaryrefslogtreecommitdiff
path: root/bootloaders/atmega168
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2009-03-24 10:41:46 +0000
committerDavid A. Mellis <d.mellis@arduino.cc>2009-03-24 10:41:46 +0000
commitb89ee8da481d7b9c360b689f367b7a234ec7cb11 (patch)
tree3f00f634f41fafaa2879247b9c1a5da30bf3e3ec /bootloaders/atmega168
parentbb1c655273bf11ccc3811b301cba030cdee8453e (diff)
Renaming atmega168 bootloader directory to atmega since it's no longer atmega168 specific. Updating boards.txt accordingly.
Diffstat (limited to 'bootloaders/atmega168')
-rwxr-xr-xbootloaders/atmega168/ATmegaBOOT_168.c992
-rw-r--r--bootloaders/atmega168/ATmegaBOOT_168_atmega328.hex125
-rw-r--r--bootloaders/atmega168/ATmegaBOOT_168_diecimila.hex126
-rw-r--r--bootloaders/atmega168/ATmegaBOOT_168_ng.hex110
-rw-r--r--bootloaders/atmega168/ATmegaBOOT_168_pro_8MHz.hex126
-rwxr-xr-xbootloaders/atmega168/Makefile194
6 files changed, 0 insertions, 1673 deletions
diff --git a/bootloaders/atmega168/ATmegaBOOT_168.c b/bootloaders/atmega168/ATmegaBOOT_168.c
deleted file mode 100755
index 9413f86..0000000
--- a/bootloaders/atmega168/ATmegaBOOT_168.c
+++ /dev/null
@@ -1,992 +0,0 @@
-/**********************************************************/
-/* Serial Bootloader for Atmel megaAVR Controllers */
-/* */
-/* tested with ATmega8, ATmega128 and ATmega168 */
-/* should work with other mega's, see code for details */
-/* */
-/* ATmegaBOOT.c */
-/* */
-/* 20070626: hacked for Arduino Diecimila (which auto- */
-/* resets when a USB connection is made to it) */
-/* by D. Mellis */
-/* 20060802: hacked for Arduino by D. Cuartielles */
-/* based on a previous hack by D. Mellis */
-/* and D. Cuartielles */
-/* */
-/* Monitor and debug functions were added to the original */
-/* code by Dr. Erik Lins, chip45.com. (See below) */
-/* */
-/* Thanks to Karl Pitrich for fixing a bootloader pin */
-/* problem and more informative LED blinking! */
-/* */
-/* For the latest version see: */
-/* http://www.chip45.com/ */
-/* */
-/* ------------------------------------------------------ */
-/* */
-/* based on stk500boot.c */
-/* Copyright (c) 2003, Jason P. Kyle */
-/* All rights reserved. */
-/* see avr1.org for original file and information */
-/* */
-/* This program is free software; you can redistribute it */
-/* and/or modify it under the terms of the GNU General */
-/* Public License as published by the Free Software */
-/* Foundation; either version 2 of the License, or */
-/* (at your option) any later version. */
-/* */
-/* This program is distributed in the hope that it will */
-/* be useful, but WITHOUT ANY WARRANTY; without even the */
-/* implied warranty of MERCHANTABILITY or FITNESS FOR A */
-/* PARTICULAR PURPOSE. See the GNU General Public */
-/* License for more details. */
-/* */
-/* You should have received a copy of the GNU General */
-/* Public License along with this program; if not, write */
-/* to the Free Software Foundation, Inc., */
-/* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/* */
-/* Licence can be viewed at */
-/* http://www.fsf.org/licenses/gpl.txt */
-/* */
-/* Target = Atmel AVR m128,m64,m32,m16,m8,m162,m163,m169, */
-/* m8515,m8535. ATmega161 has a very small boot block so */
-/* isn't supported. */
-/* */
-/* Tested with m168 */
-/**********************************************************/
-
-/* $Id$ */
-
-
-/* some includes */
-#include <inttypes.h>
-#include <avr/io.h>
-#include <avr/pgmspace.h>
-#include <avr/interrupt.h>
-#include <avr/wdt.h>
-#include <util/delay.h>
-
-/* the current avr-libc eeprom functions do not support the ATmega168 */
-/* own eeprom write/read functions are used instead */
-#if !defined(__AVR_ATmega168__) || !defined(__AVR_ATmega328P__)
-#include <avr/eeprom.h>
-#endif
-
-/* Use the F_CPU defined in Makefile */
-
-/* 20060803: hacked by DojoCorp */
-/* 20070626: hacked by David A. Mellis to decrease waiting time for auto-reset */
-/* set the waiting time for the bootloader */
-/* get this from the Makefile instead */
-/* #define MAX_TIME_COUNT (F_CPU>>4) */
-
-/* 20070707: hacked by David A. Mellis - after this many errors give up and launch application */
-#define MAX_ERROR_COUNT 5
-
-/* set the UART baud rate */
-/* 20060803: hacked by DojoCorp */
-//#define BAUD_RATE 115200
-#ifndef BAUD_RATE
-#define BAUD_RATE 19200
-#endif
-
-
-/* SW_MAJOR and MINOR needs to be updated from time to time to avoid warning message from AVR Studio */
-/* never allow AVR Studio to do an update !!!! */
-#define HW_VER 0x02
-#define SW_MAJOR 0x01
-#define SW_MINOR 0x10
-
-
-/* Adjust to suit whatever pin your hardware uses to enter the bootloader */
-/* ATmega128 has two UARTS so two pins are used to enter bootloader and select UART */
-/* BL0... means UART0, BL1... means UART1 */
-#ifdef __AVR_ATmega128__
-#define BL_DDR DDRF
-#define BL_PORT PORTF
-#define BL_PIN PINF
-#define BL0 PINF7
-#define BL1 PINF6
-#else
-/* other ATmegas have only one UART, so only one pin is defined to enter bootloader */
-#define BL_DDR DDRD
-#define BL_PORT PORTD
-#define BL_PIN PIND
-#define BL PIND6
-#endif
-
-
-/* onboard LED is used to indicate, that the bootloader was entered (3x flashing) */
-/* if monitor functions are included, LED goes on after monitor was entered */
-#ifdef __AVR_ATmega128__
-/* Onboard LED is connected to pin PB7 (e.g. Crumb128, PROBOmega128, Savvy128) */
-#define LED_DDR DDRB
-#define LED_PORT PORTB
-#define LED_PIN PINB
-#define LED PINB7
-#else
-/* Onboard LED is connected to pin PB2 (e.g. Crumb8, Crumb168) */
-#define LED_DDR DDRB
-#define LED_PORT PORTB
-#define LED_PIN PINB
-/* 20060803: hacked by DojoCorp, LED pin is B5 in Arduino */
-/* #define LED PINB2 */
-#define LED PINB5
-#endif
-
-
-/* monitor functions will only be compiled when using ATmega128, due to bootblock size constraints */
-#ifdef __AVR_ATmega128__
-#define MONITOR
-#endif
-
-
-/* define various device id's */
-/* manufacturer byte is always the same */
-#define SIG1 0x1E // Yep, Atmel is the only manufacturer of AVR micros. Single source :(
-
-#if defined __AVR_ATmega128__
-#define SIG2 0x97
-#define SIG3 0x02
-#define PAGE_SIZE 0x80U //128 words
-
-#elif defined __AVR_ATmega64__
-#define SIG2 0x96
-#define SIG3 0x02
-#define PAGE_SIZE 0x80U //128 words
-
-#elif defined __AVR_ATmega32__
-#define SIG2 0x95
-#define SIG3 0x02
-#define PAGE_SIZE 0x40U //64 words
-
-#elif defined __AVR_ATmega16__
-#define SIG2 0x94
-#define SIG3 0x03
-#define PAGE_SIZE 0x40U //64 words
-
-#elif defined __AVR_ATmega8__
-#define SIG2 0x93
-#define SIG3 0x07
-#define PAGE_SIZE 0x20U //32 words
-
-#elif defined __AVR_ATmega88__
-#define SIG2 0x93
-#define SIG3 0x0a
-#define PAGE_SIZE 0x20U //32 words
-
-#elif defined __AVR_ATmega168__
-#define SIG2 0x94
-#define SIG3 0x06
-#define PAGE_SIZE 0x40U //64 words
-
-#elif defined __AVR_ATmega328P__
-#define SIG2 0x95
-#define SIG3 0x0F
-#define PAGE_SIZE 0x40U //64 words
-
-#elif defined __AVR_ATmega162__
-#define SIG2 0x94
-#define SIG3 0x04
-#define PAGE_SIZE 0x40U //64 words
-
-#elif defined __AVR_ATmega163__
-#define SIG2 0x94
-#define SIG3 0x02
-#define PAGE_SIZE 0x40U //64 words
-
-#elif defined __AVR_ATmega169__
-#define SIG2 0x94
-#define SIG3 0x05
-#define PAGE_SIZE 0x40U //64 words
-
-#elif defined __AVR_ATmega8515__
-#define SIG2 0x93
-#define SIG3 0x06
-#define PAGE_SIZE 0x20U //32 words
-
-#elif defined __AVR_ATmega8535__
-#define SIG2 0x93
-#define SIG3 0x08
-#define PAGE_SIZE 0x20U //32 words
-#endif
-
-
-/* function prototypes */
-void putch(char);
-char getch(void);
-void getNch(uint8_t);
-void byte_response(uint8_t);
-void nothing_response(void);
-char gethex(void);
-void puthex(char);
-void flash_led(uint8_t);
-
-/* some variables */
-union address_union {
- uint16_t word;
- uint8_t byte[2];
-} address;
-
-union length_union {
- uint16_t word;
- uint8_t byte[2];
-} length;
-
-struct flags_struct {
- unsigned eeprom : 1;
- unsigned rampz : 1;
-} flags;
-
-uint8_t buff[256];
-uint8_t address_high;
-
-uint8_t pagesz=0x80;
-
-uint8_t i;
-uint8_t bootuart = 0;
-
-uint8_t error_count = 0;
-
-void (*app_start)(void) = 0x0000;
-
-
-/* main program starts here */
-int main(void)
-{
- uint8_t ch,ch2;
- uint16_t w;
-
-#ifdef WATCHDOG_MODS
- ch = MCUSR;
- MCUSR = 0;
-
- WDTCSR |= _BV(WDCE) | _BV(WDE);
- WDTCSR = 0;
-
- // Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
- if (! (ch & _BV(EXTRF))) // if its a not an external reset...
- app_start(); // skip bootloader
-#else
- asm volatile("nop\n\t");
-#endif
-
- /* set pin direction for bootloader pin and enable pullup */
- /* for ATmega128, two pins need to be initialized */
-#ifdef __AVR_ATmega128__
- BL_DDR &= ~_BV(BL0);
- BL_DDR &= ~_BV(BL1);
- BL_PORT |= _BV(BL0);
- BL_PORT |= _BV(BL1);
-#else
- /* We run the bootloader regardless of the state of this pin. Thus, don't
- put it in a different state than the other pins. --DAM, 070709
- BL_DDR &= ~_BV(BL);
- BL_PORT |= _BV(BL);
- */
-#endif
-
-
-#ifdef __AVR_ATmega128__
- /* check which UART should be used for booting */
- if(bit_is_clear(BL_PIN, BL0)) {
- bootuart = 1;
- }
- else if(bit_is_clear(BL_PIN, BL1)) {
- bootuart = 2;
- }
-#endif
-
- /* check if flash is programmed already, if not start bootloader anyway */
- if(pgm_read_byte_near(0x0000) != 0xFF) {
-
-#ifdef __AVR_ATmega128__
- /* no UART was selected, start application */
- if(!bootuart) {
- app_start();
- }
-#else
- /* check if bootloader pin is set low */
- /* we don't start this part neither for the m8, nor m168 */
- //if(bit_is_set(BL_PIN, BL)) {
- // app_start();
- //}
-#endif
- }
-
-#ifdef __AVR_ATmega128__
- /* no bootuart was selected, default to uart 0 */
- if(!bootuart) {
- bootuart = 1;
- }
-#endif
-
-
- /* initialize UART(s) depending on CPU defined */
-#ifdef __AVR_ATmega128__
- if(bootuart == 1) {
- UBRR0L = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1);
- UBRR0H = (F_CPU/(BAUD_RATE*16L)-1) >> 8;
- UCSR0A = 0x00;
- UCSR0C = 0x06;
- UCSR0B = _BV(TXEN0)|_BV(RXEN0);
- }
- if(bootuart == 2) {
- UBRR1L = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1);
- UBRR1H = (F_CPU/(BAUD_RATE*16L)-1) >> 8;
- UCSR1A = 0x00;
- UCSR1C = 0x06;
- UCSR1B = _BV(TXEN1)|_BV(RXEN1);
- }
-#elif defined __AVR_ATmega163__
- UBRR = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1);
- UBRRHI = (F_CPU/(BAUD_RATE*16L)-1) >> 8;
- UCSRA = 0x00;
- UCSRB = _BV(TXEN)|_BV(RXEN);
-#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
- UBRR0L = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1);
- UBRR0H = (F_CPU/(BAUD_RATE*16L)-1) >> 8;
- UCSR0B = (1<<RXEN0) | (1<<TXEN0);
- UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
-
- /* Enable internal pull-up resistor on pin D0 (RX), in order
- to supress line noise that prevents the bootloader from
- timing out (DAM: 20070509) */
- DDRD &= ~_BV(PIND0);
- PORTD |= _BV(PIND0);
-#elif defined __AVR_ATmega8__
- /* m8 */
- UBRRH = (((F_CPU/BAUD_RATE)/16)-1)>>8; // set baud rate
- UBRRL = (((F_CPU/BAUD_RATE)/16)-1);
- UCSRB = (1<<RXEN)|(1<<TXEN); // enable Rx & Tx
- UCSRC = (1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0); // config USART; 8N1
-#else
- /* m16,m32,m169,m8515,m8535 */
- UBRRL = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1);
- UBRRH = (F_CPU/(BAUD_RATE*16L)-1) >> 8;
- UCSRA = 0x00;
- UCSRC = 0x06;
- UCSRB = _BV(TXEN)|_BV(RXEN);
-#endif
-
- /* set LED pin as output */
- LED_DDR |= _BV(LED);
-
-
- /* flash onboard LED to signal entering of bootloader */
-#ifdef __AVR_ATmega128__
- // 4x for UART0, 5x for UART1
- flash_led(NUM_LED_FLASHES + bootuart);
-#else
- flash_led(NUM_LED_FLASHES);
-#endif
-
- /* 20050803: by DojoCorp, this is one of the parts provoking the
- system to stop listening, cancelled from the original */
- //putch('\0');
-
-
- /* forever loop */
- for (;;) {
-
- /* get character from UART */
- ch = getch();
-
- /* A bunch of if...else if... gives smaller code than switch...case ! */
-
- /* Hello is anyone home ? */
- if(ch=='0') {
- nothing_response();
- }
-
-
- /* Request programmer ID */
- /* Not using PROGMEM string due to boot block in m128 being beyond 64kB boundry */
- /* Would need to selectively manipulate RAMPZ, and it's only 9 characters anyway so who cares. */
- else if(ch=='1') {
- if (getch() == ' ') {
- putch(0x14);
- putch('A');
- putch('V');
- putch('R');
- putch(' ');
- putch('I');
- putch('S');
- putch('P');
- putch(0x10);
- } else {
- if (++error_count == MAX_ERROR_COUNT)
- app_start();
- }
- }
-
-
- /* AVR ISP/STK500 board commands DON'T CARE so default nothing_response */
- else if(ch=='@') {
- ch2 = getch();
- if (ch2>0x85) getch();
- nothing_response();
- }
-
-
- /* AVR ISP/STK500 board requests */
- else if(ch=='A') {
- ch2 = getch();
- if(ch2==0x80) byte_response(HW_VER); // Hardware version
- else if(ch2==0x81) byte_response(SW_MAJOR); // Software major version
- else if(ch2==0x82) byte_response(SW_MINOR); // Software minor version
- else if(ch2==0x98) byte_response(0x03); // Unknown but seems to be required by avr studio 3.56
- else byte_response(0x00); // Covers various unnecessary responses we don't care about
- }
-
-
- /* Device Parameters DON'T CARE, DEVICE IS FIXED */
- else if(ch=='B') {
- getNch(20);
- nothing_response();
- }
-
-
- /* Parallel programming stuff DON'T CARE */
- else if(ch=='E') {
- getNch(5);
- nothing_response();
- }
-
-
- /* P: Enter programming mode */
- /* R: Erase device, don't care as we will erase one page at a time anyway. */
- else if(ch=='P' || ch=='R') {
- nothing_response();
- }
-
-
- /* Leave programming mode */
- else if(ch=='Q') {
- nothing_response();
-#ifdef WATCHDOG_MODS
- // autoreset via watchdog (sneaky!)
- WDTCSR = _BV(WDE);
- while (1); // 16 ms
-#endif
- }
-
-
- /* Set address, little endian. EEPROM in bytes, FLASH in words */
- /* Perhaps extra address bytes may be added in future to support > 128kB FLASH. */
- /* This might explain why little endian was used here, big endian used everywhere else. */
- else if(ch=='U') {
- address.byte[0] = getch();
- address.byte[1] = getch();
- nothing_response();
- }
-
-
- /* Universal SPI programming command, disabled. Would be used for fuses and lock bits. */
- else if(ch=='V') {
- if (getch() == 0x30) {
- getch();
- ch = getch();
- getch();
- if (ch == 0) {
- byte_response(SIG1);
- } else if (ch == 1) {
- byte_response(SIG2);
- } else {
- byte_response(SIG3);
- }
- } else {
- getNch(3);
- byte_response(0x00);
- }
- }
-
-
- /* Write memory, length is big endian and is in bytes */
- else if(ch=='d') {
- length.byte[1] = getch();
- length.byte[0] = getch();
- flags.eeprom = 0;
- if (getch() == 'E') flags.eeprom = 1;
- for (w=0;w<length.word;w++) {
- buff[w] = getch(); // Store data in buffer, can't keep up with serial data stream whilst programming pages
- }
- if (getch() == ' ') {
- if (flags.eeprom) { //Write to EEPROM one byte at a time
- address.word <<= 1;
- for(w=0;w<length.word;w++) {
-#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
- while(EECR & (1<<EEPE));
- EEAR = (uint16_t)(void *)address.word;
- EEDR = buff[w];
- EECR |= (1<<EEMPE);
- EECR |= (1<<EEPE);
-#else
- eeprom_write_byte((void *)address.word,buff[w]);
-#endif
- address.word++;
- }
- }
- else { //Write to FLASH one page at a time
- if (address.byte[1]>127) address_high = 0x01; //Only possible with m128, m256 will need 3rd address byte. FIXME
- else address_high = 0x00;
-#ifdef __AVR_ATmega128__
- RAMPZ = address_high;
-#endif
- address.word = address.word << 1; //address * 2 -> byte location
- /* if ((length.byte[0] & 0x01) == 0x01) length.word++; //Even up an odd number of bytes */
- if ((length.byte[0] & 0x01)) length.word++; //Even up an odd number of bytes
- cli(); //Disable interrupts, just to be sure
- // HACKME: EEPE used to be EEWE
- while(bit_is_set(EECR,EEPE)); //Wait for previous EEPROM writes to complete
- asm volatile(
- "clr r17 \n\t" //page_word_count
- "lds r30,address \n\t" //Address of FLASH location (in bytes)
- "lds r31,address+1 \n\t"
- "ldi r28,lo8(buff) \n\t" //Start of buffer array in RAM
- "ldi r29,hi8(buff) \n\t"
- "lds r24,length \n\t" //Length of data to be written (in bytes)
- "lds r25,length+1 \n\t"
- "length_loop: \n\t" //Main loop, repeat for number of words in block
- "cpi r17,0x00 \n\t" //If page_word_count=0 then erase page
- "brne no_page_erase \n\t"
- "wait_spm1: \n\t"
- "lds r16,%0 \n\t" //Wait for previous spm to complete
- "andi r16,1 \n\t"
- "cpi r16,1 \n\t"
- "breq wait_spm1 \n\t"
- "ldi r16,0x03 \n\t" //Erase page pointed to by Z
- "sts %0,r16 \n\t"
- "spm \n\t"
-#ifdef __AVR_ATmega163__
- ".word 0xFFFF \n\t"
- "nop \n\t"
-#endif
- "wait_spm2: \n\t"
- "lds r16,%0 \n\t" //Wait for previous spm to complete
- "andi r16,1 \n\t"
- "cpi r16,1 \n\t"
- "breq wait_spm2 \n\t"
-
- "ldi r16,0x11 \n\t" //Re-enable RWW section
- "sts %0,r16 \n\t"
- "spm \n\t"
-#ifdef __AVR_ATmega163__
- ".word 0xFFFF \n\t"
- "nop \n\t"
-#endif
- "no_page_erase: \n\t"
- "ld r0,Y+ \n\t" //Write 2 bytes into page buffer
- "ld r1,Y+ \n\t"
-
- "wait_spm3: \n\t"
- "lds r16,%0 \n\t" //Wait for previous spm to complete
- "andi r16,1 \n\t"
- "cpi r16,1 \n\t"
- "breq wait_spm3 \n\t"
- "ldi r16,0x01 \n\t" //Load r0,r1 into FLASH page buffer
- "sts %0,r16 \n\t"
- "spm \n\t"
-
- "inc r17 \n\t" //page_word_count++
- "cpi r17,%1 \n\t"
- "brlo same_page \n\t" //Still same page in FLASH
- "write_page: \n\t"
- "clr r17 \n\t" //New page, write current one first
- "wait_spm4: \n\t"
- "lds r16,%0 \n\t" //Wait for previous spm to complete
- "andi r16,1 \n\t"
- "cpi r16,1 \n\t"
- "breq wait_spm4 \n\t"
-#ifdef __AVR_ATmega163__
- "andi r30,0x80 \n\t" // m163 requires Z6:Z1 to be zero during page write
-#endif
- "ldi r16,0x05 \n\t" //Write page pointed to by Z
- "sts %0,r16 \n\t"
- "spm \n\t"
-#ifdef __AVR_ATmega163__
- ".word 0xFFFF \n\t"
- "nop \n\t"
- "ori r30,0x7E \n\t" // recover Z6:Z1 state after page write (had to be zero during write)
-#endif
- "wait_spm5: \n\t"
- "lds r16,%0 \n\t" //Wait for previous spm to complete
- "andi r16,1 \n\t"
- "cpi r16,1 \n\t"
- "breq wait_spm5 \n\t"
- "ldi r16,0x11 \n\t" //Re-enable RWW section
- "sts %0,r16 \n\t"
- "spm \n\t"
-#ifdef __AVR_ATmega163__
- ".word 0xFFFF \n\t"
- "nop \n\t"
-#endif
- "same_page: \n\t"
- "adiw r30,2 \n\t" //Next word in FLASH
- "sbiw r24,2 \n\t" //length-2
- "breq final_write \n\t" //Finished
- "rjmp length_loop \n\t"
- "final_write: \n\t"
- "cpi r17,0 \n\t"
- "breq block_done \n\t"
- "adiw r24,2 \n\t" //length+2, fool above check on length after short page write
- "rjmp write_page \n\t"
- "block_done: \n\t"
- "clr __zero_reg__ \n\t" //restore zero register
-#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
- : "=m" (SPMCSR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
-#else
- : "=m" (SPMCR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
-#endif
- );
- /* Should really add a wait for RWW section to be enabled, don't actually need it since we never */
- /* exit the bootloader without a power cycle anyhow */
- }
- putch(0x14);
- putch(0x10);
- } else {
- if (++error_count == MAX_ERROR_COUNT)
- app_start();
- }
- }
-
-
- /* Read memory block mode, length is big endian. */
- else if(ch=='t') {
- length.byte[1] = getch();
- length.byte[0] = getch();
-#if defined __AVR_ATmega128__
- if (address.word>0x7FFF) flags.rampz = 1; // No go with m256, FIXME
- else flags.rampz = 0;
-#endif
- address.word = address.word << 1; // address * 2 -> byte location
- if (getch() == 'E') flags.eeprom = 1;
- else flags.eeprom = 0;
- if (getch() == ' ') { // Command terminator
- putch(0x14);
- for (w=0;w < length.word;w++) { // Can handle odd and even lengths okay
- if (flags.eeprom) { // Byte access EEPROM read
-#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
- while(EECR & (1<<EEPE));
- EEAR = (uint16_t)(void *)address.word;
- EECR |= (1<<EERE);
- putch(EEDR);
-#else
- putch(eeprom_read_byte((void *)address.word));
-#endif
- address.word++;
- }
- else {
-
- if (!flags.rampz) putch(pgm_read_byte_near(address.word));
-#if defined __AVR_ATmega128__
- else putch(pgm_read_byte_far(address.word + 0x10000));
- // Hmmmm, yuck FIXME when m256 arrvies
-#endif
- address.word++;
- }
- }
- putch(0x10);
- }
- }
-
-
- /* Get device signature bytes */
- else if(ch=='u') {
- if (getch() == ' ') {
- putch(0x14);
- putch(SIG1);
- putch(SIG2);
- putch(SIG3);
- putch(0x10);
- } else {
- if (++error_count == MAX_ERROR_COUNT)
- app_start();
- }
- }
-
-
- /* Read oscillator calibration byte */
- else if(ch=='v') {
- byte_response(0x00);
- }
-
-
-#ifdef MONITOR
-
- /* here come the extended monitor commands by Erik Lins */
-
- /* check for three times exclamation mark pressed */
- else if(ch=='!') {
- ch = getch();
- if(ch=='!') {
- ch = getch();
- if(ch=='!') {
-
-#ifdef __AVR_ATmega128__
- uint16_t extaddr;
-#endif
- uint8_t addrl, addrh;
-
-#ifdef CRUMB128
- PGM_P welcome = {"ATmegaBOOT / Crumb128 - (C) J.P.Kyle, E.Lins - 050815\n\r"};
-#elif defined PROBOMEGA128
- PGM_P welcome = {"ATmegaBOOT / PROBOmega128 - (C) J.P.Kyle, E.Lins - 050815\n\r"};
-#elif defined SAVVY128
- PGM_P welcome = {"ATmegaBOOT / Savvy128 - (C) J.P.Kyle, E.Lins - 050815\n\r"};
-#endif
-
- /* turn on LED */
- LED_DDR |= _BV(LED);
- LED_PORT &= ~_BV(LED);
-
- /* print a welcome message and command overview */
- for(i=0; welcome[i] != '\0'; ++i) {
- putch(welcome[i]);
- }
-
- /* test for valid commands */
- for(;;) {
- putch('\n');
- putch('\r');
- putch(':');
- putch(' ');
-
- ch = getch();
- putch(ch);
-
- /* toggle LED */
- if(ch == 't') {
- if(bit_is_set(LED_PIN,LED)) {
- LED_PORT &= ~_BV(LED);
- putch('1');
- } else {
- LED_PORT |= _BV(LED);
- putch('0');
- }
- }
-
- /* read byte from address */
- else if(ch == 'r') {
- ch = getch(); putch(ch);
- addrh = gethex();
- addrl = gethex();
- putch('=');
- ch = *(uint8_t *)((addrh << 8) + addrl);
- puthex(ch);
- }
-
- /* write a byte to address */
- else if(ch == 'w') {
- ch = getch(); putch(ch);
- addrh = gethex();
- addrl = gethex();
- ch = getch(); putch(ch);
- ch = gethex();
- *(uint8_t *)((addrh << 8) + addrl) = ch;
- }
-
- /* read from uart and echo back */
- else if(ch == 'u') {
- for(;;) {
- putch(getch());
- }
- }
-#ifdef __AVR_ATmega128__
- /* external bus loop */
- else if(ch == 'b') {
- putch('b');
- putch('u');
- putch('s');
- MCUCR = 0x80;
- XMCRA = 0;
- XMCRB = 0;
- extaddr = 0x1100;
- for(;;) {
- ch = *(volatile uint8_t *)extaddr;
- if(++extaddr == 0) {
- extaddr = 0x1100;
- }
- }
- }
-#endif
-
- else if(ch == 'j') {
- app_start();
- }
-
- } /* end of monitor functions */
-
- }
- }
- }
- /* end of monitor */
-#endif
- else if (++error_count == MAX_ERROR_COUNT) {
- app_start();
- }
- } /* end of forever loop */
-
-}
-
-
-char gethexnib(void) {
- char a;
- a = getch(); putch(a);
- if(a >= 'a') {
- return (a - 'a' + 0x0a);
- } else if(a >= '0') {
- return(a - '0');
- }
- return a;
-}
-
-
-char gethex(void) {
- return (gethexnib() << 4) + gethexnib();
-}
-
-
-void puthex(char ch) {
- char ah;
-
- ah = ch >> 4;
- if(ah >= 0x0a) {
- ah = ah - 0x0a + 'a';
- } else {
- ah += '0';
- }
-
- ch &= 0x0f;
- if(ch >= 0x0a) {
- ch = ch - 0x0a + 'a';
- } else {
- ch += '0';
- }
-
- putch(ah);
- putch(ch);
-}
-
-
-void putch(char ch)
-{
-#ifdef __AVR_ATmega128__
- if(bootuart == 1) {
- while (!(UCSR0A & _BV(UDRE0)));
- UDR0 = ch;
- }
- else if (bootuart == 2) {
- while (!(UCSR1A & _BV(UDRE1)));
- UDR1 = ch;
- }
-#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
- while (!(UCSR0A & _BV(UDRE0)));
- UDR0 = ch;
-#else
- /* m8,16,32,169,8515,8535,163 */
- while (!(UCSRA & _BV(UDRE)));
- UDR = ch;
-#endif
-}
-
-
-char getch(void)
-{
-#ifdef __AVR_ATmega128__
- if(bootuart == 1) {
- while(!(UCSR0A & _BV(RXC0)));
- return UDR0;
- }
- else if(bootuart == 2) {
- while(!(UCSR1A & _BV(RXC1)));
- return UDR1;
- }
- return 0;
-#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
- uint32_t count = 0;
- while(!(UCSR0A & _BV(RXC0))){
- /* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/
- /* HACKME:: here is a good place to count times*/
- count++;
- if (count > MAX_TIME_COUNT)
- app_start();
- }
- return UDR0;
-#else
- /* m8,16,32,169,8515,8535,163 */
- uint32_t count = 0;
- while(!(UCSRA & _BV(RXC))){
- /* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/
- /* HACKME:: here is a good place to count times*/
- count++;
- if (count > MAX_TIME_COUNT)
- app_start();
- }
- return UDR;
-#endif
-}
-
-
-void getNch(uint8_t count)
-{
- while(count--) {
-#ifdef __AVR_ATmega128__
- if(bootuart == 1) {
- while(!(UCSR0A & _BV(RXC0)));
- UDR0;
- }
- else if(bootuart == 2) {
- while(!(UCSR1A & _BV(RXC1)));
- UDR1;
- }
-#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
- getch();
-#else
- /* m8,16,32,169,8515,8535,163 */
- /* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/
- //while(!(UCSRA & _BV(RXC)));
- //UDR;
- getch(); // need to handle time out
-#endif
- }
-}
-
-
-void byte_response(uint8_t val)
-{
- if (getch() == ' ') {
- putch(0x14);
- putch(val);
- putch(0x10);
- } else {
- if (++error_count == MAX_ERROR_COUNT)
- app_start();
- }
-}
-
-
-void nothing_response(void)
-{
- if (getch() == ' ') {
- putch(0x14);
- putch(0x10);
- } else {
- if (++error_count == MAX_ERROR_COUNT)
- app_start();
- }
-}
-
-void flash_led(uint8_t count)
-{
- while (count--) {
- LED_PORT |= _BV(LED);
- _delay_ms(100);
- LED_PORT &= ~_BV(LED);
- _delay_ms(100);
- }
-}
-
-
-/* end of file ATmegaBOOT.c */
diff --git a/bootloaders/atmega168/ATmegaBOOT_168_atmega328.hex b/bootloaders/atmega168/ATmegaBOOT_168_atmega328.hex
deleted file mode 100644
index 43a8b30..0000000
--- a/bootloaders/atmega168/ATmegaBOOT_168_atmega328.hex
+++ /dev/null
@@ -1,125 +0,0 @@
-:107800000C94343C0C94513C0C94513C0C94513CE1
-:107810000C94513C0C94513C0C94513C0C94513CB4
-:107820000C94513C0C94513C0C94513C0C94513CA4
-:107830000C94513C0C94513C0C94513C0C94513C94
-:107840000C94513C0C94513C0C94513C0C94513C84
-:107850000C94513C0C94513C0C94513C0C94513C74
-:107860000C94513C0C94513C11241FBECFEFD8E036
-:10787000DEBFCDBF11E0A0E0B1E0ECE9FFE702C060
-:1078800005900D92A230B107D9F712E0A2E0B1E065
-:1078900001C01D92AD30B107E1F70E942D3D0C945F
-:1078A000CC3F0C94003C982F959595959595959582
-:1078B000905D8F708A307CF0282F295A8091C0000B
-:1078C00085FFFCCF9093C6008091C00085FFFCCF60
-:1078D0002093C6000895282F205DF0CF982F809127
-:1078E000C00085FFFCCF9093C6000895EF92FF92F1
-:1078F0000F931F93EE24FF2487018091C00087FD22
-:1079000017C00894E11CF11C011D111D81E4E8164B
-:1079100082E4F8068FE0080780E0180770F3E09132
-:107920000401F091050109958091C00087FFE9CF1E
-:107930008091C6001F910F91FF90EF9008950E94D3
-:10794000763C982F8091C00085FFFCCF9093C600B5
-:1079500091362CF490330CF09053892F089597555D
-:10796000892F08951F930E949F3C182F0E949F3CCF
-:107970001295107F810F1F9108951F93182F882350
-:1079800021F00E94763C1150E1F71F9108951F935A
-:10799000182F0E94763C803249F0809103018F5F5E
-:1079A000809303018530C1F01F9108958091C0003C
-:1079B00085FFFCCF84E18093C6008091C00085FFE5
-:1079C000FCCF1093C6008091C00085FFFCCF80E102
-:1079D0008093C6001F910895E0910401F091050184
-:1079E00009951F9108950E94763C803241F0809164
-:1079F00003018F5F80930301853081F008958091AA
-:107A0000C00085FFFCCF84E18093C6008091C00058
-:107A100085FFFCCF80E18093C6000895E0910401CA
-:107A2000F09105010995089540E951E08823A1F0FE
-:107A30002D9A28EE33E0FA013197F1F721503040CA
-:107A4000D1F72D9828EE33E0FA013197F1F7215064
-:107A50003040D1F7815061F708953F924F925F9285
-:107A60006F927F928F929F92AF92BF92CF92DF924E
-:107A7000EF92FF920F931F93CF93DF93000080E16B
-:107A80008093C4001092C50088E18093C10086E015
-:107A90008093C2005098589A259A81E00E94143D24
-:107AA00024E1F22E9EE1E92E85E9D82E0FE0C02ECA
-:107AB00010E1B12EAA24A394B1E49B2EA6E58A2E50
-:107AC000F2E57F2EE0E26E2E79E4572E63E5462E36
-:107AD00050E5352E0E94763C8033B1F18133B9F107
-:107AE000803409F46FC0813409F476C0823409F41B
-:107AF00085C0853409F488C0803531F1823521F1A3
-:107B0000813511F1853509F485C0863509F48DC0BC
-:107B1000843609F496C0843709F403C1853709F423
-:107B200072C1863709F466C0809103018F5F80932C
-:107B30000301853079F6E0910401F0910501099582
-:107B40000E94763C803351F60E94F33CC3CF0E94E2
-:107B5000763C803249F78091C00085FFFCCFF092DF
-:107B6000C6008091C00085FFFCCF9092C600809136
-:107B7000C00085FFFCCF8092C6008091C00085FFC9
-:107B8000FCCF7092C6008091C00085FFFCCF609250
-:107B9000C6008091C00085FFFCCF5092C600809146
-:107BA000C00085FFFCCF4092C6008091C00085FFD9
-:107BB000FCCF3092C6008091C00085FFFCCFB09210
-:107BC000C60088CF0E94763C863808F4BDCF0E945C
-:107BD000763C0E94F33C7ECF0E94763C803809F4CC
-:107BE0009CC0813809F40BC1823809F43CC1883942
-:107BF00009F48FC080E00E94C73C6CCF84E10E94F2
-:107C0000BD3C0E94F33C66CF85E00E94BD3C0E94D3
-:107C1000F33C60CF0E94763C809306010E94763C44
-:107C2000809307010E94F33C55CF0E94763C80333D
-:107C300009F41DC183E00E94BD3C80E00E94C73C66
-:107C400049CF0E94763C809309020E94763C809343
-:107C5000080280910C028E7F80930C020E94763C79
-:107C6000853409F415C18091080290910902892B8D
-:107C700089F000E010E00E94763CF801E85FFE4FDA
-:107C800080830F5F1F4F80910802909109020817AF
-:107C9000190788F30E94763C803209F045CF809125
-:107CA0000C0280FF01C16091060170910701660F0F
-:107CB000771F7093070160930601A0910802B091AD
-:107CC00009021097C9F0E8E0F1E09B01AD014E0F09
-:107CD0005F1FF999FECF32BD21BD819180BDFA9A17
-:107CE000F99A2F5F3F4FE417F50799F76A0F7B1F4B
-:107CF00070930701609306018091C00085FFFCCF5F
-:107D0000F092C6008091C00085FFFCCFB092C60003
-:107D1000E1CE83E00E94C73CDDCE82E00E94C73CFA
-:107D2000D9CE0E94763C809309020E94763C8093D3
-:107D300008028091060190910701880F991F909386
-:107D40000701809306010E94763C853409F4A6C0A1
-:107D500080910C028E7F80930C020E94763C8032D0
-:107D600009F0B8CE8091C00085FFFCCFF092C6002C
-:107D7000609108027091090261157105B9F140E046
-:107D800050E080910C02A82FA170B82FB27011C0E2
-:107D9000BB2309F45CC0E0910601F0910701319624
-:107DA000F0930701E09306014F5F5F4F46175707B7
-:107DB000E8F4AA2369F3F999FECF209106013091E6
-:107DC000070132BD21BDF89A90B58091C00085FFB2
-:107DD000FCCF9093C6002F5F3F4F30930701209355
-:107DE00006014F5F5F4F4617570718F38091C00099
-:107DF00085FDE5CE8091C00085FFF8CFE0CE81E023
-:107E00000E94C73C67CE0E94763C803209F08CCE3F
-:107E10008091C00085FFFCCFF092C6008091C00029
-:107E200085FFFCCFE092C6008091C00085FFFCCFAB
-:107E3000D092C6008091C00085FFFCCFC092C600E2
-:107E40008091C00085FFFCCFB092C60043CEE09188
-:107E50000601F091070194918091C00085FFFCCF4D
-:107E60009093C6009CCF80E10E94C73C33CE0E9415
-:107E7000763C0E94763C182F0E94763C112309F430
-:107E800083C0113009F484C08FE00E94C73C22CE29
-:107E900080910C02816080930C02E5CE80910C02EF
-:107EA000816080930C0259CF809107018823880F4D
-:107EB000880B8A2180930B02809106019091070123
-:107EC000880F991F90930701809306018091080203
-:107ED00080FF09C080910802909109020196909359
-:107EE000090280930802F894F999FECF1127E091D6
-:107EF0000601F0910701C8E0D1E08091080290915D
-:107F00000902103091F40091570001700130D9F34B
-:107F100003E000935700E89500915700017001308D
-:107F2000D9F301E100935700E89509901990009169
-:107F3000570001700130D9F301E000935700E89534
-:107F40001395103498F011270091570001700130FB
-:107F5000D9F305E000935700E895009157000170B0
-:107F60000130D9F301E100935700E895329602976A
-:107F700009F0C7CF103011F00296E5CF112480919F
-:107F8000C00085FFB9CEBCCE8EE10E94C73CA2CD19
-:0C7F900085E90E94C73C9ECDF894FFCF0D
-:027F9C00800063
-:040000030000780081
-:00000001FF
diff --git a/bootloaders/atmega168/ATmegaBOOT_168_diecimila.hex b/bootloaders/atmega168/ATmegaBOOT_168_diecimila.hex
deleted file mode 100644
index feac9d2..0000000
--- a/bootloaders/atmega168/ATmegaBOOT_168_diecimila.hex
+++ /dev/null
@@ -1,126 +0,0 @@
-:103800000C94341C0C94511C0C94511C0C94511CA1
-:103810000C94511C0C94511C0C94511C0C94511C74
-:103820000C94511C0C94511C0C94511C0C94511C64
-:103830000C94511C0C94511C0C94511C0C94511C54
-:103840000C94511C0C94511C0C94511C0C94511C44
-:103850000C94511C0C94511C0C94511C0C94511C34
-:103860000C94511C0C94511C11241FBECFEFD4E0BA
-:10387000DEBFCDBF11E0A0E0B1E0E4EAFFE302C0AB
-:1038800005900D92A230B107D9F712E0A2E0B1E0A5
-:1038900001C01D92AD30B107E1F70E94361D0C94B6
-:1038A000D01F0C94001C982F9595959595959595FE
-:1038B000905D8F708A307CF0282F295A8091C0004B
-:1038C00085FFFCCF9093C6008091C00085FFFCCFA0
-:1038D0002093C6000895282F205DF0CF982F809167
-:1038E000C00085FFFCCF9093C6000895EF92FF9231
-:1038F0000F931F93EE24FF2487018091C00087FD62
-:1039000017C00894E11CF11C011D111D81E4E8168B
-:1039100082E4F8068FE0080780E0180770F3E09172
-:103920000401F091050109958091C00087FFE9CF5E
-:103930008091C6001F910F91FF90EF9008950E9413
-:10394000761C982F8091C00085FFFCCF9093C60015
-:1039500091362CF490330CF09053892F089597559D
-:10396000892F08951F930E949F1C182F0E949F1C4F
-:103970001295107F810F1F910895882351F0982F81
-:1039800091508091C00087FFFCCF8091C6009923A1
-:10399000B9F708951F93182F0E94761C803249F0C2
-:1039A000809103018F5F809303018530C1F01F91E7
-:1039B00008958091C00085FFFCCF84E18093C6000C
-:1039C0008091C00085FFFCCF1093C6008091C0009D
-:1039D00085FFFCCF80E18093C6001F910895E091A0
-:1039E0000401F091050109951F9108950E94761C2C
-:1039F000803241F0809103018F5F80930301853015
-:103A000081F008958091C00085FFFCCF84E1809310
-:103A1000C6008091C00085FFFCCF80E18093C60086
-:103A20000895E0910401F09105010995089510921F
-:103A30000A028823D1F090E040E951E02D9A28EE67
-:103A400033E0FA013197F1F721503040D1F72D984A
-:103A500028EE33E0FA013197F1F721503040D1F7E9
-:103A60009F5F981758F380930A0208953F924F92F0
-:103A70005F926F927F928F929F92AF92BF92CF92FE
-:103A8000DF92EF92FF920F931F93CF93DF9300008B
-:103A900083E38093C4001092C50088E18093C10045
-:103AA00086E08093C2005098589A259A81E00E943F
-:103AB000171D44E1F42E3EE1E32E24E9D22E96E0D8
-:103AC000C92E80E1B82EAA24A39401E4902E16E515
-:103AD000812EB2E57B2EA0E26A2EF9E45F2EE3E5AB
-:103AE0004E2E70E5372E0E94761C8033B1F1813363
-:103AF00009F441C0803409F479C0813409F48CC0E0
-:103B0000823471F1853409F47BC0803531F182351E
-:103B100021F1813511F1853509F48DC0863509F41F
-:103B20009DC0843609F4AEC0843709F41BC18537C3
-:103B300009F485C1863709F47AC0809103018F5F4B
-:103B400080930301853079F6E0910401F09105013D
-:103B500009950E94761C803351F60E94F61CC3CF53
-:103B600093E18091C00087FFFCCF8091C60099232C
-:103B7000A1F39150F6CF0E94761C8032F1F680912D
-:103B8000C00085FFFCCFF092C6008091C00085FF89
-:103B9000FCCF9092C6008091C00085FFFCCF809240
-:103BA000C6008091C00085FFFCCF7092C600809156
-:103BB000C00085FFFCCF6092C6008091C00085FFE9
-:103BC000FCCF5092C6008091C00085FFFCCF409290
-:103BD000C6008091C00085FFFCCF3092C600809166
-:103BE000C00085FFFCCFB092C6007DCF0E94761C3E
-:103BF000863808F4B2CF0E94761C0E94F61C73CF60
-:103C000094E08091C00087FFFCCF8091C60099238B
-:103C100009F4A3CF9150F5CF0E94761C8038D1F0E3
-:103C2000813861F1823809F499C0883979F080E0EF
-:103C30000E94CA1C58CF0E94761C809306010E94E5
-:103C4000761C809307010E94F61C4DCF83E00E94F2
-:103C5000CA1C49CF82E00E94CA1C45CF0E94761C34
-:103C6000803309F486C192E08091C00087FFFCCFC9
-:103C70008091C6009923D9F29150F6CF81E00E943D
-:103C8000CA1C31CF0E94761C809309020E94761CC8
-:103C90008093080280910C028E7F80930C020E9418
-:103CA000761C853429F480910C02816080930C028B
-:103CB0008091080290910902892B89F000E010E0C0
-:103CC0000E94761CF801E85FFE4F80830F5F1F4F54
-:103CD00080910802909109020817190788F30E9441
-:103CE000761C803209F029CF80910C0280FFD1C070
-:103CF0004091060150910701440F551F5093070151
-:103D000040930601A0910802B09109021097C9F0F2
-:103D1000E8E0F1E09A01BD016E0F7F1FF999FECF37
-:103D200032BD21BD819180BDFA9AF99A2F5F3F4F34
-:103D3000E617F70799F74A0F5B1F50930701409367
-:103D400006018091C00085FFFCCFF092C6008091F3
-:103D5000C00085FFFCCFB092C600C5CE80E10E94B6
-:103D6000CA1CC1CE0E94761C809309020E94761C58
-:103D7000809308028091060190910701880F991F96
-:103D800090930701809306010E94761C853409F404
-:103D90007AC080910C028E7F80930C020E94761C68
-:103DA000803209F0A0CE8091C00085FFFCCFF09258
-:103DB000C600A0910802B09109021097B9F1809154
-:103DC0000C02182F1170082F0270E0910601F0917B
-:103DD00007019F012F5F3F4FB90140E050E01123E1
-:103DE000B1F4002339F494918091C00085FFFCCF99
-:103DF0009093C6004F5F5F4FCB010196F9014A17C0
-:103E00005B0780F4BC012F5F3F4F112351F3F999F9
-:103E1000FECFF2BDE1BDF89A90B58091C00085FF5C
-:103E2000FCCFE6CF70930701609306018091C0003C
-:103E300085FDD9CE8091C00085FFF8CFD4CE0E94F9
-:103E4000761C803209F079CE8091C00085FFFCCFCE
-:103E5000F092C6008091C00085FFFCCFE092C600C2
-:103E60008091C00085FFFCCFD092C6008091C00039
-:103E700085FFFCCFC092C6008091C00085FFFCCFBB
-:103E8000B092C60030CE80910C02816080930C020B
-:103E900085CF809107018823880F880B8A21809322
-:103EA0000B028091060190910701880F991F909352
-:103EB0000701809306018091080280FF09C080916C
-:103EC00008029091090201969093090280930802DA
-:103ED000F894F999FECF1127E0910601F0910701BE
-:103EE000C8E0D1E08091080290910902103091F46D
-:103EF0000091570001700130D9F303E0009357009F
-:103F0000E8950091570001700130D9F301E1009369
-:103F10005700E89509901990009157000170013001
-:103F2000D9F301E000935700E8951395103498F009
-:103F300011270091570001700130D9F305E000937B
-:103F40005700E8950091570001700130D9F301E165
-:103F500000935700E8953296029709F0C7CF1030CA
-:103F600011F00296E5CF11248091C00085FFE9CEC3
-:103F7000ECCE0E94761C0E94761C182F0E94761CA4
-:103F8000112351F0113021F086E00E94CA1CABCD04
-:103F900084E90E94CA1CA7CD8EE10E94CA1CA3CD51
-:043FA000F894FFCFC3
-:023FA40080009B
-:0400000300003800C1
-:00000001FF
diff --git a/bootloaders/atmega168/ATmegaBOOT_168_ng.hex b/bootloaders/atmega168/ATmegaBOOT_168_ng.hex
deleted file mode 100644
index 387091e..0000000
--- a/bootloaders/atmega168/ATmegaBOOT_168_ng.hex
+++ /dev/null
@@ -1,110 +0,0 @@
-:103800000C94341C0C94511C0C94511C0C94511CA1
-:103810000C94511C0C94511C0C94511C0C94511C74
-:103820000C94511C0C94511C0C94511C0C94511C64
-:103830000C94511C0C94511C0C94511C0C94511C54
-:103840000C94511C0C94511C0C94511C0C94511C44
-:103850000C94511C0C94511C0C94511C0C94511C34
-:103860000C94511C0C94511C11241FBECFEFD4E0BA
-:10387000DEBFCDBF11E0A0E0B1E0E4EAFEE302C0AC
-:1038800005900D92A230B107D9F712E0A2E0B1E0A5
-:1038900001C01D92AD30B107E1F70E94ED1C0C9400
-:1038A000511F0C94001C482F10920A0280E08417CC
-:1038B000E0F4582F2D9A28EE33E080E991E001974B
-:1038C000F1F721503040C9F72D9828EE33E080E918
-:1038D00091E00197F1F721503040C9F7852F8F5FB4
-:1038E000582F841738F380930A020895EF92FF92BD
-:1038F0000F931F93EE24FF2487018091C00087FD62
-:1039000017C00894E11CF11C011D111D81E0E8168F
-:1039100082E1F8068AE7080780E0180770F3E09173
-:103920000201F091030109958091C00087FFE9CF62
-:103930008091C600992787FD90951F910F91FF9068
-:10394000EF900895982F8091C00085FFFCCF909351
-:10395000C60008950E94761C803271F080910401A7
-:103960008F5F80930401853009F00895E091020192
-:10397000F09103010995089584E10E94A21C80E161
-:103980000E94A21C0895CF93C82F0E94761C8032FB
-:1039900041F0809104018F5F80930401853081F4B0
-:1039A0000AC084E10E94A21C8C2F0E94A21C80E10C
-:1039B0000E94A21C05C0E0910201F091030109954B
-:1039C000CF910895CF93C82FC150CF3F21F00E94CF
-:1039D000761CC150E0F7CF910895CFEFD4E0DEBF61
-:1039E000CDBF000083E38093C4001092C50088E13E
-:1039F0008093C10086E08093C2005098589A259A1F
-:103A000083E00E94531C0E94761C8033B1F1813305
-:103A1000B9F1803409F455C0813409F45BC08234B3
-:103A200009F46DC0853409F470C0803531F18235F8
-:103A300021F1813511F1853509F46BC0863509F422
-:103A400073C0843609F47AC0843709F4CEC0853750
-:103A500009F429C1863709F44AC0809104018F5FB7
-:103A600080930401853079F6E0910201F091030121
-:103A700009950E94761C803351F60E94AA1CC3CF80
-:103A80000E94761CC82F803241F784E10E94A21C5C
-:103A900081E40E94A21C86E50E94A21C82E50E948D
-:103AA000A21C8C2F0E94A21C89E40E94A21C83E508
-:103AB0000E94A21C80E50E94A21C80E10E94A21C20
-:103AC000A2CF0E94761C8638C0F20E94761C0E940B
-:103AD000AA1C99CF0E94761C803809F486C18138CF
-:103AE00009F487C1823809F488C1883921F080E05F
-:103AF0000E94C31C88CF83E00E94C31C84CF84E152
-:103B00000E94E21C0E94AA1C7ECF85E00E94E21C5B
-:103B1000F9CF0E94761C809306010E94761C809348
-:103B200007010E94AA1C6FCF0E94761C803309F403
-:103B3000CAC083E00E94E21C80E0DACF0E94761CBB
-:103B4000809309020E94761C8093080280910C02E7
-:103B50008E7F80930C020E94761C853409F4C4C0C9
-:103B600000E010E0809108029091090218161906F1
-:103B700070F4C8E0D1E00E94761C89930F5F1F4F5C
-:103B8000809108029091090208171907A0F30E947A
-:103B9000761C803209F061CF80910C0280FFAEC0AC
-:103BA000E0910601F0910701EE0FFF1F00E010E029
-:103BB00020910802309109021216130680F4A8E041
-:103BC000B1E0F999FECFF2BDE1BD8D9180BDFA9AC9
-:103BD000F99A31960F5F1F4F0217130790F3F09376
-:103BE0000701E093060184E166CF0E94761C809372
-:103BF00009020E94761C8093080280910601909130
-:103C00000701880F991F90930701809306010E9476
-:103C1000761C853409F46EC080910C028E7F8093EF
-:103C20000C020E94761C803209F0EDCE84E10E94E5
-:103C3000A21C00E010E02091080230910902121647
-:103C4000130608F03ACFE0910601F0910701809148
-:103C50000C0280FF1FC0F999FECFF2BDE1BDF89ABA
-:103C600080B50E94A21CE0910601F09107013196F7
-:103C7000F0930701E09306012091080230910902B8
-:103C80000F5F1F4F0217130708F017CF80910C0228
-:103C900080FDE1CF869580FFB4C03196F093070197
-:103CA000E0930601EDCF0E94761C803209F0D5CE5C
-:103CB00084E10E94A21C8EE10E94A21C84E90E9461
-:103CC000A21C86E0F8CE0E94761C0E94761CC82FAB
-:103CD0000E94761CCC2309F47CC0C13009F47DC05D
-:103CE00086E00E94C31C8FCE80910C02816080937D
-:103CF0000C0236CF80910C02816091CF8091070138
-:103D000087FD6FC010920B02809106019091070110
-:103D1000880F991F909307018093060180910802F4
-:103D200080FF09C08091080290910902019690934A
-:103D3000090280930802F894F999FECF1127E091C7
-:103D40000601F0910701C8E0D1E08091080290914E
-:103D50000902103091F40091570001700130D9F33D
-:103D600003E000935700E89500915700017001307F
-:103D7000D9F301E100935700E8950990199000915B
-:103D8000570001700130D9F301E000935700E89526
-:103D90001395103498F011270091570001700130ED
-:103DA000D9F305E000935700E895009157000170A2
-:103DB0000130D9F301E100935700E895329602975C
-:103DC00009F0C7CF103011F00296E5CF112484E13D
-:103DD00072CE8EE10E94C31C16CE84E90E94C31CE1
-:103DE00012CE81E080930B028FCF82E00E94C31C31
-:103DF0000ACE81E00E94C31C06CE80E10E94C31C53
-:103E000002CE84910E94A21C2091080230910902E6
-:103E1000E0910601F091070140CFCF930E94761CFC
-:103E2000C82F0E94A21CC13614F0C75503C0C0336E
-:103E30000CF0C0538C2F992787FD9095CF91089552
-:103E40000F931F930E940D1F082F112707FD109538
-:103E500002951295107F1027007F10270E940D1FDA
-:103E6000800F992787FD90951F910F910895CF930B
-:103E7000C82F85958595859585958A3034F0895A22
-:103E8000CF70CA3034F0C95A05C0805DCF70CA30D7
-:103E9000D4F7C05D0E94A21C8C2F0E94A21CCF915F
-:043EA0000895FFCFB3
-:023EA40080009C
-:0400000300003800C1
-:00000001FF
diff --git a/bootloaders/atmega168/ATmegaBOOT_168_pro_8MHz.hex b/bootloaders/atmega168/ATmegaBOOT_168_pro_8MHz.hex
deleted file mode 100644
index 994e478..0000000
--- a/bootloaders/atmega168/ATmegaBOOT_168_pro_8MHz.hex
+++ /dev/null
@@ -1,126 +0,0 @@
-:103800000C94341C0C94511C0C94511C0C94511CA1
-:103810000C94511C0C94511C0C94511C0C94511C74
-:103820000C94511C0C94511C0C94511C0C94511C64
-:103830000C94511C0C94511C0C94511C0C94511C54
-:103840000C94511C0C94511C0C94511C0C94511C44
-:103850000C94511C0C94511C0C94511C0C94511C34
-:103860000C94511C0C94511C11241FBECFEFD4E0BA
-:10387000DEBFCDBF11E0A0E0B1E0EEEAFFE302C0A1
-:1038800005900D92A230B107D9F712E0A2E0B1E0A5
-:1038900001C01D92AD30B107E1F70E94331D0C94B9
-:1038A000D51F0C94001C982F9595959595959595F9
-:1038B000905D8F708A307CF0282F295A8091C0004B
-:1038C00085FFFCCF9093C6008091C00085FFFCCFA0
-:1038D0002093C6000895282F205DF0CF982F809167
-:1038E000C00085FFFCCF9093C6000895EF92FF9231
-:1038F0000F931F93EE24FF2487018091C00087FD62
-:1039000017C00894E11CF11C011D111D81E2E8168D
-:1039100081EAF80687E0080780E0180770F3E09175
-:103920000401F091050109958091C00087FFE9CF5E
-:103930008091C6001F910F91FF90EF9008950E9413
-:10394000761C982F8091C00085FFFCCF9093C60015
-:1039500091362CF490330CF09053892F089597559D
-:10396000892F08951F930E949F1C182F0E949F1C4F
-:103970001295107F810F1F9108951F93182F882390
-:1039800021F00E94761C1150E1F71F9108951F93BA
-:10399000182F0E94761C803249F0809103018F5FBE
-:1039A000809303018530C1F01F9108958091C0007C
-:1039B00085FFFCCF84E18093C6008091C00085FF25
-:1039C000FCCF1093C6008091C00085FFFCCF80E142
-:1039D0008093C6001F910895E0910401F0910501C4
-:1039E00009951F9108950E94761C803241F08091C4
-:1039F00003018F5F80930301853081F008958091EA
-:103A0000C00085FFFCCF84E18093C6008091C00098
-:103A100085FFFCCF80E18093C6000895E09104010A
-:103A2000F09105010995089510920A028823D1F0BA
-:103A300090E048EC50E02D9A28EE33E0FA013197FF
-:103A4000F1F721503040D1F72D9828EE33E0FA01FC
-:103A50003197F1F721503040D1F79F5F981758F315
-:103A600080930A0208953F924F925F926F927F92E5
-:103A70008F929F92AF92BF92CF92DF92EF92FF927E
-:103A80000F931F93CF93DF9394B714BE8091600080
-:103A90008861809360001092600091FF0CC289E100
-:103AA0008093C4001092C50088E18093C10086E035
-:103AB0008093C2005098589A259A81E00E94141D64
-:103AC00044E1F42E3EE1E32E24E9D22E96E0C92E05
-:103AD00080E1B82EAA24A39401E4902E16E5812E4D
-:103AE000B2E57B2EA0E26A2EF9E45F2EE3E54E2ECE
-:103AF00070E5372E0E94761C8033B9F18133C1F115
-:103B0000803409F470C0813409F477C0823409F438
-:103B100086C0853409F489C0803539F1823529F1B0
-:103B2000813509F4AFC1853509F485C0863509F4BE
-:103B30008DC0843609F435C1843709F4C1C0853796
-:103B400009F490C0863709F466C0809103018F5F45
-:103B500080930301853071F6E0910401F091050135
-:103B600009950E94761C803349F60E94F31CC2CF4F
-:103B70000E94761C803249F78091C00085FFFCCFFF
-:103B8000F092C6008091C00085FFFCCF9092C600E5
-:103B90008091C00085FFFCCF8092C6008091C0005C
-:103BA00085FFFCCF7092C6008091C00085FFFCCFDE
-:103BB0006092C6008091C00085FFFCCF5092C60085
-:103BC0008091C00085FFFCCF4092C6008091C0006C
-:103BD00085FFFCCF3092C6008091C00085FFFCCFEE
-:103BE000B092C60087CF0E94761C863808F4BDCFFD
-:103BF0000E94761C0E94F31C7DCF0E94761C8038A8
-:103C000009F45AC0813809F453C0823809F440C11C
-:103C1000883909F449C080E00E94C71C6BCF84E159
-:103C20000E94BD1C0E94F31C65CF85E00E94BD1C54
-:103C30000E94F31C5FCF0E94761C809306010E94B5
-:103C4000761C809307010E94F31C54CF0E94761CBF
-:103C5000803309F421C183E00E94BD1C80E00E94F2
-:103C6000C71C48CF0E94761C803209F06ECF80912D
-:103C7000C00085FFFCCFF092C6008091C00085FF98
-:103C8000FCCFE092C6008091C00085FFFCCFD092AF
-:103C9000C6008091C00085FFFCCFC092C600809115
-:103CA000C00085FFFCCF9CCF83E00E94C71C22CFC1
-:103CB00081E00E94C71C1ECF82E00E94C71C1ACF61
-:103CC0000E94761C809309020E94761C8093080251
-:103CD0008091060190910701880F991F9093070129
-:103CE000809306010E94761C853409F4C5C080913A
-:103CF0000C028E7F80930C020E94761C803209F0A9
-:103D0000F9CE8091C00085FFFCCFF092C600609193
-:103D10000802709109026115710591F140E050E0CF
-:103D200080910C02A82FA170B82FB27010C0BB23D5
-:103D300061F1E0910601F09107013196F0930701DE
-:103D4000E09306014F5F5F4F46175707C8F4AA2359
-:103D500071F3F999FECF209106013091070132BD30
-:103D600021BDF89A90B58091C00085FFFCCF90935B
-:103D7000C6002F5F3F4F3093070120930601E2CF2B
-:103D80008091C00085FFFCCF2BCFE0910601F09120
-:103D9000070194918091C00085FFFCCF9093C600ED
-:103DA000CCCF0E94761C809309020E94761C8093DF
-:103DB000080280910C028E7F80930C020E94761C78
-:103DC000853429F480910C02816080930C028091EB
-:103DD000080290910902892B89F000E010E00E940E
-:103DE000761CF801E85FFE4F80830F5F1F4F8091C4
-:103DF0000802909109020817190788F30E94761C9F
-:103E0000803209F0A2CE80910C0280FF62C0409106
-:103E1000060150910701440F551F5093070140932D
-:103E20000601609108027091090261157105C9F0DF
-:103E3000E8E0F1E09A01DB01AE0FBF1FF999FECF78
-:103E400032BD21BD819180BDFA9AF99A2F5F3F4F13
-:103E5000EA17FB0799F7460F571F50930701409346
-:103E600006018091C00085FFFCCFF092C6008091D2
-:103E7000C00085FFFCCFB4CE80910C02816080939E
-:103E80000C023ACF0E94F31C88E080936000FFCFC1
-:103E900080E10E94C71C2ECE0E94761C0E94761CD8
-:103EA000182F0E94761C112381F0113051F086E00A
-:103EB0000E94C71C1FCEE0910401F09105010995F5
-:103EC000EECD84E90E94C71C15CE8EE10E94C71C6E
-:103ED00011CE809107018823880F880B8A21809357
-:103EE0000B028091060190910701880F991F909312
-:103EF0000701809306018091080280FF09C080912C
-:103F00000802909109020196909309028093080299
-:103F1000F894F999FECF1127E0910601F09107017D
-:103F2000C8E0D1E08091080290910902103091F42C
-:103F30000091570001700130D9F303E0009357005E
-:103F4000E8950091570001700130D9F301E1009329
-:103F50005700E895099019900091570001700130C1
-:103F6000D9F301E000935700E8951395103498F0C9
-:103F700011270091570001700130D9F305E000933B
-:103F80005700E8950091570001700130D9F301E125
-:103F900000935700E8953296029709F0C7CF10308A
-:0E3FA00011F00296E5CF11245CCFF894FFCF0C
-:023FAE00800091
-:0400000300003800C1
-:00000001FF
diff --git a/bootloaders/atmega168/Makefile b/bootloaders/atmega168/Makefile
deleted file mode 100755
index 861cedd..0000000
--- a/bootloaders/atmega168/Makefile
+++ /dev/null
@@ -1,194 +0,0 @@
-# Makefile for ATmegaBOOT
-# E.Lins, 18.7.2005
-# $Id$
-#
-# Instructions
-#
-# To make bootloader .hex file:
-# make diecimila
-# make lilypad
-# make ng
-# etc...
-#
-# To burn bootloader .hex file:
-# make diecimila_isp
-# make lilypad_isp
-# make ng_isp
-# etc...
-
-# program name should not be changed...
-PROGRAM = ATmegaBOOT_168
-
-# enter the parameters for the avrdude isp tool
-ISPTOOL = stk500v2
-ISPPORT = usb
-ISPSPEED = -b 115200
-
-MCU_TARGET = atmega168
-LDSECTION = --section-start=.text=0x3800
-
-# the efuse should really be 0xf8; since, however, only the lower
-# three bits of that byte are used on the atmega168, avrdude gets
-# confused if you specify 1's for the higher bits, see:
-# http://tinker.it/now/2007/02/24/the-tale-of-avrdude-atmega168-and-extended-bits-fuses/
-#
-# similarly, the lock bits should be 0xff instead of 0x3f (to
-# unlock the bootloader section) and 0xcf instead of 0x0f (to
-# lock it), but since the high two bits of the lock byte are
-# unused, avrdude would get confused.
-
-ISPFUSES = avrdude -c $(ISPTOOL) -p $(MCU_TARGET) -P $(ISPPORT) $(ISPSPEED) \
--e -u -U lock:w:0x3f:m -U efuse:w:0x$(EFUSE):m -U hfuse:w:0x$(HFUSE):m -U lfuse:w:0x$(LFUSE):m
-ISPFLASH = avrdude -c $(ISPTOOL) -p $(MCU_TARGET) -P $(ISPPORT) $(ISPSPEED) \
--U flash:w:$(PROGRAM)_$(TARGET).hex -U lock:w:0x0f:m
-
-STK500 = "C:\Program Files\Atmel\AVR Tools\STK500\Stk500.exe"
-STK500-1 = $(STK500) -e -d$(MCU_TARGET) -pf -vf -if$(PROGRAM)_$(TARGET).hex \
--lFF -LFF -f$(HFUSE)$(LFUSE) -EF8 -ms -q -cUSB -I200kHz -s -wt
-STK500-2 = $(STK500) -d$(MCU_TARGET) -ms -q -lCF -LCF -cUSB -I200kHz -s -wt
-
-
-OBJ = $(PROGRAM).o
-OPTIMIZE = -O2
-
-DEFS =
-LIBS =
-
-CC = avr-gcc
-
-# Override is only needed by avr-lib build system.
-
-override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS)
-override LDFLAGS = -Wl,$(LDSECTION)
-#override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION)
-
-OBJCOPY = avr-objcopy
-OBJDUMP = avr-objdump
-
-all:
-
-lilypad: TARGET = lilypad
-lilypad: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>1' '-DNUM_LED_FLASHES=3'
-lilypad: AVR_FREQ = 8000000L
-lilypad: $(PROGRAM)_lilypad.hex
-
-lilypad_isp: lilypad
-lilypad_isp: TARGET = lilypad
-lilypad_isp: HFUSE = DD
-lilypad_isp: LFUSE = E2
-lilypad_isp: EFUSE = 00
-lilypad_isp: isp
-
-lilypad_resonator: TARGET = lilypad_resonator
-lilypad_resonator: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=3'
-lilypad_resonator: AVR_FREQ = 8000000L
-lilypad_resonator: $(PROGRAM)_lilypad_resonator.hex
-
-lilypad_resonator_isp: lilypad_resonator
-lilypad_resonator_isp: TARGET = lilypad_resonator
-lilypad_resonator_isp: HFUSE = DD
-lilypad_resonator_isp: LFUSE = C6
-lilypad_resonator_isp: EFUSE = 00
-lilypad_resonator_isp: isp
-
-pro8: TARGET = pro_8MHz
-pro8: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1' '-DWATCHDOG_MODS'
-pro8: AVR_FREQ = 8000000L
-pro8: $(PROGRAM)_pro_8MHz.hex
-
-pro8_isp: pro8
-pro8_isp: TARGET = pro_8MHz
-pro8_isp: HFUSE = DD
-pro8_isp: LFUSE = C6
-pro8_isp: EFUSE = 00
-pro8_isp: isp
-
-pro16: TARGET = pro_16MHz
-pro16: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1' '-DWATCHDOG_MODS'
-pro16: AVR_FREQ = 16000000L
-pro16: $(PROGRAM)_pro_16MHz.hex
-
-pro16_isp: pro16
-pro16_isp: TARGET = pro_16MHz
-pro16_isp: HFUSE = DD
-pro16_isp: LFUSE = C6
-pro16_isp: EFUSE = 00
-pro16_isp: isp
-
-pro20: TARGET = pro_20mhz
-pro20: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1' '-DWATCHDOG_MODS'
-pro20: AVR_FREQ = 20000000L
-pro20: $(PROGRAM)_pro_20mhz.hex
-
-pro20_isp: pro20
-pro20_isp: TARGET = pro_20mhz
-pro20_isp: HFUSE = DD
-pro20_isp: LFUSE = C6
-pro20_isp: EFUSE = 00
-pro20_isp: isp
-
-diecimila: TARGET = diecimila
-diecimila: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1'
-diecimila: AVR_FREQ = 16000000L
-diecimila: $(PROGRAM)_diecimila.hex
-
-diecimila_isp: diecimila
-diecimila_isp: TARGET = diecimila
-diecimila_isp: HFUSE = DD
-diecimila_isp: LFUSE = FF
-diecimila_isp: EFUSE = 00
-diecimila_isp: isp
-
-ng: TARGET = ng
-ng: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>1' '-DNUM_LED_FLASHES=3'
-ng: AVR_FREQ = 16000000L
-ng: $(PROGRAM)_ng.hex
-
-ng_isp: ng
-ng_isp: TARGET = ng
-ng_isp: HFUSE = DD
-ng_isp: LFUSE = FF
-ng_isp: EFUSE = 00
-ng_isp: isp
-
-atmega328: TARGET = atmega328
-atmega328: MCU_TARGET = atmega328p
-atmega328: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1' -DBAUD_RATE=57600
-atmega328: AVR_FREQ = 16000000L
-atmega328: LDSECTION = --section-start=.text=0x7800
-atmega328: $(PROGRAM)_atmega328.hex
-
-atmega328_isp: atmega328
-atmega328_isp: TARGET = atmega328
-atmega328_isp: MCU_TARGET = atmega328p
-atmega328_isp: HFUSE = DA
-atmega328_isp: LFUSE = FF
-atmega328_isp: EFUSE = 05
-atmega328_isp: isp
-
-isp: $(TARGET)
- $(ISPFUSES)
- $(ISPFLASH)
-
-isp-stk500: $(PROGRAM)_$(TARGET).hex
- $(STK500-1)
- $(STK500-2)
-
-%.elf: $(OBJ)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
-
-clean:
- rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex
-
-%.lst: %.elf
- $(OBJDUMP) -h -S $< > $@
-
-%.hex: %.elf
- $(OBJCOPY) -j .text -j .data -O ihex $< $@
-
-%.srec: %.elf
- $(OBJCOPY) -j .text -j .data -O srec $< $@
-
-%.bin: %.elf
- $(OBJCOPY) -j .text -j .data -O binary $< $@
-