AVR_M8 BootLoader應(yīng)用范例
//BOOTSZ1BOOTSZ0=00
//meg8bootloader
//BOOTSZ1BOOTSZ0=00
#include
#defineSPM_PAGESIZE64//M8的一個Flash頁為64字節(jié)(32字)
#defineBAUD38400//波特率采用38400bps
#defineCRYSTAL8000000//系統(tǒng)時鐘8MHz
//計算和定義M128的波特率設(shè)置參數(shù)
#defineBAUD_SETTING(unsignedchar)((unsignedlong)CRYSTAL/(16*(unsignedlong)BAUD)-1)
#defineBAUD_H(unsignedchar)(BAUD_SETTING>>8)
#defineBAUD_L(unsignedchar)BAUD_SETTING
#defineDATA_BUFFER_SIZE128//定義接收緩沖區(qū)長度
//定義Xmoden控制字符
#defineXMODEM_NUL0x00
#defineXMODEM_SOH0x01
#defineXMODEM_STX0x02
#defineXMODEM_EOT0x04
#defineXMODEM_ACK0x06
#defineXMODEM_NAK0x15
#defineXMODEM_CAN0x18
#defineXMODEM_EOF0x1A
#defineXMODEM_RECIEVING_WAIT_CHARC
//定義全局變量
constcharstartupString[]="Typeddownload,Othersrunapp.nr