avrboot/chipdef.h

130 lines
3.5 KiB
C

#ifndef CHIPDEF_H
#define CHIPDEF_H
#if defined(__AVR_ATmega169__)
#define sig_byte3 0x1E
#define sig_byte2 0x94
#define sig_byte1 0x05
#define devtype 0x79 // Mega 169 device code
#define PAGESIZE 128 // 2*64 Words = Size in Bytes
#ifdef _B128
#define APP_PAGES ((2*8192 / PAGESIZE)- (2*128 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B256
#define APP_PAGES ((2*8192 / PAGESIZE)- (2*256 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B512
#define APP_PAGES ((2*8192 / PAGESIZE)- (2*512 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B1024
#define APP_PAGES ((2*8192 / PAGESIZE)- (2*1024 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B2048
#error "_B2048 not suppoted on this device"
#endif
#elif defined(__AVR_ATmega16__)
#define sig_byte3 0x1E
#define sig_byte2 0x94
#define sig_byte1 0x03
#define devtype 0x75 // Mega16 device code
#define PAGESIZE 128 // Size in Bytes
#ifdef _B128
#define APP_PAGES ((2*8192 / PAGESIZE)- (2*128 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B256
#define APP_PAGES ((2*8192 / PAGESIZE)- (2*256 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B512
#define APP_PAGES ((2*8192 / PAGESIZE)- (2*512 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B1024
#define APP_PAGES ((2*8192 / PAGESIZE)- (2*1024 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B2048
#error "_B2048 not suppoted on this device"
#endif
#elif defined(__AVR_ATmega8__)
#define sig_byte3 0x1E
#define sig_byte2 0x93
#define sig_byte1 0x07
#define devtype 0x77 // Mega8 boot device code
#define PAGESIZE 64 // Size in Bytes
#ifdef _B128
#define APP_PAGES ((2*4096 / PAGESIZE)- (2*128 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B256
#define APP_PAGES ((2*4096 / PAGESIZE)- (2*256 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B512
#define APP_PAGES ((2*4096 / PAGESIZE)- (2*512 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B1024
#define APP_PAGES ((2*4096 / PAGESIZE)- (2*1024 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B2048
#error "_B2048 not suppoted on this device"
#endif
#elif defined(__AVR_ATmega32__)
#define sig_byte3 0x1E
#define sig_byte2 0x95
#define sig_byte1 0x02
#define devtype 0x73 // Mega32 device code
#define PAGESIZE 128 // Size in Bytes
#ifdef _B128
#define APP_PAGES ((2*16384 / PAGESIZE)- (2*128 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B256
#define APP_PAGES ((2*16384 / PAGESIZE)- (2*256 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B512
#define APP_PAGES ((2*16384 / PAGESIZE)- (2*512 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B1024
#define APP_PAGES ((2*16384 / PAGESIZE)- (2*1024 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#ifdef _B2048
#define APP_PAGES ((2*16384 / PAGESIZE)- (2*2048 / PAGESIZE ))
#define APP_END APP_PAGES * PAGESIZE
#endif
#else
#error "no definition for MCU available in chipdef.h"
#endif
#endif