//*****************************************************************************
//* BootLoader 4.3 for MegaLoad 4.0
//*
//* Devices supported at this time
//* ATMega8
//* ATMega16
//* ATMega32
//* ATMega64
//* ATMega128
//* ATMega162
//* ATMega169
//* ATMega8515
//* ATMega8535
//* ATMega48 not tested, please give me feedback!
//* ATMega88
//* ATMega168 not tested, please give me feedback!
//* ATMega165 not tested, please give me feedback!
//* ATMega3250 not tested, please give me feedback!
//* ATMega6450 not tested, please give me feedback!
//* ATMega168 not tested, please give me feedback!
//* ATMega3290 not tested, please give me feedback!
//* ATMega6490 not tested, please give me feedback!
//* ATMega406 not tested, please give me feedback!
//* ATMega640 not tested, please give me feedback!
//* ATMega1280 not tested, please give me feedback!
//* ATMega2560
//* ATMega2561 not tested, please give me feedback!
//* ATMCAN128
//* ATMega325 Define to do
//*
//* Version 4.0 June 2005
//* 1.0 : First Release
//* 1.1 : Add auto baud rate, code smaller
//* 1.2 : Correct a bug with file larger than 65280 bytes.
//* 2.0 : All in one source file that fit in 512 Words
//* 3.0 : Add EEprom programming
//* Add RS485 half duplex support
//* Add LockBit programming
//* 3.1 : Correct a problem with interupt vector for M8/16/32/162/8515/8535
//* Change some #define to be more clear
//* 3.2 : Add support for M48/M88/M168
//* 4.0 : Change code to work with MegaLoad .NET 4.0
//* Add M165/325x/645x/168/329x/649x/406/640/128x/256x
//* 4.1 : Add ATMegaCAN128
//* 4.2 : Some change for M88 tested by duane
//* 4.3 : Problem with UART2,3,4 found my Matthew, Problem with ICC new version corrected
//*
//* sbissonnette@MicroSyl.com
//*****************************************************************************
//
// To setup the bootloader for your project you must
// remove the comment below to fit with your hardware
// recompile it using ICCAVR setup for bootloader
// of 512 word for ONLY flash programming
// or 1024 word for flash and eeprom programming
//
//*****************************************************************************
// MCU selection
//
// *************************************
// *->Do the same thing in assembly.s<-*
// *************************************
//
//*****************************************************************************
#define MEGATYPE 8
//#define MEGATYPE 16
//#define MEGATYPE 32
//#define MEGATYPE 64
//#define MEGATYPE 128
//#define MEGATYPE 162
//#define MEGATYPE 169
//#define MEGATYPE 8515
//#define MEGATYPE 8535
//#define MEGATYPE 2313
//#define MEGATYPE 48
//#define MEGATYPE 88
//#define MEGATYPE 168
//#define MEGATYPE 165
//#define MEGATYPE 3250
//#define MEGATYPE 6450
//#define MEGATYPE 3290
//#define MEGATYPE 6490
//#define MEGATYPE 406
//#define MEGATYPE 640
//#define MEGATYPE 1280
//#define MEGATYPE 2560
//#define MEGATYPE 1128 //(ATMegaCAN128)
//*****************************************************************************
// MCU Fequancy
//*****************************************************************************
#define XTAL 16000000
//*****************************************************************************
// Bootload on UART x
//*****************************************************************************
#define UART 0
//#define UART 1
//#define UART 2
//#define UART 3
//*****************************************************************************
// BaudRate
// If you don't specify the baudRate divisor the bootloader
// will automaticaly be in AutoBaudrate mode
//*****************************************************************************
#define BAUDRATE 19200
//*****************************************************************************
// Auto OSCCAL
// Enable the autocalibration of OSCCAL register (can't be used with autobaud)
//
//*****************************************************************************
//#define AUTOOSCCAL
//*****************************************************************************
// Crystal speed
// frequancy of your MCU speed
// LOW -> Xtal < 8Mhz
// HIGH -> Xtal >= 8Mhz
//*****************************************************************************
//#define LOW
#define HIGH
//*****************************************************************************
// EEprom programming
// enable EEprom programing via bootloader
// YOU MUST SET TO 1024 WORD THE BOOTLOADER SIZE IF EEPROM
// PROGRAMMING IS USE
//*****************************************************************************
//#define EEPROM
//*****************************************************************************
// LockBit programming
// enable LOCKBIT programing via bootloader
//*****************************************************************************
//#define LOCKBIT
//*****************************************************************************
// RS485
// if you use RS485 half duplex for bootloader
// make the appropriate change for RX/TX transceiver switch
//*****************************************************************************
//#define RS485DDR DDRB
//#define RS485PORT PORTB
//#define RS485TXE 0x08
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//!!!!!!!!!!!!!! DO NOT CHANGE ANYTHING BELOW THIS LINE !!!!!!!!!!!!!!!!!!!!!!!
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include <macros.h>
#define Tiny2313 'O'
#define Tiny13 'P'
#define Mega8 'A'
#define Mega16 'B'
#define Mega32 'E'
#define Mega48 'L'
#define Mega64 'C'
#define Mega88 'M'
#define Mega128 'D'
#define Mega162 'F'
#define Mega163 'J'
#define Mega168 'N'
#define Mega169 'G'
#define Mega323 'K'
#define Mega8515 'H'
#define Mega8535 'I'
#define Mega165 0x80
#define Mega3250 0x81
#define Mega6450 0x82
#define Mega3290 0x83
#define Mega6490 0x84
#define Mega406 0x85
#define Mega640 0x86
#define Mega1280 0x87
#define Mega2560 0x88
#define MCAN128 0x89
#define Mega325 0x90
#define Flash1k 'g'
#define Flash2k 'h'
#define Flash4k 'i'
#define Flash8k 'l'
#define Flash16k 'm'
#define Flash32k 'n'
#define Flash64k 'o'
#define Flash128k 'p'
#define Flash256k 'q'
#define Flash40k 'r'
#define EEprom64 '.'
#define EEprom128 '/'
#define EEprom256 '0'
#define EEprom512 '1'
#define EEprom1024 '2'
#define EEprom2048 '3'
#define EEprom4096 '4'
#define Boot128 'a'
#define Boot256 'b'
#define Boot512 'c'
#define Boot1024 'd'
#define Boot2048 'e'
#define Boot4096 'f'
#define Page32 'Q'
#define Page64 'R'
#define Page128 'S'
#define Page256 'T'
#define Page512 'V'
#if !(defined MEGATYPE)
#error "Processor Type is Undefined"
#endif
#ifdef EEPROM
#define BootSize Boot1024
#endif
#ifndef EEPROM
#define BootSize Boot512
#endif
#if (MEGATYPE == 8)
#include "iom8v.h"
#define DeviceID Mega8
#define FlashSize Flash8k
#define PageSize Page64
#define EEpromSize EEprom512
#define PageByte 64
#define NSHIFTPAGE 6
#define INTVECREG GICR
#define PULLUPPORT PORTD
#define PULLUPPIN 0x01
#endif
AVR单片机 Bootloader(串口在线升级程序源代码).rar
5星 · 超过95%的资源 需积分: 50 108 浏览量
2010-01-09
16:34:56
上传
评论 8
收藏 15KB RAR 举报
wwwwffff78
- 粉丝: 1
- 资源: 16
最新资源
- 已过基于Hadoop+Spark招聘推荐可视化系统 大数据项目 毕业设计(源码下载)
- python爬虫开发题答案及题目-100(1).zip
- Python 小游戏 (贪吃蛇、五子棋、扫雷、俄罗斯方块)-3 (2).zip
- c语言实现的数独小游戏.zip
- 高德地图中国行政区划省、市、县经纬度
- March 2024 Expiration Of The OAM Out Of The Box Certificates
- 二叉搜索树迭代器(java代码).docx
- 解决keil MDK 5.38版本 在Debug配置使用STlink调试时软件闪退的问题
- py小项目:用户登录和注册系统开发欢迎图片
- TCCEE-x64-v6.2.3(9.51)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
- 4
- 5
- 6
前往页