From 625027a807f97eedf6339e033a7b10cadb56f415 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sat, 5 Feb 2022 14:44:13 +0100 Subject: [PATCH 001/511] Add HV UPDI pulse command --- src/jtag3.c | 4 ++++ src/jtag3_private.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/jtag3.c b/src/jtag3.c index 1681a001..b0815986 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1247,6 +1247,10 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) } } + parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE; + if (jtag3_setparm(pgm, SCOPE_AVR, 3, PARM3_OPT_12V_UPDI_ENABLE, parm, 1) < 0) + return -1; + u16_to_b2(xd.default_min_div1_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV1_VOLTAGE_MV); u16_to_b2(xd.default_min_div2_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV2_VOLTAGE_MV); u16_to_b2(xd.default_min_div4_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV4_VOLTAGE_MV); diff --git a/src/jtag3_private.h b/src/jtag3_private.h index a3e7fb08..3eeb61b3 100644 --- a/src/jtag3_private.h +++ b/src/jtag3_private.h @@ -236,6 +236,14 @@ #define PARM3_OPT_12V_UPDI_ENABLE 0x06 #define PARM3_OPT_CHIP_ERASE_TO_ENTER 0x07 +/* + * UPDI high-voltage enable modes + */ +#define PARM3_UPDI_HV_NONE 0x00 /* Do not use high-voltage */ +#define PARM3_UPDI_HV_SIMPLE_PULSE 0x01 /* Issue a single high-voltage pulse immediately*/ +#define PARM3_UPDI_HV_AUTO_POWER_TOGGLE 0x02 /* Toggle power automatically and then apply a high-voltage pulse */ +#define PARM3_UPDI_HV_USER_POWER_TOGGLE 0x03 /* The user toggles power, and the tool applies a high-voltage pulse on power-up */ + /* Xmega erase memory types, for CMND_XMEGA_ERASE */ #define XMEGA_ERASE_CHIP 0x00 #define XMEGA_ERASE_APP 0x01 From 3dc1e4e72b7da597c98761a7bb7cb5aa5c885584 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Sun, 3 Apr 2022 20:29:56 +0100 Subject: [PATCH 002/511] Wait and retry until deplayed udev permission rule applies after exporting gpio pin --- src/linuxgpio.c | 54 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/src/linuxgpio.c b/src/linuxgpio.c index 86fefd76..36687612 100644 --- a/src/linuxgpio.c +++ b/src/linuxgpio.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "avrdude.h" #include "libavrdude.h" @@ -108,7 +109,8 @@ static int linuxgpio_dir(unsigned int gpio, unsigned int dir) fd = open(buf, O_WRONLY); if (fd < 0) { - perror("Can't open gpioX/direction"); + snprintf(buf, sizeof(buf), "Can't open gpio%u/direction", gpio); + perror(buf); return fd; } @@ -138,6 +140,11 @@ static int linuxgpio_dir_in(unsigned int gpio) #define N_GPIO (PIN_MAX + 1) +/* Delay between checks for successful GPIO export (100ms) */ +#define GPIO_SYSFS_OPEN_DELAY 100000 +/* Number of retries to check for successful GPIO exports */ +#define GPIO_SYSFS_OPEN_RETRIES 10 + /* * an array which holds open FDs to /sys/class/gpio/gpioXX/value for all needed pins */ @@ -245,6 +252,8 @@ static void linuxgpio_powerdown(PROGRAMMER *pgm) static int linuxgpio_open(PROGRAMMER *pgm, char *port) { int r, i, pin; + char gpio_path[60]; + struct stat stat_buf; if (bitbang_check_prerequisites(pgm) < 0) return -1; @@ -272,13 +281,46 @@ static int linuxgpio_open(PROGRAMMER *pgm, char *port) pin, strerror(errno)); return r; } - if (i == PIN_AVR_MISO) - r=linuxgpio_dir_in(pin); - else - r=linuxgpio_dir_out(pin); - if (r < 0) + /* Wait until GPIO directory appears */ + snprintf(gpio_path, sizeof(gpio_path), "/sys/class/gpio/gpio%u", pin); + unsigned int retry_count; + for (retry_count = 0; retry_count < GPIO_SYSFS_OPEN_RETRIES; retry_count++) { + int ret = stat(gpio_path, &stat_buf); + if (ret == 0) { + break; + } else if (ret < 0 && errno != ENOENT) { + linuxgpio_unexport(pin); + return ret; + } + + usleep(GPIO_SYSFS_OPEN_DELAY); + } + + /* Write direction, looping in case of EACCES errors due to delayed + * udev permission rule application after export */ + for (retry_count = GPIO_SYSFS_OPEN_RETRIES; retry_count > 0; retry_count--) { + usleep(GPIO_SYSFS_OPEN_DELAY); + if (i == PIN_AVR_MISO) + r=linuxgpio_dir_in(pin); + else + r=linuxgpio_dir_out(pin); + + if (r >= 0) { + break; + } else if (errno != EACCES) { + linuxgpio_unexport(pin); + return r; + } + if (retry_count > 1) { + printf("Retrying...\n"); + } + } + + if (r < 0) { + linuxgpio_unexport(pin); return r; + } if ((linuxgpio_fds[pin]=linuxgpio_openfd(pin)) < 0) return linuxgpio_fds[pin]; From 6fceea8f71a531178eeb964f0e12f93a0f7e81dd Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 10 Apr 2022 23:36:53 +0200 Subject: [PATCH 003/511] Fix linuxspi default port If no port is specified, Avrdude will try to use the default port specified in avrdude.conf. If not present, use port specified in linuxspi.c --- src/avrdude.conf.in | 4 +++- src/config.c | 1 + src/config_gram.y | 11 ++++++++++- src/lexer.l | 2 ++ src/libavrdude.h | 4 +++- src/main.c | 7 +++++++ 6 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 096751d0..13f8034c 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -22,7 +22,7 @@ # desc = ; # quoted string # type = ; # programmer type, quoted string # # supported programmer types can be listed by "-c ?type" -# connection_type = parallel | serial | usb +# connection_type = parallel | serial | usb | spi # baudrate = ; # baudrate for avr910-programmer # vcc = [, ... ] ; # pin number(s) # buff = [, ... ] ; # pin number(s) @@ -337,6 +337,7 @@ # default_parallel = "@DEFAULT_PAR_PORT@"; default_serial = "@DEFAULT_SER_PORT@"; +default_spi = "@DEFAULT_SPI_PORT@"; # default_bitclock = 2.5; # @@ -1609,6 +1610,7 @@ programmer id = "linuxspi"; desc = "Use Linux SPI device in /dev/spidev*"; type = "linuxspi"; + connection_type = spi; reset = 25; # Pi GPIO number - this is J8:22 ; @HAVE_LINUXSPI_END@ diff --git a/src/config.c b/src/config.c index 3d8a760e..00ac8b0e 100644 --- a/src/config.c +++ b/src/config.c @@ -35,6 +35,7 @@ char default_programmer[MAX_STR_CONST]; char default_parallel[PATH_MAX]; char default_serial[PATH_MAX]; +char default_spi[PATH_MAX]; double default_bitclock; char string_buf[MAX_STR_CONST]; diff --git a/src/config_gram.y b/src/config_gram.y index a8416162..20830ca7 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -79,6 +79,7 @@ static int pin_name; %token K_DEFAULT_PARALLEL %token K_DEFAULT_PROGRAMMER %token K_DEFAULT_SERIAL +%token K_DEFAULT_SPI %token K_DESC %token K_FAMILY_ID %token K_DEVICECODE @@ -115,6 +116,7 @@ static int pin_name; %token K_RESET %token K_RETRY_PULSE %token K_SERIAL +%token K_SPI %token K_SCK %token K_SIGNATURE %token K_SIZE @@ -254,6 +256,12 @@ def : free_token($3); } | + K_DEFAULT_SPI TKN_EQUAL TKN_STRING TKN_SEMI { + strncpy(default_spi, $3->value.string, PATH_MAX); + default_spi[PATH_MAX-1] = 0; + free_token($3); + } | + K_DEFAULT_BITCLOCK TKN_EQUAL number_real TKN_SEMI { default_bitclock = $3->value.number_real; free_token($3); @@ -507,7 +515,8 @@ prog_parm_conntype: prog_parm_conntype_id: K_PARALLEL { current_prog->conntype = CONNTYPE_PARALLEL; } | K_SERIAL { current_prog->conntype = CONNTYPE_SERIAL; } | - K_USB { current_prog->conntype = CONNTYPE_USB; } + K_USB { current_prog->conntype = CONNTYPE_USB; } | + K_SPI { current_prog->conntype = CONNTYPE_SPI; } ; prog_parm_usb: diff --git a/src/lexer.l b/src/lexer.l index 0b31eb21..00e83d6b 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -139,6 +139,7 @@ default_bitclock { yylval=NULL; return K_DEFAULT_BITCLOCK; } default_parallel { yylval=NULL; return K_DEFAULT_PARALLEL; } default_programmer { yylval=NULL; return K_DEFAULT_PROGRAMMER; } default_serial { yylval=NULL; return K_DEFAULT_SERIAL; } +default_spi { yylval=NULL; return K_DEFAULT_SPI; } delay { yylval=NULL; return K_DELAY; } desc { yylval=NULL; return K_DESC; } family_id { yylval=NULL; return K_FAMILY_ID; } @@ -222,6 +223,7 @@ sck { yylval=new_token(K_SCK); return K_SCK; } serial { yylval=NULL; return K_SERIAL; } signature { yylval=NULL; return K_SIGNATURE; } size { yylval=NULL; return K_SIZE; } +spi { yylval=NULL; return K_SPI; } spmcr { yylval=NULL; return K_SPMCR; } stabdelay { yylval=NULL; return K_STABDELAY; } stk500_devcode { yylval=NULL; return K_STK500_DEVCODE; } diff --git a/src/libavrdude.h b/src/libavrdude.h index ddb72b48..7ec7dd85 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -635,7 +635,8 @@ typedef enum { typedef enum { CONNTYPE_PARALLEL, CONNTYPE_SERIAL, - CONNTYPE_USB + CONNTYPE_USB, + CONNTYPE_SPI } conntype_t; typedef struct programmer_t { @@ -912,6 +913,7 @@ extern LISTID programmers; extern char default_programmer[]; extern char default_parallel[]; extern char default_serial[]; +extern char default_spi[]; extern double default_bitclock; /* This name is fixed, it's only here for symmetry with diff --git a/src/main.c b/src/main.c index 253c6e51..7198c42d 100644 --- a/src/main.c +++ b/src/main.c @@ -382,6 +382,7 @@ int main(int argc, char * argv []) default_parallel[0] = 0; default_serial[0] = 0; + default_spi[0] = 0; default_bitclock = 0.0; init_config(); @@ -921,6 +922,12 @@ int main(int argc, char * argv []) case CONNTYPE_USB: port = DEFAULT_USB; break; + +#ifdef HAVE_LINUXSPI + case CONNTYPE_SPI: + port = *default_spi ? default_spi : "unknown"; + break; +#endif } } From ed38456f83ac84ab1f3facc52de83f4e58a78f18 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 15 Apr 2022 20:46:40 +0100 Subject: [PATCH 004/511] Piggy-back 'Do not remove trailing 0xff' onto option -D --- src/avr.c | 10 ++++++++++ src/fileio.c | 5 ++++- src/main.c | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/avr.c b/src/avr.c index d6e78bb5..9d2bf503 100644 --- a/src/avr.c +++ b/src/avr.c @@ -282,6 +282,16 @@ int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, int avr_mem_hiaddr(AVRMEM * mem) { int i, n; + static int disableffopt; + + /* calling once with NULL disables any future trailing-0xff optimisation */ + if(!mem) { + disableffopt = 1; + return 0; + } + + if(disableffopt) + return mem->size; /* return the highest non-0xff address regardless of how much memory was read */ diff --git a/src/fileio.c b/src/fileio.c index 7c021ce4..429a200e 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1594,7 +1594,10 @@ int fileio(int op, char * filename, FILEFMT format, * if we are reading flash, just mark the size as being the * highest non-0xff byte */ - rc = avr_mem_hiaddr(mem); + int hiaddr = avr_mem_hiaddr(mem); + + if(hiaddr < rc) /* if trailing-0xff not disabled */ + rc = hiaddr; } } if (format != FMT_IMM && !using_stdio) { diff --git a/src/main.c b/src/main.c index 253c6e51..c3bc0381 100644 --- a/src/main.c +++ b/src/main.c @@ -528,6 +528,7 @@ int main(int argc, char * argv []) case 'D': /* disable auto erase */ uflags &= ~UF_AUTO_ERASE; + avr_mem_hiaddr(NULL); /* disable trailing 0xff optimisation */ break; case 'e': /* perform a chip erase */ From e18d436f88e575afcee68343842660b44aa9ce30 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 15 Apr 2022 20:48:46 +0100 Subject: [PATCH 005/511] Move evaluating 'is flash' from caller to callee avr_mem_hiaddr() --- src/avr.c | 27 +++++++++++---------------- src/fileio.c | 19 ++++++------------- 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/src/avr.c b/src/avr.c index 9d2bf503..a6d621b7 100644 --- a/src/avr.c +++ b/src/avr.c @@ -278,6 +278,7 @@ int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, * value. This is useful for determining where to stop when dealing * with "flash" memory, since writing 0xff to flash is typically a * no-op. Always return an even number since flash is word addressed. + * Only apply this optimisation on flash-type memory. */ int avr_mem_hiaddr(AVRMEM * mem) { @@ -293,6 +294,13 @@ int avr_mem_hiaddr(AVRMEM * mem) if(disableffopt) return mem->size; + /* if the memory is not a flash-type memory do not remove trailing 0xff */ + if(strcasecmp(mem->desc, "flash") && + strcasecmp(mem->desc, "application") && + strcasecmp(mem->desc, "apptable") && + strcasecmp(mem->desc, "boot")) + return mem->size; + /* return the highest non-0xff address regardless of how much memory was read */ for (i=mem->size-1; i>0; i--) { @@ -426,15 +434,8 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, nread++; report_progress(nread, npages, NULL); } - if (!failure) { - if (strcasecmp(mem->desc, "flash") == 0 || - strcasecmp(mem->desc, "application") == 0 || - strcasecmp(mem->desc, "apptable") == 0 || - strcasecmp(mem->desc, "boot") == 0) - return avr_mem_hiaddr(mem); - else - return mem->size; - } + if (!failure) + return avr_mem_hiaddr(mem); /* else: fall back to byte-at-a-time write, for historical reasons */ } @@ -464,13 +465,7 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, report_progress(i, mem->size, NULL); } - if (strcasecmp(mem->desc, "flash") == 0 || - strcasecmp(mem->desc, "application") == 0 || - strcasecmp(mem->desc, "apptable") == 0 || - strcasecmp(mem->desc, "boot") == 0) - return avr_mem_hiaddr(mem); - else - return i; + return avr_mem_hiaddr(mem); } diff --git a/src/fileio.c b/src/fileio.c index 429a200e..754e267b 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1585,21 +1585,14 @@ int fileio(int op, char * filename, FILEFMT format, return -1; } - if (rc > 0) { - if ((op == FIO_READ) && (strcasecmp(mem->desc, "flash") == 0 || - strcasecmp(mem->desc, "application") == 0 || - strcasecmp(mem->desc, "apptable") == 0 || - strcasecmp(mem->desc, "boot") == 0)) { - /* - * if we are reading flash, just mark the size as being the - * highest non-0xff byte - */ - int hiaddr = avr_mem_hiaddr(mem); + /* on reading flash set the size to location of highest non-0xff byte */ + if (rc > 0 && op == FIO_READ) { + int hiaddr = avr_mem_hiaddr(mem); - if(hiaddr < rc) /* if trailing-0xff not disabled */ - rc = hiaddr; - } + if(hiaddr < rc) /* if trailing-0xff not disabled */ + rc = hiaddr; } + if (format != FMT_IMM && !using_stdio) { fclose(f); } From 2397984d2b13b885fee4100f79af6612dca33599 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 27 Apr 2022 18:54:13 +0100 Subject: [PATCH 006/511] Disable trailing-0xff removal when invoking arduino programmer --- src/arduino.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/arduino.c b/src/arduino.c index dbaafef2..7f030a13 100644 --- a/src/arduino.c +++ b/src/arduino.c @@ -130,4 +130,7 @@ void arduino_initpgm(PROGRAMMER * pgm) pgm->read_sig_bytes = arduino_read_sig_bytes; pgm->open = arduino_open; pgm->close = arduino_close; + + /* disable trailing-0xff removal when reading input files and avr flash */ + avr_mem_hiaddr(NULL); } From 52b20f4a2808dc6732fd9d185a9f0b3c1122b7e0 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 28 Apr 2022 17:26:09 +0100 Subject: [PATCH 007/511] Provide self-documenting API for disabling trailing-0xff removal --- src/arduino.c | 3 +-- src/libavrdude.h | 1 + src/main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/arduino.c b/src/arduino.c index 7f030a13..f7b60246 100644 --- a/src/arduino.c +++ b/src/arduino.c @@ -131,6 +131,5 @@ void arduino_initpgm(PROGRAMMER * pgm) pgm->open = arduino_open; pgm->close = arduino_close; - /* disable trailing-0xff removal when reading input files and avr flash */ - avr_mem_hiaddr(NULL); + disable_trailing_ff_removal(); /* so that arduino bootloader can ignore chip erase */ } diff --git a/src/libavrdude.h b/src/libavrdude.h index ddb72b48..d8d5739a 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -787,6 +787,7 @@ int avr_get_cycle_count(PROGRAMMER * pgm, AVRPART * p, int * cycles); int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles); +#define disable_trailing_ff_removal() avr_mem_hiaddr(NULL) int avr_mem_hiaddr(AVRMEM * mem); int avr_chip_erase(PROGRAMMER * pgm, AVRPART * p); diff --git a/src/main.c b/src/main.c index c3bc0381..526ae35f 100644 --- a/src/main.c +++ b/src/main.c @@ -528,7 +528,7 @@ int main(int argc, char * argv []) case 'D': /* disable auto erase */ uflags &= ~UF_AUTO_ERASE; - avr_mem_hiaddr(NULL); /* disable trailing 0xff optimisation */ + disable_trailing_ff_removal(); break; case 'e': /* perform a chip erase */ From 52734bafc6af7cfc4b72824629159900ee88f6a6 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 28 Apr 2022 17:29:06 +0100 Subject: [PATCH 008/511] Add option -A to separately disable trailing-0xff removal --- src/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 526ae35f..f5381834 100644 --- a/src/main.c +++ b/src/main.c @@ -110,7 +110,8 @@ static void usage(void) " -B Specify JTAG/STK500v2 bit clock period (us).\n" " -C Specify location of configuration file.\n" " -c Specify programmer type.\n" - " -D Disable auto erase for flash memory\n" + " -A Disable trailing-0xff removal from file and AVR read.\n" + " -D Disable auto erase for flash memory; implies -A.\n" " -i ISP Clock Delay [in microseconds]\n" " -P Specify connection port.\n" " -F Override invalid signature check.\n" @@ -442,7 +443,7 @@ int main(int argc, char * argv []) /* * process command line arguments */ - while ((ch = getopt(argc,argv,"?b:B:c:C:DeE:Fi:l:np:OP:qstU:uvVx:yY:")) != -1) { + while ((ch = getopt(argc,argv,"?Ab:B:c:C:DeE:Fi:l:np:OP:qstU:uvVx:yY:")) != -1) { switch (ch) { case 'b': /* override default programmer baud rate */ @@ -528,6 +529,9 @@ int main(int argc, char * argv []) case 'D': /* disable auto erase */ uflags &= ~UF_AUTO_ERASE; + /* fall through */ + + case 'A': /* explicit disabling of trailing-0xff removal */ disable_trailing_ff_removal(); break; From f47ec634f81a0f9bd89aa6ce0616b147f69da5d9 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 28 Apr 2022 17:53:10 +0100 Subject: [PATCH 009/511] On verify always verify full input file --- src/fileio.c | 9 +++++---- src/libavrdude.h | 5 +++-- src/update.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index 754e267b..1c81682d 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1446,16 +1446,17 @@ static int fmt_autodetect(char * fname) -int fileio(int op, char * filename, FILEFMT format, +int fileio(int oprwv, char * filename, FILEFMT format, struct avrpart * p, char * memtype, int size) { - int rc; + int op, rc; FILE * f; char * fname; struct fioparms fio; AVRMEM * mem; int using_stdio; + op = oprwv == FIO_READ_FOR_VERIFY? FIO_READ: oprwv; mem = avr_locate_mem(p, memtype); if (mem == NULL) { avrdude_message(MSG_INFO, "fileio(): memory type \"%s\" not configured for device \"%s\"\n", @@ -1585,8 +1586,8 @@ int fileio(int op, char * filename, FILEFMT format, return -1; } - /* on reading flash set the size to location of highest non-0xff byte */ - if (rc > 0 && op == FIO_READ) { + /* on reading flash other than for verify set the size to location of highest non-0xff byte */ + if (rc > 0 && oprwv == FIO_READ) { int hiaddr = avr_mem_hiaddr(mem); if(hiaddr < rc) /* if trailing-0xff not disabled */ diff --git a/src/libavrdude.h b/src/libavrdude.h index d8d5739a..73083932 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -826,7 +826,8 @@ struct fioparms { enum { FIO_READ, - FIO_WRITE + FIO_WRITE, + FIO_READ_FOR_VERIFY, }; #ifdef __cplusplus @@ -835,7 +836,7 @@ extern "C" { char * fmtstr(FILEFMT format); -int fileio(int op, char * filename, FILEFMT format, +int fileio(int oprwv, char * filename, FILEFMT format, struct avrpart * p, char * memtype, int size); #ifdef __cplusplus diff --git a/src/update.c b/src/update.c index 15002549..d3c208fc 100644 --- a/src/update.c +++ b/src/update.c @@ -341,7 +341,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f progname, mem->desc, alias_mem_desc, upd->filename); } - rc = fileio(FIO_READ, upd->filename, upd->format, p, upd->memtype, -1); + rc = fileio(FIO_READ_FOR_VERIFY, upd->filename, upd->format, p, upd->memtype, -1); if (rc < 0) { avrdude_message(MSG_INFO, "%s: read from file '%s' failed\n", progname, upd->filename); From 580c37fbfefcff83131ea767b176cbf27f9a39a8 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 29 Apr 2022 00:14:45 +0100 Subject: [PATCH 010/511] Describe -A in the man and .texi documentation --- src/avrdude.1 | 25 ++++++++++++++++++++++--- src/doc/avrdude.texi | 15 +++++++++++++-- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/avrdude.1 b/src/avrdude.1 index cc05cf4c..48082d00 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -18,7 +18,7 @@ .\" .\" $Id$ .\" -.Dd DATE November 22, 2021 +.Dd DATE April 28, 2022 .Os .Dt AVRDUDE 1 .Sh NAME @@ -31,6 +31,7 @@ .Op Fl B Ar bitclock .Op Fl c Ar programmer-id .Op Fl C Ar config-file +.Op Fl A .Op Fl D .Op Fl e .Oo Fl E Ar exitspec Ns @@ -102,7 +103,7 @@ available (like almost all embedded Linux boards) you can do without any additional hardware - just connect them to the MOSI, MISO, RESET and SCK pins on the AVR and use the linuxgpio programmer type. It bitbangs the lines using the Linux sysfs GPIO interface. Of course, care should -be taken about voltage level compatibility. Also, although not strictrly +be taken about voltage level compatibility. Also, although not strictly required, it is strongly advisable to protect the GPIO pins from overcurrent situations in some way. The simplest would be to just put some resistors in series or better yet use a 3-state buffer driver like @@ -253,7 +254,7 @@ The Teensy bootloader is supported for all AVR boards. As the bootloader does not support reading from flash memory, use the .Fl V -option to prevent AVRDUDE from verifing the flash memory. +option to prevent AVRDUDE from verifying the flash memory. See the section on .Em extended parameters for Teensy specific options. @@ -376,6 +377,20 @@ files. This can be used to add entries to the configuration without patching your system wide configuration file. It can be used several times, the files are read in same order as given on the command line. +.It Fl A +Disable the automatic removal of trailing-0xFF sequences in file +input that is to be programmed to flash and in AVR reads from +flash memory. Normally, trailing 0xFFs can be discarded, as flash +programming requires the memory be erased to 0xFF beforehand. +.Fl A +should be used when the programmer hardware, or bootloader +software for that matter, does not carry out chip erase and +instead handles the memory erase on a page level. The popular +Arduino bootloader exhibits this behaviour; for this reason +.Fl A +is engaged by default when specifying +. Fl c +arduino. .It Fl D Disable auto erase for flash. When the .Fl U @@ -389,6 +404,10 @@ use page erase before writing each page so no explicit chip erase is required. Note however that any page not affected by the current operation will retain its previous contents. +Setting +.Fl D +implies +.Fl A. .It Fl e Causes a chip erase to be executed. This will reset the contents of the flash ROM and EEPROM to the value diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index ad4a6598..a7901361 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -321,13 +321,13 @@ via a serial link (@url{https://github.com/ElTangas/jtag2updi}). The Micronucleus bootloader is supported for both protocol version V1 and V2. As the bootloader does not support reading from flash memory, -use the @code{-V} option to prevent AVRDUDE from verifing the flash memory. +use the @code{-V} option to prevent AVRDUDE from verifying the flash memory. See the section on @emph{extended parameters} below for Micronucleus specific options. The Teensy bootloader is supported for all AVR boards. As the bootloader does not support reading from flash memory, -use the @code{-V} option to prevent AVRDUDE from verifing the flash memory. +use the @code{-V} option to prevent AVRDUDE from verifying the flash memory. See the section on @emph{extended parameters} below for Teensy specific options. @@ -495,6 +495,16 @@ without patching your system wide configuration file. It can be used several times, the files are read in same order as given on the command line. +@item -A +Disable the automatic removal of trailing-0xFF sequences in file +input that is to be programmed to flash and in AVR reads from +flash memory. Normally, trailing 0xFFs can be discarded, as flash +programming requires the memory be erased to 0xFF beforehand. -A +should be used when the programmer hardware, or bootloader +software for that matter, does not carry out chip erase and +instead handles the memory erase on a page level. The popular +Arduino bootloader exhibits this behaviour; for this reason -A is +engaged by default when specifying -c arduino. @item -D Disable auto erase for flash. When the -U option with flash memory is @@ -506,6 +516,7 @@ use page erase before writing each page so no explicit chip erase is required. Note however that any page not affected by the current operation will retain its previous contents. +Setting -D implies -A. @item -e Causes a chip erase to be executed. This will reset the contents of the From 033b2ed796ffbf8327ab51be0d6f528c83bbab1a Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 29 Apr 2022 00:37:28 +0100 Subject: [PATCH 011/511] Treat x bits in .conf SPI commands as 0 --- src/avrpart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/avrpart.c b/src/avrpart.c index dc6def44..fdff0f78 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -82,11 +82,11 @@ int avr_set_bits(OPCODE * op, unsigned char * cmd) unsigned char mask; for (i=0; i<32; i++) { - if (op->bit[i].type == AVR_CMDBIT_VALUE) { + if (op->bit[i].type == AVR_CMDBIT_VALUE || op->bit[i].type == AVR_CMDBIT_IGNORE) { j = 3 - i / 8; bit = i % 8; mask = 1 << bit; - if (op->bit[i].value) + if (op->bit[i].value && op->bit[i].type == AVR_CMDBIT_VALUE) cmd[j] = cmd[j] | mask; else cmd[j] = cmd[j] & ~mask; From 3bdf138721bd4a08ed743312e11a95aa8a2ee892 Mon Sep 17 00:00:00 2001 From: Marius Greuel Date: Thu, 5 May 2022 20:45:47 +0200 Subject: [PATCH 012/511] Fix micronucleus bootloader to check for unresponsive USB devices --- src/micronucleus.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/micronucleus.c b/src/micronucleus.c index b3c25341..b8d9d7ee 100644 --- a/src/micronucleus.c +++ b/src/micronucleus.c @@ -744,6 +744,19 @@ static int micronucleus_open(PROGRAMMER* pgm, char* port) { avrdude_message(MSG_INFO, "%s: ERROR: Failed to open USB device: %s\n", progname, usb_strerror()); } + else + { + // Send a dummy request to check for a unresponsive USB device. + int result = micronucleus_get_bootloader_info(pdata); + if (result < 0) + { + avrdude_message(MSG_NOTICE, "%s: WARNING: Failed to probe device (error %d), skipping...\n", + progname, result); + + usb_close(pdata->usb_handle); + pdata->usb_handle = NULL; + } + } } } } From c64f2030a175341ee8943757d12dcf91f5af829c Mon Sep 17 00:00:00 2001 From: Marius Greuel Date: Thu, 5 May 2022 21:42:27 +0200 Subject: [PATCH 013/511] Improve micronucleus bootloader user experience for unresponsive USB devices --- src/micronucleus.c | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/micronucleus.c b/src/micronucleus.c index b8d9d7ee..28dac2cb 100644 --- a/src/micronucleus.c +++ b/src/micronucleus.c @@ -139,6 +139,22 @@ static int micronucleus_check_connection(pdata_t* pdata) } } +static bool micronucleus_is_device_responsive(pdata_t* pdata, struct usb_device* device) +{ + pdata->usb_handle = usb_open(device); + if (pdata->usb_handle == NULL) + { + return false; + } + + int result = micronucleus_check_connection(pdata); + + usb_close(pdata->usb_handle); + pdata->usb_handle = NULL; + + return result >= 0; +} + static int micronucleus_reconnect(pdata_t* pdata) { struct usb_device* device = usb_device(pdata->usb_handle); @@ -696,6 +712,7 @@ static int micronucleus_open(PROGRAMMER* pgm, char* port) usb_init(); bool show_retry_message = true; + bool show_unresponsive_device_message = true; time_t start_time = time(NULL); for (;;) @@ -717,6 +734,19 @@ static int micronucleus_open(PROGRAMMER* pgm, char* port) pdata->major_version = (uint8_t)(device->descriptor.bcdDevice >> 8); pdata->minor_version = (uint8_t)(device->descriptor.bcdDevice >> 0); + if (!micronucleus_is_device_responsive(pdata, device)) + { + if (show_unresponsive_device_message) + { + avrdude_message(MSG_INFO, "%s: WARNING: Unresponsive Micronucleus device detected, please reconnect....\n", + progname); + + show_unresponsive_device_message = false; + } + + continue; + } + avrdude_message(MSG_NOTICE, "%s: Found device with Micronucleus V%d.%d, bus:device: %s:%s\n", progname, pdata->major_version, pdata->minor_version, @@ -744,19 +774,6 @@ static int micronucleus_open(PROGRAMMER* pgm, char* port) { avrdude_message(MSG_INFO, "%s: ERROR: Failed to open USB device: %s\n", progname, usb_strerror()); } - else - { - // Send a dummy request to check for a unresponsive USB device. - int result = micronucleus_get_bootloader_info(pdata); - if (result < 0) - { - avrdude_message(MSG_NOTICE, "%s: WARNING: Failed to probe device (error %d), skipping...\n", - progname, result); - - usb_close(pdata->usb_handle); - pdata->usb_handle = NULL; - } - } } } } From 01a9e42d7d43bb4329740f9d72b1c3591e342726 Mon Sep 17 00:00:00 2001 From: Marius Greuel Date: Thu, 5 May 2022 22:08:46 +0200 Subject: [PATCH 014/511] Fix typo in micronucleus message --- src/micronucleus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/micronucleus.c b/src/micronucleus.c index 28dac2cb..c3dd007d 100644 --- a/src/micronucleus.c +++ b/src/micronucleus.c @@ -738,7 +738,7 @@ static int micronucleus_open(PROGRAMMER* pgm, char* port) { if (show_unresponsive_device_message) { - avrdude_message(MSG_INFO, "%s: WARNING: Unresponsive Micronucleus device detected, please reconnect....\n", + avrdude_message(MSG_INFO, "%s: WARNING: Unresponsive Micronucleus device detected, please reconnect...\n", progname); show_unresponsive_device_message = false; From 9bc28d410e7e646b29f8f3e03f5afb2225e118af Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sat, 7 May 2022 22:57:49 +0200 Subject: [PATCH 015/511] Post-7.0 changes Update version date in configure.ac. Update template in NEWS --- NEWS | 14 ++++++++++++++ src/configure.ac | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 2a190861..558831ab 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,20 @@ Approximate change log for AVRDUDE by version. (For detailed changes, see the version control system logs.) ---------------------------------------------------------------------- +Changes since version 7.0: + + * Major changes compared to the previous version: + + * New devices supported: + + * New programmers supported: + + * Issues fixed: + + * Pull requests: + + * Internals: + Changes in version 7.0: * Major changes compared to the previous version: diff --git a/src/configure.ac b/src/configure.ac index ae60e3f1..e6629c73 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -23,7 +23,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.60) -AC_INIT(avrdude, 7.0, avrdude-dev@nongnu.org) +AC_INIT(avrdude, 7.0-20220508, avrdude-dev@nongnu.org) AC_CANONICAL_BUILD AC_CANONICAL_HOST From d6347f4187451653371b83edf6ff6a2c02567d61 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sun, 8 May 2022 13:58:44 +0200 Subject: [PATCH 016/511] Correctly name the release in CMakeLists.txt as well --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3d6f8dd..95c89d2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ # cmake --build build cmake_minimum_required(VERSION 3.12) -project(avrdude VERSION 6.99) +project(avrdude VERSION 7.0) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED True) From b9a012cebb96a4ec73763a58b45ace9aeb7af00d Mon Sep 17 00:00:00 2001 From: Subhaditya Nath Date: Sun, 8 May 2022 20:35:32 +0530 Subject: [PATCH 017/511] Fix .Dd macro in manpage The correct format for .Dd according to mdoc(7) is - .Dd month day, year --- src/avrdude.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/avrdude.1 b/src/avrdude.1 index cc05cf4c..81834d30 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -18,7 +18,7 @@ .\" .\" $Id$ .\" -.Dd DATE November 22, 2021 +.Dd November 22, 2021 .Os .Dt AVRDUDE 1 .Sh NAME From 4601bee4afa76fb4aa8392ffdd4a4dd56ede1bae Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sun, 8 May 2022 20:39:12 +0200 Subject: [PATCH 018/511] Mention PR 949 --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 558831ab..ca827290 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,8 @@ Changes since version 7.0: * Pull requests: + - Fix .Dd macro in manpage #949 + * Internals: Changes in version 7.0: From 75bfbf7bef53a54a6824626913253d0b4bebc9e8 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 9 May 2022 02:02:42 +0200 Subject: [PATCH 019/511] fix M1 homebrew path --- build.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index baea4516..4fceb6e3 100755 --- a/build.sh +++ b/build.sh @@ -50,7 +50,13 @@ case "${ostype}" in then build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/opt/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/local/lib" else - build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar" + # Apple M1 (may be new version of homebrew also) + if [ -d /opt/homebrew ] + then + build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/homebrew/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/homebrew/Cellar" + else + build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar" + fi fi ;; From a23055d6481f268f1782a55303cc5427072bbe1e Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 9 May 2022 14:51:16 +0200 Subject: [PATCH 020/511] fix typo --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 4fceb6e3..0b664807 100755 --- a/build.sh +++ b/build.sh @@ -53,7 +53,7 @@ case "${ostype}" in # Apple M1 (may be new version of homebrew also) if [ -d /opt/homebrew ] then - build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/homebrew/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/homebrew/Cellar" + build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/opt/homebrew/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/Cellar" else build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar" fi From 8b61c9dd8f0c0e99bd89389c4f19f186beeef3ef Mon Sep 17 00:00:00 2001 From: Marius Greuel Date: Wed, 11 May 2022 20:56:05 +0200 Subject: [PATCH 021/511] CMake: Move MSVC compatibility shim into library --- src/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a8e0262b..7d6771f3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -51,7 +51,7 @@ include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) add_compile_definitions(CONFIG_DIR=\"${CONFIG_DIR}\") if(WIN32) - set(EXTRA_WINDOWS_SOURCES "${PROJECT_BINARY_DIR}/src/windows.rc") + set(EXTRA_WINDOWS_RESOURCES "${PROJECT_BINARY_DIR}/src/windows.rc") set(EXTRA_WINDOWS_LIBRARIES setupapi ws2_32) endif() @@ -216,6 +216,7 @@ add_library(libavrdude xbee.c ${FLEX_Parser_OUTPUTS} ${BISON_Parser_OUTPUTS} + "${EXTRA_WINDOWS_SOURCES}" ) set_target_properties(libavrdude PROPERTIES @@ -253,7 +254,7 @@ add_executable(avrdude term.h whereami.c whereami.h - "${EXTRA_WINDOWS_SOURCES}" + "${EXTRA_WINDOWS_RESOURCES}" ) target_link_libraries(avrdude PUBLIC libavrdude) From 053c2dcdd3cb24e0778bd54073c7456a66056a68 Mon Sep 17 00:00:00 2001 From: Marius Greuel Date: Wed, 11 May 2022 20:57:14 +0200 Subject: [PATCH 022/511] CMake: Include GCC specific options also for MSYS2 --- src/CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7d6771f3..7577e113 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,11 +55,6 @@ if(WIN32) set(EXTRA_WINDOWS_LIBRARIES setupapi ws2_32) endif() -if(NOT WIN32) - set(LIB_MATH m) - add_compile_options(-Wall) # -Wextra -endif() - if(MSVC) add_compile_definitions(_CRT_SECURE_NO_WARNINGS=1) add_compile_definitions(_CRT_NONSTDC_NO_WARNINGS=1) @@ -79,6 +74,9 @@ if(MSVC) set(EXTRA_WINDOWS_INCLUDES ${EXTRA_WINDOWS_INCLUDES} "msvc" ) +else() + set(LIB_MATH m) + add_compile_options(-Wall) # -Wextra endif() # ===================================== From 0ea4b08b2f895ed89dcc0f0557acf9de0bd0dcd3 Mon Sep 17 00:00:00 2001 From: Marius Greuel Date: Wed, 11 May 2022 21:02:03 +0200 Subject: [PATCH 023/511] CMake: If installed, use static version of libreadline for MSYS2 --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95c89d2b..cf3623e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,7 @@ if(WIN32) set(PREFERRED_LIBHIDAPI libhidapi.a libhidapi-libusb.a libhidapi-hidraw.a hidapi hidapi-libusb hidapi-hidraw) set(PREFERRED_LIBFTDI libftdi.a ftdi) set(PREFERRED_LIBFTDI1 libftdi1.a ftdi1) + set(PREFERRED_LIBREADLINE libreadline.a) else() set(PREFERRED_LIBELF elf) set(PREFERRED_LIBUSB usb) @@ -125,6 +126,7 @@ else() set(PREFERRED_LIBHIDAPI hidapi hidapi-libusb hidapi-hidraw) set(PREFERRED_LIBFTDI ftdi) set(PREFERRED_LIBFTDI1 ftdi1) + set(PREFERRED_LIBREADLINE readline) endif() # ------------------------------------- @@ -212,7 +214,7 @@ endif() # ------------------------------------- # Find libreadline -find_library(HAVE_LIBREADLINE NAMES readline) +find_library(HAVE_LIBREADLINE NAMES ${PREFERRED_LIBREADLINE}) if(HAVE_LIBREADLINE) set(LIB_LIBREADLINE ${HAVE_LIBREADLINE}) endif() From 65bb41f8e9bd500d2afe2462a7ff7f93b3c277b7 Mon Sep 17 00:00:00 2001 From: Marius Greuel Date: Wed, 11 May 2022 21:08:05 +0200 Subject: [PATCH 024/511] CMake: Add build option to select static or shared libraries --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf3623e9..19897c72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,13 @@ option(USE_LIBUSBWIN32 "Prefer libusb-win32 over libusb" OFF) option(DEBUG_CMAKE "Enable debugging output for this CMake project" OFF) option(BUILD_SHARED_LIBS "Build shared libraries" OFF) +if(WIN32) + # Prefer static libraries over DLLs on Windows + option(USE_STATIC_LIBS "Use static libraries" ON) +else() + option(USE_STATIC_LIBS "Use static libraries" OFF) +endif() + include(CheckIncludeFile) include(CheckSymbolExists) include(FetchContent) @@ -110,8 +117,7 @@ endif() # Detect installed libraries # ===================================== -# Prefer static libraries over DLLs on Windows -if(WIN32) +if(USE_STATIC_LIBS) set(PREFERRED_LIBELF libelf.a elf) set(PREFERRED_LIBUSB libusb.a usb) set(PREFERRED_LIBUSB_1_0 libusb-1.0.a usb-1.0) From 3b0d7e5d5d325362d4ca1f4ebc7271c653a89766 Mon Sep 17 00:00:00 2001 From: Ebben Aries Date: Sat, 21 May 2022 14:25:27 -0600 Subject: [PATCH 025/511] Fix src/CMakeLists.txt to honor CMAKE_INSTALL_LIBDIR --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a8e0262b..d4472481 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -264,8 +264,8 @@ target_link_libraries(avrdude PUBLIC libavrdude) install(TARGETS avrdude DESTINATION bin) install(TARGETS libavrdude - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION include COMPONENT dev ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avrdude.conf" TYPE SYSCONF) From 952ad72fb9f962e450764d506044987aafa1d855 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 24 May 2022 16:56:11 +0100 Subject: [PATCH 026/511] Add -p \* to summarise properties of parts in conf --- src/main.c | 313 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 310 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 253c6e51..6ed62221 100644 --- a/src/main.c +++ b/src/main.c @@ -26,7 +26,7 @@ * For parallel port connected programmers, the pin definitions can be * changed via a config file. See the config file for instructions on * how to add a programmer definition. - * + * */ #include "ac_cfg.h" @@ -102,7 +102,7 @@ int ovsigck; /* 1=override sig check, 0=don't */ */ static void usage(void) { - avrdude_message(MSG_INFO, + avrdude_message(MSG_INFO, "Usage: %s [options]\n" "Options:\n" " -p Required. Specify AVR device.\n" @@ -310,6 +310,119 @@ static void replace_backslashes(char *s) } +static char cmdbitchar(CMDBIT cb) { + switch(cb.type) { + case AVR_CMDBIT_IGNORE: + return 'x'; + case AVR_CMDBIT_VALUE: + return cb.value? '1': '0'; + case AVR_CMDBIT_ADDRESS: + return 'a'; + case AVR_CMDBIT_INPUT: + return 'i'; + case AVR_CMDBIT_OUTPUT: + return 'o'; + default: + return '?'; + } +} + +static const char *opcodename(int what) { + switch(what) { + case AVR_OP_READ: + return "read"; + case AVR_OP_WRITE: + return "write"; + case AVR_OP_READ_LO: + return "read_lo"; + case AVR_OP_READ_HI: + return "read_hi"; + case AVR_OP_WRITE_LO: + return "write_lo"; + case AVR_OP_WRITE_HI: + return "write_hi"; + case AVR_OP_LOADPAGE_LO: + return "loadpage_lo"; + case AVR_OP_LOADPAGE_HI: + return "loadpage_hi"; + case AVR_OP_LOAD_EXT_ADDR: + return "load_ext_addr"; + case AVR_OP_WRITEPAGE: + return "writepage"; + case AVR_OP_CHIP_ERASE: + return "chip_erase"; + case AVR_OP_PGM_ENABLE: + return "pgm_enable"; + default: + return "???"; + } +} + +static void printopcode(AVRPART *p, const char *d, OPCODE **opa, int what) { + unsigned char cmd[4]; + int i; + + if(opa && opa[what]) { + memset(cmd, 0, sizeof cmd); + avr_set_bits(opa[what], cmd); + + avrdude_message(MSG_INFO, ".op %s %s %s 0x%02x%02x%02x%02x ", p->desc, d, opcodename(what), cmd[0], cmd[1], cmd[2], cmd[3]); + for(i=31; i >= 0; i--) { + avrdude_message(MSG_INFO, "%c", cmdbitchar(opa[what]->bit[i])); + if(i%8 == 0) + avrdude_message(MSG_INFO, "%c", i? ' ': '\n'); + } + } +} + +static void printallopcodes(AVRPART *p, const char *d, OPCODE **opa) { + for(int i=0; i>= 1; ret++) + continue; + + return ret; +} + +// check whether address bits are where they should be in ISP commands +static void checkaddr(int memsize, int pagesize, int what, OPCODE *op, AVRPART *p, AVRMEM *m) { + int i, lo, hi; + const char *whatstr = opcodename(what); + + lo = intlog2(pagesize); + hi = intlog2(memsize-1); + + // address bits should be between positions lo and hi (and fall in line), outside should be 0 or don't care + for(i=0; i<16; i++) { // ISP programming only deals with 16-bit addresses (words for flash, bytes for eeprom) + if(i < lo || i > hi) { + if(op->bit[i+8].type != AVR_CMDBIT_IGNORE && !(op->bit[i+8].type == AVR_CMDBIT_VALUE && op->bit[i+8].value == 0)) { + avrdude_message(MSG_INFO, ".cmdbit%d %s %s-%s outside addressable space should be x or 0, but is %c", i+8, p->desc, m->desc, whatstr, cmdbitchar(op->bit[i+8])); + if(op->bit[i+8].type == AVR_CMDBIT_ADDRESS) + avrdude_message(MSG_INFO, "%d", op->bit[i+8].bitno); + avrdude_message(MSG_INFO, "\n"); + } + } else { + if(op->bit[i+8].type != AVR_CMDBIT_ADDRESS) + avrdude_message(MSG_INFO, ".cmdbit%d %s %s-%s is %c but should be a\n", i+8, p->desc, m->desc, whatstr, cmdbitchar(op->bit[i+8])); + else if(op->bit[i+8].bitno != i) + avrdude_message(MSG_INFO, ".cmdbit%d %s %s-%s inconsistent: a%d specified as a%d\n", i+8, p->desc, m->desc, whatstr, i, op->bit[i+8].bitno); + } + } + for(i=0; i<32; i++) // command bits 8..23 should not contain address bits + if((i<8 || i>23) && op->bit[i].type == AVR_CMDBIT_ADDRESS) + avrdude_message(MSG_INFO, ".cmdbit%d %s %s-%s contains a%d which it shouldn't\n", i, p->desc, m->desc, whatstr, op->bit[i].bitno); +} + /* * main routine */ @@ -830,6 +943,200 @@ int main(int argc, char * argv []) avrdude_message(MSG_NOTICE, "\n"); + // print part descriptions for debugging avrdude.conf and exit + if(partdesc && 0 == strcmp(partdesc, "*")) { + int first = 1; + + for(LNODEID ln1 = lfirst(part_list); ln1; ln1 = lnext(ln1)) { + AVRPART *p = ldata(ln1); + int flashsize = 0, flashoffset = 0, flashpagesize = 0, eepromsize = 0, eepromoffset = 0, eeprompagesize = 0; + + if(p->mem) { + for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { + AVRMEM *m = ldata(lnm); + if(!flashsize && m->desc && 0==strcmp(m->desc, "flash")) { + flashsize = m->size; + flashpagesize = m->page_size; + flashoffset = m->offset; + } + if(!eepromsize && m->desc && 0==strcmp(m->desc, "eeprom")) { + eepromsize = m->size; + eepromoffset = m->offset; + eeprompagesize = m->page_size; + } + } + } + +#define AD_SPI_EN_CE_SIG 1 +#define AD_SPI_PROGMEM 2 +#define AD_SPI_PROGMEM_PAGED 4 +#define AD_SPI_LOAD_EXT_ADDR 8 +#define AD_SPI_EEPROM 16 +#define AD_SPI_EEPROM_PAGED 32 +#define AD_SPI_LOCK 64 +#define AD_SPI_CALIBRATION 128 +#define AD_SPI_LFUSE 256 +#define AD_SPI_HFUSE 512 +#define AD_SPI_EFUSE 1024 + + if(flashsize && !index(p->desc, ' ')) { + int len, ok, nfuses; + AVRMEM *m; + OPCODE *oc; + + if(!first) + avrdude_message(MSG_INFO, "\n"); + first = 0; + + ok = 2047; + nfuses = 0; + + if(!p->op[AVR_OP_PGM_ENABLE]) + ok &= ~AD_SPI_EN_CE_SIG; + + if(!p->op[AVR_OP_CHIP_ERASE]) + ok &= ~AD_SPI_EN_CE_SIG; + + if((m = avr_locate_mem(p, "flash"))) { + if((oc = m->op[AVR_OP_LOAD_EXT_ADDR])) { + // @@@ to do: check whether address is put at lsb of third byte + } else + ok &= ~AD_SPI_LOAD_EXT_ADDR; + + if((oc = m->op[AVR_OP_READ_HI])) + checkaddr(m->size>>1, 1, AVR_OP_READ_HI, oc, p, m); + else + ok &= ~AD_SPI_PROGMEM; + + if((oc = m->op[AVR_OP_READ_LO])) + checkaddr(m->size>>1, 1, AVR_OP_READ_LO, oc, p, m); + else + ok &= ~AD_SPI_PROGMEM; + + if((oc = m->op[AVR_OP_WRITE_HI])) + checkaddr(m->size>>1, 1, AVR_OP_WRITE_HI, oc, p, m); + else + ok &= ~AD_SPI_PROGMEM; + + if((oc = m->op[AVR_OP_WRITE_LO])) + checkaddr(m->size>>1, 1, AVR_OP_WRITE_LO, oc, p, m); + else + ok &= ~AD_SPI_PROGMEM; + + if((oc = m->op[AVR_OP_LOADPAGE_HI])) + checkaddr(m->page_size>>1, 1, AVR_OP_LOADPAGE_HI, oc, p, m); + else + ok &= ~AD_SPI_PROGMEM_PAGED; + + if((oc = m->op[AVR_OP_LOADPAGE_LO])) + checkaddr(m->page_size>>1, 1, AVR_OP_LOADPAGE_LO, oc, p, m); + else + ok &= ~AD_SPI_PROGMEM_PAGED; + + if((oc = m->op[AVR_OP_WRITEPAGE])) + checkaddr(m->size>>1, m->page_size>>1, AVR_OP_WRITEPAGE, oc, p, m); + else + ok &= ~AD_SPI_PROGMEM_PAGED; + } else + ok &= ~(AD_SPI_PROGMEM_PAGED | AD_SPI_PROGMEM); + + if((m = avr_locate_mem(p, "eeprom"))) { + if((oc = m->op[AVR_OP_READ])) { + checkaddr(m->size, 1, AVR_OP_READ, oc, p, m); + } else + ok &= ~AD_SPI_EEPROM; + + if((oc = m->op[AVR_OP_WRITE])) { + checkaddr(m->size, 1, AVR_OP_WRITE, oc, p, m); + } else + ok &= ~AD_SPI_EEPROM; + + if((oc = m->op[AVR_OP_LOADPAGE_LO])) { + checkaddr(m->page_size, 1, AVR_OP_LOADPAGE_LO, oc, p, m); + } else + ok &= ~AD_SPI_EEPROM_PAGED; + + if((oc = m->op[AVR_OP_WRITEPAGE])) { + checkaddr(m->size, m->page_size, AVR_OP_WRITEPAGE, oc, p, m); + } else + ok &= ~AD_SPI_EEPROM_PAGED; + } else + ok &= ~(AD_SPI_EEPROM_PAGED | AD_SPI_EEPROM); + + if((m = avr_locate_mem(p, "signature")) && (oc = m->op[AVR_OP_READ])) + checkaddr(m->size, 1, AVR_OP_READ, oc, p, m); + else + ok &= ~AD_SPI_EN_CE_SIG; + + if((m = avr_locate_mem(p, "calibration")) && (oc = m->op[AVR_OP_READ])) + checkaddr(m->size, 1, AVR_OP_READ, oc, p, m); + else + ok &= ~AD_SPI_CALIBRATION; + + // actually, some AT90S... parts cannot read, only write lock bits :-0 + if( ! ((m = avr_locate_mem(p, "lock")) && m->op[AVR_OP_WRITE])) + ok &= ~AD_SPI_LOCK; + + if(((m = avr_locate_mem(p, "fuse")) || (m = avr_locate_mem(p, "lfuse"))) && m->op[AVR_OP_READ] && m->op[AVR_OP_WRITE]) + nfuses++; + else + ok &= ~AD_SPI_LFUSE; + + if((m = avr_locate_mem(p, "hfuse")) && m->op[AVR_OP_READ] && m->op[AVR_OP_WRITE]) + nfuses++; + else + ok &= ~AD_SPI_HFUSE; + + if((m = avr_locate_mem(p, "efuse")) && m->op[AVR_OP_READ] && m->op[AVR_OP_WRITE]) + nfuses++; + else + ok &= ~AD_SPI_EFUSE; + + len = 16-strlen(p->desc); + avrdude_message(MSG_INFO, ".desc '%s' =>%*s [0x%02X, 0x%02X, 0x%02X, 0x%08x, 0x%05x, 0x%03x, 0x%06x, 0x%04x, 0x%03x, %d, 0x%03x, 0x%04x], # %s %d\n", + p->desc, len > 0? len: 0, "", + p->signature[0], p->signature[1], p->signature[2], + flashoffset, flashsize, flashpagesize, + eepromoffset, eepromsize, eeprompagesize, + nfuses, + ok, + p->flags, + p->config_file, p->lineno + ); + } + + printallopcodes(p, "part", p->op); + if(p->mem) { + for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { + AVRMEM *m = ldata(lnm); + if(m) + printallopcodes(p, m->desc, m->op); + } + } + + // print wait delays for AVR family parts + if(!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI | AVRPART_HAS_TPI | AVRPART_AVR32))) + avrdude_message(MSG_INFO, ".wd_chip_erase %.3f ms %s\n", p->chip_erase_delay/1000.0, p->desc); + if(p->mem) { + for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { + AVRMEM *m = ldata(lnm); + // write delays not needed for read-only calibration and signature memories + if(strcmp(m->desc, "calibration") && strcmp(m->desc, "signature")) { + if(!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI | AVRPART_HAS_TPI | AVRPART_AVR32))) { + if(m->min_write_delay == m->max_write_delay) + avrdude_message(MSG_INFO, ".wd_%s %.3f ms %s\n", m->desc, m->min_write_delay/1000.0, p->desc); + else { + avrdude_message(MSG_INFO, ".wd_min_%s %.3f ms %s\n", m->desc, m->min_write_delay/1000.0, p->desc); + avrdude_message(MSG_INFO, ".wd_max_%s %.3f ms %s\n", m->desc, m->max_write_delay/1000.0, p->desc); + } + } + } + } + } + } + exit(1); + } + if (partdesc) { if (strcmp(partdesc, "?") == 0) { avrdude_message(MSG_INFO, "\n"); @@ -1161,7 +1468,7 @@ int main(int argc, char * argv []) goto main_exit; } } - + sig = avr_locate_mem(p, "signature"); if (sig == NULL) { avrdude_message(MSG_INFO, "%s: WARNING: signature data not defined for device \"%s\"\n", From feaa1c6a6b0a0cf234dbd9e86e5b0d13d745c09a Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Mon, 30 May 2022 07:01:22 +0200 Subject: [PATCH 027/511] PR 950 done --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index ca827290..1a0c4824 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ Changes since version 7.0: * Pull requests: - Fix .Dd macro in manpage #949 + - fix M1 homebrew path #950 * Internals: From bdb4128de3f63a1fb4abc208ec9bfa90ef3dd676 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 29 May 2022 13:12:50 +0200 Subject: [PATCH 028/511] Fix JTAG transaction close issue Fixes issue #366 --- src/jtagmkII.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jtagmkII.c b/src/jtagmkII.c index fc06301c..b1024b53 100644 --- a/src/jtagmkII.c +++ b/src/jtagmkII.c @@ -1840,8 +1840,8 @@ void jtagmkII_close(PROGRAMMER * pgm) avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close()\n", progname); - if (pgm->flag & PGM_FL_IS_PDI) { - /* When in PDI mode, restart target. */ + if (pgm->flag & (PGM_FL_IS_PDI | PGM_FL_IS_JTAG)) { + /* When in PDI or JTAG mode, restart target. */ buf[0] = CMND_GO; avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close(): Sending GO command: ", progname); From bd8c17b35f772978dd12f866e4de569963f27162 Mon Sep 17 00:00:00 2001 From: prchal Date: Tue, 7 Jun 2022 11:50:03 +0200 Subject: [PATCH 029/511] adding support for all Linux baud rates v.2 If optiboot can work at higher bauds, why not avrdude. Versoin 2 of #985. Linux uses the old-style bitmapped version of the Bxxxx macros. --- src/ser_posix.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/ser_posix.c b/src/ser_posix.c index 2c5d45b5..53d8cd15 100644 --- a/src/ser_posix.c +++ b/src/ser_posix.c @@ -76,6 +76,45 @@ static struct baud_mapping baud_lookup_table [] = { #endif #ifdef B230400 { 230400, B230400 }, +#endif +#ifdef B250000 + { 250000, B250000 }, +#endif +#ifdef B460800 + { 460800, B460800 }, +#endif +#ifdef B500000 + { 500000, B500000 }, +#endif +#ifdef B576000 + { 576000, B576000 }, +#endif +#ifdef B921600 + { 921600, B921600 }, +#endif +#ifdef B1000000 + { 1000000, B1000000 }, +#endif +#ifdef B1152000 + { 1152000, B1152000 }, +#endif +#ifdef B1500000 + { 1500000, B1500000 }, +#endif +#ifdef B2000000 + { 2000000, B2000000 }, +#endif +#ifdef B2500000 + { 2500000, B2500000 }, +#endif +#ifdef B3000000 + { 3000000, B3000000 }, +#endif +#ifdef B3500000 + { 3500000, B3500000 }, +#endif +#ifdef B4000000 + { 4000000, B4000000 }, #endif { 0, 0 } /* Terminator. */ }; From cb114233ef68625332df5fff876467f57648cd9d Mon Sep 17 00:00:00 2001 From: Marius Greuel Date: Fri, 10 Jun 2022 20:38:54 +0200 Subject: [PATCH 030/511] Mention PR #945, #962, #972 --- NEWS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 1a0c4824..4638746a 100644 --- a/NEWS +++ b/NEWS @@ -15,10 +15,15 @@ Changes since version 7.0: * Issues fixed: + - Fix micronucleus bootloader to check for unresponsive USB + devices #945 + - Fix src/CMakeLists.txt to honor CMAKE_INSTALL_LIBDIR #972 + * Pull requests: - Fix .Dd macro in manpage #949 - fix M1 homebrew path #950 + - CMake Enhancements #962 * Internals: From 308263043087c15f58ebaa501bd8da69c9188b68 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Wed, 15 Jun 2022 23:32:22 +0200 Subject: [PATCH 031/511] Replace internal knowledge in jtag3.c by a public API In certain situations (CRC failure, device locked), that JTAG3 read functions need to return an indication to the caller that it is OK to proceed, and allow erasing the device anyway. Historically, the JTAG3 code passed the respective protocol errors directly (and unexplained) up to the caller, leaving the decision to the caller how to handle the situation. Replace that by a more common return value API. New code should prefer this API instead of any hardcoded return values. --- src/avr.c | 12 ++++++------ src/jtag3.c | 31 +++++++++++++++++++++---------- src/jtag3_private.h | 1 + src/libavrdude.h | 10 ++++++++++ src/main.c | 5 ++--- 5 files changed, 40 insertions(+), 19 deletions(-) diff --git a/src/avr.c b/src/avr.c index d6e78bb5..a8945d86 100644 --- a/src/avr.c +++ b/src/avr.c @@ -439,16 +439,16 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, (vmem->tags[i] & TAG_ALLOCATED) != 0) { rc = pgm->read_byte(pgm, p, mem, i, mem->buf + i); - if (rc != 0) { + if (rc != LIBAVRDUDE_SUCCESS) { avrdude_message(MSG_INFO, "avr_read(): error reading address 0x%04lx\n", i); - if (rc == -1) { + if (rc == LIBAVRDUDE_GENERAL_FAILURE) { avrdude_message(MSG_INFO, " read operation not supported for memory \"%s\"\n", memtype); - return -2; + return LIBAVRDUDE_NOTSUPPORTED; } avrdude_message(MSG_INFO, " read operation failed for memory \"%s\"\n", memtype); - return rc; + return LIBAVRDUDE_SOFTFAIL; } } report_progress(i, mem->size, NULL); @@ -1035,14 +1035,14 @@ int avr_signature(PROGRAMMER * pgm, AVRPART * p) report_progress (0,1,"Reading"); rc = avr_read(pgm, p, "signature", 0); - if (rc < 0) { + if (rc < LIBAVRDUDE_SUCCESS) { avrdude_message(MSG_INFO, "%s: error reading signature data for part \"%s\", rc=%d\n", progname, p->desc, rc); return rc; } report_progress (1,1,NULL); - return 0; + return LIBAVRDUDE_SUCCESS; } static uint8_t get_fuse_bitmask(AVRMEM * m) { diff --git a/src/jtag3.c b/src/jtag3.c index 6d358dfa..23df86ff 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -313,6 +313,16 @@ static void jtag3_prmsg(PROGRAMMER * pgm, unsigned char * data, size_t len) } } +static int jtag3_errcode(int status) +{ + if (status >= LIBAVRDUDE_SUCCESS) + return status; + if (status == RSP3_FAIL_OCD_LOCKED || + status == RSP3_FAIL_CRC_FAILURE) + return LIBAVRDUDE_SOFTFAIL; + return LIBAVRDUDE_GENERAL_FAILURE; +} + static void jtag3_prevent(PROGRAMMER * pgm, unsigned char * data, size_t len) { int i; @@ -850,7 +860,7 @@ int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) { putc('\n', stderr); avrdude_message(MSG_NOTICE2, "%s: %s command: timeout/error communicating with programmer (status %d)\n", progname, descr, status); - return -1; + return LIBAVRDUDE_GENERAL_FAILURE; } else if (verbose >= 3) { putc('\n', stderr); jtag3_prmsg(pgm, *resp, status); @@ -871,10 +881,11 @@ int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) { status = (*resp)[3]; free(*resp); resp = 0; - return -status; + + return jtag3_errcode(status); } - return status; + return LIBAVRDUDE_SUCCESS; } @@ -987,10 +998,10 @@ static int jtag3_program_enable(PROGRAMMER * pgm) free(resp); PDATA(pgm)->prog_enabled = 1; - return 0; + return LIBAVRDUDE_SUCCESS; } - return status; + return jtag3_errcode(status); } static int jtag3_program_disable(PROGRAMMER * pgm) @@ -1921,7 +1932,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, if (!(pgm->flag & PGM_FL_IS_DW)) if ((status = jtag3_program_enable(pgm)) < 0) - return status; + return jtag3_errcode(status); cmd[0] = SCOPE_AVR; cmd[1] = CMD3_READ_MEMORY; @@ -2007,7 +2018,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, if (addr == 0) { if ((status = jtag3_command(pgm, cmd, 12, &resp, "read memory")) < 0) - return status; + return jtag3_errcode(status); signature_cache[0] = resp[4]; signature_cache[1] = resp[5]; @@ -2057,7 +2068,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } if ((status = jtag3_command(pgm, cmd, 12, &resp, "read memory")) < 0) - return status; + return jtag3_errcode(status); if (resp[1] != RSP3_DATA || status < (pagesize? pagesize: 1) + 4) { @@ -2185,7 +2196,7 @@ static int jtag3_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, cmd[13] = data; if ((status = jtag3_command(pgm, cmd, 14, &resp, "write memory")) < 0) - return status; + return jtag3_errcode(status); free(resp); @@ -2316,7 +2327,7 @@ int jtag3_read_sib(PROGRAMMER * pgm, AVRPART * p, char * sib) u32_to_b4(cmd + 8, AVR_SIBLEN); if ((status = jtag3_command(pgm, cmd, 12, &resp, "read SIB")) < 0) - return status; + return jtag3_errcode(status); memcpy(sib, resp+3, AVR_SIBLEN); sib[AVR_SIBLEN] = 0; // Zero terminate string diff --git a/src/jtag3_private.h b/src/jtag3_private.h index a3e7fb08..6385aa4c 100644 --- a/src/jtag3_private.h +++ b/src/jtag3_private.h @@ -145,6 +145,7 @@ # define RSP3_FAIL_UNSUPP_MEMORY 0x34 /* unsupported memory type */ # define RSP3_FAIL_WRONG_LENGTH 0x35 /* wrong lenth for mem access */ # define RSP3_FAIL_OCD_LOCKED 0x44 /* device is locked */ +# define RSP3_FAIL_CRC_FAILURE 0x47 /* CRC failure in device */ # define RSP3_FAIL_NOT_UNDERSTOOD 0x91 /* ICE events */ diff --git a/src/libavrdude.h b/src/libavrdude.h index ddb72b48..46789f4f 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -27,6 +27,16 @@ #include typedef uint32_t pinmask_t; +/* + * Values returned by library functions. + * Some library functions also return a count, i.e. a positive + * number greater than 0. + */ +#define LIBAVRDUDE_SUCCESS 0 +#define LIBAVRDUDE_GENERAL_FAILURE (-1) +#define LIBAVRDUDE_NOTSUPPORTED (-2) // operation not supported +#define LIBAVRDUDE_SOFTFAIL (-3) // returned by avr_signature() if caller + // might proceed with chip erase /* formerly lists.h */ diff --git a/src/main.c b/src/main.c index 253c6e51..5b0a6e38 100644 --- a/src/main.c +++ b/src/main.c @@ -1116,9 +1116,8 @@ int main(int argc, char * argv []) usleep(waittime); if (init_ok) { rc = avr_signature(pgm, p); - if (rc != 0) { - // -68 == -(0x44) == -(RSP3_FAIL_OCD_LOCKED) - if ((rc == -68) && (p->flags & AVRPART_HAS_UPDI) && (attempt < 1)) { + if (rc != LIBAVRDUDE_SUCCESS) { + if ((rc == LIBAVRDUDE_SOFTFAIL) && (p->flags & AVRPART_HAS_UPDI) && (attempt < 1)) { attempt++; if (pgm->read_sib) { // Read SIB and compare FamilyID From c8350f816c2ec26022bba5758aadebd4b3095230 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sat, 18 Jun 2022 22:34:54 +0100 Subject: [PATCH 032/511] Fix support for ATmega2560 et al (load extended address) --- src/avrftdi.c | 41 +++++++++++++++++++---------------------- src/avrftdi_private.h | 2 ++ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/avrftdi.c b/src/avrftdi.c index e41d775e..c6d2f86e 100644 --- a/src/avrftdi.c +++ b/src/avrftdi.c @@ -917,8 +917,15 @@ static int avrftdi_chip_erase(PROGRAMMER * pgm, AVRPART * p) static int avrftdi_lext(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, unsigned int address) { + avrftdi_t *pdata = to_pdata(pgm); unsigned char buf[] = { 0x00, 0x00, 0x00, 0x00 }; + /* only send load extended address command if high byte changed */ + if(pdata->lext_byte == (uint8_t) (address>>16)) + return 0; + + pdata->lext_byte = (uint8_t) (address>>16); + avr_set_bits(m->op[AVR_OP_LOAD_EXT_ADDR], buf); avr_set_addr(m->op[AVR_OP_LOAD_EXT_ADDR], buf, address); @@ -983,8 +990,6 @@ static int avrftdi_eeprom_read(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned int page_size, unsigned int addr, unsigned int len) { - int use_lext_address = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL; - unsigned int word; unsigned int poll_index; @@ -1013,22 +1018,12 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, page_size = m->page_size; - /* if we do cross a 64k word boundary (or write the - * first page), we need to issue a 'load extended - * address byte' command, which is defined as 0x4d - * 0x00
0x00. As far as i know, this - * is only available on 256k parts. 64k word is 128k - * bytes. - * write the command only once. - */ - if(use_lext_address && (((addr/2) & 0xffff0000))) { - if (0 > avrftdi_lext(pgm, p, m, addr/2)) - return -1; - } + /* on large-flash devices > 128k issue extended address command when needed */ + if(m->op[AVR_OP_LOAD_EXT_ADDR] && avrftdi_lext(pgm, p, m, addr/2) < 0) + return -1; /* prepare the command stream for the whole page */ - /* addr is in bytes, but we program in words. addr/2 should be something - * like addr >> WORD_SHIFT, though */ + /* addr is in bytes, but we program in words. */ for(word = addr/2; word < (len + addr)/2; word++) { log_debug("-< bytes = %d of %d\n", word * 2, len + addr); @@ -1107,7 +1102,6 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, { OPCODE * readop; int byte, word; - int use_lext_address = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL; unsigned int address = addr/2; unsigned int buf_size = 4 * len + 4; @@ -1128,10 +1122,8 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return -1; } - if(use_lext_address && ((address & 0xffff0000))) { - if (0 > avrftdi_lext(pgm, p, m, address)) - return -1; - } + if(m->op[AVR_OP_LOAD_EXT_ADDR] && avrftdi_lext(pgm, p, m, address) < 0) + return -1; /* word addressing! */ for(word = addr/2, index = 0; word < (addr + len)/2; word++) @@ -1210,7 +1202,11 @@ avrftdi_setup(PROGRAMMER * pgm) { avrftdi_t* pdata; - pgm->cookie = malloc(sizeof(avrftdi_t)); + + if(!(pgm->cookie = calloc(sizeof(avrftdi_t), 1))) { + log_err("Error allocating memory.\n"); + exit(1); + } pdata = to_pdata(pgm); pdata->ftdic = ftdi_new(); @@ -1224,6 +1220,7 @@ avrftdi_setup(PROGRAMMER * pgm) pdata->pin_value = 0; pdata->pin_direction = 0; pdata->led_mask = 0; + pdata->lext_byte = 0xff; } static void diff --git a/src/avrftdi_private.h b/src/avrftdi_private.h index 3c965ed8..15b9caec 100644 --- a/src/avrftdi_private.h +++ b/src/avrftdi_private.h @@ -81,6 +81,8 @@ typedef struct avrftdi_s { int tx_buffer_size; /* use bitbanging instead of mpsse spi */ bool use_bitbanging; + /* bits 16-23 of extended 24-bit word flash address for parts with flash > 128k */ + uint8_t lext_byte; } avrftdi_t; void avrftdi_log(int level, const char * func, int line, const char * fmt, ...); From 3b0a2abc20e88101a194b953ab31cd8ab89d27dd Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 19 Jun 2022 10:53:07 +0200 Subject: [PATCH 033/511] Reduce programmer description string length to less than 80 characters. #941 related --- src/avrdude.conf.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 362b6167..ba7f4f8e 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -947,9 +947,10 @@ programmer ; # commercial version of USBtiny, using a separate VID/PID +# https://github.com/IowaScaledEngineering/ckt-avrprogrammer programmer id = "iseavrprog"; - desc = "USBtiny-based USB programmer, https://github.com/IowaScaledEngineering/ckt-avrprogrammer"; + desc = "USBtiny-based programmer, https://iascaled.com"; type = "usbtiny"; connection_type = usb; usbvid = 0x1209; From aa211f75800d320548cc051c8f830886f4f09c7e Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 19 Jun 2022 19:23:34 +0200 Subject: [PATCH 034/511] Add missing efuse write delay for ATmega169/A/P/PA and ATmega328P --- src/avrdude.conf.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 362b6167..c0ba9c4b 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -5823,6 +5823,8 @@ part memory "efuse" size = 1; + min_write_delay = 2000; + max_write_delay = 2000; write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", "x x x x x x x x x x x x i i i i"; @@ -9852,6 +9854,8 @@ part parent "m328" memory "efuse" size = 1; + min_write_delay = 4500; + max_write_delay = 4500; read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", "x x x x x x x x o o o o o o o o"; write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", From 692c13ed98a80b0728f2a4e78c6b61fcf181fa3b Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 19 Jun 2022 19:40:31 +0200 Subject: [PATCH 035/511] Add missing chip erase delay for ATmega48/88/168/328PB --- src/avrdude.conf.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index c0ba9c4b..bf2892aa 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -8215,6 +8215,7 @@ part parent "m48" id = "m48pb"; desc = "ATmega48PB"; signature = 0x1e 0x92 0x10; + chip_erase_delay = 10500; ; #------------------------------------------------------------ @@ -8442,6 +8443,7 @@ part parent "m88" id = "m88pb"; desc = "ATmega88PB"; signature = 0x1e 0x93 0x16; + chip_erase_delay = 10500; ; #------------------------------------------------------------ @@ -8671,6 +8673,7 @@ part parent "m168" id = "m168pb"; desc = "ATmega168PB"; signature = 0x1e 0x94 0x15; + chip_erase_delay = 10500; ; #------------------------------------------------------------ @@ -9827,6 +9830,7 @@ part parent "m328" id = "m328pb"; desc = "ATmega328PB"; signature = 0x1e 0x95 0x16; + chip_erase_delay = 10500; memory "efuse" size = 1; From 1aa59aaa98e6a79bb4a321be80c5113184dd2668 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sun, 19 Jun 2022 19:56:56 +0200 Subject: [PATCH 036/511] PR #1000 is done now --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 4638746a..888796ca 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,8 @@ Changes since version 7.0: - Fix .Dd macro in manpage #949 - fix M1 homebrew path #950 - CMake Enhancements #962 + - Reduce programmer desc string length in avrdude.conf + to < 80 characters #1000 * Internals: From ae0e3e2f8e239c5075cd5a8507c9ada021197bcf Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Wed, 22 Jun 2022 23:33:53 +0200 Subject: [PATCH 037/511] Fix a number of logic errors in the previous commits RSP3_FAIL_CRC_FAILURE is 0x43 rather than 0x47. jtag3_errcode() must only be applied to a reason code, not to any general status code. --- src/jtag3.c | 32 +++++++++++++++----------------- src/jtag3_private.h | 2 +- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/jtag3.c b/src/jtag3.c index 23df86ff..4c159ee8 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -313,12 +313,10 @@ static void jtag3_prmsg(PROGRAMMER * pgm, unsigned char * data, size_t len) } } -static int jtag3_errcode(int status) +static int jtag3_errcode(int reason) { - if (status >= LIBAVRDUDE_SUCCESS) - return status; - if (status == RSP3_FAIL_OCD_LOCKED || - status == RSP3_FAIL_CRC_FAILURE) + if (reason == RSP3_FAIL_OCD_LOCKED || + reason == RSP3_FAIL_CRC_FAILURE) return LIBAVRDUDE_SOFTFAIL; return LIBAVRDUDE_GENERAL_FAILURE; } @@ -844,7 +842,7 @@ int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) { } } - int jtag3_command(PROGRAMMER *pgm, unsigned char *cmd, unsigned int cmdlen, +int jtag3_command(PROGRAMMER *pgm, unsigned char *cmd, unsigned int cmdlen, unsigned char **resp, const char *descr) { int status; @@ -868,9 +866,10 @@ int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) { avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", (*resp)[1], status); } - c = (*resp)[1]; - if ((c & RSP3_STATUS_MASK) != RSP3_OK) { - if ((c == RSP3_FAILED) && ((*resp)[3] == RSP3_FAIL_OCD_LOCKED)) { + c = (*resp)[1] & RSP3_STATUS_MASK; + if (c != RSP3_OK) { + if ((c == RSP3_FAILED) && ((*resp)[3] == RSP3_FAIL_OCD_LOCKED || + (*resp)[3] == RSP3_FAIL_CRC_FAILURE)) { avrdude_message(MSG_INFO, "%s: Device is locked! Chip erase required to unlock.\n", progname); @@ -881,11 +880,10 @@ int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) { status = (*resp)[3]; free(*resp); resp = 0; - return jtag3_errcode(status); } - return LIBAVRDUDE_SUCCESS; + return status; } @@ -1001,7 +999,7 @@ static int jtag3_program_enable(PROGRAMMER * pgm) return LIBAVRDUDE_SUCCESS; } - return jtag3_errcode(status); + return status; } static int jtag3_program_disable(PROGRAMMER * pgm) @@ -1932,7 +1930,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, if (!(pgm->flag & PGM_FL_IS_DW)) if ((status = jtag3_program_enable(pgm)) < 0) - return jtag3_errcode(status); + return status; cmd[0] = SCOPE_AVR; cmd[1] = CMD3_READ_MEMORY; @@ -2018,7 +2016,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, if (addr == 0) { if ((status = jtag3_command(pgm, cmd, 12, &resp, "read memory")) < 0) - return jtag3_errcode(status); + return status; signature_cache[0] = resp[4]; signature_cache[1] = resp[5]; @@ -2068,7 +2066,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } if ((status = jtag3_command(pgm, cmd, 12, &resp, "read memory")) < 0) - return jtag3_errcode(status); + return status; if (resp[1] != RSP3_DATA || status < (pagesize? pagesize: 1) + 4) { @@ -2196,7 +2194,7 @@ static int jtag3_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, cmd[13] = data; if ((status = jtag3_command(pgm, cmd, 14, &resp, "write memory")) < 0) - return jtag3_errcode(status); + return status; free(resp); @@ -2327,7 +2325,7 @@ int jtag3_read_sib(PROGRAMMER * pgm, AVRPART * p, char * sib) u32_to_b4(cmd + 8, AVR_SIBLEN); if ((status = jtag3_command(pgm, cmd, 12, &resp, "read SIB")) < 0) - return jtag3_errcode(status); + return status; memcpy(sib, resp+3, AVR_SIBLEN); sib[AVR_SIBLEN] = 0; // Zero terminate string diff --git a/src/jtag3_private.h b/src/jtag3_private.h index 6385aa4c..7d0cbb74 100644 --- a/src/jtag3_private.h +++ b/src/jtag3_private.h @@ -144,8 +144,8 @@ # define RSP3_FAIL_WRONG_MODE 0x32 /* progmode vs. non-prog */ # define RSP3_FAIL_UNSUPP_MEMORY 0x34 /* unsupported memory type */ # define RSP3_FAIL_WRONG_LENGTH 0x35 /* wrong lenth for mem access */ +# define RSP3_FAIL_CRC_FAILURE 0x43 /* CRC failure in device */ # define RSP3_FAIL_OCD_LOCKED 0x44 /* device is locked */ -# define RSP3_FAIL_CRC_FAILURE 0x47 /* CRC failure in device */ # define RSP3_FAIL_NOT_UNDERSTOOD 0x91 /* ICE events */ From 89b0aa72e0f605e4408989ae9a579dbffd65688d Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sat, 25 Jun 2022 11:39:16 +0200 Subject: [PATCH 038/511] Attempt to fix EEPROM write issue #1009 --- src/jtag3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jtag3.c b/src/jtag3.c index 6d358dfa..bb41431f 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1761,7 +1761,7 @@ static int jtag3_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, free(cmd); return n_bytes; } - cmd[3] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_EEPROM_XMEGA : MTYPE_EEPROM_PAGE; + cmd[3] = ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) ? MTYPE_EEPROM_XMEGA : MTYPE_EEPROM_PAGE; PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L; } else if (strcmp(m->desc, "usersig") == 0 || strcmp(m->desc, "userrow") == 0) { From 317cc6d49284e33eb6550ba8c92aeadda7794c3d Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 26 Jun 2022 15:10:19 +0100 Subject: [PATCH 039/511] Add part type to -p \* .desc output --- src/main.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 6ed62221..43219bad 100644 --- a/src/main.c +++ b/src/main.c @@ -394,6 +394,42 @@ static int intlog2(unsigned int n) { return ret; } +// mnemonic characterisation of flags +static char *parttype(AVRPART *p) { + static char type[1024]; + + switch(p->flags & (AVRPART_HAS_PDI | AVRPART_AVR32 | AVRPART_HAS_TPI | AVRPART_HAS_UPDI)) { + case 0: strcpy(type, "ISP"); break; + case AVRPART_HAS_PDI: strcpy(type, "PDI"); break; + case AVRPART_AVR32: strcpy(type, "AVR32"); break; + case AVRPART_HAS_TPI: strcpy(type, "TPI"); break; + case AVRPART_HAS_UPDI: strcpy(type, "UPDI"); break; + default: strcpy(type, "UNKNOWN"); break; + } + if((p->flags & AVRPART_SERIALOK) == 0) + strcat(type, "|NOTSERIAL"); + if((p->flags & AVRPART_PARALLELOK) == 0) + strcat(type, "|NOTPARALLEL"); + if(p->flags & AVRPART_PSEUDOPARALLEL) + strcat(type, "|PSEUDOPARALLEL"); + if(p->flags & AVRPART_IS_AT90S1200) + strcat(type, "|IS_AT90S1200"); + + if(p->flags & AVRPART_HAS_DW) + strcat(type, "|DW"); + + if(p->flags & AVRPART_HAS_JTAG) + strcat(type, "|JTAG"); + if(p->flags & AVRPART_ALLOWFULLPAGEBITSTREAM) + strcat(type, "|PAGEBITSTREAM"); + if((p->flags & AVRPART_ENABLEPAGEPROGRAMMING) == 0) + strcat(type, "|NOPAGEPROGRAMMING"); + + return type; +} + + + // check whether address bits are where they should be in ISP commands static void checkaddr(int memsize, int pagesize, int what, OPCODE *op, AVRPART *p, AVRMEM *m) { int i, lo, hi; @@ -1093,7 +1129,7 @@ int main(int argc, char * argv []) ok &= ~AD_SPI_EFUSE; len = 16-strlen(p->desc); - avrdude_message(MSG_INFO, ".desc '%s' =>%*s [0x%02X, 0x%02X, 0x%02X, 0x%08x, 0x%05x, 0x%03x, 0x%06x, 0x%04x, 0x%03x, %d, 0x%03x, 0x%04x], # %s %d\n", + avrdude_message(MSG_INFO, ".desc '%s' =>%*s [0x%02X, 0x%02X, 0x%02X, 0x%08x, 0x%05x, 0x%03x, 0x%06x, 0x%04x, 0x%03x, %d, 0x%03x, 0x%04x, '%s'], # %s %d\n", p->desc, len > 0? len: 0, "", p->signature[0], p->signature[1], p->signature[2], flashoffset, flashsize, flashpagesize, @@ -1101,6 +1137,7 @@ int main(int argc, char * argv []) nfuses, ok, p->flags, + parttype(p), p->config_file, p->lineno ); } From 17509d2ef4ade40b84a969b810b92b77663cf101 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Sun, 26 Jun 2022 21:31:44 +0200 Subject: [PATCH 040/511] CMakeLists.txt: fix build without C++ Fix the following build failure without a C++ compiler: CMake Error at CMakeLists.txt:24 (project): No CMAKE_CXX_COMPILER could be found. Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH. Signed-off-by: Fabrice Fontaine --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19897c72..5efc8d45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ # cmake --build build cmake_minimum_required(VERSION 3.12) -project(avrdude VERSION 7.0) +project(avrdude VERSION 7.0 LANGUAGES C) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED True) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bd3c6dee..f2dfe9cc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -56,6 +56,8 @@ if(WIN32) endif() if(MSVC) + enable_language(CXX) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS=1) add_compile_definitions(_CRT_NONSTDC_NO_WARNINGS=1) add_compile_definitions(_WINSOCK_DEPRECATED_NO_WARNINGS=1) From 1b997968a526c630a45ba8c705162140f86a7419 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sun, 26 Jun 2022 22:58:25 +0200 Subject: [PATCH 041/511] Closing PR 979 --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 888796ca..16fef572 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ Changes since version 7.0: - Fix micronucleus bootloader to check for unresponsive USB devices #945 - Fix src/CMakeLists.txt to honor CMAKE_INSTALL_LIBDIR #972 + - [bug #43898] atmega644p remains stopped after JTAG transaction #366 * Pull requests: @@ -26,6 +27,7 @@ Changes since version 7.0: - CMake Enhancements #962 - Reduce programmer desc string length in avrdude.conf to < 80 characters #1000 + - Dragon JTAG fix #979 * Internals: From 362e6993acc863c282a16fd4d3642ebbeab4eae7 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sun, 26 Jun 2022 23:00:32 +0200 Subject: [PATCH 042/511] PR 993 done --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 16fef572..da4e42d0 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,7 @@ Changes since version 7.0: - Reduce programmer desc string length in avrdude.conf to < 80 characters #1000 - Dragon JTAG fix #979 + - adding support for all Linux baud rates v.2 #993 * Internals: From 3bd75e74c6c65bd3b0c7fdb170f39b380dec1286 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 28 Jun 2022 20:14:29 +0100 Subject: [PATCH 043/511] Move developer options into own source file and expand part description -p \* -p \*/c check address bits in SPI commands -p \*/d description of core part features -p \*/o opcodes for SPI programming parts and memories -p \*/s show avrdude.conf entries of parts -p \*/ss show full avrdude.conf entry as tab separated table -p \*/w wd_... constants for ISP parts -p \*/\* all of the above except -p \*/s -p \* same as -p\*/\* --- src/CMakeLists.txt | 3 + src/Makefile.am | 3 + src/developer_opts.c | 651 +++++++++++++++++++++++++++++++++++ src/developer_opts.h | 24 ++ src/developer_opts_private.h | 50 +++ src/main.c | 346 +------------------ 6 files changed, 735 insertions(+), 342 deletions(-) create mode 100644 src/developer_opts.c create mode 100644 src/developer_opts.h create mode 100644 src/developer_opts_private.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bd3c6dee..d3f9b87a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -133,6 +133,9 @@ add_library(libavrdude confwin.c crc16.c crc16.h + developer_opts.c + developer_opts.h + developer_opts_private.h dfu.c dfu.h fileio.c diff --git a/src/Makefile.am b/src/Makefile.am index 15162224..f2747c1b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -110,6 +110,9 @@ libavrdude_a_SOURCES = \ confwin.c \ crc16.c \ crc16.h \ + developer_opts.c \ + developer_opts.h \ + developer_opts_private.h \ dfu.c \ dfu.h \ fileio.c \ diff --git a/src/developer_opts.c b/src/developer_opts.c new file mode 100644 index 00000000..36dd6461 --- /dev/null +++ b/src/developer_opts.c @@ -0,0 +1,651 @@ +/* + * avrdude - A Downloader/Uploader for AVR device programmers + * Copyright (C) 2022, Stefan Rueger + * + * 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, see . + */ + +/* $Id$ */ + +/* + * Code to program an Atmel AVR device through one of the supported + * programmers. + * + * For parallel port connected programmers, the pin definitions can be + * changed via a config file. See the config file for instructions on + * how to add a programmer definition. + * + */ + +#include "ac_cfg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "avrdude.h" +#include "libavrdude.h" + +#include "developer_opts.h" +#include "developer_opts_private.h" + +static char cmdbitchar(CMDBIT cb) { + switch(cb.type) { + case AVR_CMDBIT_IGNORE: + return 'x'; + case AVR_CMDBIT_VALUE: + return cb.value? '1': '0'; + case AVR_CMDBIT_ADDRESS: + return 'a'; + case AVR_CMDBIT_INPUT: + return 'i'; + case AVR_CMDBIT_OUTPUT: + return 'o'; + default: + return '?'; + } +} + + +static const char *opcodename(int what) { + switch(what) { + case AVR_OP_READ: + return "read"; + case AVR_OP_WRITE: + return "write"; + case AVR_OP_READ_LO: + return "read_lo"; + case AVR_OP_READ_HI: + return "read_hi"; + case AVR_OP_WRITE_LO: + return "write_lo"; + case AVR_OP_WRITE_HI: + return "write_hi"; + case AVR_OP_LOADPAGE_LO: + return "loadpage_lo"; + case AVR_OP_LOADPAGE_HI: + return "loadpage_hi"; + case AVR_OP_LOAD_EXT_ADDR: + return "load_ext_addr"; + case AVR_OP_WRITEPAGE: + return "writepage"; + case AVR_OP_CHIP_ERASE: + return "chip_erase"; + case AVR_OP_PGM_ENABLE: + return "pgm_enable"; + default: + return "???"; + } +} + + +char *opcode2str(OPCODE *op, int detailed) { + char cb, space[1024], *sp = space; + + if(detailed) + *sp++ = '"'; + for(int i=31; i >= 0; i--) { + *sp++ = cb = cmdbitchar(op->bit[i]); + if(detailed && cb == 'a') { + sprintf(sp, "%d", op->bit[i].bitno); + sp += strlen(sp); + } + if(i) { + if(detailed) + *sp++ = ' '; + if(i%8 == 0) + *sp++ = ' '; + } + } + if(detailed) + *sp++ = '"'; + *sp = 0; + + return strdup(space); +} + +static void printopcode(AVRPART *p, const char *d, OPCODE *op, int what) { + unsigned char cmd[4]; + int i; + + if(op) { + memset(cmd, 0, sizeof cmd); + avr_set_bits(op, cmd); + + dev_info(".op %s %s %s 0x%02x%02x%02x%02x ", p->desc, d, opcodename(what), cmd[0], cmd[1], cmd[2], cmd[3]); + for(i=31; i >= 0; i--) { + dev_info("%c", cmdbitchar(op->bit[i])); + if(i%8 == 0) + dev_info("%c", i? ' ': '\n'); + } + } +} + +static void printallopcodes(AVRPART *p, const char *d, OPCODE **opa) { + for(int i=0; i>= 1; ret++) + continue; + + return ret; +} + + +// mnemonic characterisation of flags +static char *parttype(AVRPART *p) { + static char type[1024]; + + switch(p->flags & (AVRPART_HAS_PDI | AVRPART_AVR32 | AVRPART_HAS_TPI | AVRPART_HAS_UPDI)) { + case 0: strcpy(type, "ISP"); break; + case AVRPART_HAS_PDI: strcpy(type, "PDI"); break; + case AVRPART_AVR32: strcpy(type, "AVR32"); break; + case AVRPART_HAS_TPI: strcpy(type, "TPI"); break; + case AVRPART_HAS_UPDI: strcpy(type, "UPDI"); break; + default: strcpy(type, "UNKNOWN"); break; + } + if((p->flags & AVRPART_SERIALOK) == 0) + strcat(type, "|NOTSERIAL"); + if((p->flags & AVRPART_PARALLELOK) == 0) + strcat(type, "|NOTPARALLEL"); + if(p->flags & AVRPART_PSEUDOPARALLEL) + strcat(type, "|PSEUDOPARALLEL"); + if(p->flags & AVRPART_IS_AT90S1200) + strcat(type, "|IS_AT90S1200"); + + if(p->flags & AVRPART_HAS_DW) + strcat(type, "|DW"); + + if(p->flags & AVRPART_HAS_JTAG) + strcat(type, "|JTAG"); + if(p->flags & AVRPART_ALLOWFULLPAGEBITSTREAM) + strcat(type, "|PAGEBITSTREAM"); + if((p->flags & AVRPART_ENABLEPAGEPROGRAMMING) == 0) + strcat(type, "|NOPAGEPROGRAMMING"); + + return type; +} + + +// check whether address bits are where they should be in ISP commands +static void checkaddr(int memsize, int pagesize, int what, OPCODE *op, AVRPART *p, AVRMEM *m) { + int i, lo, hi; + const char *whatstr = opcodename(what); + + lo = intlog2(pagesize); + hi = intlog2(memsize-1); + + // address bits should be between positions lo and hi (and fall in line), outside should be 0 or don't care + for(i=0; i<16; i++) { // ISP programming only deals with 16-bit addresses (words for flash, bytes for eeprom) + if(i < lo || i > hi) { + if(op->bit[i+8].type != AVR_CMDBIT_IGNORE && !(op->bit[i+8].type == AVR_CMDBIT_VALUE && op->bit[i+8].value == 0)) { + dev_info(".cmdbit%d %s %s-%s outside addressable space should be x or 0, but is %c", i+8, p->desc, m->desc, whatstr, cmdbitchar(op->bit[i+8])); + if(op->bit[i+8].type == AVR_CMDBIT_ADDRESS) + dev_info("%d", op->bit[i+8].bitno); + dev_info("\n"); + } + } else { + if(op->bit[i+8].type != AVR_CMDBIT_ADDRESS) + dev_info(".cmdbit%d %s %s-%s is %c but should be a\n", i+8, p->desc, m->desc, whatstr, cmdbitchar(op->bit[i+8])); + else if(op->bit[i+8].bitno != i) + dev_info(".cmdbit%d %s %s-%s inconsistent: a%d specified as a%d\n", i+8, p->desc, m->desc, whatstr, i, op->bit[i+8].bitno); + } + } + for(i=0; i<32; i++) // command bits 8..23 should not contain address bits + if((i<8 || i>23) && op->bit[i].type == AVR_CMDBIT_ADDRESS) + dev_info(".cmdbit%d %s %s-%s contains a%d which it shouldn't\n", i, p->desc, m->desc, whatstr, op->bit[i].bitno); +} + + +void dev_stack_out(bool dot, AVRPART *p, char *name, unsigned char *stack, int ns) { + if(dot) + dev_info("%s\t%s\t", p->desc, name); + else + dev_info(" %-19s = ", name); + for(int i=0; iconfig_file, real_config_file)) + memcpy(real_config_file, p->config_file, sizeof real_config_file); + dev_info("# %s %d\n", real_config_file, p->lineno); + + if(!dot) + dev_info("part\n"); + dev_partout("\"%s\"", desc); + dev_partout("\"%s\"", id); + dev_partout("\"%s\"", family_id); + dev_partout("0x%02x", stk500_devcode); + dev_partout("0x%02x", avr910_devcode); + dev_partout("%d", chip_erase_delay); + dev_partout("0x%02x", pagel); + dev_partout("0x%02x", bs2); + sprintf(space, "0x%02x 0x%02x 0x%02x", p->signature[0], p->signature[1], p->signature[2]); + dev_partout_str(space, signature); + dev_partout("0x%04x", usbpid); + sprintf(space, "%s", p->reset_disposition == RESET_DEDICATED? "dedicated": p->reset_disposition == RESET_IO? "io": "unknown"); + dev_partout_str(space, reset); + sprintf(space, "%s", p->retry_pulse == PIN_AVR_RESET? "reset": p->retry_pulse == PIN_AVR_SCK? "sck": "unknown"); + dev_partout_str(space, retry_pulse); + + if(dot) + dev_info(".part\t%s\tflags\t0x%04x\n", p->desc, p->flags); + else { + dev_flagout("has_jtag", AVRPART_HAS_JTAG); + dev_flagout("has_debugwire", AVRPART_HAS_DW); + dev_flagout("has_pdi", AVRPART_HAS_PDI); + dev_flagout("has_updi", AVRPART_HAS_UPDI); + dev_flagout("has_tpi", AVRPART_HAS_TPI); + dev_flagout("is_at90s1200", AVRPART_IS_AT90S1200); + dev_flagout("is_avr32", AVRPART_AVR32); + dev_flagout("allowfullpagebitstream", AVRPART_ALLOWFULLPAGEBITSTREAM); + dev_flagout("enablepageprogramming", AVRPART_ENABLEPAGEPROGRAMMING); + dev_flagout("serial", AVRPART_SERIALOK); + + switch(p->flags & (AVRPART_PARALLELOK | AVRPART_PSEUDOPARALLEL)) { + case 0: strcpy(space, "no"); break; + case AVRPART_PSEUDOPARALLEL: strcpy(space, "unknown"); break; + case AVRPART_PARALLELOK: strcpy(space, "yes"); break; + default: strcpy(space, "pseudo"); break; + } + dev_info(" %-19s = %s;\n", "parallel", space); + } + + dev_partout("%d", timeout); + dev_partout("%d", stabdelay); + dev_partout("%d", cmdexedelay); + dev_partout("%d", synchloops); + dev_partout("%d", bytedelay); + dev_partout("%d", pollindex); + dev_partout("0x%02x", pollvalue); + dev_partout("%d", predelay); + dev_partout("%d", postdelay); + dev_partout("%d", pollmethod); + + sprintf(space, "%s", p->ctl_stack_type == CTL_STACK_PP? "pp_controlstack": p->ctl_stack_type == CTL_STACK_HVSP? "hvsp_controlstack": "unknown_controlstack"); + if(p->ctl_stack_type != CTL_STACK_NONE) + dev_stack_out(dot, p, space, p->controlstack, CTL_STACK_SIZE); + dev_stack_out(dot, p, "flash_instr", p->flash_instr, FLASH_INSTR_SIZE); + dev_stack_out(dot, p, "eeprom_instr", p->eeprom_instr, EEPROM_INSTR_SIZE); + +/* + unsigned char controlstack[CTL_STACK_SIZE]; // stk500v2 PP/HVSP ctl stack + unsigned char flash_instr[FLASH_INSTR_SIZE]; // flash instructions (debugWire, JTAG) + unsigned char eeprom_instr[EEPROM_INSTR_SIZE]; // EEPROM instructions (debugWire, JTAG) +*/ + + dev_partout("%d", hventerstabdelay); + dev_partout("%d", progmodedelay); + dev_partout("%d", latchcycles); + dev_partout("%d", togglevtg); + dev_partout("%d", poweroffdelay); + dev_partout("%d", resetdelayms); + dev_partout("%d", resetdelayus); + dev_partout("%d", hvleavestabdelay); + dev_partout("%d", resetdelay); + dev_partout("%d", chiperasepulsewidth); + dev_partout("%d", chiperasepolltimeout); + dev_partout("%d", chiperasetime); + dev_partout("%d", programfusepulsewidth); + dev_partout("%d", programfusepolltimeout); + dev_partout("%d", programlockpulsewidth); + dev_partout("%d", programlockpolltimeout); + dev_partout("%d", synchcycles); + dev_partout("%d", hvspcmdexedelay); + + dev_partout("0x%02x", idr); + dev_partout("0x%02x", rampz); + dev_partout("0x%02x", spmcr); + dev_partout("0x%02x", eecr); // why is eecr an unsigned short? + + dev_partout("0x%04x", mcu_base); + dev_partout("0x%04x", nvm_base); + dev_partout("0x%04x", ocd_base); + + if(p->ocdrev >= 0) + dev_partout("%d", ocdrev); + else + dev_partout("0x%8x", ocdrev); + + for(int i=0; i < AVR_OP_MAX; i++) { + if(p->op[i]) { + char *opc = opcode2str(p->op[i], !dot); + + if(dot) + dev_info(".partop\t%s\t%s\t%s\n", p->desc, opcodename(i), opc? opc: "error"); + else + dev_info(" %-19s = %s;\n", opcodename(i), opc? opc: "error"); + + if(opc) + free(opc); + } + } + if(p->mem) { + for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { + AVRMEM *m = ldata(lnm); + if(!dot) + dev_info("\n memory \"%s\"\n", m->desc); + + dev_memout_yn(paged); + if(m->size > 8192) + dev_memout("0x%x", size); + else + dev_memout("%d", size); + dev_memout("%d", page_size); + dev_memout("%d", num_pages); // why can AVRDUDE not compute this? + dev_memout("0x%x", offset); + dev_memout("%d", min_write_delay); + dev_memout("%d", max_write_delay); + dev_memout_yn(pwroff_after_write); + sprintf(space, "0x%02x 0x%02x", m->readback[0], m->readback[1]); + dev_memout_str(space, readback); + dev_memout("%d", mode); + dev_memout("%d", delay); + dev_memout("%d", blocksize); + dev_memout("%d", readsize); + dev_memout("%d", pollindex); + + for(int i=0; i < AVR_OP_MAX; i++) { + if(m->op[i]) { + char *opc = opcode2str(m->op[i], !dot); + + if(dot) + dev_info(".pmemop\t%s\t%s\t%s\t%s\n", p->desc, m->desc, opcodename(i), opc? opc: "error"); + else + dev_info(" %-15s = %s;\n", opcodename(i), opc? opc: "error"); + + if(opc) + free(opc); + } + } + + if(!dot) + dev_info(" ;\n"); + for(LNODEID lnm=lfirst(p->mem_alias); lnm; lnm=lnext(lnm)) { + AVRMEM_ALIAS *ma = ldata(lnm); + if(ma->aliased_mem && !strcmp(ma->aliased_mem->desc, m->desc)) { + if(dot) + dev_info(".pmem\t%s\t%s\talias\t%s\n", p->desc, ma->desc, m->desc); + else + dev_info("\n memory \"%s\"\n alias \"%s\";\n ;\n", ma->desc, m->desc); + } + } + } + } + + if(!dot) + dev_info(";\n"); + } + + + // identify core flash and eeprom parameters + + flashsize = flashoffset = flashpagesize = eepromsize = eepromoffset = eeprompagesize = 0; + if(p->mem) { + for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { + AVRMEM *m = ldata(lnm); + if(!flashsize && m->desc && 0==strcmp(m->desc, "flash")) { + flashsize = m->size; + flashpagesize = m->page_size; + flashoffset = m->offset; + } + if(!eepromsize && m->desc && 0==strcmp(m->desc, "eeprom")) { + eepromsize = m->size; + eepromoffset = m->offset; + eeprompagesize = m->page_size; + } + } + } + + // "real" entries don't seem to have a space in their desc (a bit hackey) + if(flashsize && !index(p->desc, ' ')) { + int ok, nfuses; + AVRMEM *m; + OPCODE *oc; + + if(!first && all) + dev_info("\n"); + first = 0; + + ok = 2047; + nfuses = 0; + + if(!p->op[AVR_OP_PGM_ENABLE]) + ok &= ~DEV_SPI_EN_CE_SIG; + + if(!p->op[AVR_OP_CHIP_ERASE]) + ok &= ~DEV_SPI_EN_CE_SIG; + + if((m = avr_locate_mem(p, "flash"))) { + if((oc = m->op[AVR_OP_LOAD_EXT_ADDR])) { + // @@@ to do: check whether address is put at lsb of third byte + } else + ok &= ~DEV_SPI_LOAD_EXT_ADDR; + + if((oc = m->op[AVR_OP_READ_HI])) { + if(cmdok) + checkaddr(m->size>>1, 1, AVR_OP_READ_HI, oc, p, m); + } else + ok &= ~DEV_SPI_PROGMEM; + + if((oc = m->op[AVR_OP_READ_LO])) { + if(cmdok) + checkaddr(m->size>>1, 1, AVR_OP_READ_LO, oc, p, m); + } else + ok &= ~DEV_SPI_PROGMEM; + + if((oc = m->op[AVR_OP_WRITE_HI])) { + if(cmdok) + checkaddr(m->size>>1, 1, AVR_OP_WRITE_HI, oc, p, m); + } else + ok &= ~DEV_SPI_PROGMEM; + + if((oc = m->op[AVR_OP_WRITE_LO])) { + if(cmdok) + checkaddr(m->size>>1, 1, AVR_OP_WRITE_LO, oc, p, m); + } else + ok &= ~DEV_SPI_PROGMEM; + + if((oc = m->op[AVR_OP_LOADPAGE_HI])) { + if(cmdok) + checkaddr(m->page_size>>1, 1, AVR_OP_LOADPAGE_HI, oc, p, m); + } else + ok &= ~DEV_SPI_PROGMEM_PAGED; + + if((oc = m->op[AVR_OP_LOADPAGE_LO])) { + if(cmdok) + checkaddr(m->page_size>>1, 1, AVR_OP_LOADPAGE_LO, oc, p, m); + } else + ok &= ~DEV_SPI_PROGMEM_PAGED; + + if((oc = m->op[AVR_OP_WRITEPAGE])) { + if(cmdok) + checkaddr(m->size>>1, m->page_size>>1, AVR_OP_WRITEPAGE, oc, p, m); + } else + ok &= ~DEV_SPI_PROGMEM_PAGED; + } else + ok &= ~(DEV_SPI_PROGMEM_PAGED | DEV_SPI_PROGMEM); + + if((m = avr_locate_mem(p, "eeprom"))) { + if((oc = m->op[AVR_OP_READ])) { + if(cmdok) + checkaddr(m->size, 1, AVR_OP_READ, oc, p, m); + } else + ok &= ~DEV_SPI_EEPROM; + + if((oc = m->op[AVR_OP_WRITE])) { + if(cmdok) + checkaddr(m->size, 1, AVR_OP_WRITE, oc, p, m); + } else + ok &= ~DEV_SPI_EEPROM; + + if((oc = m->op[AVR_OP_LOADPAGE_LO])) { + if(cmdok) + checkaddr(m->page_size, 1, AVR_OP_LOADPAGE_LO, oc, p, m); + } else + ok &= ~DEV_SPI_EEPROM_PAGED; + + if((oc = m->op[AVR_OP_WRITEPAGE])) { + if(cmdok) + checkaddr(m->size, m->page_size, AVR_OP_WRITEPAGE, oc, p, m); + } else + ok &= ~DEV_SPI_EEPROM_PAGED; + } else + ok &= ~(DEV_SPI_EEPROM_PAGED | DEV_SPI_EEPROM); + + if((m = avr_locate_mem(p, "signature")) && (oc = m->op[AVR_OP_READ])) { + if(cmdok) + checkaddr(m->size, 1, AVR_OP_READ, oc, p, m); + } else + ok &= ~DEV_SPI_EN_CE_SIG; + + if((m = avr_locate_mem(p, "calibration")) && (oc = m->op[AVR_OP_READ])) { + if(cmdok) + checkaddr(m->size, 1, AVR_OP_READ, oc, p, m); + } else + ok &= ~DEV_SPI_CALIBRATION; + + // actually, some AT90S... parts cannot read, only write lock bits :-0 + if( ! ((m = avr_locate_mem(p, "lock")) && m->op[AVR_OP_WRITE])) + ok &= ~DEV_SPI_LOCK; + + if(((m = avr_locate_mem(p, "fuse")) || (m = avr_locate_mem(p, "lfuse"))) && m->op[AVR_OP_READ] && m->op[AVR_OP_WRITE]) + nfuses++; + else + ok &= ~DEV_SPI_LFUSE; + + if((m = avr_locate_mem(p, "hfuse")) && m->op[AVR_OP_READ] && m->op[AVR_OP_WRITE]) + nfuses++; + else + ok &= ~DEV_SPI_HFUSE; + + if((m = avr_locate_mem(p, "efuse")) && m->op[AVR_OP_READ] && m->op[AVR_OP_WRITE]) + nfuses++; + else + ok &= ~DEV_SPI_EFUSE; + + if(descs) { + int len = 16-strlen(p->desc); + dev_info(".desc '%s' =>%*s [0x%02X, 0x%02X, 0x%02X, 0x%08x, 0x%05x, 0x%03x, 0x%06x, 0x%04x, 0x%03x, %d, 0x%03x, 0x%04x, '%s'], # %s %d\n", + p->desc, len > 0? len: 0, "", + p->signature[0], p->signature[1], p->signature[2], + flashoffset, flashsize, flashpagesize, + eepromoffset, eepromsize, eeprompagesize, + nfuses, + ok, + p->flags, + parttype(p), + p->config_file, p->lineno + ); + } + } + + if(opspi) { + printallopcodes(p, "part", p->op); + if(p->mem) { + for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { + AVRMEM *m = ldata(lnm); + if(m) + printallopcodes(p, m->desc, m->op); + } + } + } + + // print wait delays for AVR family parts + if(waits) { + if(!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI | AVRPART_HAS_TPI | AVRPART_AVR32))) + dev_info(".wd_chip_erase %.3f ms %s\n", p->chip_erase_delay/1000.0, p->desc); + if(p->mem) { + for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { + AVRMEM *m = ldata(lnm); + // write delays not needed for read-only calibration and signature memories + if(strcmp(m->desc, "calibration") && strcmp(m->desc, "signature")) { + if(!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI | AVRPART_HAS_TPI | AVRPART_AVR32))) { + if(m->min_write_delay == m->max_write_delay) + dev_info(".wd_%s %.3f ms %s\n", m->desc, m->min_write_delay/1000.0, p->desc); + else { + dev_info(".wd_min_%s %.3f ms %s\n", m->desc, m->min_write_delay/1000.0, p->desc); + dev_info(".wd_max_%s %.3f ms %s\n", m->desc, m->max_write_delay/1000.0, p->desc); + } + } + } + } + } + } + } +} diff --git a/src/developer_opts.h b/src/developer_opts.h new file mode 100644 index 00000000..701d97e3 --- /dev/null +++ b/src/developer_opts.h @@ -0,0 +1,24 @@ +/* + * avrdude - A Downloader/Uploader for AVR device programmers + * Copyright (C) 2022, Stefan Rueger + * + * 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, see . + */ + +#ifndef developer_opts_h +#define developer_opts_h + +void dev_output_part_defs(); + +#endif diff --git a/src/developer_opts_private.h b/src/developer_opts_private.h new file mode 100644 index 00000000..ffeb5c05 --- /dev/null +++ b/src/developer_opts_private.h @@ -0,0 +1,50 @@ +#define DEV_SPI_EN_CE_SIG 1 +#define DEV_SPI_PROGMEM 2 +#define DEV_SPI_PROGMEM_PAGED 4 +#define DEV_SPI_LOAD_EXT_ADDR 8 +#define DEV_SPI_EEPROM 16 +#define DEV_SPI_EEPROM_PAGED 32 +#define DEV_SPI_LOCK 64 +#define DEV_SPI_CALIBRATION 128 +#define DEV_SPI_LFUSE 256 +#define DEV_SPI_HFUSE 512 +#define DEV_SPI_EFUSE 1024 + +#ifndef DEV_INFO +#define DEV_INFO MSG_INFO +#endif + +#ifndef DEV_NOTICE +#define DEV_NOTICE MSG_NOTICE +#endif + +#ifndef DEV_NOTICE +#define DEV_NOTICE2 MSG_NOTICE2 +#endif + +#define dev_info(...) avrdude_message(DEV_INFO, __VA_ARGS__) +#define dev_notice(...) avrdude_message(DEV_NOTICE, __VA_ARGS__) +#define dev_notice2(...) avrdude_message(DEV_NOTICE2, __VA_ARGS__) + +#define dev_partout(fmt, component) (dot? \ + dev_info(".part\t%s\t%s\t" fmt "\n", p->desc, #component, p->component): \ + dev_info(" %-19s = " fmt ";\n", #component, p->component)) + +#define dev_partout_str(result, component) (dot? \ + dev_info(".part\t%s\t%s\t%s\n", p->desc, #component, result): \ + dev_info(" %-19s = %s;\n", #component, result)) + +#define dev_memout(fmt, component) (dot? \ + dev_info(".pmem\t%s\t%s\t%s\t" fmt "\n", p->desc, m->desc, #component, m->component): \ + dev_info(" %-15s = " fmt ";\n", #component, m->component)) + +#define dev_memout_str(result, component) (dot? \ + dev_info(".pmem\t%s\t%s\t%s\t%s\n", p->desc, m->desc, #component, result): \ + dev_info(" %-15s = %s;\n", #component, result)) + +#define dev_memout_yn(component) (dot? \ + dev_info(".pmem\t%s\t%s\t%s\t%s\n", p->desc, m->desc, #component, m->component? "yes": "no"): \ + dev_info(" %-15s = %s;\n", #component, m->component? "yes": "no")) + + +#define dev_flagout(name, mask) dev_info(" %-19s = %s;\n", (name), p->flags & (mask)? "yes": "no") diff --git a/src/main.c b/src/main.c index 43219bad..121e865e 100644 --- a/src/main.c +++ b/src/main.c @@ -50,7 +50,7 @@ #include "libavrdude.h" #include "term.h" - +#include "developer_opts.h" /* Get VERSION from ac_cfg.h */ char * version = VERSION; @@ -310,155 +310,6 @@ static void replace_backslashes(char *s) } -static char cmdbitchar(CMDBIT cb) { - switch(cb.type) { - case AVR_CMDBIT_IGNORE: - return 'x'; - case AVR_CMDBIT_VALUE: - return cb.value? '1': '0'; - case AVR_CMDBIT_ADDRESS: - return 'a'; - case AVR_CMDBIT_INPUT: - return 'i'; - case AVR_CMDBIT_OUTPUT: - return 'o'; - default: - return '?'; - } -} - -static const char *opcodename(int what) { - switch(what) { - case AVR_OP_READ: - return "read"; - case AVR_OP_WRITE: - return "write"; - case AVR_OP_READ_LO: - return "read_lo"; - case AVR_OP_READ_HI: - return "read_hi"; - case AVR_OP_WRITE_LO: - return "write_lo"; - case AVR_OP_WRITE_HI: - return "write_hi"; - case AVR_OP_LOADPAGE_LO: - return "loadpage_lo"; - case AVR_OP_LOADPAGE_HI: - return "loadpage_hi"; - case AVR_OP_LOAD_EXT_ADDR: - return "load_ext_addr"; - case AVR_OP_WRITEPAGE: - return "writepage"; - case AVR_OP_CHIP_ERASE: - return "chip_erase"; - case AVR_OP_PGM_ENABLE: - return "pgm_enable"; - default: - return "???"; - } -} - -static void printopcode(AVRPART *p, const char *d, OPCODE **opa, int what) { - unsigned char cmd[4]; - int i; - - if(opa && opa[what]) { - memset(cmd, 0, sizeof cmd); - avr_set_bits(opa[what], cmd); - - avrdude_message(MSG_INFO, ".op %s %s %s 0x%02x%02x%02x%02x ", p->desc, d, opcodename(what), cmd[0], cmd[1], cmd[2], cmd[3]); - for(i=31; i >= 0; i--) { - avrdude_message(MSG_INFO, "%c", cmdbitchar(opa[what]->bit[i])); - if(i%8 == 0) - avrdude_message(MSG_INFO, "%c", i? ' ': '\n'); - } - } -} - -static void printallopcodes(AVRPART *p, const char *d, OPCODE **opa) { - for(int i=0; i>= 1; ret++) - continue; - - return ret; -} - -// mnemonic characterisation of flags -static char *parttype(AVRPART *p) { - static char type[1024]; - - switch(p->flags & (AVRPART_HAS_PDI | AVRPART_AVR32 | AVRPART_HAS_TPI | AVRPART_HAS_UPDI)) { - case 0: strcpy(type, "ISP"); break; - case AVRPART_HAS_PDI: strcpy(type, "PDI"); break; - case AVRPART_AVR32: strcpy(type, "AVR32"); break; - case AVRPART_HAS_TPI: strcpy(type, "TPI"); break; - case AVRPART_HAS_UPDI: strcpy(type, "UPDI"); break; - default: strcpy(type, "UNKNOWN"); break; - } - if((p->flags & AVRPART_SERIALOK) == 0) - strcat(type, "|NOTSERIAL"); - if((p->flags & AVRPART_PARALLELOK) == 0) - strcat(type, "|NOTPARALLEL"); - if(p->flags & AVRPART_PSEUDOPARALLEL) - strcat(type, "|PSEUDOPARALLEL"); - if(p->flags & AVRPART_IS_AT90S1200) - strcat(type, "|IS_AT90S1200"); - - if(p->flags & AVRPART_HAS_DW) - strcat(type, "|DW"); - - if(p->flags & AVRPART_HAS_JTAG) - strcat(type, "|JTAG"); - if(p->flags & AVRPART_ALLOWFULLPAGEBITSTREAM) - strcat(type, "|PAGEBITSTREAM"); - if((p->flags & AVRPART_ENABLEPAGEPROGRAMMING) == 0) - strcat(type, "|NOPAGEPROGRAMMING"); - - return type; -} - - - -// check whether address bits are where they should be in ISP commands -static void checkaddr(int memsize, int pagesize, int what, OPCODE *op, AVRPART *p, AVRMEM *m) { - int i, lo, hi; - const char *whatstr = opcodename(what); - - lo = intlog2(pagesize); - hi = intlog2(memsize-1); - - // address bits should be between positions lo and hi (and fall in line), outside should be 0 or don't care - for(i=0; i<16; i++) { // ISP programming only deals with 16-bit addresses (words for flash, bytes for eeprom) - if(i < lo || i > hi) { - if(op->bit[i+8].type != AVR_CMDBIT_IGNORE && !(op->bit[i+8].type == AVR_CMDBIT_VALUE && op->bit[i+8].value == 0)) { - avrdude_message(MSG_INFO, ".cmdbit%d %s %s-%s outside addressable space should be x or 0, but is %c", i+8, p->desc, m->desc, whatstr, cmdbitchar(op->bit[i+8])); - if(op->bit[i+8].type == AVR_CMDBIT_ADDRESS) - avrdude_message(MSG_INFO, "%d", op->bit[i+8].bitno); - avrdude_message(MSG_INFO, "\n"); - } - } else { - if(op->bit[i+8].type != AVR_CMDBIT_ADDRESS) - avrdude_message(MSG_INFO, ".cmdbit%d %s %s-%s is %c but should be a\n", i+8, p->desc, m->desc, whatstr, cmdbitchar(op->bit[i+8])); - else if(op->bit[i+8].bitno != i) - avrdude_message(MSG_INFO, ".cmdbit%d %s %s-%s inconsistent: a%d specified as a%d\n", i+8, p->desc, m->desc, whatstr, i, op->bit[i+8].bitno); - } - } - for(i=0; i<32; i++) // command bits 8..23 should not contain address bits - if((i<8 || i>23) && op->bit[i].type == AVR_CMDBIT_ADDRESS) - avrdude_message(MSG_INFO, ".cmdbit%d %s %s-%s contains a%d which it shouldn't\n", i, p->desc, m->desc, whatstr, op->bit[i].bitno); -} - /* * main routine */ @@ -979,198 +830,9 @@ int main(int argc, char * argv []) avrdude_message(MSG_NOTICE, "\n"); - // print part descriptions for debugging avrdude.conf and exit - if(partdesc && 0 == strcmp(partdesc, "*")) { - int first = 1; - - for(LNODEID ln1 = lfirst(part_list); ln1; ln1 = lnext(ln1)) { - AVRPART *p = ldata(ln1); - int flashsize = 0, flashoffset = 0, flashpagesize = 0, eepromsize = 0, eepromoffset = 0, eeprompagesize = 0; - - if(p->mem) { - for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { - AVRMEM *m = ldata(lnm); - if(!flashsize && m->desc && 0==strcmp(m->desc, "flash")) { - flashsize = m->size; - flashpagesize = m->page_size; - flashoffset = m->offset; - } - if(!eepromsize && m->desc && 0==strcmp(m->desc, "eeprom")) { - eepromsize = m->size; - eepromoffset = m->offset; - eeprompagesize = m->page_size; - } - } - } - -#define AD_SPI_EN_CE_SIG 1 -#define AD_SPI_PROGMEM 2 -#define AD_SPI_PROGMEM_PAGED 4 -#define AD_SPI_LOAD_EXT_ADDR 8 -#define AD_SPI_EEPROM 16 -#define AD_SPI_EEPROM_PAGED 32 -#define AD_SPI_LOCK 64 -#define AD_SPI_CALIBRATION 128 -#define AD_SPI_LFUSE 256 -#define AD_SPI_HFUSE 512 -#define AD_SPI_EFUSE 1024 - - if(flashsize && !index(p->desc, ' ')) { - int len, ok, nfuses; - AVRMEM *m; - OPCODE *oc; - - if(!first) - avrdude_message(MSG_INFO, "\n"); - first = 0; - - ok = 2047; - nfuses = 0; - - if(!p->op[AVR_OP_PGM_ENABLE]) - ok &= ~AD_SPI_EN_CE_SIG; - - if(!p->op[AVR_OP_CHIP_ERASE]) - ok &= ~AD_SPI_EN_CE_SIG; - - if((m = avr_locate_mem(p, "flash"))) { - if((oc = m->op[AVR_OP_LOAD_EXT_ADDR])) { - // @@@ to do: check whether address is put at lsb of third byte - } else - ok &= ~AD_SPI_LOAD_EXT_ADDR; - - if((oc = m->op[AVR_OP_READ_HI])) - checkaddr(m->size>>1, 1, AVR_OP_READ_HI, oc, p, m); - else - ok &= ~AD_SPI_PROGMEM; - - if((oc = m->op[AVR_OP_READ_LO])) - checkaddr(m->size>>1, 1, AVR_OP_READ_LO, oc, p, m); - else - ok &= ~AD_SPI_PROGMEM; - - if((oc = m->op[AVR_OP_WRITE_HI])) - checkaddr(m->size>>1, 1, AVR_OP_WRITE_HI, oc, p, m); - else - ok &= ~AD_SPI_PROGMEM; - - if((oc = m->op[AVR_OP_WRITE_LO])) - checkaddr(m->size>>1, 1, AVR_OP_WRITE_LO, oc, p, m); - else - ok &= ~AD_SPI_PROGMEM; - - if((oc = m->op[AVR_OP_LOADPAGE_HI])) - checkaddr(m->page_size>>1, 1, AVR_OP_LOADPAGE_HI, oc, p, m); - else - ok &= ~AD_SPI_PROGMEM_PAGED; - - if((oc = m->op[AVR_OP_LOADPAGE_LO])) - checkaddr(m->page_size>>1, 1, AVR_OP_LOADPAGE_LO, oc, p, m); - else - ok &= ~AD_SPI_PROGMEM_PAGED; - - if((oc = m->op[AVR_OP_WRITEPAGE])) - checkaddr(m->size>>1, m->page_size>>1, AVR_OP_WRITEPAGE, oc, p, m); - else - ok &= ~AD_SPI_PROGMEM_PAGED; - } else - ok &= ~(AD_SPI_PROGMEM_PAGED | AD_SPI_PROGMEM); - - if((m = avr_locate_mem(p, "eeprom"))) { - if((oc = m->op[AVR_OP_READ])) { - checkaddr(m->size, 1, AVR_OP_READ, oc, p, m); - } else - ok &= ~AD_SPI_EEPROM; - - if((oc = m->op[AVR_OP_WRITE])) { - checkaddr(m->size, 1, AVR_OP_WRITE, oc, p, m); - } else - ok &= ~AD_SPI_EEPROM; - - if((oc = m->op[AVR_OP_LOADPAGE_LO])) { - checkaddr(m->page_size, 1, AVR_OP_LOADPAGE_LO, oc, p, m); - } else - ok &= ~AD_SPI_EEPROM_PAGED; - - if((oc = m->op[AVR_OP_WRITEPAGE])) { - checkaddr(m->size, m->page_size, AVR_OP_WRITEPAGE, oc, p, m); - } else - ok &= ~AD_SPI_EEPROM_PAGED; - } else - ok &= ~(AD_SPI_EEPROM_PAGED | AD_SPI_EEPROM); - - if((m = avr_locate_mem(p, "signature")) && (oc = m->op[AVR_OP_READ])) - checkaddr(m->size, 1, AVR_OP_READ, oc, p, m); - else - ok &= ~AD_SPI_EN_CE_SIG; - - if((m = avr_locate_mem(p, "calibration")) && (oc = m->op[AVR_OP_READ])) - checkaddr(m->size, 1, AVR_OP_READ, oc, p, m); - else - ok &= ~AD_SPI_CALIBRATION; - - // actually, some AT90S... parts cannot read, only write lock bits :-0 - if( ! ((m = avr_locate_mem(p, "lock")) && m->op[AVR_OP_WRITE])) - ok &= ~AD_SPI_LOCK; - - if(((m = avr_locate_mem(p, "fuse")) || (m = avr_locate_mem(p, "lfuse"))) && m->op[AVR_OP_READ] && m->op[AVR_OP_WRITE]) - nfuses++; - else - ok &= ~AD_SPI_LFUSE; - - if((m = avr_locate_mem(p, "hfuse")) && m->op[AVR_OP_READ] && m->op[AVR_OP_WRITE]) - nfuses++; - else - ok &= ~AD_SPI_HFUSE; - - if((m = avr_locate_mem(p, "efuse")) && m->op[AVR_OP_READ] && m->op[AVR_OP_WRITE]) - nfuses++; - else - ok &= ~AD_SPI_EFUSE; - - len = 16-strlen(p->desc); - avrdude_message(MSG_INFO, ".desc '%s' =>%*s [0x%02X, 0x%02X, 0x%02X, 0x%08x, 0x%05x, 0x%03x, 0x%06x, 0x%04x, 0x%03x, %d, 0x%03x, 0x%04x, '%s'], # %s %d\n", - p->desc, len > 0? len: 0, "", - p->signature[0], p->signature[1], p->signature[2], - flashoffset, flashsize, flashpagesize, - eepromoffset, eepromsize, eeprompagesize, - nfuses, - ok, - p->flags, - parttype(p), - p->config_file, p->lineno - ); - } - - printallopcodes(p, "part", p->op); - if(p->mem) { - for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { - AVRMEM *m = ldata(lnm); - if(m) - printallopcodes(p, m->desc, m->op); - } - } - - // print wait delays for AVR family parts - if(!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI | AVRPART_HAS_TPI | AVRPART_AVR32))) - avrdude_message(MSG_INFO, ".wd_chip_erase %.3f ms %s\n", p->chip_erase_delay/1000.0, p->desc); - if(p->mem) { - for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { - AVRMEM *m = ldata(lnm); - // write delays not needed for read-only calibration and signature memories - if(strcmp(m->desc, "calibration") && strcmp(m->desc, "signature")) { - if(!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI | AVRPART_HAS_TPI | AVRPART_AVR32))) { - if(m->min_write_delay == m->max_write_delay) - avrdude_message(MSG_INFO, ".wd_%s %.3f ms %s\n", m->desc, m->min_write_delay/1000.0, p->desc); - else { - avrdude_message(MSG_INFO, ".wd_min_%s %.3f ms %s\n", m->desc, m->min_write_delay/1000.0, p->desc); - avrdude_message(MSG_INFO, ".wd_max_%s %.3f ms %s\n", m->desc, m->max_write_delay/1000.0, p->desc); - } - } - } - } - } - } + // developer option -p */[*codws] prints various aspects of part descriptions and exits + if(partdesc && *partdesc == '*') { + dev_output_part_defs(partdesc+1); exit(1); } From a6ea797c1cd51ccebdb44ac5cc5fc71b4c2a8cc7 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Tue, 28 Jun 2022 22:53:24 +0200 Subject: [PATCH 044/511] PR 996 and 1013 done --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index da4e42d0..d5ce1df4 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,8 @@ Changes since version 7.0: to < 80 characters #1000 - Dragon JTAG fix #979 - adding support for all Linux baud rates v.2 #993 + - Replace internal knowledge in jtag3.c by a public API #996 + - JTAG3 UPDI EEPROM fix #1013 * Internals: From 43c6b0422681ca271b9f32537bdba488df221e06 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 28 Jun 2022 22:46:06 +0100 Subject: [PATCH 045/511] Update NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index d5ce1df4..e78362b3 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ Changes since version 7.0: - adding support for all Linux baud rates v.2 #993 - Replace internal knowledge in jtag3.c by a public API #996 - JTAG3 UPDI EEPROM fix #1013 + - Treat x bits in .conf SPI commands as 0 #943 * Internals: From ba98e48880c030d90d9d4dd752a895fa29295607 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 26 Jun 2022 00:11:51 +0200 Subject: [PATCH 046/511] add "hvupdi_variant" property to avrdude.conf --- src/avrdude.conf.in | 44 ++++++++++++++++++++++++++------------------ src/config_gram.y | 7 +++++++ src/lexer.l | 1 + src/libavrdude.h | 1 + 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index ba7f4f8e..2fc59ecd 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -17114,13 +17114,15 @@ part # AVR8X tiny family common values #------------------------------------------------------------ -part parent ".avr8x" - id = ".avr8x_tiny"; - desc = "AVR8X tiny family common values"; - family_id = "tinyAVR"; +part parent ".avr8x" + id = ".avr8x_tiny"; + desc = "AVR8X tiny family common values"; + family_id = "tinyAVR"; + # Shared UPDI pin, HV on UPDI pin + hvupdi_variant = 0; memory "userrow" - size = 0x20; + size = 0x20; offset = 0x1300; page_size = 0x20; readsize = 0x100; @@ -17135,13 +17137,15 @@ part parent ".avr8x" # AVR8X mega family common values #------------------------------------------------------------ -part parent ".avr8x" - id = ".avr8x_mega"; - desc = "AVR8X mega family common values"; - family_id = "megaAVR"; +part parent ".avr8x" + id = ".avr8x_mega"; + desc = "AVR8X mega family common values"; + family_id = "megaAVR"; + # Dedicated UPDI pin, no HV + hvupdi_variant = 1; memory "userrow" - size = 0x40; + size = 0x40; offset = 0x1300; page_size = 0x40; readsize = 0x100; @@ -18240,11 +18244,13 @@ part parent ".avr8x_mega" #------------------------------------------------------------ part - id = ".avrdx"; - desc = "AVR-Dx family common values"; - has_updi = yes; - nvm_base = 0x1000; - ocd_base = 0x0F80; + id = ".avrdx"; + desc = "AVR-Dx family common values"; + has_updi = yes; + nvm_base = 0x1000; + ocd_base = 0x0F80; + # Dedicated UPDI pin, no HV + hvupdi_variant = 1; memory "signature" size = 3; @@ -19210,9 +19216,11 @@ part parent ".avrdx" # AVR-Ex family common values #------------------------------------------------------------ -part parent ".avrdx" - id = ".avrex"; - desc = "AVR-Ex family common values"; +part parent ".avrdx" + id = ".avrex"; + desc = "AVR-Ex family common values"; + # Shared UPDI pin, HV on _RESET + hvupdi_variant = 2; memory "userrow" size = 0x40; diff --git a/src/config_gram.y b/src/config_gram.y index a8416162..126b9b54 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -81,6 +81,7 @@ static int pin_name; %token K_DEFAULT_SERIAL %token K_DESC %token K_FAMILY_ID +%token K_HVUPDI_VARIANT %token K_DEVICECODE %token K_STK500_DEVCODE %token K_AVR910_DEVCODE @@ -676,6 +677,12 @@ part_parm : free_token($3); } | + K_HVUPDI_VARIANT TKN_EQUAL TKN_NUMBER + { + current_part->hvupdi_variant = $3->value.number; + free_token($3); + } | + K_DEVICECODE TKN_EQUAL TKN_NUMBER { { yyerror("devicecode is deprecated, use " diff --git a/src/lexer.l b/src/lexer.l index 0b31eb21..dd5c081a 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -159,6 +159,7 @@ hventerstabdelay { yylval=NULL; return K_HVENTERSTABDELAY; } hvleavestabdelay { yylval=NULL; return K_HVLEAVESTABDELAY; } hvsp_controlstack { yylval=NULL; return K_HVSP_CONTROLSTACK; } hvspcmdexedelay { yylval=NULL; return K_HVSPCMDEXEDELAY; } +hvupdi_variant { yylval=NULL; return K_HVUPDI_VARIANT; } id { yylval=NULL; return K_ID; } idr { yylval=NULL; return K_IDR; } io { yylval=new_token(K_IO); return K_IO; } diff --git a/src/libavrdude.h b/src/libavrdude.h index ddb72b48..2b87ddf1 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -202,6 +202,7 @@ typedef struct avrpart { char desc[AVR_DESCLEN]; /* long part name */ char id[AVR_IDLEN]; /* short part name */ char family_id[AVR_FAMILYIDLEN+1]; /* family id in the SIB (avr8x) */ + int hvupdi_variant; /* 12V pulse on UPDI pin, no pin or RESET pin */ int stk500_devcode; /* stk500 device code */ int avr910_devcode; /* avr910 device code */ int chip_erase_delay; /* microseconds */ From f67c35744e7522a61ff1d67efef4adc27278e1b0 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 26 Jun 2022 00:13:56 +0200 Subject: [PATCH 047/511] add support for "-x hvupdi" that triggers HV UPDI --- src/jtag3.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/jtag3.c b/src/jtag3.c index 4e3ef8c2..976291f4 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -71,6 +71,9 @@ struct pdata /* Start address of Xmega boot area */ unsigned long boot_start; + /* Flag for triggering HV UPDI */ + bool use_hvupdi; + /* Function to set the appropriate clock parameter */ int (*set_sck)(PROGRAMMER *, unsigned char *); }; @@ -1249,10 +1252,12 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) } } - parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE; - if (jtag3_setparm(pgm, SCOPE_AVR, 3, PARM3_OPT_12V_UPDI_ENABLE, parm, 1) < 0) - return -1; - + // Generate 12V UPDI pulse if user asks for it and hardware supports it + if(p->flags & AVRPART_HAS_UPDI && PDATA(pgm)->use_hvupdi == true && p->hvupdi_variant == 0) { + parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE; + if (jtag3_setparm(pgm, SCOPE_AVR, 3, PARM3_OPT_12V_UPDI_ENABLE, parm, 1) < 0) + return -1; + } u16_to_b2(xd.default_min_div1_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV1_VOLTAGE_MV); u16_to_b2(xd.default_min_div2_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV2_VOLTAGE_MV); u16_to_b2(xd.default_min_div4_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV4_VOLTAGE_MV); @@ -1477,6 +1482,10 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms) continue; } + else if (matches(extended_param, "hvupdi") || matches(extended_param, "hvupdi=1")) { + PDATA(pgm)->use_hvupdi = true; + continue; + } avrdude_message(MSG_INFO, "%s: jtag3_parseextparms(): invalid extended parameter '%s'\n", progname, extended_param); @@ -2601,6 +2610,7 @@ void jtag3_updi_initpgm(PROGRAMMER * pgm) * mandatory functions */ pgm->initialize = jtag3_initialize; + pgm->parseextparams = jtag3_parseextparms; pgm->display = jtag3_display; pgm->enable = jtag3_enable; pgm->disable = jtag3_disable; From e0683417163d1563cedbfeb0a2c23e4d783d4940 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 26 Jun 2022 10:19:27 +0200 Subject: [PATCH 048/511] Make sure "-x hvupdi" is only valid for Pickit4 and Powerdebugger --- src/jtag3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/jtag3.c b/src/jtag3.c index 976291f4..5e971a28 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1458,6 +1458,7 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms) LNODEID ln; const char *extended_param; int rv = 0; + avrdude_message(MSG_INFO, "id: %s, desc: %s, type: %s\n", ldata(lfirst(pgm->id)), pgm->desc, pgm->type); for (ln = lfirst(extparms); ln; ln = lnext(ln)) { extended_param = ldata(ln); @@ -1482,7 +1483,9 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms) continue; } - else if (matches(extended_param, "hvupdi") || matches(extended_param, "hvupdi=1")) { + + else if ((matches(extended_param, "hvupdi") || matches(extended_param, "hvupdi=1")) && + (matches(ldata(lfirst(pgm->id)), "pickit4_updi") || matches(ldata(lfirst(pgm->id)), "powerdebugger_updi"))) { PDATA(pgm)->use_hvupdi = true; continue; } From 50220289bb8b369ccb89fade961f60d8c593d556 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 26 Jun 2022 19:35:39 +0200 Subject: [PATCH 049/511] Add high-voltage UPDI info to docs --- src/avrdude.1 | 20 ++++++++++++++++---- src/doc/avrdude.texi | 20 +++++++++++++++++--- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/avrdude.1 b/src/avrdude.1 index 81834d30..5ecccb6b 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -179,7 +179,7 @@ has a revision 1 hardware and firmware version of at least 5.37 (decimal). For ATxmega devices, the JTAGICE3 is supported in PDI mode. .Pp Atmel-ICE (ARM/AVR) is supported in all modes (JTAG, PDI for Xmega, debugWIRE, -ISP). +ISP, UPDI). .Pp Atmel's XplainedPro boards, using the EDBG protocol (CMSIS-DAP compatible), are supported using the "jtag3" programmer type. @@ -225,7 +225,7 @@ thus the name SerialUPDI programmer implementation is based on Microchip's .Em pymcuprog Li https://github.com/microchip-pic-avr-tools/pymcuprog utility, but it also contains some performance improvements included in -Spence Kohde's +Spence Konde's .Em DxCore Arduino core .Li https://github.com/SpenceKonde/DxCore . @@ -959,9 +959,13 @@ versions of the bootloader. .It Ar JTAG ICE mkII .It Ar JTAGICE3 .It Ar Atmel-ICE +.It Ar Power Debugger +.It Ar PICkit 4 +.It Ar MPLAB SNAP .It Ar AVR Dragon -When using the JTAG ICE mkII, JTAGICE3, Atmel-ICE or AVR Dragon in JTAG mode, the -following extended parameter is accepted: +When using the JTAG ICE mkII, JTAGICE3, Atmel-ICE, PICkit 4, MPLAB SNAP, +Power Debugger or AVR Dragon in JTAG mode, the following extended parameter +is accepted: .Bl -tag -offset indent -width indent .It Ar jtagchain=UB,UA,BB,BA Setup the JTAG scan chain for @@ -976,6 +980,14 @@ bits after the target AVR, respectively. Each AVR unit within the chain shifts by 4 bits. Other JTAG units might require a different bit shift count. .El +.Pp +The PICkit 4 and the Power Debugger also supports high-voltage UPDI programming. +This is used to enable a UPDI pin that has previously been set to RESET or +GPIO mode. High-voltage UPDI can be utilized by using an extended parameter: +.Bl -tag -offset indent -width indent +.It Ar hvupdi +Enable high-voltage UPDI initialization for targets that supports this. +.El .It Ar AVR910 .Bl -tag -offset indent -width indent .It Ar devcode=VALUE diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index 92cf4df4..20c8612a 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -250,7 +250,8 @@ See below for the limitations of debugWire. For ATxmega devices, the JTAG ICE mkII/3 is supported in PDI mode, provided it has a revision 1 hardware and firmware version of at least 5.37 (decimal). -The Atmel-ICE (ARM/AVR) is supported (JTAG, PDI for Xmega, debugWIRE, ISP modes). +The Atmel-ICE (ARM/AVR) is supported (JTAG, PDI for Xmega, debugWIRE, ISP, +UPDI). Atmel's XplainedPro boards, using EDBG protocol (CMSIS-DAP compliant), are supported by the ``jtag3'' programmer type. @@ -843,10 +844,15 @@ accepting extended parameters. @table @code @item JTAG ICE mkII/3 +@itemx Atmel-ICE +@itemx PICkit 4 +@itemx MPLAB SNAP +@itemx Power Debugger @itemx AVR Dragon -When using the JTAG ICE mkII/3 or AVR Dragon in JTAG mode, the -following extended parameter is accepted: +When using the JTAG ICE mkII, JTAGICE3, Atmel-ICE, PICkit 4, MPLAB SNAP, +Power Debugger or AVR Dragon in JTAG mode, the following extended parameter +is accepted: @table @code @item @samp{jtagchain=UB,UA,BB,BA} Setup the JTAG scan chain for @var{UB} units before, @var{UA} units @@ -856,6 +862,14 @@ Each AVR unit within the chain shifts by 4 bits. Other JTAG units might require a different bit shift count. @end table +The PICkit 4 and the Power Debugger also supports high-voltage UPDI programming. +This is used to enable a UPDI pin that has previously been set to RESET or +GPIO mode. High-voltage UPDI can be utilized by using an extended parameter: +@table @code +@item @samp{hvupdi} +Enable high-voltage UPDI initialization for targets that supports this. +@end table + @cindex @code{-x} AVR910 @item AVR910 From 577856cf15700c048f1dd1cac7ca3a92d2f12b4d Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 26 Jun 2022 19:54:40 +0200 Subject: [PATCH 050/511] Use HV UPDI constants rather than arbitrary numbers --- src/jtag3.c | 7 ++++--- src/libavrdude.h | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/jtag3.c b/src/jtag3.c index 5e971a28..8eed8c29 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1252,8 +1252,10 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) } } - // Generate 12V UPDI pulse if user asks for it and hardware supports it - if(p->flags & AVRPART_HAS_UPDI && PDATA(pgm)->use_hvupdi == true && p->hvupdi_variant == 0) { + // Generate 12V UPDI pulse if user asks for it and hardware supports it + if (p->flags & AVRPART_HAS_UPDI && + PDATA(pgm)->use_hvupdi == true && + p->hvupdi_variant == HV_UPDI_VARIANT_0) { parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE; if (jtag3_setparm(pgm, SCOPE_AVR, 3, PARM3_OPT_12V_UPDI_ENABLE, parm, 1) < 0) return -1; @@ -1458,7 +1460,6 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms) LNODEID ln; const char *extended_param; int rv = 0; - avrdude_message(MSG_INFO, "id: %s, desc: %s, type: %s\n", ldata(lfirst(pgm->id)), pgm->desc, pgm->type); for (ln = lfirst(extparms); ln; ln = lnext(ln)) { extended_param = ldata(ln); diff --git a/src/libavrdude.h b/src/libavrdude.h index 2b87ddf1..c3e89a7e 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -188,6 +188,10 @@ typedef struct opcode { #define AVRPART_IS_AT90S1200 0x1000 /* part is an AT90S1200 (needs special treatment) */ #define AVRPART_HAS_UPDI 0x2000 /* part has UPDI i/f (AVR8X) */ +#define HV_UPDI_VARIANT_0 0 /* Shared UPDI/GPIO/RESET pin, HV on UPDI pin (tinyAVR0/1/2)*/ +#define HV_UPDI_VARIANT_1 1 /* Dedicated UPDI pin, no HV (megaAVR0/AVR-Dx) */ +#define HV_UPDI_VARIANT_2 2 /* Shared UPDI pin, HV on _RESET (AVR-Ex) */ + #define AVR_DESCLEN 64 #define AVR_IDLEN 32 #define AVR_FAMILYIDLEN 7 From 39008ac2c1008ca377cd605a754796ccc3cb3223 Mon Sep 17 00:00:00 2001 From: "Ruud, Jan Egil" Date: Tue, 28 Jun 2022 11:55:33 +0200 Subject: [PATCH 051/511] Add UPDI HV type to device description. --- src/jtag3.c | 1 + src/jtag3_private.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/jtag3.c b/src/jtag3.c index 8eed8c29..a371a6a9 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1198,6 +1198,7 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) u16_to_b2(xd.nvm_base_addr, p->nvm_base); u16_to_b2(xd.ocd_base_addr, p->ocd_base); + xd.hvupdi_variant = p->hvupdi_variant; for (ln = lfirst(p->mem); ln; ln = lnext(ln)) { diff --git a/src/jtag3_private.h b/src/jtag3_private.h index 3eeb61b3..677d2289 100644 --- a/src/jtag3_private.h +++ b/src/jtag3_private.h @@ -400,5 +400,7 @@ struct updi_device_desc { unsigned char flash_page_size_msb; // Extends flash_page_size, used in 24-bit mode unsigned char address_mode; // 0x00 = 16-bit mode, 0x01 = 24-bit mode + + unsigned char hvupdi_variant; // Indicates the target UPDI HV implementation }; #endif /* JTAG3_PRIVATE_EXPORTED */ From 65763b5700c0f7dc627fece050f8c7369e47aadf Mon Sep 17 00:00:00 2001 From: "Ruud, Jan Egil" Date: Tue, 28 Jun 2022 12:21:45 +0200 Subject: [PATCH 052/511] Correct hvupdi_variant for AVR DD devices. --- src/avrdude.conf.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 2fc59ecd..2e66c360 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -18932,6 +18932,7 @@ part parent ".avrdx" id = "avr16dd14"; desc = "AVR16DD14"; signature = 0x1E 0x94 0x34; + hvupdi_variant = 2; memory "flash" size = 0x4000; @@ -18956,6 +18957,7 @@ part parent ".avrdx" id = "avr16dd20"; desc = "AVR16DD20"; signature = 0x1E 0x94 0x33; + hvupdi_variant = 2; memory "flash" size = 0x4000; @@ -18980,6 +18982,7 @@ part parent ".avrdx" id = "avr16dd28"; desc = "AVR16DD28"; signature = 0x1E 0x94 0x32; + hvupdi_variant = 2; memory "flash" size = 0x4000; @@ -19004,6 +19007,7 @@ part parent ".avrdx" id = "avr16dd32"; desc = "AVR16DD32"; signature = 0x1E 0x94 0x31; + hvupdi_variant = 2; memory "flash" size = 0x4000; @@ -19028,6 +19032,7 @@ part parent ".avrdx" id = "avr32dd14"; desc = "AVR32DD14"; signature = 0x1E 0x95 0x3B; + hvupdi_variant = 2; memory "flash" size = 0x8000; @@ -19052,6 +19057,7 @@ part parent ".avrdx" id = "avr32dd20"; desc = "AVR32DD20"; signature = 0x1E 0x95 0x3A; + hvupdi_variant = 2; memory "flash" size = 0x8000; @@ -19076,6 +19082,7 @@ part parent ".avrdx" id = "avr32dd28"; desc = "AVR32DD28"; signature = 0x1E 0x95 0x39; + hvupdi_variant = 2; memory "flash" size = 0x8000; @@ -19100,6 +19107,7 @@ part parent ".avrdx" id = "avr32dd32"; desc = "AVR32DD32"; signature = 0x1E 0x95 0x38; + hvupdi_variant = 2; memory "flash" size = 0x8000; @@ -19124,6 +19132,7 @@ part parent ".avrdx" id = "avr64dd14"; desc = "AVR64DD14"; signature = 0x1E 0x96 0x1D; + hvupdi_variant = 2; memory "flash" size = 0x10000; @@ -19148,6 +19157,7 @@ part parent ".avrdx" id = "avr64dd20"; desc = "AVR64DD20"; signature = 0x1E 0x96 0x1C; + hvupdi_variant = 2; memory "flash" size = 0x10000; @@ -19172,6 +19182,7 @@ part parent ".avrdx" id = "avr64dd28"; desc = "AVR64DD28"; signature = 0x1E 0x96 0x1B; + hvupdi_variant = 2; memory "flash" size = 0x10000; @@ -19196,6 +19207,7 @@ part parent ".avrdx" id = "avr64dd32"; desc = "AVR64DD32"; signature = 0x1E 0x96 0x1A; + hvupdi_variant = 2; memory "flash" size = 0x10000; From 30c1b31b8d8c6572e608f379f7e6e00f6e45bf17 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Tue, 28 Jun 2022 13:59:54 +0200 Subject: [PATCH 053/511] Send 12V pulse to HV_UPDI_VARIANT_2 targets as well --- src/jtag3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/jtag3.c b/src/jtag3.c index a371a6a9..f1cd2fc9 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1256,7 +1256,8 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) // Generate 12V UPDI pulse if user asks for it and hardware supports it if (p->flags & AVRPART_HAS_UPDI && PDATA(pgm)->use_hvupdi == true && - p->hvupdi_variant == HV_UPDI_VARIANT_0) { + (p->hvupdi_variant == HV_UPDI_VARIANT_0 || + p->hvupdi_variant == HV_UPDI_VARIANT_2)) { parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE; if (jtag3_setparm(pgm, SCOPE_AVR, 3, PARM3_OPT_12V_UPDI_ENABLE, parm, 1) < 0) return -1; From 6473a6d71ab53e732babb90ed010d216d15b90c9 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Wed, 29 Jun 2022 19:55:23 +0200 Subject: [PATCH 054/511] Add avrdude_message to verbose mode --- src/jtag3.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/jtag3.c b/src/jtag3.c index f1cd2fc9..5a333991 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1258,10 +1258,13 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) PDATA(pgm)->use_hvupdi == true && (p->hvupdi_variant == HV_UPDI_VARIANT_0 || p->hvupdi_variant == HV_UPDI_VARIANT_2)) { + avrdude_message(MSG_NOTICE, "%s: Sending HV pulse to %s pin\n", + progname, p->hvupdi_variant == HV_UPDI_VARIANT_0 ? "UPDI" : "RESET"); parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE; if (jtag3_setparm(pgm, SCOPE_AVR, 3, PARM3_OPT_12V_UPDI_ENABLE, parm, 1) < 0) return -1; } + u16_to_b2(xd.default_min_div1_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV1_VOLTAGE_MV); u16_to_b2(xd.default_min_div2_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV2_VOLTAGE_MV); u16_to_b2(xd.default_min_div4_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV4_VOLTAGE_MV); From d95c1a91f72578a761c579b103c3a1c787a741e1 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 4 Jul 2022 12:25:50 +0100 Subject: [PATCH 055/511] Steamline avrftdi support for ATmega2560 et al --- src/avrftdi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/avrftdi.c b/src/avrftdi.c index c6d2f86e..54490dc0 100644 --- a/src/avrftdi.c +++ b/src/avrftdi.c @@ -917,6 +917,10 @@ static int avrftdi_chip_erase(PROGRAMMER * pgm, AVRPART * p) static int avrftdi_lext(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, unsigned int address) { + /* nothing to do if load extended address command unavailable */ + if(m->op[AVR_OP_LOAD_EXT_ADDR] == NULL) + return 0; + avrftdi_t *pdata = to_pdata(pgm); unsigned char buf[] = { 0x00, 0x00, 0x00, 0x00 }; @@ -1019,7 +1023,7 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, page_size = m->page_size; /* on large-flash devices > 128k issue extended address command when needed */ - if(m->op[AVR_OP_LOAD_EXT_ADDR] && avrftdi_lext(pgm, p, m, addr/2) < 0) + if(avrftdi_lext(pgm, p, m, addr/2) < 0) return -1; /* prepare the command stream for the whole page */ @@ -1102,7 +1106,6 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, { OPCODE * readop; int byte, word; - unsigned int address = addr/2; unsigned int buf_size = 4 * len + 4; unsigned char* o_buf = alloca(buf_size); @@ -1122,7 +1125,7 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return -1; } - if(m->op[AVR_OP_LOAD_EXT_ADDR] && avrftdi_lext(pgm, p, m, address) < 0) + if(avrftdi_lext(pgm, p, m, addr/2) < 0) return -1; /* word addressing! */ From 3893a21164c0adec19e5d29f34efddb9b007d56a Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sat, 18 Jun 2022 22:34:54 +0100 Subject: [PATCH 056/511] Fix avrftdi support for ATmega2560 et al (load extended address) --- src/avrftdi.c | 41 +++++++++++++++++++---------------------- src/avrftdi_private.h | 2 ++ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/avrftdi.c b/src/avrftdi.c index e41d775e..c6d2f86e 100644 --- a/src/avrftdi.c +++ b/src/avrftdi.c @@ -917,8 +917,15 @@ static int avrftdi_chip_erase(PROGRAMMER * pgm, AVRPART * p) static int avrftdi_lext(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, unsigned int address) { + avrftdi_t *pdata = to_pdata(pgm); unsigned char buf[] = { 0x00, 0x00, 0x00, 0x00 }; + /* only send load extended address command if high byte changed */ + if(pdata->lext_byte == (uint8_t) (address>>16)) + return 0; + + pdata->lext_byte = (uint8_t) (address>>16); + avr_set_bits(m->op[AVR_OP_LOAD_EXT_ADDR], buf); avr_set_addr(m->op[AVR_OP_LOAD_EXT_ADDR], buf, address); @@ -983,8 +990,6 @@ static int avrftdi_eeprom_read(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned int page_size, unsigned int addr, unsigned int len) { - int use_lext_address = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL; - unsigned int word; unsigned int poll_index; @@ -1013,22 +1018,12 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, page_size = m->page_size; - /* if we do cross a 64k word boundary (or write the - * first page), we need to issue a 'load extended - * address byte' command, which is defined as 0x4d - * 0x00
0x00. As far as i know, this - * is only available on 256k parts. 64k word is 128k - * bytes. - * write the command only once. - */ - if(use_lext_address && (((addr/2) & 0xffff0000))) { - if (0 > avrftdi_lext(pgm, p, m, addr/2)) - return -1; - } + /* on large-flash devices > 128k issue extended address command when needed */ + if(m->op[AVR_OP_LOAD_EXT_ADDR] && avrftdi_lext(pgm, p, m, addr/2) < 0) + return -1; /* prepare the command stream for the whole page */ - /* addr is in bytes, but we program in words. addr/2 should be something - * like addr >> WORD_SHIFT, though */ + /* addr is in bytes, but we program in words. */ for(word = addr/2; word < (len + addr)/2; word++) { log_debug("-< bytes = %d of %d\n", word * 2, len + addr); @@ -1107,7 +1102,6 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, { OPCODE * readop; int byte, word; - int use_lext_address = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL; unsigned int address = addr/2; unsigned int buf_size = 4 * len + 4; @@ -1128,10 +1122,8 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return -1; } - if(use_lext_address && ((address & 0xffff0000))) { - if (0 > avrftdi_lext(pgm, p, m, address)) - return -1; - } + if(m->op[AVR_OP_LOAD_EXT_ADDR] && avrftdi_lext(pgm, p, m, address) < 0) + return -1; /* word addressing! */ for(word = addr/2, index = 0; word < (addr + len)/2; word++) @@ -1210,7 +1202,11 @@ avrftdi_setup(PROGRAMMER * pgm) { avrftdi_t* pdata; - pgm->cookie = malloc(sizeof(avrftdi_t)); + + if(!(pgm->cookie = calloc(sizeof(avrftdi_t), 1))) { + log_err("Error allocating memory.\n"); + exit(1); + } pdata = to_pdata(pgm); pdata->ftdic = ftdi_new(); @@ -1224,6 +1220,7 @@ avrftdi_setup(PROGRAMMER * pgm) pdata->pin_value = 0; pdata->pin_direction = 0; pdata->led_mask = 0; + pdata->lext_byte = 0xff; } static void diff --git a/src/avrftdi_private.h b/src/avrftdi_private.h index 3c965ed8..15b9caec 100644 --- a/src/avrftdi_private.h +++ b/src/avrftdi_private.h @@ -81,6 +81,8 @@ typedef struct avrftdi_s { int tx_buffer_size; /* use bitbanging instead of mpsse spi */ bool use_bitbanging; + /* bits 16-23 of extended 24-bit word flash address for parts with flash > 128k */ + uint8_t lext_byte; } avrftdi_t; void avrftdi_log(int level, const char * func, int line, const char * fmt, ...); From b167e88422e769db93de12c1e8d820569fdb3fdd Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 19 Jun 2022 10:53:07 +0200 Subject: [PATCH 057/511] Reduce programmer description string length to less than 80 characters. #941 related --- src/avrdude.conf.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 362b6167..ba7f4f8e 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -947,9 +947,10 @@ programmer ; # commercial version of USBtiny, using a separate VID/PID +# https://github.com/IowaScaledEngineering/ckt-avrprogrammer programmer id = "iseavrprog"; - desc = "USBtiny-based USB programmer, https://github.com/IowaScaledEngineering/ckt-avrprogrammer"; + desc = "USBtiny-based programmer, https://iascaled.com"; type = "usbtiny"; connection_type = usb; usbvid = 0x1209; From 37026cad52f1952732b0807974149db5280cde82 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sun, 19 Jun 2022 19:56:56 +0200 Subject: [PATCH 058/511] PR #1000 is done now --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 4638746a..888796ca 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,8 @@ Changes since version 7.0: - Fix .Dd macro in manpage #949 - fix M1 homebrew path #950 - CMake Enhancements #962 + - Reduce programmer desc string length in avrdude.conf + to < 80 characters #1000 * Internals: From 963a1e54afee8f828e2b3f36ace79f1d55f6a5b0 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 29 May 2022 13:12:50 +0200 Subject: [PATCH 059/511] Fix JTAG transaction close issue Fixes issue #366 --- src/jtagmkII.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jtagmkII.c b/src/jtagmkII.c index fc06301c..b1024b53 100644 --- a/src/jtagmkII.c +++ b/src/jtagmkII.c @@ -1840,8 +1840,8 @@ void jtagmkII_close(PROGRAMMER * pgm) avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close()\n", progname); - if (pgm->flag & PGM_FL_IS_PDI) { - /* When in PDI mode, restart target. */ + if (pgm->flag & (PGM_FL_IS_PDI | PGM_FL_IS_JTAG)) { + /* When in PDI or JTAG mode, restart target. */ buf[0] = CMND_GO; avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close(): Sending GO command: ", progname); From 8bd39157c199508c0d3f61b62d159d0ba271387c Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sun, 26 Jun 2022 22:58:25 +0200 Subject: [PATCH 060/511] Closing PR 979 --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 888796ca..16fef572 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ Changes since version 7.0: - Fix micronucleus bootloader to check for unresponsive USB devices #945 - Fix src/CMakeLists.txt to honor CMAKE_INSTALL_LIBDIR #972 + - [bug #43898] atmega644p remains stopped after JTAG transaction #366 * Pull requests: @@ -26,6 +27,7 @@ Changes since version 7.0: - CMake Enhancements #962 - Reduce programmer desc string length in avrdude.conf to < 80 characters #1000 + - Dragon JTAG fix #979 * Internals: From 134509cc6fcee6c595f7ccaed21956c251647fcb Mon Sep 17 00:00:00 2001 From: prchal Date: Tue, 7 Jun 2022 11:50:03 +0200 Subject: [PATCH 061/511] adding support for all Linux baud rates v.2 If optiboot can work at higher bauds, why not avrdude. Versoin 2 of #985. Linux uses the old-style bitmapped version of the Bxxxx macros. --- src/ser_posix.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/ser_posix.c b/src/ser_posix.c index 2c5d45b5..53d8cd15 100644 --- a/src/ser_posix.c +++ b/src/ser_posix.c @@ -76,6 +76,45 @@ static struct baud_mapping baud_lookup_table [] = { #endif #ifdef B230400 { 230400, B230400 }, +#endif +#ifdef B250000 + { 250000, B250000 }, +#endif +#ifdef B460800 + { 460800, B460800 }, +#endif +#ifdef B500000 + { 500000, B500000 }, +#endif +#ifdef B576000 + { 576000, B576000 }, +#endif +#ifdef B921600 + { 921600, B921600 }, +#endif +#ifdef B1000000 + { 1000000, B1000000 }, +#endif +#ifdef B1152000 + { 1152000, B1152000 }, +#endif +#ifdef B1500000 + { 1500000, B1500000 }, +#endif +#ifdef B2000000 + { 2000000, B2000000 }, +#endif +#ifdef B2500000 + { 2500000, B2500000 }, +#endif +#ifdef B3000000 + { 3000000, B3000000 }, +#endif +#ifdef B3500000 + { 3500000, B3500000 }, +#endif +#ifdef B4000000 + { 4000000, B4000000 }, #endif { 0, 0 } /* Terminator. */ }; From ad2be990b762e92872e16d969634e252434ff71f Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sun, 26 Jun 2022 23:00:32 +0200 Subject: [PATCH 062/511] PR 993 done --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 16fef572..da4e42d0 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,7 @@ Changes since version 7.0: - Reduce programmer desc string length in avrdude.conf to < 80 characters #1000 - Dragon JTAG fix #979 + - adding support for all Linux baud rates v.2 #993 * Internals: From ef785a617ac9a79f4f438fdb87500855f2a2a9a8 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 29 Apr 2022 00:37:28 +0100 Subject: [PATCH 063/511] Treat x bits in .conf SPI commands as 0 --- src/avrpart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/avrpart.c b/src/avrpart.c index dc6def44..fdff0f78 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -82,11 +82,11 @@ int avr_set_bits(OPCODE * op, unsigned char * cmd) unsigned char mask; for (i=0; i<32; i++) { - if (op->bit[i].type == AVR_CMDBIT_VALUE) { + if (op->bit[i].type == AVR_CMDBIT_VALUE || op->bit[i].type == AVR_CMDBIT_IGNORE) { j = 3 - i / 8; bit = i % 8; mask = 1 << bit; - if (op->bit[i].value) + if (op->bit[i].value && op->bit[i].type == AVR_CMDBIT_VALUE) cmd[j] = cmd[j] | mask; else cmd[j] = cmd[j] & ~mask; From 8953967fc38fc3785e4cb9eb7cf3354ebf5b8a83 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Wed, 15 Jun 2022 23:32:22 +0200 Subject: [PATCH 064/511] Replace internal knowledge in jtag3.c by a public API In certain situations (CRC failure, device locked), that JTAG3 read functions need to return an indication to the caller that it is OK to proceed, and allow erasing the device anyway. Historically, the JTAG3 code passed the respective protocol errors directly (and unexplained) up to the caller, leaving the decision to the caller how to handle the situation. Replace that by a more common return value API. New code should prefer this API instead of any hardcoded return values. --- src/avr.c | 12 ++++++------ src/jtag3.c | 31 +++++++++++++++++++++---------- src/jtag3_private.h | 1 + src/libavrdude.h | 10 ++++++++++ src/main.c | 5 ++--- 5 files changed, 40 insertions(+), 19 deletions(-) diff --git a/src/avr.c b/src/avr.c index d6e78bb5..a8945d86 100644 --- a/src/avr.c +++ b/src/avr.c @@ -439,16 +439,16 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, (vmem->tags[i] & TAG_ALLOCATED) != 0) { rc = pgm->read_byte(pgm, p, mem, i, mem->buf + i); - if (rc != 0) { + if (rc != LIBAVRDUDE_SUCCESS) { avrdude_message(MSG_INFO, "avr_read(): error reading address 0x%04lx\n", i); - if (rc == -1) { + if (rc == LIBAVRDUDE_GENERAL_FAILURE) { avrdude_message(MSG_INFO, " read operation not supported for memory \"%s\"\n", memtype); - return -2; + return LIBAVRDUDE_NOTSUPPORTED; } avrdude_message(MSG_INFO, " read operation failed for memory \"%s\"\n", memtype); - return rc; + return LIBAVRDUDE_SOFTFAIL; } } report_progress(i, mem->size, NULL); @@ -1035,14 +1035,14 @@ int avr_signature(PROGRAMMER * pgm, AVRPART * p) report_progress (0,1,"Reading"); rc = avr_read(pgm, p, "signature", 0); - if (rc < 0) { + if (rc < LIBAVRDUDE_SUCCESS) { avrdude_message(MSG_INFO, "%s: error reading signature data for part \"%s\", rc=%d\n", progname, p->desc, rc); return rc; } report_progress (1,1,NULL); - return 0; + return LIBAVRDUDE_SUCCESS; } static uint8_t get_fuse_bitmask(AVRMEM * m) { diff --git a/src/jtag3.c b/src/jtag3.c index 6d358dfa..23df86ff 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -313,6 +313,16 @@ static void jtag3_prmsg(PROGRAMMER * pgm, unsigned char * data, size_t len) } } +static int jtag3_errcode(int status) +{ + if (status >= LIBAVRDUDE_SUCCESS) + return status; + if (status == RSP3_FAIL_OCD_LOCKED || + status == RSP3_FAIL_CRC_FAILURE) + return LIBAVRDUDE_SOFTFAIL; + return LIBAVRDUDE_GENERAL_FAILURE; +} + static void jtag3_prevent(PROGRAMMER * pgm, unsigned char * data, size_t len) { int i; @@ -850,7 +860,7 @@ int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) { putc('\n', stderr); avrdude_message(MSG_NOTICE2, "%s: %s command: timeout/error communicating with programmer (status %d)\n", progname, descr, status); - return -1; + return LIBAVRDUDE_GENERAL_FAILURE; } else if (verbose >= 3) { putc('\n', stderr); jtag3_prmsg(pgm, *resp, status); @@ -871,10 +881,11 @@ int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) { status = (*resp)[3]; free(*resp); resp = 0; - return -status; + + return jtag3_errcode(status); } - return status; + return LIBAVRDUDE_SUCCESS; } @@ -987,10 +998,10 @@ static int jtag3_program_enable(PROGRAMMER * pgm) free(resp); PDATA(pgm)->prog_enabled = 1; - return 0; + return LIBAVRDUDE_SUCCESS; } - return status; + return jtag3_errcode(status); } static int jtag3_program_disable(PROGRAMMER * pgm) @@ -1921,7 +1932,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, if (!(pgm->flag & PGM_FL_IS_DW)) if ((status = jtag3_program_enable(pgm)) < 0) - return status; + return jtag3_errcode(status); cmd[0] = SCOPE_AVR; cmd[1] = CMD3_READ_MEMORY; @@ -2007,7 +2018,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, if (addr == 0) { if ((status = jtag3_command(pgm, cmd, 12, &resp, "read memory")) < 0) - return status; + return jtag3_errcode(status); signature_cache[0] = resp[4]; signature_cache[1] = resp[5]; @@ -2057,7 +2068,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } if ((status = jtag3_command(pgm, cmd, 12, &resp, "read memory")) < 0) - return status; + return jtag3_errcode(status); if (resp[1] != RSP3_DATA || status < (pagesize? pagesize: 1) + 4) { @@ -2185,7 +2196,7 @@ static int jtag3_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, cmd[13] = data; if ((status = jtag3_command(pgm, cmd, 14, &resp, "write memory")) < 0) - return status; + return jtag3_errcode(status); free(resp); @@ -2316,7 +2327,7 @@ int jtag3_read_sib(PROGRAMMER * pgm, AVRPART * p, char * sib) u32_to_b4(cmd + 8, AVR_SIBLEN); if ((status = jtag3_command(pgm, cmd, 12, &resp, "read SIB")) < 0) - return status; + return jtag3_errcode(status); memcpy(sib, resp+3, AVR_SIBLEN); sib[AVR_SIBLEN] = 0; // Zero terminate string diff --git a/src/jtag3_private.h b/src/jtag3_private.h index a3e7fb08..6385aa4c 100644 --- a/src/jtag3_private.h +++ b/src/jtag3_private.h @@ -145,6 +145,7 @@ # define RSP3_FAIL_UNSUPP_MEMORY 0x34 /* unsupported memory type */ # define RSP3_FAIL_WRONG_LENGTH 0x35 /* wrong lenth for mem access */ # define RSP3_FAIL_OCD_LOCKED 0x44 /* device is locked */ +# define RSP3_FAIL_CRC_FAILURE 0x47 /* CRC failure in device */ # define RSP3_FAIL_NOT_UNDERSTOOD 0x91 /* ICE events */ diff --git a/src/libavrdude.h b/src/libavrdude.h index ddb72b48..46789f4f 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -27,6 +27,16 @@ #include typedef uint32_t pinmask_t; +/* + * Values returned by library functions. + * Some library functions also return a count, i.e. a positive + * number greater than 0. + */ +#define LIBAVRDUDE_SUCCESS 0 +#define LIBAVRDUDE_GENERAL_FAILURE (-1) +#define LIBAVRDUDE_NOTSUPPORTED (-2) // operation not supported +#define LIBAVRDUDE_SOFTFAIL (-3) // returned by avr_signature() if caller + // might proceed with chip erase /* formerly lists.h */ diff --git a/src/main.c b/src/main.c index 253c6e51..5b0a6e38 100644 --- a/src/main.c +++ b/src/main.c @@ -1116,9 +1116,8 @@ int main(int argc, char * argv []) usleep(waittime); if (init_ok) { rc = avr_signature(pgm, p); - if (rc != 0) { - // -68 == -(0x44) == -(RSP3_FAIL_OCD_LOCKED) - if ((rc == -68) && (p->flags & AVRPART_HAS_UPDI) && (attempt < 1)) { + if (rc != LIBAVRDUDE_SUCCESS) { + if ((rc == LIBAVRDUDE_SOFTFAIL) && (p->flags & AVRPART_HAS_UPDI) && (attempt < 1)) { attempt++; if (pgm->read_sib) { // Read SIB and compare FamilyID From f22b81c00e81604596cab1ab57c89b526c9d92bc Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Wed, 22 Jun 2022 23:33:53 +0200 Subject: [PATCH 065/511] Fix a number of logic errors in the previous commits RSP3_FAIL_CRC_FAILURE is 0x43 rather than 0x47. jtag3_errcode() must only be applied to a reason code, not to any general status code. --- src/jtag3.c | 32 +++++++++++++++----------------- src/jtag3_private.h | 2 +- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/jtag3.c b/src/jtag3.c index 23df86ff..4c159ee8 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -313,12 +313,10 @@ static void jtag3_prmsg(PROGRAMMER * pgm, unsigned char * data, size_t len) } } -static int jtag3_errcode(int status) +static int jtag3_errcode(int reason) { - if (status >= LIBAVRDUDE_SUCCESS) - return status; - if (status == RSP3_FAIL_OCD_LOCKED || - status == RSP3_FAIL_CRC_FAILURE) + if (reason == RSP3_FAIL_OCD_LOCKED || + reason == RSP3_FAIL_CRC_FAILURE) return LIBAVRDUDE_SOFTFAIL; return LIBAVRDUDE_GENERAL_FAILURE; } @@ -844,7 +842,7 @@ int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) { } } - int jtag3_command(PROGRAMMER *pgm, unsigned char *cmd, unsigned int cmdlen, +int jtag3_command(PROGRAMMER *pgm, unsigned char *cmd, unsigned int cmdlen, unsigned char **resp, const char *descr) { int status; @@ -868,9 +866,10 @@ int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) { avrdude_message(MSG_NOTICE2, "0x%02x (%d bytes msg)\n", (*resp)[1], status); } - c = (*resp)[1]; - if ((c & RSP3_STATUS_MASK) != RSP3_OK) { - if ((c == RSP3_FAILED) && ((*resp)[3] == RSP3_FAIL_OCD_LOCKED)) { + c = (*resp)[1] & RSP3_STATUS_MASK; + if (c != RSP3_OK) { + if ((c == RSP3_FAILED) && ((*resp)[3] == RSP3_FAIL_OCD_LOCKED || + (*resp)[3] == RSP3_FAIL_CRC_FAILURE)) { avrdude_message(MSG_INFO, "%s: Device is locked! Chip erase required to unlock.\n", progname); @@ -881,11 +880,10 @@ int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) { status = (*resp)[3]; free(*resp); resp = 0; - return jtag3_errcode(status); } - return LIBAVRDUDE_SUCCESS; + return status; } @@ -1001,7 +999,7 @@ static int jtag3_program_enable(PROGRAMMER * pgm) return LIBAVRDUDE_SUCCESS; } - return jtag3_errcode(status); + return status; } static int jtag3_program_disable(PROGRAMMER * pgm) @@ -1932,7 +1930,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, if (!(pgm->flag & PGM_FL_IS_DW)) if ((status = jtag3_program_enable(pgm)) < 0) - return jtag3_errcode(status); + return status; cmd[0] = SCOPE_AVR; cmd[1] = CMD3_READ_MEMORY; @@ -2018,7 +2016,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, if (addr == 0) { if ((status = jtag3_command(pgm, cmd, 12, &resp, "read memory")) < 0) - return jtag3_errcode(status); + return status; signature_cache[0] = resp[4]; signature_cache[1] = resp[5]; @@ -2068,7 +2066,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } if ((status = jtag3_command(pgm, cmd, 12, &resp, "read memory")) < 0) - return jtag3_errcode(status); + return status; if (resp[1] != RSP3_DATA || status < (pagesize? pagesize: 1) + 4) { @@ -2196,7 +2194,7 @@ static int jtag3_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, cmd[13] = data; if ((status = jtag3_command(pgm, cmd, 14, &resp, "write memory")) < 0) - return jtag3_errcode(status); + return status; free(resp); @@ -2327,7 +2325,7 @@ int jtag3_read_sib(PROGRAMMER * pgm, AVRPART * p, char * sib) u32_to_b4(cmd + 8, AVR_SIBLEN); if ((status = jtag3_command(pgm, cmd, 12, &resp, "read SIB")) < 0) - return jtag3_errcode(status); + return status; memcpy(sib, resp+3, AVR_SIBLEN); sib[AVR_SIBLEN] = 0; // Zero terminate string diff --git a/src/jtag3_private.h b/src/jtag3_private.h index 6385aa4c..7d0cbb74 100644 --- a/src/jtag3_private.h +++ b/src/jtag3_private.h @@ -144,8 +144,8 @@ # define RSP3_FAIL_WRONG_MODE 0x32 /* progmode vs. non-prog */ # define RSP3_FAIL_UNSUPP_MEMORY 0x34 /* unsupported memory type */ # define RSP3_FAIL_WRONG_LENGTH 0x35 /* wrong lenth for mem access */ +# define RSP3_FAIL_CRC_FAILURE 0x43 /* CRC failure in device */ # define RSP3_FAIL_OCD_LOCKED 0x44 /* device is locked */ -# define RSP3_FAIL_CRC_FAILURE 0x47 /* CRC failure in device */ # define RSP3_FAIL_NOT_UNDERSTOOD 0x91 /* ICE events */ From d2bb964fc74e7703a25a2256d0bf6cb0992eb4f6 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sat, 25 Jun 2022 11:39:16 +0200 Subject: [PATCH 066/511] Attempt to fix EEPROM write issue #1009 --- src/jtag3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jtag3.c b/src/jtag3.c index 4c159ee8..6a4004f3 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1770,7 +1770,7 @@ static int jtag3_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, free(cmd); return n_bytes; } - cmd[3] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_EEPROM_XMEGA : MTYPE_EEPROM_PAGE; + cmd[3] = ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) ? MTYPE_EEPROM_XMEGA : MTYPE_EEPROM_PAGE; PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L; } else if (strcmp(m->desc, "usersig") == 0 || strcmp(m->desc, "userrow") == 0) { From bdab12d8fbdf0bc674c81edac5e34b1b9d3f7c05 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Tue, 28 Jun 2022 22:53:24 +0200 Subject: [PATCH 067/511] PR 996 and 1013 done --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index da4e42d0..d5ce1df4 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,8 @@ Changes since version 7.0: to < 80 characters #1000 - Dragon JTAG fix #979 - adding support for all Linux baud rates v.2 #993 + - Replace internal knowledge in jtag3.c by a public API #996 + - JTAG3 UPDI EEPROM fix #1013 * Internals: From 2827c2695ee938735d10ea2d34c8ad69642df14b Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 28 Jun 2022 22:46:06 +0100 Subject: [PATCH 068/511] Update NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index d5ce1df4..e78362b3 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ Changes since version 7.0: - adding support for all Linux baud rates v.2 #993 - Replace internal knowledge in jtag3.c by a public API #996 - JTAG3 UPDI EEPROM fix #1013 + - Treat x bits in .conf SPI commands as 0 #943 * Internals: From 237cb6321116ab30f02984148758a9db633ce07e Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 4 Jul 2022 12:25:50 +0100 Subject: [PATCH 069/511] Steamline avrftdi support for ATmega2560 et al --- src/avrftdi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/avrftdi.c b/src/avrftdi.c index c6d2f86e..54490dc0 100644 --- a/src/avrftdi.c +++ b/src/avrftdi.c @@ -917,6 +917,10 @@ static int avrftdi_chip_erase(PROGRAMMER * pgm, AVRPART * p) static int avrftdi_lext(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, unsigned int address) { + /* nothing to do if load extended address command unavailable */ + if(m->op[AVR_OP_LOAD_EXT_ADDR] == NULL) + return 0; + avrftdi_t *pdata = to_pdata(pgm); unsigned char buf[] = { 0x00, 0x00, 0x00, 0x00 }; @@ -1019,7 +1023,7 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, page_size = m->page_size; /* on large-flash devices > 128k issue extended address command when needed */ - if(m->op[AVR_OP_LOAD_EXT_ADDR] && avrftdi_lext(pgm, p, m, addr/2) < 0) + if(avrftdi_lext(pgm, p, m, addr/2) < 0) return -1; /* prepare the command stream for the whole page */ @@ -1102,7 +1106,6 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, { OPCODE * readop; int byte, word; - unsigned int address = addr/2; unsigned int buf_size = 4 * len + 4; unsigned char* o_buf = alloca(buf_size); @@ -1122,7 +1125,7 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return -1; } - if(m->op[AVR_OP_LOAD_EXT_ADDR] && avrftdi_lext(pgm, p, m, address) < 0) + if(avrftdi_lext(pgm, p, m, addr/2) < 0) return -1; /* word addressing! */ From a721e485cb873c1ef38bbe756c85cc012d412327 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 4 Jul 2022 23:04:36 +0100 Subject: [PATCH 070/511] Refactor paged read/write routines in ft245r.c --- src/ft245r.c | 326 +++++++++++++++++++++++---------------------------- 1 file changed, 149 insertions(+), 177 deletions(-) diff --git a/src/ft245r.c b/src/ft245r.c index d5af4ca9..4525cab1 100644 --- a/src/ft245r.c +++ b/src/ft245r.c @@ -107,10 +107,10 @@ void ft245r_initpgm(PROGRAMMER * pgm) { #else -#define FT245R_CYCLES 2 -#define FT245R_FRAGMENT_SIZE 512 -#define REQ_OUTSTANDINGS 10 -//#define USE_INLINE_WRITE_PAGE +#define FT245R_CYCLES 2 +#define FT245R_CMD_SIZE (4 * 8*FT245R_CYCLES) +#define FT245R_FRAGMENT_SIZE (8 * FT245R_CMD_SIZE) +#define REQ_OUTSTANDINGS 10 #define FT245R_DEBUG 0 /* @@ -992,40 +992,18 @@ static void ft245r_display(PROGRAMMER * pgm, const char * p) { pgm_display_generic_mask(pgm, p, SHOW_ALL_PINS); } -static int ft245r_paged_write_gen(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, - unsigned int page_size, unsigned int addr, - unsigned int n_bytes) { - unsigned long i, pa; - int rc; - for (i=0; ibuf[addr]); - if (rc != 0) { +static int ft245r_paged_write_gen(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, + unsigned int page_size, unsigned int addr, unsigned int n_bytes) { + + for(int i=0; i < (int) n_bytes; i++, addr++) + if(avr_write_byte_default(pgm, p, m, addr, m->buf[addr]) != 0) return -2; - } - if (m->paged) { - // Can this piece of code ever be activated?? Do AVRs exist that - // have paged non-flash memories? -- REW - // XXX Untested code below. - /* - * check to see if it is time to flush the page with a page - * write - */ - - if (((addr % m->page_size) == m->page_size-1) || (i == n_bytes-1)) { - pa = addr - (addr % m->page_size); - - rc = avr_write_page(pgm, p, m, pa); - if (rc != 0) { - return -2; - } - } - } - } - return i; + return n_bytes; } + static struct ft245r_request { int addr; int bytes; @@ -1081,178 +1059,172 @@ static int do_request(PROGRAMMER * pgm, AVRMEM *m) { return 1; } -static int ft245r_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, - int page_size, int addr, int n_bytes) { - unsigned int i,j; - int addr_save,buf_pos,do_page_write,req_count; - unsigned char buf[FT245R_FRAGMENT_SIZE+1+128]; - req_count = 0; - for (i=0; i> 9) & 0xff ); - buf_pos += set_data(pgm, buf+buf_pos, (addr >> 1) & 0xff ); - buf_pos += set_data(pgm, buf+buf_pos, m->buf[addr]); - addr ++; - i++; - if ( (m->paged) && - (((i % m->page_size) == 0) || (i == n_bytes))) { - do_page_write = 1; - break; - } - } -#if defined(USE_INLINE_WRITE_PAGE) - if (do_page_write) { - int addr_wk = addr_save - (addr_save % m->page_size); - /* If this device has a "load extended address" command, issue it. */ - if (m->op[AVR_OP_LOAD_EXT_ADDR]) { - unsigned char cmd[4]; - OPCODE *lext = m->op[AVR_OP_LOAD_EXT_ADDR]; +static int ft245r_paged_write_flash(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, + unsigned int page_size, unsigned int addr, unsigned int n_bytes) { - memset(cmd, 0, 4); - avr_set_bits(lext, cmd); - avr_set_addr(lext, cmd, addr_wk/2); - buf_pos += set_data(pgm, buf+buf_pos, cmd[0]); - buf_pos += set_data(pgm, buf+buf_pos, cmd[1]); - buf_pos += set_data(pgm, buf+buf_pos, cmd[2]); - buf_pos += set_data(pgm, buf+buf_pos, cmd[3]); + int i, j, addr_save, buf_pos, req_count, do_page_write; + unsigned char buf[FT245R_FRAGMENT_SIZE+1]; + unsigned char cmd[4]; + + if(m->op[AVR_OP_LOADPAGE_LO] == NULL || m->op[AVR_OP_LOADPAGE_HI] == NULL) { + avrdude_message(MSG_INFO, "AVR_OP_LOADPAGE_HI/LO command not defined for %s\n", p->desc); + return -1; + } + + do_page_write = req_count = i = j = buf_pos = 0; + addr_save = addr; + while(i < (int) n_bytes) { + int spi = addr&1? AVR_OP_LOADPAGE_HI: AVR_OP_LOADPAGE_LO; + + // put the SPI loadpage command as FT245R_CMD_SIZE bytes into buffer + memset(cmd, 0, sizeof cmd); + avr_set_bits(m->op[spi], cmd); + avr_set_addr(m->op[spi], cmd, addr/2); + avr_set_input(m->op[spi], cmd, m->buf[addr]); + for(int k=0; kpaged && (i%m->page_size == 0 || i >= (int) n_bytes)) + do_page_write = 1; + + // page boundary, finished or buffer exhausted? queue up requests + if(do_page_write || i >= (int) n_bytes || j >= FT245R_FRAGMENT_SIZE/FT245R_CMD_SIZE) { + if(i >= n_bytes) { + ft245r_out = SET_BITS_0(ft245r_out, pgm, PIN_AVR_SCK, 0); // SCK down + buf[buf_pos++] = ft245r_out; + } else { + // stretch sequence to allow correct readout, see extract_data() + buf[buf_pos] = buf[buf_pos - 1]; + buf_pos++; } - buf_pos += set_data(pgm, buf+buf_pos, 0x4C); /* Issue Page Write */ - buf_pos += set_data(pgm, buf+buf_pos,(addr_wk >> 9) & 0xff); - buf_pos += set_data(pgm, buf+buf_pos,(addr_wk >> 1) & 0xff); - buf_pos += set_data(pgm, buf+buf_pos, 0); - } -#endif - if (i >= n_bytes) { - ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0); // sck down - buf[buf_pos++] = ft245r_out; - } - else { - /* stretch sequence to allow correct readout, see extract_data() */ - buf[buf_pos] = buf[buf_pos - 1]; - buf_pos++; - } - ft245r_send(pgm, buf, buf_pos); - put_request(addr_save, buf_pos, 0); - //ft245r_sync(pgm); -#if 0 - avrdude_message(MSG_INFO, "send addr 0x%04x bufsize %d [%02x %02x] page_write %d\n", - addr_save,buf_pos, - extract_data_out(pgm, buf , (0*4 + 3) ), - extract_data_out(pgm, buf , (1*4 + 3) ), - do_page_write); -#endif - req_count++; - if (req_count > REQ_OUTSTANDINGS) - do_request(pgm, m); - if (do_page_write) { -#if defined(USE_INLINE_WRITE_PAGE) - while (do_request(pgm, m)) - ; - ft245r_usleep(pgm, m->max_write_delay); -#else - int addr_wk = addr_save - (addr_save % m->page_size); - int rc; - while (do_request(pgm, m)) - ; - rc = avr_write_page(pgm, p, m, addr_wk); - if (rc != 0) { - return -2; + ft245r_send(pgm, buf, buf_pos); + put_request(addr_save, buf_pos, 0); + + if(++req_count > REQ_OUTSTANDINGS) + do_request(pgm, m); + + if(do_page_write) { + while(do_request(pgm, m)) + continue; + if(avr_write_page(pgm, p, m, addr_save - (addr_save % m->page_size)) != 0) + return -2; + do_page_write = req_count = 0; } -#endif - req_count = 0; + + // reset buffer variables + j = buf_pos = 0; + addr_save = addr; } } - while (do_request(pgm, m)) - ; - return i; + + while(do_request(pgm, m)) + continue; + + return n_bytes; } static int ft245r_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, - unsigned int page_size, unsigned int addr, unsigned int n_bytes) { - if (strcmp(m->desc, "flash") == 0) { + unsigned int page_size, unsigned int addr, unsigned int n_bytes) { + + if(!n_bytes) + return 0; + + if(strcmp(m->desc, "flash") == 0) return ft245r_paged_write_flash(pgm, p, m, page_size, addr, n_bytes); - } else if (strcmp(m->desc, "eeprom") == 0) { + + if(strcmp(m->desc, "eeprom") == 0) return ft245r_paged_write_gen(pgm, p, m, page_size, addr, n_bytes); - } else { - return -2; - } + + return -2; } -static int ft245r_paged_load_gen(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, - unsigned int page_size, unsigned int addr, - int n_bytes) { - unsigned char rbyte; - unsigned long i; - int rc; +static int ft245r_paged_load_gen(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, + unsigned int page_size, unsigned int addr, unsigned int n_bytes) { - for (i=0; ibuf[i+addr] = rbyte; + + m->buf[addr+i] = rbyte; } + return 0; } -static int ft245r_paged_load_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, - unsigned int page_size, unsigned int addr, - unsigned int n_bytes) { - unsigned long i,j,n; - int addr_save,buf_pos; - int req_count = 0; + +static int ft245r_paged_load_flash(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, + unsigned int page_size, unsigned int addr, unsigned int n_bytes) { + + int i, j, addr_save, buf_pos, req_count; unsigned char buf[FT245R_FRAGMENT_SIZE+1]; + unsigned char cmd[4]; - for (i=0; i= n_bytes) break; - buf_pos += set_data(pgm, buf+buf_pos, (addr & 1)?0x28:0x20 ); - buf_pos += set_data(pgm, buf+buf_pos, (addr >> 9) & 0xff ); - buf_pos += set_data(pgm, buf+buf_pos, (addr >> 1) & 0xff ); - buf_pos += set_data(pgm, buf+buf_pos, 0); - addr ++; - i++; - } - if (i >= n_bytes) { - ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0); // sck down - buf[buf_pos++] = ft245r_out; - } - else { - /* stretch sequence to allow correct readout, see extract_data() */ - buf[buf_pos] = buf[buf_pos - 1]; - buf_pos++; - } - n = j; - ft245r_send(pgm, buf, buf_pos); - put_request(addr_save, buf_pos, n); - req_count++; - if (req_count > REQ_OUTSTANDINGS) - do_request(pgm, m); - + if(m->op[AVR_OP_READ_LO] == NULL || m->op[AVR_OP_READ_HI] == NULL) { + avrdude_message(MSG_INFO, "AVR_OP_READ_HI/LO command not defined for %s\n", p->desc); + return -1; } - while (do_request(pgm, m)) - ; + + req_count = i = j = buf_pos = 0; + addr_save = addr; + while(i < (int) n_bytes) { + int spi = addr&1? AVR_OP_READ_HI: AVR_OP_READ_LO; + + // put the SPI read command as FT245R_CMD_SIZE bytes into buffer + memset(cmd, 0, sizeof cmd); + avr_set_bits(m->op[spi], cmd); + avr_set_addr(m->op[spi], cmd, addr/2); + for(int k=0; k= (int) n_bytes || j >= FT245R_FRAGMENT_SIZE/FT245R_CMD_SIZE) { + if(i >= (int) n_bytes) { + ft245r_out = SET_BITS_0(ft245r_out, pgm, PIN_AVR_SCK, 0); // SCK down + buf[buf_pos++] = ft245r_out; + } else { + // stretch sequence to allow correct readout, see extract_data() + buf[buf_pos] = buf[buf_pos - 1]; + buf_pos++; + } + ft245r_send(pgm, buf, buf_pos); + put_request(addr_save, buf_pos, j); + + if(++req_count > REQ_OUTSTANDINGS) + do_request(pgm, m); + + // reset buffer variables + j = buf_pos = 0; + addr_save = addr; + } + } + + while(do_request(pgm, m)) + continue; + return 0; } -static int ft245r_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, - unsigned int page_size, unsigned int addr, - unsigned int n_bytes) { - if (strcmp(m->desc, "flash") == 0) { +static int ft245r_paged_load(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, + unsigned int page_size, unsigned int addr, unsigned int n_bytes) { + + if(!n_bytes) + return 0; + + if(strcmp(m->desc, "flash") == 0) return ft245r_paged_load_flash(pgm, p, m, page_size, addr, n_bytes); - } else if (strcmp(m->desc, "eeprom") == 0) { + + if(strcmp(m->desc, "eeprom") == 0) return ft245r_paged_load_gen(pgm, p, m, page_size, addr, n_bytes); - } else { - return -2; - } + + return -2; } void ft245r_initpgm(PROGRAMMER * pgm) { From 7aad03cbcdd762b912f9ef920c2badd2463efabb Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 4 Jul 2022 23:11:32 +0100 Subject: [PATCH 071/511] Fix paged read for ATmega2560 et al for ft245r.c --- src/ft245r.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ft245r.c b/src/ft245r.c index 4525cab1..874167ac 100644 --- a/src/ft245r.c +++ b/src/ft245r.c @@ -1170,6 +1170,19 @@ static int ft245r_paged_load_flash(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, return -1; } + // always called with addr at page boundary, and n_bytes == m->page_size; + // hence, OK to prepend load extended address command (at most) once + if(m->op[AVR_OP_LOAD_EXT_ADDR]) { + memset(cmd, 0, sizeof cmd); + avr_set_bits(m->op[AVR_OP_LOAD_EXT_ADDR], cmd); + avr_set_addr(m->op[AVR_OP_LOAD_EXT_ADDR], cmd, addr/2); + + buf_pos = 0; + for(int k=0; k Date: Mon, 4 Jul 2022 23:54:02 +0100 Subject: [PATCH 072/511] Adapt whitespace to existing style in avrftdi.c --- src/avrftdi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/avrftdi.c b/src/avrftdi.c index 54490dc0..f0c07a6a 100644 --- a/src/avrftdi.c +++ b/src/avrftdi.c @@ -918,7 +918,7 @@ static int avrftdi_lext(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, unsigned int address) { /* nothing to do if load extended address command unavailable */ - if(m->op[AVR_OP_LOAD_EXT_ADDR] == NULL) + if(m->op[AVR_OP_LOAD_EXT_ADDR] == NULL) return 0; avrftdi_t *pdata = to_pdata(pgm); From 9742c7b97aa78bb0e96435f7c4ac39e627bbd2c4 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 5 Jul 2022 00:55:58 +0100 Subject: [PATCH 073/511] Add #474 and #976 to NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index e78362b3..78f59f95 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,8 @@ Changes since version 7.0: - Replace internal knowledge in jtag3.c by a public API #996 - JTAG3 UPDI EEPROM fix #1013 - Treat x bits in .conf SPI commands as 0 #943 + - Fix avrftdi support for ATmega2560 et al #474 + - Fix avrdude.conf timings for ATmega328PB and other parts #976 * Internals: From d3b22fa3c620c0f8dad856214b4a5cccd0c3baff Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 5 Jul 2022 00:57:40 +0100 Subject: [PATCH 074/511] Update debug message in avr.c with correct function name --- src/avr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/avr.c b/src/avr.c index a8945d86..7f267622 100644 --- a/src/avr.c +++ b/src/avr.c @@ -234,7 +234,7 @@ int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, if (readop == NULL) { #if DEBUG - avrdude_message(MSG_INFO, "avr_read_byte(): operation not supported on memory type \"%s\"\n", + avrdude_message(MSG_INFO, "avr_read_byte_default(): operation not supported on memory type \"%s\"\n", mem->desc); #endif return -1; From 64ee4858fd5e4a2ce65cf3c280274674c4320de5 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 5 Jul 2022 01:00:45 +0100 Subject: [PATCH 075/511] Update 2nd debug message in avr.c with correct function name --- src/avr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/avr.c b/src/avr.c index 7f267622..17f85f34 100644 --- a/src/avr.c +++ b/src/avr.c @@ -650,7 +650,7 @@ int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, if (writeop == NULL) { #if DEBUG - avrdude_message(MSG_INFO, "avr_write_byte(): write not supported for memory type \"%s\"\n", + avrdude_message(MSG_INFO, "avr_write_byte_default(): write not supported for memory type \"%s\"\n", mem->desc); #endif return -1; From 9e5ea25b9e2d57c67decdbd524be1d4706ed124e Mon Sep 17 00:00:00 2001 From: "Ruud, Jan Egil" Date: Thu, 30 Jun 2022 16:15:24 +0200 Subject: [PATCH 076/511] Add HVUPDI_SUPPORT list for programmers. --- src/avrdude.conf.in | 11 +++++++++++ src/config_gram.y | 30 ++++++++++++++++++++++++++++++ src/jtag3.c | 18 ++++++++++++------ src/lexer.l | 1 + src/libavrdude.h | 1 + 5 files changed, 55 insertions(+), 6 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 2e66c360..9d4f8dbd 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -40,6 +40,7 @@ # usbvendor = ; # USB Vendor Name # usbproduct = ; # USB Product Name # usbsn = ; # USB Serial Number +# hvupdi_support = , , ...; # UPDI HV Variants Support # # To invert a bit, use = ~ , the spaces are important. # For a pin list all pins must be inverted. @@ -630,6 +631,7 @@ programmer desc = "SerialUPDI"; type = "serialupdi"; connection_type = serial; + hvupdi_support = 1; ; programmer @@ -1177,6 +1179,7 @@ programmer type = "jtagice3_updi"; connection_type = usb; usbpid = 0x2110, 0x2140; + hvupdi_support = 1; ; programmer @@ -1209,6 +1212,7 @@ programmer type = "jtagice3_updi"; connection_type = usb; usbpid = 0x2111; + hvupdi_support = 1; ; programmer @@ -1233,6 +1237,7 @@ programmer type = "jtagice3_updi"; connection_type = usb; usbpid = 0x2145; + hvupdi_support = 1; ; programmer @@ -1257,6 +1262,7 @@ programmer type = "jtagice3_updi"; connection_type = usb; usbpid = 0x2141; + hvupdi_support = 1; ; programmer @@ -1297,6 +1303,7 @@ programmer type = "jtagice3_updi"; connection_type = usb; usbpid = 0x2144; + hvupdi_support = 0, 1; ; programmer @@ -1321,6 +1328,7 @@ programmer type = "jtagice3_updi"; connection_type = usb; usbpid = 0x2177, 0x2178, 0x2179; + hvupdi_support = 0, 1, 2; ; programmer @@ -1345,6 +1353,7 @@ programmer type = "jtagice3_updi"; connection_type = usb; usbpid = 0x217F, 0x2180, 0x2181; + hvupdi_support = 1; ; programmer @@ -1369,6 +1378,7 @@ programmer type = "jtagice3_updi"; connection_type = usb; usbpid = 0x2175; + hvupdi_support = 1; ; programmer @@ -1737,6 +1747,7 @@ programmer type = "jtagmkii_pdi"; connection_type = serial; baudrate = 115200; + hvupdi_support = 1; ; # diff --git a/src/config_gram.y b/src/config_gram.y index 126b9b54..5db2a475 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -81,6 +81,7 @@ static int pin_name; %token K_DEFAULT_SERIAL %token K_DESC %token K_FAMILY_ID +%token K_HVUPDI_SUPPORT %token K_HVUPDI_VARIANT %token K_DEVICECODE %token K_STK500_DEVCODE @@ -547,6 +548,7 @@ prog_parm_usb: free_token($3); } } + K_HVUPDI_SUPPORT TKN_EQUAL hvupdi_support_list ; usb_pid_list: @@ -577,6 +579,34 @@ usb_pid_list: } ; +hvupdi_support_list: + TKN_NUMBER { + { + /* overwrite pids, so clear the existing entries */ + ldestroy_cb(current_prog->hvupdi_support, free); + current_prog->hvupdi_support = lcreat(NULL, 0); + } + { + int *ip = malloc(sizeof(int)); + if (ip) { + *ip = $1->value.number; + ladd(current_prog->hvupdi_support, ip); + } + free_token($1); + } + } | + hvupdi_support_list TKN_COMMA TKN_NUMBER { + { + int *ip = malloc(sizeof(int)); + if (ip) { + *ip = $3->value.number; + ladd(current_prog->hvupdi_support, ip); + } + free_token($3); + } + } +; + pin_number_non_empty: TKN_NUMBER { if(0 != assign_pin(pin_name, $1, 0)) YYABORT; } | diff --git a/src/jtag3.c b/src/jtag3.c index 5a333991..efb9b702 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1253,14 +1253,20 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) } } - // Generate 12V UPDI pulse if user asks for it and hardware supports it + // Generate UPDI high-voltage pulse if user asks for it and hardware supports it + LNODEID hvupdi_support; if (p->flags & AVRPART_HAS_UPDI && PDATA(pgm)->use_hvupdi == true && - (p->hvupdi_variant == HV_UPDI_VARIANT_0 || - p->hvupdi_variant == HV_UPDI_VARIANT_2)) { - avrdude_message(MSG_NOTICE, "%s: Sending HV pulse to %s pin\n", - progname, p->hvupdi_variant == HV_UPDI_VARIANT_0 ? "UPDI" : "RESET"); - parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE; + p->hvupdi_variant != HV_UPDI_VARIANT_1) { + for (hvupdi_support = lfirst(pgm->hvupdi_support); hvupdi_support != NULL; hvupdi_support = lnext(hvupdi_support)) { + unsigned int sup = (unsigned int)(*(int *)(ldata(hvupdi_support))); + if(sup == p->hvupdi_variant) { + avrdude_message(MSG_NOTICE, "%s: Sending HV pulse to targets %s pin\n", + progname, p->hvupdi_variant == HV_UPDI_VARIANT_0 ? "UPDI" : "RESET"); + parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE; + break; + } + } if (jtag3_setparm(pgm, SCOPE_AVR, 3, PARM3_OPT_12V_UPDI_ENABLE, parm, 1) < 0) return -1; } diff --git a/src/lexer.l b/src/lexer.l index dd5c081a..1693886c 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -159,6 +159,7 @@ hventerstabdelay { yylval=NULL; return K_HVENTERSTABDELAY; } hvleavestabdelay { yylval=NULL; return K_HVLEAVESTABDELAY; } hvsp_controlstack { yylval=NULL; return K_HVSP_CONTROLSTACK; } hvspcmdexedelay { yylval=NULL; return K_HVSPCMDEXEDELAY; } +hvupdi_support { yylval=NULL; return K_HVUPDI_SUPPORT; } hvupdi_variant { yylval=NULL; return K_HVUPDI_VARIANT; } id { yylval=NULL; return K_ID; } idr { yylval=NULL; return K_IDR; } diff --git a/src/libavrdude.h b/src/libavrdude.h index c3e89a7e..4a7a66b0 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -719,6 +719,7 @@ typedef struct programmer_t { int lineno; /* config file line number */ void *cookie; /* for private use by the programmer */ char flag; /* for private use of the programmer */ + LISTID hvupdi_support; /* List of UPDI HV variants the tool supports. See HV_UPDI_VARIANT_ */ } PROGRAMMER; #ifdef __cplusplus From 91310e6f505c1e8eba9c739ee9b0d0a93c790b03 Mon Sep 17 00:00:00 2001 From: Jan Egil Ruud Date: Thu, 7 Jul 2022 12:23:05 +0200 Subject: [PATCH 077/511] Move hvupdi_support list to a new prog_parm_updi group, and initialize the list. --- src/avrdude.conf.in | 2 +- src/config_gram.y | 10 +++++++--- src/jtag3.c | 9 +++++++++ src/libavrdude.h | 2 +- src/pgm.c | 1 + 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 9d4f8dbd..6cb314da 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -40,7 +40,7 @@ # usbvendor = ; # USB Vendor Name # usbproduct = ; # USB Product Name # usbsn = ; # USB Serial Number -# hvupdi_support = , , ...; # UPDI HV Variants Support +# hvupdi_support = [, , ... ] ; # UPDI HV Variants Support # # To invert a bit, use = ~ , the spaces are important. # For a pin list all pins must be inverted. diff --git a/src/config_gram.y b/src/config_gram.y index 5db2a475..b0a8e36e 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -477,7 +477,8 @@ prog_parm : current_prog->baudrate = $3->value.number; free_token($3); } - } + } | + prog_parm_updi ; prog_parm_type: @@ -548,7 +549,6 @@ prog_parm_usb: free_token($3); } } - K_HVUPDI_SUPPORT TKN_EQUAL hvupdi_support_list ; usb_pid_list: @@ -579,10 +579,14 @@ usb_pid_list: } ; +prog_parm_updi: + K_HVUPDI_SUPPORT TKN_EQUAL hvupdi_support_list +; + hvupdi_support_list: TKN_NUMBER { { - /* overwrite pids, so clear the existing entries */ + /* overwrite list entries, so clear the existing entries */ ldestroy_cb(current_prog->hvupdi_support, free); current_prog->hvupdi_support = lcreat(NULL, 0); } diff --git a/src/jtag3.c b/src/jtag3.c index efb9b702..1c003a82 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1649,6 +1649,15 @@ static int jtag3_open_updi(PROGRAMMER * pgm, char * port) { avrdude_message(MSG_NOTICE2, "%s: jtag3_open_updi()\n", progname); + LNODEID ln; + unsigned int hv_sup; + avrdude_message(MSG_NOTICE2, "%s: HV UPDI support:", progname); + for (ln = lfirst(pgm->hvupdi_support); ln; ln = lnext(ln)) { + hv_sup = (unsigned int)(*(int *)ldata(ln)); + avrdude_message(MSG_NOTICE2, " %d", hv_sup); + } + avrdude_message(MSG_NOTICE2, "\n", progname); + if (jtag3_open_common(pgm, port) < 0) return -1; diff --git a/src/libavrdude.h b/src/libavrdude.h index 4a7a66b0..1259977f 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -206,7 +206,7 @@ typedef struct avrpart { char desc[AVR_DESCLEN]; /* long part name */ char id[AVR_IDLEN]; /* short part name */ char family_id[AVR_FAMILYIDLEN+1]; /* family id in the SIB (avr8x) */ - int hvupdi_variant; /* 12V pulse on UPDI pin, no pin or RESET pin */ + int hvupdi_variant; /* HV pulse on UPDI pin, no pin or RESET pin */ int stk500_devcode; /* stk500 device code */ int avr910_devcode; /* avr910 device code */ int chip_erase_delay; /* microseconds */ diff --git a/src/pgm.c b/src/pgm.c index 851ac5a8..4580cbbd 100644 --- a/src/pgm.c +++ b/src/pgm.c @@ -83,6 +83,7 @@ PROGRAMMER * pgm_new(void) pgm->lineno = 0; pgm->baudrate = 0; pgm->initpgm = NULL; + pgm->hvupdi_support = lcreat(NULL, 0); for (i=0; ipinno[i] = 0; From 9e2cea3adae89c05f41d7fda76a6c7316bd4dea1 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 7 Jul 2022 18:32:19 +0100 Subject: [PATCH 078/511] Implement developer options -p */[*cdosSrwt] for part descriptions --- src/avrpart.c | 32 +- src/developer_opts.c | 791 +++++++++++++++++++++++++---------- src/developer_opts_private.h | 104 ++++- src/libavrdude.h | 8 +- src/main.c | 6 +- 5 files changed, 690 insertions(+), 251 deletions(-) diff --git a/src/avrpart.c b/src/avrpart.c index dc6def44..7274050a 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -379,13 +379,16 @@ void avr_free_memalias(AVRMEM_ALIAS * m) free(m); } -AVRMEM_ALIAS * avr_locate_memalias(AVRPART * p, char * desc) +AVRMEM_ALIAS * avr_locate_memalias(AVRPART * p, const char * desc) { AVRMEM_ALIAS * m, * match; LNODEID ln; int matches; int l; + if(!p || !desc || !p->mem_alias) + return NULL; + l = strlen(desc); matches = 0; match = NULL; @@ -403,13 +406,16 @@ AVRMEM_ALIAS * avr_locate_memalias(AVRPART * p, char * desc) return NULL; } -AVRMEM * avr_locate_mem_noalias(AVRPART * p, char * desc) +AVRMEM * avr_locate_mem_noalias(AVRPART * p, const char * desc) { AVRMEM * m, * match; LNODEID ln; int matches; int l; + if(!p || !desc || !p->mem) + return NULL; + l = strlen(desc); matches = 0; match = NULL; @@ -428,7 +434,7 @@ AVRMEM * avr_locate_mem_noalias(AVRPART * p, char * desc) } -AVRMEM * avr_locate_mem(AVRPART * p, char * desc) +AVRMEM * avr_locate_mem(AVRPART * p, const char * desc) { AVRMEM * m, * match; AVRMEM_ALIAS * alias; @@ -436,14 +442,19 @@ AVRMEM * avr_locate_mem(AVRPART * p, char * desc) int matches; int l; + if(!p || !desc) + return NULL; + l = strlen(desc); matches = 0; match = NULL; - for (ln=lfirst(p->mem); ln; ln=lnext(ln)) { - m = ldata(ln); - if (strncmp(desc, m->desc, l) == 0) { - match = m; - matches++; + if(p->mem) { + for (ln=lfirst(p->mem); ln; ln=lnext(ln)) { + m = ldata(ln); + if (strncmp(desc, m->desc, l) == 0) { + match = m; + matches++; + } } } @@ -640,12 +651,15 @@ int i; free(d); } -AVRPART * locate_part(LISTID parts, char * partdesc) +AVRPART * locate_part(LISTID parts, const char * partdesc) { LNODEID ln1; AVRPART * p = NULL; int found; + if(!parts || !partdesc) + return NULL; + found = 0; for (ln1=lfirst(parts); ln1 && !found; ln1=lnext(ln1)) { diff --git a/src/developer_opts.c b/src/developer_opts.c index 36dd6461..76ab3160 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -44,6 +44,7 @@ #include #include #include +#include #include "avrdude.h" #include "libavrdude.h" @@ -68,6 +69,19 @@ static char cmdbitchar(CMDBIT cb) { } } +static char *cmdbitstr(CMDBIT cb) { + char space[10]; + + *space = cmdbitchar(cb); + if(*space == 'a') + sprintf(space+1, "%d", cb.bitno); + else + space[1] = 0; + + return strdup(space); +} + + static const char *opcodename(int what) { switch(what) { @@ -101,9 +115,12 @@ static const char *opcodename(int what) { } -char *opcode2str(OPCODE *op, int detailed) { +static char *opcode2str(OPCODE *op, int detailed) { char cb, space[1024], *sp = space; + if(!op) + return strdup("NULL"); + if(detailed) *sp++ = '"'; for(int i=31; i >= 0; i--) { @@ -126,6 +143,42 @@ char *opcode2str(OPCODE *op, int detailed) { return strdup(space); } + +// return 0 if op code would encode (essentially) the same SPI command +static int opcodecmp(OPCODE *op1, OPCODE *op2) { + char *opstr1, *opstr2, *p; + int cmp; + + if(!op1 && !op2) + return 0; + if(!op1 || !op2) + return op1? -1: 1; + + opstr1 = opcode2str(op1, 1); + opstr2 = opcode2str(op2, 1); + if(!opstr1 || !opstr2) { + dev_info("%s: out of memory\n", progname); + exit(1); + } + + // don't care x and 0 are functionally equivalent + for(p=opstr1; *p; p++) + if(*p == 'x') + *p = '0'; + for(p=opstr2; *p; p++) + if(*p == 'x') + *p = '0'; + + cmp = strcmp(opstr1, opstr2); + free(opstr1); + free(opstr2); + + return cmp; +} + + + + static void printopcode(AVRPART *p, const char *d, OPCODE *op, int what) { unsigned char cmd[4]; int i; @@ -134,11 +187,11 @@ static void printopcode(AVRPART *p, const char *d, OPCODE *op, int what) { memset(cmd, 0, sizeof cmd); avr_set_bits(op, cmd); - dev_info(".op %s %s %s 0x%02x%02x%02x%02x ", p->desc, d, opcodename(what), cmd[0], cmd[1], cmd[2], cmd[3]); + dev_info(".op\t%s\t%s\t%s\t0x%02x%02x%02x%02x\t", p->desc, d, opcodename(what), cmd[0], cmd[1], cmd[2], cmd[3]); for(i=31; i >= 0; i--) { dev_info("%c", cmdbitchar(op->bit[i])); if(i%8 == 0) - dev_info("%c", i? ' ': '\n'); + dev_info("%c", i? '\t': '\n'); } } } @@ -175,6 +228,7 @@ static char *parttype(AVRPART *p) { case AVRPART_HAS_UPDI: strcpy(type, "UPDI"); break; default: strcpy(type, "UNKNOWN"); break; } + if((p->flags & AVRPART_SERIALOK) == 0) strcat(type, "|NOTSERIAL"); if((p->flags & AVRPART_PARALLELOK) == 0) @@ -210,248 +264,556 @@ static void checkaddr(int memsize, int pagesize, int what, OPCODE *op, AVRPART * for(i=0; i<16; i++) { // ISP programming only deals with 16-bit addresses (words for flash, bytes for eeprom) if(i < lo || i > hi) { if(op->bit[i+8].type != AVR_CMDBIT_IGNORE && !(op->bit[i+8].type == AVR_CMDBIT_VALUE && op->bit[i+8].value == 0)) { - dev_info(".cmdbit%d %s %s-%s outside addressable space should be x or 0, but is %c", i+8, p->desc, m->desc, whatstr, cmdbitchar(op->bit[i+8])); - if(op->bit[i+8].type == AVR_CMDBIT_ADDRESS) - dev_info("%d", op->bit[i+8].bitno); - dev_info("\n"); + char *cbs = cmdbitstr(op->bit[i+8]); + dev_info(".cmderr\t%s\t%s-%s\tbit %d outside addressable space should be x or 0 but is %s\n", p->desc, m->desc, whatstr, i+8, cbs? cbs: "NULL"); + if(cbs) + free(cbs); } } else { if(op->bit[i+8].type != AVR_CMDBIT_ADDRESS) - dev_info(".cmdbit%d %s %s-%s is %c but should be a\n", i+8, p->desc, m->desc, whatstr, cmdbitchar(op->bit[i+8])); + dev_info(".cmderr\t%s\t%s-%s\tbit %d is %c but should be a\n", p->desc, m->desc, whatstr, i+8, cmdbitchar(op->bit[i+8])); else if(op->bit[i+8].bitno != i) - dev_info(".cmdbit%d %s %s-%s inconsistent: a%d specified as a%d\n", i+8, p->desc, m->desc, whatstr, i, op->bit[i+8].bitno); + dev_info(".cmderr\t%s\t%s-%s\tbit %d inconsistent: a%d specified as a%d\n", p->desc, m->desc, whatstr, i+8, i, op->bit[i+8].bitno); } } for(i=0; i<32; i++) // command bits 8..23 should not contain address bits if((i<8 || i>23) && op->bit[i].type == AVR_CMDBIT_ADDRESS) - dev_info(".cmdbit%d %s %s-%s contains a%d which it shouldn't\n", i, p->desc, m->desc, whatstr, op->bit[i].bitno); + dev_info(".cmderr\t%s\t%s-%s\tbit %d contains a%d which it shouldn't\n", p->desc, m->desc, whatstr, i, op->bit[i].bitno); } -void dev_stack_out(bool dot, AVRPART *p, char *name, unsigned char *stack, int ns) { - if(dot) - dev_info("%s\t%s\t", p->desc, name); +static char *dev_sprintf(const char *fmt, ...) { + int size = 0; + char *p = NULL; + va_list ap; + + // compute size + va_start(ap, fmt); + size = vsnprintf(p, size, fmt, ap); + va_end(ap); + + if(size < 0) + return NULL; + + size++; // for temrinating '\0' + if(!(p = malloc(size))) + return NULL; + + va_start(ap, fmt); + size = vsnprintf(p, size, fmt, ap); + va_end(ap); + + if(size < 0) { + free(p); + return NULL; + } + + return p; +} + + +static int dev_nprinted; + +int dev_message(int msglvl, const char *fmt, ...) { + va_list ap; + int rc = 0; + + if(verbose >= msglvl) { + va_start(ap, fmt); + rc = vfprintf(stderr, fmt, ap); + va_end(ap); + if(rc > 0) + dev_nprinted += rc; + } + + return rc; +} + + + +static int dev_part_strct_entry(bool tsv, char *col0, char *col1, char *col2, const char *name, char *cont) { + const char *n = name? name: "name_error"; + const char *c = cont? cont: "cont_error"; + + if(tsv) { // tab separated values + if(col0) { + dev_info("%s\t", col0); + if(col1) { + dev_info("%s\t", col1); + if(col2) { + dev_info("%s\t", col2); + } + } + } + dev_info("%s\t%s\n", n, c); + } else { // grammar conform + int indent = col2 && strcmp(col2, "part"); + + printf("%*s%-*s = %s;\n", indent? 8: 4, "", indent? 15: 19, n, c); + } + + if(cont) + free(cont); + + return 1; +} + + +static const char *dev_controlstack_name(AVRPART *p) { + return + p->ctl_stack_type == CTL_STACK_PP? "pp_controlstack": + p->ctl_stack_type == CTL_STACK_HVSP? "hvsp_controlstack": + p->ctl_stack_type == CTL_STACK_NONE? "NONE": + "unknown_controlstack"; +} + + +static void dev_stack_out(bool tsv, AVRPART *p, const char *name, unsigned char *stack, int ns) { + if(!strcmp(name, "NONE")) { + name = "pp_controlstack"; + ns = 0; + } + + if(tsv) + dev_info(".pt\t%s\t%s\t", p->desc, name); else - dev_info(" %-19s = ", name); - for(int i=0; i 8 && i%8 == 0? "\n ": "", stack[i], i+1base = *m; + + // zap all bytes beyond terminating nul of desc array + len = strlen(m->desc)+1; + if(len < sizeof m->desc) + memset(d->base.desc + len, 0, sizeof m->desc - len); + + // zap address values + d->base.buf = NULL; + d->base.tags = NULL; + for(int i=0; ibase.op[i] = NULL; + + + // copy over the SPI operations themselves + memset(d->base.op, 0, sizeof d->base.op); + memset(d->ops, 0, sizeof d->ops); + for(int i=0; iops/sizeof *d->ops; i++) + if(m->op[i]) + d->ops[i] = *m->op[i]; + + return 0; +} + +static int memorycmp(AVRMEM *m1, AVRMEM *m2) { + AVRMEMdeep dm1, dm2; + + if(!m1 && !m2) + return 0; + + if(!m1 || !m2) + return m1? -1: 1; + + avrmem_deep_copy(&dm1, m1); + avrmem_deep_copy(&dm2, m2); + + return memcmp(&dm1, &dm2, sizeof dm1); +} + + +typedef struct { + AVRPART base; + OPCODE ops[AVR_OP_MAX]; + AVRMEMdeep mems[40]; +} AVRPARTdeep; + +static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { + AVRMEM *m; + int len, di; + + memset(d, 0, sizeof *d); + + d->base = *p; + + // remove location info + memset(d->base.config_file, 0, sizeof d->base.config_file); + d->base.lineno = 0; + + // zap all bytes beyond terminating nul of desc, id and family_id array + len = strlen(p->desc); + if(len < sizeof p->desc) + memset(d->base.desc + len, 0, sizeof p->desc - len); + + len = strlen(p->family_id); + if(len < sizeof p->family_id) + memset(d->base.family_id + len, 0, sizeof p->family_id - len); + + len = strlen(p->id); + if(len < sizeof p->id) + memset(d->base.id + len, 0, sizeof p->id - len); + + // zap address values + d->base.mem = NULL; + d->base.mem_alias = NULL; + for(int i=0; ibase.op[i] = NULL; + + // copy over the SPI operations + memset(d->base.op, 0, sizeof d->base.op); + memset(d->ops, 0, sizeof d->ops); + for(int i=0; iop[i]) + d->ops[i] = *p->op[i]; + + // fill in all memories we got in defined order + di = 0; + for(int mi=0; mi < sizeof mem_order/sizeof *mem_order && mem_order[mi]; mi++) { + m = p->mem? avr_locate_mem(p, mem_order[mi]): NULL; + if(m) { + if(di >= sizeof d->mems/sizeof *d->mems) { + avrdude_message(MSG_INFO, "%s: ran out of mems[] space, increase size in AVRMEMdeep of developer_opts.c and recompile\n", progname); + exit(1); + } + avrmem_deep_copy(d->mems+di, m); + di++; + } + } + + return di; +} + +static char txtchar(unsigned char in) { + in &= 0x7f; + return in == ' '? '_': in > ' ' && in < 0x7f? in: '.'; +} + + +static void dev_raw_dump(unsigned char *p, int nbytes, const char *name, const char *sub, int idx) { + unsigned char *end = p+nbytes; + int n = ((end - p) + 15)/16; + + for(int i=0; idesc, "part", 0); + dev_raw_dump((unsigned char *) &dp.ops, sizeof dp.ops, part->desc, "ops", 1); + + for(int i=0; idesc, dp.mems[i].base.desc, i+2); +} + + +static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { + char real_config_file[PATH_MAX]; + + if(!realpath(p->config_file, real_config_file)) + memcpy(real_config_file, p->config_file, sizeof real_config_file); + + dev_info("# %s %d\n", real_config_file, p->lineno); + + if(!tsv) + dev_info("part\n"); + + __if_partout(strcmp, "\"%s\"", desc); + __if_partout(strcmp, "\"%s\"", id); + __if_partout(strcmp, "\"%s\"", family_id); + __if_partout(intcmp, "0x%02x", stk500_devcode); + __if_partout(intcmp, "0x%02x", avr910_devcode); + __if_partout(intcmp, "%d", chip_erase_delay); + __if_partout(intcmp, "0x%02x", pagel); + __if_partout(intcmp, "0x%02x", bs2); + __if_n_partout_str(memcmp, sizeof p->signature, dev_sprintf("0x%02x 0x%02x 0x%02x", p->signature[0], p->signature[1], p->signature[2]), signature); + __if_partout(intcmp, "0x%04x", usbpid); + + if(!base || base->reset_disposition != p->reset_disposition) + __partout_str(strdup(p->reset_disposition == RESET_DEDICATED? "dedicated": p->reset_disposition == RESET_IO? "io": "unknown"), reset); + + __if_partout_str(intcmp, strdup(p->retry_pulse == PIN_AVR_RESET? "reset": p->retry_pulse == PIN_AVR_SCK? "sck": "unknown"), retry_pulse); + + if(!base || base->flags != p->flags) { + if(tsv) { + __partout("0x%04x", flags); + } else { + __if_flagout(AVRPART_HAS_JTAG, has_jtag); + __if_flagout(AVRPART_HAS_DW, has_debugwire); + __if_flagout(AVRPART_HAS_PDI, has_pdi); + __if_flagout(AVRPART_HAS_UPDI, has_updi); + __if_flagout(AVRPART_HAS_TPI, has_tpi); + __if_flagout(AVRPART_IS_AT90S1200, is_at90s1200); + __if_flagout(AVRPART_AVR32, is_avr32); + __if_flagout(AVRPART_ALLOWFULLPAGEBITSTREAM, allowfullpagebitstream); + __if_flagout(AVRPART_ENABLEPAGEPROGRAMMING, enablepageprogramming); + __if_flagout(AVRPART_SERIALOK, serial); + + if(!base || (base->flags & (AVRPART_PARALLELOK | AVRPART_PSEUDOPARALLEL)) != (p->flags & (AVRPART_PARALLELOK | AVRPART_PSEUDOPARALLEL))) { + int par = p->flags & (AVRPART_PARALLELOK | AVRPART_PSEUDOPARALLEL); + __partout_str(strdup(par == 0? "no": par == AVRPART_PSEUDOPARALLEL? "unknown": AVRPART_PARALLELOK? "yes": "pseudo"), parallel); + } + } + } + + __if_partout(intcmp, "%d", timeout); + __if_partout(intcmp, "%d", stabdelay); + __if_partout(intcmp, "%d", cmdexedelay); + __if_partout(intcmp, "%d", synchloops); + __if_partout(intcmp, "%d", bytedelay); + __if_partout(intcmp, "%d", pollindex); + __if_partout(intcmp, "0x%02x", pollvalue); + __if_partout(intcmp, "%d", predelay); + __if_partout(intcmp, "%d", postdelay); + __if_partout(intcmp, "%d", pollmethod); + + if(!base && p->ctl_stack_type != CTL_STACK_NONE) + dev_stack_out(tsv, p, dev_controlstack_name(p), p->controlstack, CTL_STACK_SIZE); + + // @@@ may need to remove controlstack and set p->ctl_stack_type to CTL_STACK_NONE if base has controlstack? + if(base && (p->ctl_stack_type != base->ctl_stack_type || memcmp(base->controlstack, p->controlstack, sizeof base->controlstack))) + dev_stack_out(tsv, p, dev_controlstack_name(p), p->controlstack, CTL_STACK_SIZE); + + if(!base || memcmp(base->flash_instr, p->flash_instr, sizeof base->flash_instr)) + dev_stack_out(tsv, p, "flash_instr", p->flash_instr, FLASH_INSTR_SIZE); + + if(!base || memcmp(base->eeprom_instr, p->eeprom_instr, sizeof base->eeprom_instr)) + dev_stack_out(tsv, p, "eeprom_instr", p->eeprom_instr, EEPROM_INSTR_SIZE); + + __if_partout(intcmp, "%d", hventerstabdelay); + __if_partout(intcmp, "%d", progmodedelay); + __if_partout(intcmp, "%d", latchcycles); + __if_partout(intcmp, "%d", togglevtg); + __if_partout(intcmp, "%d", poweroffdelay); + __if_partout(intcmp, "%d", resetdelayms); + __if_partout(intcmp, "%d", resetdelayus); + __if_partout(intcmp, "%d", hvleavestabdelay); + __if_partout(intcmp, "%d", resetdelay); + __if_partout(intcmp, "%d", chiperasepulsewidth); + __if_partout(intcmp, "%d", chiperasepolltimeout); + __if_partout(intcmp, "%d", chiperasetime); + __if_partout(intcmp, "%d", programfusepulsewidth); + __if_partout(intcmp, "%d", programfusepolltimeout); + __if_partout(intcmp, "%d", programlockpulsewidth); + __if_partout(intcmp, "%d", programlockpolltimeout); + __if_partout(intcmp, "%d", synchcycles); + __if_partout(intcmp, "%d", hvspcmdexedelay); + __if_partout(intcmp, "0x%02x", idr); + __if_partout(intcmp, "0x%02x", rampz); + __if_partout(intcmp, "0x%02x", spmcr); + __if_partout(intcmp, "0x%02x", eecr); // why is eecr an unsigned short? + __if_partout(intcmp, "0x%04x", mcu_base); + __if_partout(intcmp, "0x%04x", nvm_base); + __if_partout(intcmp, "0x%04x", ocd_base); + __if_partout(intcmp, "%d", ocdrev); + + for(int i=0; i < AVR_OP_MAX; i++) + if(!base || opcodecmp(p->op[i], base->op[i])) + dev_part_strct_entry(tsv, ".ptop", p->desc, "part", opcodename(i), opcode2str(p->op[i], !tsv)); + + for(int mi=0; mi < sizeof mem_order/sizeof *mem_order && mem_order[mi]; mi++) { + AVRMEM *m, *bm; + + m = p->mem? avr_locate_mem(p, mem_order[mi]): NULL; + bm = base && base->mem? avr_locate_mem(base, mem_order[mi]): NULL; + + if(!m && bm && !tsv) + dev_info("\n memory \"%s\" = NULL;\n", bm->desc); + + if(!m) + continue; + + if(base && !bm) + bm = avr_new_memtype(); + + if(!tsv) { + if(!memorycmp(bm, m)) // same memory bit for bit, no need to instantiate + continue; + + dev_info("\n memory \"%s\"\n", m->desc); + } + + __if_memout_yn(paged); + __if_memout(intcmp, m->size > 8192? "0x%x": "%d", size); + __if_memout(intcmp, "%d", page_size); + __if_memout(intcmp, "%d", num_pages); // why can AVRDUDE not compute this? + __if_memout(intcmp, "0x%x", offset); + __if_memout(intcmp, "%d", min_write_delay); + __if_memout(intcmp, "%d", max_write_delay); + __if_memout_yn(pwroff_after_write); + __if_n_memout_str(memcmp, 2, dev_sprintf("0x%02x 0x%02x", m->readback[0], m->readback[1]), readback); + __if_memout(intcmp, "%d", mode); + __if_memout(intcmp, "%d", delay); + __if_memout(intcmp, "%d", blocksize); + __if_memout(intcmp, "%d", readsize); + __if_memout(intcmp, "%d", pollindex); + + for(int i=0; i < AVR_OP_MAX; i++) + if(!bm || opcodecmp(bm->op[i], m->op[i])) + dev_part_strct_entry(tsv, ".ptmmop", p->desc, m->desc, opcodename(i), opcode2str(m->op[i], !tsv)); + + if(!tsv) + dev_info(" ;\n"); + + for(LNODEID lnm=lfirst(p->mem_alias); lnm; lnm=lnext(lnm)) { + AVRMEM_ALIAS *ma = ldata(lnm); + if(ma->aliased_mem && !strcmp(ma->aliased_mem->desc, m->desc)) { + if(tsv) + dev_info(".ptmm\t%s\t%s\talias\t%s\n", p->desc, ma->desc, m->desc); + else + dev_info("\n memory \"%s\"\n alias \"%s\";\n ;\n", ma->desc, m->desc); + } + } + } + + if(!tsv) + dev_info(";\n"); } // -p */[cdosw*] void dev_output_part_defs(char *partdesc) { - bool first = 1, cmdok, waits, opspi, descs, strct, all, dot; + bool cmdok, waits, opspi, descs, strct, cmpst, raw, all, tsv; + char *flags; + int nprinted; + AVRPART *nullpart = avr_new_part(); - if(!*partdesc) - all = 1; - else if(*partdesc != '/' || (*partdesc == '/' && partdesc[1] && !strchr("cdosw*", partdesc[1]))) { - dev_info("%s: flags for developer option -p \\* not recognised\n", progname); - dev_info(" -p \\*/c check address bits in SPI commands\n"); - dev_info(" -p \\*/d description of core part features\n"); - dev_info(" -p \\*/o opcodes for SPI programming parts and memories\n"); - dev_info(" -p \\*/s show avrdude.conf entries of parts\n"); - dev_info(" -p \\*/ss show full avrdude.conf entry as tab separated table\n"); - dev_info(" -p \\*/w wd_... constants for ISP parts\n"); - dev_info(" -p \\*/\\* all of the above except -p \\*/s\n"); - dev_info(" -p \\* same as -p\\*/\\*\n"); + if((flags = strchr(partdesc, '/'))) + *flags++ = 0; + + if(!flags && !strcmp(partdesc, "*")) // treat -p * as if it was -p */* + flags = "*"; + + if(!*flags || !strchr("cdosSrw*t", *flags)) { + dev_info("%s: flags for developer option -p / not recognised\n", progname); + dev_info( + "Wildcard examples:\n" + " * all known parts\n" + " ATtiny10 just this part\n" + " *32[0-9] matches ATmega329, ATmega325 and ATmega328\n" + " *32? matches ATmega329, ATmega32A, ATmega325 and ATmega328\n" + "Flags (one or more of the characters below):\n" + " c check address bits in SPI commands and output errors\n" + " d description of core part features\n" + " o opcodes for SPI programming parts and memories\n" + " S show entries of avrdude.conf parts with all values\n" + " s show entries of avrdude.conf parts with necessary values\n" + " r show entries of avrdude.conf parts as raw dump\n" + " w wd_... constants for ISP parts\n" + " * all of the above except s\n" + " t use tab separated values as much as possible\n" + "Note:\n" + " -p * same as -p */*\n" + ); return; - } else { - partdesc++; - all = !!strchr(partdesc, '*') || !strlen(partdesc); } // redirect stderr to stdout fflush(stderr); fflush(stdout); dup2(1, 2); - cmdok = all || !!strchr(partdesc, 'c'); - descs = all || !!strchr(partdesc, 'd'); - opspi = all || !!strchr(partdesc, 'o'); - strct = all || !!strchr(partdesc, 's'); - waits = all || !!strchr(partdesc, 'w'); - dot = strlen(partdesc) != 1; + all = *flags == '*'; + cmdok = all || !!strchr(flags, 'c'); + descs = all || !!strchr(flags, 'd'); + opspi = all || !!strchr(flags, 'o'); + waits = all || !!strchr(flags, 'w'); + strct = all || !!strchr(flags, 'S'); + raw = all || !!strchr(flags, 'r'); + cmpst = !!strchr(flags, 's'); + tsv = !!strchr(flags, 't'); + + // go through all memories and add them to the memory order list + for(LNODEID ln1 = lfirst(part_list); ln1; ln1 = lnext(ln1)) { + AVRPART *p = ldata(ln1); + if(p->mem) + for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) + add_mem_order(((AVRMEM *) ldata(lnm))->desc); + + // same for aliased memories (though probably not needed) + if(p->mem_alias) + for(LNODEID lnm=lfirst(p->mem_alias); lnm; lnm=lnext(lnm)) + add_mem_order(((AVRMEM_ALIAS *) ldata(lnm))->desc); + } + + nprinted = dev_nprinted; for(LNODEID ln1 = lfirst(part_list); ln1; ln1 = lnext(ln1)) { AVRPART *p = ldata(ln1); int flashsize, flashoffset, flashpagesize, eepromsize , eepromoffset, eeprompagesize; - if(strct) { - char space[1024], real_config_file[PATH_MAX]; - - if(!first) + if(!descs || tsv) + if(dev_nprinted > nprinted) { dev_info("\n"); - first = 0; - - if(!realpath(p->config_file, real_config_file)) - memcpy(real_config_file, p->config_file, sizeof real_config_file); - dev_info("# %s %d\n", real_config_file, p->lineno); - - if(!dot) - dev_info("part\n"); - dev_partout("\"%s\"", desc); - dev_partout("\"%s\"", id); - dev_partout("\"%s\"", family_id); - dev_partout("0x%02x", stk500_devcode); - dev_partout("0x%02x", avr910_devcode); - dev_partout("%d", chip_erase_delay); - dev_partout("0x%02x", pagel); - dev_partout("0x%02x", bs2); - sprintf(space, "0x%02x 0x%02x 0x%02x", p->signature[0], p->signature[1], p->signature[2]); - dev_partout_str(space, signature); - dev_partout("0x%04x", usbpid); - sprintf(space, "%s", p->reset_disposition == RESET_DEDICATED? "dedicated": p->reset_disposition == RESET_IO? "io": "unknown"); - dev_partout_str(space, reset); - sprintf(space, "%s", p->retry_pulse == PIN_AVR_RESET? "reset": p->retry_pulse == PIN_AVR_SCK? "sck": "unknown"); - dev_partout_str(space, retry_pulse); - - if(dot) - dev_info(".part\t%s\tflags\t0x%04x\n", p->desc, p->flags); - else { - dev_flagout("has_jtag", AVRPART_HAS_JTAG); - dev_flagout("has_debugwire", AVRPART_HAS_DW); - dev_flagout("has_pdi", AVRPART_HAS_PDI); - dev_flagout("has_updi", AVRPART_HAS_UPDI); - dev_flagout("has_tpi", AVRPART_HAS_TPI); - dev_flagout("is_at90s1200", AVRPART_IS_AT90S1200); - dev_flagout("is_avr32", AVRPART_AVR32); - dev_flagout("allowfullpagebitstream", AVRPART_ALLOWFULLPAGEBITSTREAM); - dev_flagout("enablepageprogramming", AVRPART_ENABLEPAGEPROGRAMMING); - dev_flagout("serial", AVRPART_SERIALOK); - - switch(p->flags & (AVRPART_PARALLELOK | AVRPART_PSEUDOPARALLEL)) { - case 0: strcpy(space, "no"); break; - case AVRPART_PSEUDOPARALLEL: strcpy(space, "unknown"); break; - case AVRPART_PARALLELOK: strcpy(space, "yes"); break; - default: strcpy(space, "pseudo"); break; - } - dev_info(" %-19s = %s;\n", "parallel", space); + nprinted = dev_nprinted; } - dev_partout("%d", timeout); - dev_partout("%d", stabdelay); - dev_partout("%d", cmdexedelay); - dev_partout("%d", synchloops); - dev_partout("%d", bytedelay); - dev_partout("%d", pollindex); - dev_partout("0x%02x", pollvalue); - dev_partout("%d", predelay); - dev_partout("%d", postdelay); - dev_partout("%d", pollmethod); + // pattern match the name of the part with command line: FMP_CASEFOLD not available here :( + if(fnmatch(partdesc, p->desc, 0) && fnmatch(partdesc, p->id, 0)) + continue; - sprintf(space, "%s", p->ctl_stack_type == CTL_STACK_PP? "pp_controlstack": p->ctl_stack_type == CTL_STACK_HVSP? "hvsp_controlstack": "unknown_controlstack"); - if(p->ctl_stack_type != CTL_STACK_NONE) - dev_stack_out(dot, p, space, p->controlstack, CTL_STACK_SIZE); - dev_stack_out(dot, p, "flash_instr", p->flash_instr, FLASH_INSTR_SIZE); - dev_stack_out(dot, p, "eeprom_instr", p->eeprom_instr, EEPROM_INSTR_SIZE); - -/* - unsigned char controlstack[CTL_STACK_SIZE]; // stk500v2 PP/HVSP ctl stack - unsigned char flash_instr[FLASH_INSTR_SIZE]; // flash instructions (debugWire, JTAG) - unsigned char eeprom_instr[EEPROM_INSTR_SIZE]; // EEPROM instructions (debugWire, JTAG) -*/ - - dev_partout("%d", hventerstabdelay); - dev_partout("%d", progmodedelay); - dev_partout("%d", latchcycles); - dev_partout("%d", togglevtg); - dev_partout("%d", poweroffdelay); - dev_partout("%d", resetdelayms); - dev_partout("%d", resetdelayus); - dev_partout("%d", hvleavestabdelay); - dev_partout("%d", resetdelay); - dev_partout("%d", chiperasepulsewidth); - dev_partout("%d", chiperasepolltimeout); - dev_partout("%d", chiperasetime); - dev_partout("%d", programfusepulsewidth); - dev_partout("%d", programfusepolltimeout); - dev_partout("%d", programlockpulsewidth); - dev_partout("%d", programlockpolltimeout); - dev_partout("%d", synchcycles); - dev_partout("%d", hvspcmdexedelay); - - dev_partout("0x%02x", idr); - dev_partout("0x%02x", rampz); - dev_partout("0x%02x", spmcr); - dev_partout("0x%02x", eecr); // why is eecr an unsigned short? - - dev_partout("0x%04x", mcu_base); - dev_partout("0x%04x", nvm_base); - dev_partout("0x%04x", ocd_base); - - if(p->ocdrev >= 0) - dev_partout("%d", ocdrev); - else - dev_partout("0x%8x", ocdrev); - - for(int i=0; i < AVR_OP_MAX; i++) { - if(p->op[i]) { - char *opc = opcode2str(p->op[i], !dot); - - if(dot) - dev_info(".partop\t%s\t%s\t%s\n", p->desc, opcodename(i), opc? opc: "error"); - else - dev_info(" %-19s = %s;\n", opcodename(i), opc? opc: "error"); - - if(opc) - free(opc); - } - } - if(p->mem) { - for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { - AVRMEM *m = ldata(lnm); - if(!dot) - dev_info("\n memory \"%s\"\n", m->desc); - - dev_memout_yn(paged); - if(m->size > 8192) - dev_memout("0x%x", size); - else - dev_memout("%d", size); - dev_memout("%d", page_size); - dev_memout("%d", num_pages); // why can AVRDUDE not compute this? - dev_memout("0x%x", offset); - dev_memout("%d", min_write_delay); - dev_memout("%d", max_write_delay); - dev_memout_yn(pwroff_after_write); - sprintf(space, "0x%02x 0x%02x", m->readback[0], m->readback[1]); - dev_memout_str(space, readback); - dev_memout("%d", mode); - dev_memout("%d", delay); - dev_memout("%d", blocksize); - dev_memout("%d", readsize); - dev_memout("%d", pollindex); - - for(int i=0; i < AVR_OP_MAX; i++) { - if(m->op[i]) { - char *opc = opcode2str(m->op[i], !dot); - - if(dot) - dev_info(".pmemop\t%s\t%s\t%s\t%s\n", p->desc, m->desc, opcodename(i), opc? opc: "error"); - else - dev_info(" %-15s = %s;\n", opcodename(i), opc? opc: "error"); - - if(opc) - free(opc); - } - } - - if(!dot) - dev_info(" ;\n"); - for(LNODEID lnm=lfirst(p->mem_alias); lnm; lnm=lnext(lnm)) { - AVRMEM_ALIAS *ma = ldata(lnm); - if(ma->aliased_mem && !strcmp(ma->aliased_mem->desc, m->desc)) { - if(dot) - dev_info(".pmem\t%s\t%s\talias\t%s\n", p->desc, ma->desc, m->desc); - else - dev_info("\n memory \"%s\"\n alias \"%s\";\n ;\n", ma->desc, m->desc); - } - } - } - } - - if(!dot) - dev_info(";\n"); - } + if(strct || cmpst) + dev_part_strct(p, tsv, cmpst? nullpart: NULL); + if(raw) + dev_part_raw(p); // identify core flash and eeprom parameters @@ -478,10 +840,6 @@ void dev_output_part_defs(char *partdesc) { AVRMEM *m; OPCODE *oc; - if(!first && all) - dev_info("\n"); - first = 0; - ok = 2047; nfuses = 0; @@ -601,7 +959,8 @@ void dev_output_part_defs(char *partdesc) { if(descs) { int len = 16-strlen(p->desc); - dev_info(".desc '%s' =>%*s [0x%02X, 0x%02X, 0x%02X, 0x%08x, 0x%05x, 0x%03x, 0x%06x, 0x%04x, 0x%03x, %d, 0x%03x, 0x%04x, '%s'], # %s %d\n", + dev_info("%s '%s' =>%*s [0x%02X, 0x%02X, 0x%02X, 0x%08x, 0x%05x, 0x%03x, 0x%06x, 0x%04x, 0x%03x, %d, 0x%03x, 0x%04x, '%s'], # %s %d\n", + tsv || all? ".desc": " ", p->desc, len > 0? len: 0, "", p->signature[0], p->signature[1], p->signature[2], flashoffset, flashsize, flashpagesize, diff --git a/src/developer_opts_private.h b/src/developer_opts_private.h index ffeb5c05..b05949bd 100644 --- a/src/developer_opts_private.h +++ b/src/developer_opts_private.h @@ -1,3 +1,24 @@ +/* + * avrdude - A Downloader/Uploader for AVR device programmers + * Copyright (C) 2022, Stefan Rueger + * + * 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, see . + */ + +#ifndef developer_opts_private_h +#define developer_opts_private_h + #define DEV_SPI_EN_CE_SIG 1 #define DEV_SPI_PROGMEM 2 #define DEV_SPI_PROGMEM_PAGED 4 @@ -10,6 +31,10 @@ #define DEV_SPI_HFUSE 512 #define DEV_SPI_EFUSE 1024 + +static int dev_message(int msglvl, const char *fmt, ...); + + #ifndef DEV_INFO #define DEV_INFO MSG_INFO #endif @@ -22,29 +47,70 @@ #define DEV_NOTICE2 MSG_NOTICE2 #endif -#define dev_info(...) avrdude_message(DEV_INFO, __VA_ARGS__) -#define dev_notice(...) avrdude_message(DEV_NOTICE, __VA_ARGS__) -#define dev_notice2(...) avrdude_message(DEV_NOTICE2, __VA_ARGS__) +#define dev_info(...) dev_message(DEV_INFO, __VA_ARGS__) +#define dev_notice(...) dev_message(DEV_NOTICE, __VA_ARGS__) +#define dev_notice2(...) dev_message(DEV_NOTICE2, __VA_ARGS__) -#define dev_partout(fmt, component) (dot? \ - dev_info(".part\t%s\t%s\t" fmt "\n", p->desc, #component, p->component): \ - dev_info(" %-19s = " fmt ";\n", #component, p->component)) +#define __partout(fmt, component) \ + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)) -#define dev_partout_str(result, component) (dot? \ - dev_info(".part\t%s\t%s\t%s\n", p->desc, #component, result): \ - dev_info(" %-19s = %s;\n", #component, result)) +#define __if_partout(cmp, fmt, component) ({ \ + if(!base || cmp(base->component, p->component)) \ + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)); \ +}) -#define dev_memout(fmt, component) (dot? \ - dev_info(".pmem\t%s\t%s\t%s\t" fmt "\n", p->desc, m->desc, #component, m->component): \ - dev_info(" %-15s = " fmt ";\n", #component, m->component)) +#define __if_n_partout(cmp, n, fmt, component) ({ \ + if(!base || cmp(base->component, p->component, n)) \ + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)); \ +}) -#define dev_memout_str(result, component) (dot? \ - dev_info(".pmem\t%s\t%s\t%s\t%s\n", p->desc, m->desc, #component, result): \ - dev_info(" %-15s = %s;\n", #component, result)) +#define __partout_str(result, component) \ + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result) -#define dev_memout_yn(component) (dot? \ - dev_info(".pmem\t%s\t%s\t%s\t%s\n", p->desc, m->desc, #component, m->component? "yes": "no"): \ - dev_info(" %-15s = %s;\n", #component, m->component? "yes": "no")) +#define __if_partout_str(cmp, result, component) ({ \ + if(!base || cmp(base->component, p->component)) \ + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result); \ +}) + +#define __if_n_partout_str(cmp, n, result, component) ({ \ + if(!base || cmp(base->component, p->component, n)) \ + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result); \ +}) -#define dev_flagout(name, mask) dev_info(" %-19s = %s;\n", (name), p->flags & (mask)? "yes": "no") +#define __memout(fmt, component) \ + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component)) + +#define __if_memout(cmp, fmt, component) ({ \ + if(!bm || cmp(bm->component, m->component)) \ + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component)); \ +}) + +#define __memout_str(result, component) \ + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result) + +#define __if_n_memout_str(cmp, n, result, component) ({ \ + if(!bm || cmp(bm->component, m->component, n)) \ + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result); \ +}) + +#define __memout_yn(component) \ + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, strdup(m->component? "yes": "no")) + +#define __if_memout_yn(component) ({ \ + if(!bm || bm->component != m->component) \ + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, strdup(m->component? "yes": "no")); \ +}) + +#define __flagout(mask, name) \ + __partout_str(strdup(p->flags & (mask)? "yes": "no"), name) + +#define __if_flagout(mask, name) ({ \ + if(!base || (base->flags & (mask)) != (p->flags & (mask))) \ + __partout_str(strdup(p->flags & (mask)? "yes": "no"), name); \ +}) + +#define __cmderr(result, component) \ + dev_part_strct_entry(tsv, ".cmderr", p->desc, m->desc, #component, result) + +#endif diff --git a/src/libavrdude.h b/src/libavrdude.h index ddb72b48..e27d61ea 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -318,9 +318,9 @@ int avr_initmem(AVRPART * p); AVRMEM * avr_dup_mem(AVRMEM * m); void avr_free_mem(AVRMEM * m); void avr_free_memalias(AVRMEM_ALIAS * m); -AVRMEM * avr_locate_mem(AVRPART * p, char * desc); -AVRMEM * avr_locate_mem_noalias(AVRPART * p, char * desc); -AVRMEM_ALIAS * avr_locate_memalias(AVRPART * p, char * desc); +AVRMEM * avr_locate_mem(AVRPART * p, const char * desc); +AVRMEM * avr_locate_mem_noalias(AVRPART * p, const char * desc); +AVRMEM_ALIAS * avr_locate_memalias(AVRPART * p, const char * desc); AVRMEM_ALIAS * avr_find_memalias(AVRPART * p, AVRMEM * m_orig); void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, int type, int verbose); @@ -329,7 +329,7 @@ void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, AVRPART * avr_new_part(void); AVRPART * avr_dup_part(AVRPART * d); void avr_free_part(AVRPART * d); -AVRPART * locate_part(LISTID parts, char * partdesc); +AVRPART * locate_part(LISTID parts, const char * partdesc); AVRPART * locate_part_by_avr910_devcode(LISTID parts, int devcode); AVRPART * locate_part_by_signature(LISTID parts, unsigned char * sig, int sigsize); diff --git a/src/main.c b/src/main.c index 121e865e..755ae731 100644 --- a/src/main.c +++ b/src/main.c @@ -830,9 +830,9 @@ int main(int argc, char * argv []) avrdude_message(MSG_NOTICE, "\n"); - // developer option -p */[*codws] prints various aspects of part descriptions and exits - if(partdesc && *partdesc == '*') { - dev_output_part_defs(partdesc+1); + // developer option -p /[*codws] prints various aspects of part descriptions and exits + if(partdesc && (strcmp(partdesc, "*") == 0 || strchr(partdesc, '/'))) { + dev_output_part_defs(partdesc); exit(1); } From ff8f519a34ed4e167be442ca4abeac6f11cccdca Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 10 Jul 2022 23:25:31 +0100 Subject: [PATCH 079/511] Fix PICKit2 ATmega2560 flash paged flash read The paged read in pickit2.c has two errors: - It drops load extended address commands unless a paged read happens at a 64k byte boundary; this is invalid when reading files with holes - It wrongly assumed that flash memory is byte addressed The fix is to carry out a load extended address command, if needed, at the beginning of each paged flash read with the correct word address. Although the pickit2_paged_load() has independent parameters page_size, addr and n_bytes, AVRDUDE only ever calls paged read/write functions with page_size and n_bytes both set to mem->page_size and addr aligned with a page boundary. Therefore, it is sufficient to set the load extended address at the beginning of each page read. --- src/pickit2.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/pickit2.c b/src/pickit2.c index 9e4be94c..ac3781f5 100644 --- a/src/pickit2.c +++ b/src/pickit2.c @@ -491,18 +491,15 @@ static int pickit2_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, pgm->pgm_led(pgm, ON); + if (lext) { + memset(cmd, 0, sizeof(cmd)); + avr_set_bits(lext, cmd); + avr_set_addr(lext, cmd, addr/2); + pgm->cmd(pgm, cmd, res); + } + for (addr_base = addr; addr_base < max_addr; ) { - if ((addr_base == 0 || (addr_base % /*ext_address_boundary*/ 65536) == 0) - && lext != NULL) - { - memset(cmd, 0, sizeof(cmd)); - - avr_set_bits(lext, cmd); - avr_set_addr(lext, cmd, addr_base); - pgm->cmd(pgm, cmd, res); - } - // bytes to send in the next packet -- not necessary as pickit2_spi() handles breaking up // the data into packets -- but we need to keep transfers frequent so that we can update the // status indicator bar From 173b4f9d0ac90924764d8c3174ad3e3ab934a0cd Mon Sep 17 00:00:00 2001 From: Jan Egil Ruud Date: Mon, 11 Jul 2022 14:07:45 +0200 Subject: [PATCH 080/511] Clean up and simplify hvupdi handling, and set default hvupdi_variant to -1. --- src/avrpart.c | 1 + src/jtag3.c | 13 ++++--------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/avrpart.c b/src/avrpart.c index dc6def44..5a192e2d 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -573,6 +573,7 @@ AVRPART * avr_new_part(void) memset(p->signature, 0xFF, 3); p->ctl_stack_type = CTL_STACK_NONE; p->ocdrev = -1; + p->hvupdi_variant = -1; p->mem = lcreat(NULL, 0); p->mem_alias = lcreat(NULL, 0); diff --git a/src/jtag3.c b/src/jtag3.c index 1c003a82..ae5d1912 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1259,8 +1259,7 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) PDATA(pgm)->use_hvupdi == true && p->hvupdi_variant != HV_UPDI_VARIANT_1) { for (hvupdi_support = lfirst(pgm->hvupdi_support); hvupdi_support != NULL; hvupdi_support = lnext(hvupdi_support)) { - unsigned int sup = (unsigned int)(*(int *)(ldata(hvupdi_support))); - if(sup == p->hvupdi_variant) { + if(*(int *) ldata(hvupdi_support) == p->hvupdi_variant) { avrdude_message(MSG_NOTICE, "%s: Sending HV pulse to targets %s pin\n", progname, p->hvupdi_variant == HV_UPDI_VARIANT_0 ? "UPDI" : "RESET"); parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE; @@ -1496,8 +1495,7 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms) continue; } - else if ((matches(extended_param, "hvupdi") || matches(extended_param, "hvupdi=1")) && - (matches(ldata(lfirst(pgm->id)), "pickit4_updi") || matches(ldata(lfirst(pgm->id)), "powerdebugger_updi"))) { + else if (matches(extended_param, "hvupdi")) { PDATA(pgm)->use_hvupdi = true; continue; } @@ -1650,12 +1648,9 @@ static int jtag3_open_updi(PROGRAMMER * pgm, char * port) avrdude_message(MSG_NOTICE2, "%s: jtag3_open_updi()\n", progname); LNODEID ln; - unsigned int hv_sup; avrdude_message(MSG_NOTICE2, "%s: HV UPDI support:", progname); - for (ln = lfirst(pgm->hvupdi_support); ln; ln = lnext(ln)) { - hv_sup = (unsigned int)(*(int *)ldata(ln)); - avrdude_message(MSG_NOTICE2, " %d", hv_sup); - } + for (ln = lfirst(pgm->hvupdi_support); ln; ln = lnext(ln)) + avrdude_message(MSG_NOTICE2, " %d", *(int *) ldata(ln)); avrdude_message(MSG_NOTICE2, "\n", progname); if (jtag3_open_common(pgm, port) < 0) From 2478c1874591693ccff4c689e39238687bc2bc93 Mon Sep 17 00:00:00 2001 From: Jan Egil Ruud Date: Mon, 11 Jul 2022 15:26:41 +0200 Subject: [PATCH 081/511] Do not let the hvupdi extended option take any configuration values. The hvupdi type is implied by the part configuration. --- src/jtag3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jtag3.c b/src/jtag3.c index ae5d1912..f07e0319 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1495,7 +1495,7 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms) continue; } - else if (matches(extended_param, "hvupdi")) { + else if (strcmp(extended_param, "hvupdi") == 0) { PDATA(pgm)->use_hvupdi = true; continue; } From 69ee5da6130471d62bf170735b7f82cc93128107 Mon Sep 17 00:00:00 2001 From: Jan Egil Ruud Date: Tue, 12 Jul 2022 12:01:17 +0200 Subject: [PATCH 082/511] Improve error handling for devices that does not support HVUPDI. --- src/jtag3.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/jtag3.c b/src/jtag3.c index f07e0319..becfd8a1 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1254,17 +1254,21 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) } // Generate UPDI high-voltage pulse if user asks for it and hardware supports it - LNODEID hvupdi_support; + LNODEID support; if (p->flags & AVRPART_HAS_UPDI && PDATA(pgm)->use_hvupdi == true && p->hvupdi_variant != HV_UPDI_VARIANT_1) { - for (hvupdi_support = lfirst(pgm->hvupdi_support); hvupdi_support != NULL; hvupdi_support = lnext(hvupdi_support)) { - if(*(int *) ldata(hvupdi_support) == p->hvupdi_variant) { + parm[0] = PARM3_UPDI_HV_NONE; + for (support = lfirst(pgm->hvupdi_support); support != NULL; support = lnext(support)) { + if(*(int *) ldata(support) == p->hvupdi_variant) { avrdude_message(MSG_NOTICE, "%s: Sending HV pulse to targets %s pin\n", progname, p->hvupdi_variant == HV_UPDI_VARIANT_0 ? "UPDI" : "RESET"); parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE; break; } + if (parm[0] == PARM3_UPDI_HV_NONE) + avrdude_message(MSG_INFO, "%s: %s does not support sending HV pulse to target %s\n", + progname, pgm->desc, p->desc); } if (jtag3_setparm(pgm, SCOPE_AVR, 3, PARM3_OPT_12V_UPDI_ENABLE, parm, 1) < 0) return -1; @@ -1495,7 +1499,8 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms) continue; } - else if (strcmp(extended_param, "hvupdi") == 0) { + else if ((strcmp(extended_param, "hvupdi") == 0) && + (lsize(pgm->hvupdi_support) > 1)) { PDATA(pgm)->use_hvupdi = true; continue; } From d9450058c8667d9d3fe5ce467210305d93ad1159 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:12:20 +0100 Subject: [PATCH 083/511] Cache strlen(argv[i]) in term.c cmd_write() and prevent negative array index --- src/term.c | 84 +++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/src/term.c b/src/term.c index dc771273..1ddaf885 100644 --- a/src/term.c +++ b/src/term.c @@ -426,6 +426,9 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, // Handle the next argument if (i < argc - start_offset + 3) { + char *argi = argv[i]; + size_t arglen = strlen(argi); + // Free string pointer if already allocated if(data.str_ptr) { free(data.str_ptr); @@ -433,52 +436,55 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } // Get suffix if present - char suffix = argv[i][strlen(argv[i]) - 1]; - char lsuffix = argv[i][strlen(argv[i]) - 2]; - if ((suffix == 'L' && lsuffix == 'L') || (suffix == 'l' && lsuffix == 'l')) { - argv[i][strlen(argv[i]) - 2] = '\0'; - data.size = 8; - } else if (suffix == 'L' || suffix == 'l') { - argv[i][strlen(argv[i]) - 1] = '\0'; - data.size = 4; - } else if ((suffix == 'F' || suffix == 'f') && - strncmp(argv[i], "0x", 2) != 0 && strncmp(argv[i], "-0x", 3) != 0) { - argv[i][strlen(argv[i]) - 1] = '\0'; - data.size = 4; - } else if ((suffix == 'H' && lsuffix == 'H') || (suffix == 'h' && lsuffix == 'h')) { - argv[i][strlen(argv[i]) - 2] = '\0'; - data.size = 1; - } else if (suffix == 'H' || suffix == 'h' || suffix == 'S' || suffix == 's') { - argv[i][strlen(argv[i]) - 1] = '\0'; - data.size = 2; - } else if (suffix == '\'') { - data.size = 1; + char suffix = 0, lsuffix = 0; + if(arglen > 1) { + suffix = argi[arglen - 1]; + lsuffix = argi[arglen - 2]; + if ((suffix == 'L' && lsuffix == 'L') || (suffix == 'l' && lsuffix == 'l')) { + argi[arglen -= 2] = '\0'; + data.size = 8; + } else if (suffix == 'L' || suffix == 'l') { + argi[--arglen] = '\0'; + data.size = 4; + } else if ((suffix == 'F' || suffix == 'f') && + strncmp(argi, "0x", 2) != 0 && strncmp(argi, "-0x", 3) != 0) { + argi[--arglen] = '\0'; + data.size = 4; + } else if ((suffix == 'H' && lsuffix == 'H') || (suffix == 'h' && lsuffix == 'h')) { + argi[arglen -= 2] = '\0'; + data.size = 1; + } else if (suffix == 'H' || suffix == 'h' || suffix == 'S' || suffix == 's') { + argi[--arglen] = '\0'; + data.size = 2; + } else if (suffix == '\'') { + data.size = 1; + } } // Try integers - data.ll = strtoll(argv[i], &end_ptr, 0); - if (*end_ptr || (end_ptr == argv[i])) { + data.ll = strtoll(argi, &end_ptr, 0); + if (*end_ptr || (end_ptr == argi)) { // Try float - data.f = strtof(argv[i], &end_ptr); + data.f = strtof(argi, &end_ptr); data.is_float = true; - if (*end_ptr || (end_ptr == argv[i])) { + if (*end_ptr || (end_ptr == argi)) { data.is_float = false; // Try single character - if (argv[i][0] == '\'' && argv[i][2] == '\'') { - data.ll = argv[i][1]; + if (argi[0] == '\'' && argi[2] == '\'') { + data.ll = argi[1]; } else { // Try string that starts and ends with quotes - if (argv[i][0] == '\"' && argv[i][strlen(argv[i]) - 1] == '\"') { - data.str_ptr = calloc(strlen(argv[i]), sizeof(char)); + if (argi[0] == '\"' && argi[arglen - 1] == '\"') { + data.str_ptr = calloc(arglen, sizeof(char)); if (data.str_ptr == NULL) { avrdude_message(MSG_INFO, "%s (write str): out of memory\n", progname); return -1; } // Strip start and end quotes - strncpy(data.str_ptr, argv[i] + 1, strlen(argv[i]) - 2); + strncpy(data.str_ptr, argi + 1, arglen - 2); } else { avrdude_message(MSG_INFO, "\n%s (write): can't parse data '%s'\n", - progname, argv[i]); + progname, argi); free(buf); if(data.str_ptr != NULL) free(data.str_ptr); @@ -489,18 +495,18 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } // Print warning if data size might be ambiguous - bool is_hex = (strncmp(argv[i], "0x", 2) == 0); - bool is_neg_hex = (strncmp(argv[i], "-0x", 3) == 0); - bool leading_zero = (strncmp(argv[i], "0x0", 3) == 0); - int8_t hex_digits = (strlen(argv[i]) - 2); - if(!data.size // No pre-defined size - && (is_neg_hex // Hex with - sign in front - || (is_hex && leading_zero && (hex_digits & (hex_digits - 1))) // Hex with 3, 5, 6 or 7 digits - || (!is_hex && !data.is_float && llabs(data.ll) > 0xFF && strlen(argv[i]) > 2))) // Base10 int greater than 255 + bool is_hex = (strncmp(argi, "0x", 2) == 0); + bool is_neg_hex = (strncmp(argi, "-0x", 3) == 0); + bool leading_zero = (strncmp(argi, "0x0", 3) == 0); + int8_t hex_digits = (arglen - 2); + if(!data.size // No pre-defined size + && (is_neg_hex // Hex with - sign in front + || (is_hex && leading_zero && (hex_digits & (hex_digits - 1))) // Hex with 3, 5, 6 or 7 digits + || (!is_hex && !data.is_float && llabs(data.ll) > 0xFF && arglen > 2))) // Base10 int greater than 255 { avrdude_message(MSG_INFO, "Warning: no size suffix specified for \"%s\". " "Writing %d byte(s)\n", - argv[i], + argi, llabs(data.ll) > UINT32_MAX ? 8 : llabs(data.ll) > UINT16_MAX || data.is_float ? 4 : \ llabs(data.ll) > UINT8_MAX ? 2 : 1); From 360d7c502b69920124d6eb51c39ec08951274363 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:13:46 +0100 Subject: [PATCH 084/511] Make suffix fully case insensitive (allow Hh, Ll, ...) in terminal write --- src/term.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/term.c b/src/term.c index 1ddaf885..534cf67b 100644 --- a/src/term.c +++ b/src/term.c @@ -438,22 +438,22 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, // Get suffix if present char suffix = 0, lsuffix = 0; if(arglen > 1) { - suffix = argi[arglen - 1]; - lsuffix = argi[arglen - 2]; - if ((suffix == 'L' && lsuffix == 'L') || (suffix == 'l' && lsuffix == 'l')) { + suffix = toupper(argi[arglen - 1]); + lsuffix = toupper(argi[arglen - 2]); + if (suffix == 'L' && lsuffix == 'L') { argi[arglen -= 2] = '\0'; data.size = 8; } else if (suffix == 'L' || suffix == 'l') { argi[--arglen] = '\0'; data.size = 4; - } else if ((suffix == 'F' || suffix == 'f') && + } else if ((suffix == 'F') && strncmp(argi, "0x", 2) != 0 && strncmp(argi, "-0x", 3) != 0) { argi[--arglen] = '\0'; data.size = 4; - } else if ((suffix == 'H' && lsuffix == 'H') || (suffix == 'h' && lsuffix == 'h')) { + } else if (suffix == 'H' && lsuffix == 'H') { argi[arglen -= 2] = '\0'; data.size = 1; - } else if (suffix == 'H' || suffix == 'h' || suffix == 'S' || suffix == 's') { + } else if (suffix == 'H' || suffix == 'S') { argi[--arglen] = '\0'; data.size = 2; } else if (suffix == '\'') { From 39a00bc71ed2527ad1953f1465df22f4961c6d5a Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:14:41 +0100 Subject: [PATCH 085/511] Ensure +0x...f does not strip suffix f in terminal write --- src/term.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/term.c b/src/term.c index 534cf67b..ce6c6157 100644 --- a/src/term.c +++ b/src/term.c @@ -447,7 +447,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, argi[--arglen] = '\0'; data.size = 4; } else if ((suffix == 'F') && - strncmp(argi, "0x", 2) != 0 && strncmp(argi, "-0x", 3) != 0) { + strncmp(argi, "0x", 2) && strncmp(argi, "-0x", 3) && strncmp(argi, "+0x", 3)) { argi[--arglen] = '\0'; data.size = 4; } else if (suffix == 'H' && lsuffix == 'H') { From d3ad078577b07833e0a40be32f84e7850ff4898b Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:15:30 +0100 Subject: [PATCH 086/511] Ensure terminal write fill mode ... always fills with last data item --- src/term.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/term.c b/src/term.c index ce6c6157..881207fc 100644 --- a/src/term.c +++ b/src/term.c @@ -421,14 +421,14 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, }; for (i = start_offset; i < len + start_offset; i++) { - data.is_float = false; - data.size = 0; - // Handle the next argument if (i < argc - start_offset + 3) { char *argi = argv[i]; size_t arglen = strlen(argi); + data.is_float = false; + data.size = 0; + // Free string pointer if already allocated if(data.str_ptr) { free(data.str_ptr); From 177834ae7c72bc0738af41dc32cd3b0dfb14fdb7 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:16:16 +0100 Subject: [PATCH 087/511] Ensure enough memory is allocated for buf in terminal write --- src/term.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/term.c b/src/term.c index 881207fc..64bee430 100644 --- a/src/term.c +++ b/src/term.c @@ -334,6 +334,16 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, } +static size_t maxstrlen(int argc, char **argv) { + size_t max = 0; + + for(int i=0; i max) + max = strlen(argv[i]); + + return max; +} + static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, int argc, char * argv[]) { @@ -374,7 +384,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } // Allocate a buffer guaranteed to be large enough - uint8_t * buf = calloc(mem->size + 0x10 + strlen(argv[argc - 2]), sizeof(uint8_t)); + uint8_t * buf = calloc(mem->size + 0x10 + maxstrlen(argc-3, argv+3), sizeof(uint8_t)); if (buf == NULL) { avrdude_message(MSG_INFO, "%s (write): out of memory\n", progname); return -1; From ff43e0544d40e70bc911f5a85090f1c354e6b2f9 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:18:15 +0100 Subject: [PATCH 088/511] Correct a parse message in terminal write --- src/term.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/term.c b/src/term.c index 64bee430..7e635463 100644 --- a/src/term.c +++ b/src/term.c @@ -396,7 +396,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, start_offset = 4; len = strtoul(argv[3], &end_ptr, 0); if (*end_ptr || (end_ptr == argv[3])) { - avrdude_message(MSG_INFO, "%s (write ...): can't parse address \"%s\"\n", + avrdude_message(MSG_INFO, "%s (write ...): can't parse length \"%s\"\n", progname, argv[3]); free(buf); return -1; From 9afa56381e2c60158f84ccdcbe9789120815317d Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:19:05 +0100 Subject: [PATCH 089/511] Remove unused component is_signed in terminal write --- src/term.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/term.c b/src/term.c index 7e635463..ac36e3bf 100644 --- a/src/term.c +++ b/src/term.c @@ -413,7 +413,6 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, int32_t bytes_grown; uint8_t size; bool is_float; - bool is_signed; char * str_ptr; // Data union union { @@ -425,7 +424,6 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, .bytes_grown = 0, .size = 0, .is_float = false, - .is_signed = false, .str_ptr = NULL, .ll = 0 }; @@ -521,9 +519,8 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, llabs(data.ll) > UINT16_MAX || data.is_float ? 4 : \ llabs(data.ll) > UINT8_MAX ? 2 : 1); } - // Flag if signed integer and adjust size + // Adjust size if signed integer if (data.ll < 0 && !data.is_float) { - data.is_signed = true; if (data.ll < INT32_MIN) data.size = 8; else if (data.ll < INT16_MIN) From 62d3eebd568c2078428a55485675a8411d97f415 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:19:47 +0100 Subject: [PATCH 090/511] Fix 64-bit integer terminal write where high bit set Using strtoll() can only return numbers in the range [-2^63, 2^63-1]. This means that 0xffffFFFFffffFFFF (2^64-1) will be out of range and is written as max LL. Actually, every 64-bit number with high-bit set will wrongly be written as max LL. This commit uses strtoull() instead to fix this, and checks for unsiged out- of-range error. strtoull() also has the neat benefit that input with a minus sign is treated like C unsigned numbers, ie, -u is also a valid unsigned number if only u is one. In case the input is meant to be treated as signed, it is therefore still OK to use strtoull() in the first instance only that in this case a second check against the range of the signed domain is necessary. --- src/term.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/term.c b/src/term.c index ac36e3bf..203168de 100644 --- a/src/term.c +++ b/src/term.c @@ -26,6 +26,7 @@ #include #include #include +#include #if defined(HAVE_LIBREADLINE) # include @@ -470,8 +471,9 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } // Try integers - data.ll = strtoll(argi, &end_ptr, 0); - if (*end_ptr || (end_ptr == argi)) { + errno = 0; + data.ll = strtoull(argi, &end_ptr, 0); + if (!(end_ptr == argi || errno)) { // Try float data.f = strtof(argi, &end_ptr); data.is_float = true; From 51355d04fb34805a2b352475f01f13e8270f0822 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:32:38 +0100 Subject: [PATCH 091/511] Remodel logic of the size that integer items occupy in terminal write Integers can be hexadecimal, decimal or octal. An optional case-insensitive suffix specifies their size: HH: 8 bit, H/S: 16 bit, L: 32 bit, LL: 64 bit An optional U suffix makes a number unsigned. Ordinary 0x hex numbers are always treated as unsigned. +0x or -0x hex numbers are treated as signed unless they have a U suffix. Unsigned integers cannot be larger than 2^64-1. If n is an unsigned integer then -n is also a valid unsigned integer as in C. Signed integers must fall into the [-2^63, 2^63-1] range or a correspondingly smaller range when a suffix specifies a smaller type. Out of range signed numbers trigger a warning. Ordinary 0x hex numbers with n hex digits (counting leading zeros) use the smallest size of 1, 2, 4 and 8 bytes that can accommodate any n-digit hex number. If a suffix specifies a size explicitly the corresponding number of least significant bytes are written. Otherwise, signed and unsigned integers alike occupy the smallest of 1, 2, 4, or 8 bytes needed to accommodate them in their respective representation. --- src/term.c | 157 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 91 insertions(+), 66 deletions(-) diff --git a/src/term.c b/src/term.c index 203168de..96ed8e57 100644 --- a/src/term.c +++ b/src/term.c @@ -419,6 +419,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, union { float f; int64_t ll; + uint64_t ull; uint8_t a[8]; }; } data = { @@ -444,44 +445,99 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, data.str_ptr = NULL; } - // Get suffix if present - char suffix = 0, lsuffix = 0; - if(arglen > 1) { - suffix = toupper(argi[arglen - 1]); - lsuffix = toupper(argi[arglen - 2]); - if (suffix == 'L' && lsuffix == 'L') { - argi[arglen -= 2] = '\0'; - data.size = 8; - } else if (suffix == 'L' || suffix == 'l') { - argi[--arglen] = '\0'; - data.size = 4; - } else if ((suffix == 'F') && - strncmp(argi, "0x", 2) && strncmp(argi, "-0x", 3) && strncmp(argi, "+0x", 3)) { - argi[--arglen] = '\0'; - data.size = 4; - } else if (suffix == 'H' && lsuffix == 'H') { - argi[arglen -= 2] = '\0'; - data.size = 1; - } else if (suffix == 'H' || suffix == 'S') { - argi[--arglen] = '\0'; - data.size = 2; - } else if (suffix == '\'') { - data.size = 1; + // Try integers and assign data size + errno = 0; + data.ull = strtoull(argi, &end_ptr, 0); + if (!(end_ptr == argi || errno)) { + unsigned int nu=0, nl=0, nh=0, ns=0, nx=0; + char *p; + + // parse suffixes: ULL, LL, UL, L ... UHH, HH + for(p=end_ptr; *p; p++) + switch(toupper(*p)) { + case 'U': nu++; break; + case 'L': nl++; break; + case 'H': nh++; break; + case 'S': ns++; break; + default: nx++; + } + + if(nx==0 && nu<2 && nl<3 && nh<3 && ns<2) { // could be valid integer suffix + if(nu==0 || toupper(*end_ptr) == 'U' || toupper(p[-1]) == 'U') { // if U, then must be at start or end + bool is_hex = strncasecmp(argi, "0x", 2) == 0; // ordinary hex: "0x..." without explicit +/- sign + bool is_signed = !(nu || is_hex); // neither explicitly unsigned nor ordinary hex + bool is_outside_int64_t = 0; + bool is_out_of_range = 0; + int nhexdigs = p-argi-2; + + if(is_signed) { // Is input in range for int64_t? + errno = 0; (void) strtoll(argi, NULL, 0); + is_outside_int64_t = errno == ERANGE; + } + + if(nl==0 && ns==0 && nh==0) { // no explicit data size + // ordinary hex numbers have "implicit" size, given by number of hex digits, including leading zeros + if(is_hex) { + data.size = nhexdigs > 8? 8: nhexdigs > 4? 4: nhexdigs > 2? 2: 1; + + } else if(is_signed) { + // smallest size that fits signed representation + data.size = + is_outside_int64_t? 8: + data.ll < INT32_MIN || data.ll > INT32_MAX? 8: + data.ll < INT16_MIN || data.ll > INT16_MAX? 4: + data.ll < INT8_MIN || data.ll > INT8_MAX? 2: 1; + + } else { + // smallest size that fits unsigned representation + data.size = + data.ull > UINT32_MAX? 8: + data.ull > UINT16_MAX? 4: + data.ull > UINT8_MAX? 2: 1; + } + } else if(nl==0 && nh==2 && ns==0) { // HH + data.size = 1; + if(is_outside_int64_t || (is_signed && (data.ll < INT8_MIN || data.ll > INT8_MAX))) { + is_out_of_range = 1; + data.ll = (int8_t) data.ll; + } + } else if(nl==0 && ((nh==1 && ns==0) || (nh==0 && ns==1))) { // H or S + data.size = 2; + if(is_outside_int64_t || (is_signed && (data.ll < INT16_MIN || data.ll > INT16_MAX))) { + is_out_of_range = 1; + data.ll = (int16_t) data.ll; + } + } else if(nl==1 && nh==0 && ns==0) { // L + data.size = 4; + if(is_outside_int64_t || (is_signed && (data.ll < INT32_MIN || data.ll > INT32_MAX))) { + is_out_of_range = 1; + data.ll = (int32_t) data.ll; + } + } else if(nl==2 && nh==0 && ns==0) { // LL + data.size = 8; + } + + if(is_outside_int64_t || is_out_of_range) + avrdude_message(MSG_INFO, "%s (write): %s out of int%d_t range, " + "interpreted as %d-byte %lld%s; consider 'U' suffix\n", + progname, argi, data.size*8, data.size, data.ll, + is_out_of_range? " (unlikely what you want)": "" + ); + } } } - // Try integers - errno = 0; - data.ll = strtoull(argi, &end_ptr, 0); - if (!(end_ptr == argi || errno)) { + if(!data.size) { // Data item was not recognised as integer // Try float data.f = strtof(argi, &end_ptr); - data.is_float = true; - if (*end_ptr || (end_ptr == argi)) { - data.is_float = false; + if (end_ptr != argi && toupper(*end_ptr) == 'F' && end_ptr[1] == 0) { + data.is_float = true; + data.size = 4; + } else { // Try single character if (argi[0] == '\'' && argi[2] == '\'') { data.ll = argi[1]; + data.size = 1; } else { // Try string that starts and ends with quotes if (argi[0] == '\"' && argi[arglen - 1] == '\"') { @@ -503,35 +559,6 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } } } - - // Print warning if data size might be ambiguous - bool is_hex = (strncmp(argi, "0x", 2) == 0); - bool is_neg_hex = (strncmp(argi, "-0x", 3) == 0); - bool leading_zero = (strncmp(argi, "0x0", 3) == 0); - int8_t hex_digits = (arglen - 2); - if(!data.size // No pre-defined size - && (is_neg_hex // Hex with - sign in front - || (is_hex && leading_zero && (hex_digits & (hex_digits - 1))) // Hex with 3, 5, 6 or 7 digits - || (!is_hex && !data.is_float && llabs(data.ll) > 0xFF && arglen > 2))) // Base10 int greater than 255 - { - avrdude_message(MSG_INFO, "Warning: no size suffix specified for \"%s\". " - "Writing %d byte(s)\n", - argi, - llabs(data.ll) > UINT32_MAX ? 8 : - llabs(data.ll) > UINT16_MAX || data.is_float ? 4 : \ - llabs(data.ll) > UINT8_MAX ? 2 : 1); - } - // Adjust size if signed integer - if (data.ll < 0 && !data.is_float) { - if (data.ll < INT32_MIN) - data.size = 8; - else if (data.ll < INT16_MIN) - data.size = 4; - else if (data.ll < INT8_MIN) - data.size = 2; - else - data.size = 1; - } } if(data.str_ptr) { for(int16_t j = 0; j < strlen(data.str_ptr); j++) @@ -912,7 +939,7 @@ static int cmd_help(PROGRAMMER * pgm, struct avrpart * p, fprintf(stdout, cmd[i].desc, cmd[i].name); fprintf(stdout, "\n"); } - fprintf(stdout, + fprintf(stdout, "\nUse the 'part' command to display valid memory types for use with the\n" "'dump' and 'write' commands.\n\n"); @@ -989,9 +1016,9 @@ static int tokenize(char * s, char *** argv) slen = strlen(s); - /* + /* * initialize allow for 20 arguments, use realloc to grow this if - * necessary + * necessary */ nargs = 20; bufsize = slen + 20; @@ -1047,7 +1074,7 @@ static int tokenize(char * s, char *** argv) } } - /* + /* * We have parsed all the args, n == argc, bufv contains an array of * pointers to each arg, and buf points to one memory block that * contains all the args, back to back, seperated by a nul @@ -1140,7 +1167,7 @@ int terminal_mode(PROGRAMMER * pgm, struct avrpart * p) rc = 0; while ((cmdbuf = terminal_get_input("avrdude> ")) != NULL) { - /* + /* * find the start of the command, skipping any white space */ q = cmdbuf; @@ -1175,5 +1202,3 @@ int terminal_mode(PROGRAMMER * pgm, struct avrpart * p) return rc; } - - From feda75b60a20c3bfdc06af3c739e26c9c3b106c5 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:35:27 +0100 Subject: [PATCH 092/511] Remove unnecessary bool is_float in terminal write --- src/term.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/term.c b/src/term.c index 96ed8e57..7481f0ee 100644 --- a/src/term.c +++ b/src/term.c @@ -413,7 +413,6 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, // Data info int32_t bytes_grown; uint8_t size; - bool is_float; char * str_ptr; // Data union union { @@ -425,7 +424,6 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } data = { .bytes_grown = 0, .size = 0, - .is_float = false, .str_ptr = NULL, .ll = 0 }; @@ -436,7 +434,6 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, char *argi = argv[i]; size_t arglen = strlen(argi); - data.is_float = false; data.size = 0; // Free string pointer if already allocated @@ -531,7 +528,6 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, // Try float data.f = strtof(argi, &end_ptr); if (end_ptr != argi && toupper(*end_ptr) == 'F' && end_ptr[1] == 0) { - data.is_float = true; data.size = 4; } else { // Try single character @@ -565,9 +561,9 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, buf[i - start_offset + data.bytes_grown++] = (uint8_t)data.str_ptr[j]; } else { buf[i - start_offset + data.bytes_grown] = data.a[0]; - if (llabs(data.ll) > 0x000000FF || data.size >= 2 || data.is_float) + if (llabs(data.ll) > 0x000000FF || data.size >= 2) buf[i - start_offset + ++data.bytes_grown] = data.a[1]; - if (llabs(data.ll) > 0x0000FFFF || data.size >= 4 || data.is_float) { + if (llabs(data.ll) > 0x0000FFFF || data.size >= 4) { buf[i - start_offset + ++data.bytes_grown] = data.a[2]; buf[i - start_offset + ++data.bytes_grown] = data.a[3]; } From 9fe6820236169bd154bb54cff867351900795fcf Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:36:57 +0100 Subject: [PATCH 093/511] Add double type for terminal write in anticipation of future avr-libc extension --- src/term.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/term.c b/src/term.c index 7481f0ee..6efa380a 100644 --- a/src/term.c +++ b/src/term.c @@ -417,6 +417,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, // Data union union { float f; + double d; int64_t ll; uint64_t ull; uint8_t a[8]; @@ -524,12 +525,19 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } } - if(!data.size) { // Data item was not recognised as integer - // Try float + if(!data.size) { // Try float data.f = strtof(argi, &end_ptr); - if (end_ptr != argi && toupper(*end_ptr) == 'F' && end_ptr[1] == 0) { + if (end_ptr != argi && toupper(*end_ptr) == 'F' && end_ptr[1] == 0) data.size = 4; - } else { + } + + if(!data.size) { // Try double + data.d = strtod(argi, &end_ptr); + if (end_ptr != argi && *end_ptr == 0) + data.size = 8; + } + + if(!data.size) { // Try single character if (argi[0] == '\'' && argi[2] == '\'') { data.ll = argi[1]; @@ -553,7 +561,6 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, return -1; } } - } } } if(data.str_ptr) { From 5c4cfa642aa32d268224c503555e3a1b196b38df Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:39:02 +0100 Subject: [PATCH 094/511] Parse terminal writes of string and character constants in C-style --- src/term.c | 221 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 200 insertions(+), 21 deletions(-) diff --git a/src/term.c b/src/term.c index 6efa380a..cd7e3b45 100644 --- a/src/term.c +++ b/src/term.c @@ -335,6 +335,179 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, } + +// convert the next n hex digits of s to a hex number +static unsigned int tohex(const char *s, unsigned int n) { + int ret, c; + + ret = 0; + while(n--) { + ret *= 16; + c = *s++; + ret += c >= '0' && c <= '9'? c - '0': c >= 'a' && c <= 'f'? c - 'a' + 10: c - 'A' + 10; + } + + return ret; +} + +/* + * Create a utf-8 character sequence from a single unicode character. + * Permissive for some invalid unicode sequences but not for those with + * high bit set). Returns numbers of characters written (0-6). + */ +static int wc_to_utf8str(unsigned int wc, char *str) { + if(!(wc & ~0x7fu)) { + *str = (char) wc; + return 1; + } + if(!(wc & ~0x7ffu)) { + *str++ = (char) ((wc >> 6) | 0xc0); + *str++ = (char) ((wc & 0x3f) | 0x80); + return 2; + } + if(!(wc & ~0xffffu)) { + *str++ = (char) ((wc >> 12) | 0xe0); + *str++ = (char) (((wc >> 6) & 0x3f) | 0x80); + *str++ = (char) ((wc & 0x3f) | 0x80); + return 3; + } + if(!(wc & ~0x1fffffu)) { + *str++ = (char) ((wc >> 18) | 0xf0); + *str++ = (char) (((wc >> 12) & 0x3f) | 0x80); + *str++ = (char) (((wc >> 6) & 0x3f) | 0x80); + *str++ = (char) ((wc & 0x3f) | 0x80); + return 4; + } + if(!(wc & ~0x3ffffffu)) { + *str++ = (char) ((wc >> 24) | 0xf8); + *str++ = (char) (((wc >> 18) & 0x3f) | 0x80); + *str++ = (char) (((wc >> 12) & 0x3f) | 0x80); + *str++ = (char) (((wc >> 6) & 0x3f) | 0x80); + *str++ = (char) ((wc & 0x3f) | 0x80); + return 5; + } + if(!(wc & ~0x7fffffffu)) { + *str++ = (char) ((wc >> 30) | 0xfc); + *str++ = (char) (((wc >> 24) & 0x3f) | 0x80); + *str++ = (char) (((wc >> 18) & 0x3f) | 0x80); + *str++ = (char) (((wc >> 12) & 0x3f) | 0x80); + *str++ = (char) (((wc >> 6) & 0x3f) | 0x80); + *str++ = (char) ((wc & 0x3f) | 0x80); + return 6; + } + return 0; +} + +// Unescape C-style strings, destination d must hold enough space (and can be source s) +static char *unescape(char *d, const char *s) { + char *ret = d; + int n, k; + + while(*s) { + switch (*s) { + case '\\': + switch (*++s) { + case 'n': + *d = '\n'; + break; + case 't': + *d = '\t'; + break; + case 'a': + *d = '\a'; + break; + case 'b': + *d = '\b'; + break; + case 'e': // non-standard ESC + *d = 27; + break; + case 'f': + *d = '\f'; + break; + case 'r': + *d = '\r'; + break; + case 'v': + *d = '\v'; + break; + case '?': + *d = '?'; + break; + case '`': + *d = '`'; + break; + case '"': + *d = '"'; + break; + case '\'': + *d = '\''; + break; + case '\\': + *d = '\\'; + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': // 1-3 octal digits + n = *s - '0'; + for(k = 0; k < 2 && s[1] >= '0' && s[1] <= '7'; k++) // max 2 more octal characters + n *= 8, n += s[1] - '0', s++; + *d = n; + break; + case 'x': // unlimited hex digits + for(k = 0; isxdigit(s[k + 1]); k++) + continue; + if(k > 0) { + *d = tohex(s + 1, k); + s += k; + } else { // no hex digits after \x? copy \x + *d++ = '\\'; + *d = 'x'; + } + break; + case 'u': // exactly 4 hex digits and valid unicode + if(isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) && + (n = wc_to_utf8str(tohex(s+1, 4), d))) { + d += n - 1; + s += 4; + } else { // invalid \u sequence? copy \u + *d++ = '\\'; + *d = 'u'; + } + break; + case 'U': // exactly 6 hex digits and valid unicode + if(isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) && isxdigit(s[5]) && isxdigit(s[6]) && + (n = wc_to_utf8str(tohex(s+1, 6), d))) { + d += n - 1; + s += 6; + } else { // invalid \U sequence? copy \U + *d++ = '\\'; + *d = 'U'; + } + break; + default: // keep the escape sequence (C would warn and remove \) + *d++ = '\\'; + *d = *s; + } + break; + + default: // not an escape sequence: just copy the character + *d = *s; + } + d++; + s++; + } + *d = *s; // terminate + + return ret; +} + + static size_t maxstrlen(int argc, char **argv) { size_t max = 0; @@ -537,32 +710,38 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, data.size = 8; } - if(!data.size) { - // Try single character - if (argi[0] == '\'' && argi[2] == '\'') { - data.ll = argi[1]; - data.size = 1; - } else { - // Try string that starts and ends with quotes - if (argi[0] == '\"' && argi[arglen - 1] == '\"') { - data.str_ptr = calloc(arglen, sizeof(char)); - if (data.str_ptr == NULL) { - avrdude_message(MSG_INFO, "%s (write str): out of memory\n", progname); - return -1; - } - // Strip start and end quotes - strncpy(data.str_ptr, argi + 1, arglen - 2); - } else { - avrdude_message(MSG_INFO, "\n%s (write): can't parse data '%s'\n", - progname, argi); + if(!data.size) { // Try C-style string or single character + if ((*argi == '\'' && argi[arglen-1] == '\'') || (*argi == '\"' && argi[arglen-1] == '\"')) { + char *s = calloc(arglen-1, 1); + if (s == NULL) { + avrdude_message(MSG_INFO, "%s (write str): out of memory\n", progname); free(buf); - if(data.str_ptr != NULL) - free(data.str_ptr); return -1; - } } + // Strip start and end quotes, and unescape C string + strncpy(s, argi+1, arglen-2); + unescape(s, s); + if (*argi == '\'') { // single C-style character + if(*s && s[1]) + avrdude_message(MSG_INFO, "%s (write): only using first character of %s\n", + progname, argi); + data.ll = *s; + data.size = 1; + free(s); + } else { // C-style string + data.str_ptr = s; + } + } else { + avrdude_message(MSG_INFO, "\n%s (write): can't parse data '%s'\n", + progname, argi); + free(buf); + if(data.str_ptr != NULL) + free(data.str_ptr); + return -1; + } } } + if(data.str_ptr) { for(int16_t j = 0; j < strlen(data.str_ptr); j++) buf[i - start_offset + data.bytes_grown++] = (uint8_t)data.str_ptr[j]; From 0b2f38c67d3501f997a7840ff2f0791cfc3e06cd Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:39:52 +0100 Subject: [PATCH 095/511] Allow optional comma separators for data items in terminal write --- src/term.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/term.c b/src/term.c index cd7e3b45..f4472452 100644 --- a/src/term.c +++ b/src/term.c @@ -616,6 +616,10 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, data.str_ptr = NULL; } + // remove trailing comma to allow cut and paste of lists + if(arglen > 0 && argi[arglen-1] == ',') + argi[--arglen] = 0; + // Try integers and assign data size errno = 0; data.ull = strtoull(argi, &end_ptr, 0); From ddffabe86adb3aa3aabc24ea2f7829725602e5b9 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:40:40 +0100 Subject: [PATCH 096/511] Improve terminal write usage message --- src/term.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/term.c b/src/term.c index f4472452..1b563f46 100644 --- a/src/term.c +++ b/src/term.c @@ -523,10 +523,33 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, { if (argc < 4) { avrdude_message(MSG_INFO, - "Usage: write \n" - " write <...>\n\n" - " Add a suffix to manually specify the size for each field:\n" - " HH/hh: 8-bit, H/h/S/s: 16-bit, L/l: 32-bit, LL/ll: 64-bit, F/f: 32-bit float\n"); + "Usage: write [,] {[,]} \n" + " write [,] {[,]} ...\n" + "\n" + "Ellipsis ... writes bytes padded by repeating the last item.\n" + "\n" + " can be hexadecimal, octal or decimal integers, double, float or\n" + "C-style strings and chars. For numbers, an optional case-insensitive suffix\n" + "specifies the data size: HH: 8 bit, H/S: 16 bit, L: 32 bit, LL: 64 bit, F:\n" + "32-bit float. Hexadecimal floating point notation is supported. The\n" + "ambiguous trailing F in 0x1.8F makes the number be interpreted as double;\n" + "use a zero exponent as in 0x1.8p0F to denote a hexadecimal float.\n" + "\n" + "An optional U suffix makes a number unsigned. Ordinary 0x hex numbers are\n" + "always treated as unsigned. +0x or -0x hex numbers are treated as signed\n" + "unless they have a U suffix. Unsigned integers cannot be larger than 2^64-1.\n" + "If n is an unsigned integer then -n is also a valid unsigned integer as in C.\n" + "Signed integers must fall into the [-2^63, 2^63-1] range or a correspondingly\n" + "smaller range when a suffix specifies a smaller type. Out of range signed\n" + "numbers trigger a warning.\n" + "\n" + "Ordinary 0x hex numbers with n hex digits (counting leading zeros) use\n" + "the smallest size of 1, 2, 4 and 8 bytes that can accommodate any n-digit hex\n" + "number. If a suffix specifies a size explicitly the corresponding number of\n" + "least significant bytes are written. Otherwise, signed and unsigned integers\n" + "alike occupy the smallest of 1, 2, 4, or 8 bytes needed to accommodate them\n" + "in their respective representation.\n" + ); return -1; } From aa09bcf9007481791f19ed3ac9e531aa1a04c54c Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:42:59 +0100 Subject: [PATCH 097/511] Ensure terminal writes little endian numbers --- src/term.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/term.c b/src/term.c index 1b563f46..65e5c850 100644 --- a/src/term.c +++ b/src/term.c @@ -518,6 +518,16 @@ static size_t maxstrlen(int argc, char **argv) { return max; } + +// Change data item p of size bytes from big endian to little endian and vice versa +static void change_endian(void *p, int size) { + uint8_t tmp, *w = p; + + for(int i=0; i 1) + change_endian(data.a, data.size); } if(data.str_ptr) { From 7205bbae80eb033978bd1c3ffc26d81c0b424522 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:43:45 +0100 Subject: [PATCH 098/511] Enhance terminal read with new mode: read --- src/term.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/term.c b/src/term.c index 65e5c850..441868e0 100644 --- a/src/term.c +++ b/src/term.c @@ -255,7 +255,8 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, // Get start address if present char * end_ptr; static uint32_t addr = 0; - if (argc == 4) { + + if (argc >= 3 && strcmp(argv[2], "...") != 0) { addr = strtoul(argv[2], &end_ptr, 0); if (*end_ptr || (end_ptr == argv[2])) { avrdude_message(MSG_INFO, "%s (%s): can't parse address \"%s\"\n", From 602e9bb80c85c162a2c448b42c341e4249369640 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:44:20 +0100 Subject: [PATCH 099/511] Change size for memory type variable in terminal read --- src/term.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/term.c b/src/term.c index 441868e0..fe3cebfc 100644 --- a/src/term.c +++ b/src/term.c @@ -242,7 +242,7 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, } enum { read_size = 256 }; - static char prevmem[128] = {0x00}; + static char prevmem[AVR_MEMDESCLEN] = {0x00}; char * memtype = argv[1]; AVRMEM * mem = avr_locate_mem(p, memtype); if (mem == NULL) { From 92425af0cc004ee5466ec0c576d8152d10a3b5c5 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:47:33 +0100 Subject: [PATCH 100/511] Improve terminal dump usage message --- src/term.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/term.c b/src/term.c index fe3cebfc..01fb2560 100644 --- a/src/term.c +++ b/src/term.c @@ -232,13 +232,15 @@ static int hexdump_buf(FILE * f, int startaddr, unsigned char * buf, int len) static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, int argc, char * argv[]) { - if (argc < 2) { - avrdude_message(MSG_INFO, "Usage: %s [ ]\n" - " %s [ <...>]\n" - " %s <...>\n" - " %s \n", - argv[0], argv[0], argv[0], argv[0]); - return -1; + if (argc < 2 || argc > 4) { + avrdude_message(MSG_INFO, + "Usage: %s \n" + " %s ...\n" + " %s \n" + " %s ...\n" + " %s \n", + argv[0], argv[0], argv[0], argv[0], argv[0]); + return -1; } enum { read_size = 256 }; From c5f522342d394bb8a6b22879dc79be413ea93558 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:50:23 +0100 Subject: [PATCH 101/511] Improve terminal help message --- src/term.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/term.c b/src/term.c index 01fb2560..3e9fdd59 100644 --- a/src/term.c +++ b/src/term.c @@ -92,13 +92,13 @@ static int cmd_verbose (PROGRAMMER * pgm, struct avrpart * p, int argc, char *argv[]); struct command cmd[] = { - { "dump", cmd_dump, "dump memory : %s " }, + { "dump", cmd_dump, "%s [ | ... | | ...]" }, { "read", cmd_dump, "alias for dump" }, - { "write", cmd_write, "write memory : %s ... " }, + { "write", cmd_write, "%s [[,] {[,]} | [,] {[,]} ...]" }, { "erase", cmd_erase, "perform a chip erase" }, { "sig", cmd_sig, "display device signature bytes" }, { "part", cmd_part, "display the current part information" }, - { "send", cmd_send, "send a raw command : %s " }, + { "send", cmd_send, "send a raw command: %s " }, { "parms", cmd_parms, "display adjustable parameters (STK500 and Curiosity Nano only)" }, { "vtarg", cmd_vtarg, "set (STK500 and Curiosity Nano only)" }, { "varef", cmd_varef, "set (STK500 only)" }, @@ -1162,9 +1162,9 @@ static int cmd_help(PROGRAMMER * pgm, struct avrpart * p, { int i; - fprintf(stdout, "Valid commands:\n\n"); + fprintf(stdout, "Valid commands:\n"); for (i=0; i Date: Tue, 12 Jul 2022 11:51:04 +0100 Subject: [PATCH 102/511] Remove echo of tokenised terminal command --- src/term.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/term.c b/src/term.c index 3e9fdd59..e7185593 100644 --- a/src/term.c +++ b/src/term.c @@ -1388,7 +1388,6 @@ char * terminal_get_input(const char *prompt) int terminal_mode(PROGRAMMER * pgm, struct avrpart * p) { char * cmdbuf; - int i; char * q; int rc; int argc; @@ -1414,10 +1413,12 @@ int terminal_mode(PROGRAMMER * pgm, struct avrpart * p) return argc; } +#if 0 fprintf(stdout, ">>> "); - for (i=0; i Date: Tue, 12 Jul 2022 11:58:51 +0100 Subject: [PATCH 103/511] Consolidate error messages in term.c --- src/term.c | 149 ++++++++++++++++++++++++++--------------------------- 1 file changed, 74 insertions(+), 75 deletions(-) diff --git a/src/term.c b/src/term.c index e7185593..6d146c66 100644 --- a/src/term.c +++ b/src/term.c @@ -248,8 +248,8 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, char * memtype = argv[1]; AVRMEM * mem = avr_locate_mem(p, memtype); if (mem == NULL) { - avrdude_message(MSG_INFO, "\"%s\" memory type not defined for part \"%s\"\n", - memtype, p->desc); + avrdude_message(MSG_INFO, "%s (dump): %s memory type not defined for part %s\n", + progname, memtype, p->desc); return -1; } uint32_t maxsize = mem->size; @@ -261,12 +261,12 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, if (argc >= 3 && strcmp(argv[2], "...") != 0) { addr = strtoul(argv[2], &end_ptr, 0); if (*end_ptr || (end_ptr == argv[2])) { - avrdude_message(MSG_INFO, "%s (%s): can't parse address \"%s\"\n", - progname, argv[0], argv[2]); + avrdude_message(MSG_INFO, "%s (dump): can't parse address %s\n", + progname, argv[2]); return -1; } else if (addr >= maxsize) { - avrdude_message(MSG_INFO, "%s (%s): address 0x%05lx is out of range for %s memory\n", - progname, argv[0], addr, mem->desc); + avrdude_message(MSG_INFO, "%s (dump): address 0x%05lx is out of range for %s memory\n", + progname, (long) addr, mem->desc); return -1; } } @@ -282,8 +282,8 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, } else if (argc == 4) { len = strtol(argv[3], &end_ptr, 0); if (*end_ptr || (end_ptr == argv[3])) { - avrdude_message(MSG_INFO, "%s (%s): can't parse length \"%s\"\n", - progname, argv[0], argv[3]); + avrdude_message(MSG_INFO, "%s (dump): can't parse length %s\n", + progname, argv[3]); return -1; } } else { @@ -317,10 +317,10 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, int32_t rc = pgm->read_byte(pgm, p, mem, addr + i, &buf[i]); if (rc != 0) { avrdude_message(MSG_INFO, "error reading %s address 0x%05lx of part %s\n", - mem->desc, addr + i, p->desc); + mem->desc, (long) addr + i, p->desc); if (rc == -1) - avrdude_message(MSG_INFO, "read operation not supported on memory type \"%s\"\n", - mem->desc); + avrdude_message(MSG_INFO, "read operation not supported on memory type %s\n", + mem->desc); return -1; } report_progress(i, len, NULL); @@ -573,8 +573,8 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, char * memtype = argv[1]; // Memory name string AVRMEM * mem = avr_locate_mem(p, memtype); if (mem == NULL) { - avrdude_message(MSG_INFO, "\"%s\" memory type not defined for part \"%s\"\n", - memtype, p->desc); + avrdude_message(MSG_INFO, "%s memory type not defined for part %s\n", + memtype, p->desc); return -1; } uint32_t maxsize = mem->size; @@ -582,14 +582,14 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, char * end_ptr; int32_t addr = strtoul(argv[2], &end_ptr, 0); if (*end_ptr || (end_ptr == argv[2])) { - avrdude_message(MSG_INFO, "%s (write): can't parse address \"%s\"\n", - progname, argv[2]); + avrdude_message(MSG_INFO, "%s (write): can't parse address %s\n", + progname, argv[2]); return -1; } if (addr > maxsize) { avrdude_message(MSG_INFO, "%s (write): address 0x%05lx is out of range for %s memory\n", - progname, addr, memtype); + progname, (long) addr, memtype); return -1; } @@ -606,8 +606,8 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, start_offset = 4; len = strtoul(argv[3], &end_ptr, 0); if (*end_ptr || (end_ptr == argv[3])) { - avrdude_message(MSG_INFO, "%s (write ...): can't parse length \"%s\"\n", - progname, argv[3]); + avrdude_message(MSG_INFO, "%s (write ...): can't parse length %s\n", + progname, argv[3]); free(buf); return -1; } @@ -639,7 +639,8 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, }; if(sizeof(long long) != sizeof(int64_t) || (data.a[0]^data.a[7]) != 1) - avrdude_message(MSG_INFO, "%s (write): assumption on data types not met? check source and recompile\n", progname); + avrdude_message(MSG_INFO, "%s (write): assumption on data types not met? " + "Check source and recompile\n", progname); bool is_big_endian = data.a[7]; for (i = start_offset; i < len + start_offset; i++) { @@ -734,10 +735,8 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, if(is_outside_int64_t || is_out_of_range) avrdude_message(MSG_INFO, "%s (write): %s out of int%d_t range, " - "interpreted as %d-byte %lld%s; consider 'U' suffix\n", - progname, argi, data.size*8, data.size, data.ll, - is_out_of_range? " (unlikely what you want)": "" - ); + "interpreted as %d-byte %lld; consider 'U' suffix\n", + progname, argi, data.size*8, data.size, data.ll); } } } @@ -768,7 +767,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, if (*argi == '\'') { // single C-style character if(*s && s[1]) avrdude_message(MSG_INFO, "%s (write): only using first character of %s\n", - progname, argi); + progname, argi); data.ll = *s; data.size = 1; free(s); @@ -776,8 +775,8 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, data.str_ptr = s; } } else { - avrdude_message(MSG_INFO, "\n%s (write): can't parse data '%s'\n", - progname, argi); + avrdude_message(MSG_INFO, "%s (write): can't parse data %s\n", + progname, argi); free(buf); if(data.str_ptr != NULL) free(data.str_ptr); @@ -819,8 +818,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, if ((addr + len + data.bytes_grown) > maxsize) { avrdude_message(MSG_INFO, "%s (write): selected address and # bytes exceed " - "range for %s memory\n", - progname, memtype); + "range for %s memory\n", progname, memtype); free(buf); return -1; } @@ -828,8 +826,8 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, if(data.str_ptr) free(data.str_ptr); - avrdude_message(MSG_NOTICE, "\nInfo: Writing %d bytes starting from address 0x%02x", - len + data.bytes_grown, addr); + avrdude_message(MSG_NOTICE, "\nInfo: Writing %d bytes starting from address 0x%02lx", + len + data.bytes_grown, (long) addr); if (write_mode == WRITE_MODE_FILL) avrdude_message(MSG_NOTICE, ". Remaining space filled with %s", argv[argc - 2]); avrdude_message(MSG_NOTICE, "\n"); @@ -841,10 +839,10 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, int32_t rc = avr_write_byte(pgm, p, mem, addr+i, buf[i]); if (rc) { avrdude_message(MSG_INFO, "%s (write): error writing 0x%02x at 0x%05lx, rc=%d\n", - progname, buf[i], addr+i, rc); + progname, buf[i], (long) addr+i, (int) rc); if (rc == -1) - avrdude_message(MSG_INFO, "write operation not supported on memory type \"%s\"\n", - mem->desc); + avrdude_message(MSG_INFO, "write operation not supported on memory type %s\n", + mem->desc); werror = true; } @@ -852,7 +850,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, rc = pgm->read_byte(pgm, p, mem, addr+i, &b); if (b != buf[i]) { avrdude_message(MSG_INFO, "%s (write): error writing 0x%02x at 0x%05lx cell=0x%02x\n", - progname, buf[i], addr+i, b); + progname, buf[i], (long) addr+i, b); werror = true; } @@ -879,14 +877,14 @@ static int cmd_send(PROGRAMMER * pgm, struct avrpart * p, int len; if (pgm->cmd == NULL) { - avrdude_message(MSG_INFO, "The %s programmer does not support direct ISP commands.\n", - pgm->type); + avrdude_message(MSG_INFO, "%s (send): the %s programmer does not support direct ISP commands\n", + progname, pgm->type); return -1; } if (spi_mode && (pgm->spi == NULL)) { - avrdude_message(MSG_INFO, "The %s programmer does not support direct SPI transfers.\n", - pgm->type); + avrdude_message(MSG_INFO, "%s (send): the %s programmer does not support direct SPI transfers\n", + progname, pgm->type); return -1; } @@ -905,8 +903,8 @@ static int cmd_send(PROGRAMMER * pgm, struct avrpart * p, for (i=1; idesc); + avrdude_message(MSG_INFO, "%s (sig): signature data not defined for device %s\n", + progname, p->desc); } else { fprintf(stdout, "Device signature = 0x"); @@ -997,8 +995,7 @@ static int cmd_parms(PROGRAMMER * pgm, struct avrpart * p, { if (pgm->print_parms == NULL) { avrdude_message(MSG_INFO, "%s (parms): the %s programmer does not support " - "adjustable parameters\n", - progname, pgm->type); + "adjustable parameters\n", progname, pgm->type); return -1; } pgm->print_parms(pgm); @@ -1020,18 +1017,18 @@ static int cmd_vtarg(PROGRAMMER * pgm, struct avrpart * p, } v = strtod(argv[1], &endp); if (endp == argv[1]) { - avrdude_message(MSG_INFO, "%s (vtarg): can't parse voltage \"%s\"\n", - progname, argv[1]); + avrdude_message(MSG_INFO, "%s (vtarg): can't parse voltage %s\n", + progname, argv[1]); return -1; } if (pgm->set_vtarget == NULL) { avrdude_message(MSG_INFO, "%s (vtarg): the %s programmer cannot set V[target]\n", - progname, pgm->type); + progname, pgm->type); return -2; } if ((rc = pgm->set_vtarget(pgm, v)) != 0) { avrdude_message(MSG_INFO, "%s (vtarg): failed to set V[target] (rc = %d)\n", - progname, rc); + progname, rc); return -3; } return 0; @@ -1054,8 +1051,8 @@ static int cmd_fosc(PROGRAMMER * pgm, struct avrpart * p, if (strcmp(argv[1], "off") == 0) v = 0.0; else { - avrdude_message(MSG_INFO, "%s (fosc): can't parse frequency \"%s\"\n", - progname, argv[1]); + avrdude_message(MSG_INFO, "%s (fosc): can't parse frequency %s\n", + progname, argv[1]); return -1; } } @@ -1065,12 +1062,12 @@ static int cmd_fosc(PROGRAMMER * pgm, struct avrpart * p, v *= 1e3; if (pgm->set_fosc == NULL) { avrdude_message(MSG_INFO, "%s (fosc): the %s programmer cannot set oscillator frequency\n", - progname, pgm->type); + progname, pgm->type); return -2; } if ((rc = pgm->set_fosc(pgm, v)) != 0) { avrdude_message(MSG_INFO, "%s (fosc): failed to set oscillator frequency (rc = %d)\n", - progname, rc); + progname, rc); return -3; } return 0; @@ -1090,19 +1087,19 @@ static int cmd_sck(PROGRAMMER * pgm, struct avrpart * p, } v = strtod(argv[1], &endp); if (endp == argv[1]) { - avrdude_message(MSG_INFO, "%s (sck): can't parse period \"%s\"\n", - progname, argv[1]); + avrdude_message(MSG_INFO, "%s (sck): can't parse period %s\n", + progname, argv[1]); return -1; } v *= 1e-6; /* Convert from microseconds to seconds. */ if (pgm->set_sck_period == NULL) { avrdude_message(MSG_INFO, "%s (sck): the %s programmer cannot set SCK period\n", - progname, pgm->type); + progname, pgm->type); return -2; } if ((rc = pgm->set_sck_period(pgm, v)) != 0) { avrdude_message(MSG_INFO, "%s (sck): failed to set SCK period (rc = %d)\n", - progname, rc); + progname, rc); return -3; } return 0; @@ -1125,32 +1122,32 @@ static int cmd_varef(PROGRAMMER * pgm, struct avrpart * p, chan = 0; v = strtod(argv[1], &endp); if (endp == argv[1]) { - avrdude_message(MSG_INFO, "%s (varef): can't parse voltage \"%s\"\n", - progname, argv[1]); + avrdude_message(MSG_INFO, "%s (varef): can't parse voltage %s\n", + progname, argv[1]); return -1; } } else { chan = strtoul(argv[1], &endp, 10); if (endp == argv[1]) { - avrdude_message(MSG_INFO, "%s (varef): can't parse channel \"%s\"\n", - progname, argv[1]); + avrdude_message(MSG_INFO, "%s (varef): can't parse channel %s\n", + progname, argv[1]); return -1; } v = strtod(argv[2], &endp); if (endp == argv[2]) { - avrdude_message(MSG_INFO, "%s (varef): can't parse voltage \"%s\"\n", - progname, argv[2]); + avrdude_message(MSG_INFO, "%s (varef): can't parse voltage %s\n", + progname, argv[2]); return -1; } } if (pgm->set_varef == NULL) { avrdude_message(MSG_INFO, "%s (varef): the %s programmer cannot set V[aref]\n", - progname, pgm->type); + progname, pgm->type); return -2; } if ((rc = pgm->set_varef(pgm, chan, v)) != 0) { avrdude_message(MSG_INFO, "%s (varef): failed to set V[aref] (rc = %d)\n", - progname, rc); + progname, rc); return -3; } return 0; @@ -1183,7 +1180,8 @@ static int cmd_spi(PROGRAMMER * pgm, struct avrpart * p, spi_mode = 1; return 0; } - avrdude_message(MSG_INFO, "`spi' command unavailable for this programmer type\n"); + avrdude_message(MSG_INFO, "%s: spi command unavailable for this programmer type\n", + progname); return -1; } @@ -1196,7 +1194,8 @@ static int cmd_pgm(PROGRAMMER * pgm, struct avrpart * p, pgm->initialize(pgm, p); return 0; } - avrdude_message(MSG_INFO, "`pgm' command unavailable for this programmer type\n"); + avrdude_message(MSG_INFO, "%s: pgm command unavailable for this programmer type\n", + progname); return -1; } @@ -1216,13 +1215,13 @@ static int cmd_verbose(PROGRAMMER * pgm, struct avrpart * p, } nverb = strtol(argv[1], &endp, 0); if (endp == argv[2]) { - avrdude_message(MSG_INFO, "%s: can't parse verbosity level \"%s\"\n", - progname, argv[2]); + avrdude_message(MSG_INFO, "%s: can't parse verbosity level %s\n", + progname, argv[2]); return -1; } if (nverb < 0) { avrdude_message(MSG_INFO, "%s: verbosity level must be positive: %d\n", - progname, nverb); + progname, nverb); return -1; } verbose = nverb; @@ -1344,8 +1343,8 @@ static int do_cmd(PROGRAMMER * pgm, struct avrpart * p, } else if (strncasecmp(argv[0], cmd[i].name, len)==0) { if (hold != -1) { - avrdude_message(MSG_INFO, "%s: command \"%s\" is ambiguous\n", - progname, argv[0]); + avrdude_message(MSG_INFO, "%s (cmd): command %s is ambiguous\n", + progname, argv[0]); return -1; } hold = i; @@ -1355,8 +1354,8 @@ static int do_cmd(PROGRAMMER * pgm, struct avrpart * p, if (hold != -1) return cmd[hold].func(pgm, p, argc, argv); - avrdude_message(MSG_INFO, "%s: invalid command \"%s\"\n", - progname, argv[0]); + avrdude_message(MSG_INFO, "%s (cmd): invalid command %s\n", + progname, argv[0]); return -1; } From 704d2536368a421da11a1d57c55907bbc027b3c2 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 11:59:42 +0100 Subject: [PATCH 104/511] Remove comparisons between signed and unsigned integers in term.c --- src/term.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/term.c b/src/term.c index 6d146c66..865a413c 100644 --- a/src/term.c +++ b/src/term.c @@ -112,7 +112,7 @@ struct command cmd[] = { { "quit", cmd_quit, "quit" } }; -#define NCMDS (sizeof(cmd)/sizeof(struct command)) +#define NCMDS ((int)(sizeof(cmd)/sizeof(struct command))) @@ -157,8 +157,8 @@ static int hexdump_line(char * buffer, unsigned char * p, int n, int pad) { char * hexdata = "0123456789abcdef"; char * b = buffer; - int32_t i = 0; - int32_t j = 0; + int i = 0; + int j = 0; for (i=0; i len) n = len; hexdump_line(dst1, p, n, 48); @@ -252,11 +252,11 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, progname, memtype, p->desc); return -1; } - uint32_t maxsize = mem->size; + int maxsize = mem->size; // Get start address if present char * end_ptr; - static uint32_t addr = 0; + static int addr = 0; if (argc >= 3 && strcmp(argv[2], "...") != 0) { addr = strtoul(argv[2], &end_ptr, 0); @@ -272,7 +272,7 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, } // Get no. bytes to read if present - static int32_t len = read_size; + static int len = read_size; if (argc >= 3) { memset(prevmem, 0x00, sizeof(prevmem)); if (strcmp(argv[argc - 1], "...") == 0) { @@ -313,8 +313,8 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, } report_progress(0, 1, "Reading"); - for (uint32_t i = 0; i < len; i++) { - int32_t rc = pgm->read_byte(pgm, p, mem, addr + i, &buf[i]); + for (int i = 0; i < len; i++) { + int rc = pgm->read_byte(pgm, p, mem, addr + i, &buf[i]); if (rc != 0) { avrdude_message(MSG_INFO, "error reading %s address 0x%05lx of part %s\n", mem->desc, (long) addr + i, p->desc); @@ -566,10 +566,10 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, return -1; } - int32_t i; + int i; uint8_t write_mode; // Operation mode, "standard" or "fill" uint8_t start_offset; // Which argc argument - int32_t len; // Number of bytes to write to memory + int len; // Number of bytes to write to memory char * memtype = argv[1]; // Memory name string AVRMEM * mem = avr_locate_mem(p, memtype); if (mem == NULL) { @@ -577,10 +577,10 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, memtype, p->desc); return -1; } - uint32_t maxsize = mem->size; + int maxsize = mem->size; char * end_ptr; - int32_t addr = strtoul(argv[2], &end_ptr, 0); + int addr = strtoul(argv[2], &end_ptr, 0); if (*end_ptr || (end_ptr == argv[2])) { avrdude_message(MSG_INFO, "%s (write): can't parse address %s\n", progname, argv[2]); @@ -620,7 +620,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, // Structure related to data that is being written to memory struct Data { // Data info - int32_t bytes_grown; + int bytes_grown; uint8_t size; char * str_ptr; // Data union @@ -789,7 +789,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } if(data.str_ptr) { - for(int16_t j = 0; j < strlen(data.str_ptr); j++) + for(size_t j = 0; j < strlen(data.str_ptr); j++) buf[i - start_offset + data.bytes_grown++] = (uint8_t)data.str_ptr[j]; } else { buf[i - start_offset + data.bytes_grown] = data.a[0]; @@ -836,7 +836,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, bool werror = false; report_progress(0, 1, "Writing"); for (i = 0; i < (len + data.bytes_grown); i++) { - int32_t rc = avr_write_byte(pgm, p, mem, addr+i, buf[i]); + int rc = avr_write_byte(pgm, p, mem, addr+i, buf[i]); if (rc) { avrdude_message(MSG_INFO, "%s (write): error writing 0x%02x at 0x%05lx, rc=%d\n", progname, buf[i], (long) addr+i, (int) rc); @@ -960,7 +960,7 @@ static int cmd_sig(PROGRAMMER * pgm, struct avrpart * p, rc = avr_signature(pgm, p); if (rc != 0) { avrdude_message(MSG_INFO, "%s (sig): error reading signature data, rc=%d\n", - prgname, rc); + progname, rc); } m = avr_locate_mem(p, "signature"); From 7c766ef9bd9dd35c011ad583351909d744222985 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 12:01:14 +0100 Subject: [PATCH 105/511] Refine type detection in terminal write The code no longer accepts valid mantissa-only doubles that are integer rejects, eg, 078 or ULL overflows. These are most likely input errors by the user: 8 is not an octal digit, they might have typed 17 hex digits, not 16. It's just too hard to explain that 0xffffFFFFffffFFFFf writes 0x4430000000000000, which is the correct double representation of the valid 17-digit hex mantissa that strtod() is perfectly happy to accept. --- src/term.c | 55 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/src/term.c b/src/term.c index 865a413c..1f5ec4b4 100644 --- a/src/term.c +++ b/src/term.c @@ -531,6 +531,30 @@ static void change_endian(void *p, int size) { } +// Looks like a double mantissa in hex or dec notation +static int is_mantissa_only(char *p) { + char *digs; + + if(*p == '+' || *p == '-') + p++; + + if(*p == '0' && (p[1] == 'x' || p[1] == 'X')) { + p += 2; + digs = "0123456789abcdefABCDEF"; + } else + digs = "0123456789"; + + if(!*p) + return 0; + + while(*p) + if(!strchr(digs, *p++)) + return 0; + + return 1; +} + + static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, int argc, char * argv[]) { @@ -741,18 +765,20 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } } + if(!data.size) { // Try double now that input was rejected as integer + data.d = strtod(argi, &end_ptr); + // Do not accept valid doubles that are integer rejects (eg, 078 or ULL overflows) + if (end_ptr != argi && *end_ptr == 0) + if (!is_mantissa_only(argi)) + data.size = 8; + } + if(!data.size) { // Try float data.f = strtof(argi, &end_ptr); if (end_ptr != argi && toupper(*end_ptr) == 'F' && end_ptr[1] == 0) data.size = 4; } - if(!data.size) { // Try double - data.d = strtod(argi, &end_ptr); - if (end_ptr != argi && *end_ptr == 0) - data.size = 8; - } - if(!data.size) { // Try C-style string or single character if ((*argi == '\'' && argi[arglen-1] == '\'') || (*argi == '\"' && argi[arglen-1] == '\"')) { char *s = calloc(arglen-1, 1); @@ -774,16 +800,17 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } else { // C-style string data.str_ptr = s; } - } else { - avrdude_message(MSG_INFO, "%s (write): can't parse data %s\n", - progname, argi); - free(buf); - if(data.str_ptr != NULL) - free(data.str_ptr); - return -1; } } - // ensure we have little endian representation in data.a + + if(!data.size && !data.str_ptr) { + avrdude_message(MSG_INFO, "%s (write): can't parse data %s\n", + progname, argi); + free(buf); + return -1; + } + + // Assume endianness is the same for double and int, and ensure little endian representation if(is_big_endian && data.size > 1) change_endian(data.a, data.size); } From f871a4dc1ea57c417b9c8fe4c2731fa330853f73 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 12:02:33 +0100 Subject: [PATCH 106/511] Adapt capitalisation of comments in term.c to existing style --- src/term.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/term.c b/src/term.c index 1f5ec4b4..181a3b4a 100644 --- a/src/term.c +++ b/src/term.c @@ -339,7 +339,7 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, -// convert the next n hex digits of s to a hex number +// Convert the next n hex digits of s to a hex number static unsigned int tohex(const char *s, unsigned int n) { int ret, c; @@ -422,7 +422,7 @@ static char *unescape(char *d, const char *s) { case 'b': *d = '\b'; break; - case 'e': // non-standard ESC + case 'e': // Non-standard ESC *d = 27; break; case 'f': @@ -458,54 +458,54 @@ static char *unescape(char *d, const char *s) { case '6': case '7': // 1-3 octal digits n = *s - '0'; - for(k = 0; k < 2 && s[1] >= '0' && s[1] <= '7'; k++) // max 2 more octal characters + for(k = 0; k < 2 && s[1] >= '0' && s[1] <= '7'; k++) // Max 2 more octal characters n *= 8, n += s[1] - '0', s++; *d = n; break; - case 'x': // unlimited hex digits + case 'x': // Unlimited hex digits for(k = 0; isxdigit(s[k + 1]); k++) continue; if(k > 0) { *d = tohex(s + 1, k); s += k; - } else { // no hex digits after \x? copy \x + } else { // No hex digits after \x? copy \x *d++ = '\\'; *d = 'x'; } break; - case 'u': // exactly 4 hex digits and valid unicode + case 'u': // Exactly 4 hex digits and valid unicode if(isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) && (n = wc_to_utf8str(tohex(s+1, 4), d))) { d += n - 1; s += 4; - } else { // invalid \u sequence? copy \u + } else { // Invalid \u sequence? copy \u *d++ = '\\'; *d = 'u'; } break; - case 'U': // exactly 6 hex digits and valid unicode + case 'U': // Exactly 6 hex digits and valid unicode if(isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) && isxdigit(s[5]) && isxdigit(s[6]) && (n = wc_to_utf8str(tohex(s+1, 6), d))) { d += n - 1; s += 6; - } else { // invalid \U sequence? copy \U + } else { // Invalid \U sequence? copy \U *d++ = '\\'; *d = 'U'; } break; - default: // keep the escape sequence (C would warn and remove \) + default: // Keep the escape sequence (C would warn and remove \) *d++ = '\\'; *d = *s; } break; - default: // not an escape sequence: just copy the character + default: // Not an escape sequence: just copy the character *d = *s; } d++; s++; } - *d = *s; // terminate + *d = *s; // Terminate return ret; } @@ -681,7 +681,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, data.str_ptr = NULL; } - // remove trailing comma to allow cut and paste of lists + // Remove trailing comma to allow cut and paste of lists if(arglen > 0 && argi[arglen-1] == ',') argi[--arglen] = 0; @@ -692,7 +692,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, unsigned int nu=0, nl=0, nh=0, ns=0, nx=0; char *p; - // parse suffixes: ULL, LL, UL, L ... UHH, HH + // Parse suffixes: ULL, LL, UL, L ... UHH, HH for(p=end_ptr; *p; p++) switch(toupper(*p)) { case 'U': nu++; break; @@ -702,10 +702,10 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, default: nx++; } - if(nx==0 && nu<2 && nl<3 && nh<3 && ns<2) { // could be valid integer suffix - if(nu==0 || toupper(*end_ptr) == 'U' || toupper(p[-1]) == 'U') { // if U, then must be at start or end - bool is_hex = strncasecmp(argi, "0x", 2) == 0; // ordinary hex: "0x..." without explicit +/- sign - bool is_signed = !(nu || is_hex); // neither explicitly unsigned nor ordinary hex + if(nx==0 && nu<2 && nl<3 && nh<3 && ns<2) { // Could be valid integer suffix + if(nu==0 || toupper(*end_ptr) == 'U' || toupper(p[-1]) == 'U') { // If U, then must be at start or end + bool is_hex = strncasecmp(argi, "0x", 2) == 0; // Ordinary hex: 0x... without explicit +/- sign + bool is_signed = !(nu || is_hex); // Neither explicitly unsigned nor ordinary hex bool is_outside_int64_t = 0; bool is_out_of_range = 0; int nhexdigs = p-argi-2; @@ -715,13 +715,13 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, is_outside_int64_t = errno == ERANGE; } - if(nl==0 && ns==0 && nh==0) { // no explicit data size - // ordinary hex numbers have "implicit" size, given by number of hex digits, including leading zeros + if(nl==0 && ns==0 && nh==0) { // No explicit data size + // Ordinary hex numbers have implicit size given by number of hex digits, including leading zeros if(is_hex) { data.size = nhexdigs > 8? 8: nhexdigs > 4? 4: nhexdigs > 2? 2: 1; } else if(is_signed) { - // smallest size that fits signed representation + // Smallest size that fits signed representation data.size = is_outside_int64_t? 8: data.ll < INT32_MIN || data.ll > INT32_MAX? 8: @@ -729,7 +729,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, data.ll < INT8_MIN || data.ll > INT8_MAX? 2: 1; } else { - // smallest size that fits unsigned representation + // Smallest size that fits unsigned representation data.size = data.ull > UINT32_MAX? 8: data.ull > UINT16_MAX? 4: @@ -767,7 +767,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, if(!data.size) { // Try double now that input was rejected as integer data.d = strtod(argi, &end_ptr); - // Do not accept valid doubles that are integer rejects (eg, 078 or ULL overflows) + // Do not accept valid mantissa-only doubles that are integer rejects (eg, 078 or ULL overflows) if (end_ptr != argi && *end_ptr == 0) if (!is_mantissa_only(argi)) data.size = 8; @@ -790,7 +790,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, // Strip start and end quotes, and unescape C string strncpy(s, argi+1, arglen-2); unescape(s, s); - if (*argi == '\'') { // single C-style character + if (*argi == '\'') { // Single C-style character if(*s && s[1]) avrdude_message(MSG_INFO, "%s (write): only using first character of %s\n", progname, argi); From 63fb79accbf867af563f83163410b58f0e7f832d Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 12:24:30 +0100 Subject: [PATCH 107/511] Consolidate more error messages in term.c --- src/term.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/term.c b/src/term.c index 181a3b4a..8dc44233 100644 --- a/src/term.c +++ b/src/term.c @@ -316,11 +316,11 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, for (int i = 0; i < len; i++) { int rc = pgm->read_byte(pgm, p, mem, addr + i, &buf[i]); if (rc != 0) { - avrdude_message(MSG_INFO, "error reading %s address 0x%05lx of part %s\n", - mem->desc, (long) addr + i, p->desc); + avrdude_message(MSG_INFO, "%s (dump): error reading %s address 0x%05lx of part %s\n", + progname, mem->desc, (long) addr + i, p->desc); if (rc == -1) - avrdude_message(MSG_INFO, "read operation not supported on memory type %s\n", - mem->desc); + avrdude_message(MSG_INFO, "%*sread operation not supported on memory type %s\n", + (int) strlen(progname)+9, "", mem->desc); return -1; } report_progress(i, len, NULL); @@ -597,8 +597,8 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, char * memtype = argv[1]; // Memory name string AVRMEM * mem = avr_locate_mem(p, memtype); if (mem == NULL) { - avrdude_message(MSG_INFO, "%s memory type not defined for part %s\n", - memtype, p->desc); + avrdude_message(MSG_INFO, "%s (write): %s memory type not defined for part %s\n", + progname, memtype, p->desc); return -1; } int maxsize = mem->size; @@ -853,10 +853,10 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, if(data.str_ptr) free(data.str_ptr); - avrdude_message(MSG_NOTICE, "\nInfo: Writing %d bytes starting from address 0x%02lx", + avrdude_message(MSG_NOTICE, "Info: writing %d bytes starting from address 0x%02lx", len + data.bytes_grown, (long) addr); if (write_mode == WRITE_MODE_FILL) - avrdude_message(MSG_NOTICE, ". Remaining space filled with %s", argv[argc - 2]); + avrdude_message(MSG_NOTICE, "; remaining space filled with %s", argv[argc - 2]); avrdude_message(MSG_NOTICE, "\n"); pgm->err_led(pgm, OFF); @@ -868,8 +868,8 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, avrdude_message(MSG_INFO, "%s (write): error writing 0x%02x at 0x%05lx, rc=%d\n", progname, buf[i], (long) addr+i, (int) rc); if (rc == -1) - avrdude_message(MSG_INFO, "write operation not supported on memory type %s\n", - mem->desc); + avrdude_message(MSG_INFO, "%*swrite operation not supported on memory type %s\n", + (int) strlen(progname)+10, "", mem->desc); werror = true; } From d9cb9772d7bfd1569d85fb6eef98cf7bc8c7111f Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 12:30:29 +0100 Subject: [PATCH 108/511] Fix verbosity level parsing in term.c --- src/term.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/term.c b/src/term.c index 8dc44233..41b172ec 100644 --- a/src/term.c +++ b/src/term.c @@ -1241,13 +1241,13 @@ static int cmd_verbose(PROGRAMMER * pgm, struct avrpart * p, return 0; } nverb = strtol(argv[1], &endp, 0); - if (endp == argv[2]) { - avrdude_message(MSG_INFO, "%s: can't parse verbosity level %s\n", - progname, argv[2]); + if (endp == argv[1] || *endp) { + avrdude_message(MSG_INFO, "%s (verbose): can't parse verbosity level %s\n", + progname, argv[1]); return -1; } if (nverb < 0) { - avrdude_message(MSG_INFO, "%s: verbosity level must be positive: %d\n", + avrdude_message(MSG_INFO, "%s: verbosity level must not be negative: %d\n", progname, nverb); return -1; } From 1e8b56751e4368db5abbf09337610916965df0cc Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 13:11:10 +0100 Subject: [PATCH 109/511] Add quell command in terminal Sets the quell_progress global variable that can be, and is, consulted by programmers. Setting quell_progress to a positive number also switches off progress bars. It is currently not possible to switch on progress bars again: that is enabled in main.c once at the start of AVRDUDE. That code in main should move to avr.c to enable report_update() to consult quell_progress directly. Will do at another time when touching main.c and avr.c. smr --- src/term.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/term.c b/src/term.c index 41b172ec..5050938b 100644 --- a/src/term.c +++ b/src/term.c @@ -91,6 +91,9 @@ static int cmd_pgm (PROGRAMMER * pgm, struct avrpart * p, static int cmd_verbose (PROGRAMMER * pgm, struct avrpart * p, int argc, char *argv[]); +static int cmd_quell (PROGRAMMER * pgm, struct avrpart * p, + int argc, char *argv[]); + struct command cmd[] = { { "dump", cmd_dump, "%s [ | ... | | ...]" }, { "read", cmd_dump, "alias for dump" }, @@ -107,6 +110,7 @@ struct command cmd[] = { { "spi", cmd_spi, "enter direct SPI mode" }, { "pgm", cmd_pgm, "return to programming mode" }, { "verbose", cmd_verbose, "change verbosity" }, + { "quell", cmd_quell, "set quell level for progress bars" }, { "help", cmd_help, "help" }, { "?", cmd_help, "help" }, { "quit", cmd_quit, "quit" } @@ -1257,6 +1261,40 @@ static int cmd_verbose(PROGRAMMER * pgm, struct avrpart * p, return 0; } +static int cmd_quell(PROGRAMMER * pgm, struct avrpart * p, + int argc, char * argv[]) +{ + int nquell; + char *endp; + + if (argc != 1 && argc != 2) { + avrdude_message(MSG_INFO, "Usage: quell []\n"); + return -1; + } + if (argc == 1) { + avrdude_message(MSG_INFO, "Quell level: %d\n", quell_progress); + return 0; + } + nquell = strtol(argv[1], &endp, 0); + if (endp == argv[1] || *endp) { + avrdude_message(MSG_INFO, "%s (quell): can't parse quell level %s\n", + progname, argv[1]); + return -1; + } + if (nquell < 0) { + avrdude_message(MSG_INFO, "%s: quell level must not be negative: %d\n", + progname, nquell); + return -1; + } + quell_progress = nquell; + avrdude_message(MSG_INFO, "New quell level: %d\n", quell_progress); + + if(quell_progress > 0) + update_progress = NULL; + + return 0; +} + static int tokenize(char * s, char *** argv) { int i, n, l, k, nargs, offset; From b6204b181a3cb5167e2c41abe3dd79ae19f947c6 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 15:22:52 +0100 Subject: [PATCH 110/511] Provide echo of terminal command line prompt under Windows --- src/term.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/term.c b/src/term.c index 5050938b..fe19d2d5 100644 --- a/src/term.c +++ b/src/term.c @@ -1477,7 +1477,7 @@ int terminal_mode(PROGRAMMER * pgm, struct avrpart * p) return argc; } -#if 0 +#if defined(WIN32) fprintf(stdout, ">>> "); for (int i=0; i Date: Tue, 12 Jul 2022 15:52:37 +0100 Subject: [PATCH 111/511] Update NEWS --- NEWS | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 78f59f95..7bea2bcb 100644 --- a/NEWS +++ b/NEWS @@ -32,8 +32,12 @@ Changes since version 7.0: - Replace internal knowledge in jtag3.c by a public API #996 - JTAG3 UPDI EEPROM fix #1013 - Treat x bits in .conf SPI commands as 0 #943 - - Fix avrftdi support for ATmega2560 et al #474 - - Fix avrdude.conf timings for ATmega328PB and other parts #976 + - Fix avrftdi support for ATmega2560 et al #998 + - Fix avrdude.conf timings for ATmega328PB and other parts #1001 + - Fix PICKit2 ATmega2560 flash paged flash read #1023 + - Fix ft245r paged read for ATmega2560 et al #1018 + - Add option -A that supresses trailing 0xff optimisation + and automatically do so for -c arduino #936 * Internals: From f8145ae1c4dba6180182b636c0b327dd104823dd Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 12 Jul 2022 21:53:37 +0100 Subject: [PATCH 112/511] Echo >>> terminal command line for Windows or non-libreadline --- src/term.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/term.c b/src/term.c index fe19d2d5..1f294540 100644 --- a/src/term.c +++ b/src/term.c @@ -1477,7 +1477,7 @@ int terminal_mode(PROGRAMMER * pgm, struct avrpart * p) return argc; } -#if defined(WIN32) +#if !defined(HAVE_LIBREADLINE) || defined(WIN32) fprintf(stdout, ">>> "); for (int i=0; i Date: Wed, 13 Jul 2022 11:19:21 +0100 Subject: [PATCH 113/511] Fix isspace() and other isxxx() calls in term.c --- src/term.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/term.c b/src/term.c index 1f294540..8cd48b99 100644 --- a/src/term.c +++ b/src/term.c @@ -124,19 +124,19 @@ static int spi_mode = 0; static int nexttok(char * buf, char ** tok, char ** next) { - char * q, * n; + unsigned char *q, *n; - q = buf; - while (isspace((int)*q)) + q = (unsigned char *) buf; + while (isspace(*q)) q++; /* isolate first token */ n = q; uint8_t quotes = 0; - while (*n && (!isspace((int)*n) || quotes)) { + while (*n && (!isspace(*n) || quotes)) { if (*n == '\"') quotes++; - else if (isspace((int)*n) && *(n-1) == '\"') + else if (isspace(*n) && *(n-1) == '\"') break; n++; } @@ -147,11 +147,11 @@ static int nexttok(char * buf, char ** tok, char ** next) } /* find start of next token */ - while (isspace((int)*n)) + while (isspace(*n)) n++; - *tok = q; - *next = n; + *tok = (char *) q; + *next = (char *) n; return 0; } @@ -190,14 +190,17 @@ static int hexdump_line(char * buffer, unsigned char * p, int n, int pad) static int chardump_line(char * buffer, unsigned char * p, int n, int pad) { int i; - char b [ 128 ]; + unsigned char b[128]; + // sanity check + n = n < 1? 1: n > sizeof b? sizeof b: n; + + memcpy(b, p, n); for (int i = 0; i < n; i++) { - memcpy(b, p, n); buffer[i] = '.'; - if (isalpha((int)(b[i])) || isdigit((int)(b[i])) || ispunct((int)(b[i]))) + if (isalpha(b[i]) || isdigit(b[i]) || ispunct(b[i])) buffer[i] = b[i]; - else if (isspace((int)(b[i]))) + else if (isspace(b[i])) buffer[i] = ' '; } @@ -344,7 +347,7 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, // Convert the next n hex digits of s to a hex number -static unsigned int tohex(const char *s, unsigned int n) { +static unsigned int tohex(const unsigned char *s, unsigned int n) { int ret, c; ret = 0; @@ -362,7 +365,7 @@ static unsigned int tohex(const char *s, unsigned int n) { * Permissive for some invalid unicode sequences but not for those with * high bit set). Returns numbers of characters written (0-6). */ -static int wc_to_utf8str(unsigned int wc, char *str) { +static int wc_to_utf8str(unsigned int wc, unsigned char *str) { if(!(wc & ~0x7fu)) { *str = (char) wc; return 1; @@ -406,8 +409,8 @@ static int wc_to_utf8str(unsigned int wc, char *str) { } // Unescape C-style strings, destination d must hold enough space (and can be source s) -static char *unescape(char *d, const char *s) { - char *ret = d; +static unsigned char *unescape(unsigned char *d, const unsigned char *s) { + unsigned char *ret = d; int n, k; while(*s) { @@ -650,7 +653,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, // Data info int bytes_grown; uint8_t size; - char * str_ptr; + char *str_ptr; // Data union union { float f; @@ -793,7 +796,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } // Strip start and end quotes, and unescape C string strncpy(s, argi+1, arglen-2); - unescape(s, s); + unescape((unsigned char *) s, (unsigned char *) s); if (*argi == '\'') { // Single C-style character if(*s && s[1]) avrdude_message(MSG_INFO, "%s (write): only using first character of %s\n", @@ -1463,7 +1466,7 @@ int terminal_mode(PROGRAMMER * pgm, struct avrpart * p) * find the start of the command, skipping any white space */ q = cmdbuf; - while (*q && isspace((int)*q)) + while (*q && isspace((unsigned char) *q)) q++; /* skip blank lines and comments */ From 1efbc64922486a6036cce04fedc34ef514b251c5 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 13 Jul 2022 11:38:43 +0100 Subject: [PATCH 114/511] Add terminal_setup_update_progress() library interface to term.c This enables the new quell terminal command to switch on and off progress reports to the terminal. The code for this was moved from main.c to term.c. It can be used as library call for other frontends than main.c --- src/main.c | 80 ++------------------------------------------------- src/term.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++- src/term.h | 1 + 3 files changed, 86 insertions(+), 79 deletions(-) diff --git a/src/main.c b/src/main.c index 1d00ae67..b6fd2926 100644 --- a/src/main.c +++ b/src/main.c @@ -135,72 +135,6 @@ static void usage(void) } -static void update_progress_tty (int percent, double etime, char *hdr) -{ - static char hashes[51]; - static char *header; - static int last = 0; - int i; - - setvbuf(stderr, (char*)NULL, _IONBF, 0); - - hashes[50] = 0; - - memset (hashes, ' ', 50); - for (i=0; i>1)*2; - - setvbuf(stderr, (char*)NULL, _IONBF, 0); - - if (hdr) { - avrdude_message(MSG_INFO, "\n%s | ", hdr); - last = 0; - done = 0; - } - else { - while ((cnt > last) && (done == 0)) { - avrdude_message(MSG_INFO, "#"); - cnt -= 2; - } - } - - if ((percent == 100) && (done == 0)) { - avrdude_message(MSG_INFO, " | 100%% %0.2fs\n\n", etime); - last = 0; - done = 1; - } - else - last = (percent>>1)*2; /* Make last a multiple of 2. */ - - setvbuf(stderr, (char*)NULL, _IOLBF, 0); -} - static void list_programmers_callback(const char *name, const char *desc, const char *cfgname, int cfglineno, void *cookie) @@ -759,18 +693,8 @@ int main(int argc, char * argv []) } #endif - if (quell_progress == 0) { - if (isatty (STDERR_FILENO)) - update_progress = update_progress_tty; - else { - update_progress = update_progress_no_tty; - /* disable all buffering of stderr for compatibility with - software that captures and redirects output to a GUI - i.e. Programmers Notepad */ - setvbuf( stderr, NULL, _IONBF, 0 ); - setvbuf( stdout, NULL, _IONBF, 0 ); - } - } + if (quell_progress == 0) + terminal_setup_update_progress(); /* * Print out an identifying string so folks can tell what version diff --git a/src/term.c b/src/term.c index 8cd48b99..ec95fcec 100644 --- a/src/term.c +++ b/src/term.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #if defined(HAVE_LIBREADLINE) @@ -345,7 +346,6 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, } - // Convert the next n hex digits of s to a hex number static unsigned int tohex(const unsigned char *s, unsigned int n) { int ret, c; @@ -1294,6 +1294,8 @@ static int cmd_quell(PROGRAMMER * pgm, struct avrpart * p, if(quell_progress > 0) update_progress = NULL; + else + terminal_setup_update_progress(); return 0; } @@ -1499,3 +1501,83 @@ int terminal_mode(PROGRAMMER * pgm, struct avrpart * p) return rc; } + + +static void update_progress_tty (int percent, double etime, char *hdr) +{ + static char hashes[51]; + static char *header; + static int last = 0; + int i; + + setvbuf(stderr, (char*)NULL, _IONBF, 0); + + hashes[50] = 0; + + memset (hashes, ' ', 50); + for (i=0; i>1)*2; + + setvbuf(stderr, (char*)NULL, _IONBF, 0); + + if (hdr) { + avrdude_message(MSG_INFO, "\n%s | ", hdr); + last = 0; + done = 0; + } + else { + while ((cnt > last) && (done == 0)) { + avrdude_message(MSG_INFO, "#"); + cnt -= 2; + } + } + + if ((percent == 100) && (done == 0)) { + avrdude_message(MSG_INFO, " | 100%% %0.2fs\n\n", etime); + last = 0; + done = 1; + } + else + last = (percent>>1)*2; /* Make last a multiple of 2. */ + + setvbuf(stderr, (char*)NULL, _IOLBF, 0); +} + +void terminal_setup_update_progress() { + if (isatty (STDERR_FILENO)) + update_progress = update_progress_tty; + else { + update_progress = update_progress_no_tty; + /* disable all buffering of stderr for compatibility with + software that captures and redirects output to a GUI + i.e. Programmers Notepad */ + setvbuf( stderr, NULL, _IONBF, 0 ); + setvbuf( stdout, NULL, _IONBF, 0 ); + } +} diff --git a/src/term.h b/src/term.h index f114d4b0..61c4916c 100644 --- a/src/term.h +++ b/src/term.h @@ -34,6 +34,7 @@ typedef enum { int terminal_mode(PROGRAMMER * pgm, struct avrpart * p); char * terminal_get_input(const char *prompt); +void terminal_setup_update_progress(); #ifdef __cplusplus } From 0b3a5781fc46e6193b26560eed8c7a1d062cb511 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 13 Jul 2022 11:48:29 +0100 Subject: [PATCH 115/511] Flush stderr and stdout with all terminal error messages Error messages are written to stderr whilst normal terminal output is stdout. When redirecting output to pipelines or files these two streams can get separated as they are buffered separately. To avoid this, term.c now provides a function terminal_message() that works just like avrdude_message() but flushes stderr and stdout before printing on stderr, and it flushes stderr afterwards. This commit replaces all avrdude_message() calls except for progress report with terminal_message() to ensure stdout and stderr streams keep together. --- src/term.c | 155 +++++++++++++++++++++++++++++------------------------ src/term.h | 1 + 2 files changed, 87 insertions(+), 69 deletions(-) diff --git a/src/term.c b/src/term.c index ec95fcec..18999b19 100644 --- a/src/term.c +++ b/src/term.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -241,7 +242,7 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, int argc, char * argv[]) { if (argc < 2 || argc > 4) { - avrdude_message(MSG_INFO, + terminal_message(MSG_INFO, "Usage: %s \n" " %s ...\n" " %s \n" @@ -256,7 +257,7 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, char * memtype = argv[1]; AVRMEM * mem = avr_locate_mem(p, memtype); if (mem == NULL) { - avrdude_message(MSG_INFO, "%s (dump): %s memory type not defined for part %s\n", + terminal_message(MSG_INFO, "%s (dump): %s memory type not defined for part %s\n", progname, memtype, p->desc); return -1; } @@ -269,11 +270,11 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, if (argc >= 3 && strcmp(argv[2], "...") != 0) { addr = strtoul(argv[2], &end_ptr, 0); if (*end_ptr || (end_ptr == argv[2])) { - avrdude_message(MSG_INFO, "%s (dump): can't parse address %s\n", + terminal_message(MSG_INFO, "%s (dump): can't parse address %s\n", progname, argv[2]); return -1; } else if (addr >= maxsize) { - avrdude_message(MSG_INFO, "%s (dump): address 0x%05lx is out of range for %s memory\n", + terminal_message(MSG_INFO, "%s (dump): address 0x%05lx is out of range for %s memory\n", progname, (long) addr, mem->desc); return -1; } @@ -290,7 +291,7 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, } else if (argc == 4) { len = strtol(argv[3], &end_ptr, 0); if (*end_ptr || (end_ptr == argv[3])) { - avrdude_message(MSG_INFO, "%s (dump): can't parse length %s\n", + terminal_message(MSG_INFO, "%s (dump): can't parse length %s\n", progname, argv[3]); return -1; } @@ -316,7 +317,7 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, uint8_t * buf = malloc(len); if (buf == NULL) { - avrdude_message(MSG_INFO, "%s (dump): out of memory\n", progname); + terminal_message(MSG_INFO, "%s (dump): out of memory\n", progname); return -1; } @@ -324,10 +325,10 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, for (int i = 0; i < len; i++) { int rc = pgm->read_byte(pgm, p, mem, addr + i, &buf[i]); if (rc != 0) { - avrdude_message(MSG_INFO, "%s (dump): error reading %s address 0x%05lx of part %s\n", + terminal_message(MSG_INFO, "%s (dump): error reading %s address 0x%05lx of part %s\n", progname, mem->desc, (long) addr + i, p->desc); if (rc == -1) - avrdude_message(MSG_INFO, "%*sread operation not supported on memory type %s\n", + terminal_message(MSG_INFO, "%*sread operation not supported on memory type %s\n", (int) strlen(progname)+9, "", mem->desc); return -1; } @@ -566,7 +567,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, int argc, char * argv[]) { if (argc < 4) { - avrdude_message(MSG_INFO, + terminal_message(MSG_INFO, "Usage: write [,] {[,]} \n" " write [,] {[,]} ...\n" "\n" @@ -604,7 +605,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, char * memtype = argv[1]; // Memory name string AVRMEM * mem = avr_locate_mem(p, memtype); if (mem == NULL) { - avrdude_message(MSG_INFO, "%s (write): %s memory type not defined for part %s\n", + terminal_message(MSG_INFO, "%s (write): %s memory type not defined for part %s\n", progname, memtype, p->desc); return -1; } @@ -613,13 +614,13 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, char * end_ptr; int addr = strtoul(argv[2], &end_ptr, 0); if (*end_ptr || (end_ptr == argv[2])) { - avrdude_message(MSG_INFO, "%s (write): can't parse address %s\n", + terminal_message(MSG_INFO, "%s (write): can't parse address %s\n", progname, argv[2]); return -1; } if (addr > maxsize) { - avrdude_message(MSG_INFO, "%s (write): address 0x%05lx is out of range for %s memory\n", + terminal_message(MSG_INFO, "%s (write): address 0x%05lx is out of range for %s memory\n", progname, (long) addr, memtype); return -1; } @@ -627,7 +628,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, // Allocate a buffer guaranteed to be large enough uint8_t * buf = calloc(mem->size + 0x10 + maxstrlen(argc-3, argv+3), sizeof(uint8_t)); if (buf == NULL) { - avrdude_message(MSG_INFO, "%s (write): out of memory\n", progname); + terminal_message(MSG_INFO, "%s (write): out of memory\n", progname); return -1; } @@ -637,7 +638,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, start_offset = 4; len = strtoul(argv[3], &end_ptr, 0); if (*end_ptr || (end_ptr == argv[3])) { - avrdude_message(MSG_INFO, "%s (write ...): can't parse length %s\n", + terminal_message(MSG_INFO, "%s (write ...): can't parse length %s\n", progname, argv[3]); free(buf); return -1; @@ -670,7 +671,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, }; if(sizeof(long long) != sizeof(int64_t) || (data.a[0]^data.a[7]) != 1) - avrdude_message(MSG_INFO, "%s (write): assumption on data types not met? " + terminal_message(MSG_INFO, "%s (write): assumption on data types not met? " "Check source and recompile\n", progname); bool is_big_endian = data.a[7]; @@ -765,7 +766,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } if(is_outside_int64_t || is_out_of_range) - avrdude_message(MSG_INFO, "%s (write): %s out of int%d_t range, " + terminal_message(MSG_INFO, "%s (write): %s out of int%d_t range, " "interpreted as %d-byte %lld; consider 'U' suffix\n", progname, argi, data.size*8, data.size, data.ll); } @@ -790,7 +791,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, if ((*argi == '\'' && argi[arglen-1] == '\'') || (*argi == '\"' && argi[arglen-1] == '\"')) { char *s = calloc(arglen-1, 1); if (s == NULL) { - avrdude_message(MSG_INFO, "%s (write str): out of memory\n", progname); + terminal_message(MSG_INFO, "%s (write str): out of memory\n", progname); free(buf); return -1; } @@ -799,7 +800,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, unescape((unsigned char *) s, (unsigned char *) s); if (*argi == '\'') { // Single C-style character if(*s && s[1]) - avrdude_message(MSG_INFO, "%s (write): only using first character of %s\n", + terminal_message(MSG_INFO, "%s (write): only using first character of %s\n", progname, argi); data.ll = *s; data.size = 1; @@ -811,7 +812,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } if(!data.size && !data.str_ptr) { - avrdude_message(MSG_INFO, "%s (write): can't parse data %s\n", + terminal_message(MSG_INFO, "%s (write): can't parse data %s\n", progname, argi); free(buf); return -1; @@ -851,7 +852,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, data.bytes_grown = 0; if ((addr + len + data.bytes_grown) > maxsize) { - avrdude_message(MSG_INFO, "%s (write): selected address and # bytes exceed " + terminal_message(MSG_INFO, "%s (write): selected address and # bytes exceed " "range for %s memory\n", progname, memtype); free(buf); return -1; @@ -860,11 +861,11 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, if(data.str_ptr) free(data.str_ptr); - avrdude_message(MSG_NOTICE, "Info: writing %d bytes starting from address 0x%02lx", + terminal_message(MSG_NOTICE, "Info: writing %d bytes starting from address 0x%02lx", len + data.bytes_grown, (long) addr); if (write_mode == WRITE_MODE_FILL) - avrdude_message(MSG_NOTICE, "; remaining space filled with %s", argv[argc - 2]); - avrdude_message(MSG_NOTICE, "\n"); + terminal_message(MSG_NOTICE, "; remaining space filled with %s", argv[argc - 2]); + terminal_message(MSG_NOTICE, "\n"); pgm->err_led(pgm, OFF); bool werror = false; @@ -872,10 +873,10 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, for (i = 0; i < (len + data.bytes_grown); i++) { int rc = avr_write_byte(pgm, p, mem, addr+i, buf[i]); if (rc) { - avrdude_message(MSG_INFO, "%s (write): error writing 0x%02x at 0x%05lx, rc=%d\n", + terminal_message(MSG_INFO, "%s (write): error writing 0x%02x at 0x%05lx, rc=%d\n", progname, buf[i], (long) addr+i, (int) rc); if (rc == -1) - avrdude_message(MSG_INFO, "%*swrite operation not supported on memory type %s\n", + terminal_message(MSG_INFO, "%*swrite operation not supported on memory type %s\n", (int) strlen(progname)+10, "", mem->desc); werror = true; } @@ -883,7 +884,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, uint8_t b; rc = pgm->read_byte(pgm, p, mem, addr+i, &b); if (b != buf[i]) { - avrdude_message(MSG_INFO, "%s (write): error writing 0x%02x at 0x%05lx cell=0x%02x\n", + terminal_message(MSG_INFO, "%s (write): error writing 0x%02x at 0x%05lx cell=0x%02x\n", progname, buf[i], (long) addr+i, b); werror = true; } @@ -911,20 +912,20 @@ static int cmd_send(PROGRAMMER * pgm, struct avrpart * p, int len; if (pgm->cmd == NULL) { - avrdude_message(MSG_INFO, "%s (send): the %s programmer does not support direct ISP commands\n", + terminal_message(MSG_INFO, "%s (send): the %s programmer does not support direct ISP commands\n", progname, pgm->type); return -1; } if (spi_mode && (pgm->spi == NULL)) { - avrdude_message(MSG_INFO, "%s (send): the %s programmer does not support direct SPI transfers\n", + terminal_message(MSG_INFO, "%s (send): the %s programmer does not support direct SPI transfers\n", progname, pgm->type); return -1; } if ((argc > 5) || ((argc < 5) && (!spi_mode))) { - avrdude_message(MSG_INFO, spi_mode? + terminal_message(MSG_INFO, spi_mode? "Usage: send [ [ []]]\n": "Usage: send \n"); return -1; @@ -937,7 +938,7 @@ static int cmd_send(PROGRAMMER * pgm, struct avrpart * p, for (i=1; ichip_erase(pgm, p); return 0; } @@ -993,13 +994,13 @@ static int cmd_sig(PROGRAMMER * pgm, struct avrpart * p, rc = avr_signature(pgm, p); if (rc != 0) { - avrdude_message(MSG_INFO, "%s (sig): error reading signature data, rc=%d\n", + terminal_message(MSG_INFO, "%s (sig): error reading signature data, rc=%d\n", progname, rc); } m = avr_locate_mem(p, "signature"); if (m == NULL) { - avrdude_message(MSG_INFO, "%s (sig): signature data not defined for device %s\n", + terminal_message(MSG_INFO, "%s (sig): signature data not defined for device %s\n", progname, p->desc); } else { @@ -1028,7 +1029,7 @@ static int cmd_parms(PROGRAMMER * pgm, struct avrpart * p, int argc, char * argv[]) { if (pgm->print_parms == NULL) { - avrdude_message(MSG_INFO, "%s (parms): the %s programmer does not support " + terminal_message(MSG_INFO, "%s (parms): the %s programmer does not support " "adjustable parameters\n", progname, pgm->type); return -1; } @@ -1046,22 +1047,22 @@ static int cmd_vtarg(PROGRAMMER * pgm, struct avrpart * p, char *endp; if (argc != 2) { - avrdude_message(MSG_INFO, "Usage: vtarg \n"); + terminal_message(MSG_INFO, "Usage: vtarg \n"); return -1; } v = strtod(argv[1], &endp); if (endp == argv[1]) { - avrdude_message(MSG_INFO, "%s (vtarg): can't parse voltage %s\n", + terminal_message(MSG_INFO, "%s (vtarg): can't parse voltage %s\n", progname, argv[1]); return -1; } if (pgm->set_vtarget == NULL) { - avrdude_message(MSG_INFO, "%s (vtarg): the %s programmer cannot set V[target]\n", + terminal_message(MSG_INFO, "%s (vtarg): the %s programmer cannot set V[target]\n", progname, pgm->type); return -2; } if ((rc = pgm->set_vtarget(pgm, v)) != 0) { - avrdude_message(MSG_INFO, "%s (vtarg): failed to set V[target] (rc = %d)\n", + terminal_message(MSG_INFO, "%s (vtarg): failed to set V[target] (rc = %d)\n", progname, rc); return -3; } @@ -1077,7 +1078,7 @@ static int cmd_fosc(PROGRAMMER * pgm, struct avrpart * p, char *endp; if (argc != 2) { - avrdude_message(MSG_INFO, "Usage: fosc [M|k] | off\n"); + terminal_message(MSG_INFO, "Usage: fosc [M|k] | off\n"); return -1; } v = strtod(argv[1], &endp); @@ -1085,7 +1086,7 @@ static int cmd_fosc(PROGRAMMER * pgm, struct avrpart * p, if (strcmp(argv[1], "off") == 0) v = 0.0; else { - avrdude_message(MSG_INFO, "%s (fosc): can't parse frequency %s\n", + terminal_message(MSG_INFO, "%s (fosc): can't parse frequency %s\n", progname, argv[1]); return -1; } @@ -1095,12 +1096,12 @@ static int cmd_fosc(PROGRAMMER * pgm, struct avrpart * p, else if (*endp == 'k' || *endp == 'K') v *= 1e3; if (pgm->set_fosc == NULL) { - avrdude_message(MSG_INFO, "%s (fosc): the %s programmer cannot set oscillator frequency\n", + terminal_message(MSG_INFO, "%s (fosc): the %s programmer cannot set oscillator frequency\n", progname, pgm->type); return -2; } if ((rc = pgm->set_fosc(pgm, v)) != 0) { - avrdude_message(MSG_INFO, "%s (fosc): failed to set oscillator frequency (rc = %d)\n", + terminal_message(MSG_INFO, "%s (fosc): failed to set oscillator frequency (rc = %d)\n", progname, rc); return -3; } @@ -1116,23 +1117,23 @@ static int cmd_sck(PROGRAMMER * pgm, struct avrpart * p, char *endp; if (argc != 2) { - avrdude_message(MSG_INFO, "Usage: sck \n"); + terminal_message(MSG_INFO, "Usage: sck \n"); return -1; } v = strtod(argv[1], &endp); if (endp == argv[1]) { - avrdude_message(MSG_INFO, "%s (sck): can't parse period %s\n", + terminal_message(MSG_INFO, "%s (sck): can't parse period %s\n", progname, argv[1]); return -1; } v *= 1e-6; /* Convert from microseconds to seconds. */ if (pgm->set_sck_period == NULL) { - avrdude_message(MSG_INFO, "%s (sck): the %s programmer cannot set SCK period\n", + terminal_message(MSG_INFO, "%s (sck): the %s programmer cannot set SCK period\n", progname, pgm->type); return -2; } if ((rc = pgm->set_sck_period(pgm, v)) != 0) { - avrdude_message(MSG_INFO, "%s (sck): failed to set SCK period (rc = %d)\n", + terminal_message(MSG_INFO, "%s (sck): failed to set SCK period (rc = %d)\n", progname, rc); return -3; } @@ -1149,38 +1150,38 @@ static int cmd_varef(PROGRAMMER * pgm, struct avrpart * p, char *endp; if (argc != 2 && argc != 3) { - avrdude_message(MSG_INFO, "Usage: varef [channel] \n"); + terminal_message(MSG_INFO, "Usage: varef [channel] \n"); return -1; } if (argc == 2) { chan = 0; v = strtod(argv[1], &endp); if (endp == argv[1]) { - avrdude_message(MSG_INFO, "%s (varef): can't parse voltage %s\n", + terminal_message(MSG_INFO, "%s (varef): can't parse voltage %s\n", progname, argv[1]); return -1; } } else { chan = strtoul(argv[1], &endp, 10); if (endp == argv[1]) { - avrdude_message(MSG_INFO, "%s (varef): can't parse channel %s\n", + terminal_message(MSG_INFO, "%s (varef): can't parse channel %s\n", progname, argv[1]); return -1; } v = strtod(argv[2], &endp); if (endp == argv[2]) { - avrdude_message(MSG_INFO, "%s (varef): can't parse voltage %s\n", + terminal_message(MSG_INFO, "%s (varef): can't parse voltage %s\n", progname, argv[2]); return -1; } } if (pgm->set_varef == NULL) { - avrdude_message(MSG_INFO, "%s (varef): the %s programmer cannot set V[aref]\n", + terminal_message(MSG_INFO, "%s (varef): the %s programmer cannot set V[aref]\n", progname, pgm->type); return -2; } if ((rc = pgm->set_varef(pgm, chan, v)) != 0) { - avrdude_message(MSG_INFO, "%s (varef): failed to set V[aref] (rc = %d)\n", + terminal_message(MSG_INFO, "%s (varef): failed to set V[aref] (rc = %d)\n", progname, rc); return -3; } @@ -1214,7 +1215,7 @@ static int cmd_spi(PROGRAMMER * pgm, struct avrpart * p, spi_mode = 1; return 0; } - avrdude_message(MSG_INFO, "%s: spi command unavailable for this programmer type\n", + terminal_message(MSG_INFO, "%s: spi command unavailable for this programmer type\n", progname); return -1; } @@ -1228,7 +1229,7 @@ static int cmd_pgm(PROGRAMMER * pgm, struct avrpart * p, pgm->initialize(pgm, p); return 0; } - avrdude_message(MSG_INFO, "%s: pgm command unavailable for this programmer type\n", + terminal_message(MSG_INFO, "%s: pgm command unavailable for this programmer type\n", progname); return -1; } @@ -1240,26 +1241,26 @@ static int cmd_verbose(PROGRAMMER * pgm, struct avrpart * p, char *endp; if (argc != 1 && argc != 2) { - avrdude_message(MSG_INFO, "Usage: verbose []\n"); + terminal_message(MSG_INFO, "Usage: verbose []\n"); return -1; } if (argc == 1) { - avrdude_message(MSG_INFO, "Verbosity level: %d\n", verbose); + terminal_message(MSG_INFO, "Verbosity level: %d\n", verbose); return 0; } nverb = strtol(argv[1], &endp, 0); if (endp == argv[1] || *endp) { - avrdude_message(MSG_INFO, "%s (verbose): can't parse verbosity level %s\n", + terminal_message(MSG_INFO, "%s (verbose): can't parse verbosity level %s\n", progname, argv[1]); return -1; } if (nverb < 0) { - avrdude_message(MSG_INFO, "%s: verbosity level must not be negative: %d\n", + terminal_message(MSG_INFO, "%s: verbosity level must not be negative: %d\n", progname, nverb); return -1; } verbose = nverb; - avrdude_message(MSG_INFO, "New verbosity level: %d\n", verbose); + terminal_message(MSG_INFO, "New verbosity level: %d\n", verbose); return 0; } @@ -1271,26 +1272,26 @@ static int cmd_quell(PROGRAMMER * pgm, struct avrpart * p, char *endp; if (argc != 1 && argc != 2) { - avrdude_message(MSG_INFO, "Usage: quell []\n"); + terminal_message(MSG_INFO, "Usage: quell []\n"); return -1; } if (argc == 1) { - avrdude_message(MSG_INFO, "Quell level: %d\n", quell_progress); + terminal_message(MSG_INFO, "Quell level: %d\n", quell_progress); return 0; } nquell = strtol(argv[1], &endp, 0); if (endp == argv[1] || *endp) { - avrdude_message(MSG_INFO, "%s (quell): can't parse quell level %s\n", + terminal_message(MSG_INFO, "%s (quell): can't parse quell level %s\n", progname, argv[1]); return -1; } if (nquell < 0) { - avrdude_message(MSG_INFO, "%s: quell level must not be negative: %d\n", + terminal_message(MSG_INFO, "%s: quell level must not be negative: %d\n", progname, nquell); return -1; } quell_progress = nquell; - avrdude_message(MSG_INFO, "New quell level: %d\n", quell_progress); + terminal_message(MSG_INFO, "New quell level: %d\n", quell_progress); if(quell_progress > 0) update_progress = NULL; @@ -1413,7 +1414,7 @@ static int do_cmd(PROGRAMMER * pgm, struct avrpart * p, } else if (strncasecmp(argv[0], cmd[i].name, len)==0) { if (hold != -1) { - avrdude_message(MSG_INFO, "%s (cmd): command %s is ambiguous\n", + terminal_message(MSG_INFO, "%s (cmd): command %s is ambiguous\n", progname, argv[0]); return -1; } @@ -1424,7 +1425,7 @@ static int do_cmd(PROGRAMMER * pgm, struct avrpart * p, if (hold != -1) return cmd[hold].func(pgm, p, argc, argv); - avrdude_message(MSG_INFO, "%s (cmd): invalid command %s\n", + terminal_message(MSG_INFO, "%s (cmd): invalid command %s\n", progname, argv[0]); return -1; @@ -1503,6 +1504,22 @@ int terminal_mode(PROGRAMMER * pgm, struct avrpart * p) } +int terminal_message(const int msglvl, const char *format, ...) { + int rc = 0; + va_list ap; + + fflush(stdout); fflush(stderr); + if (verbose >= msglvl) { + va_start(ap, format); + rc = vfprintf(stderr, format, ap); + va_end(ap); + } + fflush(stderr); + + return rc; +} + + static void update_progress_tty (int percent, double etime, char *hdr) { static char hashes[51]; diff --git a/src/term.h b/src/term.h index 61c4916c..a89927ea 100644 --- a/src/term.h +++ b/src/term.h @@ -35,6 +35,7 @@ typedef enum { int terminal_mode(PROGRAMMER * pgm, struct avrpart * p); char * terminal_get_input(const char *prompt); void terminal_setup_update_progress(); +int terminal_message(const int msglvl, const char *format, ...); #ifdef __cplusplus } From b02cce38d76346a4dcef69717fbe77e530bea261 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 13 Jul 2022 12:25:09 +0100 Subject: [PATCH 116/511] Added long double data type for terminal write --- src/term.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/term.c b/src/term.c index 18999b19..96abbf7c 100644 --- a/src/term.c +++ b/src/term.c @@ -626,7 +626,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } // Allocate a buffer guaranteed to be large enough - uint8_t * buf = calloc(mem->size + 0x10 + maxstrlen(argc-3, argv+3), sizeof(uint8_t)); + uint8_t * buf = calloc(mem->size + sizeof(long double) + 8 + maxstrlen(argc-3, argv+3)+1, sizeof(uint8_t)); if (buf == NULL) { terminal_message(MSG_INFO, "%s (write): out of memory\n", progname); return -1; @@ -659,9 +659,10 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, union { float f; double d; + long double ld; int64_t ll; uint64_t ull; - uint8_t a[8]; + uint8_t a[sizeof(long double) > 8? sizeof(long double): 8]; }; } data = { .bytes_grown = 0, @@ -773,7 +774,13 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } } - if(!data.size) { // Try double now that input was rejected as integer + if(!data.size) { // Try long double now that input was rejected as integer + data.ld = strtold(argi, &end_ptr); + if (end_ptr != argi && toupper(*end_ptr) == 'L' && end_ptr[1] == 0) + data.size = sizeof(data.ld); + } + + if(!data.size) { // Try double data.d = strtod(argi, &end_ptr); // Do not accept valid mantissa-only doubles that are integer rejects (eg, 078 or ULL overflows) if (end_ptr != argi && *end_ptr == 0) @@ -826,20 +833,10 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, if(data.str_ptr) { for(size_t j = 0; j < strlen(data.str_ptr); j++) buf[i - start_offset + data.bytes_grown++] = (uint8_t)data.str_ptr[j]; - } else { - buf[i - start_offset + data.bytes_grown] = data.a[0]; - if (llabs(data.ll) > 0x000000FF || data.size >= 2) - buf[i - start_offset + ++data.bytes_grown] = data.a[1]; - if (llabs(data.ll) > 0x0000FFFF || data.size >= 4) { - buf[i - start_offset + ++data.bytes_grown] = data.a[2]; - buf[i - start_offset + ++data.bytes_grown] = data.a[3]; - } - if (llabs(data.ll) > 0xFFFFFFFF || data.size == 8) { - buf[i - start_offset + ++data.bytes_grown] = data.a[4]; - buf[i - start_offset + ++data.bytes_grown] = data.a[5]; - buf[i - start_offset + ++data.bytes_grown] = data.a[6]; - buf[i - start_offset + ++data.bytes_grown] = data.a[7]; - } + } else if(data.size > 0) { + for(int k=0; k Date: Wed, 13 Jul 2022 12:35:49 +0100 Subject: [PATCH 117/511] Change terminal write usage message to accommodate long double --- src/term.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/term.c b/src/term.c index 96abbf7c..ea34d5ee 100644 --- a/src/term.c +++ b/src/term.c @@ -574,11 +574,12 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, "Ellipsis ... writes bytes padded by repeating the last item.\n" "\n" " can be hexadecimal, octal or decimal integers, double, float or\n" - "C-style strings and chars. For numbers, an optional case-insensitive suffix\n" - "specifies the data size: HH: 8 bit, H/S: 16 bit, L: 32 bit, LL: 64 bit, F:\n" - "32-bit float. Hexadecimal floating point notation is supported. The\n" - "ambiguous trailing F in 0x1.8F makes the number be interpreted as double;\n" - "use a zero exponent as in 0x1.8p0F to denote a hexadecimal float.\n" + "C-style strings and chars. For integers, an optional case-insensitive suffix\n" + "specifies the data size: HH: 8 bit, H/S: 16 bit, L: 32 bit or LL: 64 bit.\n" + "Floating point types follow the C convention (add F for 32-bit float or L for\n" + "long double). Hexadecimal floating point notation is supported. The ambiguous\n" + "trailing F in 0x1.8F makes the number be interpreted as double; use a zero\n" + "exponent as in 0x1.8p0F to denote a hexadecimal float.\n" "\n" "An optional U suffix makes a number unsigned. Ordinary 0x hex numbers are\n" "always treated as unsigned. +0x or -0x hex numbers are treated as signed\n" From dde35018eb7a3bf26af3f64d5549cb8ceb66583d Mon Sep 17 00:00:00 2001 From: MCUdude Date: Wed, 13 Jul 2022 23:49:14 +0200 Subject: [PATCH 118/511] Exit if programmer can't send HV pulse to target --- src/jtag3.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/jtag3.c b/src/jtag3.c index becfd8a1..5ce6769c 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1266,9 +1266,11 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE; break; } - if (parm[0] == PARM3_UPDI_HV_NONE) + if (parm[0] == PARM3_UPDI_HV_NONE) { avrdude_message(MSG_INFO, "%s: %s does not support sending HV pulse to target %s\n", progname, pgm->desc, p->desc); + return -1; + } } if (jtag3_setparm(pgm, SCOPE_AVR, 3, PARM3_OPT_12V_UPDI_ENABLE, parm, 1) < 0) return -1; From 5721908e63a16ce44b326738c91ec4c46078b47e Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 14 Jul 2022 17:13:13 +0100 Subject: [PATCH 119/511] Revert to double/float only in terminal write and clarify usage --- src/term.c | 52 ++++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/src/term.c b/src/term.c index ea34d5ee..52906f29 100644 --- a/src/term.c +++ b/src/term.c @@ -573,15 +573,16 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, "\n" "Ellipsis ... writes bytes padded by repeating the last item.\n" "\n" - " can be hexadecimal, octal or decimal integers, double, float or\n" - "C-style strings and chars. For integers, an optional case-insensitive suffix\n" - "specifies the data size: HH: 8 bit, H/S: 16 bit, L: 32 bit or LL: 64 bit.\n" - "Floating point types follow the C convention (add F for 32-bit float or L for\n" - "long double). Hexadecimal floating point notation is supported. The ambiguous\n" - "trailing F in 0x1.8F makes the number be interpreted as double; use a zero\n" - "exponent as in 0x1.8p0F to denote a hexadecimal float.\n" + " can be hexadecimal, octal or decimal integers, floating point numbers\n" + "or C-style strings and characters. For integers, an optional case-insensitive\n" + "suffix specifies the data size: HH 8 bit, H/S 16 bit, L 32 bit, LL 64 bit.\n" + "Suffix D indicates a 64-bit double, F a 32-bit float, whilst a floating point\n" + "number without suffix defaults to 32-bit float. Hexadecimal floating point\n" + "notation is supported. An ambiguous trailing suffix, eg, 0x1.8D, is read as\n" + "no-suffix float where D is part of the mantissa; use a zero exponent 0x1.8p0D\n" + "to clarify.\n" "\n" - "An optional U suffix makes a number unsigned. Ordinary 0x hex numbers are\n" + "An optional U suffix makes integers unsigned. Ordinary 0x hex integers are\n" "always treated as unsigned. +0x or -0x hex numbers are treated as signed\n" "unless they have a U suffix. Unsigned integers cannot be larger than 2^64-1.\n" "If n is an unsigned integer then -n is also a valid unsigned integer as in C.\n" @@ -589,12 +590,12 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, "smaller range when a suffix specifies a smaller type. Out of range signed\n" "numbers trigger a warning.\n" "\n" - "Ordinary 0x hex numbers with n hex digits (counting leading zeros) use\n" - "the smallest size of 1, 2, 4 and 8 bytes that can accommodate any n-digit hex\n" - "number. If a suffix specifies a size explicitly the corresponding number of\n" - "least significant bytes are written. Otherwise, signed and unsigned integers\n" - "alike occupy the smallest of 1, 2, 4, or 8 bytes needed to accommodate them\n" - "in their respective representation.\n" + "Ordinary 0x hex integers with n hex digits (counting leading zeros) use the\n" + "smallest size of 1, 2, 4 and 8 bytes that can accommodate any n-digit hex\n" + "integer. If an integer suffix specifies a size explicitly the corresponding\n" + "number of least significant bytes are written. Otherwise, signed and unsigned\n" + "integers alike occupy the smallest of 1, 2, 4, or 8 bytes needed to\n" + "accommodate them in their respective representation.\n" ); return -1; } @@ -627,7 +628,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } // Allocate a buffer guaranteed to be large enough - uint8_t * buf = calloc(mem->size + sizeof(long double) + 8 + maxstrlen(argc-3, argv+3)+1, sizeof(uint8_t)); + uint8_t * buf = calloc(mem->size + 8 + maxstrlen(argc-3, argv+3)+1, sizeof(uint8_t)); if (buf == NULL) { terminal_message(MSG_INFO, "%s (write): out of memory\n", progname); return -1; @@ -660,10 +661,9 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, union { float f; double d; - long double ld; int64_t ll; uint64_t ull; - uint8_t a[sizeof(long double) > 8? sizeof(long double): 8]; + uint8_t a[8]; }; } data = { .bytes_grown = 0, @@ -775,24 +775,20 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } } - if(!data.size) { // Try long double now that input was rejected as integer - data.ld = strtold(argi, &end_ptr); - if (end_ptr != argi && toupper(*end_ptr) == 'L' && end_ptr[1] == 0) - data.size = sizeof(data.ld); - } - - if(!data.size) { // Try double + if(!data.size) { // Try double now that input was rejected as integer data.d = strtod(argi, &end_ptr); - // Do not accept valid mantissa-only doubles that are integer rejects (eg, 078 or ULL overflows) - if (end_ptr != argi && *end_ptr == 0) - if (!is_mantissa_only(argi)) - data.size = 8; + if (end_ptr != argi && toupper(*end_ptr) == 'D' && end_ptr[1] == 0) + data.size = 8; } if(!data.size) { // Try float data.f = strtof(argi, &end_ptr); if (end_ptr != argi && toupper(*end_ptr) == 'F' && end_ptr[1] == 0) data.size = 4; + if (end_ptr != argi && *end_ptr == 0) // no suffix defaults to float but ... + // ... do not accept valid mantissa-only floats that are integer rejects (eg, 078 or ULL overflows) + if (!is_mantissa_only(argi)) + data.size = 4; } if(!data.size) { // Try C-style string or single character From 14b27726d4fa05d7d18dcc8711d50f63e67571f3 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 14 Jul 2022 17:16:30 +0100 Subject: [PATCH 120/511] Protect terminal dump from vagaries of C libray implementation of isalpha() etc Some C libraries assign true to isalpha(0xff), isdigit(0xff) or ispunct(0xff), which means that the Operating System terminal sees a character 0xff which it may not have a useful display character for. This commit only outputs printable ASCII characters for an AVRDUDE terminal dump reducing the risk of the OS terminal not being able to print the character properly. --- src/term.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/term.c b/src/term.c index 52906f29..7fe6246c 100644 --- a/src/term.c +++ b/src/term.c @@ -198,13 +198,9 @@ static int chardump_line(char * buffer, unsigned char * p, int n, int pad) n = n < 1? 1: n > sizeof b? sizeof b: n; memcpy(b, p, n); - for (int i = 0; i < n; i++) { - buffer[i] = '.'; - if (isalpha(b[i]) || isdigit(b[i]) || ispunct(b[i])) - buffer[i] = b[i]; - else if (isspace(b[i])) - buffer[i] = ' '; - } + for (int i = 0; i < n; i++) + buffer[i] = isascii(b[i]) && isspace(b[i])? ' ': + isascii(b[i]) && isgraph(b[i])? b[i]: '.'; for (i = n; i < pad; i++) buffer[i] = ' '; From 7ceb163cbabda069462fcd4e7770ece0f5d09494 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 14 Jul 2022 18:31:44 +0100 Subject: [PATCH 121/511] Echo terminal command line on Apple --- src/term.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/term.c b/src/term.c index 7fe6246c..e779f84a 100644 --- a/src/term.c +++ b/src/term.c @@ -1473,7 +1473,7 @@ int terminal_mode(PROGRAMMER * pgm, struct avrpart * p) return argc; } -#if !defined(HAVE_LIBREADLINE) || defined(WIN32) +#if !defined(HAVE_LIBREADLINE) || defined(WIN32) || defined(__APPLE__) fprintf(stdout, ">>> "); for (int i=0; i Date: Fri, 15 Jul 2022 18:50:20 +0100 Subject: [PATCH 122/511] Fix terminal line parsing for strings (to some extent) --- src/term.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/term.c b/src/term.c index e779f84a..f02f95c5 100644 --- a/src/term.c +++ b/src/term.c @@ -136,9 +136,12 @@ static int nexttok(char * buf, char ** tok, char ** next) n = q; uint8_t quotes = 0; while (*n && (!isspace(*n) || quotes)) { - if (*n == '\"') + // poor man's quote and escape processing + if (*n == '"' || *n == '\'') quotes++; - else if (isspace(*n) && *(n-1) == '\"') + else if(*n == '\\' && n[1]) + n++; + else if (isspace(*n) && (n > q+1) && (n[-1] == '"' || n[-1] == '\'')) break; n++; } @@ -787,7 +790,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, data.size = 4; } - if(!data.size) { // Try C-style string or single character + if(!data.size && arglen > 1) { // Try C-style string or single character if ((*argi == '\'' && argi[arglen-1] == '\'') || (*argi == '\"' && argi[arglen-1] == '\"')) { char *s = calloc(arglen-1, 1); if (s == NULL) { From d05ddd188d10aa43398c6f33d9e6515c00b7cd2c Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sat, 16 Jul 2022 11:06:18 +0100 Subject: [PATCH 123/511] Fix usbtiny read/verify for parts with more than 64 kB flash Usbtiny has a protocol or firmware problem that prevents it from reading flash above 64 kB in page mode (used by -U flash:r:... and -U flash:v:...). This commit fixes that problem by falling back on byte access for flash paged reads above 64k. It also issues the correct load extended address command for parts with more than 128 kB flash thus extending support to ATmega2560 et al. --- src/usbtiny.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/usbtiny.c b/src/usbtiny.c index 4bbaca7c..75c88be6 100644 --- a/src/usbtiny.c +++ b/src/usbtiny.c @@ -657,15 +657,39 @@ static int usbtiny_paged_load (PROGRAMMER * pgm, AVRPART * p, AVRMEM* m, unsigned int addr, unsigned int n_bytes) { unsigned int maxaddr = addr + n_bytes; - int chunk; - int function; - + int chunk, function; + OPCODE *lext, *readop; + unsigned char cmd[8]; // First determine what we're doing - if (strcmp( m->desc, "flash" ) == 0) { - function = USBTINY_FLASH_READ; - } else { - function = USBTINY_EEPROM_READ; + function = strcmp(m->desc, "eeprom")==0? + USBTINY_EEPROM_READ: USBTINY_FLASH_READ; + + // paged_load() only called for pages, so OK to set ext addr once at start + if((lext = m->op[AVR_OP_LOAD_EXT_ADDR])) { + memset(cmd, 0, sizeof(cmd)); + avr_set_bits(lext, cmd); + avr_set_addr(lext, cmd, addr/2); + if(pgm->cmd(pgm, cmd, cmd+4) < 0) + return -1; + } + + // Byte acces as work around to correctly read flash above 64 kiB + if(function == USBTINY_FLASH_READ && addr >= 0x10000) { + for(unsigned int i=0; iop[addr&1? AVR_OP_READ_HI: AVR_OP_READ_LO])) + return -1; + + memset(cmd, 0, sizeof(cmd)); + avr_set_bits(readop, cmd); + avr_set_addr(readop, cmd, addr/2); + if(pgm->cmd(pgm, cmd, cmd+4) < 0) + return -1; + m->buf[addr] = 0; + avr_get_output(readop, cmd+4, m->buf + addr); + } + + return n_bytes; } for (; addr < maxaddr; addr += chunk) { From 79921e52dc76f0adc6edb07f873a74aa5fb1123c Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sat, 16 Jul 2022 23:40:36 +0100 Subject: [PATCH 124/511] Provide file format I: Intel HEX with comments that ignores checksum errors The new file type I is essentially Intel HEX that, on download, inserts comments next to data records with the resolved effective address and an ASCII dump of that same record. On upload the `I` format is permissive with respect to check sum errors, eg, after manipulated an Intel HEX file for debugging. --- src/avrdude.1 | 2 ++ src/doc/avrdude.texi | 3 +++ src/fileio.c | 60 +++++++++++++++++++++++++++++++------------- src/libavrdude.h | 3 ++- src/update.c | 1 + 5 files changed, 50 insertions(+), 19 deletions(-) diff --git a/src/avrdude.1 b/src/avrdude.1 index c4fc850f..be22e0c1 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -709,6 +709,8 @@ can be one of: .Bl -tag -width sss .It Ar i Intel Hex +.It Ar I +Intel Hex with comments on download and tolerance of checksum errors on upload .It Ar s Motorola S-record .It Ar r diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index d99b0a85..42cdc88a 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -768,6 +768,9 @@ the file to read or write. Possible values are: @item i Intel Hex +@item I +Intel Hex with comments on download and tolerance of checksum errors on upload + @item s Motorola S-record diff --git a/src/fileio.c b/src/fileio.c index 1c81682d..f1df1158 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -59,10 +59,11 @@ struct ihexrec { static int b2ihex(unsigned char * inbuf, int bufsize, int recsize, int startaddr, - char * outfile, FILE * outf); + char * outfile, FILE * outf, FILEFMT ffmt); static int ihex2b(char * infile, FILE * inf, - AVRMEM * mem, int bufsize, unsigned int fileoffset); + AVRMEM * mem, int bufsize, unsigned int fileoffset, + FILEFMT ffmt); static int b2srec(unsigned char * inbuf, int bufsize, int recsize, int startaddr, @@ -79,7 +80,8 @@ static int fileio_rbin(struct fioparms * fio, char * filename, FILE * f, AVRMEM * mem, int size); static int fileio_ihex(struct fioparms * fio, - char * filename, FILE * f, AVRMEM * mem, int size); + char * filename, FILE * f, AVRMEM * mem, int size, + FILEFMT ffmt); static int fileio_srec(struct fioparms * fio, char * filename, FILE * f, AVRMEM * mem, int size); @@ -108,6 +110,7 @@ char * fmtstr(FILEFMT format) case FMT_AUTO : return "auto-detect"; break; case FMT_SREC : return "Motorola S-Record"; break; case FMT_IHEX : return "Intel Hex"; break; + case FMT_IHXC : return "Intel Hex with comments"; break; case FMT_RBIN : return "raw binary"; break; case FMT_ELF : return "ELF"; break; default : return "invalid format"; break; @@ -115,10 +118,9 @@ char * fmtstr(FILEFMT format) } - static int b2ihex(unsigned char * inbuf, int bufsize, int recsize, int startaddr, - char * outfile, FILE * outf) + char * outfile, FILE * outf, FILEFMT ffmt) { unsigned char * buf; unsigned int nextaddr; @@ -154,8 +156,20 @@ static int b2ihex(unsigned char * inbuf, int bufsize, cksum += buf[i]; } cksum = -cksum; - fprintf(outf, "%02X\n", cksum); - + fprintf(outf, "%02X", cksum); + + if(ffmt == FMT_IHXC) { /* Print comment with address and ASCII dump */ + for(i=n; i ", n_64k*0x10000 + nextaddr); + for (i=0; iop) { case FIO_WRITE: - rc = b2ihex(mem->buf, size, 32, fio->fileoffset, filename, f); + rc = b2ihex(mem->buf, size, 32, fio->fileoffset, filename, f, ffmt); if (rc < 0) { return -1; } break; case FIO_READ: - rc = ihex2b(filename, f, mem, size, fio->fileoffset); + rc = ihex2b(filename, f, mem, size, fio->fileoffset, ffmt); if (rc < 0) return -1; break; @@ -1547,7 +1570,8 @@ int fileio(int oprwv, char * filename, FILEFMT format, switch (format) { case FMT_IHEX: - rc = fileio_ihex(&fio, fname, f, mem, size); + case FMT_IHXC: + rc = fileio_ihex(&fio, fname, f, mem, size, format); break; case FMT_SREC: diff --git a/src/libavrdude.h b/src/libavrdude.h index 7088b108..6ef8da14 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -822,7 +822,8 @@ typedef enum { FMT_DEC, FMT_OCT, FMT_BIN, - FMT_ELF + FMT_ELF, + FMT_IHXC, } FILEFMT; struct fioparms { diff --git a/src/update.c b/src/update.c index d3c208fc..1840f81f 100644 --- a/src/update.c +++ b/src/update.c @@ -130,6 +130,7 @@ UPDATE * parse_op(char * s) case 'a': upd->format = FMT_AUTO; break; case 's': upd->format = FMT_SREC; break; case 'i': upd->format = FMT_IHEX; break; + case 'I': upd->format = FMT_IHXC; break; case 'r': upd->format = FMT_RBIN; break; case 'e': upd->format = FMT_ELF; break; case 'm': upd->format = FMT_IMM; break; From 5904611928565c135887f851dd7a101358e79fd9 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sun, 17 Jul 2022 12:51:43 +0200 Subject: [PATCH 125/511] Apply jtagmki patch provided in #443 --- src/jtagmkI.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/jtagmkI.c b/src/jtagmkI.c index 7a97217b..43141263 100644 --- a/src/jtagmkI.c +++ b/src/jtagmkI.c @@ -1058,7 +1058,7 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, { unsigned char cmd[6], datacmd[1 * 2 + 1]; unsigned char resp[1], writedata; - int len, need_progmode = 1; + int len, need_progmode = 1, need_dummy_read = 0; avrdude_message(MSG_NOTICE2, "%s: jtagmkI_write_byte(.., %s, 0x%lx, ...)\n", progname, mem->desc, addr); @@ -1075,17 +1075,22 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L; } else if (strcmp(mem->desc, "lfuse") == 0) { cmd[1] = MTYPE_FUSE_BITS; + need_dummy_read = 1; addr = 0; } else if (strcmp(mem->desc, "hfuse") == 0) { cmd[1] = MTYPE_FUSE_BITS; + need_dummy_read = 1; addr = 1; } else if (strcmp(mem->desc, "efuse") == 0) { cmd[1] = MTYPE_FUSE_BITS; + need_dummy_read = 1; addr = 2; } else if (strcmp(mem->desc, "lock") == 0) { cmd[1] = MTYPE_LOCK_BITS; + need_dummy_read = 1; } else if (strcmp(mem->desc, "calibration") == 0) { cmd[1] = MTYPE_OSCCAL_BYTE; + need_dummy_read = 1; } else if (strcmp(mem->desc, "signature") == 0) { cmd[1] = MTYPE_SIGN_JTAG; } @@ -1154,6 +1159,8 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, avrdude_message(MSG_NOTICE2, "OK\n"); } + if(need_dummy_read) + jtagmkI_recv(pgm, resp, 1); return 0; } From a5552f64cf0bea2a4f72e3a0dc90672d1bc2a18a Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 18 Jul 2022 14:38:37 +0100 Subject: [PATCH 126/511] Update NEWS --- NEWS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 7bea2bcb..84852dbf 100644 --- a/NEWS +++ b/NEWS @@ -38,6 +38,12 @@ Changes since version 7.0: - Fix ft245r paged read for ATmega2560 et al #1018 - Add option -A that supresses trailing 0xff optimisation and automatically do so for -c arduino #936 + - Fix linuxspi default port #933 + - Add support for high-voltage UPDI im jtag3.c #1015 + - Fix terminal write edge cases; + add one read mode; + add quell command #1025 + - Fix usbtiny read for parts with more than 64 kB flash #1029 * Internals: From ec467c465e8dc41505573cc5b814623ca59362e2 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Mon, 18 Jul 2022 17:13:10 +0200 Subject: [PATCH 127/511] Ignore -s flag as safemode is no longer supported Resolves #1032 --- src/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.c b/src/main.c index 1d00ae67..3ed3fc78 100644 --- a/src/main.c +++ b/src/main.c @@ -576,6 +576,7 @@ int main(int argc, char * argv []) terminal = 1; break; + case 's': case 'u': avrdude_message(MSG_INFO, "%s: \"safemode\" feature no longer supported\n", progname); From 0e7c1512e4bc15922e1a23966e1df5a1c24298c8 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 18 Jul 2022 17:34:06 +0100 Subject: [PATCH 128/511] =?UTF-8?q?Avoid=20the=20warning:=20enumeration=20?= =?UTF-8?q?value=20=E2=80=98CONNTYPE=5FSPI=E2=80=99=20not=20handled=20in?= =?UTF-8?q?=20switch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index f480b315..baaa0bb5 100644 --- a/src/main.c +++ b/src/main.c @@ -852,11 +852,11 @@ int main(int argc, char * argv []) port = DEFAULT_USB; break; -#ifdef HAVE_LINUXSPI case CONNTYPE_SPI: - port = *default_spi ? default_spi : "unknown"; - break; +#ifdef HAVE_LINUXSPI + port = *default_spi? default_spi: "unknown"; #endif + break; } } From f95a1d34482da4387b3c0fdc677d7660361c4e0f Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 18 Jul 2022 18:10:09 +0100 Subject: [PATCH 129/511] Cache config_file components in AVRPART and PROGRAMMER structures Some 90% of the space of AVRPART and some 50% of PROGRAMMER is occupied by a 4 kB array config_file[] that contains the configuration file name. In preparation of developer options that output a raw dump of the part descriptions, this commit changes the config_file components from a large array, which is duplicated in each part and programmer description, to a cached string for each config file allowing for smaller raw dumps. This commit also changes the config file name to its realpath(), eg, shortens unwarranted `/bin/../etc/` file name components. It also changes the global variable names `infile` and `fileno` to cfg_infile and cfg_fileno for an ever so slight improvement of code clarity. --- src/avrpart.c | 2 +- src/config.c | 65 +++++++++++++++++++++++++++++++++++++++-------- src/config.h | 6 +++-- src/config_gram.y | 26 +++++++++---------- src/lexer.l | 8 +++--- src/libavrdude.h | 6 ++--- src/pgm.c | 2 +- 7 files changed, 80 insertions(+), 35 deletions(-) diff --git a/src/avrpart.c b/src/avrpart.c index d862ae24..34608155 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -568,7 +568,7 @@ AVRPART * avr_new_part(void) p->reset_disposition = RESET_DEDICATED; p->retry_pulse = PIN_AVR_SCK; p->flags = AVRPART_SERIALOK | AVRPART_PARALLELOK | AVRPART_ENABLEPAGEPROGRAMMING; - p->config_file[0] = 0; + p->config_file = NULL; p->lineno = 0; memset(p->signature, 0xFF, 3); p->ctl_stack_type = CTL_STACK_NONE; diff --git a/src/config.c b/src/config.c index 00ac8b0e..4308407e 100644 --- a/src/config.c +++ b/src/config.c @@ -50,8 +50,8 @@ LISTID part_list; LISTID programmers; bool is_alias; -int lineno; -const char * infile; +int cfg_lineno; +char * cfg_infile; extern char * yytext; @@ -76,8 +76,8 @@ int init_config(void) programmers = lcreat(NULL, 0); is_alias = false; - lineno = 1; - infile = NULL; + cfg_lineno = 1; + cfg_infile = NULL; return 0; } @@ -99,7 +99,7 @@ int yyerror(char * errmsg, ...) va_start(args, errmsg); vsnprintf(message, sizeof(message), errmsg, args); - avrdude_message(MSG_INFO, "%s: error at %s:%d: %s\n", progname, infile, lineno, message); + avrdude_message(MSG_INFO, "%s: error at %s:%d: %s\n", progname, cfg_infile, cfg_lineno, message); va_end(args); @@ -116,7 +116,7 @@ int yywarning(char * errmsg, ...) va_start(args, errmsg); vsnprintf(message, sizeof(message), errmsg, args); - avrdude_message(MSG_INFO, "%s: warning at %s:%d: %s\n", progname, infile, lineno, message); + avrdude_message(MSG_INFO, "%s: warning at %s:%d: %s\n", progname, cfg_infile, cfg_lineno, message); va_end(args); @@ -329,15 +329,22 @@ int read_config(const char * file) FILE * f; int r; - f = fopen(file, "r"); - if (f == NULL) { - avrdude_message(MSG_INFO, "%s: can't open config file \"%s\": %s\n", + if(!(cfg_infile = realpath(file, NULL))) { + avrdude_message(MSG_INFO, "%s: can't determine realpath() of config file \"%s\": %s\n", progname, file, strerror(errno)); return -1; } - lineno = 1; - infile = file; + f = fopen(cfg_infile, "r"); + if (f == NULL) { + avrdude_message(MSG_INFO, "%s: can't open config file \"%s\": %s\n", + progname, cfg_infile, strerror(errno)); + free(cfg_infile); + cfg_infile = NULL; + return -1; + } + + cfg_lineno = 1; yyin = f; r = yyparse(); @@ -349,5 +356,41 @@ int read_config(const char * file) fclose(f); + if(cfg_infile) { + free(cfg_infile); + cfg_infile = NULL; + } + return r; } + + +// Linear-search cache for a few often-referenced strings +char *cache_string(const char *file) { + static char **fnames; + static int n=0; + + if(!file) + return NULL; + + // Exists in cache? + for(int i=0; ilineno; + int temp = cfg_lineno; cfg_lineno = current_prog->lineno; yywarning("programmer %s overwrites previous definition %s:%d.", id, existing_prog->config_file, existing_prog->lineno); - lineno = temp; + cfg_lineno = temp; } lrmv_d(programmers, existing_prog); pgm_free(existing_prog); @@ -311,8 +311,8 @@ prog_decl : yyerror("could not create pgm instance"); YYABORT; } - strcpy(current_prog->config_file, infile); - current_prog->lineno = lineno; + current_prog->config_file = cache_string(cfg_infile); + current_prog->lineno = cfg_lineno; } | K_PROGRAMMER K_PARENT TKN_STRING @@ -329,8 +329,8 @@ prog_decl : free_token($3); YYABORT; } - strcpy(current_prog->config_file, infile); - current_prog->lineno = lineno; + current_prog->config_file = cache_string(cfg_infile); + current_prog->lineno = cfg_lineno; free_token($3); } ; @@ -380,11 +380,11 @@ part_def : existing_part = locate_part(part_list, current_part->id); if (existing_part) { { /* temporarily set lineno to lineno of part start */ - int temp = lineno; lineno = current_part->lineno; + int temp = cfg_lineno; cfg_lineno = current_part->lineno; yywarning("part %s overwrites previous definition %s:%d.", current_part->id, existing_part->config_file, existing_part->lineno); - lineno = temp; + cfg_lineno = temp; } lrmv_d(part_list, existing_part); avr_free_part(existing_part); @@ -402,8 +402,8 @@ part_decl : yyerror("could not create part instance"); YYABORT; } - strcpy(current_part->config_file, infile); - current_part->lineno = lineno; + current_part->config_file = cache_string(cfg_infile); + current_part->lineno = cfg_lineno; } | K_PART K_PARENT TKN_STRING { @@ -420,8 +420,8 @@ part_decl : free_token($3); YYABORT; } - strcpy(current_part->config_file, infile); - current_part->lineno = lineno; + current_part->config_file = cache_string(cfg_infile); + current_part->lineno = cfg_lineno; free_token($3); } @@ -1362,7 +1362,7 @@ mem_spec : if (ps <= 0) avrdude_message(MSG_INFO, "%s, line %d: invalid page size %d, ignored\n", - infile, lineno, ps); + cfg_infile, cfg_lineno, ps); else current_mem->page_size = ps; free_token($3); diff --git a/src/lexer.l b/src/lexer.l index 38d988db..4db95f6d 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -73,19 +73,19 @@ SIGN [+-] # { /* The following eats '#' style comments to end of line */ BEGIN(comment); } [^\n] { /* eat comments */ } -\n { lineno++; BEGIN(INITIAL); } +\n { cfg_lineno++; BEGIN(INITIAL); } "/*" { /* The following eats multiline C style comments */ int c; int comment_start; - comment_start = lineno; + comment_start = cfg_lineno; while (1) { while (((c = input()) != '*') && (c != EOF)) { /* eat up text of comment, but keep counting lines */ if (c == '\n') - lineno++; + cfg_lineno++; } if (c == '*') { @@ -256,7 +256,7 @@ yes { yylval=new_token(K_YES); return K_YES; } "(" { yylval = NULL; pyytext(); return TKN_LEFT_PAREN; } ")" { yylval = NULL; pyytext(); return TKN_RIGHT_PAREN; } -"\n" { lineno++; } +"\n" { cfg_lineno++; } [ \r\t]+ { /* ignore whitespace */ } c: { yyerror("possible old-style config file entry\n" diff --git a/src/libavrdude.h b/src/libavrdude.h index 36ad9aa8..887c5227 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -277,8 +277,8 @@ typedef struct avrpart { LISTID mem; /* avr memory definitions */ LISTID mem_alias; /* memory alias definitions */ - char config_file[PATH_MAX]; /* config file where defined */ - int lineno; /* config file line number */ + char *config_file; /* config file where defined */ + int lineno; /* config file line number */ } AVRPART; #define AVR_MEMDESCLEN 64 @@ -726,7 +726,7 @@ typedef struct programmer_t { int (*parseextparams) (struct programmer_t * pgm, LISTID xparams); void (*setup) (struct programmer_t * pgm); void (*teardown) (struct programmer_t * pgm); - char config_file[PATH_MAX]; /* config file where defined */ + char *config_file; /* config file where defined */ int lineno; /* config file line number */ void *cookie; /* for private use by the programmer */ char flag; /* for private use of the programmer */ diff --git a/src/pgm.c b/src/pgm.c index 4580cbbd..d85f35e4 100644 --- a/src/pgm.c +++ b/src/pgm.c @@ -79,7 +79,7 @@ PROGRAMMER * pgm_new(void) pgm->usbpid = lcreat(NULL, 0); pgm->desc[0] = 0; pgm->type[0] = 0; - pgm->config_file[0] = 0; + pgm->config_file = NULL; pgm->lineno = 0; pgm->baudrate = 0; pgm->initpgm = NULL; From eba67e56fccbb6ebf73c187f8753d3cfd37b3858 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 07:42:44 +0100 Subject: [PATCH 130/511] Make realpath() available for MSC and MINGW32 --- src/config_gram.y | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/config_gram.y b/src/config_gram.y index 2c6c1f46..fa74bec9 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -30,6 +30,10 @@ #include "libavrdude.h" #include "config.h" +#if defined(_MSC_VER) || defined(__MINGW32__) +#define realpath(N,R) _fullpath((R), (N), PATH_MAX) +#endif + #if defined(WIN32) #define strtok_r( _s, _sep, _lasts ) \ ( *(_lasts) = strtok( (_s), (_sep) ) ) From e52bd2b99bcf592caccf84ec7790b479a27cfc68 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 08:05:42 +0100 Subject: [PATCH 131/511] Move realpath() compatibility definition from config_gram.y to config.h --- src/config.h | 4 ++++ src/config_gram.y | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.h b/src/config.h index 4d777c5e..a20af733 100644 --- a/src/config.h +++ b/src/config.h @@ -25,6 +25,10 @@ #include "libavrdude.h" +#if defined(WIN32) || defined(_MSC_VER) || defined(__MINGW32__) +#define realpath(N,R) _fullpath((R), (N), PATH_MAX) +#endif + #define MAX_STR_CONST 1024 diff --git a/src/config_gram.y b/src/config_gram.y index fa74bec9..2c6c1f46 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -30,10 +30,6 @@ #include "libavrdude.h" #include "config.h" -#if defined(_MSC_VER) || defined(__MINGW32__) -#define realpath(N,R) _fullpath((R), (N), PATH_MAX) -#endif - #if defined(WIN32) #define strtok_r( _s, _sep, _lasts ) \ ( *(_lasts) = strtok( (_s), (_sep) ) ) From 8989e6515b102f6984620b1b6cec675d7fe4c1b3 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 14:38:34 +0100 Subject: [PATCH 132/511] Change macros __f() to _f() and adapt to config_file and hvupdi changes --- src/developer_opts.c | 160 +++++++++++++++++------------------ src/developer_opts_private.h | 34 ++++---- src/libavrdude.h | 2 + 3 files changed, 97 insertions(+), 99 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index 76ab3160..482ece7d 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -485,8 +485,7 @@ static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { d->base = *p; - // remove location info - memset(d->base.config_file, 0, sizeof d->base.config_file); + d->base.config_file = NULL; d->base.lineno = 0; // zap all bytes beyond terminating nul of desc, id and family_id array @@ -567,64 +566,60 @@ static void dev_part_raw(AVRPART *part) { static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { - char real_config_file[PATH_MAX]; - - if(!realpath(p->config_file, real_config_file)) - memcpy(real_config_file, p->config_file, sizeof real_config_file); - - dev_info("# %s %d\n", real_config_file, p->lineno); + dev_info("# %s %d\n", p->config_file, p->lineno); if(!tsv) dev_info("part\n"); - __if_partout(strcmp, "\"%s\"", desc); - __if_partout(strcmp, "\"%s\"", id); - __if_partout(strcmp, "\"%s\"", family_id); - __if_partout(intcmp, "0x%02x", stk500_devcode); - __if_partout(intcmp, "0x%02x", avr910_devcode); - __if_partout(intcmp, "%d", chip_erase_delay); - __if_partout(intcmp, "0x%02x", pagel); - __if_partout(intcmp, "0x%02x", bs2); - __if_n_partout_str(memcmp, sizeof p->signature, dev_sprintf("0x%02x 0x%02x 0x%02x", p->signature[0], p->signature[1], p->signature[2]), signature); - __if_partout(intcmp, "0x%04x", usbpid); + _if_partout(strcmp, "\"%s\"", desc); + _if_partout(strcmp, "\"%s\"", id); + _if_partout(strcmp, "\"%s\"", family_id); + _if_partout(intcmp, "%d", hvupdi_variant); + _if_partout(intcmp, "0x%02x", stk500_devcode); + _if_partout(intcmp, "0x%02x", avr910_devcode); + _if_partout(intcmp, "%d", chip_erase_delay); + _if_partout(intcmp, "0x%02x", pagel); + _if_partout(intcmp, "0x%02x", bs2); + _if_n_partout_str(memcmp, sizeof p->signature, dev_sprintf("0x%02x 0x%02x 0x%02x", p->signature[0], p->signature[1], p->signature[2]), signature); + _if_partout(intcmp, "0x%04x", usbpid); if(!base || base->reset_disposition != p->reset_disposition) - __partout_str(strdup(p->reset_disposition == RESET_DEDICATED? "dedicated": p->reset_disposition == RESET_IO? "io": "unknown"), reset); + _partout_str(strdup(p->reset_disposition == RESET_DEDICATED? "dedicated": p->reset_disposition == RESET_IO? "io": "unknown"), reset); - __if_partout_str(intcmp, strdup(p->retry_pulse == PIN_AVR_RESET? "reset": p->retry_pulse == PIN_AVR_SCK? "sck": "unknown"), retry_pulse); + _if_partout_str(intcmp, strdup(p->retry_pulse == PIN_AVR_RESET? "reset": p->retry_pulse == PIN_AVR_SCK? "sck": "unknown"), retry_pulse); if(!base || base->flags != p->flags) { if(tsv) { - __partout("0x%04x", flags); + _partout("0x%04x", flags); } else { - __if_flagout(AVRPART_HAS_JTAG, has_jtag); - __if_flagout(AVRPART_HAS_DW, has_debugwire); - __if_flagout(AVRPART_HAS_PDI, has_pdi); - __if_flagout(AVRPART_HAS_UPDI, has_updi); - __if_flagout(AVRPART_HAS_TPI, has_tpi); - __if_flagout(AVRPART_IS_AT90S1200, is_at90s1200); - __if_flagout(AVRPART_AVR32, is_avr32); - __if_flagout(AVRPART_ALLOWFULLPAGEBITSTREAM, allowfullpagebitstream); - __if_flagout(AVRPART_ENABLEPAGEPROGRAMMING, enablepageprogramming); - __if_flagout(AVRPART_SERIALOK, serial); + _if_flagout(AVRPART_HAS_JTAG, has_jtag); + _if_flagout(AVRPART_HAS_DW, has_debugwire); + _if_flagout(AVRPART_HAS_PDI, has_pdi); + _if_flagout(AVRPART_HAS_UPDI, has_updi); + _if_flagout(AVRPART_HAS_TPI, has_tpi); + _if_flagout(AVRPART_IS_AT90S1200, is_at90s1200); + _if_flagout(AVRPART_AVR32, is_avr32); + _if_flagout(AVRPART_ALLOWFULLPAGEBITSTREAM, allowfullpagebitstream); + _if_flagout(AVRPART_ENABLEPAGEPROGRAMMING, enablepageprogramming); + _if_flagout(AVRPART_SERIALOK, serial); if(!base || (base->flags & (AVRPART_PARALLELOK | AVRPART_PSEUDOPARALLEL)) != (p->flags & (AVRPART_PARALLELOK | AVRPART_PSEUDOPARALLEL))) { int par = p->flags & (AVRPART_PARALLELOK | AVRPART_PSEUDOPARALLEL); - __partout_str(strdup(par == 0? "no": par == AVRPART_PSEUDOPARALLEL? "unknown": AVRPART_PARALLELOK? "yes": "pseudo"), parallel); + _partout_str(strdup(par == 0? "no": par == AVRPART_PSEUDOPARALLEL? "unknown": AVRPART_PARALLELOK? "yes": "pseudo"), parallel); } } } - __if_partout(intcmp, "%d", timeout); - __if_partout(intcmp, "%d", stabdelay); - __if_partout(intcmp, "%d", cmdexedelay); - __if_partout(intcmp, "%d", synchloops); - __if_partout(intcmp, "%d", bytedelay); - __if_partout(intcmp, "%d", pollindex); - __if_partout(intcmp, "0x%02x", pollvalue); - __if_partout(intcmp, "%d", predelay); - __if_partout(intcmp, "%d", postdelay); - __if_partout(intcmp, "%d", pollmethod); + _if_partout(intcmp, "%d", timeout); + _if_partout(intcmp, "%d", stabdelay); + _if_partout(intcmp, "%d", cmdexedelay); + _if_partout(intcmp, "%d", synchloops); + _if_partout(intcmp, "%d", bytedelay); + _if_partout(intcmp, "%d", pollindex); + _if_partout(intcmp, "0x%02x", pollvalue); + _if_partout(intcmp, "%d", predelay); + _if_partout(intcmp, "%d", postdelay); + _if_partout(intcmp, "%d", pollmethod); if(!base && p->ctl_stack_type != CTL_STACK_NONE) dev_stack_out(tsv, p, dev_controlstack_name(p), p->controlstack, CTL_STACK_SIZE); @@ -639,32 +634,33 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { if(!base || memcmp(base->eeprom_instr, p->eeprom_instr, sizeof base->eeprom_instr)) dev_stack_out(tsv, p, "eeprom_instr", p->eeprom_instr, EEPROM_INSTR_SIZE); - __if_partout(intcmp, "%d", hventerstabdelay); - __if_partout(intcmp, "%d", progmodedelay); - __if_partout(intcmp, "%d", latchcycles); - __if_partout(intcmp, "%d", togglevtg); - __if_partout(intcmp, "%d", poweroffdelay); - __if_partout(intcmp, "%d", resetdelayms); - __if_partout(intcmp, "%d", resetdelayus); - __if_partout(intcmp, "%d", hvleavestabdelay); - __if_partout(intcmp, "%d", resetdelay); - __if_partout(intcmp, "%d", chiperasepulsewidth); - __if_partout(intcmp, "%d", chiperasepolltimeout); - __if_partout(intcmp, "%d", chiperasetime); - __if_partout(intcmp, "%d", programfusepulsewidth); - __if_partout(intcmp, "%d", programfusepolltimeout); - __if_partout(intcmp, "%d", programlockpulsewidth); - __if_partout(intcmp, "%d", programlockpolltimeout); - __if_partout(intcmp, "%d", synchcycles); - __if_partout(intcmp, "%d", hvspcmdexedelay); - __if_partout(intcmp, "0x%02x", idr); - __if_partout(intcmp, "0x%02x", rampz); - __if_partout(intcmp, "0x%02x", spmcr); - __if_partout(intcmp, "0x%02x", eecr); // why is eecr an unsigned short? - __if_partout(intcmp, "0x%04x", mcu_base); - __if_partout(intcmp, "0x%04x", nvm_base); - __if_partout(intcmp, "0x%04x", ocd_base); - __if_partout(intcmp, "%d", ocdrev); + _if_partout(intcmp, "%d", hventerstabdelay); + _if_partout(intcmp, "%d", progmodedelay); + _if_partout(intcmp, "%d", latchcycles); + _if_partout(intcmp, "%d", togglevtg); + _if_partout(intcmp, "%d", poweroffdelay); + _if_partout(intcmp, "%d", resetdelayms); + _if_partout(intcmp, "%d", resetdelayus); + _if_partout(intcmp, "%d", hvleavestabdelay); + _if_partout(intcmp, "%d", resetdelay); + _if_partout(intcmp, "%d", chiperasepulsewidth); + _if_partout(intcmp, "%d", chiperasepolltimeout); + _if_partout(intcmp, "%d", chiperasetime); + _if_partout(intcmp, "%d", programfusepulsewidth); + _if_partout(intcmp, "%d", programfusepolltimeout); + _if_partout(intcmp, "%d", programlockpulsewidth); + _if_partout(intcmp, "%d", programlockpolltimeout); + _if_partout(intcmp, "%d", synchcycles); + _if_partout(intcmp, "%d", hvspcmdexedelay); + + _if_partout(intcmp, "0x%02x", idr); + _if_partout(intcmp, "0x%02x", rampz); + _if_partout(intcmp, "0x%02x", spmcr); + _if_partout(intcmp, "0x%02x", eecr); // why is eecr an unsigned short? + _if_partout(intcmp, "0x%04x", mcu_base); + _if_partout(intcmp, "0x%04x", nvm_base); + _if_partout(intcmp, "0x%04x", ocd_base); + _if_partout(intcmp, "%d", ocdrev); for(int i=0; i < AVR_OP_MAX; i++) if(!base || opcodecmp(p->op[i], base->op[i])) @@ -692,20 +688,20 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { dev_info("\n memory \"%s\"\n", m->desc); } - __if_memout_yn(paged); - __if_memout(intcmp, m->size > 8192? "0x%x": "%d", size); - __if_memout(intcmp, "%d", page_size); - __if_memout(intcmp, "%d", num_pages); // why can AVRDUDE not compute this? - __if_memout(intcmp, "0x%x", offset); - __if_memout(intcmp, "%d", min_write_delay); - __if_memout(intcmp, "%d", max_write_delay); - __if_memout_yn(pwroff_after_write); - __if_n_memout_str(memcmp, 2, dev_sprintf("0x%02x 0x%02x", m->readback[0], m->readback[1]), readback); - __if_memout(intcmp, "%d", mode); - __if_memout(intcmp, "%d", delay); - __if_memout(intcmp, "%d", blocksize); - __if_memout(intcmp, "%d", readsize); - __if_memout(intcmp, "%d", pollindex); + _if_memout_yn(paged); + _if_memout(intcmp, m->size > 8192? "0x%x": "%d", size); + _if_memout(intcmp, "%d", page_size); + _if_memout(intcmp, "%d", num_pages); // why can AVRDUDE not compute this? + _if_memout(intcmp, "0x%x", offset); + _if_memout(intcmp, "%d", min_write_delay); + _if_memout(intcmp, "%d", max_write_delay); + _if_memout_yn(pwroff_after_write); + _if_n_memout_str(memcmp, 2, dev_sprintf("0x%02x 0x%02x", m->readback[0], m->readback[1]), readback); + _if_memout(intcmp, "%d", mode); + _if_memout(intcmp, "%d", delay); + _if_memout(intcmp, "%d", blocksize); + _if_memout(intcmp, "%d", readsize); + _if_memout(intcmp, "%d", pollindex); for(int i=0; i < AVR_OP_MAX; i++) if(!bm || opcodecmp(bm->op[i], m->op[i])) diff --git a/src/developer_opts_private.h b/src/developer_opts_private.h index b05949bd..9bdd185a 100644 --- a/src/developer_opts_private.h +++ b/src/developer_opts_private.h @@ -51,66 +51,66 @@ static int dev_message(int msglvl, const char *fmt, ...); #define dev_notice(...) dev_message(DEV_NOTICE, __VA_ARGS__) #define dev_notice2(...) dev_message(DEV_NOTICE2, __VA_ARGS__) -#define __partout(fmt, component) \ +#define _partout(fmt, component) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)) -#define __if_partout(cmp, fmt, component) ({ \ +#define _if_partout(cmp, fmt, component) ({ \ if(!base || cmp(base->component, p->component)) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)); \ }) -#define __if_n_partout(cmp, n, fmt, component) ({ \ +#define _if_n_partout(cmp, n, fmt, component) ({ \ if(!base || cmp(base->component, p->component, n)) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)); \ }) -#define __partout_str(result, component) \ +#define _partout_str(result, component) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result) -#define __if_partout_str(cmp, result, component) ({ \ +#define _if_partout_str(cmp, result, component) ({ \ if(!base || cmp(base->component, p->component)) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result); \ }) -#define __if_n_partout_str(cmp, n, result, component) ({ \ +#define _if_n_partout_str(cmp, n, result, component) ({ \ if(!base || cmp(base->component, p->component, n)) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result); \ }) -#define __memout(fmt, component) \ +#define _memout(fmt, component) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component)) -#define __if_memout(cmp, fmt, component) ({ \ +#define _if_memout(cmp, fmt, component) ({ \ if(!bm || cmp(bm->component, m->component)) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component)); \ }) -#define __memout_str(result, component) \ +#define _memout_str(result, component) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result) -#define __if_n_memout_str(cmp, n, result, component) ({ \ +#define _if_n_memout_str(cmp, n, result, component) ({ \ if(!bm || cmp(bm->component, m->component, n)) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result); \ }) -#define __memout_yn(component) \ +#define _memout_yn(component) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, strdup(m->component? "yes": "no")) -#define __if_memout_yn(component) ({ \ +#define _if_memout_yn(component) ({ \ if(!bm || bm->component != m->component) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, strdup(m->component? "yes": "no")); \ }) -#define __flagout(mask, name) \ - __partout_str(strdup(p->flags & (mask)? "yes": "no"), name) +#define _flagout(mask, name) \ + _partout_str(strdup(p->flags & (mask)? "yes": "no"), name) -#define __if_flagout(mask, name) ({ \ +#define _if_flagout(mask, name) ({ \ if(!base || (base->flags & (mask)) != (p->flags & (mask))) \ - __partout_str(strdup(p->flags & (mask)? "yes": "no"), name); \ + _partout_str(strdup(p->flags & (mask)? "yes": "no"), name); \ }) -#define __cmderr(result, component) \ +#define _cmderr(result, component) \ dev_part_strct_entry(tsv, ".cmderr", p->desc, m->desc, #component, result) #endif diff --git a/src/libavrdude.h b/src/libavrdude.h index 5e0e7807..c55608bc 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -183,6 +183,7 @@ typedef struct opcode { } OPCODE; +/* Any changes here, please also reflect in dev_part_strct() of developer_opts.c */ #define AVRPART_SERIALOK 0x0001 /* part supports serial programming */ #define AVRPART_PARALLELOK 0x0002 /* part supports parallel programming */ #define AVRPART_PSEUDOPARALLEL 0x0004 /* part has pseudo parallel support */ @@ -212,6 +213,7 @@ typedef struct opcode { #define TAG_ALLOCATED 1 /* memory byte is allocated */ +/* Any changes here, please also reflect in dev_part_strct() of developer_opts.c */ typedef struct avrpart { char desc[AVR_DESCLEN]; /* long part name */ char id[AVR_IDLEN]; /* short part name */ From 8da9c2bbf6b4e9467d362f0af242189b5173a94f Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 14:46:08 +0100 Subject: [PATCH 133/511] Correct bit number for lone 'a' in config_gram.y When an SPI command has a lone 'a' the initialisation now is as would be expected by all commands that take an address. Atmel's opcodes for SPI programming are consistent in this respect. This commit makes specifying the bit number in avrdude.conf optional. Instead of read_lo = "0 0 1 0 0 0 0 0 0 0 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; one can now use read_lo = "0 0 1 0 0 0 0 0 0 0 a a a a a a a a a a a a a a o o o o o o o o"; --- src/config_gram.y | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/config_gram.y b/src/config_gram.y index 2c6c1f46..71553aaa 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -45,7 +45,7 @@ int yywarning(char * errmsg, ...); static int assign_pin(int pinno, TOKEN * v, int invert); static int assign_pin_list(int invert); static int which_opcode(TOKEN * opcode); -static int parse_cmdbits(OPCODE * op); +static int parse_cmdbits(OPCODE * op, int opnum); static int pin_name; %} @@ -1317,7 +1317,8 @@ part_parm : free_token($1); YYABORT; } - if(0 != parse_cmdbits(op)) YYABORT; + if(0 != parse_cmdbits(op, opnum)) + YYABORT; if (current_part->op[opnum] != NULL) { /*yywarning("operation redefined");*/ avr_free_opcode(current_part->op[opnum]); @@ -1455,7 +1456,8 @@ mem_spec : free_token($1); YYABORT; } - if(0 != parse_cmdbits(op)) YYABORT; + if(0 != parse_cmdbits(op, opnum)) + YYABORT; if (current_mem->op[opnum] != NULL) { /*yywarning("operation redefined");*/ avr_free_opcode(current_mem->op[opnum]); @@ -1579,7 +1581,7 @@ static int which_opcode(TOKEN * opcode) } -static int parse_cmdbits(OPCODE * op) +static int parse_cmdbits(OPCODE * op, int opnum) { TOKEN * t; int bitno; @@ -1635,7 +1637,10 @@ static int parse_cmdbits(OPCODE * op) case 'a': op->bit[bitno].type = AVR_CMDBIT_ADDRESS; op->bit[bitno].value = 0; - op->bit[bitno].bitno = 8*(bitno/8) + bitno % 8; + op->bit[bitno].bitno = bitno < 8 || bitno > 23? 0: + opnum == AVR_OP_LOAD_EXT_ADDR? bitno+8: bitno-8; /* correct bit number for lone 'a' */ + if(bitno < 8 || bitno > 23) + yywarning("address bits don't normally appear in Byte 0 or Byte 3 of SPI programming commands"); break; case 'i': op->bit[bitno].type = AVR_CMDBIT_INPUT; @@ -1679,5 +1684,8 @@ static int parse_cmdbits(OPCODE * op) } /* while */ + if(bitno > 0) + yywarning("too few opcode bits in instruction"); + return rv; } From bb6e1bbaecffaad45663c6333e000e60dc476830 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 15:01:51 +0100 Subject: [PATCH 134/511] Add avrdude.conf new syntax: readback = 0x80 0x7f; --- src/config_gram.y | 9 +++++++++ src/lexer.l | 1 + 2 files changed, 10 insertions(+) diff --git a/src/config_gram.y b/src/config_gram.y index 71553aaa..e2dd669a 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -112,6 +112,7 @@ static int pin_name; %token K_PSEUDO %token K_PWROFF_AFTER_WRITE %token K_RDYLED +%token K_READBACK %token K_READBACK_P1 %token K_READBACK_P2 %token K_READMEM @@ -1399,6 +1400,14 @@ mem_spec : free_token($3); } | + K_READBACK TKN_EQUAL TKN_NUMBER TKN_NUMBER + { + current_mem->readback[0] = $3->value.number; + current_mem->readback[1] = $4->value.number; + free_token($3); + free_token($4); + } | + K_READBACK_P1 TKN_EQUAL TKN_NUMBER { current_mem->readback[0] = $3->value.number; diff --git a/src/lexer.l b/src/lexer.l index 4db95f6d..e392324a 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -213,6 +213,7 @@ rdyled { yylval=NULL; return K_RDYLED; } read { yylval=new_token(K_READ); return K_READ; } read_hi { yylval=new_token(K_READ_HI); return K_READ_HI; } read_lo { yylval=new_token(K_READ_LO); return K_READ_LO; } +readback { yylval=NULL; return K_READBACK; } readback_p1 { yylval=NULL; return K_READBACK_P1; } readback_p2 { yylval=NULL; return K_READBACK_P2; } readsize { yylval=NULL; return K_READSIZE; } From f8b6a246efbd3658c6185d43054df118f6c69866 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 15:17:00 +0100 Subject: [PATCH 135/511] Add in lexer.l capability to scan negative decimal integers or reals --- src/lexer.l | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lexer.l b/src/lexer.l index e392324a..f2f4b2ce 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -57,12 +57,9 @@ SIGN [+-] %% -#{SIGN}*{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; } -#{SIGN}*{DIGIT}+"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; } -#{SIGN}*"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; } -{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; } -{DIGIT}+"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; } -"."{DIGIT}+ { yylval = number_real(yytext); return TKN_NUMBER_REAL; } +{SIGN}?{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; } +{SIGN}?{DIGIT}+"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; } +{SIGN}?"."{DIGIT}+ { yylval = number_real(yytext); return TKN_NUMBER_REAL; } "\"" { string_buf_ptr = string_buf; BEGIN(strng); } From 8503f2d2d54823bee32ad753ef7da1252a7cb542 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 15:38:54 +0100 Subject: [PATCH 136/511] Add avrdude.conf syntax opcode = NULL; for SPI programming --- src/config_gram.y | 28 ++++++++++++++++++++++++++++ src/lexer.l | 1 + 2 files changed, 29 insertions(+) diff --git a/src/config_gram.y b/src/config_gram.y index e2dd669a..0ca1d782 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -50,6 +50,8 @@ static int parse_cmdbits(OPCODE * op, int opnum); static int pin_name; %} +%token K_NULL; + %token K_READ %token K_WRITE %token K_READ_LO @@ -1326,6 +1328,19 @@ part_parm : } current_part->op[opnum] = op; + free_token($1); + } + } | + + opcode TKN_EQUAL K_NULL { + { + int opnum = which_opcode($1); + if(opnum < 0) + YYABORT; + if(current_part->op[opnum] != NULL) + avr_free_opcode(current_part->op[opnum]); + current_part->op[opnum] = NULL; + free_token($1); } } @@ -1473,6 +1488,19 @@ mem_spec : } current_mem->op[opnum] = op; + free_token($1); + } + } | + + opcode TKN_EQUAL K_NULL { + { + int opnum = which_opcode($1); + if(opnum < 0) + YYABORT; + if(current_mem->op[opnum] != NULL) + avr_free_opcode(current_mem->op[opnum]); + current_mem->op[opnum] = NULL; + free_token($1); } } diff --git a/src/lexer.l b/src/lexer.l index f2f4b2ce..91d02597 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -176,6 +176,7 @@ miso { yylval=NULL; return K_MISO; } mode { yylval=NULL; return K_MODE; } mosi { yylval=NULL; return K_MOSI; } no { yylval=new_token(K_NO); return K_NO; } +NULL { yylval=NULL; return K_NULL; } num_banks { yylval=NULL; return K_NUM_PAGES; } num_pages { yylval=NULL; return K_NUM_PAGES; } nvm_base { yylval=NULL; return K_NVM_BASE; } From 155590660464b6a10e3f79340097a90f84da3df4 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 15:58:40 +0100 Subject: [PATCH 137/511] Add avrdude.conf syntax memory "name" = NULL; --- src/config_gram.y | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/config_gram.y b/src/config_gram.y index 0ca1d782..bdea3352 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -1306,7 +1306,16 @@ part_parm : } current_mem = NULL; } | - + K_MEMORY TKN_STRING TKN_EQUAL K_NULL + { + AVRMEM *existing_mem = avr_locate_mem_noalias(current_part, $2->value.string); + if (existing_mem != NULL) { + lrmv_d(current_part->mem, existing_mem); + avr_free_mem(existing_mem); + } + free_token($2); + current_mem = NULL; + } | opcode TKN_EQUAL string_list { { int opnum; From bdb5ba60552d25b56fe5f681cdbf90041dbb2172 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 16:16:55 +0100 Subject: [PATCH 138/511] Add avrdude.conf syntax ((pp|hvsp)_controlstack|(eeprom|flash)_instr) = NULL; --- src/config_gram.y | 26 ++++++++++++++++++++++++++ src/developer_opts.c | 4 ++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/config_gram.y b/src/config_gram.y index bdea3352..6f6f8765 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -800,6 +800,13 @@ part_parm : } } | + K_PP_CONTROLSTACK TKN_EQUAL K_NULL { + { + current_part->ctl_stack_type = CTL_STACK_NONE; + memset(current_part->controlstack, 0, CTL_STACK_SIZE); + } + } | + K_HVSP_CONTROLSTACK TKN_EQUAL num_list { { TOKEN * t; @@ -831,6 +838,13 @@ part_parm : } } | + K_HVSP_CONTROLSTACK TKN_EQUAL K_NULL { + { + current_part->ctl_stack_type = CTL_STACK_NONE; + memset(current_part->controlstack, 0, CTL_STACK_SIZE); + } + } | + K_FLASH_INSTR TKN_EQUAL num_list { { TOKEN * t; @@ -861,6 +875,12 @@ part_parm : } } | + K_FLASH_INSTR TKN_EQUAL K_NULL { + { + memset(current_part->flash_instr, 0, FLASH_INSTR_SIZE); + } + } | + K_EEPROM_INSTR TKN_EQUAL num_list { { TOKEN * t; @@ -891,6 +911,12 @@ part_parm : } } | + K_EEPROM_INSTR TKN_EQUAL K_NULL { + { + memset(current_part->eeprom_instr, 0, EEPROM_INSTR_SIZE); + } + } | + K_CHIP_ERASE_DELAY TKN_EQUAL TKN_NUMBER { current_part->chip_erase_delay = $3->value.number; diff --git a/src/developer_opts.c b/src/developer_opts.c index 482ece7d..5784b64f 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -363,13 +363,13 @@ static const char *dev_controlstack_name(AVRPART *p) { return p->ctl_stack_type == CTL_STACK_PP? "pp_controlstack": p->ctl_stack_type == CTL_STACK_HVSP? "hvsp_controlstack": - p->ctl_stack_type == CTL_STACK_NONE? "NONE": + p->ctl_stack_type == CTL_STACK_NONE? "NULL": "unknown_controlstack"; } static void dev_stack_out(bool tsv, AVRPART *p, const char *name, unsigned char *stack, int ns) { - if(!strcmp(name, "NONE")) { + if(!strcmp(name, "NULL")) { name = "pp_controlstack"; ns = 0; } From db37c9d2862b1229a91cb325ff70496d19d3ff10 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 20:00:17 +0100 Subject: [PATCH 139/511] Extend rather than reset memory entries in avrdude.conf This commit changes the philosophy whenever avrdude.conf encounters the same memory of a part for the second time or whenever a memory is described that, through inheritance, already existed: AVRDUDE no longer zaps the memory, it rather extends it. Therefore, avrdude.conf.in's entry for ATmega128RFA1, which inherits from the ATmega2561, needs a line `load_ext_addr = NULL;` in its flash memory description to zap the inherited load_ext_addr SPI command. Other than this, avrdude.conf.in needs no other change in order to effect the same internal representation proving earlier updates to the .conf.in file correct that manually ensured inheritance of memory contents. --- src/avrdude.conf.in | 2 ++ src/config_gram.y | 36 ++++++++++++++++-------------------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 8fc67080..3b8c5a6e 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -11845,6 +11845,8 @@ part parent "m2561" " a7 x x x x x x x", " x x x x x x x x"; + load_ext_addr = NULL; + mode = 0x41; delay = 20; blocksize = 256; diff --git a/src/config_gram.y b/src/config_gram.y index 6f6f8765..7a8cb7eb 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -1304,31 +1304,27 @@ part_parm : */ K_MEMORY TKN_STRING - { - current_mem = avr_new_memtype(); - if (current_mem == NULL) { - yyerror("could not create mem instance"); - free_token($2); - YYABORT; + { /* select memory for extension or create if not there */ + AVRMEM *mem = avr_locate_mem_noalias(current_part, $2->value.string); + if(!mem) { + if(!(mem = avr_new_memtype())) { + yyerror("could not create mem instance"); + free_token($2); + YYABORT; + } + strncpy(mem->desc, $2->value.string, AVR_MEMDESCLEN - 1); + mem->desc[AVR_MEMDESCLEN-1] = 0; + ladd(current_part->mem, mem); } - strncpy(current_mem->desc, $2->value.string, AVR_MEMDESCLEN - 1); - current_mem->desc[AVR_MEMDESCLEN-1] = 0; + current_mem = mem; free_token($2); } mem_specs - { - AVRMEM * existing_mem; - - existing_mem = avr_locate_mem_noalias(current_part, current_mem->desc); - if (existing_mem != NULL) { - lrmv_d(current_part->mem, existing_mem); - avr_free_mem(existing_mem); - } - if (is_alias) { - avr_free_mem(current_mem); // alias mem has been already entered below + { + if (is_alias) { // alias mem has been already entered + lrmv_d(current_part->mem, current_mem); + avr_free_mem(current_mem); is_alias = false; - } else { - ladd(current_part->mem, current_mem); } current_mem = NULL; } | From bfdad78fcba338d0d8815cd98672ab2bb4558662 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Tue, 19 Jul 2022 23:44:22 +0200 Subject: [PATCH 140/511] Add EEPROM dummy read --- src/jtagmkI.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/jtagmkI.c b/src/jtagmkI.c index 43141263..e5d3d5d8 100644 --- a/src/jtagmkI.c +++ b/src/jtagmkI.c @@ -1072,6 +1072,7 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } else if (strcmp(mem->desc, "eeprom") == 0) { cmd[1] = MTYPE_EEPROM; need_progmode = 0; + need_dummy_read = 1; PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L; } else if (strcmp(mem->desc, "lfuse") == 0) { cmd[1] = MTYPE_FUSE_BITS; From 30041e3f5f4ce5f10e3679f61d30d6e01219acc5 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 22:59:46 +0100 Subject: [PATCH 141/511] Add compact alternative specification for SPI opcodes in avrdude.conf As the address bit numbers in the SPI opcodes are highly systematic, they don't really need to be specified. Each bit can therefore be described as one of the characters 0 (always 0), 1 (always 1), x (don't care, but will be set as 0), a (a copy of the correct bit of the byte or word address of read, write, load, pagewrite or load extended address command of memories with more than one byte), i (input bit for a load/write) or o (output bit from a read). The bits therefore do not need to be individually separated. If a string in the list of strings that describe an SPI opcode does *not* contain a space *and* is longer than 7 characters, it is interpreted as a compact bit-pattern representation. The characters 0, 1, x, a, i and o will be recognised as the corresponding bit, whilst any of the characters ., -, _ or / can act as arbitrary visual separators, which are ignored. Examples: loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; loadpage_lo = "0100.0000", "000x.xxxx", "xxaa.aaaa", "iiii.iiii"; loadpage_lo = "0100.0000", "000x.xxxx.xxaa.aaaa", "iiii.iiii"; loadpage_lo = "0100.0000-000x.xxxx--xxaa.aaaa-iiii.iiii"; loadpage_lo = "0100.0000/000x.xxxx/xxaa.aaaa/iiii.iiii"; The compact format is an extension of the current format, which remains valid. Both, the compact and the traditional specification can be mixed in different strings, albeit not in the same string: load_ext_addr = "0100.1101", "0000.0000.0000", "0 0 0 a16", "0000.0000"; --- src/config_gram.y | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/config_gram.y b/src/config_gram.y index 7a8cb7eb..3b979c20 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -1653,7 +1653,6 @@ static int parse_cmdbits(OPCODE * op, int opnum) { TOKEN * t; int bitno; - char ch; char * e; char * q; int len; @@ -1665,10 +1664,18 @@ static int parse_cmdbits(OPCODE * op, int opnum) t = lrmv_n(string_list, 1); - s = strtok_r(t->value.string, " ", &brkt); + char *str = t->value.string; + // Compact alternative specification? (eg, "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii") + char bit[2] = {0, 0}, *cc = str; + int compact = !strchr(str, ' ') && strlen(str) > 7; + + bit[0] = *cc++; + s = !compact? strtok_r(str, " ", &brkt): *bit? bit: NULL; while (rv == 0 && s != NULL) { - bitno--; + // Ignore visual grouping characters in compact mode + if(*s != '.' && *s != '-' && *s != '_' && *s !='/') + bitno--; if (bitno < 0) { yyerror("too many opcode bits for instruction"); rv = -1; @@ -1683,10 +1690,8 @@ static int parse_cmdbits(OPCODE * op, int opnum) break; } - ch = s[0]; - if (len == 1) { - switch (ch) { + switch (*s) { case '1': op->bit[bitno].type = AVR_CMDBIT_VALUE; op->bit[bitno].value = 1; @@ -1720,14 +1725,19 @@ static int parse_cmdbits(OPCODE * op, int opnum) op->bit[bitno].value = 0; op->bit[bitno].bitno = bitno % 8; break; + case '.': + case '-': + case '_': + case '/': + break; default : - yyerror("invalid bit specifier '%c'", ch); + yyerror("invalid bit specifier '%c'", *s); rv = -1; break; } } else { - if (ch == 'a') { + if (*s == 'a') { q = &s[1]; op->bit[bitno].bitno = strtol(q, &e, 0); if ((e == q)||(*e != 0)) { @@ -1745,7 +1755,8 @@ static int parse_cmdbits(OPCODE * op, int opnum) } } - s = strtok_r(NULL, " ", &brkt); + bit[0] = *cc++; + s = !compact? strtok_r(NULL, " ", &brkt): *bit? bit: NULL; } /* while */ free_token(t); From 6afa115a5ffd40ffc174c2665e4513cfbefc54f4 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 23:44:58 +0100 Subject: [PATCH 142/511] Make -p*/s print SPI opcodes like "0100.0000--000.aaaa--aaaa.aaaa--iiii.iiii" --- src/developer_opts.c | 50 +++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index 5784b64f..1b3d17d9 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -115,25 +115,41 @@ static const char *opcodename(int what) { } -static char *opcode2str(OPCODE *op, int detailed) { +// Unique string representation of an opcode +static char *opcode2str(OPCODE *op, int opnum, int detailed) { char cb, space[1024], *sp = space; + int compact = 1; if(!op) return strdup("NULL"); + // Can the opcode be printed in a compact way? Only if address bits are systematic. + for(int i=31; i >= 0; i--) + if(op->bit[i].type == AVR_CMDBIT_ADDRESS) + if(i<8 || i>23 || op->bit[i].bitno != (opnum == AVR_OP_LOAD_EXT_ADDR? i+8: i-8)) + compact = 0; + if(detailed) *sp++ = '"'; + for(int i=31; i >= 0; i--) { *sp++ = cb = cmdbitchar(op->bit[i]); - if(detailed && cb == 'a') { - sprintf(sp, "%d", op->bit[i].bitno); - sp += strlen(sp); - } - if(i) { - if(detailed) - *sp++ = ' '; - if(i%8 == 0) - *sp++ = ' '; + if(compact) { + if(i && i%8 == 0) + *sp++ = '-', *sp++ = '-'; + else if(i && i%4 == 0) + *sp++ = '.'; + } else { + if(cb == 'a') { + sprintf(sp, "%d", op->bit[i].bitno); + sp += strlen(sp); + } + if(i) { + if(detailed) + *sp++ = ' '; + if(i%8 == 0) + *sp++ = ' '; + } } } if(detailed) @@ -145,7 +161,7 @@ static char *opcode2str(OPCODE *op, int detailed) { // return 0 if op code would encode (essentially) the same SPI command -static int opcodecmp(OPCODE *op1, OPCODE *op2) { +static int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum) { char *opstr1, *opstr2, *p; int cmp; @@ -154,8 +170,8 @@ static int opcodecmp(OPCODE *op1, OPCODE *op2) { if(!op1 || !op2) return op1? -1: 1; - opstr1 = opcode2str(op1, 1); - opstr2 = opcode2str(op2, 1); + opstr1 = opcode2str(op1, opnum, 1); + opstr2 = opcode2str(op2, opnum, 1); if(!opstr1 || !opstr2) { dev_info("%s: out of memory\n", progname); exit(1); @@ -663,8 +679,8 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { _if_partout(intcmp, "%d", ocdrev); for(int i=0; i < AVR_OP_MAX; i++) - if(!base || opcodecmp(p->op[i], base->op[i])) - dev_part_strct_entry(tsv, ".ptop", p->desc, "part", opcodename(i), opcode2str(p->op[i], !tsv)); + if(!base || opcodecmp(p->op[i], base->op[i], i)) + dev_part_strct_entry(tsv, ".ptop", p->desc, "part", opcodename(i), opcode2str(p->op[i], i, !tsv)); for(int mi=0; mi < sizeof mem_order/sizeof *mem_order && mem_order[mi]; mi++) { AVRMEM *m, *bm; @@ -704,8 +720,8 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { _if_memout(intcmp, "%d", pollindex); for(int i=0; i < AVR_OP_MAX; i++) - if(!bm || opcodecmp(bm->op[i], m->op[i])) - dev_part_strct_entry(tsv, ".ptmmop", p->desc, m->desc, opcodename(i), opcode2str(m->op[i], !tsv)); + if(!bm || opcodecmp(bm->op[i], m->op[i], i)) + dev_part_strct_entry(tsv, ".ptmmop", p->desc, m->desc, opcodename(i), opcode2str(m->op[i], i, !tsv)); if(!tsv) dev_info(" ;\n"); From 4ada98a1a8fdb90dd918a0d11c9ded87b3edd114 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 20 Jul 2022 00:57:26 +0100 Subject: [PATCH 143/511] Udate the avrdude.conf introductory documentation --- src/avrdude.conf.in | 157 +++++++++++++++++++++++++++----------------- 1 file changed, 95 insertions(+), 62 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 3b8c5a6e..8a9bca41 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -12,7 +12,7 @@ # # DO NOT MODIFY THIS FILE. Modifications will be overwritten the next # time a "make install" is run. For user-specific additions, use the -# "-C +filename" commandline option. +# "-C +filename" command line option. # # Possible entry formats are: # @@ -34,12 +34,12 @@ # rdyled = ; # pin number # pgmled = ; # pin number # vfyled = ; # pin number -# usbvid = ; # USB VID (Vendor ID) -# usbpid = [, ...] # USB PID (Product ID) (1) -# usbdev = ; # USB interface or other device info -# usbvendor = ; # USB Vendor Name -# usbproduct = ; # USB Product Name -# usbsn = ; # USB Serial Number +# usbvid = ; # USB VID (Vendor ID) +# usbpid = [, ...] ; # USB PID (Product ID) (1) +# usbdev = ; # USB interface or other device info +# usbvendor = ; # USB Vendor Name +# usbproduct = ; # USB Product Name +# usbsn = ; # USB Serial Number # hvupdi_support = [, , ... ] ; # UPDI HV Variants Support # # To invert a bit, use = ~ , the spaces are important. @@ -48,32 +48,34 @@ # specify it as follows = ~ ( [, ... ] ) . # # (1) Not all programmer types can process a list of PIDs. -# ; +# ; # # part -# id = ; # quoted string # desc = ; # quoted string +# id = ; # quoted string +# family_id = ; # quoted string, eg, "megaAVR" or "tinyAVR" +# hvupdi_variant = ; # numeric -1 (n/a) or 0..2 +# devicecode = ; # deprecated, use stk500_devcode +# stk500_devcode = ; # numeric +# avr910_devcode = ; # numeric # has_jtag = ; # part has JTAG i/f # has_debugwire = ; # part has debugWire i/f # has_pdi = ; # part has PDI i/f # has_updi = ; # part has UPDI i/f # has_tpi = ; # part has TPI i/f -# devicecode = ; # deprecated, use stk500_devcode -# stk500_devcode = ; # numeric -# avr910_devcode = ; # numeric +# is_at90s1200 = ; # AT90S1200 part +# is_avr32 = ; # AVR32 part # signature = ; # signature bytes # usbpid = ; # DFU USB PID # chip_erase_delay = ; # micro-seconds -# reset = dedicated | io; -# retry_pulse = reset | sck; -# pgm_enable = ; -# chip_erase = ; +# reset = dedicated | io ; +# retry_pulse = reset | sck ; # chip_erase_delay = ; # chip erase delay (us) # # STK500 parameters (parallel programming IO lines) # pagel = ; # pin name in hex, i.e., 0xD7 # bs2 = ; # pin name in hex, i.e., 0xA0 # serial = ; # can use serial downloading -# parallel = ; # can use par. programming +# parallel = ; # can use par. programming # # STK500v2 parameters, to be taken from Atmel's XML files # timeout = ; # stabdelay = ; @@ -85,52 +87,59 @@ # predelay = ; # postdelay = ; # pollmethod = ; -# mode = ; -# delay = ; -# blocksize = ; -# readsize = ; # hvspcmdexedelay = ; # # STK500v2 HV programming parameters, from XML -# pp_controlstack = , , ...; # PP only -# hvsp_controlstack = , , ...; # HVSP only -# hventerstabdelay = ; -# progmodedelay = ; # PP only -# latchcycles = ; -# togglevtg = ; -# poweroffdelay = ; -# resetdelayms = ; -# resetdelayus = ; -# hvleavestabdelay = ; -# resetdelay = ; -# synchcycles = ; # HVSP only -# chiperasepulsewidth = ; # PP only -# chiperasepolltimeout = ; -# chiperasetime = ; # HVSP only -# programfusepulsewidth = ; # PP only -# programfusepolltimeout = ; -# programlockpulsewidth = ; # PP only -# programlockpolltimeout = ; +# pp_controlstack = , , ... ; # PP only +# hvsp_controlstack = , , ... ; # HVSP only +# flash_instr = , , ; +# eeprom_instr = , , ... ; +# hventerstabdelay = ; +# progmodedelay = ; # PP only +# latchcycles = ; +# togglevtg = ; +# poweroffdelay = ; +# resetdelayms = ; +# resetdelayus = ; +# hvleavestabdelay = ; +# resetdelay = ; +# synchcycles = ; # HVSP only +# chiperasepulsewidth = ; # PP only +# chiperasepolltimeout = ; +# chiperasetime = ; # HVSP only +# programfusepulsewidth = ; # PP only +# programfusepolltimeout = ; +# programlockpulsewidth = ; # PP only +# programlockpolltimeout = ; # # JTAG ICE mkII parameters, also from XML files # allowfullpagebitstream = ; # enablepageprogramming = ; -# idr = ; # IO addr of IDR (OCD) reg. -# rampz = ; # IO addr of RAMPZ reg. -# spmcr = ; # mem addr of SPMC[S]R reg. -# eecr = ; # mem addr of EECR reg. -# # (only when != 0x3c) -# is_at90s1200 = ; # AT90S1200 part -# is_avr32 = ; # AVR32 part +# idr = ; # IO addr of IDR (OCD) reg +# rampz = ; # IO addr of RAMPZ reg +# spmcr = ; # mem addr of SPMC[S]R reg +# eecr = ; # mem addr of EECR reg only when != 0x3c +# mcu_base = ; +# nvm_base = ; +# ocd_base = ; +# ocdrev = ; +# pgm_enable = ; +# chip_erase = ; # # memory -# paged = ; # yes / no +# paged = ; # yes/no (flash only, do not use for EEPROM) +# offset = ; # memory offset # size = ; # bytes # page_size = ; # bytes # num_pages = ; # numeric # min_write_delay = ; # micro-seconds # max_write_delay = ; # micro-seconds -# readback_p1 = ; # byte value -# readback_p2 = ; # byte value -# pwroff_after_write = ; # yes / no +# readback = ; # pair of byte values +# readback_p1 = ; # byte value (first component) +# readback_p2 = ; # byte value (second component) +# pwroff_after_write = ; # yes/no +# mode = ; # STK500 v2 file parameter, to be taken from Atmel's XML files +# delay = ; # " +# blocksize = ; # " +# readsize = ; # " # read = ; # write = ; # read_lo = ; @@ -140,11 +149,12 @@ # loadpage_lo = ; # loadpage_hi = ; # writepage = ; -# ; -# ; +# ; +# ; # # If any of the above parameters are not specified, the default value -# of 0 is used for numerics or the empty string ("") for string +# of 0 is used for numerics (except for hvupdi_variant and ocdrev, +# where the default value is -1) or the empty string ("") for string # values. If a required parameter is left empty, AVRDUDE will # complain. # @@ -152,7 +162,12 @@ # using the following syntax. In this case specified integer and # string values override parameter values from the parent part. New # memory definitions are added to the definitions inherited from the -# parent. +# parent. If, however, a new memory definition refers to an existing +# one of the same name for that part then, from v7.1, the existing +# memory definition is extended, and components overwritten with new +# values. Assigning NULL removes an inherited SPI instruction format, +# memory definition, control stack, eeprom or flash instruction, eg, +# as in memory "efuse" = NULL; # # part parent # quoted string # id = ; # quoted string @@ -181,7 +196,7 @@ # # INSTRUCTION FORMATS # -# Instruction formats are specified as a comma seperated list of +# Instruction formats are specified as a comma separated list of # string values containing information (bit specifiers) about each # of the 32 bits of the instruction. Bit specifiers may be one of # the following formats: @@ -190,10 +205,11 @@ # # '0' = the bit is always clear on input as well as output # -# 'x' = the bit is ignored on input and output +# 'x' = the bit is ignored on input and output and set as 0 # -# 'a' = the bit is an address bit, the bit-number matches this bit -# specifier's position within the current instruction byte +# 'a' = the bit is an address bit; from v 7.1 the bit-number +# is set to match the right bit position for the +# instruction to "just work" # # 'aN' = the bit is the Nth address bit, bit-number = N, i.e., a12 # is address bit 12 on input, a0 is address bit 0. @@ -202,11 +218,28 @@ # # 'o' = the bit is an output data bit # -# Each instruction must be composed of 32 bit specifiers. The +# Each instruction must be composed of 32 bit specifiers. The # instruction specification closely follows the instruction data -# provided in Atmel's data sheets for their parts. +# provided in Atmel's data sheets for their parts. Note that flash +# addresses always refer to *word* addresses whilst all other +# memory types specify *byte* addresses. # -# See below for some examples. +# Example for signature read on the ATmega328P: +# read = "0 0 1 1 0 0 0 0", "0 0 0 x x x x x", +# "x x x x x x a1 a0", "o o o o o o o o"; +# +# As the address bit numbers in the SPI opcodes are highly +# systematic, they don't really need to be specified. A compact +# version of the format specification neither uses bit-numbers for +# address lines nor spaces. If such a string is longer than 7 +# characters, then the characters 0, 1, x, a, i and o will be +# recognised as the corresponding bit, whilst any of the characters +# ., -, _ or / can act as arbitrary visual separators, which are +# ignored. Examples: +# +# loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; +# +# loadpage_lo = "0100.0000", "000x.xxxx", "xxaa.aaaa", "iiii.iiii"; # # # The following are STK500 part device codes to use for the From 696574d1ebfa6cf3891247f79cc8f0a629955527 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 21 Jul 2022 18:04:41 +0100 Subject: [PATCH 144/511] Replace !fnmatch(p, s, 0) with own part_match(p, s) --- src/developer_opts.c | 125 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 122 insertions(+), 3 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index 1b3d17d9..0f0bdab0 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -44,7 +44,6 @@ #include #include #include -#include #include "avrdude.h" #include "libavrdude.h" @@ -742,6 +741,127 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { } + +/* + * Match STRING against the partname pattern PATTERN, returning 1 if it + * matches, 0 if not. NOTE: part_match() is a modified old copy of !fnmatch() + * from the GNU C Library (published under GLP v2). Used for portability. + */ + +#define FOLD(c) ({ int _c = (unsigned char) (c); isascii(_c)? tolower(_c): _c; }) + +static int part_match(const char *pattern, const char *string) { + unsigned char c; + const char *p = pattern, *n = string; + + if(!*n) // AVRDUDE specialty: empty string never matches + return 0; + + while((c = FOLD(*p++))) { + switch(c) { + case '?': + if(*n == 0) + return 0; + break; + + case '\\': + c = FOLD(*p++); + if(FOLD(*n) != c) + return 0; + break; + + case '*': + for(c = *p++; c == '?' || c == '*'; c = *p++) + if(c == '?' && *n++ == 0) + return 0; + + if(c == 0) + return 1; + + { + unsigned char c1 = FOLD(c == '\\'? *p : c); // This char + + for(--p; *n; ++n) // Recursively check reminder of string for * + if((c == '[' || FOLD(*n) == c1) && part_match(p, n) == 1) + return 1; + return 0; + } + + case '[': + { + int negate; + + if(*n == 0) + return 0; + + negate = (*p == '!' || *p == '^'); + if(negate) + ++p; + + c = *p++; + for(;;) { + unsigned char cstart = c, cend = c; + + if(c == '\\') + cstart = cend = *p++; + + cstart = cend = FOLD(cstart); + + if(c == 0) // [ (unterminated) + return 0; + + c = *p++; + c = FOLD(c); + + if(c == '-' && *p != ']') { + cend = *p++; + if(cend == '\\') + cend = *p++; + if(cend == 0) + return 0; + cend = FOLD(cend); + + c = *p++; + } + + if(FOLD(*n) >= cstart && FOLD(*n) <= cend) + goto matched; + + if(c == ']') + break; + } + if(!negate) + return 0; + break; + + matched:; + while(c != ']') { // Skip the rest of the [...] that already matched + + if(c == 0) // [... (unterminated) + return 0; + + c = *p++; + if(c == '\\') // XXX 1003.2d11 is unclear if this is right + ++p; + } + if(negate) + return 0; + } + break; + + default: + if(c != FOLD(*n)) + return 0; + } + + ++n; + } + + return *n == 0; +} + + + // -p */[cdosw*] void dev_output_part_defs(char *partdesc) { bool cmdok, waits, opspi, descs, strct, cmpst, raw, all, tsv; @@ -817,8 +937,7 @@ void dev_output_part_defs(char *partdesc) { nprinted = dev_nprinted; } - // pattern match the name of the part with command line: FMP_CASEFOLD not available here :( - if(fnmatch(partdesc, p->desc, 0) && fnmatch(partdesc, p->id, 0)) + if(!part_match(partdesc, p->desc) && !part_match(partdesc, p->id)) continue; if(strct || cmpst) From 192e118d2cd9706beec96fad0a94b968e205a035 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 21 Jul 2022 18:36:04 +0100 Subject: [PATCH 145/511] Make useful functions from developer_optc.c available --- src/developer_opts.c | 20 +++++++++----------- src/developer_opts.h | 7 ++++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index 0f0bdab0..db100eb3 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -51,7 +51,7 @@ #include "developer_opts.h" #include "developer_opts_private.h" -static char cmdbitchar(CMDBIT cb) { +char cmdbitchar(CMDBIT cb) { switch(cb.type) { case AVR_CMDBIT_IGNORE: return 'x'; @@ -68,8 +68,9 @@ static char cmdbitchar(CMDBIT cb) { } } -static char *cmdbitstr(CMDBIT cb) { - char space[10]; + +char *cmdbitstr(CMDBIT cb) { + char space[32]; *space = cmdbitchar(cb); if(*space == 'a') @@ -81,9 +82,8 @@ static char *cmdbitstr(CMDBIT cb) { } - -static const char *opcodename(int what) { - switch(what) { +const char *opcodename(int opcode) { + switch(opcode) { case AVR_OP_READ: return "read"; case AVR_OP_WRITE: @@ -192,8 +192,6 @@ static int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum) { } - - static void printopcode(AVRPART *p, const char *d, OPCODE *op, int what) { unsigned char cmd[4]; int i; @@ -218,7 +216,7 @@ static void printallopcodes(AVRPART *p, const char *d, OPCODE **opa) { // returns position 0..31 of highest bit set or INT_MIN if no bit is set -static int intlog2(unsigned int n) { +int intlog2(unsigned int n) { int ret; if(!n) @@ -402,7 +400,7 @@ static void dev_stack_out(bool tsv, AVRPART *p, const char *name, unsigned char } -// order in which memories are processed, runtime adds unknown ones +// order in which memories are processed, runtime adds unknown ones (but there shouldn't be any) static const char *mem_order[100] = { "eeprom", "flash", "application", "apptable", "boot", "lfuse", "hfuse", "efuse", @@ -750,7 +748,7 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { #define FOLD(c) ({ int _c = (unsigned char) (c); isascii(_c)? tolower(_c): _c; }) -static int part_match(const char *pattern, const char *string) { +int part_match(const char *pattern, const char *string) { unsigned char c; const char *p = pattern, *n = string; diff --git a/src/developer_opts.h b/src/developer_opts.h index 701d97e3..8a4d821b 100644 --- a/src/developer_opts.h +++ b/src/developer_opts.h @@ -19,6 +19,11 @@ #ifndef developer_opts_h #define developer_opts_h -void dev_output_part_defs(); +char cmdbitchar(CMDBIT cb); +char *cmdbitstr(CMDBIT cb); +const char *opcodename(int opcode); +int intlog2(unsigned int n); +int part_match(const char *pattern, const char *string); +void dev_output_part_defs(char *partdesc); #endif From 55f6765ea516564a86431226f8aab0ea01f6986a Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 21 Jul 2022 18:47:48 +0100 Subject: [PATCH 146/511] Make more useful functions from developer_optc.c available --- src/developer_opts.c | 25 ++++++++++++------------- src/developer_opts.h | 4 +++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index db100eb3..cdc40a21 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -82,8 +82,8 @@ char *cmdbitstr(CMDBIT cb) { } -const char *opcodename(int opcode) { - switch(opcode) { +const char *opcodename(int opnum) { + switch(opnum) { case AVR_OP_READ: return "read"; case AVR_OP_WRITE: @@ -115,7 +115,7 @@ const char *opcodename(int opcode) { // Unique string representation of an opcode -static char *opcode2str(OPCODE *op, int opnum, int detailed) { +char *opcode2str(OPCODE *op, int opnum, int detailed) { char cb, space[1024], *sp = space; int compact = 1; @@ -160,7 +160,7 @@ static char *opcode2str(OPCODE *op, int opnum, int detailed) { // return 0 if op code would encode (essentially) the same SPI command -static int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum) { +int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum) { char *opstr1, *opstr2, *p; int cmp; @@ -192,7 +192,7 @@ static int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum) { } -static void printopcode(AVRPART *p, const char *d, OPCODE *op, int what) { +static void printopcode(AVRPART *p, const char *d, OPCODE *op, int opnum) { unsigned char cmd[4]; int i; @@ -200,7 +200,7 @@ static void printopcode(AVRPART *p, const char *d, OPCODE *op, int what) { memset(cmd, 0, sizeof cmd); avr_set_bits(op, cmd); - dev_info(".op\t%s\t%s\t%s\t0x%02x%02x%02x%02x\t", p->desc, d, opcodename(what), cmd[0], cmd[1], cmd[2], cmd[3]); + dev_info(".op\t%s\t%s\t%s\t0x%02x%02x%02x%02x\t", p->desc, d, opcodename(opnum), cmd[0], cmd[1], cmd[2], cmd[3]); for(i=31; i >= 0; i--) { dev_info("%c", cmdbitchar(op->bit[i])); if(i%8 == 0) @@ -266,9 +266,9 @@ static char *parttype(AVRPART *p) { // check whether address bits are where they should be in ISP commands -static void checkaddr(int memsize, int pagesize, int what, OPCODE *op, AVRPART *p, AVRMEM *m) { +static void checkaddr(int memsize, int pagesize, int opnum, OPCODE *op, AVRPART *p, AVRMEM *m) { int i, lo, hi; - const char *whatstr = opcodename(what); + const char *opstr = opcodename(opnum); lo = intlog2(pagesize); hi = intlog2(memsize-1); @@ -278,20 +278,20 @@ static void checkaddr(int memsize, int pagesize, int what, OPCODE *op, AVRPART * if(i < lo || i > hi) { if(op->bit[i+8].type != AVR_CMDBIT_IGNORE && !(op->bit[i+8].type == AVR_CMDBIT_VALUE && op->bit[i+8].value == 0)) { char *cbs = cmdbitstr(op->bit[i+8]); - dev_info(".cmderr\t%s\t%s-%s\tbit %d outside addressable space should be x or 0 but is %s\n", p->desc, m->desc, whatstr, i+8, cbs? cbs: "NULL"); + dev_info(".cmderr\t%s\t%s-%s\tbit %d outside addressable space should be x or 0 but is %s\n", p->desc, m->desc, opstr, i+8, cbs? cbs: "NULL"); if(cbs) free(cbs); } } else { if(op->bit[i+8].type != AVR_CMDBIT_ADDRESS) - dev_info(".cmderr\t%s\t%s-%s\tbit %d is %c but should be a\n", p->desc, m->desc, whatstr, i+8, cmdbitchar(op->bit[i+8])); + dev_info(".cmderr\t%s\t%s-%s\tbit %d is %c but should be a\n", p->desc, m->desc, opstr, i+8, cmdbitchar(op->bit[i+8])); else if(op->bit[i+8].bitno != i) - dev_info(".cmderr\t%s\t%s-%s\tbit %d inconsistent: a%d specified as a%d\n", p->desc, m->desc, whatstr, i+8, i, op->bit[i+8].bitno); + dev_info(".cmderr\t%s\t%s-%s\tbit %d inconsistent: a%d specified as a%d\n", p->desc, m->desc, opstr, i+8, i, op->bit[i+8].bitno); } } for(i=0; i<32; i++) // command bits 8..23 should not contain address bits if((i<8 || i>23) && op->bit[i].type == AVR_CMDBIT_ADDRESS) - dev_info(".cmderr\t%s\t%s-%s\tbit %d contains a%d which it shouldn't\n", p->desc, m->desc, whatstr, i, op->bit[i].bitno); + dev_info(".cmderr\t%s\t%s-%s\tbit %d contains a%d which it shouldn't\n", p->desc, m->desc, opstr, i, op->bit[i].bitno); } @@ -859,7 +859,6 @@ int part_match(const char *pattern, const char *string) { } - // -p */[cdosw*] void dev_output_part_defs(char *partdesc) { bool cmdok, waits, opspi, descs, strct, cmpst, raw, all, tsv; diff --git a/src/developer_opts.h b/src/developer_opts.h index 8a4d821b..00c13005 100644 --- a/src/developer_opts.h +++ b/src/developer_opts.h @@ -21,7 +21,9 @@ char cmdbitchar(CMDBIT cb); char *cmdbitstr(CMDBIT cb); -const char *opcodename(int opcode); +const char *opcodename(int opnum); +char *opcode2str(OPCODE *op, int opnum, int detailed); +int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum); int intlog2(unsigned int n); int part_match(const char *pattern, const char *string); void dev_output_part_defs(char *partdesc); From 572849ec2af20416c118248b0ce95d4bb70929be Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 21 Jul 2022 21:42:07 +0100 Subject: [PATCH 147/511] Provide avr_set_addr_mem() to set addresses in SPI opcodes within boundaries The function avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long addr) is meant to replace avr_set_addr(OPCODE *op, unsigned char *cmd, unsigned long addr) in future. avr_set_addr_mem() has more information about the context of the task in that it knows the memory size, memory page size, whether or not the memory is a flash memory (which gets words addressees supplied) and, crucially, knows which SPI operation it is meant to compute the address bits for. avr_set_addr_mem() first computes the interval of bit numbers that must be supplied for the SPI command to stand a chance to work. The function only sets those address bits that are needed. Once all avr_set_addr() function calls have been replaced by avr_set_addr_mem(), the SPI commands that need an address can afford to declare in avrdude.conf all 16 address bits in the middle two bytes of the SPI command. This over-declaration will be corrected during runtime by avr_set_addr_mem(). One consequence of this is that parts can inherit smaller or larger memories from parents without the need to use different SPI codes in avrdude.conf. Another consequence is that avr_set_addr_mem() can, and does, tell the caller whether vital address bits were not declared in the SPI opcode. During parsing of avrdude.conf this might be utilised to generate a corresponding warning. This will uncover problematic SPI codes in avrdude.conf that in the past went undetected. --- src/developer_opts.c | 94 ++++++++++++++++++++++++++++++++++++++++++++ src/developer_opts.h | 1 + 2 files changed, 95 insertions(+) diff --git a/src/developer_opts.c b/src/developer_opts.c index cdc40a21..2f50eda6 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -295,6 +295,100 @@ static void checkaddr(int memsize, int pagesize, int opnum, OPCODE *op, AVRPART } +/* + * avr_set_addr_mem() + * + * Set address bits in the specified command based on the memory, opcode and + * address; addr must be a word address for flash or, for all other memories, + * a byte address; returns 0 on success and -1 on error (no memory or no + * opcode) or, if positive, bn+1 where bn is bit number of the highest + * necessary bit that the opcode does not provide. + */ +int avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long addr) { + int ret, isflash, lo, hi, memsize, pagesize; + OPCODE *op; + + if(!mem) + return -1; + + if(!(op = mem->op[opnum])) + return -1; + + isflash = !strcmp(mem->desc, "flash"); // ISP parts have only one flash-like memory + memsize = mem->size >> isflash; // word addresses for flash + pagesize = mem->page_size >> isflash; + + // compute range lo..hi of needed address bits + switch(opnum) { + case AVR_OP_READ: + case AVR_OP_WRITE: + case AVR_OP_READ_LO: + case AVR_OP_READ_HI: + case AVR_OP_WRITE_LO: + case AVR_OP_WRITE_HI: + lo = 0; + hi = intlog2(memsize-1); // memsize = 1 implies no addr bit is needed + break; + + case AVR_OP_LOADPAGE_LO: + case AVR_OP_LOADPAGE_HI: + lo = 0; + hi = intlog2(pagesize-1); + break; + + case AVR_OP_LOAD_EXT_ADDR: + lo = 16; + hi = intlog2(memsize-1); + break; + + case AVR_OP_WRITEPAGE: + lo = intlog2(pagesize); + hi = intlog2(memsize-1); + break; + + case AVR_OP_CHIP_ERASE: + case AVR_OP_PGM_ENABLE: + default: + lo = 0; + hi = -1; + break; + } + + // Unless it's load extended address, ISP chips only deal with 16 bit addresses + if(opnum != AVR_OP_LOAD_EXT_ADDR && hi > 15) + hi = 15; + + unsigned char avail[32]; + memset(avail, 0, sizeof avail); + + for(int i=0; i<32; i++) { + if(op->bit[i].type == AVR_CMDBIT_ADDRESS) { + int bitno, j, bit; + unsigned char mask; + + bitno = op->bit[i].bitno & 31; + j = 3 - i / 8; + bit = i % 8; + mask = 1 << bit; + avail[bitno] = 1; + + // 'a' bit with number outside bit range [lo, hi] is set to 0 + if (bitno >= lo && bitno <= hi? (addr >> bitno) & 1: 0) + cmd[j] = cmd[j] | mask; + else + cmd[j] = cmd[j] & ~mask; + } + } + + ret = 0; + if(lo >= 0 && hi < 32 && lo <= hi) + for(int bn=lo; bn <= hi; bn++) + if(!avail[bn]) // necessary bit bn misses in opcode + ret = bn+1; + + return ret; +} + static char *dev_sprintf(const char *fmt, ...) { int size = 0; char *p = NULL; diff --git a/src/developer_opts.h b/src/developer_opts.h index 00c13005..d112f517 100644 --- a/src/developer_opts.h +++ b/src/developer_opts.h @@ -25,6 +25,7 @@ const char *opcodename(int opnum); char *opcode2str(OPCODE *op, int opnum, int detailed); int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum); int intlog2(unsigned int n); +int avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long addr); int part_match(const char *pattern, const char *string); void dev_output_part_defs(char *partdesc); From 02788fb48aed795cb71855e4434bc0b64ab82fd1 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 21 Jul 2022 22:43:08 +0100 Subject: [PATCH 148/511] Warn whenever address bits in avrdude.conf SPI commands miss --- src/config_gram.y | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/config_gram.y b/src/config_gram.y index 3b979c20..3507fd29 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -29,6 +29,7 @@ #include "avrdude.h" #include "libavrdude.h" #include "config.h" +#include "developer_opts.h" #if defined(WIN32) #define strtok_r( _s, _sep, _lasts ) \ @@ -1325,6 +1326,16 @@ part_parm : lrmv_d(current_part->mem, current_mem); avr_free_mem(current_mem); is_alias = false; + } else { // check all opcodes re necessary address bits + unsigned char cmd[4] = { 0, 0, 0, 0, }; + int bn; + + for(int i=0; iop[i]) { + if((bn = avr_set_addr_mem(current_mem, i, cmd, 0UL)) > 0) + yywarning("%s's %s %s misses a necessary address bit a%d", + current_part->desc, current_mem->desc, opcodename(i), bn-1); + } } current_mem = NULL; } | From a95d169ccc0ac6964a3b1da3dccad29092928f50 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 21 Jul 2022 23:11:44 +0100 Subject: [PATCH 149/511] Warn whenever address bits in avrdude.conf SPI commands are misplaced --- src/config_gram.y | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/config_gram.y b/src/config_gram.y index 3507fd29..4de668b5 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -25,6 +25,7 @@ #include #include #include +#include #include "avrdude.h" #include "libavrdude.h" @@ -1662,12 +1663,10 @@ static int which_opcode(TOKEN * opcode) static int parse_cmdbits(OPCODE * op, int opnum) { - TOKEN * t; + TOKEN *t; int bitno; - char * e; - char * q; int len; - char * s, *brkt = NULL; + char *s, *brkt = NULL; int rv = 0; bitno = 32; @@ -1724,7 +1723,7 @@ static int parse_cmdbits(OPCODE * op, int opnum) op->bit[bitno].bitno = bitno < 8 || bitno > 23? 0: opnum == AVR_OP_LOAD_EXT_ADDR? bitno+8: bitno-8; /* correct bit number for lone 'a' */ if(bitno < 8 || bitno > 23) - yywarning("address bits don't normally appear in Byte 0 or Byte 3 of SPI programming commands"); + yywarning("address bits don't normally appear in Bytes 0 or 3 of SPI commands"); break; case 'i': op->bit[bitno].type = AVR_CMDBIT_INPUT; @@ -1749,13 +1748,27 @@ static int parse_cmdbits(OPCODE * op, int opnum) } else { if (*s == 'a') { - q = &s[1]; - op->bit[bitno].bitno = strtol(q, &e, 0); - if ((e == q)||(*e != 0)) { - yyerror("can't parse bit number from \"%s\"", q); - rv = -1; - break; + int sb, bn; + char *e, *q; + + q = s+1; + errno = 0; + bn = strtol(q, &e, 0); // address line + if (e == q || *e != 0 || errno) { + yywarning("can't parse bit number from a%s", q); + bn = 0; } + + sb = opnum == AVR_OP_LOAD_EXT_ADDR? bitno+8: bitno-8; // should be this number + if(bitno < 8 || bitno > 23) + yywarning("address bits don't normally appear in Bytes 0 or 3 of SPI commands"); + else if((bn & 31) != sb) + yywarning("a%d would normally be expected to be a%d", bn, sb); + else if(bn < 0 || bn > 31) + yywarning("invalid address bit a%d, using a%d", bn, bn & 31); + + op->bit[bitno].bitno = bn & 31; + op->bit[bitno].type = AVR_CMDBIT_ADDRESS; op->bit[bitno].value = 0; } From 5a517fb74dd2c5bb375ce480fb3bf1d9e0ead182 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 22 Jul 2022 23:50:22 +0100 Subject: [PATCH 150/511] Make developer opts portable: change statement exprs and index(); use size_t --- src/developer_opts.c | 42 +++++++++++++++++++----------------- src/developer_opts_private.h | 32 +++++++++++++-------------- 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index 2f50eda6..f1f465cc 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -510,7 +510,7 @@ static const char *mem_order[100] = { }; static void add_mem_order(const char *str) { - for(int i=0; i < sizeof mem_order/sizeof *mem_order; i++) { + for(size_t i=0; i < sizeof mem_order/sizeof *mem_order; i++) { if(mem_order[i] && !strcmp(mem_order[i], str)) return; if(!mem_order[i]) { @@ -536,7 +536,7 @@ typedef struct { } AVRMEMdeep; static int avrmem_deep_copy(AVRMEMdeep *d, AVRMEM *m) { - int len; + size_t len; d->base = *m; @@ -555,7 +555,7 @@ static int avrmem_deep_copy(AVRMEMdeep *d, AVRMEM *m) { // copy over the SPI operations themselves memset(d->base.op, 0, sizeof d->base.op); memset(d->ops, 0, sizeof d->ops); - for(int i=0; iops/sizeof *d->ops; i++) + for(size_t i=0; iops/sizeof *d->ops; i++) if(m->op[i]) d->ops[i] = *m->op[i]; @@ -586,7 +586,7 @@ typedef struct { static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { AVRMEM *m; - int len, di; + size_t len, di; memset(d, 0, sizeof *d); @@ -623,7 +623,7 @@ static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { // fill in all memories we got in defined order di = 0; - for(int mi=0; mi < sizeof mem_order/sizeof *mem_order && mem_order[mi]; mi++) { + for(size_t mi=0; mi < sizeof mem_order/sizeof *mem_order && mem_order[mi]; mi++) { m = p->mem? avr_locate_mem(p, mem_order[mi]): NULL; if(m) { if(di >= sizeof d->mems/sizeof *d->mems) { @@ -773,7 +773,7 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { if(!base || opcodecmp(p->op[i], base->op[i], i)) dev_part_strct_entry(tsv, ".ptop", p->desc, "part", opcodename(i), opcode2str(p->op[i], i, !tsv)); - for(int mi=0; mi < sizeof mem_order/sizeof *mem_order && mem_order[mi]; mi++) { + for(size_t mi=0; mi < sizeof mem_order/sizeof *mem_order && mem_order[mi]; mi++) { AVRMEM *m, *bm; m = p->mem? avr_locate_mem(p, mem_order[mi]): NULL; @@ -840,7 +840,9 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { * from the GNU C Library (published under GLP v2). Used for portability. */ -#define FOLD(c) ({ int _c = (unsigned char) (c); isascii(_c)? tolower(_c): _c; }) +inline static int fold(int c) { + return (c >= 'A' && c <= 'Z')? c+('a'-'A'): c; +} int part_match(const char *pattern, const char *string) { unsigned char c; @@ -849,7 +851,7 @@ int part_match(const char *pattern, const char *string) { if(!*n) // AVRDUDE specialty: empty string never matches return 0; - while((c = FOLD(*p++))) { + while((c = fold(*p++))) { switch(c) { case '?': if(*n == 0) @@ -857,8 +859,8 @@ int part_match(const char *pattern, const char *string) { break; case '\\': - c = FOLD(*p++); - if(FOLD(*n) != c) + c = fold(*p++); + if(fold(*n) != c) return 0; break; @@ -871,10 +873,10 @@ int part_match(const char *pattern, const char *string) { return 1; { - unsigned char c1 = FOLD(c == '\\'? *p : c); // This char + unsigned char c1 = fold(c == '\\'? *p : c); // This char for(--p; *n; ++n) // Recursively check reminder of string for * - if((c == '[' || FOLD(*n) == c1) && part_match(p, n) == 1) + if((c == '[' || fold(*n) == c1) && part_match(p, n) == 1) return 1; return 0; } @@ -897,13 +899,13 @@ int part_match(const char *pattern, const char *string) { if(c == '\\') cstart = cend = *p++; - cstart = cend = FOLD(cstart); + cstart = cend = fold(cstart); if(c == 0) // [ (unterminated) return 0; c = *p++; - c = FOLD(c); + c = fold(c); if(c == '-' && *p != ']') { cend = *p++; @@ -911,12 +913,12 @@ int part_match(const char *pattern, const char *string) { cend = *p++; if(cend == 0) return 0; - cend = FOLD(cend); + cend = fold(cend); c = *p++; } - if(FOLD(*n) >= cstart && FOLD(*n) <= cend) + if(fold(*n) >= cstart && fold(*n) <= cend) goto matched; if(c == ']') @@ -942,7 +944,7 @@ int part_match(const char *pattern, const char *string) { break; default: - if(c != FOLD(*n)) + if(c != fold(*n)) return 0; } @@ -1043,12 +1045,12 @@ void dev_output_part_defs(char *partdesc) { if(p->mem) { for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { AVRMEM *m = ldata(lnm); - if(!flashsize && m->desc && 0==strcmp(m->desc, "flash")) { + if(!flashsize && 0==strcmp(m->desc, "flash")) { flashsize = m->size; flashpagesize = m->page_size; flashoffset = m->offset; } - if(!eepromsize && m->desc && 0==strcmp(m->desc, "eeprom")) { + if(!eepromsize && 0==strcmp(m->desc, "eeprom")) { eepromsize = m->size; eepromoffset = m->offset; eeprompagesize = m->page_size; @@ -1057,7 +1059,7 @@ void dev_output_part_defs(char *partdesc) { } // "real" entries don't seem to have a space in their desc (a bit hackey) - if(flashsize && !index(p->desc, ' ')) { + if(flashsize && !strchr(p->desc, ' ')) { int ok, nfuses; AVRMEM *m; OPCODE *oc; diff --git a/src/developer_opts_private.h b/src/developer_opts_private.h index 9bdd185a..5a208199 100644 --- a/src/developer_opts_private.h +++ b/src/developer_opts_private.h @@ -54,61 +54,61 @@ static int dev_message(int msglvl, const char *fmt, ...); #define _partout(fmt, component) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)) -#define _if_partout(cmp, fmt, component) ({ \ +#define _if_partout(cmp, fmt, component) do { \ if(!base || cmp(base->component, p->component)) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)); \ -}) +} while(0) -#define _if_n_partout(cmp, n, fmt, component) ({ \ +#define _if_n_partout(cmp, n, fmt, component) do { \ if(!base || cmp(base->component, p->component, n)) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)); \ -}) +} while(0) #define _partout_str(result, component) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result) -#define _if_partout_str(cmp, result, component) ({ \ +#define _if_partout_str(cmp, result, component) do { \ if(!base || cmp(base->component, p->component)) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result); \ -}) +} while(0) -#define _if_n_partout_str(cmp, n, result, component) ({ \ +#define _if_n_partout_str(cmp, n, result, component) do { \ if(!base || cmp(base->component, p->component, n)) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result); \ -}) +} while(0) #define _memout(fmt, component) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component)) -#define _if_memout(cmp, fmt, component) ({ \ +#define _if_memout(cmp, fmt, component) do { \ if(!bm || cmp(bm->component, m->component)) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component)); \ -}) +} while(0) #define _memout_str(result, component) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result) -#define _if_n_memout_str(cmp, n, result, component) ({ \ +#define _if_n_memout_str(cmp, n, result, component) do { \ if(!bm || cmp(bm->component, m->component, n)) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result); \ -}) +} while(0) #define _memout_yn(component) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, strdup(m->component? "yes": "no")) -#define _if_memout_yn(component) ({ \ +#define _if_memout_yn(component) do { \ if(!bm || bm->component != m->component) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, strdup(m->component? "yes": "no")); \ -}) +} while(0) #define _flagout(mask, name) \ _partout_str(strdup(p->flags & (mask)? "yes": "no"), name) -#define _if_flagout(mask, name) ({ \ +#define _if_flagout(mask, name) do { \ if(!base || (base->flags & (mask)) != (p->flags & (mask))) \ _partout_str(strdup(p->flags & (mask)? "yes": "no"), name); \ -}) +} while(0) #define _cmderr(result, component) \ dev_part_strct_entry(tsv, ".cmderr", p->desc, m->desc, #component, result) From 26f431c9443f411c8c00f005600910c167a30517 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sat, 23 Jul 2022 10:26:17 +0200 Subject: [PATCH 151/511] Handle invalid -U file format specifiers for input The file format specifiers 'h', 'd', 'o', and 'b' are only valid for outputting data. Reject them with a proper error message when attempting to use them for input. --- src/update.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/update.c b/src/update.c index d3c208fc..8642f39d 100644 --- a/src/update.c +++ b/src/update.c @@ -278,6 +278,34 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f * write the selected device memory using data from a file; first * read the data from the specified file */ + const char *name = 0; + switch (upd->format) { + case FMT_HEX: + name = "hex"; + break; + + case FMT_DEC: + name = "decimal"; + break; + + case FMT_OCT: + name = "octal"; + break; + + case FMT_BIN: + name = "binary"; + break; + + default: + // no action needed + break; + } + if (name != 0) { + avrdude_message(MSG_INFO, + "%s: Invalid file format '%s' for input\n", + progname, name, upd->filename); + return -1; + } if (quell_progress < 2) { avrdude_message(MSG_INFO, "%s: reading input file \"%s\"\n", progname, From ce1ae41dd68c07469a7f3d7421c758c95bde0903 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sat, 23 Jul 2022 16:30:38 +0200 Subject: [PATCH 152/511] Document that 'h', 'o', and 'd' file formats are output-only. --- src/avrdude.1 | 3 +++ src/doc/avrdude.texi | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/avrdude.1 b/src/avrdude.1 index b312fff5..9f7eacde 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -733,14 +733,17 @@ fuse bit settings. hexadecimal; each value will get the string .Em 0x prepended. +Only valid on output. .It Ar o octal; each value will get a .Em 0 prepended unless it is less than 8 in which case it gets no prefix. +Only valid on output. .It Ar b binary; each value will get the string .Em 0b prepended. +Only valid on output. .El .Pp The default is to use auto detection for input files, and raw binary diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index 83b6fb3f..24a14253 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -802,13 +802,16 @@ fuse bit settings. @item h hexadecimal; each value will get the string @emph{0x} prepended. +Only valid on output. @item o octal; each value will get a @emph{0} prepended unless it is less than 8 in which case it gets no prefix. +Only valid on output. @item b binary; each value will get the string @emph{0b} prepended. +Only valid on output. @end table From 248c17177c48a1695748fc24ef85a92dca097d81 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sat, 23 Jul 2022 22:33:11 +0200 Subject: [PATCH 153/511] Mention -s and -u in the docs --- src/avrdude.1 | 5 +++-- src/doc/avrdude.texi | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/avrdude.1 b/src/avrdude.1 index c4fc850f..efeaa2fe 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -44,9 +44,7 @@ .Op Fl O .Op Fl P Ar port .Op Fl q -.Op Fl s .Op Fl t -.Op Fl u .Op Fl U Ar memtype:op:filename:filefmt .Op Fl v .Op Fl x Ar extended_param @@ -626,6 +624,9 @@ Posix systems (by now). .It Fl q Disable (or quell) output of the progress bar while reading or writing to the device. Specify it a second time for even quieter operation. +.It Fl s, u +These options used to control the obsolete "safemode" feature which +is no longer present. They are silently ignored for backwards compatibility. .It Fl t Tells .Nm diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index d99b0a85..ae04dac6 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -693,6 +693,10 @@ Posix systems (by now). Disable (or quell) output of the progress bar while reading or writing to the device. Specify it a second time for even quieter operation. +@item -s, -u +These options used to control the obsolete "safemode" feature which +is no longer present. They are silently ignored for backwards compatibility. + @item -t Tells AVRDUDE to enter the interactive ``terminal'' mode instead of up- or downloading files. See below for a detailed description of the From cc93bd2c8341f20abe2acdeabd86dea88b5169f3 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sat, 23 Jul 2022 22:47:38 +0200 Subject: [PATCH 154/511] Move the error handling for invalid file formats to fileio.c The checks used to be in update.c, but as they are related to the intended file operation, they are better placed in fileio.c. The checks affected are to refuse 'm' on output (file write), and 'd', 'h', 'o', and 'b' formats on input (file read). --- src/fileio.c | 19 +++++++++++++++++++ src/update.c | 34 ---------------------------------- 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index 1c81682d..080f69ba 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1135,6 +1135,13 @@ static int fileio_imm(struct fioparms * fio, rc = loc; } break; + + case FIO_WRITE: + avrdude_message(MSG_INFO, + "%s: Invalid file format 'immediate' for output\n", + progname); + return -1; + default: avrdude_message(MSG_INFO, "%s: fileio: invalid operation=%d\n", progname, fio->op); @@ -1248,27 +1255,32 @@ static int fileio_num(struct fioparms * fio, FILEFMT fmt) { const char *prefix; + const char *name; char cbuf[20]; int base, i, num; switch (fmt) { case FMT_HEX: + name = "hex"; prefix = "0x"; base = 16; break; default: case FMT_DEC: + name = "decimal"; prefix = ""; base = 10; break; case FMT_OCT: + name = "octal"; prefix = "0"; base = 8; break; case FMT_BIN: + name = "binary"; prefix = "0b"; base = 2; break; @@ -1278,6 +1290,13 @@ static int fileio_num(struct fioparms * fio, switch (fio->op) { case FIO_WRITE: break; + + case FIO_READ: + avrdude_message(MSG_INFO, + "%s: Invalid file format '%s' for input\n", + progname, name); + return -1; + default: avrdude_message(MSG_INFO, "%s: fileio: invalid operation=%d\n", progname, fio->op); diff --git a/src/update.c b/src/update.c index 8642f39d..29132724 100644 --- a/src/update.c +++ b/src/update.c @@ -238,12 +238,6 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f /* * read out the specified device memory and write it to a file */ - if (upd->format == FMT_IMM) { - avrdude_message(MSG_INFO, - "%s: Invalid file format 'immediate' for output\n", - progname, upd->filename); - return -1; - } if (quell_progress < 2) { avrdude_message(MSG_INFO, "%s: reading %s%s memory:\n", progname, mem->desc, alias_mem_desc); @@ -278,34 +272,6 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f * write the selected device memory using data from a file; first * read the data from the specified file */ - const char *name = 0; - switch (upd->format) { - case FMT_HEX: - name = "hex"; - break; - - case FMT_DEC: - name = "decimal"; - break; - - case FMT_OCT: - name = "octal"; - break; - - case FMT_BIN: - name = "binary"; - break; - - default: - // no action needed - break; - } - if (name != 0) { - avrdude_message(MSG_INFO, - "%s: Invalid file format '%s' for input\n", - progname, name, upd->filename); - return -1; - } if (quell_progress < 2) { avrdude_message(MSG_INFO, "%s: reading input file \"%s\"\n", progname, From 4babe183dae107fc249d4f853faa61b0653d8baa Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 24 Jul 2022 18:20:35 +0100 Subject: [PATCH 155/511] Initialise memory before avr_set_bits() calls in stk500.c and stk500v2.c --- src/stk500.c | 5 ++--- src/stk500v2.c | 11 +++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/stk500.c b/src/stk500.c index cb270036..fa013012 100644 --- a/src/stk500.c +++ b/src/stk500.c @@ -212,7 +212,6 @@ static int stk500_chip_erase(PROGRAMMER * pgm, AVRPART * p) pgm->pgm_led(pgm, ON); memset(cmd, 0, sizeof(cmd)); - avr_set_bits(p->op[AVR_OP_CHIP_ERASE], cmd); pgm->cmd(pgm, cmd, res); usleep(p->chip_erase_delay); @@ -745,8 +744,8 @@ static int stk500_loadaddr(PROGRAMMER * pgm, AVRMEM * mem, unsigned int addr) if (lext != NULL) { ext_byte = (addr >> 16) & 0xff; if (ext_byte != PDATA(pgm)->ext_addr_byte) { - /* Either this is the first addr load, or a 64K word boundary is - * crossed, so set the ext addr byte */ + /* Either this is the first addr load, or a different 64K word section */ + memset(buf, 0, 4); avr_set_bits(lext, buf); avr_set_addr(lext, buf, addr); stk500_cmd(pgm, buf, buf); diff --git a/src/stk500v2.c b/src/stk500v2.c index 523d6539..b0ccaad2 100644 --- a/src/stk500v2.c +++ b/src/stk500v2.c @@ -991,6 +991,7 @@ static int stk500v2_chip_erase(PROGRAMMER * pgm, AVRPART * p) buf[0] = CMD_CHIP_ERASE_ISP; buf[1] = p->chip_erase_delay / 1000; buf[2] = 0; // use delay (?) + memset(buf+3, 0, 4); avr_set_bits(p->op[AVR_OP_CHIP_ERASE], buf+3); result = stk500v2_command(pgm, buf, 7, sizeof(buf)); usleep(p->chip_erase_delay); @@ -1121,8 +1122,8 @@ retry: buf[5] = p->bytedelay; buf[6] = p->pollvalue; buf[7] = p->pollindex; + memset(buf+8, 0, 4); avr_set_bits(p->op[AVR_OP_PGM_ENABLE], buf+8); - buf[10] = buf[11] = 0; rv = stk500v2_command(pgm, buf, 12, sizeof(buf)); @@ -1957,12 +1958,12 @@ static int stk500isp_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, buf[0] = CMD_READ_SIGNATURE_ISP; } - memset(buf + 1, 0, 5); if ((op = mem->op[AVR_OP_READ]) == NULL) { avrdude_message(MSG_INFO, "%s: stk500isp_read_byte(): invalid operation AVR_OP_READ on %s memory\n", progname, mem->desc); return -1; } + memset(buf+2, 0, 4); avr_set_bits(op, buf + 2); if ((pollidx = avr_get_output_index(op)) == -1) { avrdude_message(MSG_INFO, "%s: stk500isp_read_byte(): cannot determine pollidx to read %s memory\n", @@ -2314,6 +2315,7 @@ static int stk500v2_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, progname, p->desc); return -1; } + memset(cmds, 0, sizeof cmds); avr_set_bits(m->op[AVR_OP_LOADPAGE_LO], cmds); commandbuf[5] = cmds[0]; @@ -2322,6 +2324,8 @@ static int stk500v2_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, progname, p->desc); return -1; } + + memset(cmds, 0, sizeof cmds); avr_set_bits(m->op[AVR_OP_WRITEPAGE], cmds); commandbuf[6] = cmds[0]; @@ -2335,6 +2339,7 @@ static int stk500v2_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, progname, p->desc); return -1; } + memset(cmds, 0, sizeof cmds); avr_set_bits(wop, cmds); commandbuf[5] = cmds[0]; commandbuf[6] = 0; @@ -2346,6 +2351,7 @@ static int stk500v2_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, progname, p->desc); return -1; } + memset(cmds, 0, sizeof cmds); avr_set_bits(rop, cmds); commandbuf[7] = cmds[0]; @@ -2549,6 +2555,7 @@ static int stk500v2_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, progname, p->desc); return -1; } + memset(cmds, 0, sizeof cmds); avr_set_bits(rop, cmds); commandbuf[3] = cmds[0]; From 7310df030f19d8e11586fc53f02f667031b78c54 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 24 Jul 2022 18:48:22 +0100 Subject: [PATCH 156/511] Check stk500_recv() actually worked before accepting SYNC byte --- src/stk500.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/stk500.c b/src/stk500.c index fa013012..208fb1a3 100644 --- a/src/stk500.c +++ b/src/stk500.c @@ -91,8 +91,6 @@ int stk500_getsync(PROGRAMMER * pgm) int attempt; int max_sync_attempts; - /* - * get in sync */ buf[0] = Cmnd_STK_GET_SYNC; buf[1] = Sync_CRC_EOP; @@ -119,11 +117,11 @@ int stk500_getsync(PROGRAMMER * pgm) usleep(50*1000); stk500_drain(pgm, 0); } + stk500_send(pgm, buf, 2); - stk500_recv(pgm, resp, 1); - if (resp[0] == Resp_STK_INSYNC){ + if(stk500_recv(pgm, resp, 1) >= 0 && resp[0] == Resp_STK_INSYNC) break; - } + avrdude_message(MSG_INFO, "%s: stk500_getsync() attempt %d of %d: not in sync: resp=0x%02x\n", progname, attempt + 1, max_sync_attempts, resp[0]); } From 535004ee3da1d73858e71fb48ac8867964425264 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 24 Jul 2022 19:27:07 +0100 Subject: [PATCH 157/511] Consolidate error messages for stk500.c --- src/stk500.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/stk500.c b/src/stk500.c index 208fb1a3..b3ed3980 100644 --- a/src/stk500.c +++ b/src/stk500.c @@ -119,6 +119,7 @@ int stk500_getsync(PROGRAMMER * pgm) } stk500_send(pgm, buf, 2); + resp[0] = 0; if(stk500_recv(pgm, resp, 1) >= 0 && resp[0] == Resp_STK_INSYNC) break; @@ -202,8 +203,8 @@ static int stk500_chip_erase(PROGRAMMER * pgm, AVRPART * p) } if (p->op[AVR_OP_CHIP_ERASE] == NULL) { - avrdude_message(MSG_INFO, "chip erase instruction not defined for part \"%s\"\n", - p->desc); + avrdude_message(MSG_INFO, "%s: chip erase instruction not defined for part \"%s\"\n", + progname, p->desc); return -1; } @@ -779,13 +780,12 @@ static int stk500_loadaddr(PROGRAMMER * pgm, AVRMEM * mem, unsigned int addr) if (stk500_recv(pgm, buf, 1) < 0) return -1; - if (buf[0] == Resp_STK_OK) { + if (buf[0] == Resp_STK_OK) return 0; - } - avrdude_message(MSG_INFO, "%s: loadaddr(): (b) protocol error, " + avrdude_message(MSG_INFO, "%s: stk500_loadaddr(): (b) protocol error, " "expect=0x%02x, resp=0x%02x\n", - progname, Resp_STK_INSYNC, buf[0]); + progname, Resp_STK_OK, buf[0]); return -1; } @@ -876,9 +876,9 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, if (stk500_recv(pgm, buf, 1) < 0) return -1; if (buf[0] != Resp_STK_OK) { - avrdude_message(MSG_INFO, "\n%s: stk500_paged_write(): (a) protocol error, " + avrdude_message(MSG_INFO, "\n%s: stk500_paged_write(): (b) protocol error, " "expect=0x%02x, resp=0x%02x\n", - progname, Resp_STK_INSYNC, buf[0]); + progname, Resp_STK_OK, buf[0]); return -5; } } @@ -970,7 +970,7 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } else { if (buf[0] != Resp_STK_OK) { - avrdude_message(MSG_INFO, "\n%s: stk500_paged_load(): (a) protocol error, " + avrdude_message(MSG_INFO, "\n%s: stk500_paged_load(): (b) protocol error, " "expect=0x%02x, resp=0x%02x\n", progname, Resp_STK_OK, buf[0]); return -5; @@ -1152,7 +1152,7 @@ static int stk500_getparm(PROGRAMMER * pgm, unsigned parm, unsigned * value) return -3; } else if (buf[0] != Resp_STK_OK) { - avrdude_message(MSG_INFO, "\n%s: stk500_getparm(): (a) protocol error, " + avrdude_message(MSG_INFO, "\n%s: stk500_getparm(): (b) protocol error, " "expect=0x%02x, resp=0x%02x\n", progname, Resp_STK_OK, buf[0]); return -3; @@ -1211,9 +1211,9 @@ static int stk500_setparm(PROGRAMMER * pgm, unsigned parm, unsigned value) return -3; } else { - avrdude_message(MSG_INFO, "\n%s: stk500_setparm(): (a) protocol error, " + avrdude_message(MSG_INFO, "\n%s: stk500_setparm(): (b) protocol error, " "expect=0x%02x, resp=0x%02x\n", - progname, Resp_STK_INSYNC, buf[0]); + progname, Resp_STK_OK, buf[0]); return -3; } } From 29c6645abc92441f204f04e6a220e628fed9aab6 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 24 Jul 2022 19:41:42 +0100 Subject: [PATCH 158/511] Resolve signed/unsigned comparisons in stk500.c and stk500v2.c --- src/stk500.c | 3 ++- src/stk500v2.c | 33 ++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/stk500.c b/src/stk500.c index b3ed3980..084bbec8 100644 --- a/src/stk500.c +++ b/src/stk500.c @@ -1034,7 +1034,8 @@ static int stk500_set_fosc(PROGRAMMER * pgm, double v) static unsigned ps[] = { 1, 8, 32, 64, 128, 256, 1024 }; - int idx, rc; + size_t idx; + int rc; prescale = cmatch = 0; if (v > 0.0) { diff --git a/src/stk500v2.c b/src/stk500v2.c index b0ccaad2..a50fda4c 100644 --- a/src/stk500v2.c +++ b/src/stk500v2.c @@ -392,9 +392,7 @@ static int stk500v2_send_mk2(PROGRAMMER * pgm, unsigned char * data, size_t len) static unsigned short get_jtagisp_return_size(unsigned char cmd) { - int i; - - for (i = 0; i < sizeof jtagispcmds / sizeof jtagispcmds[0]; i++) + for (size_t i = 0; i < sizeof jtagispcmds / sizeof jtagispcmds[0]; i++) if (jtagispcmds[i].cmd == cmd) return jtagispcmds[i].size; @@ -481,7 +479,6 @@ static int stk500v2_jtag3_send(PROGRAMMER * pgm, unsigned char * data, size_t le static int stk500v2_send(PROGRAMMER * pgm, unsigned char * data, size_t len) { unsigned char buf[275 + 6]; // max MESSAGE_BODY of 275 bytes, 6 bytes overhead - int i; if (PDATA(pgm)->pgmtype == PGMTYPE_AVRISP_MKII || PDATA(pgm)->pgmtype == PGMTYPE_STK600) @@ -500,12 +497,13 @@ static int stk500v2_send(PROGRAMMER * pgm, unsigned char * data, size_t len) // calculate the XOR checksum buf[5+len] = 0; - for (i=0;i<5+len;i++) + for (size_t i=0; i<5+len; i++) buf[5+len] ^= buf[i]; DEBUG("STK500V2: stk500v2_send("); - for (i=0;ifd, buf, len+6) != 0) { avrdude_message(MSG_INFO, "%s: stk500_send(): failed to send command to serial port\n",progname); @@ -551,9 +549,9 @@ static int stk500v2_jtagmkII_recv(PROGRAMMER * pgm, unsigned char *msg, progname); return -1; } - if (rv - 1 > maxsize) { + if ((size_t) rv - 1 > maxsize) { avrdude_message(MSG_INFO, "%s: stk500v2_jtagmkII_recv(): got %u bytes, have only room for %u bytes\n", - progname, (unsigned)rv - 1, (unsigned)maxsize); + progname, (unsigned) rv - 1, (unsigned) maxsize); rv = maxsize; } switch (jtagmsg[0]) { @@ -597,9 +595,9 @@ static int stk500v2_jtag3_recv(PROGRAMMER * pgm, unsigned char *msg, implementation of JTAGICE3, as they always request a full 512 octets from the ICE. Thus, only complain at high verbose levels. */ - if (rv - 1 > maxsize) { + if ((size_t) rv - 1 > maxsize) { avrdude_message(MSG_DEBUG, "%s: stk500v2_jtag3_recv(): got %u bytes, have only room for %u bytes\n", - progname, (unsigned)rv - 1, (unsigned)maxsize); + progname, (unsigned) rv - 1, (unsigned) maxsize); rv = maxsize; } if (jtagmsg[0] != SCOPE_AVR_ISP) { @@ -814,13 +812,13 @@ retry: static int stk500v2_command(PROGRAMMER * pgm, unsigned char * buf, size_t len, size_t maxlen) { - int i; int tries = 0; int status; DEBUG("STK500V2: stk500v2_command("); - for (i=0;i 0.0) { @@ -2781,7 +2780,7 @@ static int stk500v2_set_fosc(PROGRAMMER * pgm, double v) fosc = (unsigned)v; for (idx = 0; idx < sizeof(ps) / sizeof(ps[0]); idx++) { - if (fosc >= STK500V2_XTAL / (256 * ps[idx] * 2)) { + if ((unsigned) fosc >= STK500V2_XTAL / (256 * ps[idx] * 2)) { /* this prescaler value can handle our frequency */ prescale = idx + 1; cmatch = (unsigned)(STK500V2_XTAL / (2 * fosc * ps[idx])) - 1; @@ -2828,7 +2827,7 @@ static double avrispmkIIfreqs[] = { static int stk500v2_set_sck_period_mk2(PROGRAMMER * pgm, double v) { - int i; + size_t i; for (i = 0; i < sizeof(avrispmkIIfreqs) / sizeof(avrispmkIIfreqs[0]); i++) { if (1 / avrispmkIIfreqs[i] >= v) From 3d06457a1614a2247efc846b8e73788cb8585978 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 24 Jul 2022 20:18:15 +0100 Subject: [PATCH 159/511] Deprecate original STK500 v1 protocol in favour of optiboot and Arduino as ISP For paged read/write early AVRDUDE implementations of the STK500 v1 protocol communicated a word address (below a_div=2) or byte address (a_div=1) based on the following code irrespective of which memories were used: if(m->op[AVR_OP_LOADPAGE_LO] || m->op[AVR_OP_READ_LO]) a_div = 2; else a_div = 1; This turned out to be a bug: it really should have been a_div=2 for flash and a_div=1 for eeprom. At the time presumably no one noted because Atmel was at the cusp of replacing their FW 1.x with FW 2 (and the STK500 v2 protocol). It seems that the world (optiboot, Arduino as ISP, ...) has compensated for the bug by assuming AVRDUDE sends *all* eeprom addresses as word addresses. Actually these programmers overcompensated for the bug because for six out of the 146 known SPI programmable parts with eeprom and page size > 1, AVRDUDE would still send the eeprom addresses as byte addresses (ATmega8 ATmega8A ATmega64 ATmega64A ATmega128 ATmega128A) owing to above code. It makes no sense to correct the bug now seeing that virtually no one uses the old 2005 STK 500 v1 firmware. This commit now follows optiboot, Arduino as ISP and other projects, and simply sends all addresses for paged read or write as word addresses. There are no longer (little known) exceptions for ATmega8 et al that surprised some optiboot etc users. --- src/stk500.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/stk500.c b/src/stk500.c index 084bbec8..27334297 100644 --- a/src/stk500.c +++ b/src/stk500.c @@ -805,19 +805,20 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, if (strcmp(m->desc, "flash") == 0) { memtype = 'F'; - } - else if (strcmp(m->desc, "eeprom") == 0) { + a_div = 2; + } else if (strcmp(m->desc, "eeprom") == 0) { memtype = 'E'; - } - else { + /* + * The STK original 500 v1 protocol actually expects a_div = 1, but the + * v1.x FW of the STK500 kit has been superseded by v2 FW in the mid + * 2000s. Since optiboot, arduino as ISP and others assume a_div = 2, + * better use that. See https://github.com/avrdudes/avrdude/issues/967 + */ + a_div = 2; + } else { return -2; } - if ((m->op[AVR_OP_LOADPAGE_LO]) || (m->op[AVR_OP_READ_LO])) - a_div = 2; - else - a_div = 1; - n = addr + n_bytes; #if 0 avrdude_message(MSG_INFO, "n_bytes = %d\n" @@ -825,7 +826,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, "a_div = %d\n" "page_size = %d\n", n_bytes, n, a_div, page_size); -#endif +#endif for (; addr < n; addr += block_size) { // MIB510 uses fixed blocks size of 256 bytes @@ -872,7 +873,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, progname, Resp_STK_INSYNC, buf[0]); return -4; } - + if (stk500_recv(pgm, buf, 1) < 0) return -1; if (buf[0] != Resp_STK_OK) { @@ -899,19 +900,20 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, if (strcmp(m->desc, "flash") == 0) { memtype = 'F'; - } - else if (strcmp(m->desc, "eeprom") == 0) { + a_div = 2; + } else if (strcmp(m->desc, "eeprom") == 0) { memtype = 'E'; - } - else { + /* + * The STK original 500 v1 protocol actually expects a_div = 1, but the + * v1.x FW of the STK500 kit has been superseded by v2 FW in the mid + * 2000s. Since optiboot, arduino as ISP and others assume a_div = 2, + * better use that. See https://github.com/avrdudes/avrdude/issues/967 + */ + a_div = 2; + } else { return -2; } - if ((m->op[AVR_OP_LOADPAGE_LO]) || (m->op[AVR_OP_READ_LO])) - a_div = 2; - else - a_div = 1; - n = addr + n_bytes; for (; addr < n; addr += block_size) { // MIB510 uses fixed blocks size of 256 bytes From d5d3a0e09eb68e9889c85e0ea317a07e49f29727 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 24 Jul 2022 23:38:51 +0100 Subject: [PATCH 160/511] Improve help message -p/h for developer option -p --- src/developer_opts.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index f1f465cc..94051fe9 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -971,13 +971,13 @@ void dev_output_part_defs(char *partdesc) { if(!*flags || !strchr("cdosSrw*t", *flags)) { dev_info("%s: flags for developer option -p / not recognised\n", progname); dev_info( - "Wildcard examples:\n" + "Wildcard examples (these need protecting in the shell through quoting):\n" " * all known parts\n" " ATtiny10 just this part\n" " *32[0-9] matches ATmega329, ATmega325 and ATmega328\n" " *32? matches ATmega329, ATmega32A, ATmega325 and ATmega328\n" "Flags (one or more of the characters below):\n" - " c check address bits in SPI commands and output errors\n" + " c check and report errors in address bits of SPI commands\n" " d description of core part features\n" " o opcodes for SPI programming parts and memories\n" " S show entries of avrdude.conf parts with all values\n" @@ -986,8 +986,18 @@ void dev_output_part_defs(char *partdesc) { " w wd_... constants for ISP parts\n" " * all of the above except s\n" " t use tab separated values as much as possible\n" - "Note:\n" - " -p * same as -p */*\n" + "Examples:\n" + " $ avrdude -p ATmega328P/s\n" + " $ avrdude -p m328*/st | grep chip_erase_delay\n" + " avrdude -p*/r | sort\n" + "Notes:\n" + " -p * is the same as -p */*\n" + " This help message is printed using any unrecognised flag, eg, -p/h\n" + " Leaving no space after -p can be an OK substitute for quoting in shells\n" + " /s and /S outputs are designed to be used as input in avrdude.conf\n" + " Sorted /r output should stay invariant when rearranging avrdude.conf\n" + " The /c, /o and /w flags are less generic and may be removed sometime\n" + " These options are just to help development, so not further documented\n" ); return; } From 154927352911a3021cbec29621ece4feca57c6da Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 25 Jul 2022 20:30:40 +0100 Subject: [PATCH 161/511] Add comments with part names to -p*/s output --- src/developer_opts.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index 94051fe9..589dae05 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -673,10 +673,13 @@ static void dev_part_raw(AVRPART *part) { static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { - dev_info("# %s %d\n", p->config_file, p->lineno); - if(!tsv) - dev_info("part\n"); + if(!tsv) { + dev_info("#------------------------------------------------------------\n"); + dev_info("# %s\n", p->desc); + dev_info("#------------------------------------------------------------\n"); + dev_info("\npart\n"); + } _if_partout(strcmp, "\"%s\"", desc); _if_partout(strcmp, "\"%s\"", id); From 104dcf60527422ab3323fb77780376e872e03bee Mon Sep 17 00:00:00 2001 From: MCUdude Date: Tue, 26 Jul 2022 11:30:53 +0200 Subject: [PATCH 162/511] Add new jtagmkii_updi programmer type option in order to resolve issue #1037 --- src/avrdude.conf.in | 2 +- src/jtagmkII.c | 37 +++++++++++++++++++++++++++++++++++-- src/jtagmkII.h | 2 ++ src/pgm_type.c | 1 + 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 1728497f..92c578e8 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -1734,7 +1734,7 @@ programmer programmer id = "jtag2updi"; desc = "JTAGv2 to UPDI bridge"; - type = "jtagmkii_pdi"; + type = "jtagmkii_updi"; connection_type = serial; baudrate = 115200; ; diff --git a/src/jtagmkII.c b/src/jtagmkII.c index b1024b53..675c9540 100644 --- a/src/jtagmkII.c +++ b/src/jtagmkII.c @@ -1306,9 +1306,9 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p) const char *ifname; /* Abort and print error if programmer does not support the target microcontroller */ - if ((strncmp(ldata(lfirst(pgm->id)), "jtag2updi", strlen("jtag2updi")) == 0 && p->flags & AVRPART_HAS_PDI) || + if ((strncmp(pgm->type, "JTAGMKII_UPDI", strlen("JTAGMKII_UPDI")) == 0 && p->flags & AVRPART_HAS_PDI) || (strncmp(ldata(lfirst(pgm->id)), "jtagmkII", strlen("jtagmkII")) == 0 && p->flags & AVRPART_HAS_UPDI)) { - avrdude_message(MSG_INFO, "Error: programmer %s does not support target %s\n\n", + avrdude_message(MSG_INFO, "ERROR: programmer %s does not support target %s\n\n", ldata(lfirst(pgm->id)), p->desc); return -1; } @@ -3929,6 +3929,39 @@ void jtagmkII_pdi_initpgm(PROGRAMMER * pgm) pgm->flag = PGM_FL_IS_PDI; } +const char jtagmkII_updi_desc[] = "Atmel JTAG ICE mkII in UPDI mode"; + +void jtagmkII_updi_initpgm(PROGRAMMER * pgm) +{ + strcpy(pgm->type, "JTAGMKII_UPDI"); + + /* + * mandatory functions + */ + pgm->initialize = jtagmkII_initialize; + pgm->display = jtagmkII_display; + pgm->enable = jtagmkII_enable; + pgm->disable = jtagmkII_disable; + pgm->program_enable = jtagmkII_program_enable_INFO; + pgm->chip_erase = jtagmkII_chip_erase; + pgm->open = jtagmkII_open_pdi; + pgm->close = jtagmkII_close; + pgm->read_byte = jtagmkII_read_byte; + pgm->write_byte = jtagmkII_write_byte; + + /* + * optional functions + */ + pgm->paged_write = jtagmkII_paged_write; + pgm->paged_load = jtagmkII_paged_load; + pgm->page_erase = jtagmkII_page_erase; + pgm->print_parms = jtagmkII_print_parms; + pgm->setup = jtagmkII_setup; + pgm->teardown = jtagmkII_teardown; + pgm->page_size = 256; + pgm->flag = PGM_FL_IS_PDI; +} + const char jtagmkII_dragon_desc[] = "Atmel AVR Dragon in JTAG mode"; void jtagmkII_dragon_initpgm(PROGRAMMER * pgm) diff --git a/src/jtagmkII.h b/src/jtagmkII.h index aa79c18d..34004d6d 100644 --- a/src/jtagmkII.h +++ b/src/jtagmkII.h @@ -36,6 +36,7 @@ extern const char jtagmkII_desc[]; extern const char jtagmkII_avr32_desc[]; extern const char jtagmkII_dw_desc[]; extern const char jtagmkII_pdi_desc[]; +extern const char jtagmkII_updi_desc[]; extern const char jtagmkII_dragon_desc[]; extern const char jtagmkII_dragon_dw_desc[]; extern const char jtagmkII_dragon_pdi_desc[]; @@ -43,6 +44,7 @@ void jtagmkII_initpgm (PROGRAMMER * pgm); void jtagmkII_avr32_initpgm (PROGRAMMER * pgm); void jtagmkII_dw_initpgm (PROGRAMMER * pgm); void jtagmkII_pdi_initpgm (PROGRAMMER * pgm); +void jtagmkII_updi_initpgm (PROGRAMMER * pgm); void jtagmkII_dragon_initpgm (PROGRAMMER * pgm); void jtagmkII_dragon_dw_initpgm (PROGRAMMER * pgm); void jtagmkII_dragon_pdi_initpgm (PROGRAMMER * pgm); diff --git a/src/pgm_type.c b/src/pgm_type.c index 8afb50bd..82320fab 100644 --- a/src/pgm_type.c +++ b/src/pgm_type.c @@ -80,6 +80,7 @@ const PROGRAMMER_TYPE programmers_types[] = { {"jtagmkii_dw", jtagmkII_dw_initpgm, jtagmkII_dw_desc}, {"jtagmkii_isp", stk500v2_jtagmkII_initpgm, stk500v2_jtagmkII_desc}, {"jtagmkii_pdi", jtagmkII_pdi_initpgm, jtagmkII_pdi_desc}, + {"jtagmkii_updi", jtagmkII_updi_initpgm, jtagmkII_updi_desc}, {"jtagice3", jtag3_initpgm, jtag3_desc}, {"jtagice3_pdi", jtag3_pdi_initpgm, jtag3_pdi_desc}, {"jtagice3_updi", jtag3_updi_initpgm, jtag3_updi_desc}, From 78754b8ccc619b5cb42c7140aa97c7da7e70e2c4 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 26 Jul 2022 23:43:56 +0100 Subject: [PATCH 163/511] Add parent id output for developer options -p*/s for parts --- src/avrpart.c | 32 +++++++++++++++----------------- src/config_gram.y | 2 ++ src/developer_opts.c | 8 ++++++-- src/libavrdude.h | 2 ++ src/pgm.c | 9 +++------ 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/avrpart.c b/src/avrpart.c index 29bfbcc2..96e45334 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -354,7 +354,6 @@ AVRMEM_ALIAS * avr_dup_memalias(AVRMEM_ALIAS * m) void avr_free_mem(AVRMEM * m) { - int i; if (m->buf != NULL) { free(m->buf); m->buf = NULL; @@ -363,7 +362,7 @@ void avr_free_mem(AVRMEM * m) free(m->tags); m->tags = NULL; } - for(i=0;iop)/sizeof(m->op[0]);i++) + for(size_t i=0; iop)/sizeof(m->op[0]); i++) { if (m->op[i] != NULL) { @@ -487,7 +486,8 @@ AVRMEM_ALIAS * avr_find_memalias(AVRPART * p, AVRMEM * m_orig) void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, int type, int verbose) { - static unsigned int prev_mem_offset, prev_mem_size; + static unsigned int prev_mem_offset; + static int prev_mem_size; int i, j; char * optr; @@ -579,6 +579,7 @@ AVRPART * avr_new_part(void) p->reset_disposition = RESET_DEDICATED; p->retry_pulse = PIN_AVR_SCK; p->flags = AVRPART_SERIALOK | AVRPART_PARALLELOK | AVRPART_ENABLEPAGEPROGRAMMING; + p->parent_id = NULL; p->config_file = NULL; p->lineno = 0; memset(p->signature, 0xFF, 3); @@ -608,7 +609,6 @@ AVRPART * avr_dup_part(AVRPART * d) p->mem = save; p->mem_alias = save2; - for (ln=lfirst(d->mem); ln; ln=lnext(ln)) { AVRMEM *m = ldata(ln); AVRMEM *m2 = avr_dup_mem(m); @@ -636,20 +636,18 @@ AVRPART * avr_dup_part(AVRPART * d) void avr_free_part(AVRPART * d) { -int i; - ldestroy_cb(d->mem, (void(*)(void *))avr_free_mem); - d->mem = NULL; - ldestroy_cb(d->mem_alias, (void(*)(void *))avr_free_memalias); - d->mem_alias = NULL; - for(i=0;iop)/sizeof(d->op[0]);i++) - { - if (d->op[i] != NULL) - { - avr_free_opcode(d->op[i]); - d->op[i] = NULL; - } + ldestroy_cb(d->mem, (void(*)(void *))avr_free_mem); + d->mem = NULL; + ldestroy_cb(d->mem_alias, (void(*)(void *))avr_free_memalias); + d->mem_alias = NULL; + /* do not free d->parent_id and d->config_file */ + for(size_t i=0; iop)/sizeof(d->op[0]); i++) { + if (d->op[i] != NULL) { + avr_free_opcode(d->op[i]); + d->op[i] = NULL; } - free(d); + } + free(d); } AVRPART * locate_part(LISTID parts, const char * partdesc) diff --git a/src/config_gram.y b/src/config_gram.y index 4de668b5..68718dd1 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -334,6 +334,7 @@ prog_decl : free_token($3); YYABORT; } + current_prog->parent_id = cache_string($3->value.string); current_prog->config_file = cache_string(cfg_infile); current_prog->lineno = cfg_lineno; free_token($3); @@ -425,6 +426,7 @@ part_decl : free_token($3); YYABORT; } + current_part->parent_id = cache_string($3->value.string); current_part->config_file = cache_string(cfg_infile); current_part->lineno = cfg_lineno; diff --git a/src/developer_opts.c b/src/developer_opts.c index 589dae05..5e5b312e 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -592,6 +592,7 @@ static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { d->base = *p; + d->base.parent_id = NULL; d->base.config_file = NULL; d->base.lineno = 0; @@ -678,7 +679,10 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { dev_info("#------------------------------------------------------------\n"); dev_info("# %s\n", p->desc); dev_info("#------------------------------------------------------------\n"); - dev_info("\npart\n"); + if(p->parent_id) + dev_info("\npart parent \"%s\"\n", p->parent_id); + else + dev_info("\npart\n"); } _if_partout(strcmp, "\"%s\"", desc); @@ -1047,7 +1051,7 @@ void dev_output_part_defs(char *partdesc) { continue; if(strct || cmpst) - dev_part_strct(p, tsv, cmpst? nullpart: NULL); + dev_part_strct(p, tsv, !cmpst? NULL: p->parent_id? locate_part(part_list, p->parent_id): nullpart); if(raw) dev_part_raw(p); diff --git a/src/libavrdude.h b/src/libavrdude.h index c55608bc..76772e25 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -217,6 +217,7 @@ typedef struct opcode { typedef struct avrpart { char desc[AVR_DESCLEN]; /* long part name */ char id[AVR_IDLEN]; /* short part name */ + char * parent_id; /* parent id if set, for -p.../s */ char family_id[AVR_FAMILYIDLEN+1]; /* family id in the SIB (avr8x) */ int hvupdi_variant; /* HV pulse on UPDI pin, no pin or RESET pin */ int stk500_devcode; /* stk500 device code */ @@ -661,6 +662,7 @@ typedef struct programmer_t { char desc[PGM_DESCLEN]; char type[PGM_TYPELEN]; char port[PGM_PORTLEN]; + char *parent_id; void (*initpgm)(struct programmer_t * pgm); unsigned int pinno[N_PINS]; struct pindef_t pin[N_PINS]; diff --git a/src/pgm.c b/src/pgm.c index d85f35e4..dd38552f 100644 --- a/src/pgm.c +++ b/src/pgm.c @@ -79,6 +79,7 @@ PROGRAMMER * pgm_new(void) pgm->usbpid = lcreat(NULL, 0); pgm->desc[0] = 0; pgm->type[0] = 0; + pgm->parent_id = NULL; pgm->config_file = NULL; pgm->lineno = 0; pgm->baudrate = 0; @@ -145,11 +146,8 @@ void pgm_free(PROGRAMMER * const p) ldestroy_cb(p->usbpid, free); p->id = NULL; p->usbpid = NULL; - /* this is done by pgm_teardown, but usually cookie is not set to NULL */ - /* if (p->cookie !=NULL) { - free(p->cookie); - p->cookie = NULL; - }*/ + /* do not free p->parent_id nor p->config_file */ + /* p->cookie is freed by pgm_teardown */ free(p); } @@ -169,7 +167,6 @@ PROGRAMMER * pgm_dup(const PROGRAMMER * const src) pgm->id = lcreat(NULL, 0); pgm->usbpid = lcreat(NULL, 0); - for (ln = lfirst(src->usbpid); ln; ln = lnext(ln)) { int *ip = malloc(sizeof(int)); if (ip == NULL) { From 62dcc2e6e819edb39a24b0ca744b72828a5d0514 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 26 Jul 2022 23:55:42 +0100 Subject: [PATCH 164/511] Declare useful CMDBIT/part functions of developer_opts.c in libavrdude.h --- src/developer_opts.c | 2 +- src/developer_opts.h | 8 -------- src/libavrdude.h | 10 ++++++++++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index 5e5b312e..0ddf68b2 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -160,7 +160,7 @@ char *opcode2str(OPCODE *op, int opnum, int detailed) { // return 0 if op code would encode (essentially) the same SPI command -int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum) { +static int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum) { char *opstr1, *opstr2, *p; int cmp; diff --git a/src/developer_opts.h b/src/developer_opts.h index d112f517..6c4b3b71 100644 --- a/src/developer_opts.h +++ b/src/developer_opts.h @@ -19,14 +19,6 @@ #ifndef developer_opts_h #define developer_opts_h -char cmdbitchar(CMDBIT cb); -char *cmdbitstr(CMDBIT cb); -const char *opcodename(int opnum); -char *opcode2str(OPCODE *op, int opnum, int detailed); -int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum); -int intlog2(unsigned int n); -int avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long addr); -int part_match(const char *pattern, const char *string); void dev_output_part_defs(char *partdesc); #endif diff --git a/src/libavrdude.h b/src/libavrdude.h index 76772e25..ced77554 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -320,14 +320,22 @@ typedef struct avrmem_alias { extern "C" { #endif + +int intlog2(unsigned int n); + /* Functions for OPCODE structures */ OPCODE * avr_new_opcode(void); void avr_free_opcode(OPCODE * op); int avr_set_bits(OPCODE * op, unsigned char * cmd); int avr_set_addr(OPCODE * op, unsigned char * cmd, unsigned long addr); +int avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long addr); int avr_set_input(OPCODE * op, unsigned char * cmd, unsigned char data); int avr_get_output(OPCODE * op, unsigned char * res, unsigned char * data); int avr_get_output_index(OPCODE * op); +char cmdbitchar(CMDBIT cb); +char *cmdbitstr(CMDBIT cb); +const char *opcodename(int opnum); +char *opcode2str(OPCODE *op, int opnum, int detailed); /* Functions for AVRMEM structures */ AVRMEM * avr_new_memtype(void); @@ -359,6 +367,8 @@ typedef void (*walk_avrparts_cb)(const char *name, const char *desc, void walk_avrparts(LISTID avrparts, walk_avrparts_cb cb, void *cookie); void sort_avrparts(LISTID avrparts); +int part_match(const char *pattern, const char *string); + int compare_memory_masked(AVRMEM * m, uint8_t buf1, uint8_t buf2); #ifdef __cplusplus From 004b46b594e66beea17fd92f16dc47da1847816c Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 27 Jul 2022 00:12:57 +0100 Subject: [PATCH 165/511] Move useful CMDBIT/part functions from developer_opts.c to avrpart.c --- src/avrpart.c | 342 ++++++++++++++++++++++++++++++++++++++++++- src/developer_opts.c | 334 ------------------------------------------ 2 files changed, 339 insertions(+), 337 deletions(-) diff --git a/src/avrpart.c b/src/avrpart.c index 96e45334..4fc6304f 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -71,6 +71,21 @@ void avr_free_opcode(OPCODE * op) free(op); } + +// returns position 0..31 of highest bit set or INT_MIN if no bit is set +int intlog2(unsigned int n) { + int ret; + + if(!n) + return INT_MIN; + + for(ret = 0; n >>= 1; ret++) + continue; + + return ret; +} + + /* * avr_set_bits() * @@ -126,6 +141,101 @@ int avr_set_addr(OPCODE * op, unsigned char * cmd, unsigned long addr) } +/* + * avr_set_addr_mem() + * + * Set address bits in the specified command based on the memory, opcode and + * address; addr must be a word address for flash or, for all other memories, + * a byte address; returns 0 on success and -1 on error (no memory or no + * opcode) or, if positive, bn+1 where bn is bit number of the highest + * necessary bit that the opcode does not provide. + */ +int avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long addr) { + int ret, isflash, lo, hi, memsize, pagesize; + OPCODE *op; + + if(!mem) + return -1; + + if(!(op = mem->op[opnum])) + return -1; + + isflash = !strcmp(mem->desc, "flash"); // ISP parts have only one flash-like memory + memsize = mem->size >> isflash; // word addresses for flash + pagesize = mem->page_size >> isflash; + + // compute range lo..hi of needed address bits + switch(opnum) { + case AVR_OP_READ: + case AVR_OP_WRITE: + case AVR_OP_READ_LO: + case AVR_OP_READ_HI: + case AVR_OP_WRITE_LO: + case AVR_OP_WRITE_HI: + lo = 0; + hi = intlog2(memsize-1); // memsize = 1 implies no addr bit is needed + break; + + case AVR_OP_LOADPAGE_LO: + case AVR_OP_LOADPAGE_HI: + lo = 0; + hi = intlog2(pagesize-1); + break; + + case AVR_OP_LOAD_EXT_ADDR: + lo = 16; + hi = intlog2(memsize-1); + break; + + case AVR_OP_WRITEPAGE: + lo = intlog2(pagesize); + hi = intlog2(memsize-1); + break; + + case AVR_OP_CHIP_ERASE: + case AVR_OP_PGM_ENABLE: + default: + lo = 0; + hi = -1; + break; + } + + // Unless it's load extended address, ISP chips only deal with 16 bit addresses + if(opnum != AVR_OP_LOAD_EXT_ADDR && hi > 15) + hi = 15; + + unsigned char avail[32]; + memset(avail, 0, sizeof avail); + + for(int i=0; i<32; i++) { + if(op->bit[i].type == AVR_CMDBIT_ADDRESS) { + int bitno, j, bit; + unsigned char mask; + + bitno = op->bit[i].bitno & 31; + j = 3 - i / 8; + bit = i % 8; + mask = 1 << bit; + avail[bitno] = 1; + + // 'a' bit with number outside bit range [lo, hi] is set to 0 + if (bitno >= lo && bitno <= hi? (addr >> bitno) & 1: 0) + cmd[j] = cmd[j] | mask; + else + cmd[j] = cmd[j] & ~mask; + } + } + + ret = 0; + if(lo >= 0 && hi < 32 && lo <= hi) + for(int bn=lo; bn <= hi; bn++) + if(!avail[bn]) // necessary bit bn misses in opcode + ret = bn+1; + + return ret; +} + + /* * avr_set_input() * @@ -239,7 +349,6 @@ static char * bittype(int type) } - /*** *** Elementary functions dealing with AVRMEM structures ***/ @@ -556,12 +665,10 @@ void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, } - /* * Elementary functions dealing with AVRPART structures */ - AVRPART * avr_new_part(void) { AVRPART * p; @@ -819,3 +926,232 @@ void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose) if (buf) free(buf); } + + +char cmdbitchar(CMDBIT cb) { + switch(cb.type) { + case AVR_CMDBIT_IGNORE: + return 'x'; + case AVR_CMDBIT_VALUE: + return cb.value? '1': '0'; + case AVR_CMDBIT_ADDRESS: + return 'a'; + case AVR_CMDBIT_INPUT: + return 'i'; + case AVR_CMDBIT_OUTPUT: + return 'o'; + default: + return '?'; + } +} + + +char *cmdbitstr(CMDBIT cb) { + char space[32]; + + *space = cmdbitchar(cb); + if(*space == 'a') + sprintf(space+1, "%d", cb.bitno); + else + space[1] = 0; + + return strdup(space); +} + + +const char *opcodename(int opnum) { + switch(opnum) { + case AVR_OP_READ: + return "read"; + case AVR_OP_WRITE: + return "write"; + case AVR_OP_READ_LO: + return "read_lo"; + case AVR_OP_READ_HI: + return "read_hi"; + case AVR_OP_WRITE_LO: + return "write_lo"; + case AVR_OP_WRITE_HI: + return "write_hi"; + case AVR_OP_LOADPAGE_LO: + return "loadpage_lo"; + case AVR_OP_LOADPAGE_HI: + return "loadpage_hi"; + case AVR_OP_LOAD_EXT_ADDR: + return "load_ext_addr"; + case AVR_OP_WRITEPAGE: + return "writepage"; + case AVR_OP_CHIP_ERASE: + return "chip_erase"; + case AVR_OP_PGM_ENABLE: + return "pgm_enable"; + default: + return "???"; + } +} + + +// Unique string representation of an opcode +char *opcode2str(OPCODE *op, int opnum, int detailed) { + char cb, space[1024], *sp = space; + int compact = 1; + + if(!op) + return strdup("NULL"); + + // Can the opcode be printed in a compact way? Only if address bits are systematic. + for(int i=31; i >= 0; i--) + if(op->bit[i].type == AVR_CMDBIT_ADDRESS) + if(i<8 || i>23 || op->bit[i].bitno != (opnum == AVR_OP_LOAD_EXT_ADDR? i+8: i-8)) + compact = 0; + + if(detailed) + *sp++ = '"'; + + for(int i=31; i >= 0; i--) { + *sp++ = cb = cmdbitchar(op->bit[i]); + if(compact) { + if(i && i%8 == 0) + *sp++ = '-', *sp++ = '-'; + else if(i && i%4 == 0) + *sp++ = '.'; + } else { + if(cb == 'a') { + sprintf(sp, "%d", op->bit[i].bitno); + sp += strlen(sp); + } + if(i) { + if(detailed) + *sp++ = ' '; + if(i%8 == 0) + *sp++ = ' '; + } + } + } + if(detailed) + *sp++ = '"'; + *sp = 0; + + return strdup(space); +} + + +/* + * Match STRING against the partname pattern PATTERN, returning 1 if it + * matches, 0 if not. NOTE: part_match() is a modified old copy of !fnmatch() + * from the GNU C Library (published under GLP v2). Used for portability. + */ + +inline static int fold(int c) { + return (c >= 'A' && c <= 'Z')? c+('a'-'A'): c; +} + +int part_match(const char *pattern, const char *string) { + unsigned char c; + const char *p = pattern, *n = string; + + if(!*n) // AVRDUDE specialty: empty string never matches + return 0; + + while((c = fold(*p++))) { + switch(c) { + case '?': + if(*n == 0) + return 0; + break; + + case '\\': + c = fold(*p++); + if(fold(*n) != c) + return 0; + break; + + case '*': + for(c = *p++; c == '?' || c == '*'; c = *p++) + if(c == '?' && *n++ == 0) + return 0; + + if(c == 0) + return 1; + + { + unsigned char c1 = fold(c == '\\'? *p : c); // This char + + for(--p; *n; ++n) // Recursively check reminder of string for * + if((c == '[' || fold(*n) == c1) && part_match(p, n) == 1) + return 1; + return 0; + } + + case '[': + { + int negate; + + if(*n == 0) + return 0; + + negate = (*p == '!' || *p == '^'); + if(negate) + ++p; + + c = *p++; + for(;;) { + unsigned char cstart = c, cend = c; + + if(c == '\\') + cstart = cend = *p++; + + cstart = cend = fold(cstart); + + if(c == 0) // [ (unterminated) + return 0; + + c = *p++; + c = fold(c); + + if(c == '-' && *p != ']') { + cend = *p++; + if(cend == '\\') + cend = *p++; + if(cend == 0) + return 0; + cend = fold(cend); + + c = *p++; + } + + if(fold(*n) >= cstart && fold(*n) <= cend) + goto matched; + + if(c == ']') + break; + } + if(!negate) + return 0; + break; + + matched:; + while(c != ']') { // Skip the rest of the [...] that already matched + + if(c == 0) // [... (unterminated) + return 0; + + c = *p++; + if(c == '\\') // XXX 1003.2d11 is unclear if this is right + ++p; + } + if(negate) + return 0; + } + break; + + default: + if(c != fold(*n)) + return 0; + } + + ++n; + } + + return *n == 0; +} diff --git a/src/developer_opts.c b/src/developer_opts.c index 0ddf68b2..f4a55478 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -51,114 +51,6 @@ #include "developer_opts.h" #include "developer_opts_private.h" -char cmdbitchar(CMDBIT cb) { - switch(cb.type) { - case AVR_CMDBIT_IGNORE: - return 'x'; - case AVR_CMDBIT_VALUE: - return cb.value? '1': '0'; - case AVR_CMDBIT_ADDRESS: - return 'a'; - case AVR_CMDBIT_INPUT: - return 'i'; - case AVR_CMDBIT_OUTPUT: - return 'o'; - default: - return '?'; - } -} - - -char *cmdbitstr(CMDBIT cb) { - char space[32]; - - *space = cmdbitchar(cb); - if(*space == 'a') - sprintf(space+1, "%d", cb.bitno); - else - space[1] = 0; - - return strdup(space); -} - - -const char *opcodename(int opnum) { - switch(opnum) { - case AVR_OP_READ: - return "read"; - case AVR_OP_WRITE: - return "write"; - case AVR_OP_READ_LO: - return "read_lo"; - case AVR_OP_READ_HI: - return "read_hi"; - case AVR_OP_WRITE_LO: - return "write_lo"; - case AVR_OP_WRITE_HI: - return "write_hi"; - case AVR_OP_LOADPAGE_LO: - return "loadpage_lo"; - case AVR_OP_LOADPAGE_HI: - return "loadpage_hi"; - case AVR_OP_LOAD_EXT_ADDR: - return "load_ext_addr"; - case AVR_OP_WRITEPAGE: - return "writepage"; - case AVR_OP_CHIP_ERASE: - return "chip_erase"; - case AVR_OP_PGM_ENABLE: - return "pgm_enable"; - default: - return "???"; - } -} - - -// Unique string representation of an opcode -char *opcode2str(OPCODE *op, int opnum, int detailed) { - char cb, space[1024], *sp = space; - int compact = 1; - - if(!op) - return strdup("NULL"); - - // Can the opcode be printed in a compact way? Only if address bits are systematic. - for(int i=31; i >= 0; i--) - if(op->bit[i].type == AVR_CMDBIT_ADDRESS) - if(i<8 || i>23 || op->bit[i].bitno != (opnum == AVR_OP_LOAD_EXT_ADDR? i+8: i-8)) - compact = 0; - - if(detailed) - *sp++ = '"'; - - for(int i=31; i >= 0; i--) { - *sp++ = cb = cmdbitchar(op->bit[i]); - if(compact) { - if(i && i%8 == 0) - *sp++ = '-', *sp++ = '-'; - else if(i && i%4 == 0) - *sp++ = '.'; - } else { - if(cb == 'a') { - sprintf(sp, "%d", op->bit[i].bitno); - sp += strlen(sp); - } - if(i) { - if(detailed) - *sp++ = ' '; - if(i%8 == 0) - *sp++ = ' '; - } - } - } - if(detailed) - *sp++ = '"'; - *sp = 0; - - return strdup(space); -} - - // return 0 if op code would encode (essentially) the same SPI command static int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum) { char *opstr1, *opstr2, *p; @@ -215,19 +107,6 @@ static void printallopcodes(AVRPART *p, const char *d, OPCODE **opa) { } -// returns position 0..31 of highest bit set or INT_MIN if no bit is set -int intlog2(unsigned int n) { - int ret; - - if(!n) - return INT_MIN; - - for(ret = 0; n >>= 1; ret++) - continue; - - return ret; -} - // mnemonic characterisation of flags static char *parttype(AVRPART *p) { @@ -295,99 +174,6 @@ static void checkaddr(int memsize, int pagesize, int opnum, OPCODE *op, AVRPART } -/* - * avr_set_addr_mem() - * - * Set address bits in the specified command based on the memory, opcode and - * address; addr must be a word address for flash or, for all other memories, - * a byte address; returns 0 on success and -1 on error (no memory or no - * opcode) or, if positive, bn+1 where bn is bit number of the highest - * necessary bit that the opcode does not provide. - */ -int avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long addr) { - int ret, isflash, lo, hi, memsize, pagesize; - OPCODE *op; - - if(!mem) - return -1; - - if(!(op = mem->op[opnum])) - return -1; - - isflash = !strcmp(mem->desc, "flash"); // ISP parts have only one flash-like memory - memsize = mem->size >> isflash; // word addresses for flash - pagesize = mem->page_size >> isflash; - - // compute range lo..hi of needed address bits - switch(opnum) { - case AVR_OP_READ: - case AVR_OP_WRITE: - case AVR_OP_READ_LO: - case AVR_OP_READ_HI: - case AVR_OP_WRITE_LO: - case AVR_OP_WRITE_HI: - lo = 0; - hi = intlog2(memsize-1); // memsize = 1 implies no addr bit is needed - break; - - case AVR_OP_LOADPAGE_LO: - case AVR_OP_LOADPAGE_HI: - lo = 0; - hi = intlog2(pagesize-1); - break; - - case AVR_OP_LOAD_EXT_ADDR: - lo = 16; - hi = intlog2(memsize-1); - break; - - case AVR_OP_WRITEPAGE: - lo = intlog2(pagesize); - hi = intlog2(memsize-1); - break; - - case AVR_OP_CHIP_ERASE: - case AVR_OP_PGM_ENABLE: - default: - lo = 0; - hi = -1; - break; - } - - // Unless it's load extended address, ISP chips only deal with 16 bit addresses - if(opnum != AVR_OP_LOAD_EXT_ADDR && hi > 15) - hi = 15; - - unsigned char avail[32]; - memset(avail, 0, sizeof avail); - - for(int i=0; i<32; i++) { - if(op->bit[i].type == AVR_CMDBIT_ADDRESS) { - int bitno, j, bit; - unsigned char mask; - - bitno = op->bit[i].bitno & 31; - j = 3 - i / 8; - bit = i % 8; - mask = 1 << bit; - avail[bitno] = 1; - - // 'a' bit with number outside bit range [lo, hi] is set to 0 - if (bitno >= lo && bitno <= hi? (addr >> bitno) & 1: 0) - cmd[j] = cmd[j] | mask; - else - cmd[j] = cmd[j] & ~mask; - } - } - - ret = 0; - if(lo >= 0 && hi < 32 && lo <= hi) - for(int bn=lo; bn <= hi; bn++) - if(!avail[bn]) // necessary bit bn misses in opcode - ret = bn+1; - - return ret; -} static char *dev_sprintf(const char *fmt, ...) { int size = 0; @@ -841,126 +627,6 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { -/* - * Match STRING against the partname pattern PATTERN, returning 1 if it - * matches, 0 if not. NOTE: part_match() is a modified old copy of !fnmatch() - * from the GNU C Library (published under GLP v2). Used for portability. - */ - -inline static int fold(int c) { - return (c >= 'A' && c <= 'Z')? c+('a'-'A'): c; -} - -int part_match(const char *pattern, const char *string) { - unsigned char c; - const char *p = pattern, *n = string; - - if(!*n) // AVRDUDE specialty: empty string never matches - return 0; - - while((c = fold(*p++))) { - switch(c) { - case '?': - if(*n == 0) - return 0; - break; - - case '\\': - c = fold(*p++); - if(fold(*n) != c) - return 0; - break; - - case '*': - for(c = *p++; c == '?' || c == '*'; c = *p++) - if(c == '?' && *n++ == 0) - return 0; - - if(c == 0) - return 1; - - { - unsigned char c1 = fold(c == '\\'? *p : c); // This char - - for(--p; *n; ++n) // Recursively check reminder of string for * - if((c == '[' || fold(*n) == c1) && part_match(p, n) == 1) - return 1; - return 0; - } - - case '[': - { - int negate; - - if(*n == 0) - return 0; - - negate = (*p == '!' || *p == '^'); - if(negate) - ++p; - - c = *p++; - for(;;) { - unsigned char cstart = c, cend = c; - - if(c == '\\') - cstart = cend = *p++; - - cstart = cend = fold(cstart); - - if(c == 0) // [ (unterminated) - return 0; - - c = *p++; - c = fold(c); - - if(c == '-' && *p != ']') { - cend = *p++; - if(cend == '\\') - cend = *p++; - if(cend == 0) - return 0; - cend = fold(cend); - - c = *p++; - } - - if(fold(*n) >= cstart && fold(*n) <= cend) - goto matched; - - if(c == ']') - break; - } - if(!negate) - return 0; - break; - - matched:; - while(c != ']') { // Skip the rest of the [...] that already matched - - if(c == 0) // [... (unterminated) - return 0; - - c = *p++; - if(c == '\\') // XXX 1003.2d11 is unclear if this is right - ++p; - } - if(negate) - return 0; - } - break; - - default: - if(c != fold(*n)) - return 0; - } - - ++n; - } - - return *n == 0; -} - // -p */[cdosw*] void dev_output_part_defs(char *partdesc) { From f299439b972ab8a115f090981a290a4f5e56a3ad Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 27 Jul 2022 00:18:06 +0100 Subject: [PATCH 166/511] Move developer_opts* file names from library section to main section for c/make --- src/CMakeLists.txt | 6 +++--- src/Makefile.am | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d3f9b87a..d34e85e0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -133,9 +133,6 @@ add_library(libavrdude confwin.c crc16.c crc16.h - developer_opts.c - developer_opts.h - developer_opts_private.h dfu.c dfu.h fileio.c @@ -253,6 +250,9 @@ add_executable(avrdude main.c term.c term.h + developer_opts.c + developer_opts.h + developer_opts_private.h whereami.c whereami.h "${EXTRA_WINDOWS_RESOURCES}" diff --git a/src/Makefile.am b/src/Makefile.am index f2747c1b..9e0929e1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -110,9 +110,6 @@ libavrdude_a_SOURCES = \ confwin.c \ crc16.c \ crc16.h \ - developer_opts.c \ - developer_opts.h \ - developer_opts_private.h \ dfu.c \ dfu.h \ fileio.c \ @@ -201,6 +198,9 @@ avrdude_SOURCES = \ main.c \ whereami.c \ whereami.h \ + developer_opts.c \ + developer_opts.h \ + developer_opts_private.h \ term.c \ term.h From de124bfd9b3b4a002b71bf73574d412c0c9bb573 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Fri, 29 Jul 2022 12:48:53 +0200 Subject: [PATCH 167/511] Improve error detection logic --- src/jtagmkII.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jtagmkII.c b/src/jtagmkII.c index 675c9540..7181d186 100644 --- a/src/jtagmkII.c +++ b/src/jtagmkII.c @@ -1306,7 +1306,7 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p) const char *ifname; /* Abort and print error if programmer does not support the target microcontroller */ - if ((strncmp(pgm->type, "JTAGMKII_UPDI", strlen("JTAGMKII_UPDI")) == 0 && p->flags & AVRPART_HAS_PDI) || + if ((strncmp(pgm->type, "JTAGMKII_UPDI", strlen("JTAGMKII_UPDI")) == 0 && !(p->flags & AVRPART_HAS_UPDI)) || (strncmp(ldata(lfirst(pgm->id)), "jtagmkII", strlen("jtagmkII")) == 0 && p->flags & AVRPART_HAS_UPDI)) { avrdude_message(MSG_INFO, "ERROR: programmer %s does not support target %s\n\n", ldata(lfirst(pgm->id)), p->desc); From 02027ab766e0654d1c5c73dc09e5cddcd4fd1525 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 2 Aug 2022 23:26:01 +0100 Subject: [PATCH 168/511] Enable stdin verification and display correct number of bytes written/verified Counting the number of bytes written to a memory and/or verified is not trivial owing to potential holes in the input file and to potential trailing 0xff bytes in flash memory that are not written per default (but see -A). The new function memstats(), which is best called just after an input file has been read into mem->buf/mem->tags, computes the right number of bytes written and allows easy computation of the number of bytes verified. This commit also changes the strategy for the default verification after writing to a chip memory, so that the input file only needs reading once thus enabling successful verification of stdin input files. Other, minor changes: - Improving the grammar of AVRDUDE output, eg, 1 byte written instead of 1 bytes written - Better description of the input file structure in terms of its sections, the interval it spans, the number of pages, the number of padding bytes in pages, and the number of actually cut off trailing 0xff bytes for flash - Printing or instead of - in the -U routines - Option -V no longer needs to be specified before option -U in order to work As an aside this commit also provides useful helper functions for printing plural(), inname(), outname() and interval() all of which return strings fit for printing. $ avrdude -qp ATmega2560 -c usbtiny -U blink-mega2560+lext-test.hex avrdude: AVR device initialized and ready to accept instructions avrdude: Device signature = 0x1e9801 (probably m2560) avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: input file blink-mega2560+lext-test.hex auto detected as Intel Hex avrdude: reading input file blink-mega2560+lext-test.hex for flash with 1346 bytes in 4 sections within [0, 0x3106d] using 7 pages and 446 pad bytes avrdude: writing 1346 bytes flash ... avrdude: 1346 bytes of flash written avrdude: verifying flash memory against blink-mega2560+lext-test.hex avrdude: 1346 bytes of flash verified avrdude done. Thank you. $ avrdude -qp ATmega328P -c usb-bub-ii -U sketch-ending-in-ff.hex avrdude: AVR device initialized and ready to accept instructions avrdude: Device signature = 0x1e950f (probably m328p) avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: input file sketch-ending-in-ff.hex auto detected as Intel Hex avrdude: reading input file sketch-ending-in-ff.hex for flash with 2160 bytes in 1 section within [0, 0x888] using 17 pages and 16 pad bytes, cutting off 25 trailing 0xff bytes avrdude: writing 2160 bytes flash ... avrdude: 2160 bytes of flash written avrdude: verifying flash memory against sketch-ending-in-ff.hex avrdude: 2185 bytes of flash verified avrdude done. Thank you. $ echo "Hello, world..." | avrdude -qp ATmega328P -c ... -U eeprom:w:-:r avrdude: AVR device initialized and ready to accept instructions avrdude: Device signature = 0x1e950f (probably m328p) avrdude: reading input file for eeprom avrdude: writing 16 bytes eeprom ... avrdude: 16 bytes of eeprom written avrdude: verifying eeprom memory against avrdude: 16 bytes of eeprom verified avrdude done. Thank you. --- src/libavrdude.h | 20 +++ src/main.c | 14 +- src/update.c | 330 ++++++++++++++++++++++++++++++++--------------- 3 files changed, 252 insertions(+), 112 deletions(-) diff --git a/src/libavrdude.h b/src/libavrdude.h index dad47922..95e08d18 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -888,6 +888,7 @@ enum updateflags { UF_NONE = 0, UF_NOWRITE = 1, UF_AUTO_ERASE = 2, + UF_VERIFY = 4, }; @@ -898,6 +899,17 @@ typedef struct update_t { int format; } UPDATE; +typedef struct { // File reads for flash can exclude trailing 0xff, which are cut off + int nbytes, // Number of bytes set including 0xff but excluding cut off, trailing 0xff + nsections, // Number of consecutive sections in source excluding cut off, trailing 0xff + npages, // Number of memory pages needed excluding pages solely with trailing 0xff + nfill, // Number of fill bytes to make up full pages that are needed + ntrailing, // Number of trailing 0xff in source + firstaddr, // First address set in [0, mem->size-1] + lastaddr; // Highest address set by input file +} Filestats; + + #ifdef __cplusplus extern "C" { #endif @@ -910,6 +922,14 @@ extern void free_update(UPDATE * upd); extern int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags flags); +extern int memstats(struct avrpart *p, char *memtype, int size, Filestats *fsp); + +// Convenience functions for printing +const char *plural(int x); +const char *inname(const char *fn); +const char *outname(const char *fn); +const char *interval(int a, int b); + #ifdef __cplusplus } #endif diff --git a/src/main.c b/src/main.c index 772762f3..f4095d5f 100644 --- a/src/main.c +++ b/src/main.c @@ -237,7 +237,7 @@ static void cleanup_main(void) static void replace_backslashes(char *s) { // Replace all backslashes with forward slashes - for (int i = 0; i < strlen(s); i++) { + for (size_t i = 0; i < strlen(s); i++) { if (s[i] == '\\') { s[i] = '/'; } @@ -267,7 +267,6 @@ int main(int argc, char * argv []) int calibrate; /* 1=calibrate RC oscillator, 0=don't */ char * port; /* device port (/dev/xxx) */ int terminal; /* 1=enter terminal mode, 0=don't */ - int verify; /* perform a verify operation */ char * exitspecs; /* exit specs string from command line */ char * programmer; /* programmer id */ char * partdesc; /* part id */ @@ -284,7 +283,7 @@ int main(int argc, char * argv []) int init_ok; /* Device initialization worked well */ int is_open; /* Device open succeeded */ char * logfile; /* Use logfile rather than stderr for diagnostics */ - enum updateflags uflags = UF_AUTO_ERASE; /* Flags for do_op() */ + enum updateflags uflags = UF_AUTO_ERASE | UF_VERIFY; /* Flags for do_op() */ #if !defined(WIN32) char * homedir; @@ -349,7 +348,6 @@ int main(int argc, char * argv []) p = NULL; ovsigck = 0; terminal = 0; - verify = 1; /* on by default */ quell_progress = 0; exitspecs = NULL; pgm = NULL; @@ -525,12 +523,6 @@ int main(int argc, char * argv []) exit(1); } ladd(updates, upd); - - if (verify && upd->op == DEVICE_WRITE) { - upd = dup_update(upd); - upd->op = DEVICE_VERIFY; - ladd(updates, upd); - } break; case 'v': @@ -538,7 +530,7 @@ int main(int argc, char * argv []) break; case 'V': - verify = 0; + uflags &= ~UF_VERIFY; break; case 'x': diff --git a/src/update.c b/src/update.c index 1840f81f..ffddfa16 100644 --- a/src/update.c +++ b/src/update.c @@ -45,7 +45,7 @@ UPDATE * parse_op(char * s) i = 0; p = s; - while ((i < (sizeof(buf)-1) && *p && (*p != ':'))) + while (i < (int) sizeof(buf)-1 && *p && *p != ':') buf[i++] = *p++; buf[i] = 0; @@ -214,18 +214,124 @@ void free_update(UPDATE * u) } +// Memory statistics considering holes after a file read returned size bytes +int memstats(struct avrpart *p, char *memtype, int size, Filestats *fsp) { + Filestats ret = { 0 }; + AVRMEM *mem = avr_locate_mem(p, memtype); + + if(!mem) { + avrdude_message(MSG_INFO, "%s: %s %s undefined\n", + progname, p->desc, memtype); + return LIBAVRDUDE_GENERAL_FAILURE; + } + + if(!mem->buf || !mem->tags) { + avrdude_message(MSG_INFO, "%s: %s %s is not set\n", + progname, p->desc, memtype); + return LIBAVRDUDE_GENERAL_FAILURE; + } + + int pgsize = mem->page_size; + if(pgsize < 1) + pgsize = 1; + + if(size < 0 || size > mem->size) { + avrdude_message(MSG_INFO, "%s: memstats() size %d at odds with %s %s size %d\n", + progname, size, p->desc, memtype, mem->size); + return LIBAVRDUDE_GENERAL_FAILURE; + } + + ret.lastaddr = -1; + int firstset = 0, insection = 0; + // Scan all memory + for(int addr = 0; addr < mem->size; ) { + int pageset = 0; + // Go page by page + for(int pgi = 0; pgi < pgsize; pgi++, addr++) { + if(mem->tags[addr] & TAG_ALLOCATED) { + if(!firstset) { + firstset = 1; + ret.firstaddr = addr; + } + ret.lastaddr = addr; + // size can be smaller than tags suggest owing to flash trailing-0xff + if(addr < size) { + ret.nbytes++; + if(!pageset) { + pageset = 1; + ret.nfill += pgi; + ret.npages++; + } + if(!insection) { + insection = 1; + ret.nsections++; + } + } else { // Now beyond size returned by input file read + ret.ntrailing++; + if(pageset) + ret.nfill++; + } + } else { // In a hole or beyond input file + insection = 0; + if(pageset) + ret.nfill++; + } + } + } + + if(fsp) + *fsp = ret; + + return LIBAVRDUDE_SUCCESS; +} + + +// Convenience functions for printing +const char *plural(int x) { + return x==1? "": "s"; +} + +const char *inname(const char *fn) { + return !fn? "???": strcmp(fn, "-")? fn: ""; +} + +const char *outname(const char *fn) { + return !fn? "???": strcmp(fn, "-")? fn: ""; +} + +// Return sth like "[0, 0x1ff]" +const char *interval(int a, int b) { + // Cyclic buffer for 20+ temporary interval strings each max 41 bytes at 64-bit int + static char space[20*41 + 80], *sp; + if(!sp || sp-space > (int) sizeof space - 80) + sp = space; + + char *ret = sp; + + sprintf(sp, a<16? "[%d": "[0x%x", a); + sp += strlen(sp); + sprintf(sp, b<16? ", %d]": ", 0x%x]", b); + + // Advance beyond return string in temporary ring buffer + sp += strlen(sp)+1; + + return ret; +} + + int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags flags) { struct avrpart * v; AVRMEM * mem; - int size, vsize; + int size; int rc; + Filestats fs; mem = avr_locate_mem(p, upd->memtype); if (mem == NULL) { - avrdude_message(MSG_INFO, "\"%s\" memory type not defined for part \"%s\"\n", - upd->memtype, p->desc); - return -1; + avrdude_message(MSG_INFO, "%s memory type not defined for part %s\n", + upd->memtype, p->desc); + return LIBAVRDUDE_GENERAL_FAILURE; } AVRMEM_ALIAS * alias_mem = avr_find_memalias(p, mem); @@ -235,167 +341,189 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f strcat(alias_mem_desc, alias_mem->desc); } - if (upd->op == DEVICE_READ) { - /* - * read out the specified device memory and write it to a file - */ + switch (upd->op) { + case DEVICE_READ: + // Read out the specified device memory and write it to a file if (upd->format == FMT_IMM) { avrdude_message(MSG_INFO, - "%s: Invalid file format 'immediate' for output\n", - progname, upd->filename); - return -1; + "%s: Invalid file format 'immediate' for output\n", progname); + return LIBAVRDUDE_GENERAL_FAILURE; } - if (quell_progress < 2) { - avrdude_message(MSG_INFO, "%s: reading %s%s memory:\n", - progname, mem->desc, alias_mem_desc); - } - report_progress(0,1,"Reading"); + if (quell_progress < 2) + avrdude_message(MSG_INFO, "%s: reading %s%s memory ...\n", + progname, mem->desc, alias_mem_desc); + + report_progress(0, 1, "Reading"); rc = avr_read(pgm, p, upd->memtype, 0); + report_progress(1, 1, NULL); if (rc < 0) { avrdude_message(MSG_INFO, "%s: failed to read all of %s%s memory, rc=%d\n", - progname, mem->desc, alias_mem_desc, rc); - return -1; + progname, mem->desc, alias_mem_desc, rc); + return LIBAVRDUDE_GENERAL_FAILURE; } - report_progress(1,1,NULL); size = rc; if (quell_progress < 2) { if (rc == 0) - avrdude_message(MSG_INFO, "%s: Flash is empty, resulting file has no contents.\n", - progname); - avrdude_message(MSG_INFO, "%s: writing output file \"%s\"\n", - progname, - strcmp(upd->filename, "-")==0 ? "" : upd->filename); + avrdude_message(MSG_INFO, "%s: flash is empty, resulting file has no contents\n", + progname); + avrdude_message(MSG_INFO, "%s: writing output file %s\n", + progname, outname(upd->filename)); } rc = fileio(FIO_WRITE, upd->filename, upd->format, p, upd->memtype, size); if (rc < 0) { - avrdude_message(MSG_INFO, "%s: write to file '%s' failed\n", - progname, upd->filename); - return -1; - } - } - else if (upd->op == DEVICE_WRITE) { - /* - * write the selected device memory using data from a file; first - * read the data from the specified file - */ - if (quell_progress < 2) { - avrdude_message(MSG_INFO, "%s: reading input file \"%s\"\n", - progname, - strcmp(upd->filename, "-")==0 ? "" : upd->filename); + avrdude_message(MSG_INFO, "%s: write to file %s failed\n", + progname, outname(upd->filename)); + return LIBAVRDUDE_GENERAL_FAILURE; } + break; + + case DEVICE_WRITE: + // Write the selected device memory using data from a file + rc = fileio(FIO_READ, upd->filename, upd->format, p, upd->memtype, -1); + if (quell_progress < 2) + avrdude_message(MSG_INFO, "%s: reading input file %s for %s%s\n", + progname, inname(upd->filename), mem->desc, alias_mem_desc); if (rc < 0) { - avrdude_message(MSG_INFO, "%s: read from file '%s' failed\n", - progname, upd->filename); - return -1; + avrdude_message(MSG_INFO, "%s: read from file %s failed\n", + progname, inname(upd->filename)); + return LIBAVRDUDE_GENERAL_FAILURE; } size = rc; - /* - * write the buffer contents to the selected memory type - */ - if (quell_progress < 2) { - avrdude_message(MSG_INFO, "%s: writing %s%s (%d bytes):\n", - progname, mem->desc, alias_mem_desc, size); - } + if(memstats(p, upd->memtype, size, &fs) < 0) + return LIBAVRDUDE_GENERAL_FAILURE; + + if(quell_progress < 2) { + int level = fs.nsections > 1 || fs.firstaddr > 0 || fs.ntrailing? MSG_INFO: MSG_NOTICE; + + avrdude_message(level, "%*s with %d byte%s in %d section%s within %s\n", + (int) strlen(progname)+1, "", + fs.nbytes, plural(fs.nbytes), + fs.nsections, plural(fs.nsections), + interval(fs.firstaddr, fs.lastaddr)); + if(mem->page_size > 1) { + avrdude_message(level, "%*s using %d page%s and %d pad byte%s", + (int) strlen(progname)+1, "", + fs.npages, plural(fs.npages), + fs.nfill, plural(fs.nfill)); + if(fs.ntrailing) + avrdude_message(level, ", cutting off %d trailing 0xff byte%s", + fs.ntrailing, plural(fs.ntrailing)); + avrdude_message(level, "\n"); + } + } + + // Write the buffer contents to the selected memory type + if (quell_progress < 2) + avrdude_message(MSG_INFO, "%s: writing %d byte%s %s%s ...\n", + progname, fs.nbytes, plural(fs.nbytes), mem->desc, alias_mem_desc); if (!(flags & UF_NOWRITE)) { - report_progress(0,1,"Writing"); + report_progress(0, 1, "Writing"); rc = avr_write(pgm, p, upd->memtype, size, (flags & UF_AUTO_ERASE) != 0); - report_progress(1,1,NULL); - } - else { - /* - * test mode, don't actually write to the chip, output the buffer - * to stdout in intel hex instead - */ + report_progress(1, 1, NULL); + } else { + // Test mode: write to stdout in intel hex rather than to the chip rc = fileio(FIO_WRITE, "-", FMT_IHEX, p, upd->memtype, size); } if (rc < 0) { avrdude_message(MSG_INFO, "%s: failed to write %s%s memory, rc=%d\n", - progname, mem->desc, alias_mem_desc, rc); - return -1; + progname, mem->desc, alias_mem_desc, rc); + return LIBAVRDUDE_GENERAL_FAILURE; } - vsize = rc; + if (quell_progress < 2) + avrdude_message(MSG_INFO, "%s: %d byte%s of %s%s written\n", + progname, fs.nbytes, plural(fs.nbytes), mem->desc, alias_mem_desc); - if (quell_progress < 2) { - avrdude_message(MSG_INFO, "%s: %d bytes of %s%s written\n", progname, - vsize, mem->desc, alias_mem_desc); - } + // Fall through for (default) auto verify, ie, unless -V was specified + if (!(flags & UF_VERIFY)) + break; - } - else if (upd->op == DEVICE_VERIFY) { - /* - * verify that the in memory file (p->mem[AVR_M_FLASH|AVR_M_EEPROM]) - * is the same as what is on the chip - */ + case DEVICE_VERIFY: + // Verify that the in memory file is the same as what is on the chip pgm->vfy_led(pgm, ON); + int userverify = upd->op == DEVICE_VERIFY; // Explicit -U :v by user + if (quell_progress < 2) { - avrdude_message(MSG_INFO, "%s: verifying %s%s memory against %s:\n", - progname, mem->desc, alias_mem_desc, upd->filename); + avrdude_message(MSG_INFO, "%s: verifying %s%s memory against %s\n", + progname, mem->desc, alias_mem_desc, inname(upd->filename)); - avrdude_message(MSG_NOTICE2, "%s: load data %s%s data from input file %s:\n", - progname, mem->desc, alias_mem_desc, upd->filename); + if (userverify) + avrdude_message(MSG_NOTICE, "%s: load %s%s data from input file %s\n", + progname, mem->desc, alias_mem_desc, inname(upd->filename)); } - rc = fileio(FIO_READ_FOR_VERIFY, upd->filename, upd->format, p, upd->memtype, -1); - if (rc < 0) { - avrdude_message(MSG_INFO, "%s: read from file '%s' failed\n", - progname, upd->filename); - return -1; + // No need to read file when fallen through from DEVICE_WRITE + if (userverify) { + rc = fileio(FIO_READ_FOR_VERIFY, upd->filename, upd->format, p, upd->memtype, -1); + + if (rc < 0) { + avrdude_message(MSG_INFO, "%s: read from file %s failed\n", + progname, inname(upd->filename)); + return LIBAVRDUDE_GENERAL_FAILURE; + } + size = rc; + + if(memstats(p, upd->memtype, size, &fs) < 0) + return LIBAVRDUDE_GENERAL_FAILURE; + } else { + // Correct size of last read to include potentially cut off, trailing 0xff (flash) + size = fs.lastaddr+1; } + v = avr_dup_part(p); - size = rc; + if (quell_progress < 2) { - avrdude_message(MSG_NOTICE2, "%s: input file %s contains %d bytes\n", - progname, upd->filename, size); - avrdude_message(MSG_NOTICE2, "%s: reading on-chip %s%s data:\n", - progname, mem->desc, alias_mem_desc); + if (userverify) + avrdude_message(MSG_NOTICE, "%s: input file %s contains %d byte%s\n", + progname, inname(upd->filename), fs.nbytes, plural(fs.nbytes)); + avrdude_message(MSG_NOTICE2, "%s: reading on-chip %s%s data ...\n", + progname, mem->desc, alias_mem_desc); } report_progress (0,1,"Reading"); rc = avr_read(pgm, p, upd->memtype, v); + report_progress (1,1,NULL); if (rc < 0) { avrdude_message(MSG_INFO, "%s: failed to read all of %s%s memory, rc=%d\n", - progname, mem->desc, alias_mem_desc, rc); + progname, mem->desc, alias_mem_desc, rc); pgm->err_led(pgm, ON); avr_free_part(v); - return -1; + return LIBAVRDUDE_GENERAL_FAILURE; } - report_progress (1,1,NULL); - - - if (quell_progress < 2) { + if (quell_progress < 2) avrdude_message(MSG_NOTICE2, "%s: verifying ...\n", progname); - } + rc = avr_verify(p, v, upd->memtype, size); if (rc < 0) { avrdude_message(MSG_INFO, "%s: verification error; content mismatch\n", - progname); + progname); pgm->err_led(pgm, ON); avr_free_part(v); - return -1; + return LIBAVRDUDE_GENERAL_FAILURE; } if (quell_progress < 2) { - avrdude_message(MSG_INFO, "%s: %d bytes of %s%s verified\n", - progname, rc, mem->desc, alias_mem_desc); + int verified = fs.nbytes+fs.ntrailing; + avrdude_message(MSG_INFO, "%s: %d byte%s of %s%s verified\n", + progname, verified, plural(verified), mem->desc, alias_mem_desc); } pgm->vfy_led(pgm, OFF); avr_free_part(v); - } - else { + break; + + default: avrdude_message(MSG_INFO, "%s: invalid update operation (%d) requested\n", - progname, upd->op); - return -1; + progname, upd->op); + return LIBAVRDUDE_GENERAL_FAILURE; } - return 0; + return LIBAVRDUDE_SUCCESS; } - From 42c8169c37923345758664ca3fdc4e229bc112d0 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 2 Aug 2022 23:53:00 +0100 Subject: [PATCH 169/511] Add ordered list of known memories to avr.c with access functions --- src/avr.c | 39 +++++++++++++++++++++++++++++++++++++++ src/config_gram.y | 1 + src/developer_opts.c | 43 +++++++------------------------------------ src/libavrdude.h | 5 +++++ 4 files changed, 52 insertions(+), 36 deletions(-) diff --git a/src/avr.c b/src/avr.c index 7f91e9a1..eb077b32 100644 --- a/src/avr.c +++ b/src/avr.c @@ -1220,7 +1220,46 @@ int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles) } return 0; +} + + +// Typical order in which memories show in avrdude.conf, runtime adds unknown ones (if any) +const char *avr_mem_order[100] = { + "eeprom", "flash", "application", "apptable", + "boot", "lfuse", "hfuse", "efuse", + "fuse", "fuse0", "wdtcfg", "fuse1", + "bodcfg", "fuse2", "osccfg", "fuse3", + "fuse4", "tcd0cfg", "fuse5", "syscfg0", + "fuse6", "syscfg1", "fuse7", "append", + "codesize", "fuse8", "fuse9", "bootend", + "bootsize", "fuses", "lock", "lockbits", + "tempsense", "signature", "prodsig", "sernum", + "calibration", "osccal16", "osccal20", "osc16err", + "osc20err", "usersig", "userrow", "data", +}; + +void avr_add_mem_order(const char *str) { + for(size_t i=0; i < sizeof avr_mem_order/sizeof *avr_mem_order; i++) { + if(avr_mem_order[i] && !strcmp(avr_mem_order[i], str)) + return; + if(!avr_mem_order[i]) { + avr_mem_order[i] = strdup(str); + return; + } } + avrdude_message(MSG_INFO, + "%s: avr_mem_order[] under-dimensioned in avr.c; increase and recompile\n", + progname); + exit(1); +} + +int avr_known_mem(const char *str) { + for(size_t i=0; i < sizeof avr_mem_order/sizeof *avr_mem_order; i++) + if(avr_mem_order[i] && !strcmp(avr_mem_order[i], str)) + return 1; + return 0; +} + int avr_chip_erase(PROGRAMMER * pgm, AVRPART * p) { diff --git a/src/config_gram.y b/src/config_gram.y index 68718dd1..ce11b924 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -1320,6 +1320,7 @@ part_parm : mem->desc[AVR_MEMDESCLEN-1] = 0; ladd(current_part->mem, mem); } + avr_add_mem_order($2->value.string); current_mem = mem; free_token($2); } diff --git a/src/developer_opts.c b/src/developer_opts.c index f4a55478..b82c1805 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -280,35 +280,6 @@ static void dev_stack_out(bool tsv, AVRPART *p, const char *name, unsigned char } -// order in which memories are processed, runtime adds unknown ones (but there shouldn't be any) -static const char *mem_order[100] = { - "eeprom", "flash", "application", "apptable", - "boot", "lfuse", "hfuse", "efuse", - "fuse", "fuse0", "wdtcfg", "fuse1", - "bodcfg", "fuse2", "osccfg", "fuse3", - "fuse4", "tcd0cfg", "fuse5", "syscfg0", - "fuse6", "syscfg1", "fuse7", "append", - "codesize", "fuse8", "fuse9", "bootend", - "bootsize", "fuses", "lock", "lockbits", - "tempsense", "signature", "prodsig", "sernum", - "calibration", "osccal16", "osccal20", "osc16err", - "osc20err", "usersig", "userrow", "data", -}; - -static void add_mem_order(const char *str) { - for(size_t i=0; i < sizeof mem_order/sizeof *mem_order; i++) { - if(mem_order[i] && !strcmp(mem_order[i], str)) - return; - if(!mem_order[i]) { - mem_order[i] = strdup(str); - return; - } - } - dev_info("%s: mem_order[] under-dimensioned in developer_opts.c; increase and recompile\n", progname); - exit(1); -} - - static int intcmp(int a, int b) { return a-b; } @@ -410,8 +381,8 @@ static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { // fill in all memories we got in defined order di = 0; - for(size_t mi=0; mi < sizeof mem_order/sizeof *mem_order && mem_order[mi]; mi++) { - m = p->mem? avr_locate_mem(p, mem_order[mi]): NULL; + for(size_t mi=0; mi < sizeof avr_mem_order/sizeof *avr_mem_order && avr_mem_order[mi]; mi++) { + m = p->mem? avr_locate_mem(p, avr_mem_order[mi]): NULL; if(m) { if(di >= sizeof d->mems/sizeof *d->mems) { avrdude_message(MSG_INFO, "%s: ran out of mems[] space, increase size in AVRMEMdeep of developer_opts.c and recompile\n", progname); @@ -566,11 +537,11 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { if(!base || opcodecmp(p->op[i], base->op[i], i)) dev_part_strct_entry(tsv, ".ptop", p->desc, "part", opcodename(i), opcode2str(p->op[i], i, !tsv)); - for(size_t mi=0; mi < sizeof mem_order/sizeof *mem_order && mem_order[mi]; mi++) { + for(size_t mi=0; mi < sizeof avr_mem_order/sizeof *avr_mem_order && avr_mem_order[mi]; mi++) { AVRMEM *m, *bm; - m = p->mem? avr_locate_mem(p, mem_order[mi]): NULL; - bm = base && base->mem? avr_locate_mem(base, mem_order[mi]): NULL; + m = p->mem? avr_locate_mem(p, avr_mem_order[mi]): NULL; + bm = base && base->mem? avr_locate_mem(base, avr_mem_order[mi]): NULL; if(!m && bm && !tsv) dev_info("\n memory \"%s\" = NULL;\n", bm->desc); @@ -694,12 +665,12 @@ void dev_output_part_defs(char *partdesc) { AVRPART *p = ldata(ln1); if(p->mem) for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) - add_mem_order(((AVRMEM *) ldata(lnm))->desc); + avr_add_mem_order(((AVRMEM *) ldata(lnm))->desc); // same for aliased memories (though probably not needed) if(p->mem_alias) for(LNODEID lnm=lfirst(p->mem_alias); lnm; lnm=lnext(lnm)) - add_mem_order(((AVRMEM_ALIAS *) ldata(lnm))->desc); + avr_add_mem_order(((AVRMEM_ALIAS *) ldata(lnm))->desc); } nprinted = dev_nprinted; diff --git a/src/libavrdude.h b/src/libavrdude.h index 95e08d18..cc332ec7 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -783,6 +783,7 @@ void sort_programmers(LISTID programmers); typedef void (*FP_UpdateProgress)(int percent, double etime, char *hdr); extern struct avrpart parts[]; +extern const char *avr_mem_order[100]; extern FP_UpdateProgress update_progress; @@ -818,6 +819,10 @@ int avr_get_cycle_count(PROGRAMMER * pgm, AVRPART * p, int * cycles); int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles); +void avr_add_mem_order(const char *str); + +int avr_known_mem(const char *str); + #define disable_trailing_ff_removal() avr_mem_hiaddr(NULL) int avr_mem_hiaddr(AVRMEM * mem); From 9604a3ef365b088b2d6b36e04dde6a225b271a56 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 3 Aug 2022 00:04:14 +0100 Subject: [PATCH 170/511] Check -U option for unknown memories during parsing $ avrdude -qp ATmega2560 -c usbtiny -U flesh:w:blink-mega2560+lext-test.hex:i avrdude: unknown memory type flesh avrdude: error parsing update operation 'flesh:w:blink-mega2560+lext-test.hex:i' --- src/avr.c | 2 +- src/libavrdude.h | 2 +- src/update.c | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/avr.c b/src/avr.c index eb077b32..3a7d4a9e 100644 --- a/src/avr.c +++ b/src/avr.c @@ -1253,7 +1253,7 @@ void avr_add_mem_order(const char *str) { exit(1); } -int avr_known_mem(const char *str) { +int avr_mem_is_known(const char *str) { for(size_t i=0; i < sizeof avr_mem_order/sizeof *avr_mem_order; i++) if(avr_mem_order[i] && !strcmp(avr_mem_order[i], str)) return 1; diff --git a/src/libavrdude.h b/src/libavrdude.h index cc332ec7..f8bdf682 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -821,7 +821,7 @@ int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles); void avr_add_mem_order(const char *str); -int avr_known_mem(const char *str); +int avr_mem_is_known(const char *str); #define disable_trailing_ff_removal() avr_mem_hiaddr(NULL) int avr_mem_hiaddr(AVRMEM * mem); diff --git a/src/update.c b/src/update.c index ffddfa16..ee205bbc 100644 --- a/src/update.c +++ b/src/update.c @@ -62,6 +62,12 @@ UPDATE * parse_op(char * s) return upd; } + if (!avr_mem_is_known(buf)) { + avrdude_message(MSG_INFO, "%s: unknown memory type %s\n", progname, buf); + free(upd); + return NULL; + } + upd->memtype = (char *)malloc(strlen(buf)+1); if (upd->memtype == NULL) { avrdude_message(MSG_INFO, "%s: out of memory\n", progname); From 648f3319a92ab0fdd004cb88bbb84dc6c04bf280 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 3 Aug 2022 00:23:15 +0100 Subject: [PATCH 171/511] Ignore target memories not present in part $ avrdude -qp m8 -c ... -U efuse:w:0xff:m && echo OK avrdude: AVR device initialized and ready to accept instructions avrdude: skipping -U efuse:... as memory not defined for part ATmega8 avrdude done. Thank you. OK --- src/main.c | 2 +- src/update.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index f4095d5f..2984203a 100644 --- a/src/main.c +++ b/src/main.c @@ -1243,7 +1243,7 @@ int main(int argc, char * argv []) for (ln=lfirst(updates); ln; ln=lnext(ln)) { upd = ldata(ln); rc = do_op(pgm, p, upd, uflags); - if (rc) { + if (rc && rc != LIBAVRDUDE_SOFTFAIL) { exitrc = 1; break; } diff --git a/src/update.c b/src/update.c index ee205bbc..78703e89 100644 --- a/src/update.c +++ b/src/update.c @@ -335,9 +335,9 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f mem = avr_locate_mem(p, upd->memtype); if (mem == NULL) { - avrdude_message(MSG_INFO, "%s memory type not defined for part %s\n", - upd->memtype, p->desc); - return LIBAVRDUDE_GENERAL_FAILURE; + avrdude_message(MSG_INFO, "%s: skipping -U %s:... as memory not defined for part %s\n", + progname, upd->memtype, p->desc); + return LIBAVRDUDE_SOFTFAIL; } AVRMEM_ALIAS * alias_mem = avr_find_memalias(p, mem); From 53ece538622ec695893bff35ee2650c1640b012a Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 3 Aug 2022 01:19:48 +0100 Subject: [PATCH 172/511] Update NEWS --- NEWS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/NEWS b/NEWS index 84852dbf..d820a6a4 100644 --- a/NEWS +++ b/NEWS @@ -44,6 +44,16 @@ Changes since version 7.0: add one read mode; add quell command #1025 - Fix usbtiny read for parts with more than 64 kB flash #1029 + - CMakeLists.txt: fix build without C++ #1016 + - Provide file format I: Intel HEX with comments that ignores + checksum errors #1030 + - Enable writing fuse and lock bits for AVR-JTAGICE #1031 + - Ignore -s flag as safemode is no longer supported #1033 + - Developer options to describe parts and + extend avrdude.conf syntax #1040 + - Deprecate original STK500 v1 protocol in favour of optiboot + and Arduino as ISP #1046 + - Add jtagmkii_updi programmer option #1048 * Internals: From 3412196cd904dc02bc04678758c8f2e7c943c09f Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 4 Aug 2022 00:14:19 +0100 Subject: [PATCH 173/511] Weaken -U memory type check and move after config file parsing in main.c The check for typos in -U memory names against a list of known memory names now happens after the config files have been read, so newly declared memory names can be considered. This commit also weakens the check against existence of a known memory: it is now sufficent for a name to pass when it could be the initial string of any known memory of any part. Any -U memory that cannot possibly be matched up with a known memory is considered a typo and leads to an exit before the programmer is opened. This to protect users from typos that leave a device partially programmed. When every -U memory name might be matching one of the known memories, the programming is attempted. If the part to be programmed turns out not to have a particular -U memory, AVRDUDE warns the user and skips this -U update. This to support unifying interfaces that call AVRDUDE with potentially more memories than the actual part has (eg, efuse on ATmega8). --- src/avr.c | 15 ++++++++++++--- src/libavrdude.h | 1 + src/main.c | 7 +++++++ src/update.c | 6 ------ 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/avr.c b/src/avr.c index 3a7d4a9e..eea0ad8a 100644 --- a/src/avr.c +++ b/src/avr.c @@ -1254,9 +1254,18 @@ void avr_add_mem_order(const char *str) { } int avr_mem_is_known(const char *str) { - for(size_t i=0; i < sizeof avr_mem_order/sizeof *avr_mem_order; i++) - if(avr_mem_order[i] && !strcmp(avr_mem_order[i], str)) - return 1; + if(str && *str) + for(size_t i=0; i < sizeof avr_mem_order/sizeof *avr_mem_order; i++) + if(avr_mem_order[i] && !strcmp(avr_mem_order[i], str)) + return 1; + return 0; +} + +int avr_mem_might_be_known(const char *str) { + if(str && *str) + for(size_t i=0; i < sizeof avr_mem_order/sizeof *avr_mem_order; i++) + if(avr_mem_order[i] && !strncmp(avr_mem_order[i], str, strlen(str))) + return 1; return 0; } diff --git a/src/libavrdude.h b/src/libavrdude.h index f8bdf682..a30c1402 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -822,6 +822,7 @@ int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles); void avr_add_mem_order(const char *str); int avr_mem_is_known(const char *str); +int avr_mem_might_be_known(const char *str); #define disable_trailing_ff_removal() avr_mem_hiaddr(NULL) int avr_mem_hiaddr(AVRMEM * mem); diff --git a/src/main.c b/src/main.c index 2984203a..9f72847f 100644 --- a/src/main.c +++ b/src/main.c @@ -751,6 +751,7 @@ int main(int argc, char * argv []) bitclock = default_bitclock; } + avrdude_message(MSG_NOTICE, "\n"); // developer option -p /[*codws] prints various aspects of part descriptions and exits @@ -918,6 +919,12 @@ int main(int argc, char * argv []) exit(1); } } + + if (!avr_mem_might_be_known(upd->memtype)) { + avrdude_message(MSG_INFO, "%s: unknown memory type %s\n", progname, upd->memtype); + exit(1); + } + // TODO: check whether filename other than "-" is readable/writable } /* diff --git a/src/update.c b/src/update.c index 78703e89..025bfb6b 100644 --- a/src/update.c +++ b/src/update.c @@ -62,12 +62,6 @@ UPDATE * parse_op(char * s) return upd; } - if (!avr_mem_is_known(buf)) { - avrdude_message(MSG_INFO, "%s: unknown memory type %s\n", progname, buf); - free(upd); - return NULL; - } - upd->memtype = (char *)malloc(strlen(buf)+1); if (upd->memtype == NULL) { avrdude_message(MSG_INFO, "%s: out of memory\n", progname); From 4eec8d15db3b1109f4207f8d3f3d7af865ba18ee Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 4 Aug 2022 18:19:43 +0100 Subject: [PATCH 174/511] Update NEWS --- NEWS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS b/NEWS index d820a6a4..c312a97f 100644 --- a/NEWS +++ b/NEWS @@ -54,6 +54,11 @@ Changes since version 7.0: - Deprecate original STK500 v1 protocol in favour of optiboot and Arduino as ISP #1046 - Add jtagmkii_updi programmer option #1048 + - Enable stdin verification, display correct number of bytes + written/verified, check -U memory names against spelling + errors and exit but skip -U memory updates with known + memories that the part lacks #1053 + - Handle invalid -U file format specifiers for input #1042 * Internals: From 5f5002eeaa8ef248f852b6a3766424bc73f0205c Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 4 Aug 2022 18:25:14 +0100 Subject: [PATCH 175/511] Change name of update helper functions for print messages --- src/libavrdude.h | 8 ++++---- src/update.c | 42 +++++++++++++++++++++--------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/libavrdude.h b/src/libavrdude.h index a30c1402..23905953 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -931,10 +931,10 @@ extern int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, extern int memstats(struct avrpart *p, char *memtype, int size, Filestats *fsp); // Convenience functions for printing -const char *plural(int x); -const char *inname(const char *fn); -const char *outname(const char *fn); -const char *interval(int a, int b); +const char *update_plural(int x); +const char *update_inname(const char *fn); +const char *update_outname(const char *fn); +const char *update_interval(int a, int b); #ifdef __cplusplus } diff --git a/src/update.c b/src/update.c index 33ce0608..2aa2579b 100644 --- a/src/update.c +++ b/src/update.c @@ -287,20 +287,20 @@ int memstats(struct avrpart *p, char *memtype, int size, Filestats *fsp) { // Convenience functions for printing -const char *plural(int x) { +const char *update_plural(int x) { return x==1? "": "s"; } -const char *inname(const char *fn) { +const char *update_inname(const char *fn) { return !fn? "???": strcmp(fn, "-")? fn: ""; } -const char *outname(const char *fn) { +const char *update_outname(const char *fn) { return !fn? "???": strcmp(fn, "-")? fn: ""; } // Return sth like "[0, 0x1ff]" -const char *interval(int a, int b) { +const char *update_interval(int a, int b) { // Cyclic buffer for 20+ temporary interval strings each max 41 bytes at 64-bit int static char space[20*41 + 80], *sp; if(!sp || sp-space > (int) sizeof space - 80) @@ -369,12 +369,12 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f avrdude_message(MSG_INFO, "%s: flash is empty, resulting file has no contents\n", progname); avrdude_message(MSG_INFO, "%s: writing output file %s\n", - progname, outname(upd->filename)); + progname, update_outname(upd->filename)); } rc = fileio(FIO_WRITE, upd->filename, upd->format, p, upd->memtype, size); if (rc < 0) { avrdude_message(MSG_INFO, "%s: write to file %s failed\n", - progname, outname(upd->filename)); + progname, update_outname(upd->filename)); return LIBAVRDUDE_GENERAL_FAILURE; } break; @@ -385,10 +385,10 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f rc = fileio(FIO_READ, upd->filename, upd->format, p, upd->memtype, -1); if (quell_progress < 2) avrdude_message(MSG_INFO, "%s: reading input file %s for %s%s\n", - progname, inname(upd->filename), mem->desc, alias_mem_desc); + progname, update_inname(upd->filename), mem->desc, alias_mem_desc); if (rc < 0) { avrdude_message(MSG_INFO, "%s: read from file %s failed\n", - progname, inname(upd->filename)); + progname, update_inname(upd->filename)); return LIBAVRDUDE_GENERAL_FAILURE; } size = rc; @@ -401,17 +401,17 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f avrdude_message(level, "%*s with %d byte%s in %d section%s within %s\n", (int) strlen(progname)+1, "", - fs.nbytes, plural(fs.nbytes), - fs.nsections, plural(fs.nsections), - interval(fs.firstaddr, fs.lastaddr)); + fs.nbytes, update_plural(fs.nbytes), + fs.nsections, update_plural(fs.nsections), + update_interval(fs.firstaddr, fs.lastaddr)); if(mem->page_size > 1) { avrdude_message(level, "%*s using %d page%s and %d pad byte%s", (int) strlen(progname)+1, "", - fs.npages, plural(fs.npages), - fs.nfill, plural(fs.nfill)); + fs.npages, update_plural(fs.npages), + fs.nfill, update_plural(fs.nfill)); if(fs.ntrailing) avrdude_message(level, ", cutting off %d trailing 0xff byte%s", - fs.ntrailing, plural(fs.ntrailing)); + fs.ntrailing, update_plural(fs.ntrailing)); avrdude_message(level, "\n"); } } @@ -419,7 +419,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f // Write the buffer contents to the selected memory type if (quell_progress < 2) avrdude_message(MSG_INFO, "%s: writing %d byte%s %s%s ...\n", - progname, fs.nbytes, plural(fs.nbytes), mem->desc, alias_mem_desc); + progname, fs.nbytes, update_plural(fs.nbytes), mem->desc, alias_mem_desc); if (!(flags & UF_NOWRITE)) { report_progress(0, 1, "Writing"); @@ -438,7 +438,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f if (quell_progress < 2) avrdude_message(MSG_INFO, "%s: %d byte%s of %s%s written\n", - progname, fs.nbytes, plural(fs.nbytes), mem->desc, alias_mem_desc); + progname, fs.nbytes, update_plural(fs.nbytes), mem->desc, alias_mem_desc); // Fall through for (default) auto verify, ie, unless -V was specified if (!(flags & UF_VERIFY)) @@ -452,11 +452,11 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f if (quell_progress < 2) { avrdude_message(MSG_INFO, "%s: verifying %s%s memory against %s\n", - progname, mem->desc, alias_mem_desc, inname(upd->filename)); + progname, mem->desc, alias_mem_desc, update_inname(upd->filename)); if (userverify) avrdude_message(MSG_NOTICE, "%s: load %s%s data from input file %s\n", - progname, mem->desc, alias_mem_desc, inname(upd->filename)); + progname, mem->desc, alias_mem_desc, update_inname(upd->filename)); } // No need to read file when fallen through from DEVICE_WRITE @@ -465,7 +465,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f if (rc < 0) { avrdude_message(MSG_INFO, "%s: read from file %s failed\n", - progname, inname(upd->filename)); + progname, update_inname(upd->filename)); return LIBAVRDUDE_GENERAL_FAILURE; } size = rc; @@ -482,7 +482,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f if (quell_progress < 2) { if (userverify) avrdude_message(MSG_NOTICE, "%s: input file %s contains %d byte%s\n", - progname, inname(upd->filename), fs.nbytes, plural(fs.nbytes)); + progname, update_inname(upd->filename), fs.nbytes, update_plural(fs.nbytes)); avrdude_message(MSG_NOTICE2, "%s: reading on-chip %s%s data ...\n", progname, mem->desc, alias_mem_desc); } @@ -513,7 +513,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f if (quell_progress < 2) { int verified = fs.nbytes+fs.ntrailing; avrdude_message(MSG_INFO, "%s: %d byte%s of %s%s verified\n", - progname, verified, plural(verified), mem->desc, alias_mem_desc); + progname, verified, update_plural(verified), mem->desc, alias_mem_desc); } pgm->vfy_led(pgm, OFF); From b24a1cf6673923a9db502742308d925ab53994fc Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 5 Aug 2022 17:38:59 +0100 Subject: [PATCH 176/511] Implement a dry run for -U updates before opening the programmer This commit checks -U update requests for - Typos in memory names - Whether the files can be written or read - Automatic format detection if necessary before opening the programmer. This to reduce the chances of the programming failing midway through. Minor additional changes: - Give strerror() system info when files are not read/writeable - Lift the auto detection message from MSG_INFO to MSG_NOTICE - Provide fileio_fmt_autodetect() in the AVRDUDE library - Rename fmtstr() in the AVRDUDE library to fileio_fmtstr() to avoid name clashes when an application links with it Example: $ avrdude -U - -U typo:r:.:h -U eeprom:w:testin:r -p ... -c ... avrdude: can't auto detect file format for stdin/out, specify explicitly avrdude: unknown memory type typo avrdude: file . is not writeable (not a regular or character file?) avrdude: file testin is not readable. No such file or directory --- src/fileio.c | 13 ++-- src/libavrdude.h | 12 +++- src/main.c | 20 ++++--- src/update.c | 152 +++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 175 insertions(+), 22 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index d21d8993..9d39325a 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -100,11 +100,8 @@ static int fileio_num(struct fioparms * fio, char * filename, FILE * f, AVRMEM * mem, int size, FILEFMT fmt); -static int fmt_autodetect(char * fname); - - -char * fmtstr(FILEFMT format) +char * fileio_fmtstr(FILEFMT format) { switch (format) { case FMT_AUTO : return "auto-detect"; break; @@ -1402,7 +1399,7 @@ int fileio_setparms(int op, struct fioparms * fp, -static int fmt_autodetect(char * fname) +int fileio_fmt_autodetect(const char * fname) { FILE * f; unsigned char buf[MAX_LINE_LEN]; @@ -1547,7 +1544,7 @@ int fileio(int oprwv, char * filename, FILEFMT format, return -1; } - format_detect = fmt_autodetect(fname); + format_detect = fileio_fmt_autodetect(fname); if (format_detect < 0) { avrdude_message(MSG_INFO, "%s: can't determine file format for %s, specify explicitly\n", progname, fname); @@ -1556,8 +1553,8 @@ int fileio(int oprwv, char * filename, FILEFMT format, format = format_detect; if (quell_progress < 2) { - avrdude_message(MSG_INFO, "%s: %s file %s auto detected as %s\n", - progname, fio.iodesc, fname, fmtstr(format)); + avrdude_message(MSG_NOTICE, "%s: %s file %s auto detected as %s\n", + progname, fio.iodesc, fname, fileio_fmtstr(format)); } } diff --git a/src/libavrdude.h b/src/libavrdude.h index 23905953..5e8fc5d2 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -872,7 +872,9 @@ enum { extern "C" { #endif -char * fmtstr(FILEFMT format); +char * fileio_fmtstr(FILEFMT format); + +int fileio_fmt_autodetect(const char * fname); int fileio(int oprwv, char * filename, FILEFMT format, struct avrpart * p, char * memtype, int size); @@ -936,6 +938,14 @@ const char *update_inname(const char *fn); const char *update_outname(const char *fn); const char *update_interval(int a, int b); +// Helper functions for dry run to determine file access +int update_is_okfile(const char *fn); +int update_is_writeable(const char *fn); +int update_is_readable(const char *fn); + +int update_dryrun(struct avrpart *p, UPDATE *upd); + + #ifdef __cplusplus } #endif diff --git a/src/main.c b/src/main.c index 9f72847f..de991aab 100644 --- a/src/main.c +++ b/src/main.c @@ -901,11 +901,13 @@ int main(int argc, char * argv []) } /* - * Now that we know which part we are going to program, locate any - * -U options using the default memory region, and fill in the - * device-dependent default region name, either "application" (for - * Xmega devices), or "flash" (everything else). + * Now that we know which part we are going to program, locate any -U + * options using the default memory region, fill in the device-dependent + * default region name ("application" for Xmega parts or "flash" otherwise) + * and check for basic problems with memory names or file access with a + * view to exit before programming. */ + int doexit = 0; for (ln=lfirst(updates); ln; ln=lnext(ln)) { upd = ldata(ln); if (upd->memtype == NULL) { @@ -920,12 +922,12 @@ int main(int argc, char * argv []) } } - if (!avr_mem_might_be_known(upd->memtype)) { - avrdude_message(MSG_INFO, "%s: unknown memory type %s\n", progname, upd->memtype); - exit(1); - } - // TODO: check whether filename other than "-" is readable/writable + rc = update_dryrun(p, upd); + if (rc && rc != LIBAVRDUDE_SOFTFAIL) + doexit = 1; } + if(doexit) + exit(1); /* * open the programmer diff --git a/src/update.c b/src/update.c index 2aa2579b..b0c48c6d 100644 --- a/src/update.c +++ b/src/update.c @@ -24,6 +24,9 @@ #include #include #include +#include +#include +#include #include "ac_cfg.h" #include "avrdude.h" @@ -319,6 +322,147 @@ const char *update_interval(int a, int b) { } +// Helper functions for dry run to determine file access + +int update_is_okfile(const char *fn) { + struct stat info; + + // File exists and is a regular file or a character file, eg, /dev/urandom + return fn && *fn && stat(fn, &info) == 0 && !!(info.st_mode & (S_IFREG | S_IFCHR)); +} + +int update_is_writeable(const char *fn) { + if(!fn || !*fn) + return 0; + + // Assume writing to stdout will be OK + if(!strcmp(fn, "-")) + return 1; + + // File exists? If so return whether it's readable and an OK file type + if(access(fn, F_OK) == 0) + return access(fn, W_OK) == 0 && update_is_okfile(fn); + + // File does not exist: try to create it + FILE *test = fopen(fn, "w"); + if(test) { + unlink(fn); + fclose(test); + } + return !!test; +} + +int update_is_readable(const char *fn) { + if(!fn || !*fn) + return 0; + + // Assume reading from stdin will be OK + if(!strcmp(fn, "-")) + return 1; + + // File exists, is readable by the process and an OK file type? + return access(fn, R_OK) == 0 && update_is_okfile(fn); +} + + +static void ioerror(const char *iotype, UPDATE *upd) { + avrdude_message(MSG_INFO, "%s: file %s is not %s", + progname, update_outname(upd->filename), iotype); + if(errno) { + char buf[1024]; + strerror_r(errno, buf, sizeof buf); + avrdude_message(MSG_INFO, ". %s", buf); + } else if(upd->filename && *upd->filename) + avrdude_message(MSG_INFO, " (not a regular or character file?)"); + avrdude_message(MSG_INFO, "\n"); +} + +// Basic checks to reveal serious failure before programming +int update_dryrun(struct avrpart *p, UPDATE *upd) { + static char **wrote; + static int nfwritten; + + int known, format_detect, ret = LIBAVRDUDE_SUCCESS; + + /* + * Reject an update if memory name is not known amongst any part (suspect a typo) + * but accept when the specific part does not have it (allow unifying i/faces) + */ + if(!avr_mem_might_be_known(upd->memtype)) { + avrdude_message(MSG_INFO, "%s: unknown memory type %s\n", progname, upd->memtype); + ret = LIBAVRDUDE_GENERAL_FAILURE; + } else if(p && !avr_locate_mem(p, upd->memtype)) + ret = LIBAVRDUDE_SOFTFAIL; + + known = 0; + // Necessary to check whether the file is readable? + if(upd->op == DEVICE_VERIFY || upd->op == DEVICE_WRITE || upd->format == FMT_AUTO) { + if(upd->format != FMT_IMM) { + // Need to read the file: was it written before, so will be known? + for(int i = 0; i < nfwritten; i++) + if(!wrote || (upd->filename && !strcmp(wrote[i], upd->filename))) + known = 1; + + errno = 0; + if(!known && !update_is_readable(upd->filename)) { + ioerror("readable", upd); + ret = LIBAVRDUDE_GENERAL_FAILURE; + known = 1; // Pretend we know it, so no auto detect needed + } + } + } + + if(!known && upd->format == FMT_AUTO) { + if(!strcmp(upd->filename, "-")) { + avrdude_message(MSG_INFO, "%s: can't auto detect file format for stdin/out, " + "specify explicitly\n", progname); + ret = LIBAVRDUDE_GENERAL_FAILURE; + } else if((format_detect = fileio_fmt_autodetect(upd->filename)) < 0) { + avrdude_message(MSG_INFO, "%s: can't determine file format for %s, specify explicitly\n", + progname, upd->filename); + ret = LIBAVRDUDE_GENERAL_FAILURE; + } else { + // Set format now, no need to repeat auto detection later + upd->format = format_detect; + if(quell_progress < 2) + avrdude_message(MSG_NOTICE, "%s: %s file %s auto detected as %s\n", + progname, upd->op == DEVICE_READ? "output": "input", upd->filename, + fileio_fmtstr(upd->format)); + } + } + + switch(upd->op) { + case DEVICE_READ: + if(upd->format == FMT_IMM) { + avrdude_message(MSG_INFO, + "%s: invalid file format 'immediate' for output\n", progname); + ret = LIBAVRDUDE_GENERAL_FAILURE; + } else { + errno = 0; + if(!update_is_writeable(upd->filename)) { + ioerror("writeable", upd); + ret = LIBAVRDUDE_GENERAL_FAILURE; + } else if(upd->filename) { // Record filename (other than stdout) is available for future reads + if(strcmp(upd->filename, "-") && (wrote = realloc(wrote, sizeof(*wrote) * (nfwritten+1)))) + wrote[nfwritten++] = upd->filename; + } + } + break; + + case DEVICE_VERIFY: // Already checked that file is readable + case DEVICE_WRITE: + break; + + default: + avrdude_message(MSG_INFO, "%s: invalid update operation (%d) requested\n", + progname, upd->op); + ret = LIBAVRDUDE_GENERAL_FAILURE; + } + + return ret; +} + + int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags flags) { struct avrpart * v; @@ -346,7 +490,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f // Read out the specified device memory and write it to a file if (upd->format == FMT_IMM) { avrdude_message(MSG_INFO, - "%s: Invalid file format 'immediate' for output\n", progname); + "%s: invalid file format 'immediate' for output\n", progname); return LIBAVRDUDE_GENERAL_FAILURE; } if (quell_progress < 2) @@ -383,15 +527,15 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f // Write the selected device memory using data from a file rc = fileio(FIO_READ, upd->filename, upd->format, p, upd->memtype, -1); - if (quell_progress < 2) - avrdude_message(MSG_INFO, "%s: reading input file %s for %s%s\n", - progname, update_inname(upd->filename), mem->desc, alias_mem_desc); if (rc < 0) { avrdude_message(MSG_INFO, "%s: read from file %s failed\n", progname, update_inname(upd->filename)); return LIBAVRDUDE_GENERAL_FAILURE; } size = rc; + if (quell_progress < 2) + avrdude_message(MSG_INFO, "%s: reading input file %s for %s%s\n", + progname, update_inname(upd->filename), mem->desc, alias_mem_desc); if(memstats(p, upd->memtype, size, &fs) < 0) return LIBAVRDUDE_GENERAL_FAILURE; From e590aead9323a3ad72c33b0d0ca6823cc023faec Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 5 Aug 2022 18:04:46 +0100 Subject: [PATCH 177/511] Treat comparison of different signedness warning in fileio.c --- src/fileio.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index 9d39325a..52e9afef 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -346,7 +346,7 @@ static int ihex2b(char * infile, FILE * inf, return -1; } nextaddr = ihex.loadofs + baseaddr - fileoffset; - if (nextaddr + ihex.reclen > bufsize) { + if (nextaddr + ihex.reclen > (unsigned) bufsize) { avrdude_message(MSG_INFO, "%s: ERROR: address 0x%04x out of range at line %d of %s\n", progname, nextaddr+ihex.reclen, lineno, infile); return -1; @@ -412,7 +412,6 @@ static int b2srec(unsigned char * inbuf, int bufsize, unsigned char * buf; unsigned int nextaddr; int n, nbytes, addr_width; - int i; unsigned char cksum; char * tmpl=0; @@ -460,10 +459,10 @@ static int b2srec(unsigned char * inbuf, int bufsize, cksum += n + addr_width + 1; - for (i=addr_width; i>0; i--) + for (int i=addr_width; i>0; i--) cksum += (nextaddr >> (i-1) * 8) & 0xff; - for (i=nextaddr; i0; i--) + for (int i=addr_width; i>0; i--) cksum += (nextaddr >> (i - 1) * 8) & 0xff; cksum = 0xff - cksum; fprintf(outf, "%02X\n", cksum); @@ -597,7 +596,7 @@ static int srec2b(char * infile, FILE * inf, int len; struct ihexrec srec; int rc; - int reccount; + unsigned int reccount; unsigned char datarec; char * msg = 0; @@ -687,7 +686,7 @@ static int srec2b(char * infile, FILE * inf, return -1; } nextaddr -= fileoffset; - if (nextaddr + srec.reclen > bufsize) { + if (nextaddr + srec.reclen > (unsigned) bufsize) { avrdude_message(MSG_INFO, msg, progname, nextaddr+srec.reclen, "", lineno, infile); return -1; @@ -1006,8 +1005,7 @@ static int elf2b(char * infile, FILE * inf, * ELF file region for these, and extract the actual byte to write * from it, using the "foff" offset obtained above. */ - if (mem->size != 1 && - sh->sh_size > mem->size) { + if (mem->size != 1 && sh->sh_size > (unsigned) mem->size) { avrdude_message(MSG_INFO, "%s: ERROR: section \"%s\" does not fit into \"%s\" memory:\n" " 0x%x + %u > %u\n", progname, sname, mem->desc, @@ -1507,7 +1505,7 @@ int fileio(int oprwv, char * filename, FILEFMT format, if (rc < 0) return -1; - if (fio.op == FIO_READ) + if (size < 0 || fio.op == FIO_READ) size = mem->size; if (fio.op == FIO_READ) { From e681035cc45a9cd6341736de7f77d526e6a37915 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 5 Aug 2022 18:47:40 +0100 Subject: [PATCH 178/511] Add strerror_r() and access() modes to MSVC compat file --- src/msvc/msvc_compat.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/msvc/msvc_compat.h b/src/msvc/msvc_compat.h index eb3e026a..2c072b3b 100644 --- a/src/msvc/msvc_compat.h +++ b/src/msvc/msvc_compat.h @@ -28,6 +28,11 @@ #pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "setupapi.lib") +#define strerror_r(errno,buf,len) strerror_s(buf,len,errno) + +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 #define F_OK 0 #define PATH_MAX _MAX_PATH From a8bbedcde399492d9dccd1c15ea5d1c25ab798af Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sat, 6 Aug 2022 00:20:43 +0100 Subject: [PATCH 179/511] Switch from strerror_r() to strerror() in update.c for portability --- src/update.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/update.c b/src/update.c index b0c48c6d..b79f6442 100644 --- a/src/update.c +++ b/src/update.c @@ -368,13 +368,11 @@ int update_is_readable(const char *fn) { static void ioerror(const char *iotype, UPDATE *upd) { avrdude_message(MSG_INFO, "%s: file %s is not %s", progname, update_outname(upd->filename), iotype); - if(errno) { - char buf[1024]; - strerror_r(errno, buf, sizeof buf); - avrdude_message(MSG_INFO, ". %s", buf); - } else if(upd->filename && *upd->filename) + if(errno) + avrdude_message(MSG_INFO, ". %s", strerror(errno)); + else if(upd->filename && *upd->filename) avrdude_message(MSG_INFO, " (not a regular or character file?)"); - avrdude_message(MSG_INFO, "\n"); + avrdude_message(MSG_INFO, "\n"); } // Basic checks to reveal serious failure before programming From 81136688f677473a27ca8aeae875e4282de907e2 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 7 Aug 2022 08:53:24 +0100 Subject: [PATCH 180/511] Establish a third option to print out part definitions Introduced -p /A, which prints what -p /S used to print, ie, all components of the part structures including the default ones. Now -p /S prints the expanded part structure without use of parent and without printing default values. This functionality is new and predominantly needed for checking specific avrdude.conf entries, eg, avrdude -p*/St | grep pollindex The option -p /s continues to print a short entry of `avrdude.conf` using its parent if so defined: $ avrdude -p m328p/s part parent "m328" desc = "ATmega328P"; id = "m328p"; signature = 0x1e 0x95 0x0f; ; --- src/developer_opts.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index b82c1805..f80f5537 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -601,7 +601,7 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { // -p */[cdosw*] void dev_output_part_defs(char *partdesc) { - bool cmdok, waits, opspi, descs, strct, cmpst, raw, all, tsv; + bool cmdok, waits, opspi, descs, astrc, strct, cmpst, raw, all, tsv; char *flags; int nprinted; AVRPART *nullpart = avr_new_part(); @@ -612,7 +612,7 @@ void dev_output_part_defs(char *partdesc) { if(!flags && !strcmp(partdesc, "*")) // treat -p * as if it was -p */* flags = "*"; - if(!*flags || !strchr("cdosSrw*t", *flags)) { + if(!*flags || !strchr("cdoASsrw*t", *flags)) { dev_info("%s: flags for developer option -p / not recognised\n", progname); dev_info( "Wildcard examples (these need protecting in the shell through quoting):\n" @@ -621,14 +621,15 @@ void dev_output_part_defs(char *partdesc) { " *32[0-9] matches ATmega329, ATmega325 and ATmega328\n" " *32? matches ATmega329, ATmega32A, ATmega325 and ATmega328\n" "Flags (one or more of the characters below):\n" - " c check and report errors in address bits of SPI commands\n" " d description of core part features\n" - " o opcodes for SPI programming parts and memories\n" - " S show entries of avrdude.conf parts with all values\n" - " s show entries of avrdude.conf parts with necessary values\n" + " A show entries of avrdude.conf parts with all values\n" + " S show entries of avrdude.conf parts with necessary values\n" + " s show short entries of avrdude.conf parts using parent\n" " r show entries of avrdude.conf parts as raw dump\n" + " c check and report errors in address bits of SPI commands\n" + " o opcodes for SPI programming parts and memories\n" " w wd_... constants for ISP parts\n" - " * all of the above except s\n" + " * all of the above except s and S\n" " t use tab separated values as much as possible\n" "Examples:\n" " $ avrdude -p ATmega328P/s\n" @@ -638,7 +639,7 @@ void dev_output_part_defs(char *partdesc) { " -p * is the same as -p */*\n" " This help message is printed using any unrecognised flag, eg, -p/h\n" " Leaving no space after -p can be an OK substitute for quoting in shells\n" - " /s and /S outputs are designed to be used as input in avrdude.conf\n" + " /s, /S and /A outputs are designed to be used as input in avrdude.conf\n" " Sorted /r output should stay invariant when rearranging avrdude.conf\n" " The /c, /o and /w flags are less generic and may be removed sometime\n" " These options are just to help development, so not further documented\n" @@ -654,8 +655,9 @@ void dev_output_part_defs(char *partdesc) { descs = all || !!strchr(flags, 'd'); opspi = all || !!strchr(flags, 'o'); waits = all || !!strchr(flags, 'w'); - strct = all || !!strchr(flags, 'S'); + astrc = all || !!strchr(flags, 'A'); raw = all || !!strchr(flags, 'r'); + strct = !!strchr(flags, 'S'); cmpst = !!strchr(flags, 's'); tsv = !!strchr(flags, 't'); @@ -687,8 +689,11 @@ void dev_output_part_defs(char *partdesc) { if(!part_match(partdesc, p->desc) && !part_match(partdesc, p->id)) continue; - if(strct || cmpst) - dev_part_strct(p, tsv, !cmpst? NULL: p->parent_id? locate_part(part_list, p->parent_id): nullpart); + if(astrc || strct || cmpst) + dev_part_strct(p, tsv, + astrc? NULL: + strct? nullpart: + p->parent_id? locate_part(part_list, p->parent_id): nullpart); if(raw) dev_part_raw(p); From 08049a40ea661494f8d5465055b216522d5e3d22 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 7 Aug 2022 14:05:54 +0100 Subject: [PATCH 181/511] Implement dev option -c */[ASsrt] skeleton Also changed usbdev, usbsn, usbvendor and usbproduct components from PROGRAMMER structure to be cached string pointers rather than fixed-size arrays. These will be initialised by pgm_new() with a pointer to nul; --- src/avrftdi.c | 2 +- src/avrpart.c | 5 +- src/config.h | 2 - src/config_gram.y | 12 ++--- src/developer_opts.c | 124 +++++++++++++++++++++++++++++++++++++++++-- src/developer_opts.h | 1 + src/ft245r.c | 4 +- src/libavrdude.h | 14 ++--- src/main.c | 8 ++- src/pgm.c | 12 +++-- src/ser_avrdoper.c | 4 +- src/usbasp.c | 8 +-- 12 files changed, 159 insertions(+), 37 deletions(-) diff --git a/src/avrftdi.c b/src/avrftdi.c index f0c07a6a..315f23e8 100644 --- a/src/avrftdi.c +++ b/src/avrftdi.c @@ -651,7 +651,7 @@ static int avrftdi_pin_setup(PROGRAMMER * pgm) static int avrftdi_open(PROGRAMMER * pgm, char *port) { int vid, pid, interface, index, err; - char * serial, *desc; + const char *serial, *desc; avrftdi_t* pdata = to_pdata(pgm); diff --git a/src/avrpart.c b/src/avrpart.c index 4fc6304f..970dfde8 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -672,6 +672,7 @@ void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, AVRPART * avr_new_part(void) { AVRPART * p; + char *nulp = cache_string(""); p = (AVRPART *)malloc(sizeof(AVRPART)); if (p == NULL) { @@ -686,8 +687,8 @@ AVRPART * avr_new_part(void) p->reset_disposition = RESET_DEDICATED; p->retry_pulse = PIN_AVR_SCK; p->flags = AVRPART_SERIALOK | AVRPART_PARALLELOK | AVRPART_ENABLEPAGEPROGRAMMING; - p->parent_id = NULL; - p->config_file = NULL; + p->parent_id = nulp; + p->config_file = nulp; p->lineno = 0; memset(p->signature, 0xFF, 3); p->ctl_stack_type = CTL_STACK_NONE; diff --git a/src/config.h b/src/config.h index a20af733..a7d2563d 100644 --- a/src/config.h +++ b/src/config.h @@ -101,8 +101,6 @@ void pyytext(void); char * dup_string(const char * str); -char * cache_string(const char * file); - #ifdef __cplusplus } #endif diff --git a/src/config_gram.y b/src/config_gram.y index ce11b924..552832ec 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -532,8 +532,7 @@ prog_parm_conntype_id: prog_parm_usb: K_USBDEV TKN_EQUAL TKN_STRING { { - strncpy(current_prog->usbdev, $3->value.string, PGM_USBSTRINGLEN); - current_prog->usbdev[PGM_USBSTRINGLEN-1] = 0; + current_prog->usbdev = cache_string($3->value.string); free_token($3); } } | @@ -546,22 +545,19 @@ prog_parm_usb: K_USBPID TKN_EQUAL usb_pid_list | K_USBSN TKN_EQUAL TKN_STRING { { - strncpy(current_prog->usbsn, $3->value.string, PGM_USBSTRINGLEN); - current_prog->usbsn[PGM_USBSTRINGLEN-1] = 0; + current_prog->usbsn = cache_string($3->value.string); free_token($3); } } | K_USBVENDOR TKN_EQUAL TKN_STRING { { - strncpy(current_prog->usbvendor, $3->value.string, PGM_USBSTRINGLEN); - current_prog->usbvendor[PGM_USBSTRINGLEN-1] = 0; + current_prog->usbvendor = cache_string($3->value.string); free_token($3); } } | K_USBPRODUCT TKN_EQUAL TKN_STRING { { - strncpy(current_prog->usbproduct, $3->value.string, PGM_USBSTRINGLEN); - current_prog->usbproduct[PGM_USBSTRINGLEN-1] = 0; + current_prog->usbproduct = cache_string($3->value.string); free_token($3); } } diff --git a/src/developer_opts.c b/src/developer_opts.c index f80f5537..8aea0bb2 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -436,7 +436,7 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { dev_info("#------------------------------------------------------------\n"); dev_info("# %s\n", p->desc); dev_info("#------------------------------------------------------------\n"); - if(p->parent_id) + if(p->parent_id && *p->parent_id) dev_info("\npart parent \"%s\"\n", p->parent_id); else dev_info("\npart\n"); @@ -597,9 +597,7 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { } - - -// -p */[cdosw*] +// -p */[dASsrcow*t] void dev_output_part_defs(char *partdesc) { bool cmdok, waits, opspi, descs, astrc, strct, cmpst, raw, all, tsv; char *flags; @@ -693,7 +691,7 @@ void dev_output_part_defs(char *partdesc) { dev_part_strct(p, tsv, astrc? NULL: strct? nullpart: - p->parent_id? locate_part(part_list, p->parent_id): nullpart); + p->parent_id && *p->parent_id? locate_part(part_list, p->parent_id): nullpart); if(raw) dev_part_raw(p); @@ -891,3 +889,119 @@ void dev_output_part_defs(char *partdesc) { } } } + + +static void dev_pgm_raw(PROGRAMMER *pgm) { + PROGRAMMER dp; + + memcpy(&dp, pgm, sizeof dp); + dev_raw_dump((unsigned char *) &dp, sizeof dp, pgm->desc, "pgm", 0); +} + + +static void dev_pgm_strct(PROGRAMMER *pgm, bool tsv, PROGRAMMER *base) { + if(!tsv) { + int firstid = 1; + + dev_info("#------------------------------------------------------------\n"); + dev_info("# "); + for(LNODEID ln=lfirst(pgm->id); ln; ln=lnext(ln)) { + if(!firstid) + dev_info("/"); + firstid = 0; + dev_info("%s", ldata(ln)); + } + dev_info("\n"); + dev_info("#------------------------------------------------------------\n"); + if(pgm->parent_id && *pgm->parent_id) + dev_info("\nprogrammer parent \"%s\"\n", pgm->parent_id); + else + dev_info("\nprogrammer\n"); + } + + if(!tsv) + dev_info(";\n"); +} + + +// -c */[ASsrt] +void dev_output_pgm_defs(char *pgmid) { + bool astrc, strct, cmpst, raw, tsv; + char *flags; + int nprinted; + PROGRAMMER *nullpgm = pgm_new(); + + if((flags = strchr(pgmid, '/'))) + *flags++ = 0; + + if(!flags && !strcmp(pgmid, "*")) // treat -c * as if it was -c */A + flags = "A"; + + if(!*flags || !strchr("ASsrt", *flags)) { + dev_info("%s: flags for developer option -c / not recognised\n", progname); + dev_info( + "Wildcard examples (these need protecting in the shell through quoting):\n" + " * all known programmers\n" + " avrftdi just this programmer\n" + " jtag*pdi matches jtag2pdi, jtag3pdi, jtag3updi and jtag2updi\n" + " jtag?pdi matches jtag2pdi and jtag3pdi\n" + "Flags (one or more of the characters below):\n" + " A show entries of avrdude.conf programmers with all values\n" + " S show entries of avrdude.conf programmers with necessary values\n" + " s show short entries of avrdude.conf programmers using parent\n" + " r show entries of avrdude.conf programmers as raw dump\n" + " t use tab separated values as much as possible\n" + "Examples:\n" + " $ avrdude -c usbasp/s\n" + " $ avrdude -c */st | grep baudrate\n" + " $ avrdude -c */r | sort\n" + "Notes:\n" + " -c * is the same as -c */A\n" + " This help message is printed using any unrecognised flag, eg, -c/h\n" + " Leaving no space after -c can be an OK substitute for quoting in shells\n" + " /s, /S and /A outputs are designed to be used as input in avrdude.conf\n" + " Sorted /r output should stay invariant when rearranging avrdude.conf\n" + " These options are just to help development, so not further documented\n" + ); + return; + } + + // redirect stderr to stdout + fflush(stderr); fflush(stdout); dup2(1, 2); + + astrc = !!strchr(flags, 'A'); + strct = !!strchr(flags, 'S'); + cmpst = !!strchr(flags, 's'); + raw = !!strchr(flags, 'r'); + tsv = !!strchr(flags, 't'); + + nprinted = dev_nprinted; + + LNODEID ln1, ln2; + for(ln1=lfirst(programmers); ln1; ln1=lnext(ln1)) { + PROGRAMMER *pgm = ldata(ln1); + int matched = 0; + for(ln2=lfirst(pgm->id); ln2; ln2=lnext(ln2)) { + if(part_match(pgmid, ldata(ln2))) { + matched = 1; + break; + } + } + if(!matched) + continue; + + if(dev_nprinted > nprinted) { + dev_info("\n"); + nprinted = dev_nprinted; + } + + if(astrc || strct || cmpst) + dev_pgm_strct(pgm, tsv, + astrc? NULL: + strct? nullpgm: + pgm->parent_id && *pgm->parent_id? locate_programmer(programmers, pgm->parent_id): nullpgm); + + if(raw) + dev_pgm_raw(pgm); + } +} diff --git a/src/developer_opts.h b/src/developer_opts.h index 6c4b3b71..2079c109 100644 --- a/src/developer_opts.h +++ b/src/developer_opts.h @@ -20,5 +20,6 @@ #define developer_opts_h void dev_output_part_defs(char *partdesc); +void dev_output_pgm_defs(char *programmer); #endif diff --git a/src/ft245r.c b/src/ft245r.c index 874167ac..04790143 100644 --- a/src/ft245r.c +++ b/src/ft245r.c @@ -851,7 +851,7 @@ static int ft245r_open(PROGRAMMER * pgm, char * port) { avrdude_message(MSG_NOTICE, "%s: ft245r_open(): no device identifier in portname, using default\n", progname); - pgm->usbsn[0] = 0; + pgm->usbsn = cache_string(""); devnum = 0; } else { if (strlen(device) == 8 ){ // serial number @@ -863,7 +863,7 @@ static int ft245r_open(PROGRAMMER * pgm, char * port) { device); } // copy serial number to pgm struct - strcpy(pgm->usbsn, device); + pgm->usbsn = cache_string(device); // and use first device with matching serial (should be unique) devnum = 0; } diff --git a/src/libavrdude.h b/src/libavrdude.h index 23905953..7dcab3c2 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -217,7 +217,7 @@ typedef struct opcode { typedef struct avrpart { char desc[AVR_DESCLEN]; /* long part name */ char id[AVR_IDLEN]; /* short part name */ - char * parent_id; /* parent id if set, for -p.../s */ + const char * parent_id; /* parent id if set, for -p.../s */ char family_id[AVR_FAMILYIDLEN+1]; /* family id in the SIB (avr8x) */ int hvupdi_variant; /* HV pulse on UPDI pin, no pin or RESET pin */ int stk500_devcode; /* stk500 device code */ @@ -280,7 +280,7 @@ typedef struct avrpart { LISTID mem; /* avr memory definitions */ LISTID mem_alias; /* memory alias definitions */ - char *config_file; /* config file where defined */ + const char * config_file; /* config file where defined */ int lineno; /* config file line number */ } AVRPART; @@ -640,7 +640,6 @@ extern struct serial_device usbhid_serdev; #define PGM_DESCLEN 80 #define PGM_PORTLEN PATH_MAX #define PGM_TYPELEN 32 -#define PGM_USBSTRINGLEN 256 typedef enum { EXIT_VCC_UNSPEC, @@ -672,7 +671,7 @@ typedef struct programmer_t { char desc[PGM_DESCLEN]; char type[PGM_TYPELEN]; char port[PGM_PORTLEN]; - char *parent_id; + const char *parent_id; void (*initpgm)(struct programmer_t * pgm); unsigned int pinno[N_PINS]; struct pindef_t pin[N_PINS]; @@ -685,8 +684,7 @@ typedef struct programmer_t { int baudrate; int usbvid; LISTID usbpid; - char usbdev[PGM_USBSTRINGLEN], usbsn[PGM_USBSTRINGLEN]; - char usbvendor[PGM_USBSTRINGLEN], usbproduct[PGM_USBSTRINGLEN]; + const char *usbdev, *usbsn, *usbvendor, *usbproduct; double bitclock; /* JTAG ICE clock period in microseconds */ int ispdelay; /* ISP clock delay */ union filedescriptor fd; @@ -740,7 +738,7 @@ typedef struct programmer_t { int (*parseextparams) (struct programmer_t * pgm, LISTID xparams); void (*setup) (struct programmer_t * pgm); void (*teardown) (struct programmer_t * pgm); - char *config_file; /* config file where defined */ + const char *config_file; /* config file where defined */ int lineno; /* config file line number */ void *cookie; /* for private use by the programmer */ char flag; /* for private use of the programmer */ @@ -989,6 +987,8 @@ void cleanup_config(void); int read_config(const char * file); +char *cache_string(const char *file); + #ifdef __cplusplus } #endif diff --git a/src/main.c b/src/main.c index 9f72847f..83bde3e9 100644 --- a/src/main.c +++ b/src/main.c @@ -754,7 +754,7 @@ int main(int argc, char * argv []) avrdude_message(MSG_NOTICE, "\n"); - // developer option -p /[*codws] prints various aspects of part descriptions and exits + // Developer option -p /[dASsrcow*t] prints part description(s) and exits if(partdesc && (strcmp(partdesc, "*") == 0 || strchr(partdesc, '/'))) { dev_output_part_defs(partdesc); exit(1); @@ -770,6 +770,12 @@ int main(int argc, char * argv []) } } + // Developer option -c /[ASsrt] prints programmer description(s) and exits + if(programmer && (strcmp(programmer, "*") == 0 || strchr(programmer, '/'))) { + dev_output_pgm_defs(programmer); + exit(1); + } + if (programmer) { if (strcmp(programmer, "?") == 0) { avrdude_message(MSG_INFO, "\n"); diff --git a/src/pgm.c b/src/pgm.c index dd38552f..a4e0ed54 100644 --- a/src/pgm.c +++ b/src/pgm.c @@ -65,6 +65,7 @@ PROGRAMMER * pgm_new(void) { int i; PROGRAMMER * pgm; + char *nulp = cache_string(""); pgm = (PROGRAMMER *)malloc(sizeof(*pgm)); if (pgm == NULL) { @@ -79,13 +80,18 @@ PROGRAMMER * pgm_new(void) pgm->usbpid = lcreat(NULL, 0); pgm->desc[0] = 0; pgm->type[0] = 0; - pgm->parent_id = NULL; - pgm->config_file = NULL; + pgm->parent_id = nulp; + pgm->config_file = nulp; pgm->lineno = 0; pgm->baudrate = 0; pgm->initpgm = NULL; pgm->hvupdi_support = lcreat(NULL, 0); + pgm->usbdev = nulp; + pgm->usbsn = nulp; + pgm->usbvendor = nulp; + pgm->usbproduct = nulp; + for (i=0; ipinno[i] = 0; pin_clear_all(&(pgm->pin[i])); @@ -146,7 +152,7 @@ void pgm_free(PROGRAMMER * const p) ldestroy_cb(p->usbpid, free); p->id = NULL; p->usbpid = NULL; - /* do not free p->parent_id nor p->config_file */ + /* do not free p->parent_id, p->config_file, p->usbdev, p->usbsn, p->usbvendor or p-> usbproduct */ /* p->cookie is freed by pgm_teardown */ free(p); } diff --git a/src/ser_avrdoper.c b/src/ser_avrdoper.c index a8414403..e459f921 100644 --- a/src/ser_avrdoper.c +++ b/src/ser_avrdoper.c @@ -65,8 +65,8 @@ static int avrdoperRxPosition = 0; /* amount of bytes already consu /* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */ -static int usbOpenDevice(union filedescriptor *fdp, int vendor, char *vendorName, - int product, char *productName, int doReportIDs) +static int usbOpenDevice(union filedescriptor *fdp, int vendor, const char *vendorName, + int product, const char *productName, int doReportIDs) { hid_device *dev; diff --git a/src/usbasp.c b/src/usbasp.c index 250c8a22..2b4c4831 100644 --- a/src/usbasp.c +++ b/src/usbasp.c @@ -160,9 +160,9 @@ static int usbasp_transmit(PROGRAMMER * pgm, unsigned char receive, unsigned char functionid, const unsigned char *send, unsigned char *buffer, int buffersize); #ifdef USE_LIBUSB_1_0 -static int usbOpenDevice(libusb_device_handle **device, int vendor, char *vendorName, int product, char *productName); +static int usbOpenDevice(libusb_device_handle **device, int vendor, const char *vendorName, int product, const char *productName); #else -static int usbOpenDevice(usb_dev_handle **device, int vendor, char *vendorName, int product, char *productName); +static int usbOpenDevice(usb_dev_handle **device, int vendor, const char *vendorName, int product, const char *productName); #endif // interface - prog. static int usbasp_open(PROGRAMMER * pgm, char * port); @@ -337,7 +337,7 @@ static int usbasp_transmit(PROGRAMMER * pgm, */ #ifdef USE_LIBUSB_1_0 static int usbOpenDevice(libusb_device_handle **device, int vendor, - char *vendorName, int product, char *productName) + const char *vendorName, int product, const char *productName) { libusb_device_handle *handle = NULL; int errorCode = USB_ERROR_NOTFOUND; @@ -412,7 +412,7 @@ static int usbOpenDevice(libusb_device_handle **device, int vendor, } #else static int usbOpenDevice(usb_dev_handle **device, int vendor, - char *vendorName, int product, char *productName) + const char *vendorName, int product, const char *productName) { struct usb_bus *bus; struct usb_device *dev; From 075dee1dd33da28be5472fad6d478421e970d1ca Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 7 Aug 2022 17:52:17 +0100 Subject: [PATCH 182/511] Implement -c */r (raw dump of programmer structure) --- src/developer_opts.c | 134 ++++++++++++++++++++++++++++--------------- src/libavrdude.h | 22 ++++--- 2 files changed, 101 insertions(+), 55 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index 8aea0bb2..8d8c183c 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -51,7 +52,7 @@ #include "developer_opts.h" #include "developer_opts_private.h" -// return 0 if op code would encode (essentially) the same SPI command +// Return 0 if op code would encode (essentially) the same SPI command static int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum) { char *opstr1, *opstr2, *p; int cmp; @@ -68,7 +69,7 @@ static int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum) { exit(1); } - // don't care x and 0 are functionally equivalent + // Don't care x and 0 are functionally equivalent for(p=opstr1; *p; p++) if(*p == 'x') *p = '0'; @@ -108,7 +109,7 @@ static void printallopcodes(AVRPART *p, const char *d, OPCODE **opa) { -// mnemonic characterisation of flags +// Mnemonic characterisation of flags static char *parttype(AVRPART *p) { static char type[1024]; @@ -144,7 +145,7 @@ static char *parttype(AVRPART *p) { } -// check whether address bits are where they should be in ISP commands +// Check whether address bits are where they should be in ISP commands static void checkaddr(int memsize, int pagesize, int opnum, OPCODE *op, AVRPART *p, AVRMEM *m) { int i, lo, hi; const char *opstr = opcodename(opnum); @@ -152,7 +153,7 @@ static void checkaddr(int memsize, int pagesize, int opnum, OPCODE *op, AVRPART lo = intlog2(pagesize); hi = intlog2(memsize-1); - // address bits should be between positions lo and hi (and fall in line), outside should be 0 or don't care + // Address bits should be between positions lo and hi (and fall in line), outside should be 0 or don't care for(i=0; i<16; i++) { // ISP programming only deals with 16-bit addresses (words for flash, bytes for eeprom) if(i < lo || i > hi) { if(op->bit[i+8].type != AVR_CMDBIT_IGNORE && !(op->bit[i+8].type == AVR_CMDBIT_VALUE && op->bit[i+8].value == 0)) { @@ -168,7 +169,7 @@ static void checkaddr(int memsize, int pagesize, int opnum, OPCODE *op, AVRPART dev_info(".cmderr\t%s\t%s-%s\tbit %d inconsistent: a%d specified as a%d\n", p->desc, m->desc, opstr, i+8, i, op->bit[i+8].bitno); } } - for(i=0; i<32; i++) // command bits 8..23 should not contain address bits + for(i=0; i<32; i++) // Command bits 8..23 should not contain address bits if((i<8 || i>23) && op->bit[i].type == AVR_CMDBIT_ADDRESS) dev_info(".cmderr\t%s\t%s-%s\tbit %d contains a%d which it shouldn't\n", p->desc, m->desc, opstr, i, op->bit[i].bitno); } @@ -180,7 +181,7 @@ static char *dev_sprintf(const char *fmt, ...) { char *p = NULL; va_list ap; - // compute size + // Compute size va_start(ap, fmt); size = vsnprintf(p, size, fmt, ap); va_end(ap); @@ -188,7 +189,7 @@ static char *dev_sprintf(const char *fmt, ...) { if(size < 0) return NULL; - size++; // for temrinating '\0' + size++; // For temrinating '\0' if(!(p = malloc(size))) return NULL; @@ -228,7 +229,7 @@ static int dev_part_strct_entry(bool tsv, char *col0, char *col1, char *col2, co const char *n = name? name: "name_error"; const char *c = cont? cont: "cont_error"; - if(tsv) { // tab separated values + if(tsv) { // Tab separated values if(col0) { dev_info("%s\t", col0); if(col1) { @@ -239,7 +240,7 @@ static int dev_part_strct_entry(bool tsv, char *col0, char *col1, char *col2, co } } dev_info("%s\t%s\n", n, c); - } else { // grammar conform + } else { // Grammar conform int indent = col2 && strcmp(col2, "part"); printf("%*s%-*s = %s;\n", indent? 8: 4, "", indent? 15: 19, n, c); @@ -285,7 +286,7 @@ static int intcmp(int a, int b) { } -// deep copies for comparison and raw output +// Deep copies for comparison and raw output typedef struct { AVRMEM base; @@ -297,19 +298,19 @@ static int avrmem_deep_copy(AVRMEMdeep *d, AVRMEM *m) { d->base = *m; - // zap all bytes beyond terminating nul of desc array + // Zap all bytes beyond terminating nul of desc array len = strlen(m->desc)+1; if(len < sizeof m->desc) memset(d->base.desc + len, 0, sizeof m->desc - len); - // zap address values + // Zap address values d->base.buf = NULL; d->base.tags = NULL; for(int i=0; ibase.op[i] = NULL; - // copy over the SPI operations themselves + // Copy over the SPI operations themselves memset(d->base.op, 0, sizeof d->base.op); memset(d->ops, 0, sizeof d->ops); for(size_t i=0; iops/sizeof *d->ops; i++) @@ -353,7 +354,7 @@ static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { d->base.config_file = NULL; d->base.lineno = 0; - // zap all bytes beyond terminating nul of desc, id and family_id array + // Zap all bytes beyond terminating nul of desc, id and family_id array len = strlen(p->desc); if(len < sizeof p->desc) memset(d->base.desc + len, 0, sizeof p->desc - len); @@ -366,20 +367,20 @@ static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { if(len < sizeof p->id) memset(d->base.id + len, 0, sizeof p->id - len); - // zap address values + // Zap address values d->base.mem = NULL; d->base.mem_alias = NULL; for(int i=0; ibase.op[i] = NULL; - // copy over the SPI operations + // Copy over the SPI operations memset(d->base.op, 0, sizeof d->base.op); memset(d->ops, 0, sizeof d->ops); for(int i=0; iop[i]) d->ops[i] = *p->op[i]; - // fill in all memories we got in defined order + // Fill in all memories we got in defined order di = 0; for(size_t mi=0; mi < sizeof avr_mem_order/sizeof *avr_mem_order && avr_mem_order[mi]; mi++) { m = p->mem? avr_locate_mem(p, avr_mem_order[mi]): NULL; @@ -396,23 +397,28 @@ static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { return di; } + static char txtchar(unsigned char in) { in &= 0x7f; return in == ' '? '_': in > ' ' && in < 0x7f? in: '.'; } +static void dev_raw_dump(const char *p, int nbytes, const char *name, const char *sub, int idx) { + int n = (nbytes + 31)/32; -static void dev_raw_dump(unsigned char *p, int nbytes, const char *name, const char *sub, int idx) { - unsigned char *end = p+nbytes; - int n = ((end - p) + 15)/16; - - for(int i=0; idesc, "part", 0); - dev_raw_dump((unsigned char *) &dp.ops, sizeof dp.ops, part->desc, "ops", 1); + dev_raw_dump((char *) &dp.base, sizeof dp.base, part->desc, "part", 0); + dev_raw_dump((char *) &dp.ops, sizeof dp.ops, part->desc, "ops", 1); for(int i=0; idesc, dp.mems[i].base.desc, i+2); + dev_raw_dump((char *) (dp.mems+i), sizeof dp.mems[i], part->desc, dp.mems[i].base.desc, i+2); } @@ -527,7 +533,7 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { _if_partout(intcmp, "0x%02x", idr); _if_partout(intcmp, "0x%02x", rampz); _if_partout(intcmp, "0x%02x", spmcr); - _if_partout(intcmp, "0x%02x", eecr); // why is eecr an unsigned short? + _if_partout(intcmp, "0x%02x", eecr); // Why is eecr an unsigned short? _if_partout(intcmp, "0x%04x", mcu_base); _if_partout(intcmp, "0x%04x", nvm_base); _if_partout(intcmp, "0x%04x", ocd_base); @@ -553,7 +559,7 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { bm = avr_new_memtype(); if(!tsv) { - if(!memorycmp(bm, m)) // same memory bit for bit, no need to instantiate + if(!memorycmp(bm, m)) // Same memory bit for bit, no need to instantiate continue; dev_info("\n memory \"%s\"\n", m->desc); @@ -562,7 +568,7 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { _if_memout_yn(paged); _if_memout(intcmp, m->size > 8192? "0x%x": "%d", size); _if_memout(intcmp, "%d", page_size); - _if_memout(intcmp, "%d", num_pages); // why can AVRDUDE not compute this? + _if_memout(intcmp, "%d", num_pages); _if_memout(intcmp, "0x%x", offset); _if_memout(intcmp, "%d", min_write_delay); _if_memout(intcmp, "%d", max_write_delay); @@ -607,7 +613,7 @@ void dev_output_part_defs(char *partdesc) { if((flags = strchr(partdesc, '/'))) *flags++ = 0; - if(!flags && !strcmp(partdesc, "*")) // treat -p * as if it was -p */* + if(!flags && !strcmp(partdesc, "*")) // Treat -p * as if it was -p */* flags = "*"; if(!*flags || !strchr("cdoASsrw*t", *flags)) { @@ -645,7 +651,7 @@ void dev_output_part_defs(char *partdesc) { return; } - // redirect stderr to stdout + // Redirect stderr to stdout fflush(stderr); fflush(stdout); dup2(1, 2); all = *flags == '*'; @@ -660,14 +666,14 @@ void dev_output_part_defs(char *partdesc) { tsv = !!strchr(flags, 't'); - // go through all memories and add them to the memory order list + // Go through all memories and add them to the memory order list for(LNODEID ln1 = lfirst(part_list); ln1; ln1 = lnext(ln1)) { AVRPART *p = ldata(ln1); if(p->mem) for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) avr_add_mem_order(((AVRMEM *) ldata(lnm))->desc); - // same for aliased memories (though probably not needed) + // Same for aliased memories (though probably not needed) if(p->mem_alias) for(LNODEID lnm=lfirst(p->mem_alias); lnm; lnm=lnext(lnm)) avr_add_mem_order(((AVRMEM_ALIAS *) ldata(lnm))->desc); @@ -696,7 +702,7 @@ void dev_output_part_defs(char *partdesc) { if(raw) dev_part_raw(p); - // identify core flash and eeprom parameters + // Identify core flash and eeprom parameters flashsize = flashoffset = flashpagesize = eepromsize = eepromoffset = eeprompagesize = 0; if(p->mem) { @@ -715,7 +721,7 @@ void dev_output_part_defs(char *partdesc) { } } - // "real" entries don't seem to have a space in their desc (a bit hackey) + // "Real" entries don't seem to have a space in their desc (a bit hackey) if(flashsize && !strchr(p->desc, ' ')) { int ok, nfuses; AVRMEM *m; @@ -819,7 +825,7 @@ void dev_output_part_defs(char *partdesc) { } else ok &= ~DEV_SPI_CALIBRATION; - // actually, some AT90S... parts cannot read, only write lock bits :-0 + // Actually, some AT90S... parts cannot read, only write lock bits :-0 if( ! ((m = avr_locate_mem(p, "lock")) && m->op[AVR_OP_WRITE])) ok &= ~DEV_SPI_LOCK; @@ -866,14 +872,14 @@ void dev_output_part_defs(char *partdesc) { } } - // print wait delays for AVR family parts + // Print wait delays for AVR family parts if(waits) { if(!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI | AVRPART_HAS_TPI | AVRPART_AVR32))) dev_info(".wd_chip_erase %.3f ms %s\n", p->chip_erase_delay/1000.0, p->desc); if(p->mem) { for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { AVRMEM *m = ldata(lnm); - // write delays not needed for read-only calibration and signature memories + // Write delays not needed for read-only calibration and signature memories if(strcmp(m->desc, "calibration") && strcmp(m->desc, "signature")) { if(!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI | AVRPART_HAS_TPI | AVRPART_AVR32))) { if(m->min_write_delay == m->max_write_delay) @@ -893,9 +899,45 @@ void dev_output_part_defs(char *partdesc) { static void dev_pgm_raw(PROGRAMMER *pgm) { PROGRAMMER dp; + int len, idx; + char *id = ldata(lfirst(pgm->id)); + LNODEID ln; memcpy(&dp, pgm, sizeof dp); - dev_raw_dump((unsigned char *) &dp, sizeof dp, pgm->desc, "pgm", 0); + + // Dump id, usbpid and hvupdi_support lists + for(idx=0, ln=lfirst(dp.id); ln; ln=lnext(ln)) + dev_raw_dump(ldata(ln), strlen(ldata(ln))+1, id, "id", idx++); + for(idx=0, ln=lfirst(dp.usbpid); ln; ln=lnext(ln)) + dev_raw_dump(ldata(ln), sizeof(int), id, "usbpid", idx++); + for(idx=0, ln=lfirst(dp.hvupdi_support); ln; ln=lnext(ln)) + dev_raw_dump(ldata(ln), sizeof(int), id, "hvupdi_", idx++); + + // Dump cache_string values + if(dp.usbdev && *dp.usbdev) + dev_raw_dump(dp.usbdev, strlen(dp.usbdev)+1, id, "usbdev", 0); + if(dp.usbsn && *dp.usbsn) + dev_raw_dump(dp.usbsn, strlen(dp.usbsn)+1, id, "usbsn", 0); + if(dp.usbvendor && *dp.usbvendor) + dev_raw_dump(dp.usbvendor, strlen(dp.usbvendor)+1, id, "usbvend", 0); + if(dp.usbproduct && *dp.usbproduct) + dev_raw_dump(dp.usbproduct, strlen(dp.usbproduct)+1, id, "usbprod", 0); + + // Zap all bytes beyond terminating nul of desc, type and port array + if((len = strlen(dp.desc)+1) < sizeof dp.desc) + memset(dp.desc + len, 0, sizeof dp.desc - len); + if((len = strlen(dp.type)+1) < sizeof dp.type) + memset(dp.type + len, 0, sizeof dp.type - len); + if((len = strlen(dp.port)+1) < sizeof dp.port) + memset(dp.port + len, 0, sizeof dp.port - len); + + // Zap address values + dp.id = NULL; + dp.parent_id = NULL; + dp.initpgm = NULL; + + // Only dump contents of PROGRAMMER struct up to and excluding the fd component + dev_raw_dump((char *) &dp, offsetof(PROGRAMMER, fd), id, "pgm", 0); } @@ -934,7 +976,7 @@ void dev_output_pgm_defs(char *pgmid) { if((flags = strchr(pgmid, '/'))) *flags++ = 0; - if(!flags && !strcmp(pgmid, "*")) // treat -c * as if it was -c */A + if(!flags && !strcmp(pgmid, "*")) // Treat -c * as if it was -c */A flags = "A"; if(!*flags || !strchr("ASsrt", *flags)) { @@ -966,7 +1008,7 @@ void dev_output_pgm_defs(char *pgmid) { return; } - // redirect stderr to stdout + // Redirect stderr to stdout fflush(stderr); fflush(stdout); dup2(1, 2); astrc = !!strchr(flags, 'A'); diff --git a/src/libavrdude.h b/src/libavrdude.h index 7dcab3c2..2dc4bcc5 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -666,13 +666,13 @@ typedef enum { CONNTYPE_SPI } conntype_t; +/* Any changes here, please also reflect in dev_pgm_strct() of developer_opts.c */ typedef struct programmer_t { LISTID id; char desc[PGM_DESCLEN]; char type[PGM_TYPELEN]; char port[PGM_PORTLEN]; const char *parent_id; - void (*initpgm)(struct programmer_t * pgm); unsigned int pinno[N_PINS]; struct pindef_t pin[N_PINS]; exit_vcc_t exit_vcc; @@ -684,11 +684,16 @@ typedef struct programmer_t { int baudrate; int usbvid; LISTID usbpid; + LISTID hvupdi_support; // List of UPDI HV variants the tool supports, see HV_UPDI_VARIANT_x const char *usbdev, *usbsn, *usbvendor, *usbproduct; - double bitclock; /* JTAG ICE clock period in microseconds */ - int ispdelay; /* ISP clock delay */ + double bitclock; // JTAG ICE clock period in microseconds + int ispdelay; // ISP clock delay + int page_size; // Page size if the programmer supports paged write/load + + // Values below are not set by config_gram.y; first one must be fd for dev_pgm_raw() union filedescriptor fd; - int page_size; /* page size if the programmer supports paged write/load */ + void (*initpgm)(struct programmer_t * pgm); + int (*rdy_led) (struct programmer_t * pgm, int value); int (*err_led) (struct programmer_t * pgm, int value); int (*pgm_led) (struct programmer_t * pgm, int value); @@ -738,11 +743,10 @@ typedef struct programmer_t { int (*parseextparams) (struct programmer_t * pgm, LISTID xparams); void (*setup) (struct programmer_t * pgm); void (*teardown) (struct programmer_t * pgm); - const char *config_file; /* config file where defined */ - int lineno; /* config file line number */ - void *cookie; /* for private use by the programmer */ - char flag; /* for private use of the programmer */ - LISTID hvupdi_support; /* List of UPDI HV variants the tool supports. See HV_UPDI_VARIANT_ */ + const char *config_file; // Config file where defined + int lineno; // Config file line number + void *cookie; // For private use by the programmer + char flag; // For private use of the programmer } PROGRAMMER; #ifdef __cplusplus From 49fcd8a96e29db8ef7ed3a91197d4d18f8079f5b Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 8 Aug 2022 16:52:09 +0100 Subject: [PATCH 183/511] Implement -c */[sSA] (syntax-correct dump of programmer structure) --- src/avrpart.c | 2 +- src/config.c | 7 ++- src/config.h | 2 + src/config_gram.y | 3 +- src/developer_opts.c | 93 +++++++++++++++++++++++++++--- src/developer_opts_private.h | 16 ++++++ src/lexer.l | 15 +++-- src/libavrdude.h | 63 +++++++++++++------- src/main.c | 20 ++++--- src/pgm.c | 2 +- src/pgm_type.c | 108 +++++++++++++++++++---------------- src/pindefs.c | 45 ++++++++++++++- 12 files changed, 281 insertions(+), 95 deletions(-) diff --git a/src/avrpart.c b/src/avrpart.c index 970dfde8..c4a2bd8b 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -672,7 +672,7 @@ void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, AVRPART * avr_new_part(void) { AVRPART * p; - char *nulp = cache_string(""); + const char *nulp = cache_string(""); p = (AVRPART *)malloc(sizeof(AVRPART)); if (p == NULL) { diff --git a/src/config.c b/src/config.c index 4308407e..34745daf 100644 --- a/src/config.c +++ b/src/config.c @@ -366,7 +366,7 @@ int read_config(const char * file) // Linear-search cache for a few often-referenced strings -char *cache_string(const char *file) { +const char *cache_string(const char *file) { static char **fnames; static int n=0; @@ -394,3 +394,8 @@ char *cache_string(const char *file) { return fnames[n++]; } + +// Captures comments during parsing +int capture_comment_char(int c) { + return c; +} diff --git a/src/config.h b/src/config.h index a7d2563d..1ebd2f70 100644 --- a/src/config.h +++ b/src/config.h @@ -101,6 +101,8 @@ void pyytext(void); char * dup_string(const char * str); +int capture_comment_char(int c); + #ifdef __cplusplus } #endif diff --git a/src/config_gram.y b/src/config_gram.y index 552832ec..c3554dcc 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -1397,7 +1397,8 @@ yesno : mem_specs : mem_spec TKN_SEMI | mem_alias TKN_SEMI | - mem_specs mem_spec TKN_SEMI + mem_specs mem_spec TKN_SEMI | + /* empty */ ; diff --git a/src/developer_opts.c b/src/developer_opts.c index 8d8c183c..bd59e940 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -613,8 +613,8 @@ void dev_output_part_defs(char *partdesc) { if((flags = strchr(partdesc, '/'))) *flags++ = 0; - if(!flags && !strcmp(partdesc, "*")) // Treat -p * as if it was -p */* - flags = "*"; + if(!flags && !strcmp(partdesc, "*")) // Treat -p * as if it was -p */s + flags = "s"; if(!*flags || !strchr("cdoASsrw*t", *flags)) { dev_info("%s: flags for developer option -p / not recognised\n", progname); @@ -640,7 +640,7 @@ void dev_output_part_defs(char *partdesc) { " $ avrdude -p m328*/st | grep chip_erase_delay\n" " avrdude -p*/r | sort\n" "Notes:\n" - " -p * is the same as -p */*\n" + " -p * is the same as -p */s\n" " This help message is printed using any unrecognised flag, eg, -p/h\n" " Leaving no space after -p can be an OK substitute for quoting in shells\n" " /s, /S and /A outputs are designed to be used as input in avrdude.conf\n" @@ -935,19 +935,37 @@ static void dev_pgm_raw(PROGRAMMER *pgm) { dp.id = NULL; dp.parent_id = NULL; dp.initpgm = NULL; + dp.usbpid = NULL; + dp.usbdev = NULL; + dp.usbsn = NULL; + dp.usbvendor = NULL; + dp.usbproduct = NULL; + dp.hvupdi_support = NULL; // Only dump contents of PROGRAMMER struct up to and excluding the fd component dev_raw_dump((char *) &dp, offsetof(PROGRAMMER, fd), id, "pgm", 0); } -static void dev_pgm_strct(PROGRAMMER *pgm, bool tsv, PROGRAMMER *base) { - if(!tsv) { - int firstid = 1; +static const char *connstr(conntype_t conntype) { + switch(conntype) { + case CONNTYPE_PARALLEL: return "parallel"; + case CONNTYPE_SERIAL: return "serial"; + case CONNTYPE_USB: return "usb"; + case CONNTYPE_SPI: return "spi"; + default: return ""; + } +} +static void dev_pgm_strct(PROGRAMMER *pgm, bool tsv, PROGRAMMER *base) { + char *id = ldata(lfirst(pgm->id)); + LNODEID ln; + int firstid; + + if(!tsv) { dev_info("#------------------------------------------------------------\n"); dev_info("# "); - for(LNODEID ln=lfirst(pgm->id); ln; ln=lnext(ln)) { + for(firstid=1, ln=lfirst(pgm->id); ln; ln=lnext(ln)) { if(!firstid) dev_info("/"); firstid = 0; @@ -961,6 +979,67 @@ static void dev_pgm_strct(PROGRAMMER *pgm, bool tsv, PROGRAMMER *base) { dev_info("\nprogrammer\n"); } + if(tsv) + dev_info(".prog\t%s\tid\t", id); + else + dev_info(" %-19s = ", "id"); + for(firstid=1, ln=lfirst(pgm->id); ln; ln=lnext(ln)) { + if(!firstid) + dev_info(", "); + firstid = 0; + dev_info("\"%s\"", ldata(ln)); + } + dev_info(tsv? "\n": ";\n"); + + _if_pgmout(strcmp, "\"%s\"", desc); + _pgmout_fmt("type", "\"%s\"", locate_programmer_type_id(pgm->initpgm)); + _pgmout_fmt("connection_type", "%s", connstr(pgm->conntype)); + _if_pgmout(intcmp, "%d", baudrate); + + _if_pgmout(intcmp, "0x%04x", usbvid); + + if(pgm->usbpid && lfirst(pgm->usbpid)) { + if(tsv) + dev_info(".prog\t%s\tusbpid\t", id); + else + dev_info(" %-19s = ", "usbpid"); + for(firstid=1, ln=lfirst(pgm->usbpid); ln; ln=lnext(ln)) { + if(!firstid) + dev_info(", "); + firstid = 0; + dev_info("0x%04x", *(unsigned int *) ldata(ln)); + } + dev_info(tsv? "\n": ";\n"); + } + + _if_pgmout(strcmp, "\"%s\"", usbdev); + _if_pgmout(strcmp, "\"%s\"", usbsn); + _if_pgmout(strcmp, "\"%s\"", usbvendor); + _if_pgmout(strcmp, "\"%s\"", usbproduct); + + for(int i=0; ipin+i); + if(str && *str) + _pgmout_fmt(avr_pin_lcname(i), "%s", str); + if(str) + free(str); + } + + if(pgm->hvupdi_support && lfirst(pgm->hvupdi_support)) { + if(tsv) + dev_info(".prog\t%s\thvupdu_support\t", id); + else + dev_info(" %-19s = ", "hvupdi_support"); + for(firstid=1, ln=lfirst(pgm->hvupdi_support); ln; ln=lnext(ln)) { + if(!firstid) + dev_info(", "); + firstid = 0; + dev_info("%d", *(unsigned int *) ldata(ln)); + } + dev_info(tsv? "\n": ";\n"); + } + + if(!tsv) dev_info(";\n"); } diff --git a/src/developer_opts_private.h b/src/developer_opts_private.h index 5a208199..e6be1ee9 100644 --- a/src/developer_opts_private.h +++ b/src/developer_opts_private.h @@ -51,6 +51,22 @@ static int dev_message(int msglvl, const char *fmt, ...); #define dev_notice(...) dev_message(DEV_NOTICE, __VA_ARGS__) #define dev_notice2(...) dev_message(DEV_NOTICE2, __VA_ARGS__) +#define _pgmout(fmt, component) \ + dev_part_strct_entry(tsv, ".prog", id, NULL, #component, dev_sprintf(fmt, pgm->component)) + +#define _pgmout_fmt(name, fmt, what) \ + dev_part_strct_entry(tsv, ".prog", id, NULL, name, dev_sprintf(fmt, what)) + +#define _if_pgmout(cmp, fmt, component) do { \ + if(!base || cmp(base->component, pgm->component)) \ + dev_part_strct_entry(tsv, ".prog", id, NULL, #component, dev_sprintf(fmt, pgm->component)); \ +} while(0) + +#define _if_pgmout_str(cmp, result, component) do { \ + if(!base || cmp(base->component, pgm->component)) \ + dev_part_strct_entry(tsv, ".prog", id, NULL, #component, result); \ +} while(0) + #define _partout(fmt, component) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)) diff --git a/src/lexer.l b/src/lexer.l index 91d02597..c55d7853 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -67,13 +67,20 @@ SIGN [+-] -# { /* The following eats '#' style comments to end of line */ +# { /* The following captures all '#' style comments to end of line */ BEGIN(comment); } -[^\n] { /* eat comments */ } -\n { cfg_lineno++; BEGIN(INITIAL); } +[^\n]*\n+ { /* eat comments */ + capture_comment_char('#'); + for(int i=0; yytext[i]; i++) { + capture_comment_char(yytext[i]); + if(yytext[i] == '\n') + cfg_lineno++; + } + BEGIN(INITIAL); +} -"/*" { /* The following eats multiline C style comments */ +"/*" { /* The following eats multiline C style comments, they are not captured */ int c; int comment_start; diff --git a/src/libavrdude.h b/src/libavrdude.h index 2dc4bcc5..c17f611b 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -516,7 +516,15 @@ int pins_check(const struct programmer_t * const pgm, const struct pin_checklist const char * avr_pin_name(int pinname); /** - * This function returns a string representation of defined pins eg. ~1,2,~4,~5,7 + * Returns the name of the pin as lowercase string. + * + * @param pinname the pinname which we want as string. + * @returns a lowercase string with the pinname, or if pinname is invalid. + */ +const char * avr_pin_lcname(int pinname); + +/** + * This function returns a string of defined pins, eg, ~1,2,~4,~5,7 or " (not used)" * Another execution of this function will overwrite the previous result in the static buffer. * * @param[in] pindef the pin definition for which we want the string representation @@ -525,9 +533,17 @@ const char * avr_pin_name(int pinname); const char * pins_to_str(const struct pindef_t * const pindef); /** - * This function returns a string representation of pins in the mask eg. 1,3,5-7,9,12 + * This function returns a string of defined pins, eg, ~1, 2, ~4, ~5, 7 or "" + * + * @param[in] pindef the pin definition for which we want the string representation + * @returns a pointer to a string, which was created by strdup (NULL if out of memory) + */ +char *pins_to_strdup(const struct pindef_t * const pindef); + +/** + * This function returns a string representation of pins in the mask, eg, 1,3,5-7,9,12 * Another execution of this function will overwrite the previous result in the static buffer. - * Consecutive pin number are representated as start-end. + * Consecutive pin number are represented as start-end. * * @param[in] pinmask the pin mask for which we want the string representation * @returns pointer to a static string. @@ -670,29 +686,32 @@ typedef enum { typedef struct programmer_t { LISTID id; char desc[PGM_DESCLEN]; - char type[PGM_TYPELEN]; - char port[PGM_PORTLEN]; - const char *parent_id; - unsigned int pinno[N_PINS]; + void (*initpgm)(struct programmer_t *pgm); + const char *parent_id; // Used by developer options -c*/[sr...] struct pindef_t pin[N_PINS]; - exit_vcc_t exit_vcc; - exit_reset_t exit_reset; - exit_datahigh_t exit_datahigh; conntype_t conntype; - int ppidata; - int ppictrl; int baudrate; int usbvid; LISTID usbpid; - LISTID hvupdi_support; // List of UPDI HV variants the tool supports, see HV_UPDI_VARIANT_x - const char *usbdev, *usbsn, *usbvendor, *usbproduct; - double bitclock; // JTAG ICE clock period in microseconds - int ispdelay; // ISP clock delay - int page_size; // Page size if the programmer supports paged write/load + const char *usbdev; + const char *usbsn; + const char *usbvendor; + const char *usbproduct; + LISTID hvupdi_support; // List of UPDI HV variants the tool supports, see HV_UPDI_VARIANT_x - // Values below are not set by config_gram.y; first one must be fd for dev_pgm_raw() + // Values below are not set by config_gram.y; make sure fd is first for dev_pgm_raw() union filedescriptor fd; - void (*initpgm)(struct programmer_t * pgm); + char type[PGM_TYPELEN]; + char port[PGM_PORTLEN]; + unsigned int pinno[N_PINS]; // TODO to be removed if old pin data no longer needed + exit_vcc_t exit_vcc; // Should these be set in avrdude.conf? + exit_reset_t exit_reset; + exit_datahigh_t exit_datahigh; + int ppidata; + int ppictrl; + int ispdelay; // ISP clock delay + int page_size; // Page size if the programmer supports paged write/load + double bitclock; // JTAG ICE clock period in microseconds int (*rdy_led) (struct programmer_t * pgm, int value); int (*err_led) (struct programmer_t * pgm, int value); @@ -957,7 +976,9 @@ typedef struct programmer_type_t { extern "C" { #endif -const PROGRAMMER_TYPE * locate_programmer_type(/*LISTID programmer_types, */const char * id); +const PROGRAMMER_TYPE *locate_programmer_type(const char *id); + +const char *locate_programmer_type_id(const void (*initpgm)(struct programmer_t *pgm)); typedef void (*walk_programmer_types_cb)(const char *id, const char *desc, void *cookie); @@ -991,7 +1012,7 @@ void cleanup_config(void); int read_config(const char * file); -char *cache_string(const char *file); +const char *cache_string(const char *file); #ifdef __cplusplus } diff --git a/src/main.c b/src/main.c index 83bde3e9..ab10b4fa 100644 --- a/src/main.c +++ b/src/main.c @@ -752,13 +752,21 @@ int main(int argc, char * argv []) } - avrdude_message(MSG_NOTICE, "\n"); - + int dev_opts = 0; + // Developer option -c /[ASsrt] prints programmer description(s) and exits + if(programmer && (strcmp(programmer, "*") == 0 || strchr(programmer, '/'))) { + dev_output_pgm_defs(programmer); + dev_opts = 1; + } // Developer option -p /[dASsrcow*t] prints part description(s) and exits if(partdesc && (strcmp(partdesc, "*") == 0 || strchr(partdesc, '/'))) { dev_output_part_defs(partdesc); - exit(1); + dev_opts = 1; } + if(dev_opts) + exit(0); + + avrdude_message(MSG_NOTICE, "\n"); if (partdesc) { if (strcmp(partdesc, "?") == 0) { @@ -770,12 +778,6 @@ int main(int argc, char * argv []) } } - // Developer option -c /[ASsrt] prints programmer description(s) and exits - if(programmer && (strcmp(programmer, "*") == 0 || strchr(programmer, '/'))) { - dev_output_pgm_defs(programmer); - exit(1); - } - if (programmer) { if (strcmp(programmer, "?") == 0) { avrdude_message(MSG_INFO, "\n"); diff --git a/src/pgm.c b/src/pgm.c index a4e0ed54..238f61d8 100644 --- a/src/pgm.c +++ b/src/pgm.c @@ -65,7 +65,7 @@ PROGRAMMER * pgm_new(void) { int i; PROGRAMMER * pgm; - char *nulp = cache_string(""); + const char *nulp = cache_string(""); pgm = (PROGRAMMER *)malloc(sizeof(*pgm)); if (pgm == NULL) { diff --git a/src/pgm_type.c b/src/pgm_type.c index 82320fab..46090424 100644 --- a/src/pgm_type.c +++ b/src/pgm_type.c @@ -57,55 +57,55 @@ #include "xbee.h" -const PROGRAMMER_TYPE programmers_types[] = { - {"arduino", arduino_initpgm, arduino_desc}, - {"avr910", avr910_initpgm, avr910_desc}, - {"avrftdi", avrftdi_initpgm, avrftdi_desc}, - {"buspirate", buspirate_initpgm, buspirate_desc}, - {"buspirate_bb", buspirate_bb_initpgm, buspirate_bb_desc}, - {"butterfly", butterfly_initpgm, butterfly_desc}, - {"butterfly_mk", butterfly_mk_initpgm, butterfly_mk_desc}, - {"dragon_dw", jtagmkII_dragon_dw_initpgm, jtagmkII_dragon_dw_desc}, - {"dragon_hvsp", stk500v2_dragon_hvsp_initpgm, stk500v2_dragon_hvsp_desc}, - {"dragon_isp", stk500v2_dragon_isp_initpgm, stk500v2_dragon_isp_desc}, - {"dragon_jtag", jtagmkII_dragon_initpgm, jtagmkII_dragon_desc}, - {"dragon_pdi", jtagmkII_dragon_pdi_initpgm, jtagmkII_dragon_pdi_desc}, - {"dragon_pp", stk500v2_dragon_pp_initpgm, stk500v2_dragon_pp_desc}, - {"flip1", flip1_initpgm, flip1_desc}, - {"flip2", flip2_initpgm, flip2_desc}, - {"ftdi_syncbb", ft245r_initpgm, ft245r_desc}, - {"jtagmki", jtagmkI_initpgm, jtagmkI_desc}, - {"jtagmkii", jtagmkII_initpgm, jtagmkII_desc}, - {"jtagmkii_avr32", jtagmkII_avr32_initpgm, jtagmkII_avr32_desc}, - {"jtagmkii_dw", jtagmkII_dw_initpgm, jtagmkII_dw_desc}, - {"jtagmkii_isp", stk500v2_jtagmkII_initpgm, stk500v2_jtagmkII_desc}, - {"jtagmkii_pdi", jtagmkII_pdi_initpgm, jtagmkII_pdi_desc}, - {"jtagmkii_updi", jtagmkII_updi_initpgm, jtagmkII_updi_desc}, - {"jtagice3", jtag3_initpgm, jtag3_desc}, - {"jtagice3_pdi", jtag3_pdi_initpgm, jtag3_pdi_desc}, - {"jtagice3_updi", jtag3_updi_initpgm, jtag3_updi_desc}, - {"jtagice3_dw", jtag3_dw_initpgm, jtag3_dw_desc}, - {"jtagice3_isp", stk500v2_jtag3_initpgm, stk500v2_jtag3_desc}, - {"linuxgpio", linuxgpio_initpgm, linuxgpio_desc}, - {"linuxspi", linuxspi_initpgm, linuxspi_desc}, - {"micronucleus", micronucleus_initpgm, micronucleus_desc}, - {"par", par_initpgm, par_desc}, - {"pickit2", pickit2_initpgm, pickit2_desc}, - {"serbb", serbb_initpgm, serbb_desc}, - {"serialupdi", serialupdi_initpgm, serialupdi_desc}, - {"stk500", stk500_initpgm, stk500_desc}, - {"stk500generic", stk500generic_initpgm, stk500generic_desc}, - {"stk500v2", stk500v2_initpgm, stk500v2_desc}, - {"stk500hvsp", stk500hvsp_initpgm, stk500hvsp_desc}, - {"stk500pp", stk500pp_initpgm, stk500pp_desc}, - {"stk600", stk600_initpgm, stk600_desc}, - {"stk600hvsp", stk600hvsp_initpgm, stk600hvsp_desc}, - {"stk600pp", stk600pp_initpgm, stk600pp_desc}, - {"teensy", teensy_initpgm, teensy_desc}, - {"usbasp", usbasp_initpgm, usbasp_desc}, - {"usbtiny", usbtiny_initpgm, usbtiny_desc}, - {"wiring", wiring_initpgm, wiring_desc}, - {"xbee", xbee_initpgm, xbee_desc}, +const PROGRAMMER_TYPE programmers_types[] = { // Name(s) the programmers call themselves + {"arduino", arduino_initpgm, arduino_desc}, // "Arduino" + {"avr910", avr910_initpgm, avr910_desc}, // "avr910" + {"avrftdi", avrftdi_initpgm, avrftdi_desc}, // "avrftdi" + {"buspirate", buspirate_initpgm, buspirate_desc}, // "BusPirate" + {"buspirate_bb", buspirate_bb_initpgm, buspirate_bb_desc}, // "BusPirate_BB" + {"butterfly", butterfly_initpgm, butterfly_desc}, // "butterfly" + {"butterfly_mk", butterfly_mk_initpgm, butterfly_mk_desc}, // "butterfly_mk" + {"dragon_dw", jtagmkII_dragon_dw_initpgm, jtagmkII_dragon_dw_desc}, // "DRAGON_DW" + {"dragon_hvsp", stk500v2_dragon_hvsp_initpgm, stk500v2_dragon_hvsp_desc}, // "DRAGON_HVSP" + {"dragon_isp", stk500v2_dragon_isp_initpgm, stk500v2_dragon_isp_desc}, // "DRAGON_ISP" + {"dragon_jtag", jtagmkII_dragon_initpgm, jtagmkII_dragon_desc}, // "DRAGON_JTAG" + {"dragon_pdi", jtagmkII_dragon_pdi_initpgm, jtagmkII_dragon_pdi_desc}, // "DRAGON_PDI" + {"dragon_pp", stk500v2_dragon_pp_initpgm, stk500v2_dragon_pp_desc}, // "DRAGON_PP" + {"flip1", flip1_initpgm, flip1_desc}, // "flip1" + {"flip2", flip2_initpgm, flip2_desc}, // "flip2" + {"ftdi_syncbb", ft245r_initpgm, ft245r_desc}, // "ftdi_syncbb" + {"jtagmki", jtagmkI_initpgm, jtagmkI_desc}, // "JTAGMKI" + {"jtagmkii", jtagmkII_initpgm, jtagmkII_desc}, // "JTAGMKII" + {"jtagmkii_avr32", jtagmkII_avr32_initpgm, jtagmkII_avr32_desc}, // "JTAGMKII_AVR32" + {"jtagmkii_dw", jtagmkII_dw_initpgm, jtagmkII_dw_desc}, // "JTAGMKII_DW" + {"jtagmkii_isp", stk500v2_jtagmkII_initpgm, stk500v2_jtagmkII_desc}, // "JTAGMKII_ISP" + {"jtagmkii_pdi", jtagmkII_pdi_initpgm, jtagmkII_pdi_desc}, // "JTAGMKII_PDI" + {"jtagmkii_updi", jtagmkII_updi_initpgm, jtagmkII_updi_desc}, // "JTAGMKII_UPDI" + {"jtagice3", jtag3_initpgm, jtag3_desc}, // "JTAGICE3" + {"jtagice3_pdi", jtag3_pdi_initpgm, jtag3_pdi_desc}, // "JTAGICE3_PDI" + {"jtagice3_updi", jtag3_updi_initpgm, jtag3_updi_desc}, // "JTAGICE3_UPDI" + {"jtagice3_dw", jtag3_dw_initpgm, jtag3_dw_desc}, // "JTAGICE3_DW" + {"jtagice3_isp", stk500v2_jtag3_initpgm, stk500v2_jtag3_desc}, // "JTAG3_ISP" + {"linuxgpio", linuxgpio_initpgm, linuxgpio_desc}, // "linuxgpio" + {"linuxspi", linuxspi_initpgm, linuxspi_desc}, // LINUXSPI + {"micronucleus", micronucleus_initpgm, micronucleus_desc}, // "micronucleus" or "Micronucleus V2.0" + {"par", par_initpgm, par_desc}, // "PPI" + {"pickit2", pickit2_initpgm, pickit2_desc}, // "pickit2" + {"serbb", serbb_initpgm, serbb_desc}, // "SERBB" + {"serialupdi", serialupdi_initpgm, serialupdi_desc}, // "serialupdi" + {"stk500", stk500_initpgm, stk500_desc}, // "STK500" + {"stk500generic", stk500generic_initpgm, stk500generic_desc}, // "STK500GENERIC" + {"stk500v2", stk500v2_initpgm, stk500v2_desc}, // "STK500V2" + {"stk500hvsp", stk500hvsp_initpgm, stk500hvsp_desc}, // "STK500HVSP" + {"stk500pp", stk500pp_initpgm, stk500pp_desc}, // "STK500PP" + {"stk600", stk600_initpgm, stk600_desc}, // "STK600" + {"stk600hvsp", stk600hvsp_initpgm, stk600hvsp_desc}, // "STK600HVSP" + {"stk600pp", stk600pp_initpgm, stk600pp_desc}, // "STK600PP" + {"teensy", teensy_initpgm, teensy_desc}, // "teensy" + {"usbasp", usbasp_initpgm, usbasp_desc}, // "usbasp" + {"usbtiny", usbtiny_initpgm, usbtiny_desc}, // "USBtiny" or "usbtiny" + {"wiring", wiring_initpgm, wiring_desc}, // "Wiring" + {"xbee", xbee_initpgm, xbee_desc}, // "XBee" }; const PROGRAMMER_TYPE * locate_programmer_type(const char * id) @@ -128,6 +128,16 @@ const PROGRAMMER_TYPE * locate_programmer_type(const char * id) return NULL; } +// Return type id given the init function or "" if not found +const char *locate_programmer_type_id(void (*initpgm)(struct programmer_t *pgm)) { + for (int i=0; i < sizeof programmers_types/sizeof*programmers_types; i++) + if(programmers_types[i].initpgm == initpgm) + return programmers_types[i].id; + + return ""; +} + + /* * Iterate over the list of programmers given as "programmers", and * call the callback function cb for each entry found. cb is being diff --git a/src/pindefs.c b/src/pindefs.c index f51e5c20..1d860ebf 100644 --- a/src/pindefs.c +++ b/src/pindefs.c @@ -312,7 +312,7 @@ int pins_check(const struct programmer_t * const pgm, const struct pin_checklist } /** - * This function returns a string representation of defined pins eg. ~1,2,~4,~5,7 + * This function returns a string of defined pins, eg, ~1,2,~4,~5,7 or " (not used)" * Another execution of this function will overwrite the previous result in the static buffer. * * @param[in] pindef the pin definition for which we want the string representation @@ -346,6 +346,28 @@ const char * pins_to_str(const struct pindef_t * const pindef) { return buf; } +/** + * This function returns a string of defined pins, eg, ~1, 2, ~4, ~5, 7 or "" + * + * @param[in] pindef the pin definition for which we want the string representation + * @returns a pointer to a string, which was created by strdup (NULL if out of memory) + */ +char *pins_to_strdup(const struct pindef_t * const pindef) { + char buf[6*(PIN_MAX+1)], *p = buf; + + *buf = 0; + for(int pin = PIN_MIN; pin <= PIN_MAX; pin++) { + int index = pin / PIN_FIELD_ELEMENT_SIZE, bit = pin % PIN_FIELD_ELEMENT_SIZE; + if(pindef->mask[index] & (1 << bit)) { + if(*buf) + *p++ = ',', *p++=' '; + p += sprintf(p, "~%d" + !(pindef->inverse[index] & (1 << bit)), pin); + } + } + + return strdup(buf); +} + /** * Returns the name of the pin as string. * @@ -369,3 +391,24 @@ const char * avr_pin_name(int pinname) { } +/** + * Returns the name of the pin as string. + * + * @param pinname the pinname which we want as string. + * @returns a lowercase string with the pinname, or if pinname is invalid. + */ +const char * avr_pin_lcname(int pinname) { + switch(pinname) { + case PPI_AVR_VCC : return "vcc"; + case PPI_AVR_BUFF : return "buff"; + case PIN_AVR_RESET : return "reset"; + case PIN_AVR_SCK : return "sck"; + case PIN_AVR_MOSI : return "mosi"; + case PIN_AVR_MISO : return "miso"; + case PIN_LED_ERR : return "errled"; + case PIN_LED_RDY : return "rdyled"; + case PIN_LED_PGM : return "pgmled"; + case PIN_LED_VFY : return "vfyled"; + default : return ""; + } +} From f25bc5580634d6fee3d2d99409725c62a4af76f8 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 8 Aug 2022 17:03:06 +0100 Subject: [PATCH 184/511] Treat -c* the same as -c*/s --- src/developer_opts.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index bd59e940..7e94aa15 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -1055,8 +1055,8 @@ void dev_output_pgm_defs(char *pgmid) { if((flags = strchr(pgmid, '/'))) *flags++ = 0; - if(!flags && !strcmp(pgmid, "*")) // Treat -c * as if it was -c */A - flags = "A"; + if(!flags && !strcmp(pgmid, "*")) // Treat -c * as if it was -c */s + flags = "s"; if(!*flags || !strchr("ASsrt", *flags)) { dev_info("%s: flags for developer option -c / not recognised\n", progname); @@ -1077,7 +1077,7 @@ void dev_output_pgm_defs(char *pgmid) { " $ avrdude -c */st | grep baudrate\n" " $ avrdude -c */r | sort\n" "Notes:\n" - " -c * is the same as -c */A\n" + " -c * is the same as -c */s\n" " This help message is printed using any unrecognised flag, eg, -c/h\n" " Leaving no space after -c can be an OK substitute for quoting in shells\n" " /s, /S and /A outputs are designed to be used as input in avrdude.conf\n" From 1da97f6825ed79db849d2aebf63a209e69e7ecc0 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 8 Aug 2022 17:21:21 +0100 Subject: [PATCH 185/511] Adjust declaration of locate_programmer_type_id() to definition --- src/libavrdude.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libavrdude.h b/src/libavrdude.h index c17f611b..9ab1a8d9 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -978,7 +978,7 @@ extern "C" { const PROGRAMMER_TYPE *locate_programmer_type(const char *id); -const char *locate_programmer_type_id(const void (*initpgm)(struct programmer_t *pgm)); +const char *locate_programmer_type_id(void (*initpgm)(struct programmer_t *pgm)); typedef void (*walk_programmer_types_cb)(const char *id, const char *desc, void *cookie); From c21be27a7d7c0a6096e452db58cc10b8a71462aa Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 8 Aug 2022 17:27:38 +0100 Subject: [PATCH 186/511] Replace const char array indexing with equivalent code in pindefs.c --- src/pindefs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pindefs.c b/src/pindefs.c index 1d860ebf..625d1f18 100644 --- a/src/pindefs.c +++ b/src/pindefs.c @@ -361,7 +361,7 @@ char *pins_to_strdup(const struct pindef_t * const pindef) { if(pindef->mask[index] & (1 << bit)) { if(*buf) *p++ = ',', *p++=' '; - p += sprintf(p, "~%d" + !(pindef->inverse[index] & (1 << bit)), pin); + p += sprintf(p, pindef->inverse[index] & (1 << bit)? "~%d": "%d", pin); } } From 7c8d336e27485cf4d8055eb4221befa185932711 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 9 Aug 2022 09:23:26 +0100 Subject: [PATCH 187/511] Change dev_info() to stdout and no longer redirect stderr to stdout --- src/developer_opts.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index 7e94aa15..de245608 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -214,7 +214,7 @@ int dev_message(int msglvl, const char *fmt, ...) { if(verbose >= msglvl) { va_start(ap, fmt); - rc = vfprintf(stderr, fmt, ap); + rc = vfprintf(stdout, fmt, ap); va_end(ap); if(rc > 0) dev_nprinted += rc; @@ -651,9 +651,6 @@ void dev_output_part_defs(char *partdesc) { return; } - // Redirect stderr to stdout - fflush(stderr); fflush(stdout); dup2(1, 2); - all = *flags == '*'; cmdok = all || !!strchr(flags, 'c'); descs = all || !!strchr(flags, 'd'); @@ -1087,9 +1084,6 @@ void dev_output_pgm_defs(char *pgmid) { return; } - // Redirect stderr to stdout - fflush(stderr); fflush(stdout); dup2(1, 2); - astrc = !!strchr(flags, 'A'); strct = !!strchr(flags, 'S'); cmpst = !!strchr(flags, 's'); From 8a717987ec1cdb9612fec4d42cdd1ec4165b1489 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 9 Aug 2022 13:19:40 +0100 Subject: [PATCH 188/511] Change unsigned short eecr; to unsigned char eecr; in libavrdude's AVRPART --- src/developer_opts.c | 2 +- src/libavrdude.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index de245608..b4f69753 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -533,7 +533,7 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { _if_partout(intcmp, "0x%02x", idr); _if_partout(intcmp, "0x%02x", rampz); _if_partout(intcmp, "0x%02x", spmcr); - _if_partout(intcmp, "0x%02x", eecr); // Why is eecr an unsigned short? + _if_partout(intcmp, "0x%02x", eecr); _if_partout(intcmp, "0x%04x", mcu_base); _if_partout(intcmp, "0x%04x", nvm_base); _if_partout(intcmp, "0x%04x", ocd_base); diff --git a/src/libavrdude.h b/src/libavrdude.h index 9ab1a8d9..fb4a53dd 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -270,7 +270,7 @@ typedef struct avrpart { unsigned char idr; /* JTAG ICE mkII XML file parameter */ unsigned char rampz; /* JTAG ICE mkII XML file parameter */ unsigned char spmcr; /* JTAG ICE mkII XML file parameter */ - unsigned short eecr; /* JTAC ICE mkII XML file parameter */ + unsigned char eecr; /* JTAC ICE mkII XML file parameter */ unsigned int mcu_base; /* Base address of MCU control block in ATxmega devices */ unsigned int nvm_base; /* Base address of NVM controller in ATxmega devices */ unsigned int ocd_base; /* Base address of OCD module in AVR8X/UPDI devices */ From 22c4dbf23e89e16491b76dceadfc443eca1c56bc Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 9 Aug 2022 21:20:44 +0100 Subject: [PATCH 189/511] Harden string processing during parsing in lexer.l, config_gram.y and otherwise - Replace strdup(s) with cfg_strdup(funname, s) that exits on out of mem - Replace malloc(n) with cfg_malloc(funname, n) that exits on out of mem - Change multiline string scanning in lexer.l to avoid core dump - Remove global variables string_buf and string_bug_ptr - Ensure reading strings unescapes strings C-Style - Ensure writing strings escapes strings C-Style again Commit looks longer than needed as unescape() and auxiliary functions needed to be moved from term.c (not in libavrdude) to config.c (in libavrdude). --- src/avr.c | 2 +- src/avrpart.c | 6 +- src/config.c | 338 ++++++++++++++++++++++++++--------- src/config.h | 29 ++- src/config_gram.y | 18 +- src/developer_opts.c | 51 +++--- src/developer_opts_private.h | 15 +- src/lexer.l | 28 ++- src/libavrdude.h | 12 +- src/main.c | 5 +- src/pgm.c | 24 +-- src/pindefs.c | 4 +- src/term.c | 175 +----------------- src/update.c | 50 ++---- 14 files changed, 355 insertions(+), 402 deletions(-) diff --git a/src/avr.c b/src/avr.c index eea0ad8a..62760ce7 100644 --- a/src/avr.c +++ b/src/avr.c @@ -1243,7 +1243,7 @@ void avr_add_mem_order(const char *str) { if(avr_mem_order[i] && !strcmp(avr_mem_order[i], str)) return; if(!avr_mem_order[i]) { - avr_mem_order[i] = strdup(str); + avr_mem_order[i] = cfg_strdup("avr_mem_order()", str); return; } } diff --git a/src/avrpart.c b/src/avrpart.c index c4a2bd8b..40baa449 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -956,7 +956,7 @@ char *cmdbitstr(CMDBIT cb) { else space[1] = 0; - return strdup(space); + return cfg_strdup("cmdbitstr()", space); } @@ -998,7 +998,7 @@ char *opcode2str(OPCODE *op, int opnum, int detailed) { int compact = 1; if(!op) - return strdup("NULL"); + return cfg_strdup("opcode2str()", "NULL"); // Can the opcode be printed in a compact way? Only if address bits are systematic. for(int i=31; i >= 0; i--) @@ -1033,7 +1033,7 @@ char *opcode2str(OPCODE *op, int opnum, int detailed) { *sp++ = '"'; *sp = 0; - return strdup(space); + return cfg_strdup("opcode2str()", space); } diff --git a/src/config.c b/src/config.c index 34745daf..8d99848d 100644 --- a/src/config.c +++ b/src/config.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "avrdude.h" #include "libavrdude.h" @@ -38,9 +39,6 @@ char default_serial[PATH_MAX]; char default_spi[PATH_MAX]; double default_bitclock; -char string_buf[MAX_STR_CONST]; -char *string_buf_ptr; - LISTID string_list; LISTID number_list; PROGRAMMER * current_prog; @@ -82,6 +80,25 @@ int init_config(void) return 0; } +void *cfg_malloc(const char *funcname, size_t n) { + void *ret = malloc(n); + if(!ret) { + avrdude_message(MSG_INFO, "%s: out of memory in %s\n", progname, funcname); + exit(1); + } + memset(ret, 0, n); + return ret; +} + + +char *cfg_strdup(const char *funcname, const char *s) { + char *ret = strdup(s); + if(!ret) { + avrdude_message(MSG_INFO, "%s: out of memory in %s\n", progname, funcname); + exit(1); + } + return ret; +} int yywrap() @@ -124,20 +141,9 @@ int yywarning(char * errmsg, ...) } -TOKEN * new_token(int primary) -{ - TOKEN * tkn; - - tkn = (TOKEN *)malloc(sizeof(TOKEN)); - if (tkn == NULL) { - yyerror("new_token(): out of memory"); - return NULL; - } - - memset(tkn, 0, sizeof(TOKEN)); - +TOKEN * new_token(int primary) { + TOKEN * tkn = (TOKEN *) cfg_malloc("new_token()", sizeof(TOKEN)); tkn->primary = primary; - return tkn; } @@ -173,14 +179,8 @@ void free_tokens(int n, ...) -TOKEN * number(char * text) -{ - struct token_t * tkn; - - tkn = new_token(TKN_NUMBER); - if (tkn == NULL) { - return NULL; /* yyerror already called */ - } +TOKEN *number(const char *text) { + struct token_t *tkn = new_token(TKN_NUMBER); tkn->value.type = V_NUM; tkn->value.number = atoi(text); @@ -191,11 +191,8 @@ TOKEN * number(char * text) return tkn; } -TOKEN * number_real(char * text) -{ - struct token_t * tkn; - - tkn = new_token(TKN_NUMBER); +TOKEN *number_real(const char *text) { + struct token_t * tkn = new_token(TKN_NUMBER); tkn->value.type = V_NUM_REAL; tkn->value.number_real = atof(text); @@ -206,15 +203,10 @@ TOKEN * number_real(char * text) return tkn; } -TOKEN * hexnumber(char * text) -{ - struct token_t * tkn; +TOKEN *hexnumber(const char *text) { + struct token_t *tkn = new_token(TKN_NUMBER); char * e; - tkn = new_token(TKN_NUMBER); - if (tkn == NULL) { - return NULL; /* yyerror already called */ - } tkn->value.type = V_NUM; tkn->value.number = strtoul(text, &e, 16); if ((e == text) || (*e != 0)) { @@ -231,26 +223,10 @@ TOKEN * hexnumber(char * text) } -TOKEN * string(char * text) -{ - struct token_t * tkn; - int len; - - tkn = new_token(TKN_STRING); - if (tkn == NULL) { - return NULL; /* yyerror already called */ - } - - len = strlen(text); - +TOKEN *string(const char *text) { + struct token_t *tkn = new_token(TKN_STRING); tkn->value.type = V_STR; - tkn->value.string = (char *) malloc(len+1); - if (tkn->value.string == NULL) { - yyerror("string(): out of memory"); - free_token(tkn); - return NULL; - } - strcpy(tkn->value.string, text); + tkn->value.string = cfg_strdup("string()", text); #if DEBUG avrdude_message(MSG_INFO, "STRING(%s)\n", tkn->value.string); @@ -260,13 +236,8 @@ TOKEN * string(char * text) } -TOKEN * keyword(int primary) -{ - struct token_t * tkn; - - tkn = new_token(primary); - - return tkn; +TOKEN * keyword(int primary) { + return new_token(primary); } @@ -306,19 +277,6 @@ void pyytext(void) } -char * dup_string(const char * str) -{ - char * s; - - s = strdup(str); - if (s == NULL) { - yyerror("dup_string(): out of memory"); - return NULL; - } - - return s; -} - #ifdef HAVE_YYLEX_DESTROY /* reset lexer and free any allocated memory */ extern int yylex_destroy(void); @@ -386,11 +344,7 @@ const char *cache_string(const char *file) { } } - fnames[n] = strdup(file); - if(!fnames[n]) { - yyerror("cache_string(): out of memory"); - return NULL; - } + fnames[n] = cfg_strdup("cache_string()", file); return fnames[n++]; } @@ -399,3 +353,227 @@ const char *cache_string(const char *file) { int capture_comment_char(int c) { return c; } + + +// Convert the next n hex digits of s to a hex number +static unsigned int tohex(const unsigned char *s, unsigned int n) { + int ret, c; + + ret = 0; + while(n--) { + ret *= 16; + c = *s++; + ret += c >= '0' && c <= '9'? c - '0': c >= 'a' && c <= 'f'? c - 'a' + 10: c - 'A' + 10; + } + + return ret; +} + +/* + * Create a utf-8 character sequence from a single unicode character. + * Permissive for some invalid unicode sequences but not for those with + * high bit set). Returns numbers of characters written (0-6). + */ +static int wc_to_utf8str(unsigned int wc, unsigned char *str) { + if(!(wc & ~0x7fu)) { + *str = (char) wc; + return 1; + } + if(!(wc & ~0x7ffu)) { + *str++ = (char) ((wc >> 6) | 0xc0); + *str++ = (char) ((wc & 0x3f) | 0x80); + return 2; + } + if(!(wc & ~0xffffu)) { + *str++ = (char) ((wc >> 12) | 0xe0); + *str++ = (char) (((wc >> 6) & 0x3f) | 0x80); + *str++ = (char) ((wc & 0x3f) | 0x80); + return 3; + } + if(!(wc & ~0x1fffffu)) { + *str++ = (char) ((wc >> 18) | 0xf0); + *str++ = (char) (((wc >> 12) & 0x3f) | 0x80); + *str++ = (char) (((wc >> 6) & 0x3f) | 0x80); + *str++ = (char) ((wc & 0x3f) | 0x80); + return 4; + } + if(!(wc & ~0x3ffffffu)) { + *str++ = (char) ((wc >> 24) | 0xf8); + *str++ = (char) (((wc >> 18) & 0x3f) | 0x80); + *str++ = (char) (((wc >> 12) & 0x3f) | 0x80); + *str++ = (char) (((wc >> 6) & 0x3f) | 0x80); + *str++ = (char) ((wc & 0x3f) | 0x80); + return 5; + } + if(!(wc & ~0x7fffffffu)) { + *str++ = (char) ((wc >> 30) | 0xfc); + *str++ = (char) (((wc >> 24) & 0x3f) | 0x80); + *str++ = (char) (((wc >> 18) & 0x3f) | 0x80); + *str++ = (char) (((wc >> 12) & 0x3f) | 0x80); + *str++ = (char) (((wc >> 6) & 0x3f) | 0x80); + *str++ = (char) ((wc & 0x3f) | 0x80); + return 6; + } + return 0; +} + +// Unescape C-style strings, destination d must hold enough space (and can be source s) +unsigned char *cfg_unescapeu(unsigned char *d, const unsigned char *s) { + unsigned char *ret = d; + int n, k; + + while(*s) { + switch (*s) { + case '\\': + switch (*++s) { + case 'n': + *d = '\n'; + break; + case 't': + *d = '\t'; + break; + case 'a': + *d = '\a'; + break; + case 'b': + *d = '\b'; + break; + case 'e': // Non-standard ESC + *d = 27; + break; + case 'f': + *d = '\f'; + break; + case 'r': + *d = '\r'; + break; + case 'v': + *d = '\v'; + break; + case '?': + *d = '?'; + break; + case '`': + *d = '`'; + break; + case '"': + *d = '"'; + break; + case '\'': + *d = '\''; + break; + case '\\': + *d = '\\'; + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': // 1-3 octal digits + n = *s - '0'; + for(k = 0; k < 2 && s[1] >= '0' && s[1] <= '7'; k++) // Max 2 more octal characters + n *= 8, n += s[1] - '0', s++; + *d = n; + break; + case 'x': // Unlimited hex digits + for(k = 0; isxdigit(s[k + 1]); k++) + continue; + if(k > 0) { + *d = tohex(s + 1, k); + s += k; + } else { // No hex digits after \x? copy \x + *d++ = '\\'; + *d = 'x'; + } + break; + case 'u': // Exactly 4 hex digits and valid unicode + if(isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) && + (n = wc_to_utf8str(tohex(s+1, 4), d))) { + d += n - 1; + s += 4; + } else { // Invalid \u sequence? copy \u + *d++ = '\\'; + *d = 'u'; + } + break; + case 'U': // Exactly 6 hex digits and valid unicode + if(isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) && isxdigit(s[5]) && isxdigit(s[6]) && + (n = wc_to_utf8str(tohex(s+1, 6), d))) { + d += n - 1; + s += 6; + } else { // Invalid \U sequence? copy \U + *d++ = '\\'; + *d = 'U'; + } + break; + default: // Keep the escape sequence (C would warn and remove \) + *d++ = '\\'; + *d = *s; + } + break; + + default: // Not an escape sequence: just copy the character + *d = *s; + } + d++; + s++; + } + *d = *s; // Terminate + + return ret; +} + +// Unescape C-style strings, destination d must hold enough space (and can be source s) +char *cfg_unescape(char *d, const char *s) { + return (char *) cfg_unescapeu((unsigned char *) d, (const unsigned char *) s); +} + +// Return an escaped string that looks like a C-style input string incl quotes, memory is malloc()ed +char *cfg_escape(const char *s) { + char *ret = (char *) cfg_malloc("cfg_escape()", 4*strlen(s)+2+3), *d = ret; + + *d++ = '"'; + for(; *s; s++) { + switch(*s) { + case '\n': + *d++ = '\\'; *d++ = 'n'; + break; + case '\t': + *d++ = '\\'; *d++ = 't'; + break; + case '\a': + *d++ = '\\'; *d++ = 'a'; + break; + case '\b': + *d++ = '\\'; *d++ = 'b'; + break; + case '\f': + *d++ = '\\'; *d++ = 'f'; + break; +#if '\r' != '\n' + case '\r': + *d++ = '\\'; *d++ = 'r'; + break; +#endif + case '\v': + *d++ = '\\'; *d++ = 'v'; + break; + case '\"': + *d++ = '\\'; *d++ = '\"'; + break; + default: + if(*s == 0x7f || (*s >= 0 && *s < 32)) { + sprintf(d, "\\%03o", *s); + d += strlen(d); + } else + *d++ = *s; + } + } + *d++ = '"'; + *d = 0; + + return ret; +} diff --git a/src/config.h b/src/config.h index 1ebd2f70..260d404a 100644 --- a/src/config.h +++ b/src/config.h @@ -35,11 +35,11 @@ enum { V_NONE, V_NUM, V_NUM_REAL, V_STR }; typedef struct value_t { int type; - /*union { TODO: use an anonymous union here ? */ + union { int number; double number_real; char * string; - /*};*/ + }; } VALUE; @@ -66,41 +66,36 @@ extern bool is_alias; // current entry is alias #endif extern YYSTYPE yylval; -extern char string_buf[MAX_STR_CONST]; -extern char *string_buf_ptr; - #ifdef __cplusplus extern "C" { #endif int yyparse(void); -int yyerror(char * errmsg, ...); +int yyerror(char *errmsg, ...); -int yywarning(char * errmsg, ...); +int yywarning(char *errmsg, ...); -TOKEN * new_token(int primary); +TOKEN *new_token(int primary); -void free_token(TOKEN * tkn); +void free_token(TOKEN *tkn); void free_tokens(int n, ...); -TOKEN * number(char * text); +TOKEN *number(const char *text); -TOKEN * number_real(char * text); +TOKEN *number_real(const char *text); -TOKEN * hexnumber(char * text); +TOKEN *hexnumber(const char *text); -TOKEN * string(char * text); +TOKEN *string(const char *text); -TOKEN * keyword(int primary); +TOKEN *keyword(int primary); -void print_token(TOKEN * tkn); +void print_token(TOKEN *tkn); void pyytext(void); -char * dup_string(const char * str); - int capture_comment_char(int c); #ifdef __cplusplus diff --git a/src/config_gram.y b/src/config_gram.y index c3554dcc..0b9cf6cd 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -453,25 +453,11 @@ prog_parms : prog_parm : K_ID TKN_EQUAL string_list { { - TOKEN * t; - char *s; - int do_yyabort = 0; while (lsize(string_list)) { - t = lrmv_n(string_list, 1); - if (!do_yyabort) { - s = dup_string(t->value.string); - if (s == NULL) { - do_yyabort = 1; - } else { - ladd(current_prog->id, s); - } - } - /* if do_yyabort == 1 just make the list empty */ + TOKEN *t = lrmv_n(string_list, 1); + ladd(current_prog->id, cfg_strdup("config_gram.y", t->value.string)); free_token(t); } - if (do_yyabort) { - YYABORT; - } } } | prog_parm_type diff --git a/src/developer_opts.c b/src/developer_opts.c index b4f69753..6cbfa4f2 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -187,20 +187,17 @@ static char *dev_sprintf(const char *fmt, ...) { va_end(ap); if(size < 0) - return NULL; + return cfg_strdup("dev_sprintf()", ""); - size++; // For temrinating '\0' - if(!(p = malloc(size))) - return NULL; + size++; // For terminating '\0' + p = cfg_malloc("dev_sprintf()", size); va_start(ap, fmt); size = vsnprintf(p, size, fmt, ap); va_end(ap); - if(size < 0) { - free(p); - return NULL; - } + if(size < 0) + *p = 0; return p; } @@ -438,9 +435,10 @@ static void dev_part_raw(AVRPART *part) { static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { + char *descstr = cfg_escape(p->desc); if(!tsv) { dev_info("#------------------------------------------------------------\n"); - dev_info("# %s\n", p->desc); + dev_info("# %.*s\n", strlen(descstr+1)-1, descstr+1); dev_info("#------------------------------------------------------------\n"); if(p->parent_id && *p->parent_id) dev_info("\npart parent \"%s\"\n", p->parent_id); @@ -448,9 +446,9 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { dev_info("\npart\n"); } - _if_partout(strcmp, "\"%s\"", desc); - _if_partout(strcmp, "\"%s\"", id); - _if_partout(strcmp, "\"%s\"", family_id); + _if_partout_str(strcmp, descstr, desc); + _if_partout_str(strcmp, cfg_escape(p->id), id); + _if_partout_str(strcmp, cfg_escape(p->family_id), family_id); _if_partout(intcmp, "%d", hvupdi_variant); _if_partout(intcmp, "0x%02x", stk500_devcode); _if_partout(intcmp, "0x%02x", avr910_devcode); @@ -461,9 +459,13 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { _if_partout(intcmp, "0x%04x", usbpid); if(!base || base->reset_disposition != p->reset_disposition) - _partout_str(strdup(p->reset_disposition == RESET_DEDICATED? "dedicated": p->reset_disposition == RESET_IO? "io": "unknown"), reset); + _partout_str(cfg_strdup("dev_part_strct()", + p->reset_disposition == RESET_DEDICATED? "dedicated": p->reset_disposition == RESET_IO? "io": "unknown"), + reset); - _if_partout_str(intcmp, strdup(p->retry_pulse == PIN_AVR_RESET? "reset": p->retry_pulse == PIN_AVR_SCK? "sck": "unknown"), retry_pulse); + _if_partout_str(intcmp, cfg_strdup("dev_part_strct()", + p->retry_pulse == PIN_AVR_RESET? "reset": p->retry_pulse == PIN_AVR_SCK? "sck": "unknown"), + retry_pulse); if(!base || base->flags != p->flags) { if(tsv) { @@ -482,7 +484,9 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { if(!base || (base->flags & (AVRPART_PARALLELOK | AVRPART_PSEUDOPARALLEL)) != (p->flags & (AVRPART_PARALLELOK | AVRPART_PSEUDOPARALLEL))) { int par = p->flags & (AVRPART_PARALLELOK | AVRPART_PSEUDOPARALLEL); - _partout_str(strdup(par == 0? "no": par == AVRPART_PSEUDOPARALLEL? "unknown": AVRPART_PARALLELOK? "yes": "pseudo"), parallel); + _partout_str(cfg_strdup("dev_part_strct()", + par == 0? "no": par == AVRPART_PSEUDOPARALLEL? "unknown": AVRPART_PARALLELOK? "yes": "pseudo"), + parallel); } } } @@ -984,13 +988,16 @@ static void dev_pgm_strct(PROGRAMMER *pgm, bool tsv, PROGRAMMER *base) { if(!firstid) dev_info(", "); firstid = 0; - dev_info("\"%s\"", ldata(ln)); + char *str = cfg_escape(ldata(ln)); + dev_info("%s", str); + free(str); } dev_info(tsv? "\n": ";\n"); - _if_pgmout(strcmp, "\"%s\"", desc); + _if_pgmout_str(strcmp, cfg_escape(pgm->desc), desc); _pgmout_fmt("type", "\"%s\"", locate_programmer_type_id(pgm->initpgm)); - _pgmout_fmt("connection_type", "%s", connstr(pgm->conntype)); + if(!base || base->conntype != pgm->conntype) + _pgmout_fmt("connection_type", "%s", connstr(pgm->conntype)); _if_pgmout(intcmp, "%d", baudrate); _if_pgmout(intcmp, "0x%04x", usbvid); @@ -1009,10 +1016,10 @@ static void dev_pgm_strct(PROGRAMMER *pgm, bool tsv, PROGRAMMER *base) { dev_info(tsv? "\n": ";\n"); } - _if_pgmout(strcmp, "\"%s\"", usbdev); - _if_pgmout(strcmp, "\"%s\"", usbsn); - _if_pgmout(strcmp, "\"%s\"", usbvendor); - _if_pgmout(strcmp, "\"%s\"", usbproduct); + _if_pgmout_str(strcmp, cfg_escape(pgm->usbdev), usbdev); + _if_pgmout_str(strcmp, cfg_escape(pgm->usbsn), usbsn); + _if_pgmout_str(strcmp, cfg_escape(pgm->usbvendor), usbvendor); + _if_pgmout_str(strcmp, cfg_escape(pgm->usbproduct), usbproduct); for(int i=0; ipin+i); diff --git a/src/developer_opts_private.h b/src/developer_opts_private.h index e6be1ee9..a5c1562e 100644 --- a/src/developer_opts_private.h +++ b/src/developer_opts_private.h @@ -62,6 +62,7 @@ static int dev_message(int msglvl, const char *fmt, ...); dev_part_strct_entry(tsv, ".prog", id, NULL, #component, dev_sprintf(fmt, pgm->component)); \ } while(0) +// Result must be a malloc()ed string #define _if_pgmout_str(cmp, result, component) do { \ if(!base || cmp(base->component, pgm->component)) \ dev_part_strct_entry(tsv, ".prog", id, NULL, #component, result); \ @@ -80,14 +81,17 @@ static int dev_message(int msglvl, const char *fmt, ...); dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)); \ } while(0) +// Result must be a malloc()ed string #define _partout_str(result, component) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result) +// Result must be a malloc()ed string #define _if_partout_str(cmp, result, component) do { \ if(!base || cmp(base->component, p->component)) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result); \ } while(0) +// Result must be a malloc()ed string #define _if_n_partout_str(cmp, n, result, component) do { \ if(!base || cmp(base->component, p->component, n)) \ dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result); \ @@ -102,30 +106,33 @@ static int dev_message(int msglvl, const char *fmt, ...); dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component)); \ } while(0) +// Result must be a malloc()ed string #define _memout_str(result, component) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result) +// Result must be a malloc()ed string #define _if_n_memout_str(cmp, n, result, component) do { \ if(!bm || cmp(bm->component, m->component, n)) \ dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result); \ } while(0) #define _memout_yn(component) \ - dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, strdup(m->component? "yes": "no")) + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, cfg_strdup("_memout_yn()", m->component? "yes": "no")) #define _if_memout_yn(component) do { \ if(!bm || bm->component != m->component) \ - dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, strdup(m->component? "yes": "no")); \ + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, cfg_strdup("_if_memout_yn()", m->component? "yes": "no")); \ } while(0) #define _flagout(mask, name) \ - _partout_str(strdup(p->flags & (mask)? "yes": "no"), name) + _partout_str(cfg_strdup("_flagout()", p->flags & (mask)? "yes": "no"), name) #define _if_flagout(mask, name) do { \ if(!base || (base->flags & (mask)) != (p->flags & (mask))) \ - _partout_str(strdup(p->flags & (mask)? "yes": "no"), name); \ + _partout_str(cfg_strdup("_if_flagout()", p->flags & (mask)? "yes": "no"), name); \ } while(0) +// Result must be a malloc()ed string #define _cmderr(result, component) \ dev_part_strct_entry(tsv, ".cmderr", p->desc, m->desc, #component, result) diff --git a/src/lexer.l b/src/lexer.l index c55d7853..23fd2277 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -45,7 +45,6 @@ DIGIT [0-9] HEXDIGIT [0-9a-fA-F] SIGN [+-] -%x strng %x incl %x comment %option nounput @@ -61,12 +60,19 @@ SIGN [+-] {SIGN}?{DIGIT}+"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; } {SIGN}?"."{DIGIT}+ { yylval = number_real(yytext); return TKN_NUMBER_REAL; } -"\"" { string_buf_ptr = string_buf; BEGIN(strng); } +["]([^"\\\n]|\\.|\\\n)*["] { + char *str= cfg_strdup("lexer.l", yytext); + cfg_unescape(str, str+1); + size_t len = strlen(str); + if(len) + str[len-1] = 0; + yylval = string(str); + free(str); + return TKN_STRING; +} 0x{HEXDIGIT}+ { yylval = hexnumber(yytext); return TKN_NUMBER; } - - # { /* The following captures all '#' style comments to end of line */ BEGIN(comment); } [^\n]*\n+ { /* eat comments */ @@ -107,20 +113,6 @@ SIGN [+-] } -\" { *string_buf_ptr = 0; string_buf_ptr = string_buf; - yylval = string(string_buf_ptr); BEGIN(INITIAL); return TKN_STRING; } -\\n *string_buf_ptr++ = '\n'; -\\t *string_buf_ptr++ = '\t'; -\\r *string_buf_ptr++ = '\r'; -\\b *string_buf_ptr++ = '\b'; -\\f *string_buf_ptr++ = '\f'; -\\(.|\n) *(string_buf_ptr++) = yytext[1]; -[^\\\n\"]+ { char *yptr = yytext; while (*yptr) - *(string_buf_ptr++) = *(yptr++); } - -\n { yyerror("unterminated character constant"); - return YYERRCODE; } - alias { yylval=NULL; return K_ALIAS; } allowfullpagebitstream { yylval=NULL; return K_ALLOWFULLPAGEBITSTREAM; } avr910_devcode { yylval=NULL; return K_AVR910_DEVCODE; } diff --git a/src/libavrdude.h b/src/libavrdude.h index fb4a53dd..840d8fc1 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -536,7 +536,7 @@ const char * pins_to_str(const struct pindef_t * const pindef); * This function returns a string of defined pins, eg, ~1, 2, ~4, ~5, 7 or "" * * @param[in] pindef the pin definition for which we want the string representation - * @returns a pointer to a string, which was created by strdup (NULL if out of memory) + * @returns a pointer to a string, which was created by strdup */ char *pins_to_strdup(const struct pindef_t * const pindef); @@ -1006,6 +1006,10 @@ extern double default_bitclock; extern "C" { #endif +void *cfg_malloc(const char *funcname, size_t n); + +char *cfg_strdup(const char *funcname, const char *s); + int init_config(void); void cleanup_config(void); @@ -1014,6 +1018,12 @@ int read_config(const char * file); const char *cache_string(const char *file); +unsigned char *cfg_unescapeu(unsigned char *d, const unsigned char *s); + +char *cfg_unescape(char *d, const char *s); + +char *cfg_escape(const char *s); + #ifdef __cplusplus } #endif diff --git a/src/main.c b/src/main.c index ab10b4fa..b696d6d7 100644 --- a/src/main.c +++ b/src/main.c @@ -922,10 +922,7 @@ int main(int argc, char * argv []) progname, (upd->op == DEVICE_READ)? 'r': (upd->op == DEVICE_WRITE)? 'w': 'v', upd->filename, mtype); - if ((upd->memtype = strdup(mtype)) == NULL) { - avrdude_message(MSG_INFO, "%s: out of memory\n", progname); - exit(1); - } + upd->memtype = cfg_strdup("main()", mtype); } if (!avr_mem_might_be_known(upd->memtype)) { diff --git a/src/pgm.c b/src/pgm.c index 238f61d8..07cbed57 100644 --- a/src/pgm.c +++ b/src/pgm.c @@ -67,14 +67,7 @@ PROGRAMMER * pgm_new(void) PROGRAMMER * pgm; const char *nulp = cache_string(""); - pgm = (PROGRAMMER *)malloc(sizeof(*pgm)); - if (pgm == NULL) { - avrdude_message(MSG_INFO, "%s: out of memory allocating programmer structure\n", - progname); - return NULL; - } - - memset(pgm, 0, sizeof(*pgm)); + pgm = (PROGRAMMER *) cfg_malloc("pgm_new()", sizeof(*pgm)); pgm->id = lcreat(NULL, 0); pgm->usbpid = lcreat(NULL, 0); @@ -162,24 +155,13 @@ PROGRAMMER * pgm_dup(const PROGRAMMER * const src) PROGRAMMER * pgm; LNODEID ln; - pgm = (PROGRAMMER *)malloc(sizeof(*pgm)); - if (pgm == NULL) { - avrdude_message(MSG_INFO, "%s: out of memory allocating programmer structure\n", - progname); - return NULL; - } - + pgm = (PROGRAMMER *) cfg_malloc("pgm_dup()", sizeof(*pgm)); memcpy(pgm, src, sizeof(*pgm)); pgm->id = lcreat(NULL, 0); pgm->usbpid = lcreat(NULL, 0); for (ln = lfirst(src->usbpid); ln; ln = lnext(ln)) { - int *ip = malloc(sizeof(int)); - if (ip == NULL) { - avrdude_message(MSG_INFO, "%s: out of memory allocating programmer structure\n", - progname); - exit(1); - } + int *ip = cfg_malloc("pgm_dup()", sizeof(int)); *ip = *(int *) ldata(ln); ladd(pgm->usbpid, ip); } diff --git a/src/pindefs.c b/src/pindefs.c index 625d1f18..2e78c8df 100644 --- a/src/pindefs.c +++ b/src/pindefs.c @@ -350,7 +350,7 @@ const char * pins_to_str(const struct pindef_t * const pindef) { * This function returns a string of defined pins, eg, ~1, 2, ~4, ~5, 7 or "" * * @param[in] pindef the pin definition for which we want the string representation - * @returns a pointer to a string, which was created by strdup (NULL if out of memory) + * @returns a pointer to a string, which was created by strdup */ char *pins_to_strdup(const struct pindef_t * const pindef) { char buf[6*(PIN_MAX+1)], *p = buf; @@ -365,7 +365,7 @@ char *pins_to_strdup(const struct pindef_t * const pindef) { } } - return strdup(buf); + return cfg_strdup("pins_to_strdup()", buf); } /** diff --git a/src/term.c b/src/term.c index f02f95c5..672a09cd 100644 --- a/src/term.c +++ b/src/term.c @@ -20,7 +20,6 @@ #include "ac_cfg.h" -#include #include #include #include @@ -346,178 +345,6 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, } -// Convert the next n hex digits of s to a hex number -static unsigned int tohex(const unsigned char *s, unsigned int n) { - int ret, c; - - ret = 0; - while(n--) { - ret *= 16; - c = *s++; - ret += c >= '0' && c <= '9'? c - '0': c >= 'a' && c <= 'f'? c - 'a' + 10: c - 'A' + 10; - } - - return ret; -} - -/* - * Create a utf-8 character sequence from a single unicode character. - * Permissive for some invalid unicode sequences but not for those with - * high bit set). Returns numbers of characters written (0-6). - */ -static int wc_to_utf8str(unsigned int wc, unsigned char *str) { - if(!(wc & ~0x7fu)) { - *str = (char) wc; - return 1; - } - if(!(wc & ~0x7ffu)) { - *str++ = (char) ((wc >> 6) | 0xc0); - *str++ = (char) ((wc & 0x3f) | 0x80); - return 2; - } - if(!(wc & ~0xffffu)) { - *str++ = (char) ((wc >> 12) | 0xe0); - *str++ = (char) (((wc >> 6) & 0x3f) | 0x80); - *str++ = (char) ((wc & 0x3f) | 0x80); - return 3; - } - if(!(wc & ~0x1fffffu)) { - *str++ = (char) ((wc >> 18) | 0xf0); - *str++ = (char) (((wc >> 12) & 0x3f) | 0x80); - *str++ = (char) (((wc >> 6) & 0x3f) | 0x80); - *str++ = (char) ((wc & 0x3f) | 0x80); - return 4; - } - if(!(wc & ~0x3ffffffu)) { - *str++ = (char) ((wc >> 24) | 0xf8); - *str++ = (char) (((wc >> 18) & 0x3f) | 0x80); - *str++ = (char) (((wc >> 12) & 0x3f) | 0x80); - *str++ = (char) (((wc >> 6) & 0x3f) | 0x80); - *str++ = (char) ((wc & 0x3f) | 0x80); - return 5; - } - if(!(wc & ~0x7fffffffu)) { - *str++ = (char) ((wc >> 30) | 0xfc); - *str++ = (char) (((wc >> 24) & 0x3f) | 0x80); - *str++ = (char) (((wc >> 18) & 0x3f) | 0x80); - *str++ = (char) (((wc >> 12) & 0x3f) | 0x80); - *str++ = (char) (((wc >> 6) & 0x3f) | 0x80); - *str++ = (char) ((wc & 0x3f) | 0x80); - return 6; - } - return 0; -} - -// Unescape C-style strings, destination d must hold enough space (and can be source s) -static unsigned char *unescape(unsigned char *d, const unsigned char *s) { - unsigned char *ret = d; - int n, k; - - while(*s) { - switch (*s) { - case '\\': - switch (*++s) { - case 'n': - *d = '\n'; - break; - case 't': - *d = '\t'; - break; - case 'a': - *d = '\a'; - break; - case 'b': - *d = '\b'; - break; - case 'e': // Non-standard ESC - *d = 27; - break; - case 'f': - *d = '\f'; - break; - case 'r': - *d = '\r'; - break; - case 'v': - *d = '\v'; - break; - case '?': - *d = '?'; - break; - case '`': - *d = '`'; - break; - case '"': - *d = '"'; - break; - case '\'': - *d = '\''; - break; - case '\\': - *d = '\\'; - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': // 1-3 octal digits - n = *s - '0'; - for(k = 0; k < 2 && s[1] >= '0' && s[1] <= '7'; k++) // Max 2 more octal characters - n *= 8, n += s[1] - '0', s++; - *d = n; - break; - case 'x': // Unlimited hex digits - for(k = 0; isxdigit(s[k + 1]); k++) - continue; - if(k > 0) { - *d = tohex(s + 1, k); - s += k; - } else { // No hex digits after \x? copy \x - *d++ = '\\'; - *d = 'x'; - } - break; - case 'u': // Exactly 4 hex digits and valid unicode - if(isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) && - (n = wc_to_utf8str(tohex(s+1, 4), d))) { - d += n - 1; - s += 4; - } else { // Invalid \u sequence? copy \u - *d++ = '\\'; - *d = 'u'; - } - break; - case 'U': // Exactly 6 hex digits and valid unicode - if(isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) && isxdigit(s[5]) && isxdigit(s[6]) && - (n = wc_to_utf8str(tohex(s+1, 6), d))) { - d += n - 1; - s += 6; - } else { // Invalid \U sequence? copy \U - *d++ = '\\'; - *d = 'U'; - } - break; - default: // Keep the escape sequence (C would warn and remove \) - *d++ = '\\'; - *d = *s; - } - break; - - default: // Not an escape sequence: just copy the character - *d = *s; - } - d++; - s++; - } - *d = *s; // Terminate - - return ret; -} - - static size_t maxstrlen(int argc, char **argv) { size_t max = 0; @@ -800,7 +627,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, } // Strip start and end quotes, and unescape C string strncpy(s, argi+1, arglen-2); - unescape((unsigned char *) s, (unsigned char *) s); + cfg_unescape(s, s); if (*argi == '\'') { // Single C-style character if(*s && s[1]) terminal_message(MSG_INFO, "%s (write): only using first character of %s\n", diff --git a/src/update.c b/src/update.c index 2aa2579b..972c3847 100644 --- a/src/update.c +++ b/src/update.c @@ -37,11 +37,7 @@ UPDATE * parse_op(char * s) int i; size_t fnlen; - upd = (UPDATE *)malloc(sizeof(UPDATE)); - if (upd == NULL) { - avrdude_message(MSG_INFO, "%s: out of memory\n", progname); - exit(1); - } + upd = (UPDATE *) cfg_malloc("parse_op()", sizeof(UPDATE)); i = 0; p = s; @@ -52,22 +48,12 @@ UPDATE * parse_op(char * s) if (*p != ':') { upd->memtype = NULL; /* default memtype, "flash", or "application" */ upd->op = DEVICE_WRITE; - upd->filename = (char *)malloc(strlen(buf) + 1); - if (upd->filename == NULL) { - avrdude_message(MSG_INFO, "%s: out of memory\n", progname); - exit(1); - } - strcpy(upd->filename, buf); + upd->filename = cfg_strdup("parse_op()", buf); upd->format = FMT_AUTO; return upd; } - upd->memtype = (char *)malloc(strlen(buf)+1); - if (upd->memtype == NULL) { - avrdude_message(MSG_INFO, "%s: out of memory\n", progname); - exit(1); - } - strcpy(upd->memtype, buf); + upd->memtype = cfg_strdup("parse_op()", buf); p++; if (*p == 'r') { @@ -118,10 +104,10 @@ UPDATE * parse_op(char * s) // and to binary for read operations: upd->format = upd->op == DEVICE_READ? FMT_RBIN: FMT_AUTO; fnlen = strlen(cp); - upd->filename = (char *)malloc(fnlen + 1); + upd->filename = (char *) cfg_malloc("parse_op()", fnlen + 1); } else { fnlen = p - cp; - upd->filename = (char *)malloc(fnlen +1); + upd->filename = (char *) cfg_malloc("parse_op()", fnlen +1); c = *++p; if (c && p[1]) /* More than one char - force failure below. */ @@ -147,12 +133,6 @@ UPDATE * parse_op(char * s) } } - if (upd->filename == NULL) { - avrdude_message(MSG_INFO, "%s: out of memory\n", progname); - free(upd->memtype); - free(upd); - return NULL; - } memcpy(upd->filename, cp, fnlen); upd->filename[fnlen] = 0; @@ -163,19 +143,15 @@ UPDATE * dup_update(UPDATE * upd) { UPDATE * u; - u = (UPDATE *)malloc(sizeof(UPDATE)); - if (u == NULL) { - avrdude_message(MSG_INFO, "%s: out of memory\n", progname); - exit(1); - } + u = (UPDATE *) cfg_malloc("dup_update()", sizeof(UPDATE)); memcpy(u, upd, sizeof(UPDATE)); if (upd->memtype != NULL) - u->memtype = strdup(upd->memtype); + u->memtype = cfg_strdup("dup_update()", upd->memtype); else u->memtype = NULL; - u->filename = strdup(upd->filename); + u->filename = cfg_strdup("dup_update()", upd->filename); return u; } @@ -184,14 +160,10 @@ UPDATE * new_update(int op, char * memtype, int filefmt, char * filename) { UPDATE * u; - u = (UPDATE *)malloc(sizeof(UPDATE)); - if (u == NULL) { - avrdude_message(MSG_INFO, "%s: out of memory\n", progname); - exit(1); - } + u = (UPDATE *) cfg_malloc("new_update()", sizeof(UPDATE)); - u->memtype = strdup(memtype); - u->filename = strdup(filename); + u->memtype = cfg_strdup("new_update()", memtype); + u->filename = cfg_strdup("new_update()", filename); u->op = op; u->format = filefmt; From 7375477f7097b4cb835f4e17889fc0674bb1ed38 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 9 Aug 2022 21:45:04 +0100 Subject: [PATCH 190/511] Replace string arrays with const char * and allocated space (part 1) This commit deals with default_programmer, default_serial, default_parallel and default_spi. The long term objective is to remove all fixed-size buffers from the structures that lexer.l and config_gram.y deal with. --- src/config.c | 8 ++++---- src/config.h | 2 -- src/config_gram.y | 12 ++++-------- src/libavrdude.h | 8 ++++---- src/main.c | 17 +++++++++-------- 5 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/config.c b/src/config.c index 8d99848d..f0b65822 100644 --- a/src/config.c +++ b/src/config.c @@ -33,10 +33,10 @@ #include "config_gram.h" -char default_programmer[MAX_STR_CONST]; -char default_parallel[PATH_MAX]; -char default_serial[PATH_MAX]; -char default_spi[PATH_MAX]; +const char *default_programmer; +const char *default_parallel; +const char *default_serial; +const char *default_spi; double default_bitclock; LISTID string_list; diff --git a/src/config.h b/src/config.h index 260d404a..7b6c6d0d 100644 --- a/src/config.h +++ b/src/config.h @@ -30,8 +30,6 @@ #endif -#define MAX_STR_CONST 1024 - enum { V_NONE, V_NUM, V_NUM_REAL, V_STR }; typedef struct value_t { int type; diff --git a/src/config_gram.y b/src/config_gram.y index 0b9cf6cd..554de900 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -246,26 +246,22 @@ def : part_def TKN_SEMI | K_DEFAULT_PROGRAMMER TKN_EQUAL TKN_STRING TKN_SEMI { - strncpy(default_programmer, $3->value.string, MAX_STR_CONST); - default_programmer[MAX_STR_CONST-1] = 0; + default_programmer = cache_string($3->value.string); free_token($3); } | K_DEFAULT_PARALLEL TKN_EQUAL TKN_STRING TKN_SEMI { - strncpy(default_parallel, $3->value.string, PATH_MAX); - default_parallel[PATH_MAX-1] = 0; + default_parallel = cache_string($3->value.string); free_token($3); } | K_DEFAULT_SERIAL TKN_EQUAL TKN_STRING TKN_SEMI { - strncpy(default_serial, $3->value.string, PATH_MAX); - default_serial[PATH_MAX-1] = 0; + default_serial = cache_string($3->value.string); free_token($3); } | K_DEFAULT_SPI TKN_EQUAL TKN_STRING TKN_SEMI { - strncpy(default_spi, $3->value.string, PATH_MAX); - default_spi[PATH_MAX-1] = 0; + default_spi = cache_string($3->value.string); free_token($3); } | diff --git a/src/libavrdude.h b/src/libavrdude.h index 840d8fc1..3c2f2a57 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -992,10 +992,10 @@ void walk_programmer_types(/*LISTID programmer_types,*/ walk_programmer_types_cb extern LISTID part_list; extern LISTID programmers; -extern char default_programmer[]; -extern char default_parallel[]; -extern char default_serial[]; -extern char default_spi[]; +extern const char *default_programmer; +extern const char *default_parallel; +extern const char *default_serial; +extern const char *default_spi; extern double default_bitclock; /* This name is fixed, it's only here for symmetry with diff --git a/src/main.c b/src/main.c index b696d6d7..08266f00 100644 --- a/src/main.c +++ b/src/main.c @@ -314,10 +314,11 @@ int main(int argc, char * argv []) else progname = argv[0]; - default_parallel[0] = 0; - default_serial[0] = 0; - default_spi[0] = 0; - default_bitclock = 0.0; + default_programmer = ""; + default_parallel = ""; + default_serial = ""; + default_spi = ""; + default_bitclock = 0.0; init_config(); @@ -351,7 +352,7 @@ int main(int argc, char * argv []) quell_progress = 0; exitspecs = NULL; pgm = NULL; - programmer = default_programmer; + programmer = cfg_strdup("main()", default_programmer); verbose = 0; baudrate = 0; bitclock = 0.0; @@ -755,7 +756,7 @@ int main(int argc, char * argv []) int dev_opts = 0; // Developer option -c /[ASsrt] prints programmer description(s) and exits if(programmer && (strcmp(programmer, "*") == 0 || strchr(programmer, '/'))) { - dev_output_pgm_defs(programmer); + dev_output_pgm_defs(cfg_strdup("main()", programmer)); dev_opts = 1; } // Developer option -p /[dASsrcow*t] prints part description(s) and exits @@ -849,11 +850,11 @@ int main(int argc, char * argv []) switch (pgm->conntype) { case CONNTYPE_PARALLEL: - port = default_parallel; + port = cfg_strdup("main()", default_parallel); break; case CONNTYPE_SERIAL: - port = default_serial; + port = cfg_strdup("main()", default_serial); break; case CONNTYPE_USB: From f4c5a8350d9c13aef4c2d085ca9fc9be3b570b46 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 10 Aug 2022 16:14:56 +0100 Subject: [PATCH 191/511] Replace string arrays with const char * and allocated space (part 2) This commit replaces fixed-string buffers in PROGRAMMER, AVRPART and AVRMEM that are dealt with by the parser and grammar. Now, string assignments are always to const char *, ie, these are read-only strings with arbitrary length. config_gram.y now only needs to consider one type of string assignment. This commit also - Replaces the simple linear-search cache_string() function with faster hashed cache_string(). Either way, the returned value is likely to be shared, so should never be free()'d. - Duplicates hvupdi_support list in pgm_dup() and frees it in pgm_free() - Adds const qualifier to some function args in avrpart.c and pgm.c - Hardens some functions against being called with NULL pointers - Ensures _new() and _dup() functions for parts, programmers and memory return a suitable memory. Out of memory triggers exit in one of three functions, cfg_malloc(), cfg_realloc() and cfg_strdup(); there is rarely anything useful that AVRDUDE or, for that matter, any application compiled against libavrdude can do once you run out of memory as AVRDUDE/libavrdude rely heavily on allocation of memory. --- src/avrpart.c | 408 ++++++++++++++++--------------------------- src/config.c | 71 +++++--- src/config.h | 2 +- src/config_gram.y | 54 +----- src/developer_opts.c | 59 ++++--- src/jtagmkI.c | 2 +- src/jtagmkII.c | 2 +- src/lexer.l | 10 +- src/libavrdude.h | 56 +++--- src/main.c | 10 +- src/pgm.c | 137 +++++++-------- src/pickit2.c | 20 ++- src/update.c | 10 +- 13 files changed, 359 insertions(+), 482 deletions(-) diff --git a/src/avrpart.c b/src/avrpart.c index 40baa449..526d0503 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -1,4 +1,3 @@ - /* * avrdude - A Downloader/Uploader for AVR device programmers * Copyright (C) 2000-2004 Brian S. Dean @@ -31,44 +30,23 @@ *** Elementary functions dealing with OPCODE structures ***/ -OPCODE * avr_new_opcode(void) -{ - OPCODE * m; - - m = (OPCODE *)malloc(sizeof(*m)); - if (m == NULL) { - avrdude_message(MSG_INFO, "avr_new_opcode(): out of memory\n"); - exit(1); - } - - memset(m, 0, sizeof(*m)); - - return m; +OPCODE *avr_new_opcode(void) { + return (OPCODE *) cfg_malloc("avr_new_opcode()", sizeof(OPCODE)); } -static OPCODE * avr_dup_opcode(OPCODE * op) -{ - OPCODE * m; - - /* this makes life easier */ - if (op == NULL) { +static OPCODE *avr_dup_opcode(const OPCODE *op) { + if(op == NULL) // Caller wants NULL if op == NULL return NULL; - } - - m = (OPCODE *)malloc(sizeof(*m)); - if (m == NULL) { - avrdude_message(MSG_INFO, "avr_dup_opcode(): out of memory\n"); - exit(1); - } + OPCODE *m = (OPCODE *) cfg_malloc("avr_dup_opcode()", sizeof(*m)); memcpy(m, op, sizeof(*m)); return m; } -void avr_free_opcode(OPCODE * op) -{ - free(op); +void avr_free_opcode(OPCODE *op) { + if(op) + free(op); } @@ -268,11 +246,10 @@ int avr_set_input(OPCODE * op, unsigned char * cmd, unsigned char data) /* * avr_get_output() * - * Retreive output data bits from the command results based on the + * Retrieve output data bits from the command results based on the * opcode data. */ -int avr_get_output(OPCODE * op, unsigned char * res, unsigned char * data) -{ +int avr_get_output(const OPCODE *op, const unsigned char *res, unsigned char *data) { int i, j, bit; unsigned char value; unsigned char mask; @@ -301,8 +278,7 @@ int avr_get_output(OPCODE * op, unsigned char * res, unsigned char * data) * Calculate the byte number of the output data based on the * opcode data. */ -int avr_get_output_index(OPCODE * op) -{ +int avr_get_output_index(const OPCODE *op) { int i, j; for (i=0; i<32; i++) { @@ -353,34 +329,17 @@ static char * bittype(int type) *** Elementary functions dealing with AVRMEM structures ***/ -AVRMEM * avr_new_memtype(void) -{ - AVRMEM * m; - - m = (AVRMEM *)malloc(sizeof(*m)); - if (m == NULL) { - avrdude_message(MSG_INFO, "avr_new_memtype(): out of memory\n"); - exit(1); - } - - memset(m, 0, sizeof(*m)); +AVRMEM *avr_new_memtype(void) { + AVRMEM *m = (AVRMEM *) cfg_malloc("avr_new_memtype()", sizeof(*m)); + m->desc = cache_string(""); m->page_size = 1; // ensure not 0 return m; } -AVRMEM_ALIAS * avr_new_memalias(void) -{ - AVRMEM_ALIAS * m; - - m = (AVRMEM_ALIAS *)malloc(sizeof(*m)); - if (m == NULL) { - avrdude_message(MSG_INFO, "avr_new_memalias(): out of memory\n"); - exit(1); - } - - memset(m, 0, sizeof(*m)); - +AVRMEM_ALIAS *avr_new_memalias(void) { + AVRMEM_ALIAS *m = (AVRMEM_ALIAS *) cfg_malloc("avr_new_memalias()", sizeof*m); + m->desc = cache_string(""); return m; } @@ -389,106 +348,79 @@ AVRMEM_ALIAS * avr_new_memalias(void) * Allocate and initialize memory buffers for each of the device's * defined memory regions. */ -int avr_initmem(AVRPART * p) -{ - LNODEID ln; - AVRMEM * m; +int avr_initmem(const AVRPART *p) { + if(p == NULL || p->mem == NULL) + return -1; - for (ln=lfirst(p->mem); ln; ln=lnext(ln)) { - m = ldata(ln); - m->buf = (unsigned char *) malloc(m->size); - if (m->buf == NULL) { - avrdude_message(MSG_INFO, "%s: can't alloc buffer for %s size of %d bytes\n", - progname, m->desc, m->size); - return -1; - } - m->tags = (unsigned char *) malloc(m->size); - if (m->tags == NULL) { - avrdude_message(MSG_INFO, "%s: can't alloc buffer for %s size of %d bytes\n", - progname, m->desc, m->size); - return -1; - } + for (LNODEID ln=lfirst(p->mem); ln; ln=lnext(ln)) { + AVRMEM *m = ldata(ln); + m->buf = (unsigned char *) cfg_malloc("avr_initmem()", m->size); + m->tags = (unsigned char *) cfg_malloc("avr_initmem()", m->size); } return 0; } -AVRMEM * avr_dup_mem(AVRMEM * m) -{ - AVRMEM * n; - int i; +AVRMEM *avr_dup_mem(const AVRMEM *m) { + AVRMEM *n = avr_new_memtype(); - n = avr_new_memtype(); + if(m) { + *n = *m; - *n = *m; - - if (m->buf != NULL) { - n->buf = (unsigned char *)malloc(n->size); - if (n->buf == NULL) { - avrdude_message(MSG_INFO, "avr_dup_mem(): out of memory (memsize=%d)\n", - n->size); - exit(1); + if(m->buf) { + n->buf = (unsigned char *) cfg_malloc("avr_dup_mem()", n->size); + memcpy(n->buf, m->buf, n->size); } - memcpy(n->buf, m->buf, n->size); - } - if (m->tags != NULL) { - n->tags = (unsigned char *)malloc(n->size); - if (n->tags == NULL) { - avrdude_message(MSG_INFO, "avr_dup_mem(): out of memory (memsize=%d)\n", - n->size); - exit(1); + if(m->tags) { + n->tags = (unsigned char *) cfg_malloc("avr_dup_mem()", n->size); + memcpy(n->tags, m->tags, n->size); } - memcpy(n->tags, m->tags, n->size); - } - for (i = 0; i < AVR_OP_MAX; i++) { - n->op[i] = avr_dup_opcode(n->op[i]); + for(int i = 0; i < AVR_OP_MAX; i++) + n->op[i] = avr_dup_opcode(n->op[i]); } return n; } -AVRMEM_ALIAS * avr_dup_memalias(AVRMEM_ALIAS * m) -{ - AVRMEM_ALIAS * n; +AVRMEM_ALIAS *avr_dup_memalias(const AVRMEM_ALIAS *m) { + AVRMEM_ALIAS *n = avr_new_memalias(); - n = avr_new_memalias(); - - *n = *m; + if(m) + *n = *m; return n; } -void avr_free_mem(AVRMEM * m) -{ - if (m->buf != NULL) { - free(m->buf); - m->buf = NULL; - } - if (m->tags != NULL) { - free(m->tags); - m->tags = NULL; - } - for(size_t i=0; iop)/sizeof(m->op[0]); i++) - { - if (m->op[i] != NULL) - { - avr_free_opcode(m->op[i]); - m->op[i] = NULL; - } - } - free(m); -} +void avr_free_mem(AVRMEM * m) { + if(m == NULL) + return; -void avr_free_memalias(AVRMEM_ALIAS * m) -{ + if(m->buf) { + free(m->buf); + m->buf = NULL; + } + if(m->tags) { + free(m->tags); + m->tags = NULL; + } + for(size_t i=0; iop)/sizeof(m->op[0]); i++) { + if(m->op[i]) { + avr_free_opcode(m->op[i]); + m->op[i] = NULL; + } + } free(m); } -AVRMEM_ALIAS * avr_locate_memalias(AVRPART * p, const char * desc) -{ +void avr_free_memalias(AVRMEM_ALIAS *m) { + if(m) + free(m); +} + +AVRMEM_ALIAS *avr_locate_memalias(const AVRPART *p, const char *desc) { AVRMEM_ALIAS * m, * match; LNODEID ln; int matches; @@ -514,8 +446,7 @@ AVRMEM_ALIAS * avr_locate_memalias(AVRPART * p, const char * desc) return NULL; } -AVRMEM * avr_locate_mem_noalias(AVRPART * p, const char * desc) -{ +AVRMEM *avr_locate_mem_noalias(const AVRPART *p, const char *desc) { AVRMEM * m, * match; LNODEID ln; int matches; @@ -542,8 +473,7 @@ AVRMEM * avr_locate_mem_noalias(AVRPART * p, const char * desc) } -AVRMEM * avr_locate_mem(AVRPART * p, const char * desc) -{ +AVRMEM *avr_locate_mem(const AVRPART *p, const char *desc) { AVRMEM * m, * match; AVRMEM_ALIAS * alias; LNODEID ln; @@ -577,24 +507,20 @@ AVRMEM * avr_locate_mem(AVRPART * p, const char * desc) return NULL; } -AVRMEM_ALIAS * avr_find_memalias(AVRPART * p, AVRMEM * m_orig) -{ - AVRMEM_ALIAS * m; - LNODEID ln; - - for (ln=lfirst(p->mem_alias); ln; ln=lnext(ln)) { - m = ldata(ln); - if (m->aliased_mem == m_orig) - return m; - } +AVRMEM_ALIAS *avr_find_memalias(const AVRPART *p, const AVRMEM *m_orig) { + if(p && p->mem_alias && m_orig) + for(LNODEID ln=lfirst(p->mem_alias); ln; ln=lnext(ln)) { + AVRMEM_ALIAS *m = ldata(ln); + if(m->aliased_mem == m_orig) + return m; + } return NULL; } -void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, - int type, int verbose) -{ +void avr_mem_display(const char *prefix, FILE *f, const AVRMEM *m, + const AVRPART *p, int verbose) { static unsigned int prev_mem_offset; static int prev_mem_size; int i, j; @@ -623,7 +549,7 @@ void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, AVRMEM_ALIAS *ap = avr_find_memalias(p, m); /* Show alias if the current and the next memory section has the same offset and size, we're not out of band and a family_id is present */ - char * mem_desc_alias = ap? ap->desc: ""; + const char *mem_desc_alias = ap? ap->desc: ""; fprintf(f, "%s%-11s %-8s %4d %5d %5d %4d %-6s %6d %4d %6d %5d %5d 0x%02x 0x%02x\n", prefix, @@ -669,74 +595,63 @@ void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, * Elementary functions dealing with AVRPART structures */ -AVRPART * avr_new_part(void) -{ - AVRPART * p; +AVRPART *avr_new_part(void) { + AVRPART *p = (AVRPART *) cfg_malloc("avr_new_part()", sizeof(AVRPART)); const char *nulp = cache_string(""); - p = (AVRPART *)malloc(sizeof(AVRPART)); - if (p == NULL) { - avrdude_message(MSG_INFO, "new_part(): out of memory\n"); - exit(1); - } - memset(p, 0, sizeof(*p)); - p->id[0] = 0; - p->desc[0] = 0; + // Initialise const char * and LISTID entities + p->desc = nulp; + p->id = nulp; + p->parent_id = nulp; + p->family_id = nulp; + p->config_file = nulp; + p->mem = lcreat(NULL, 0); + p->mem_alias = lcreat(NULL, 0); + + // Default values + p->hvupdi_variant = -1; + memset(p->signature, 0xFF, 3); p->reset_disposition = RESET_DEDICATED; p->retry_pulse = PIN_AVR_SCK; p->flags = AVRPART_SERIALOK | AVRPART_PARALLELOK | AVRPART_ENABLEPAGEPROGRAMMING; - p->parent_id = nulp; - p->config_file = nulp; - p->lineno = 0; - memset(p->signature, 0xFF, 3); p->ctl_stack_type = CTL_STACK_NONE; p->ocdrev = -1; - p->hvupdi_variant = -1; - - p->mem = lcreat(NULL, 0); - p->mem_alias = lcreat(NULL, 0); + p->lineno = 0; return p; } -AVRPART * avr_dup_part(AVRPART * d) -{ - AVRPART * p; - LISTID save, save2; - LNODEID ln, ln2; - int i; +AVRPART *avr_dup_part(const AVRPART *d) { + AVRPART *p = avr_new_part(); - p = avr_new_part(); - save = p->mem; - save2 = p->mem_alias; + if(d) { + *p = *d; - *p = *d; + // Duplicate the memory and alias chains + p->mem = lcreat(NULL, 0); + p->mem_alias = lcreat(NULL, 0); - p->mem = save; - p->mem_alias = save2; - for (ln=lfirst(d->mem); ln; ln=lnext(ln)) { - AVRMEM *m = ldata(ln); - AVRMEM *m2 = avr_dup_mem(m); - ladd(p->mem, m2); - // see if there is any alias for it - for (ln2=lfirst(d->mem_alias); ln2; ln2=lnext(ln2)) { - AVRMEM_ALIAS *a = ldata(ln2); - if (a->aliased_mem == m) { - // yes, duplicate it - AVRMEM_ALIAS *a2 = avr_dup_memalias(a); - // ... adjust the pointer ... - a2->aliased_mem = m2; - // ... and add to new list - ladd(p->mem_alias, a2); + for(LNODEID ln=lfirst(d->mem); ln; ln=lnext(ln)) { + AVRMEM *m = ldata(ln); + AVRMEM *m2 = avr_dup_mem(m); + ladd(p->mem, m2); + // See if there is any alias for it + for(LNODEID ln2=lfirst(d->mem_alias); ln2; ln2=lnext(ln2)) { + AVRMEM_ALIAS *a = ldata(ln2); + if (a->aliased_mem == m) { + // Yes, duplicate it, adjust the pointer and add to new list + AVRMEM_ALIAS *a2 = avr_dup_memalias(a); + a2->aliased_mem = m2; + ladd(p->mem_alias, a2); + } } } - } - for (i = 0; i < AVR_OP_MAX; i++) { - p->op[i] = avr_dup_opcode(p->op[i]); + for(int i = 0; i < AVR_OP_MAX; i++) + p->op[i] = avr_dup_opcode(p->op[i]); } return p; @@ -758,61 +673,45 @@ void avr_free_part(AVRPART * d) free(d); } -AVRPART * locate_part(LISTID parts, const char * partdesc) -{ - LNODEID ln1; +AVRPART *locate_part(const LISTID parts, const char *partdesc) { AVRPART * p = NULL; - int found; + int found = 0; if(!parts || !partdesc) return NULL; - found = 0; - - for (ln1=lfirst(parts); ln1 && !found; ln1=lnext(ln1)) { + for (LNODEID ln1=lfirst(parts); ln1 && !found; ln1=lnext(ln1)) { p = ldata(ln1); if ((strcasecmp(partdesc, p->id) == 0) || (strcasecmp(partdesc, p->desc) == 0)) found = 1; } - if (found) - return p; - - return NULL; + return found? p: NULL; } -AVRPART * locate_part_by_avr910_devcode(LISTID parts, int devcode) -{ - LNODEID ln1; - AVRPART * p = NULL; - - for (ln1=lfirst(parts); ln1; ln1=lnext(ln1)) { - p = ldata(ln1); - if (p->avr910_devcode == devcode) - return p; - } - - return NULL; -} - -AVRPART * locate_part_by_signature(LISTID parts, unsigned char * sig, - int sigsize) -{ - LNODEID ln1; - AVRPART * p = NULL; - int i; - - if (sigsize == 3) { - for (ln1=lfirst(parts); ln1; ln1=lnext(ln1)) { - p = ldata(ln1); - for (i=0; i<3; i++) - if (p->signature[i] != sig[i]) - break; - if (i == 3) +AVRPART *locate_part_by_avr910_devcode(const LISTID parts, int devcode) { + if(parts) + for (LNODEID ln1=lfirst(parts); ln1; ln1=lnext(ln1)) { + AVRPART * p = ldata(ln1); + if (p->avr910_devcode == devcode) + return p; + } + + return NULL; +} + +AVRPART *locate_part_by_signature(const LISTID parts, unsigned char *sig, int sigsize) { + if(parts && sigsize == 3) + for(LNODEID ln1=lfirst(parts); ln1; ln1=lnext(ln1)) { + AVRPART *p = ldata(ln1); + int i; + for(i=0; i<3; i++) + if(p->signature[i] != sig[i]) + break; + if(i == 3) return p; } - } return NULL; } @@ -841,12 +740,11 @@ void walk_avrparts(LISTID avrparts, walk_avrparts_cb cb, void *cookie) /* * Compare function to sort the list of programmers */ -static int sort_avrparts_compare(AVRPART * p1,AVRPART * p2) -{ - if(p1 == NULL || p2 == NULL) { +static int sort_avrparts_compare(const AVRPART *p1, const AVRPART *p2) { + if(p1 == NULL || p1->desc == NULL || p2 == NULL || p2->desc == NULL) return 0; - } - return strncasecmp(p1->desc,p2->desc,AVR_DESCLEN); + + return strcasecmp(p1->desc, p2->desc); } /* @@ -868,9 +766,7 @@ static char * reset_disp_str(int r) } -void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose) -{ - int i; +void avr_display(FILE *f, const AVRPART *p, const char *prefix, int verbose) { char * buf; const char * px; LNODEID ln; @@ -905,23 +801,17 @@ void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose) fprintf( f, "%sMemory Detail :\n\n", prefix); px = prefix; - i = strlen(prefix) + 5; - buf = (char *)malloc(i); - if (buf == NULL) { - /* ugh, this is not important enough to bail, just ignore it */ - } - else { - strcpy(buf, prefix); - strcat(buf, " "); - px = buf; - } + buf = (char *)cfg_malloc("avr_display()", strlen(prefix) + 5); + strcpy(buf, prefix); + strcat(buf, " "); + px = buf; + + if (verbose <= 2) + avr_mem_display(px, f, NULL, p, verbose); - if (verbose <= 2) { - avr_mem_display(px, f, NULL, p, 0, verbose); - } for (ln=lfirst(p->mem); ln; ln=lnext(ln)) { m = ldata(ln); - avr_mem_display(px, f, m, p, i, verbose); + avr_mem_display(px, f, m, p, verbose); } if (buf) diff --git a/src/config.c b/src/config.c index f0b65822..ac712b17 100644 --- a/src/config.c +++ b/src/config.c @@ -83,13 +83,24 @@ int init_config(void) void *cfg_malloc(const char *funcname, size_t n) { void *ret = malloc(n); if(!ret) { - avrdude_message(MSG_INFO, "%s: out of memory in %s\n", progname, funcname); + avrdude_message(MSG_INFO, "%s: out of memory in %s (needed %lu bytes)\n", progname, funcname, (unsigned long) n); exit(1); } memset(ret, 0, n); return ret; } +void *cfg_realloc(const char *funcname, void *p, size_t n) { + void *ret; + + if(!(ret = p? realloc(p, n): calloc(1, n))) { + avrdude_message(MSG_INFO, "%s: out of memory in %s (needed %lu bytes)\n", progname, funcname, (unsigned long) n); + exit(1); + } + + return ret; +} + char *cfg_strdup(const char *funcname, const char *s) { char *ret = strdup(s); @@ -323,35 +334,45 @@ int read_config(const char * file) } -// Linear-search cache for a few often-referenced strings -const char *cache_string(const char *file) { - static char **fnames; - static int n=0; +// Adapted version of a neat empirical hash function from comp.lang.c by Daniel Bernstein +unsigned strhash(const char *str) { + unsigned c, hash = 5381, n = 0; - if(!file) - return NULL; + while((c = (unsigned char) *str++) && n++ < 20) + hash = 33*hash ^ c; - // Exists in cache? - for(int i=0; iconfig_file = cache_string(cfg_infile); current_prog->lineno = cfg_lineno; } @@ -325,11 +321,6 @@ prog_decl : YYABORT; } current_prog = pgm_dup(pgm); - if (current_prog == NULL) { - yyerror("could not duplicate pgm instance"); - free_token($3); - YYABORT; - } current_prog->parent_id = cache_string($3->value.string); current_prog->config_file = cache_string(cfg_infile); current_prog->lineno = cfg_lineno; @@ -400,10 +391,6 @@ part_decl : K_PART { current_part = avr_new_part(); - if (current_part == NULL) { - yyerror("could not create part instance"); - YYABORT; - } current_part->config_file = cache_string(cfg_infile); current_part->lineno = cfg_lineno; } | @@ -417,11 +404,6 @@ part_decl : } current_part = avr_dup_part(parent_part); - if (current_part == NULL) { - yyerror("could not duplicate part instance"); - free_token($3); - YYABORT; - } current_part->parent_id = cache_string($3->value.string); current_part->config_file = cache_string(cfg_infile); current_part->lineno = cfg_lineno; @@ -465,8 +447,7 @@ prog_parm : prog_parm_conntype | K_DESC TKN_EQUAL TKN_STRING { - strncpy(current_prog->desc, $3->value.string, PGM_DESCLEN); - current_prog->desc[PGM_DESCLEN-1] = 0; + current_prog->desc = cache_string($3->value.string); free_token($3); } | K_BAUDRATE TKN_EQUAL TKN_NUMBER { @@ -686,22 +667,19 @@ retry_lines : part_parm : K_ID TKN_EQUAL TKN_STRING { - strncpy(current_part->id, $3->value.string, AVR_IDLEN); - current_part->id[AVR_IDLEN-1] = 0; + current_part->id = cache_string($3->value.string); free_token($3); } | K_DESC TKN_EQUAL TKN_STRING { - strncpy(current_part->desc, $3->value.string, AVR_DESCLEN - 1); - current_part->desc[AVR_DESCLEN-1] = 0; + current_part->desc = cache_string($3->value.string); free_token($3); } | K_FAMILY_ID TKN_EQUAL TKN_STRING { - strncpy(current_part->family_id, $3->value.string, AVR_FAMILYIDLEN); - current_part->family_id[AVR_FAMILYIDLEN] = 0; + current_part->family_id = cache_string($3->value.string); free_token($3); } | @@ -1289,13 +1267,8 @@ part_parm : { /* select memory for extension or create if not there */ AVRMEM *mem = avr_locate_mem_noalias(current_part, $2->value.string); if(!mem) { - if(!(mem = avr_new_memtype())) { - yyerror("could not create mem instance"); - free_token($2); - YYABORT; - } - strncpy(mem->desc, $2->value.string, AVR_MEMDESCLEN - 1); - mem->desc[AVR_MEMDESCLEN-1] = 0; + mem = avr_new_memtype(); + mem->desc = cache_string($2->value.string); ladd(current_part->mem, mem); } avr_add_mem_order($2->value.string); @@ -1339,11 +1312,6 @@ part_parm : opnum = which_opcode($1); if (opnum < 0) YYABORT; op = avr_new_opcode(); - if (op == NULL) { - yyerror("could not create opcode instance"); - free_token($1); - YYABORT; - } if(0 != parse_cmdbits(op, opnum)) YYABORT; if (current_part->op[opnum] != NULL) { @@ -1500,11 +1468,6 @@ mem_spec : opnum = which_opcode($1); if (opnum < 0) YYABORT; op = avr_new_opcode(); - if (op == NULL) { - yyerror("could not create opcode instance"); - free_token($1); - YYABORT; - } if(0 != parse_cmdbits(op, opnum)) YYABORT; if (current_mem->op[opnum] != NULL) { @@ -1553,10 +1516,7 @@ mem_alias : is_alias = true; alias = avr_new_memalias(); - - // alias->desc and current_mem->desc have the same length - // definition, thus no need to check for length here - strcpy(alias->desc, current_mem->desc); + alias->desc = current_mem->desc; alias->aliased_mem = existing_mem; ladd(current_part->mem_alias, alias); diff --git a/src/developer_opts.c b/src/developer_opts.c index 6cbfa4f2..f176563e 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -222,7 +222,7 @@ int dev_message(int msglvl, const char *fmt, ...) { -static int dev_part_strct_entry(bool tsv, char *col0, char *col1, char *col2, const char *name, char *cont) { +static int dev_part_strct_entry(bool tsv, const char *col0, const char *col1, const char *col2, const char *name, char *cont) { const char *n = name? name: "name_error"; const char *c = cont? cont: "cont_error"; @@ -286,23 +286,22 @@ static int intcmp(int a, int b) { // Deep copies for comparison and raw output typedef struct { + char descbuf[32]; AVRMEM base; OPCODE ops[AVR_OP_MAX]; } AVRMEMdeep; static int avrmem_deep_copy(AVRMEMdeep *d, AVRMEM *m) { - size_t len; - d->base = *m; - // Zap all bytes beyond terminating nul of desc array - len = strlen(m->desc)+1; - if(len < sizeof m->desc) - memset(d->base.desc + len, 0, sizeof m->desc - len); + // Note memory desc (name, really) is limited to 31 char here + memset(d->descbuf, 0, sizeof d->descbuf); + strncpy(d->descbuf, m->desc, sizeof d->descbuf-1); // Zap address values d->base.buf = NULL; d->base.tags = NULL; + d->base.desc = NULL; for(int i=0; ibase.op[i] = NULL; @@ -334,6 +333,9 @@ static int memorycmp(AVRMEM *m1, AVRMEM *m2) { typedef struct { + char descbuf[64]; + char idbuf[32]; + char family_idbuf[16]; AVRPART base; OPCODE ops[AVR_OP_MAX]; AVRMEMdeep mems[40]; @@ -341,7 +343,7 @@ typedef struct { static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { AVRMEM *m; - size_t len, di; + size_t di; memset(d, 0, sizeof *d); @@ -351,20 +353,21 @@ static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { d->base.config_file = NULL; d->base.lineno = 0; - // Zap all bytes beyond terminating nul of desc, id and family_id array - len = strlen(p->desc); - if(len < sizeof p->desc) - memset(d->base.desc + len, 0, sizeof p->desc - len); - - len = strlen(p->family_id); - if(len < sizeof p->family_id) - memset(d->base.family_id + len, 0, sizeof p->family_id - len); - - len = strlen(p->id); - if(len < sizeof p->id) - memset(d->base.id + len, 0, sizeof p->id - len); + // Copy over desc, id, and family_id + memset(d->descbuf, 0, sizeof d->descbuf); + if(d->descbuf) + strncpy(d->descbuf, p->desc, sizeof d->descbuf-1); + memset(d->idbuf, 0, sizeof d->idbuf); + if(d->idbuf) + strncpy(d->idbuf, p->id, sizeof d->idbuf-1); + memset(d->family_idbuf, 0, sizeof d->family_idbuf); + if(d->family_idbuf) + strncpy(d->family_idbuf, p->family_id, sizeof d->family_idbuf-1); // Zap address values + d->base.desc = NULL; + d->base.id = NULL; + d->base.family_id = NULL; d->base.mem = NULL; d->base.mem_alias = NULL; for(int i=0; i ' ' && in < 0x7f? in: '.'; + return in == 0? '.': in > ' ' && in < 0x7f? in: '_'; } static void dev_raw_dump(const char *p, int nbytes, const char *name, const char *sub, int idx) { int n = (nbytes + 31)/32; for(int i=0; idesc, "ops", 1); for(int i=0; idesc, dp.mems[i].base.desc, i+2); + dev_raw_dump((char *) (dp.mems+i), sizeof dp.mems[i], part->desc, dp.mems[i].descbuf, i+2); } @@ -680,7 +683,10 @@ void dev_output_part_defs(char *partdesc) { avr_add_mem_order(((AVRMEM_ALIAS *) ldata(lnm))->desc); } - nprinted = dev_nprinted; + if((nprinted = dev_nprinted)) { + dev_info("\n"); + nprinted = dev_nprinted; + } for(LNODEID ln1 = lfirst(part_list); ln1; ln1 = lnext(ln1)) { AVRPART *p = ldata(ln1); int flashsize, flashoffset, flashpagesize, eepromsize , eepromoffset, eeprompagesize; @@ -914,6 +920,8 @@ static void dev_pgm_raw(PROGRAMMER *pgm) { for(idx=0, ln=lfirst(dp.hvupdi_support); ln; ln=lnext(ln)) dev_raw_dump(ldata(ln), sizeof(int), id, "hvupdi_", idx++); + if(dp.desc) + dev_raw_dump(dp.desc, strlen(dp.desc)+1, id, "desc", 0); // Dump cache_string values if(dp.usbdev && *dp.usbdev) dev_raw_dump(dp.usbdev, strlen(dp.usbdev)+1, id, "usbdev", 0); @@ -925,14 +933,13 @@ static void dev_pgm_raw(PROGRAMMER *pgm) { dev_raw_dump(dp.usbproduct, strlen(dp.usbproduct)+1, id, "usbprod", 0); // Zap all bytes beyond terminating nul of desc, type and port array - if((len = strlen(dp.desc)+1) < sizeof dp.desc) - memset(dp.desc + len, 0, sizeof dp.desc - len); if((len = strlen(dp.type)+1) < sizeof dp.type) memset(dp.type + len, 0, sizeof dp.type - len); if((len = strlen(dp.port)+1) < sizeof dp.port) memset(dp.port + len, 0, sizeof dp.port - len); // Zap address values + dp.desc = NULL; dp.id = NULL; dp.parent_id = NULL; dp.initpgm = NULL; diff --git a/src/jtagmkI.c b/src/jtagmkI.c index e5d3d5d8..2e84eb5c 100644 --- a/src/jtagmkI.c +++ b/src/jtagmkI.c @@ -609,7 +609,7 @@ static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p) if (jtagmkI_reset(pgm) < 0) return -1; - strcpy(hfuse.desc, "hfuse"); + hfuse.desc = cache_string("hfuse"); if (jtagmkI_read_byte(pgm, p, &hfuse, 1, &b) < 0) return -1; if ((b & OCDEN) != 0) diff --git a/src/jtagmkII.c b/src/jtagmkII.c index 7181d186..f52f3bc3 100644 --- a/src/jtagmkII.c +++ b/src/jtagmkII.c @@ -1439,7 +1439,7 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p) } if ((pgm->flag & PGM_FL_IS_JTAG) && !(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))) { - strcpy(hfuse.desc, "hfuse"); + hfuse.desc = cache_string("hfuse"); if (jtagmkII_read_byte(pgm, p, &hfuse, 1, &b) < 0) return -1; if ((b & OCDEN) != 0) diff --git a/src/lexer.l b/src/lexer.l index 23fd2277..47c3cb25 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -45,8 +45,6 @@ DIGIT [0-9] HEXDIGIT [0-9a-fA-F] SIGN [+-] -%x incl -%x comment %option nounput /* Bump resources for classic lex. */ @@ -73,16 +71,12 @@ SIGN [+-] 0x{HEXDIGIT}+ { yylval = hexnumber(yytext); return TKN_NUMBER; } -# { /* The following captures all '#' style comments to end of line */ - BEGIN(comment); } -[^\n]*\n+ { /* eat comments */ - capture_comment_char('#'); +#[^\n]*\n+ { /* record and skip # comments */ + capture_comment_str(yytext); for(int i=0; yytext[i]; i++) { - capture_comment_char(yytext[i]); if(yytext[i] == '\n') cfg_lineno++; } - BEGIN(INITIAL); } diff --git a/src/libavrdude.h b/src/libavrdude.h index 3c2f2a57..cbbc8a79 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -203,8 +203,6 @@ typedef struct opcode { #define HV_UPDI_VARIANT_1 1 /* Dedicated UPDI pin, no HV (megaAVR0/AVR-Dx) */ #define HV_UPDI_VARIANT_2 2 /* Shared UPDI pin, HV on _RESET (AVR-Ex) */ -#define AVR_DESCLEN 64 -#define AVR_IDLEN 32 #define AVR_FAMILYIDLEN 7 #define AVR_SIBLEN 16 #define CTL_STACK_SIZE 32 @@ -215,10 +213,10 @@ typedef struct opcode { /* Any changes here, please also reflect in dev_part_strct() of developer_opts.c */ typedef struct avrpart { - char desc[AVR_DESCLEN]; /* long part name */ - char id[AVR_IDLEN]; /* short part name */ + const char * desc; /* long part name */ + const char * id; /* short part name */ const char * parent_id; /* parent id if set, for -p.../s */ - char family_id[AVR_FAMILYIDLEN+1]; /* family id in the SIB (avr8x) */ + const char * family_id; /* family id in the SIB (avr8x) */ int hvupdi_variant; /* HV pulse on UPDI pin, no pin or RESET pin */ int stk500_devcode; /* stk500 device code */ int avr910_devcode; /* avr910 device code */ @@ -286,7 +284,7 @@ typedef struct avrpart { #define AVR_MEMDESCLEN 64 typedef struct avrmem { - char desc[AVR_MEMDESCLEN]; /* memory description ("flash", "eeprom", etc) */ + const char *desc; /* memory description ("flash", "eeprom", etc) */ int paged; /* page addressed (e.g. ATmega flash) */ int size; /* total memory size in bytes */ int page_size; /* size of memory page (if page addressed) */ @@ -312,7 +310,7 @@ typedef struct avrmem { } AVRMEM; typedef struct avrmem_alias { - char desc[AVR_MEMDESCLEN]; /* alias name ("syscfg0" etc.) */ + const char *desc; /* alias name ("syscfg0" etc.) */ AVRMEM *aliased_mem; } AVRMEM_ALIAS; @@ -330,8 +328,8 @@ int avr_set_bits(OPCODE * op, unsigned char * cmd); int avr_set_addr(OPCODE * op, unsigned char * cmd, unsigned long addr); int avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long addr); int avr_set_input(OPCODE * op, unsigned char * cmd, unsigned char data); -int avr_get_output(OPCODE * op, unsigned char * res, unsigned char * data); -int avr_get_output_index(OPCODE * op); +int avr_get_output(const OPCODE *op, const unsigned char *res, unsigned char *data); +int avr_get_output_index(const OPCODE *op); char cmdbitchar(CMDBIT cb); char *cmdbitstr(CMDBIT cb); const char *opcodename(int opnum); @@ -340,26 +338,26 @@ char *opcode2str(OPCODE *op, int opnum, int detailed); /* Functions for AVRMEM structures */ AVRMEM * avr_new_memtype(void); AVRMEM_ALIAS * avr_new_memalias(void); -int avr_initmem(AVRPART * p); -AVRMEM * avr_dup_mem(AVRMEM * m); +int avr_initmem(const AVRPART *p); +AVRMEM * avr_dup_mem(const AVRMEM *m); void avr_free_mem(AVRMEM * m); void avr_free_memalias(AVRMEM_ALIAS * m); -AVRMEM * avr_locate_mem(AVRPART * p, const char * desc); -AVRMEM * avr_locate_mem_noalias(AVRPART * p, const char * desc); -AVRMEM_ALIAS * avr_locate_memalias(AVRPART * p, const char * desc); -AVRMEM_ALIAS * avr_find_memalias(AVRPART * p, AVRMEM * m_orig); -void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, - int type, int verbose); +AVRMEM * avr_locate_mem(const AVRPART *p, const char *desc); +AVRMEM * avr_locate_mem_noalias(const AVRPART *p, const char *desc); +AVRMEM_ALIAS * avr_locate_memalias(const AVRPART *p, const char *desc); +AVRMEM_ALIAS * avr_find_memalias(const AVRPART *p, const AVRMEM *m_orig); +void avr_mem_display(const char *prefix, FILE *f, const AVRMEM *m, + const AVRPART *p, int verbose); /* Functions for AVRPART structures */ AVRPART * avr_new_part(void); -AVRPART * avr_dup_part(AVRPART * d); +AVRPART * avr_dup_part(const AVRPART *d); void avr_free_part(AVRPART * d); -AVRPART * locate_part(LISTID parts, const char * partdesc); -AVRPART * locate_part_by_avr910_devcode(LISTID parts, int devcode); -AVRPART * locate_part_by_signature(LISTID parts, unsigned char * sig, +AVRPART * locate_part(const LISTID parts, const char *partdesc); +AVRPART * locate_part_by_avr910_devcode(const LISTID parts, int devcode); +AVRPART * locate_part_by_signature(const LISTID parts, unsigned char *sig, int sigsize); -void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose); +void avr_display(FILE *f, const AVRPART *p, const char *prefix, int verbose); typedef void (*walk_avrparts_cb)(const char *name, const char *desc, const char *cfgname, int cfglineno, @@ -653,7 +651,6 @@ extern struct serial_device usbhid_serdev; #define ON 1 #define OFF 0 -#define PGM_DESCLEN 80 #define PGM_PORTLEN PATH_MAX #define PGM_TYPELEN 32 @@ -685,7 +682,7 @@ typedef enum { /* Any changes here, please also reflect in dev_pgm_strct() of developer_opts.c */ typedef struct programmer_t { LISTID id; - char desc[PGM_DESCLEN]; + const char *desc; void (*initpgm)(struct programmer_t *pgm); const char *parent_id; // Used by developer options -c*/[sr...] struct pindef_t pin[N_PINS]; @@ -762,6 +759,7 @@ typedef struct programmer_t { int (*parseextparams) (struct programmer_t * pgm, LISTID xparams); void (*setup) (struct programmer_t * pgm); void (*teardown) (struct programmer_t * pgm); + const char *config_file; // Config file where defined int lineno; // Config file line number void *cookie; // For private use by the programmer @@ -773,8 +771,8 @@ extern "C" { #endif PROGRAMMER * pgm_new(void); -PROGRAMMER * pgm_dup(const PROGRAMMER * const src); -void pgm_free(PROGRAMMER * const p); +PROGRAMMER * pgm_dup(const PROGRAMMER *src); +void pgm_free(PROGRAMMER *p); void programmer_display(PROGRAMMER * pgm, const char * p); @@ -783,10 +781,10 @@ void programmer_display(PROGRAMMER * pgm, const char * p); #define SHOW_PPI_PINS ((1<read_sib(pgm, p, sib); avrdude_message(MSG_NOTICE, "%s: System Information Block: \"%s\"\n", progname, sib); - if (quell_progress < 2) { + if (quell_progress < 2) avrdude_message(MSG_INFO, "%s: Received FamilyID: \"%.*s\"\n", progname, AVR_FAMILYIDLEN, sib); - } + if (strncmp(p->family_id, sib, AVR_FAMILYIDLEN)) { avrdude_message(MSG_INFO, "%s: Expected FamilyID: \"%s\"\n", progname, p->family_id); if (!ovsigck) { @@ -1093,9 +1093,8 @@ int main(int argc, char * argv []) avrdude_message(MSG_INFO, "%s: conflicting -e and -n options specified, NOT erasing chip\n", progname); } else { - if (quell_progress < 2) { + if (quell_progress < 2) avrdude_message(MSG_INFO, "%s: erasing chip\n", progname); - } exitrc = avr_unlock(pgm, p); if(exitrc) goto main_exit; goto sig_again; @@ -1229,9 +1228,8 @@ int main(int argc, char * argv []) avrdude_message(MSG_INFO, "%s: conflicting -e and -n options specified, NOT erasing chip\n", progname); } else { - if (quell_progress < 2) { + if (quell_progress < 2) avrdude_message(MSG_INFO, "%s: erasing chip\n", progname); - } exitrc = avr_chip_erase(pgm, p); if(exitrc) goto main_exit; } diff --git a/src/pgm.c b/src/pgm.c index 07cbed57..518b208e 100644 --- a/src/pgm.c +++ b/src/pgm.c @@ -61,31 +61,29 @@ static void pgm_default_powerup_powerdown (struct programmer_t * pgm) } -PROGRAMMER * pgm_new(void) -{ - int i; - PROGRAMMER * pgm; +PROGRAMMER *pgm_new(void) { + PROGRAMMER *pgm = (PROGRAMMER *) cfg_malloc("pgm_new()", sizeof(*pgm)); const char *nulp = cache_string(""); - pgm = (PROGRAMMER *) cfg_malloc("pgm_new()", sizeof(*pgm)); - + // Initialise const char * and LISTID entities pgm->id = lcreat(NULL, 0); pgm->usbpid = lcreat(NULL, 0); - pgm->desc[0] = 0; - pgm->type[0] = 0; - pgm->parent_id = nulp; - pgm->config_file = nulp; - pgm->lineno = 0; - pgm->baudrate = 0; - pgm->initpgm = NULL; pgm->hvupdi_support = lcreat(NULL, 0); - + pgm->desc = nulp; + pgm->parent_id = nulp; pgm->usbdev = nulp; pgm->usbsn = nulp; pgm->usbvendor = nulp; pgm->usbproduct = nulp; + pgm->config_file = nulp; - for (i=0; iinitpgm = NULL; + pgm->lineno = 0; + pgm->baudrate = 0; + + // Clear pin array + for(int i=0; ipinno[i] = 0; pin_clear_all(&(pgm->pin[i])); } @@ -121,49 +119,70 @@ PROGRAMMER * pgm_new(void) * optional functions - these are checked to make sure they are * assigned before they are called */ + pgm->unlock = NULL; pgm->cmd = NULL; pgm->cmd_tpi = NULL; pgm->spi = NULL; pgm->paged_write = NULL; pgm->paged_load = NULL; + pgm->page_erase = NULL; pgm->write_setup = NULL; pgm->read_sig_bytes = NULL; + pgm->read_sib = NULL; + pgm->print_parms = NULL; pgm->set_vtarget = NULL; pgm->set_varef = NULL; pgm->set_fosc = NULL; + pgm->set_sck_period = NULL; + pgm->setpin = NULL; + pgm->getpin = NULL; + pgm->highpulsepin = NULL; + pgm->parseexitspecs = NULL; pgm->perform_osccal = NULL; pgm->parseextparams = NULL; pgm->setup = NULL; pgm->teardown = NULL; + // For allocating "global" memory by the programmer + pgm->cookie = NULL; + return pgm; } -void pgm_free(PROGRAMMER * const p) -{ - ldestroy_cb(p->id, free); - ldestroy_cb(p->usbpid, free); - p->id = NULL; - p->usbpid = NULL; - /* do not free p->parent_id, p->config_file, p->usbdev, p->usbsn, p->usbvendor or p-> usbproduct */ - /* p->cookie is freed by pgm_teardown */ - free(p); +void pgm_free(PROGRAMMER *p) { + if(p) { + ldestroy_cb(p->id, free); + ldestroy_cb(p->usbpid, free); + ldestroy_cb(p->hvupdi_support, free); + p->id = NULL; + p->usbpid = NULL; + p->hvupdi_support = NULL; + // Never free const char *, eg, p->desc, which are set by cache_string() + // p->cookie is freed by pgm_teardown + free(p); + } } -PROGRAMMER * pgm_dup(const PROGRAMMER * const src) -{ - PROGRAMMER * pgm; - LNODEID ln; +PROGRAMMER *pgm_dup(const PROGRAMMER *src) { + PROGRAMMER *pgm = pgm_new(); - pgm = (PROGRAMMER *) cfg_malloc("pgm_dup()", sizeof(*pgm)); - memcpy(pgm, src, sizeof(*pgm)); + if(src) { + memcpy(pgm, src, sizeof(*pgm)); + pgm->id = lcreat(NULL, 0); + pgm->usbpid = lcreat(NULL, 0); + pgm->hvupdi_support = lcreat(NULL, 0); - pgm->id = lcreat(NULL, 0); - pgm->usbpid = lcreat(NULL, 0); - for (ln = lfirst(src->usbpid); ln; ln = lnext(ln)) { - int *ip = cfg_malloc("pgm_dup()", sizeof(int)); - *ip = *(int *) ldata(ln); - ladd(pgm->usbpid, ip); + // Leave id list empty but copy usbpid and hvupdi_support over + for(LNODEID ln = lfirst(src->hvupdi_support); ln; ln = lnext(ln)) { + int *ip = cfg_malloc("pgm_dup()", sizeof(int)); + *ip = *(int *) ldata(ln); + ladd(pgm->hvupdi_support, ip); + } + for(LNODEID ln = lfirst(src->usbpid); ln; ln = lnext(ln)) { + int *ip = cfg_malloc("pgm_dup()", sizeof(int)); + *ip = *(int *) ldata(ln); + ladd(pgm->usbpid, ip); + } } return pgm; @@ -207,8 +226,7 @@ static void pgm_default_6 (struct programmer_t * pgm, const char * p) } -void programmer_display(PROGRAMMER * pgm, const char * p) -{ +void programmer_display(PROGRAMMER *pgm, const char * p) { avrdude_message(MSG_INFO, "%sProgrammer Type : %s\n", p, pgm->type); avrdude_message(MSG_INFO, "%sDescription : %s\n", p, pgm->desc); @@ -216,8 +234,7 @@ void programmer_display(PROGRAMMER * pgm, const char * p) } -void pgm_display_generic_mask(PROGRAMMER * pgm, const char * p, unsigned int show) -{ +void pgm_display_generic_mask(const PROGRAMMER *pgm, const char *p, unsigned int show) { if(show & (1<pin[PPI_AVR_VCC])); if(show & (1<pin[PIN_LED_VFY])); } -void pgm_display_generic(PROGRAMMER * pgm, const char * p) -{ +void pgm_display_generic(const PROGRAMMER *pgm, const char *p) { pgm_display_generic_mask(pgm, p, SHOW_ALL_PINS); } -PROGRAMMER * locate_programmer(LISTID programmers, const char * configid) -{ - LNODEID ln1, ln2; - PROGRAMMER * p = NULL; - const char * id; - int found; +PROGRAMMER *locate_programmer(const LISTID programmers, const char *configid) { + PROGRAMMER *p = NULL; + int found = 0; - found = 0; - - for (ln1=lfirst(programmers); ln1 && !found; ln1=lnext(ln1)) { + for(LNODEID ln1=lfirst(programmers); ln1 && !found; ln1=lnext(ln1)) { p = ldata(ln1); - for (ln2=lfirst(p->id); ln2 && !found; ln2=lnext(ln2)) { - id = ldata(ln2); - if (strcasecmp(configid, id) == 0) + for(LNODEID ln2=lfirst(p->id); ln2 && !found; ln2=lnext(ln2)) + if(strcasecmp(configid, (const char *) ldata(ln2)) == 0) found = 1; - } } - if (found) - return p; - - return NULL; + return found? p: NULL; } /* @@ -296,16 +302,11 @@ void walk_programmers(LISTID programmers, walk_programmers_cb cb, void *cookie) /* * Compare function to sort the list of programmers */ -static int sort_programmer_compare(PROGRAMMER * p1,PROGRAMMER * p2) -{ - char* id1; - char* id2; - if(p1 == NULL || p2 == NULL) { +static int sort_programmer_compare(const PROGRAMMER *p1, const PROGRAMMER *p2) { + if(p1 == NULL || p1->id == NULL || p2 == NULL || p2->id == NULL) return 0; - } - id1 = ldata(lfirst(p1->id)); - id2 = ldata(lfirst(p2->id)); - return strncasecmp(id1,id2,AVR_IDLEN); + + return strcasecmp(ldata(lfirst(p1->id)), ldata(lfirst(p2->id))); } /* diff --git a/src/pickit2.c b/src/pickit2.c index ac3781f5..a1d32f88 100644 --- a/src/pickit2.c +++ b/src/pickit2.c @@ -193,16 +193,18 @@ static int pickit2_open(PROGRAMMER * pgm, char * port) } else { - // get the device description while we're at it - short buff[PGM_DESCLEN-1], i; - HidD_GetProductString(PDATA(pgm)->usb_handle, buff, PGM_DESCLEN-1); + // Get the device description while we're at it and overlay it on pgm->desc + short wbuf[80-1]; + char *cbuf = cfg_malloc("pickit2_open()", sizeof wbuf/sizeof*wbuf + (pgm->desc? strlen(pgm->desc): 0) + 2); + HidD_GetProductString(PDATA(pgm)->usb_handle, wbuf, sizeof wbuf/sizeof*wbuf); - // convert from wide chars, but do not overwrite trailing '\0' - memset(&(pgm->desc), 0, PGM_DESCLEN); - for (i = 0; i < (PGM_DESCLEN-1) && buff[i]; i++) - { - pgm->desc[i] = (char)buff[i]; // TODO what about little/big endian??? - } + if(pgm->desc && *pgm->desc) + strcpy(cbuf, pgm->desc); + + // Convert from wide chars and overlay over initial part of desc + for (int i = 0; i < sizeof wbuf/sizeof*wbuf && wbuf[i]; i++) + cbuf[i] = (char) wbuf[i]; // TODO what about little/big endian??? + pgm->desc = cache_string(cbuf); } #else if (usb_open_device(&(PDATA(pgm)->usb_handle), PICKIT2_VID, PICKIT2_PID) < 0) diff --git a/src/update.c b/src/update.c index 972c3847..f3dbd335 100644 --- a/src/update.c +++ b/src/update.c @@ -306,11 +306,11 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f return LIBAVRDUDE_SOFTFAIL; } - AVRMEM_ALIAS * alias_mem = avr_find_memalias(p, mem); - char alias_mem_desc[AVR_DESCLEN + 1] = ""; - if(alias_mem) { - strcat(alias_mem_desc, "/"); - strcat(alias_mem_desc, alias_mem->desc); + AVRMEM_ALIAS *alias_mem = avr_find_memalias(p, mem); + char *alias_mem_desc = cfg_malloc("do_op()", 2 + (alias_mem && alias_mem->desc? strlen(alias_mem->desc): 0)); + if(alias_mem && alias_mem->desc && *alias_mem->desc) { + *alias_mem_desc = '/'; + strcpy(alias_mem_desc+1, alias_mem->desc); } switch (upd->op) { From c9cf308037a16d97f2be43d655af0d4c1da0ec5c Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 10 Aug 2022 16:24:26 +0100 Subject: [PATCH 192/511] Include ctype.h in term.c to resolve missing functions --- src/term.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/term.c b/src/term.c index 672a09cd..839e5608 100644 --- a/src/term.c +++ b/src/term.c @@ -20,6 +20,7 @@ #include "ac_cfg.h" +#include #include #include #include From ccb576ebc1af85a3dee6dd005aebb4e68e54b7cf Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 10 Aug 2022 22:25:19 +0100 Subject: [PATCH 193/511] Ensure memories are printed at most once for -p */S --- src/developer_opts.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index f176563e..32d2c71e 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -383,7 +383,7 @@ static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { // Fill in all memories we got in defined order di = 0; for(size_t mi=0; mi < sizeof avr_mem_order/sizeof *avr_mem_order && avr_mem_order[mi]; mi++) { - m = p->mem? avr_locate_mem(p, avr_mem_order[mi]): NULL; + m = p->mem? avr_locate_mem_noalias(p, avr_mem_order[mi]): NULL; if(m) { if(di >= sizeof d->mems/sizeof *d->mems) { avrdude_message(MSG_INFO, "%s: ran out of mems[] space, increase size in AVRMEMdeep of developer_opts.c and recompile\n", progname); @@ -553,8 +553,8 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { for(size_t mi=0; mi < sizeof avr_mem_order/sizeof *avr_mem_order && avr_mem_order[mi]; mi++) { AVRMEM *m, *bm; - m = p->mem? avr_locate_mem(p, avr_mem_order[mi]): NULL; - bm = base && base->mem? avr_locate_mem(base, avr_mem_order[mi]): NULL; + m = p->mem? avr_locate_mem_noalias(p, avr_mem_order[mi]): NULL; + bm = base && base->mem? avr_locate_mem_noalias(base, avr_mem_order[mi]): NULL; if(!m && bm && !tsv) dev_info("\n memory \"%s\" = NULL;\n", bm->desc); From 346de71cd5320e8e3c7c1a852c2c061cb8c3ced7 Mon Sep 17 00:00:00 2001 From: brutzzl3r Date: Thu, 11 Aug 2022 20:03:52 +0200 Subject: [PATCH 194/511] man-page: Fix logfile short option man synopsis states [-n -logfile] option. Later on in avrdude.1 as well as in main.c -l is used. Also '-logfile' is no option alternative but a parameter. This is a minor issue but still confusing when one uses / to search through man pages. -- Always leave the code cleaner than you found it -- Signed-off-by: brutzzl3r --- src/avrdude.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/avrdude.1 b/src/avrdude.1 index 05d656fa..1920b583 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -39,7 +39,7 @@ .Oc .Op Fl F .Op Fl i Ar delay -.Op Fl n logfile +.Op Fl l Ar logfile .Op Fl n .Op Fl O .Op Fl P Ar port From c2c9053b1388bfbb03c947e05be63bfe036c26bc Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 12 Aug 2022 00:28:54 +0100 Subject: [PATCH 195/511] Show comments with -p*/s or -c*/s and reduce -p */r raw output --- src/config.c | 100 +++++++++++++- src/config.h | 21 ++- src/config_gram.y | 41 +++--- src/developer_opts.c | 239 ++++++++++++++++++++++++++------- src/developer_opts.h | 1 + src/developer_opts_private.h | 49 +++---- src/lexer.l | 252 ++++++++++++++++++----------------- src/libavrdude.h | 7 +- src/main.c | 26 ++-- 9 files changed, 505 insertions(+), 231 deletions(-) diff --git a/src/config.c b/src/config.c index ac712b17..d36e0814 100644 --- a/src/config.c +++ b/src/config.c @@ -371,10 +371,98 @@ const char *cache_string(const char *p) { return hstrings[h][k] = cfg_strdup("cache_string()", p); } -// Captures comments during parsing -void capture_comment_str(const char *p) { + +static LISTID cfg_comms; // A chain of comment lines +static LISTID cfg_prologue; // Comment lines at start of avrdude.conf +static char *lkw; // Last seen keyword +static int lkw_lineno; // Line number of that + +static LISTID cfg_strctcomms; // Passed on to config_gram.y +static LISTID cfg_pushedcomms; // Temporarily pushed main comments +static int cfg_pushed; // ... for memory sections + +COMMENT *locate_comment(const LISTID comments, const char *where, int rhs) { + if(comments) + for(LNODEID ln=lfirst(comments); ln; ln=lnext(ln)) { + COMMENT *n = ldata(ln); + if(n && rhs == n->rhs && n->kw && strcmp(where, n->kw) == 0) + return n; + } + + return NULL; } +static void addcomment(int rhs) { + if(lkw) { + COMMENT *node = cfg_malloc("addcomment()", sizeof(*node)); + node->rhs = rhs; + node->kw = cfg_strdup("addcomment()", lkw); + node->comms = cfg_comms; + cfg_comms = NULL; + if(!cfg_strctcomms) + cfg_strctcomms = lcreat(NULL, 0); + ladd(cfg_strctcomms, node); + } +} + +// Capture prologue during parsing (triggered by lexer.l) +void cfg_capture_prologue(void) { + cfg_prologue = cfg_comms; + cfg_comms = NULL; +} + +LISTID cfg_get_prologue(void) { + return cfg_prologue; +} + +// Captures comments during parsing +void capture_comment_str(const char *com, int lineno) { + if(!cfg_comms) + cfg_comms = lcreat(NULL, 0); + ladd(cfg_comms, cfg_strdup("capture_comment_str()", com)); + + // Last keyword lineno is the same as this comment's + if(lkw && lkw_lineno == lineno) + addcomment(1); // Register comms to show right of lkw = ...; +} + +// Capture assignments (keywords left of =) and associate comments to them +void capture_lvalue_kw(const char *kw, int lineno) { + if(!strcmp(kw, "memory")) { // Push part comments and start memory comments + if(!cfg_pushed) { // config_gram.y pops the part comments + cfg_pushed = 1; + cfg_pushedcomms = cfg_strctcomms; + cfg_strctcomms = NULL; + } + } + + if(!strcmp(kw, "programmer") || !strcmp(kw, "part") || !strcmp(kw, "memory")) + kw = "*"; // Show comment before programmer/part/memory + + if(lkw) + free(lkw); + lkw = cfg_strdup("capture_lvalue_kw()", kw); + lkw_lineno = lineno; + if(cfg_comms) // Accrued list of # one-line comments + addcomment(0); // Register comment to appear before lkw assignment +} + +// config_gram.y calls this once for each programmer/part/memory structure +LISTID cfg_move_comments(void) { + capture_lvalue_kw(";", -1); + + LISTID ret = cfg_strctcomms; + cfg_strctcomms = NULL; + return ret; +} + +// config_gram.y calls this after ingressing the memory structure +void cfg_pop_comms(void) { + if(cfg_pushed) { + cfg_pushed = 0; + cfg_strctcomms = cfg_pushedcomms; + } +} // Convert the next n hex digits of s to a hex number static unsigned int tohex(const unsigned char *s, unsigned int n) { @@ -558,12 +646,12 @@ char *cfg_unescape(char *d, const char *s) { return (char *) cfg_unescapeu((unsigned char *) d, (const unsigned char *) s); } -// Return an escaped string that looks like a C-style input string incl quotes, memory is malloc()ed +// Return an escaped string that looks like a C-style input string incl quotes, memory is malloc'd char *cfg_escape(const char *s) { - char *ret = (char *) cfg_malloc("cfg_escape()", 4*strlen(s)+2+3), *d = ret; + char buf[50*1024], *d = buf; *d++ = '"'; - for(; *s; s++) { + for(; *s && d-buf < sizeof buf-7; s++) { switch(*s) { case '\n': *d++ = '\\'; *d++ = 'n'; @@ -602,5 +690,5 @@ char *cfg_escape(const char *s) { *d++ = '"'; *d = 0; - return ret; + return cfg_strdup("cfg_escape()", buf); } diff --git a/src/config.h b/src/config.h index afd39b17..b8bd2031 100644 --- a/src/config.h +++ b/src/config.h @@ -30,6 +30,13 @@ #endif +typedef struct { + char *kw; // Keyword near the comments + LISTID comms; // Chained list of comments + int rhs; // Comments to print rhs of keyword line +} COMMENT; + + enum { V_NONE, V_NUM, V_NUM_REAL, V_STR }; typedef struct value_t { int type; @@ -94,7 +101,19 @@ void print_token(TOKEN *tkn); void pyytext(void); -void capture_comment_str(const char *str); +COMMENT *locate_comment(const LISTID comments, const char *where, int rhs); + +void cfg_capture_prologue(void); + +LISTID cfg_get_prologue(void); + +void capture_comment_str(const char *com, int lineno); + +void capture_lvalue_kw(const char *kw, int lineno); + +LISTID cfg_move_comments(void); + +void cfg_pop_comms(void); #ifdef __cplusplus } diff --git a/src/config_gram.y b/src/config_gram.y index 2a027c7f..2c3504f2 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -297,6 +297,7 @@ prog_def : lrmv_d(programmers, existing_prog); pgm_free(existing_prog); } + current_prog->comments = cfg_move_comments(); LISTADD(programmers, current_prog); // pgm_fill_old_pins(current_prog); // TODO to be removed if old pin data no longer needed // pgm_display_generic(current_prog, id); @@ -322,6 +323,7 @@ prog_decl : } current_prog = pgm_dup(pgm); current_prog->parent_id = cache_string($3->value.string); + current_prog->comments = NULL; current_prog->config_file = cache_string(cfg_infile); current_prog->lineno = cfg_lineno; free_token($3); @@ -341,32 +343,33 @@ part_def : YYABORT; } - /* - * perform some sanity checking, and compute the number of bits - * to shift a page for constructing the page address for - * page-addressed memories. - */ + // Sanity checks for memory sizes and compute/override num_pages entry for (ln=lfirst(current_part->mem); ln; ln=lnext(ln)) { m = ldata(ln); if (m->paged) { - if (m->page_size == 0) { - yyerror("must specify page_size for paged memory"); + if (m->size <= 0) { + yyerror("must specify a positive size for paged memory %s", m->desc); YYABORT; } - if (m->num_pages == 0) { - yyerror("must specify num_pages for paged memory"); + if (m->page_size <= 0) { + yyerror("must specify a positive page size for paged memory %s", m->desc); YYABORT; } - if (m->size != m->page_size * m->num_pages) { - yyerror("page size (%u) * num_pages (%u) = " - "%u does not match memory size (%u)", - m->page_size, - m->num_pages, - m->page_size * m->num_pages, - m->size); + // Code base relies on page_size being a power of 2 in some places + if (m->page_size & (m->page_size - 1)) { + yyerror("page size must be a power of 2 for paged memory %s", m->desc); YYABORT; } + // Code base relies on size being a multiple of page_size + if (m->size % m->page_size) { + yyerror("size must be a multiple of page size for paged memory %s", m->desc); + YYABORT; + } + // Warn if num_pages was specified but is inconsistent with size and page size + if (m->num_pages && m->num_pages != m->size / m->page_size) + yywarning("overriding num_page to be %d for memory %s", m->size/m->page_size, m->desc); + m->num_pages = m->size / m->page_size; } } @@ -382,6 +385,8 @@ part_def : lrmv_d(part_list, existing_part); avr_free_part(existing_part); } + + current_part->comments = cfg_move_comments(); LISTADD(part_list, current_part); current_part = NULL; } @@ -405,6 +410,7 @@ part_decl : current_part = avr_dup_part(parent_part); current_part->parent_id = cache_string($3->value.string); + current_part->comments = NULL; current_part->config_file = cache_string(cfg_infile); current_part->lineno = cfg_lineno; @@ -1291,7 +1297,9 @@ part_parm : yywarning("%s's %s %s misses a necessary address bit a%d", current_part->desc, current_mem->desc, opcodename(i), bn-1); } + current_mem->comments = cfg_move_comments(); } + cfg_pop_comms(); current_mem = NULL; } | K_MEMORY TKN_STRING TKN_EQUAL K_NULL @@ -1302,6 +1310,7 @@ part_parm : avr_free_mem(existing_mem); } free_token($2); + cfg_pop_comms(); current_mem = NULL; } | opcode TKN_EQUAL string_list { diff --git a/src/developer_opts.c b/src/developer_opts.c index 32d2c71e..e0c274b9 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -48,6 +48,7 @@ #include "avrdude.h" #include "libavrdude.h" +#include "config.h" #include "developer_opts.h" #include "developer_opts_private.h" @@ -221,8 +222,49 @@ int dev_message(int msglvl, const char *fmt, ...) { } +// Any of the strings in the list contains subs as substring? +int dev_has_subsstr_comms(const LISTID comms, const char *subs) { + if(comms) + for(LNODEID ln=lfirst(comms); ln; ln=lnext(ln)) + if(strstr((char *) ldata(ln), subs)) + return 1; + return 0; +} + +// Print a chained list of strings +void dev_print_comment(const LISTID comms) { + if(comms) + for(LNODEID ln=lfirst(comms); ln; ln=lnext(ln)) + dev_info("%s", (char *) ldata(ln)); +} + +// Conditional output of part, memory or programmer's comments field +static void dev_cout(const LISTID comms, const char *name, int rhs, int elself) { + COMMENT *cp; + + if((cp = locate_comment(comms, name, rhs))) + dev_print_comment(cp->comms); + else if(elself) + dev_info("\n"); +} + +// Print part->comments, mem->comments or pgm->comments (for debugging) +void dev_print_kw_comments(const LISTID comms) { + if(comms) + for(LNODEID ln=lfirst(comms); ln; ln=lnext(ln)) { + COMMENT *n = ldata(ln); + if(n && n->comms) { + dev_info(">>> %s %c\n", n->kw, n->rhs? '>': '<'); + dev_print_comment(n->comms); + } + } +} + +// Ideally all assignment outputs run via this function +static int dev_part_strct_entry(bool tsv, // Print as spreadsheet? + const char *col0, const char *col1, const char *col2, // Descriptors of item + const char *name, char *cont, const LISTID comms) { // Name, contents and comments -static int dev_part_strct_entry(bool tsv, const char *col0, const char *col1, const char *col2, const char *name, char *cont) { const char *n = name? name: "name_error"; const char *c = cont? cont: "cont_error"; @@ -239,8 +281,9 @@ static int dev_part_strct_entry(bool tsv, const char *col0, const char *col1, co dev_info("%s\t%s\n", n, c); } else { // Grammar conform int indent = col2 && strcmp(col2, "part"); - - printf("%*s%-*s = %s;\n", indent? 8: 4, "", indent? 15: 19, n, c); + dev_cout(comms, n, 0, 0); // Print comments before the line + dev_info("%*s%-*s = %s;", indent? 8: 4, "", indent? 15: 19, n, c); + dev_cout(comms, n, 1, 1); // Print comments on rhs } if(cont) @@ -267,14 +310,18 @@ static void dev_stack_out(bool tsv, AVRPART *p, const char *name, unsigned char if(tsv) dev_info(".pt\t%s\t%s\t", p->desc, name); - else + else { + dev_cout(p->comments, name, 0, 0); dev_info(" %-19s =%s", name, ns <=8? " ": ""); + } if(ns <= 0) - dev_info(tsv? "NULL\n": "NULL;\n"); + dev_info(tsv? "NULL\n": "NULL;"); else for(int i=0; i 8 && i%8 == 0? "\n ": "", stack[i], i+1 8 && i%8 == 0? "\n ": "", stack[i], i+1comments, name, 1, 1); } @@ -291,7 +338,7 @@ typedef struct { OPCODE ops[AVR_OP_MAX]; } AVRMEMdeep; -static int avrmem_deep_copy(AVRMEMdeep *d, AVRMEM *m) { +static int avrmem_deep_copy(AVRMEMdeep *d, const AVRMEM *m) { d->base = *m; // Note memory desc (name, really) is limited to 31 char here @@ -299,17 +346,16 @@ static int avrmem_deep_copy(AVRMEMdeep *d, AVRMEM *m) { strncpy(d->descbuf, m->desc, sizeof d->descbuf-1); // Zap address values + d->base.comments = NULL; d->base.buf = NULL; d->base.tags = NULL; d->base.desc = NULL; for(int i=0; ibase.op[i] = NULL; - // Copy over the SPI operations themselves - memset(d->base.op, 0, sizeof d->base.op); memset(d->ops, 0, sizeof d->ops); - for(size_t i=0; iops/sizeof *d->ops; i++) + for(size_t i=0; iop[i]) d->ops[i] = *m->op[i]; @@ -324,7 +370,7 @@ static int memorycmp(AVRMEM *m1, AVRMEM *m2) { if(!m1 || !m2) return m1? -1: 1; - + avrmem_deep_copy(&dm1, m1); avrmem_deep_copy(&dm2, m2); @@ -341,7 +387,7 @@ typedef struct { AVRMEMdeep mems[40]; } AVRPARTdeep; -static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { +static int avrpart_deep_copy(AVRPARTdeep *d, const AVRPART *p) { AVRMEM *m; size_t di; @@ -349,6 +395,7 @@ static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { d->base = *p; + d->base.comments = NULL; d->base.parent_id = NULL; d->base.config_file = NULL; d->base.lineno = 0; @@ -373,8 +420,7 @@ static int avrpart_deep_copy(AVRPARTdeep *d, AVRPART *p) { for(int i=0; ibase.op[i] = NULL; - // Copy over the SPI operations - memset(d->base.op, 0, sizeof d->base.op); + // Copy over all used SPI operations memset(d->ops, 0, sizeof d->ops); for(int i=0; iop[i]) @@ -403,7 +449,8 @@ static char txtchar(unsigned char in) { return in == 0? '.': in > ' ' && in < 0x7f? in: '_'; } -static void dev_raw_dump(const char *p, int nbytes, const char *name, const char *sub, int idx) { +static void dev_raw_dump(const void *v, int nbytes, const char *name, const char *sub, int idx) { + const unsigned char *p = v; int n = (nbytes + 31)/32; for(int i=0; idesc, "part", 0); - dev_raw_dump((char *) &dp.ops, sizeof dp.ops, part->desc, "ops", 1); + dev_raw_dump(&dp.base, sizeof dp.base, part->desc, "part", 0); + for(int i=0; idesc, opsnm("part", i), 1); - for(int i=0; idesc, dp.mems[i].descbuf, i+2); + for(int i=0; idesc, nm, i+2); + dev_raw_dump(&dp.mems[i].base, sizeof dp.mems[i].base, part->desc, nm, i+2); + for(int j=0; jdesc, opsnm(nm, j), i+2); + } } static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { - char *descstr = cfg_escape(p->desc); + COMMENT *cp; + if(!tsv) { - dev_info("#------------------------------------------------------------\n"); - dev_info("# %.*s\n", strlen(descstr+1)-1, descstr+1); - dev_info("#------------------------------------------------------------\n"); + const char *del = "#------------------------------------------------------------"; + cp = locate_comment(p->comments, "*", 0); + + if(!cp || !dev_has_subsstr_comms(cp->comms, del)) { + dev_info("%s\n", del); + dev_info("# %.*s\n", strlen(descstr)-2, descstr+1); // Remove double quotes + dev_info("%s\n\n", del); + } + if(cp) + dev_print_comment(cp->comms); + if(p->parent_id && *p->parent_id) - dev_info("\npart parent \"%s\"\n", p->parent_id); + dev_info("part parent \"%s\"\n", p->parent_id); else - dev_info("\npart\n"); + dev_info("part\n"); } _if_partout_str(strcmp, descstr, desc); @@ -548,7 +623,7 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { for(int i=0; i < AVR_OP_MAX; i++) if(!base || opcodecmp(p->op[i], base->op[i], i)) - dev_part_strct_entry(tsv, ".ptop", p->desc, "part", opcodename(i), opcode2str(p->op[i], i, !tsv)); + dev_part_strct_entry(tsv, ".ptop", p->desc, "part", opcodename(i), opcode2str(p->op[i], i, !tsv), p->comments); for(size_t mi=0; mi < sizeof avr_mem_order/sizeof *avr_mem_order && avr_mem_order[mi]; mi++) { AVRMEM *m, *bm; @@ -569,7 +644,8 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { if(!memorycmp(bm, m)) // Same memory bit for bit, no need to instantiate continue; - dev_info("\n memory \"%s\"\n", m->desc); + dev_cout(m->comments, "*", 0, 1); + dev_info(" memory \"%s\"\n", m->desc); } _if_memout_yn(paged); @@ -589,10 +665,12 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { for(int i=0; i < AVR_OP_MAX; i++) if(!bm || opcodecmp(bm->op[i], m->op[i], i)) - dev_part_strct_entry(tsv, ".ptmmop", p->desc, m->desc, opcodename(i), opcode2str(m->op[i], i, !tsv)); + dev_part_strct_entry(tsv, ".ptmmop", p->desc, m->desc, opcodename(i), opcode2str(m->op[i], i, !tsv), m->comments); - if(!tsv) + if(!tsv) { + dev_cout(m->comments, ";", 0, 0); dev_info(" ;\n"); + } for(LNODEID lnm=lfirst(p->mem_alias); lnm; lnm=lnext(lnm)) { AVRMEM_ALIAS *ma = ldata(lnm); @@ -605,8 +683,37 @@ static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { } } - if(!tsv) + if(!tsv) { + dev_cout(p->comments, ";", 0, 0); dev_info(";\n"); + } +} + + +void dev_output_pgm_part(int dev_opt_c, char *programmer, int dev_opt_p, char *partdesc) { + if(dev_opt_c == 2 && dev_opt_p == 2) { + char *p; + + dev_print_comment(cfg_get_prologue()); + + dev_info("default_programmer = %s;\n", p = cfg_escape(default_programmer)); free(p); + dev_info("default_parallel = %s;\n", p = cfg_escape(default_parallel)); free(p); + dev_info("default_serial = %s;\n", p = cfg_escape(default_serial)); free(p); + dev_info("default_spi = %s;\n", p = cfg_escape(default_spi)); free(p); + + dev_info("\n#\n# PROGRAMMER DEFINITIONS\n#\n\n"); + } + + if(dev_opt_c) + dev_output_pgm_defs(cfg_strdup("main()", programmer)); + + if(dev_opt_p == 2 && dev_opt_c) + dev_info("\n"); + if(dev_opt_p == 2) + dev_info("#\n# PART DEFINITIONS\n#\n"); + + if(dev_opt_p) + dev_output_part_defs(cfg_strdup("main()", partdesc)); } @@ -941,6 +1048,7 @@ static void dev_pgm_raw(PROGRAMMER *pgm) { // Zap address values dp.desc = NULL; dp.id = NULL; + dp.comments = NULL; dp.parent_id = NULL; dp.initpgm = NULL; dp.usbpid = NULL; @@ -968,29 +1076,38 @@ static const char *connstr(conntype_t conntype) { static void dev_pgm_strct(PROGRAMMER *pgm, bool tsv, PROGRAMMER *base) { char *id = ldata(lfirst(pgm->id)); LNODEID ln; + COMMENT *cp; int firstid; if(!tsv) { - dev_info("#------------------------------------------------------------\n"); - dev_info("# "); - for(firstid=1, ln=lfirst(pgm->id); ln; ln=lnext(ln)) { - if(!firstid) - dev_info("/"); - firstid = 0; - dev_info("%s", ldata(ln)); + const char *del = "#------------------------------------------------------------"; + cp = locate_comment(pgm->comments, "*", 0); + + if(!cp || !dev_has_subsstr_comms(cp->comms, del)) { + dev_info("%s\n# ", del); + for(firstid=1, ln=lfirst(pgm->id); ln; ln=lnext(ln)) { + if(!firstid) + dev_info("/"); + firstid = 0; + dev_info("%s", ldata(ln)); + } + dev_info("\n%s\n\n", del); } - dev_info("\n"); - dev_info("#------------------------------------------------------------\n"); + if(cp) + dev_print_comment(cp->comms); + if(pgm->parent_id && *pgm->parent_id) - dev_info("\nprogrammer parent \"%s\"\n", pgm->parent_id); + dev_info("programmer parent \"%s\"\n", pgm->parent_id); else - dev_info("\nprogrammer\n"); + dev_info("programmer\n"); } if(tsv) dev_info(".prog\t%s\tid\t", id); - else + else { + dev_cout(pgm->comments, "id", 0, 0); dev_info(" %-19s = ", "id"); + } for(firstid=1, ln=lfirst(pgm->id); ln; ln=lnext(ln)) { if(!firstid) dev_info(", "); @@ -999,7 +1116,12 @@ static void dev_pgm_strct(PROGRAMMER *pgm, bool tsv, PROGRAMMER *base) { dev_info("%s", str); free(str); } - dev_info(tsv? "\n": ";\n"); + if(tsv) + dev_info("\n"); + else { + dev_info(";"); + dev_cout(pgm->comments, "id", 1, 1); + } _if_pgmout_str(strcmp, cfg_escape(pgm->desc), desc); _pgmout_fmt("type", "\"%s\"", locate_programmer_type_id(pgm->initpgm)); @@ -1012,15 +1134,22 @@ static void dev_pgm_strct(PROGRAMMER *pgm, bool tsv, PROGRAMMER *base) { if(pgm->usbpid && lfirst(pgm->usbpid)) { if(tsv) dev_info(".prog\t%s\tusbpid\t", id); - else + else { + dev_cout(pgm->comments, "usbpid", 0, 0); dev_info(" %-19s = ", "usbpid"); + } for(firstid=1, ln=lfirst(pgm->usbpid); ln; ln=lnext(ln)) { if(!firstid) dev_info(", "); firstid = 0; dev_info("0x%04x", *(unsigned int *) ldata(ln)); } - dev_info(tsv? "\n": ";\n"); + if(tsv) + dev_info("\n"); + else { + dev_info(";"); + dev_cout(pgm->comments, "usbpid", 1, 1); + } } _if_pgmout_str(strcmp, cfg_escape(pgm->usbdev), usbdev); @@ -1039,20 +1168,28 @@ static void dev_pgm_strct(PROGRAMMER *pgm, bool tsv, PROGRAMMER *base) { if(pgm->hvupdi_support && lfirst(pgm->hvupdi_support)) { if(tsv) dev_info(".prog\t%s\thvupdu_support\t", id); - else + else { + dev_cout(pgm->comments, "hvupdi_support", 0, 0); dev_info(" %-19s = ", "hvupdi_support"); + } for(firstid=1, ln=lfirst(pgm->hvupdi_support); ln; ln=lnext(ln)) { if(!firstid) dev_info(", "); firstid = 0; dev_info("%d", *(unsigned int *) ldata(ln)); } - dev_info(tsv? "\n": ";\n"); + if(tsv) + dev_info("\n"); + else { + dev_info(";"); + dev_cout(pgm->comments, "hvupdi_support", 1, 1); + } } - - if(!tsv) + if(!tsv) { + dev_cout(pgm->comments, ";", 0, 0); dev_info(";\n"); + } } diff --git a/src/developer_opts.h b/src/developer_opts.h index 2079c109..bc04a9d8 100644 --- a/src/developer_opts.h +++ b/src/developer_opts.h @@ -19,6 +19,7 @@ #ifndef developer_opts_h #define developer_opts_h +void dev_output_pgm_part(int dev_opt_c, char *programmer, int dev_opt_p, char *partdesc); void dev_output_part_defs(char *partdesc); void dev_output_pgm_defs(char *programmer); diff --git a/src/developer_opts_private.h b/src/developer_opts_private.h index a5c1562e..54012838 100644 --- a/src/developer_opts_private.h +++ b/src/developer_opts_private.h @@ -52,76 +52,77 @@ static int dev_message(int msglvl, const char *fmt, ...); #define dev_notice2(...) dev_message(DEV_NOTICE2, __VA_ARGS__) #define _pgmout(fmt, component) \ - dev_part_strct_entry(tsv, ".prog", id, NULL, #component, dev_sprintf(fmt, pgm->component)) + dev_part_strct_entry(tsv, ".prog", id, NULL, #component, dev_sprintf(fmt, pgm->component), pgm->comments) #define _pgmout_fmt(name, fmt, what) \ - dev_part_strct_entry(tsv, ".prog", id, NULL, name, dev_sprintf(fmt, what)) + dev_part_strct_entry(tsv, ".prog", id, NULL, name, dev_sprintf(fmt, what), pgm->comments) #define _if_pgmout(cmp, fmt, component) do { \ if(!base || cmp(base->component, pgm->component)) \ - dev_part_strct_entry(tsv, ".prog", id, NULL, #component, dev_sprintf(fmt, pgm->component)); \ + dev_part_strct_entry(tsv, ".prog", id, NULL, #component, dev_sprintf(fmt, pgm->component), pgm->comments); \ } while(0) -// Result must be a malloc()ed string +// Result must be a malloc'd string #define _if_pgmout_str(cmp, result, component) do { \ if(!base || cmp(base->component, pgm->component)) \ - dev_part_strct_entry(tsv, ".prog", id, NULL, #component, result); \ + dev_part_strct_entry(tsv, ".prog", id, NULL, #component, result, pgm->comments); \ } while(0) + #define _partout(fmt, component) \ - dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)) + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component), p->comments) #define _if_partout(cmp, fmt, component) do { \ if(!base || cmp(base->component, p->component)) \ - dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)); \ + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component), p->comments); \ } while(0) #define _if_n_partout(cmp, n, fmt, component) do { \ if(!base || cmp(base->component, p->component, n)) \ - dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component)); \ + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component), p->comments); \ } while(0) -// Result must be a malloc()ed string +// Result must be a malloc'd string #define _partout_str(result, component) \ - dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result) + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result, p->comments) -// Result must be a malloc()ed string +// Result must be a malloc'd string #define _if_partout_str(cmp, result, component) do { \ if(!base || cmp(base->component, p->component)) \ - dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result); \ + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result, p->comments); \ } while(0) -// Result must be a malloc()ed string +// Result must be a malloc'd string #define _if_n_partout_str(cmp, n, result, component) do { \ if(!base || cmp(base->component, p->component, n)) \ - dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result); \ + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result, p->comments); \ } while(0) #define _memout(fmt, component) \ - dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component)) + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component), m->comments) #define _if_memout(cmp, fmt, component) do { \ if(!bm || cmp(bm->component, m->component)) \ - dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component)); \ + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component), m->comments); \ } while(0) -// Result must be a malloc()ed string +// Result must be a malloc'd string #define _memout_str(result, component) \ - dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result) + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result, m->comments) -// Result must be a malloc()ed string +// Result must be a malloc'd string #define _if_n_memout_str(cmp, n, result, component) do { \ if(!bm || cmp(bm->component, m->component, n)) \ - dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result); \ + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result, m->comments); \ } while(0) #define _memout_yn(component) \ - dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, cfg_strdup("_memout_yn()", m->component? "yes": "no")) + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, cfg_strdup("_memout_yn()", m->component? "yes": "no"), m->comments) #define _if_memout_yn(component) do { \ if(!bm || bm->component != m->component) \ - dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, cfg_strdup("_if_memout_yn()", m->component? "yes": "no")); \ + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, cfg_strdup("_if_memout_yn()", m->component? "yes": "no"), m->comments); \ } while(0) #define _flagout(mask, name) \ @@ -132,8 +133,8 @@ static int dev_message(int msglvl, const char *fmt, ...); _partout_str(cfg_strdup("_if_flagout()", p->flags & (mask)? "yes": "no"), name); \ } while(0) -// Result must be a malloc()ed string +// Result must be a malloc'd string #define _cmderr(result, component) \ - dev_part_strct_entry(tsv, ".cmderr", p->desc, m->desc, #component, result) + dev_part_strct_entry(tsv, ".cmderr", p->desc, m->desc, #component, result, NULL) #endif diff --git a/src/lexer.l b/src/lexer.l index 47c3cb25..a69130d3 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -39,6 +39,15 @@ #define YYERRCODE 256 #endif +/* capture lvalue keywords to associate comments with that assignment */ +#define ccap() capture_lvalue_kw(yytext, cfg_lineno) + +static void adjust_cfg_lineno(const char *p) { + while(*p) + if(*p++ == '\n') + cfg_lineno++; +} + %} DIGIT [0-9] @@ -71,14 +80,19 @@ SIGN [+-] 0x{HEXDIGIT}+ { yylval = hexnumber(yytext); return TKN_NUMBER; } -#[^\n]*\n+ { /* record and skip # comments */ - capture_comment_str(yytext); - for(int i=0; yytext[i]; i++) { - if(yytext[i] == '\n') - cfg_lineno++; - } +#\n#\ PROGRAMMER\ DEFINITIONS\n#\n+ { /* Record comments so far as prologue and skip */ + cfg_capture_prologue(); + adjust_cfg_lineno(yytext); } +#\n#\ PART\ DEFINITIONS\n#\n+ { /* Ignore part definions header */ + adjust_cfg_lineno(yytext); +} + +[ \t]*#[^\n]*\n+ { /* Record and skip # comments including preceding white space */ + capture_comment_str(yytext, cfg_lineno); + adjust_cfg_lineno(yytext); +} "/*" { /* The following eats multiline C style comments, they are not captured */ int c; @@ -108,137 +122,137 @@ SIGN [+-] alias { yylval=NULL; return K_ALIAS; } -allowfullpagebitstream { yylval=NULL; return K_ALLOWFULLPAGEBITSTREAM; } -avr910_devcode { yylval=NULL; return K_AVR910_DEVCODE; } +allowfullpagebitstream { yylval=NULL; ccap(); return K_ALLOWFULLPAGEBITSTREAM; } +avr910_devcode { yylval=NULL; ccap(); return K_AVR910_DEVCODE; } bank_size { yylval=NULL; return K_PAGE_SIZE; } banked { yylval=NULL; return K_PAGED; } -baudrate { yylval=NULL; return K_BAUDRATE; } -blocksize { yylval=NULL; return K_BLOCKSIZE; } -bs2 { yylval=NULL; return K_BS2; } -buff { yylval=NULL; return K_BUFF; } -bytedelay { yylval=NULL; return K_BYTEDELAY; } -chip_erase { yylval=new_token(K_CHIP_ERASE); return K_CHIP_ERASE; } -chip_erase_delay { yylval=NULL; return K_CHIP_ERASE_DELAY; } -chiperasepolltimeout { yylval=NULL; return K_CHIPERASEPOLLTIMEOUT; } -chiperasepulsewidth { yylval=NULL; return K_CHIPERASEPULSEWIDTH; } -chiperasetime { yylval=NULL; return K_CHIPERASETIME; } -cmdexedelay { yylval=NULL; return K_CMDEXEDELAY; } -connection_type { yylval=NULL; return K_CONNTYPE; } +baudrate { yylval=NULL; ccap(); return K_BAUDRATE; } +blocksize { yylval=NULL; ccap(); return K_BLOCKSIZE; } +bs2 { yylval=NULL; ccap(); return K_BS2; } +buff { yylval=NULL; ccap(); return K_BUFF; } +bytedelay { yylval=NULL; ccap(); return K_BYTEDELAY; } +chip_erase { yylval=new_token(K_CHIP_ERASE); ccap(); return K_CHIP_ERASE; } +chip_erase_delay { yylval=NULL; ccap(); return K_CHIP_ERASE_DELAY; } +chiperasepolltimeout { yylval=NULL; ccap(); return K_CHIPERASEPOLLTIMEOUT; } +chiperasepulsewidth { yylval=NULL; ccap(); return K_CHIPERASEPULSEWIDTH; } +chiperasetime { yylval=NULL; ccap(); return K_CHIPERASETIME; } +cmdexedelay { yylval=NULL; ccap(); return K_CMDEXEDELAY; } +connection_type { yylval=NULL; ccap(); return K_CONNTYPE; } dedicated { yylval=new_token(K_DEDICATED); return K_DEDICATED; } default_bitclock { yylval=NULL; return K_DEFAULT_BITCLOCK; } default_parallel { yylval=NULL; return K_DEFAULT_PARALLEL; } default_programmer { yylval=NULL; return K_DEFAULT_PROGRAMMER; } default_serial { yylval=NULL; return K_DEFAULT_SERIAL; } default_spi { yylval=NULL; return K_DEFAULT_SPI; } -delay { yylval=NULL; return K_DELAY; } -desc { yylval=NULL; return K_DESC; } -family_id { yylval=NULL; return K_FAMILY_ID; } -devicecode { yylval=NULL; return K_DEVICECODE; } -eecr { yylval=NULL; return K_EECR; } +delay { yylval=NULL; ccap(); return K_DELAY; } +desc { yylval=NULL; ccap(); return K_DESC; } +devicecode { yylval=NULL; ccap(); return K_DEVICECODE; } +eecr { yylval=NULL; ccap(); return K_EECR; } eeprom { yylval=NULL; return K_EEPROM; } -eeprom_instr { yylval=NULL; return K_EEPROM_INSTR; } -enablepageprogramming { yylval=NULL; return K_ENABLEPAGEPROGRAMMING; } -errled { yylval=NULL; return K_ERRLED; } +eeprom_instr { yylval=NULL; ccap(); return K_EEPROM_INSTR; } +enablepageprogramming { yylval=NULL; ccap(); return K_ENABLEPAGEPROGRAMMING; } +errled { yylval=NULL; ccap(); return K_ERRLED; } +family_id { yylval=NULL; ccap(); return K_FAMILY_ID; } flash { yylval=NULL; return K_FLASH; } -flash_instr { yylval=NULL; return K_FLASH_INSTR; } -has_debugwire { yylval=NULL; return K_HAS_DW; } -has_jtag { yylval=NULL; return K_HAS_JTAG; } -has_pdi { yylval=NULL; return K_HAS_PDI; } -has_tpi { yylval=NULL; return K_HAS_TPI; } -has_updi { yylval=NULL; return K_HAS_UPDI; } -hventerstabdelay { yylval=NULL; return K_HVENTERSTABDELAY; } -hvleavestabdelay { yylval=NULL; return K_HVLEAVESTABDELAY; } -hvsp_controlstack { yylval=NULL; return K_HVSP_CONTROLSTACK; } -hvspcmdexedelay { yylval=NULL; return K_HVSPCMDEXEDELAY; } -hvupdi_support { yylval=NULL; return K_HVUPDI_SUPPORT; } -hvupdi_variant { yylval=NULL; return K_HVUPDI_VARIANT; } -id { yylval=NULL; return K_ID; } -idr { yylval=NULL; return K_IDR; } +flash_instr { yylval=NULL; ccap(); return K_FLASH_INSTR; } +has_debugwire { yylval=NULL; ccap(); return K_HAS_DW; } +has_jtag { yylval=NULL; ccap(); return K_HAS_JTAG; } +has_pdi { yylval=NULL; ccap(); return K_HAS_PDI; } +has_tpi { yylval=NULL; ccap(); return K_HAS_TPI; } +has_updi { yylval=NULL; ccap(); return K_HAS_UPDI; } +hventerstabdelay { yylval=NULL; ccap(); return K_HVENTERSTABDELAY; } +hvleavestabdelay { yylval=NULL; ccap(); return K_HVLEAVESTABDELAY; } +hvsp_controlstack { yylval=NULL; ccap(); return K_HVSP_CONTROLSTACK; } +hvspcmdexedelay { yylval=NULL; ccap(); return K_HVSPCMDEXEDELAY; } +hvupdi_support { yylval=NULL; ccap(); return K_HVUPDI_SUPPORT; } +hvupdi_variant { yylval=NULL; ccap(); return K_HVUPDI_VARIANT; } +id { yylval=NULL; ccap(); return K_ID; } +idr { yylval=NULL; ccap(); return K_IDR; } io { yylval=new_token(K_IO); return K_IO; } -is_at90s1200 { yylval=NULL; return K_IS_AT90S1200; } -is_avr32 { yylval=NULL; return K_IS_AVR32; } -latchcycles { yylval=NULL; return K_LATCHCYCLES; } -load_ext_addr { yylval=new_token(K_LOAD_EXT_ADDR); return K_LOAD_EXT_ADDR; } -loadpage_hi { yylval=new_token(K_LOADPAGE_HI); return K_LOADPAGE_HI; } -loadpage_lo { yylval=new_token(K_LOADPAGE_LO); return K_LOADPAGE_LO; } -max_write_delay { yylval=NULL; return K_MAX_WRITE_DELAY; } -mcu_base { yylval=NULL; return K_MCU_BASE; } -memory { yylval=NULL; return K_MEMORY; } -min_write_delay { yylval=NULL; return K_MIN_WRITE_DELAY; } -miso { yylval=NULL; return K_MISO; } -mode { yylval=NULL; return K_MODE; } -mosi { yylval=NULL; return K_MOSI; } +is_at90s1200 { yylval=NULL; ccap(); return K_IS_AT90S1200; } +is_avr32 { yylval=NULL; ccap(); return K_IS_AVR32; } +latchcycles { yylval=NULL; ccap(); return K_LATCHCYCLES; } +load_ext_addr { yylval=new_token(K_LOAD_EXT_ADDR); ccap(); return K_LOAD_EXT_ADDR; } +loadpage_hi { yylval=new_token(K_LOADPAGE_HI); ccap(); return K_LOADPAGE_HI; } +loadpage_lo { yylval=new_token(K_LOADPAGE_LO); ccap(); return K_LOADPAGE_LO; } +max_write_delay { yylval=NULL; ccap(); return K_MAX_WRITE_DELAY; } +mcu_base { yylval=NULL; ccap(); return K_MCU_BASE; } +memory { yylval=NULL; ccap(); return K_MEMORY; } +min_write_delay { yylval=NULL; ccap(); return K_MIN_WRITE_DELAY; } +miso { yylval=NULL; ccap(); return K_MISO; } +mode { yylval=NULL; ccap(); return K_MODE; } +mosi { yylval=NULL; ccap(); return K_MOSI; } no { yylval=new_token(K_NO); return K_NO; } NULL { yylval=NULL; return K_NULL; } num_banks { yylval=NULL; return K_NUM_PAGES; } -num_pages { yylval=NULL; return K_NUM_PAGES; } -nvm_base { yylval=NULL; return K_NVM_BASE; } -ocd_base { yylval=NULL; return K_OCD_BASE; } -ocdrev { yylval=NULL; return K_OCDREV; } -offset { yylval=NULL; return K_OFFSET; } -page_size { yylval=NULL; return K_PAGE_SIZE; } -paged { yylval=NULL; return K_PAGED; } -pagel { yylval=NULL; return K_PAGEL; } -parallel { yylval=NULL; return K_PARALLEL; } +num_pages { yylval=NULL; ccap(); return K_NUM_PAGES; } +nvm_base { yylval=NULL; ccap(); return K_NVM_BASE; } +ocd_base { yylval=NULL; ccap(); return K_OCD_BASE; } +ocdrev { yylval=NULL; ccap(); return K_OCDREV; } +offset { yylval=NULL; ccap(); return K_OFFSET; } +paged { yylval=NULL; ccap(); return K_PAGED; } +pagel { yylval=NULL; ccap(); return K_PAGEL; } +page_size { yylval=NULL; ccap(); return K_PAGE_SIZE; } +parallel { yylval=NULL; ccap(); return K_PARALLEL; } parent { yylval=NULL; return K_PARENT; } -part { yylval=NULL; return K_PART; } -pgm_enable { yylval=new_token(K_PGM_ENABLE); return K_PGM_ENABLE; } -pgmled { yylval=NULL; return K_PGMLED; } -pollindex { yylval=NULL; return K_POLLINDEX; } -pollmethod { yylval=NULL; return K_POLLMETHOD; } -pollvalue { yylval=NULL; return K_POLLVALUE; } -postdelay { yylval=NULL; return K_POSTDELAY; } -poweroffdelay { yylval=NULL; return K_POWEROFFDELAY; } -pp_controlstack { yylval=NULL; return K_PP_CONTROLSTACK; } -predelay { yylval=NULL; return K_PREDELAY; } -progmodedelay { yylval=NULL; return K_PROGMODEDELAY; } -programfusepolltimeout { yylval=NULL; return K_PROGRAMFUSEPOLLTIMEOUT; } -programfusepulsewidth { yylval=NULL; return K_PROGRAMFUSEPULSEWIDTH; } -programlockpolltimeout { yylval=NULL; return K_PROGRAMLOCKPOLLTIMEOUT; } -programlockpulsewidth { yylval=NULL; return K_PROGRAMLOCKPULSEWIDTH; } -programmer { yylval=NULL; return K_PROGRAMMER; } +part { yylval=NULL; ccap(); return K_PART; } +pgm_enable { yylval=new_token(K_PGM_ENABLE); ccap(); return K_PGM_ENABLE; } +pgmled { yylval=NULL; ccap(); return K_PGMLED; } +pollindex { yylval=NULL; ccap(); return K_POLLINDEX; } +pollmethod { yylval=NULL; ccap(); return K_POLLMETHOD; } +pollvalue { yylval=NULL; ccap(); return K_POLLVALUE; } +postdelay { yylval=NULL; ccap(); return K_POSTDELAY; } +poweroffdelay { yylval=NULL; ccap(); return K_POWEROFFDELAY; } +pp_controlstack { yylval=NULL; ccap(); return K_PP_CONTROLSTACK; } +predelay { yylval=NULL; ccap(); return K_PREDELAY; } +progmodedelay { yylval=NULL; ccap(); return K_PROGMODEDELAY; } +programfusepolltimeout { yylval=NULL; ccap(); return K_PROGRAMFUSEPOLLTIMEOUT; } +programfusepulsewidth { yylval=NULL; ccap(); return K_PROGRAMFUSEPULSEWIDTH; } +programlockpolltimeout { yylval=NULL; ccap(); return K_PROGRAMLOCKPOLLTIMEOUT; } +programlockpulsewidth { yylval=NULL; ccap(); return K_PROGRAMLOCKPULSEWIDTH; } +programmer { yylval=NULL; ccap(); return K_PROGRAMMER; } pseudo { yylval=new_token(K_PSEUDO); return K_PSEUDO; } -pwroff_after_write { yylval=NULL; return K_PWROFF_AFTER_WRITE; } -rampz { yylval=NULL; return K_RAMPZ; } -rdyled { yylval=NULL; return K_RDYLED; } -read { yylval=new_token(K_READ); return K_READ; } -read_hi { yylval=new_token(K_READ_HI); return K_READ_HI; } -read_lo { yylval=new_token(K_READ_LO); return K_READ_LO; } -readback { yylval=NULL; return K_READBACK; } -readback_p1 { yylval=NULL; return K_READBACK_P1; } -readback_p2 { yylval=NULL; return K_READBACK_P2; } -readsize { yylval=NULL; return K_READSIZE; } -reset { yylval=new_token(K_RESET); return K_RESET; } -resetdelay { yylval=NULL; return K_RESETDELAY; } -resetdelayms { yylval=NULL; return K_RESETDELAYMS; } -resetdelayus { yylval=NULL; return K_RESETDELAYUS; } -retry_pulse { yylval=NULL; return K_RETRY_PULSE; } -sck { yylval=new_token(K_SCK); return K_SCK; } -serial { yylval=NULL; return K_SERIAL; } -signature { yylval=NULL; return K_SIGNATURE; } -size { yylval=NULL; return K_SIZE; } +pwroff_after_write { yylval=NULL; ccap(); return K_PWROFF_AFTER_WRITE; } +rampz { yylval=NULL; ccap(); return K_RAMPZ; } +rdyled { yylval=NULL; ccap(); return K_RDYLED; } +read { yylval=new_token(K_READ); ccap(); return K_READ; } +read_hi { yylval=new_token(K_READ_HI); ccap(); return K_READ_HI; } +read_lo { yylval=new_token(K_READ_LO); ccap(); return K_READ_LO; } +readback { yylval=NULL; ccap(); return K_READBACK; } +readback_p1 { yylval=NULL; ccap(); return K_READBACK_P1; } +readback_p2 { yylval=NULL; ccap(); return K_READBACK_P2; } +readsize { yylval=NULL; ccap(); return K_READSIZE; } +reset { yylval=new_token(K_RESET); ccap(); return K_RESET; } +resetdelay { yylval=NULL; ccap(); return K_RESETDELAY; } +resetdelayms { yylval=NULL; ccap(); return K_RESETDELAYMS; } +resetdelayus { yylval=NULL; ccap(); return K_RESETDELAYUS; } +retry_pulse { yylval=NULL; ccap(); return K_RETRY_PULSE; } +sck { yylval=new_token(K_SCK); ccap(); return K_SCK; } +serial { yylval=NULL; ccap(); return K_SERIAL; } +signature { yylval=NULL; ccap(); return K_SIGNATURE; } +size { yylval=NULL; ccap(); return K_SIZE; } spi { yylval=NULL; return K_SPI; } -spmcr { yylval=NULL; return K_SPMCR; } -stabdelay { yylval=NULL; return K_STABDELAY; } -stk500_devcode { yylval=NULL; return K_STK500_DEVCODE; } -synchcycles { yylval=NULL; return K_SYNCHCYCLES; } -synchloops { yylval=NULL; return K_SYNCHLOOPS; } -timeout { yylval=NULL; return K_TIMEOUT; } -togglevtg { yylval=NULL; return K_TOGGLEVTG; } -type { yylval=NULL; return K_TYPE; } +spmcr { yylval=NULL; ccap(); return K_SPMCR; } +stabdelay { yylval=NULL; ccap(); return K_STABDELAY; } +stk500_devcode { yylval=NULL; ccap(); return K_STK500_DEVCODE; } +synchcycles { yylval=NULL; ccap(); return K_SYNCHCYCLES; } +synchloops { yylval=NULL; ccap(); return K_SYNCHLOOPS; } +timeout { yylval=NULL; ccap(); return K_TIMEOUT; } +togglevtg { yylval=NULL; ccap(); return K_TOGGLEVTG; } +type { yylval=NULL; ccap(); return K_TYPE; } usb { yylval=NULL; return K_USB; } -usbdev { yylval=NULL; return K_USBDEV; } -usbpid { yylval=NULL; return K_USBPID; } -usbproduct { yylval=NULL; return K_USBPRODUCT; } -usbsn { yylval=NULL; return K_USBSN; } -usbvendor { yylval=NULL; return K_USBVENDOR; } -usbvid { yylval=NULL; return K_USBVID; } -vcc { yylval=NULL; return K_VCC; } -vfyled { yylval=NULL; return K_VFYLED; } -write { yylval=new_token(K_WRITE); return K_WRITE; } -write_hi { yylval=new_token(K_WRITE_HI); return K_WRITE_HI; } -write_lo { yylval=new_token(K_WRITE_LO); return K_WRITE_LO; } -writepage { yylval=new_token(K_WRITEPAGE); return K_WRITEPAGE; } +usbdev { yylval=NULL; ccap(); return K_USBDEV; } +usbpid { yylval=NULL; ccap(); return K_USBPID; } +usbproduct { yylval=NULL; ccap(); return K_USBPRODUCT; } +usbsn { yylval=NULL; ccap(); return K_USBSN; } +usbvendor { yylval=NULL; ccap(); return K_USBVENDOR; } +usbvid { yylval=NULL; ccap(); return K_USBVID; } +vcc { yylval=NULL; ccap(); return K_VCC; } +vfyled { yylval=NULL; ccap(); return K_VFYLED; } +write { yylval=new_token(K_WRITE); ccap(); return K_WRITE; } +write_hi { yylval=new_token(K_WRITE_HI); ccap(); return K_WRITE_HI; } +write_lo { yylval=new_token(K_WRITE_LO); ccap(); return K_WRITE_LO; } +writepage { yylval=new_token(K_WRITEPAGE); ccap(); return K_WRITEPAGE; } yes { yylval=new_token(K_YES); return K_YES; } "," { yylval = NULL; pyytext(); return TKN_COMMA; } diff --git a/src/libavrdude.h b/src/libavrdude.h index cbbc8a79..d15677eb 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -215,7 +215,8 @@ typedef struct opcode { typedef struct avrpart { const char * desc; /* long part name */ const char * id; /* short part name */ - const char * parent_id; /* parent id if set, for -p.../s */ + LISTID comments; // Used by developer options -p*/[ASsr...] + const char * parent_id; /* Used by developer options */ const char * family_id; /* family id in the SIB (avr8x) */ int hvupdi_variant; /* HV pulse on UPDI pin, no pin or RESET pin */ int stk500_devcode; /* stk500 device code */ @@ -285,6 +286,7 @@ typedef struct avrpart { #define AVR_MEMDESCLEN 64 typedef struct avrmem { const char *desc; /* memory description ("flash", "eeprom", etc) */ + LISTID comments; // Used by developer options -p*/[ASsr...] int paged; /* page addressed (e.g. ATmega flash) */ int size; /* total memory size in bytes */ int page_size; /* size of memory page (if page addressed) */ @@ -684,7 +686,8 @@ typedef struct programmer_t { LISTID id; const char *desc; void (*initpgm)(struct programmer_t *pgm); - const char *parent_id; // Used by developer options -c*/[sr...] + LISTID comments; // Used by developer options -c*/[ASsr...] + const char *parent_id; // Used by developer options struct pindef_t pin[N_PINS]; conntype_t conntype; int baudrate; diff --git a/src/main.c b/src/main.c index 2487faa7..ae9e5ea8 100644 --- a/src/main.c +++ b/src/main.c @@ -244,6 +244,14 @@ static void replace_backslashes(char *s) } } +// Return 2 if string is * or starts with */, 1 if string contains /, 0 otherwise +static int dev_opt(char *str) { + return + !str? 0: + !strcmp(str, "*") || !strncmp(str, "*/", 2)? 2: + !!strchr(str, '/'); +} + /* * main routine @@ -752,20 +760,14 @@ int main(int argc, char * argv []) bitclock = default_bitclock; } + // Developer options to print parts and/or programmer entries of avrdude.conf + int dev_opt_c = dev_opt(programmer); // -c /[sSArt] + int dev_opt_p = dev_opt(partdesc); // -p /[dsSArcow*t] - int dev_opts = 0; - // Developer option -c /[ASsrt] prints programmer description(s) and exits - if(programmer && (strcmp(programmer, "*") == 0 || strchr(programmer, '/'))) { - dev_output_pgm_defs(cfg_strdup("main()", programmer)); - dev_opts = 1; - } - // Developer option -p /[dASsrcow*t] prints part description(s) and exits - if(partdesc && (strcmp(partdesc, "*") == 0 || strchr(partdesc, '/'))) { - dev_output_part_defs(partdesc); - dev_opts = 1; - } - if(dev_opts) + if(dev_opt_c || dev_opt_p) { // See -c/h and or -p/h + dev_output_pgm_part(dev_opt_c, programmer, dev_opt_p, partdesc); exit(0); + } avrdude_message(MSG_NOTICE, "\n"); From 8420b272335a0db7c86162ffe77f0692dfb18235 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 12 Aug 2022 14:58:21 +0100 Subject: [PATCH 196/511] Address compiler warnings in 4 source files --- src/developer_opts.c | 9 +++------ src/jtagmkII.c | 2 -- src/ser_win32.c | 6 +++--- src/stk500v2.c | 10 +++++++--- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index e0c274b9..dc7a4063 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -402,14 +402,11 @@ static int avrpart_deep_copy(AVRPARTdeep *d, const AVRPART *p) { // Copy over desc, id, and family_id memset(d->descbuf, 0, sizeof d->descbuf); - if(d->descbuf) - strncpy(d->descbuf, p->desc, sizeof d->descbuf-1); + strncpy(d->descbuf, p->desc, sizeof d->descbuf-1); memset(d->idbuf, 0, sizeof d->idbuf); - if(d->idbuf) - strncpy(d->idbuf, p->id, sizeof d->idbuf-1); + strncpy(d->idbuf, p->id, sizeof d->idbuf-1); memset(d->family_idbuf, 0, sizeof d->family_idbuf); - if(d->family_idbuf) - strncpy(d->family_idbuf, p->family_id, sizeof d->family_idbuf-1); + strncpy(d->family_idbuf, p->family_id, sizeof d->family_idbuf-1); // Zap address values d->base.desc = NULL; diff --git a/src/jtagmkII.c b/src/jtagmkII.c index f52f3bc3..ef45ee22 100644 --- a/src/jtagmkII.c +++ b/src/jtagmkII.c @@ -488,7 +488,6 @@ static int jtagmkII_recv_frame(PROGRAMMER * pgm, unsigned char **msg, int rv; unsigned char c, *buf = NULL, header[8]; unsigned short r_seqno = 0; - unsigned short checksum = 0; struct timeval tv; double timeoutval = 100; /* seconds */ @@ -521,7 +520,6 @@ static int jtagmkII_recv_frame(PROGRAMMER * pgm, unsigned char **msg, if (serial_recv(&pgm->fd, &c, 1) != 0) goto timedout; } - checksum ^= c; if (state < sDATA) header[headeridx++] = c; diff --git a/src/ser_win32.c b/src/ser_win32.c index fa4d7aba..970a3ecb 100644 --- a/src/ser_win32.c +++ b/src/ser_win32.c @@ -393,7 +393,7 @@ static int net_send(union filedescriptor *fd, const unsigned char * buf, size_t } while (len) { - rc = send(fd->ifd, p, (len > 1024) ? 1024 : len, 0); + rc = send(fd->ifd, (const char *) p, (len > 1024)? 1024: len, 0); if (rc < 0) { FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | @@ -527,7 +527,7 @@ reselect: } } - rc = recv(fd->ifd, p, (buflen - len > 1024) ? 1024 : buflen - len, 0); + rc = recv(fd->ifd, (char *) p, (buflen - len > 1024)? 1024: buflen - len, 0); if (rc < 0) { FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | @@ -693,7 +693,7 @@ static int net_drain(union filedescriptor *fd, int display) } } - rc = recv(fd->ifd, &buf, 1, 0); + rc = recv(fd->ifd, (char *) &buf, 1, 0); if (rc < 0) { FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | diff --git a/src/stk500v2.c b/src/stk500v2.c index a50fda4c..8f16ae41 100644 --- a/src/stk500v2.c +++ b/src/stk500v2.c @@ -3093,12 +3093,14 @@ static int stk500v2_setparm_real(PROGRAMMER * pgm, unsigned char parm, unsigned static int stk500v2_setparm(PROGRAMMER * pgm, unsigned char parm, unsigned char value) { - unsigned char current_value; + unsigned char current_value = value; int res; res = stk500v2_getparm(pgm, parm, ¤t_value); - if (res < 0) + if (res < 0) { avrdude_message(MSG_INFO, "%s: Unable to get parameter 0x%02x\n", progname, parm); + return -1; + } // don't issue a write if the correct value is already set. if (value == current_value) { @@ -3245,7 +3247,7 @@ f_to_kHz_MHz(double f, const char **unit) static void stk500v2_print_parms1(PROGRAMMER * pgm, const char * p) { - unsigned char vtarget, vadjust, osc_pscale, osc_cmatch, sck_duration =0; //XXX 0 is not correct, check caller + unsigned char vtarget = 0, vadjust = 0, osc_pscale = 0, osc_cmatch = 0, sck_duration =0; //XXX 0 is not correct, check caller unsigned int sck_stk600, clock_conf, dac, oct, varef; unsigned char vtarget_jtag[4]; int prescale; @@ -3253,6 +3255,8 @@ static void stk500v2_print_parms1(PROGRAMMER * pgm, const char * p) const char *unit; void *mycookie; + memset(vtarget_jtag, 0, sizeof vtarget_jtag); + if (PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE_MKII) { mycookie = pgm->cookie; pgm->cookie = PDATA(pgm)->chained_pdata; From 533feec4ede1fa0502de01183cfbcdd570e3005f Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 12 Aug 2022 15:52:51 +0100 Subject: [PATCH 197/511] Revert grammar to remove introduced shift/reduce conflicts --- src/config_gram.y | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/config_gram.y b/src/config_gram.y index 2c3504f2..c4c144a7 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -1356,8 +1356,7 @@ yesno : mem_specs : mem_spec TKN_SEMI | mem_alias TKN_SEMI | - mem_specs mem_spec TKN_SEMI | - /* empty */ + mem_specs mem_spec TKN_SEMI ; From 266eb23207faa66e5ab6f2a6717716e93e52ab59 Mon Sep 17 00:00:00 2001 From: brutzzl3r Date: Fri, 12 Aug 2022 19:26:50 +0200 Subject: [PATCH 198/511] man-page: Fix install dir `avrdude.1` is installed into `man` dir instead of its proper section location. This is due to the definition of `TYPE MAN` which points to `/man` according to cmake docs. Use `DESTINATION` and add proper section subdir. This allows for `man -M /share/man -w 1 avrdude` to succeed instead of throwing `No manual entry for avrdude in section 1` Signed-off-by: brutzzl3r --- src/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f3eedcd8..804468c1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -273,4 +273,6 @@ install(TARGETS libavrdude PUBLIC_HEADER DESTINATION include COMPONENT dev ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avrdude.conf" TYPE SYSCONF) -install(FILES avrdude.1 TYPE MAN) +install(FILES "avrdude.1" + DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" + ) From c9736a9db5f1c0aae4023a32ef905a6d9ea6bc1e Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sat, 13 Aug 2022 20:51:12 +0100 Subject: [PATCH 199/511] Specifying the full memory name now always works ... even if a memory with longer name and same initial part exists --- src/avrpart.c | 61 +++++++++++++++------------------------------------ 1 file changed, 18 insertions(+), 43 deletions(-) diff --git a/src/avrpart.c b/src/avrpart.c index 526d0503..df514f1d 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -423,88 +423,63 @@ void avr_free_memalias(AVRMEM_ALIAS *m) { AVRMEM_ALIAS *avr_locate_memalias(const AVRPART *p, const char *desc) { AVRMEM_ALIAS * m, * match; LNODEID ln; - int matches; + int matches, exact; int l; if(!p || !desc || !p->mem_alias) return NULL; l = strlen(desc); - matches = 0; + matches = exact = 0; match = NULL; for (ln=lfirst(p->mem_alias); ln; ln=lnext(ln)) { m = ldata(ln); - if (strncmp(desc, m->desc, l) == 0) { + if (strncmp(m->desc, desc, l) == 0) { // Partial initial match match = m; matches++; + if(m->desc[l] == 0) // Exact match between arg and memory + exact++; } } - if (matches == 1) - return match; - - return NULL; + return exact == 1 || matches == 1? match: NULL; } AVRMEM *avr_locate_mem_noalias(const AVRPART *p, const char *desc) { AVRMEM * m, * match; LNODEID ln; - int matches; + int matches, exact; int l; if(!p || !desc || !p->mem) return NULL; l = strlen(desc); - matches = 0; + matches = exact = 0; match = NULL; for (ln=lfirst(p->mem); ln; ln=lnext(ln)) { m = ldata(ln); - if (strncmp(desc, m->desc, l) == 0) { + if (strncmp(m->desc, desc, l) == 0) { // Partial initial match match = m; matches++; + if(m->desc[l] == 0) // Exact match between arg and memory + exact++; } } - if (matches == 1) - return match; - - return NULL; + return exact == 1 || matches == 1? match: NULL; } AVRMEM *avr_locate_mem(const AVRPART *p, const char *desc) { - AVRMEM * m, * match; - AVRMEM_ALIAS * alias; - LNODEID ln; - int matches; - int l; + AVRMEM *m = avr_locate_mem_noalias(p, desc); - if(!p || !desc) - return NULL; + if(m) + return m; - l = strlen(desc); - matches = 0; - match = NULL; - if(p->mem) { - for (ln=lfirst(p->mem); ln; ln=lnext(ln)) { - m = ldata(ln); - if (strncmp(desc, m->desc, l) == 0) { - match = m; - matches++; - } - } - } - - if (matches == 1) - return match; - - /* not yet found: look for matching alias name */ - alias = avr_locate_memalias(p, desc); - if (alias != NULL) - return alias->aliased_mem; - - return NULL; + // Not yet found: look for matching alias name + AVRMEM_ALIAS *a = avr_locate_memalias(p, desc); + return a? a->aliased_mem: NULL; } AVRMEM_ALIAS *avr_find_memalias(const AVRPART *p, const AVRMEM *m_orig) { From 297740db0e078e90387507e849cb5a7b5ded2c09 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sat, 13 Aug 2022 22:57:54 +0100 Subject: [PATCH 200/511] Stop listing programmers where id starts with . --- src/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.c b/src/main.c index ae9e5ea8..c135ef00 100644 --- a/src/main.c +++ b/src/main.c @@ -140,6 +140,10 @@ static void list_programmers_callback(const char *name, const char *desc, void *cookie) { struct list_walk_cookie *c = (struct list_walk_cookie *)cookie; + + if (*name == 0 || *name == '.') + return; + if (verbose){ fprintf(c->f, "%s%-16s = %-30s [%s:%d]\n", c->prefix, name, desc, cfgname, cfglineno); From a4bfa8247df8ddb447980e42a347035742046500 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 15 Aug 2022 00:56:38 +0100 Subject: [PATCH 201/511] Update NEWS --- NEWS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NEWS b/NEWS index c312a97f..15f9e955 100644 --- a/NEWS +++ b/NEWS @@ -59,6 +59,14 @@ Changes since version 7.0: errors and exit but skip -U memory updates with known memories that the part lacks #1053 - Handle invalid -U file format specifiers for input #1042 + - Implement a dry run for -U updates before opening the + programmer #1056 + - Implement -c /dev_options for printing avrdude.conf + show comments with -p*/s or -c*/s; Reduce -p */r raw output; + specifying the full memory name now always works; stop + listing programmers where id starts with dot #1059 + - Fix logfile short option in man-page; fix install dir for man + page #1063 * Internals: From e332ecf0b422e2925f40387f42ea966175bac465 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 15 Aug 2022 14:25:58 +0100 Subject: [PATCH 202/511] Change array for copy mem->desc to const char * in term.c --- src/libavrdude.h | 1 - src/term.c | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libavrdude.h b/src/libavrdude.h index 460f66fd..4e22c5ed 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -283,7 +283,6 @@ typedef struct avrpart { int lineno; /* config file line number */ } AVRPART; -#define AVR_MEMDESCLEN 64 typedef struct avrmem { const char *desc; /* memory description ("flash", "eeprom", etc) */ LISTID comments; // Used by developer options -p*/[ASsr...] diff --git a/src/term.c b/src/term.c index 839e5608..512e5a3c 100644 --- a/src/term.c +++ b/src/term.c @@ -252,7 +252,7 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, } enum { read_size = 256 }; - static char prevmem[AVR_MEMDESCLEN] = {0x00}; + static const char *prevmem = ""; char * memtype = argv[1]; AVRMEM * mem = avr_locate_mem(p, memtype); if (mem == NULL) { @@ -282,7 +282,7 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, // Get no. bytes to read if present static int len = read_size; if (argc >= 3) { - memset(prevmem, 0x00, sizeof(prevmem)); + prevmem = cache_string(""); if (strcmp(argv[argc - 1], "...") == 0) { if (argc == 3) addr = 0; @@ -303,8 +303,7 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p, if (strncmp(prevmem, memtype, strlen(memtype)) != 0) { addr = 0; len = read_size; - strncpy(prevmem, memtype, sizeof(prevmem) - 1); - prevmem[sizeof(prevmem) - 1] = 0; + prevmem = cache_string(mem->desc); } if (addr >= maxsize) addr = 0; // Wrap around From dfef8bb0a8afce211836e0153fecec707ba427b0 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 15 Aug 2022 14:57:04 +0100 Subject: [PATCH 203/511] Add libavrdude functions avr_mem_is_flash_type() and avr_mem_is_eeprom_type() --- src/avr.c | 17 +++++++++++++---- src/flip1.c | 6 +++--- src/flip2.c | 6 +++--- src/jtag3.c | 7 ++----- src/jtagmkII.c | 7 ++----- src/libavrdude.h | 5 +++++ src/main.c | 2 +- 7 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/avr.c b/src/avr.c index 62760ce7..49994c47 100644 --- a/src/avr.c +++ b/src/avr.c @@ -295,10 +295,7 @@ int avr_mem_hiaddr(AVRMEM * mem) return mem->size; /* if the memory is not a flash-type memory do not remove trailing 0xff */ - if(strcasecmp(mem->desc, "flash") && - strcasecmp(mem->desc, "application") && - strcasecmp(mem->desc, "apptable") && - strcasecmp(mem->desc, "boot")) + if(!avr_mem_is_flash_type(mem)) return mem->size; /* return the highest non-0xff address regardless of how much @@ -1253,6 +1250,18 @@ void avr_add_mem_order(const char *str) { exit(1); } +int avr_mem_is_flash_type(AVRMEM *mem) { + return + strcmp(mem->desc, "flash") == 0 || + strcmp(mem->desc, "application") == 0 || + strcmp(mem->desc, "apptable") == 0 || + strcmp(mem->desc, "boot") == 0; +} + +int avr_mem_is_eeprom_type(AVRMEM *mem) { + return strcmp(mem->desc, "eeprom") == 0; +} + int avr_mem_is_known(const char *str) { if(str && *str) for(size_t i=0; i < sizeof avr_mem_order/sizeof *avr_mem_order; i++) diff --git a/src/flip1.c b/src/flip1.c index 0c8a3ab2..4db54aad 100644 --- a/src/flip1.c +++ b/src/flip1.c @@ -395,7 +395,7 @@ int flip1_read_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, if (FLIP1(pgm)->dfu == NULL) return -1; - if (strcasecmp(mem->desc, "signature") == 0) { + if (strcmp(mem->desc, "signature") == 0) { if (flip1_read_sig_bytes(pgm, part, mem) < 0) return -1; if (addr > mem->size) { @@ -856,9 +856,9 @@ const char * flip1_mem_unit_str(enum flip1_mem_unit mem_unit) } enum flip1_mem_unit flip1_mem_unit(const char *name) { - if (strcasecmp(name, "flash") == 0) + if (strcmp(name, "flash") == 0) return FLIP1_MEM_UNIT_FLASH; - if (strcasecmp(name, "eeprom") == 0) + if (strcmp(name, "eeprom") == 0) return FLIP1_MEM_UNIT_EEPROM; return FLIP1_MEM_UNIT_UNKNOWN; } diff --git a/src/flip2.c b/src/flip2.c index 750be244..a1bebc1c 100644 --- a/src/flip2.c +++ b/src/flip2.c @@ -905,11 +905,11 @@ const char * flip2_mem_unit_str(enum flip2_mem_unit mem_unit) } enum flip2_mem_unit flip2_mem_unit(const char *name) { - if (strcasecmp(name, "application") == 0) + if (strcmp(name, "application") == 0) return FLIP2_MEM_UNIT_FLASH; - if (strcasecmp(name, "eeprom") == 0) + if (strcmp(name, "eeprom") == 0) return FLIP2_MEM_UNIT_EEPROM; - if (strcasecmp(name, "signature") == 0) + if (strcmp(name, "signature") == 0) return FLIP2_MEM_UNIT_SIGNATURE; return FLIP2_MEM_UNIT_UNKNOWN; } diff --git a/src/jtag3.c b/src/jtag3.c index 5612d0ed..a13c5c39 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1976,16 +1976,13 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, cmd[2] = 0; cmd[3] = ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) ? MTYPE_FLASH : MTYPE_FLASH_PAGE; - if (strcmp(mem->desc, "flash") == 0 || - strcmp(mem->desc, "application") == 0 || - strcmp(mem->desc, "apptable") == 0 || - strcmp(mem->desc, "boot") == 0) { + if (avr_mem_is_flash_type(mem)) { addr += mem->offset & (512 * 1024 - 1); /* max 512 KiB flash */ pagesize = PDATA(pgm)->flash_pagesize; paddr = addr & ~(pagesize - 1); paddr_ptr = &PDATA(pgm)->flash_pageaddr; cache_ptr = PDATA(pgm)->flash_pagecache; - } else if (strcmp(mem->desc, "eeprom") == 0) { + } else if (avr_mem_is_eeprom_type(mem)) { if ( (pgm->flag & PGM_FL_IS_DW) || ( p->flags & AVRPART_HAS_PDI ) || ( p->flags & AVRPART_HAS_UPDI ) ) { cmd[3] = MTYPE_EEPROM; } else { diff --git a/src/jtagmkII.c b/src/jtagmkII.c index ef45ee22..98ee87b1 100644 --- a/src/jtagmkII.c +++ b/src/jtagmkII.c @@ -2253,15 +2253,12 @@ static int jtagmkII_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, addr += mem->offset; cmd[1] = ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) ? MTYPE_FLASH : MTYPE_FLASH_PAGE; - if (strcmp(mem->desc, "flash") == 0 || - strcmp(mem->desc, "application") == 0 || - strcmp(mem->desc, "apptable") == 0 || - strcmp(mem->desc, "boot") == 0) { + if (avr_mem_is_flash_type(mem)) { pagesize = PDATA(pgm)->flash_pagesize; paddr = addr & ~(pagesize - 1); paddr_ptr = &PDATA(pgm)->flash_pageaddr; cache_ptr = PDATA(pgm)->flash_pagecache; - } else if (strcmp(mem->desc, "eeprom") == 0) { + } else if (avr_mem_is_eeprom_type(mem)) { if ( (pgm->flag & PGM_FL_IS_DW) || ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) ) { /* debugWire cannot use page access for EEPROM */ cmd[1] = MTYPE_EEPROM; diff --git a/src/libavrdude.h b/src/libavrdude.h index 4e22c5ed..eef7a67c 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -842,7 +842,12 @@ int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles); void avr_add_mem_order(const char *str); +int avr_mem_is_flash_type(AVRMEM *mem); + +int avr_mem_is_eeprom_type(AVRMEM *mem); + int avr_mem_is_known(const char *str); + int avr_mem_might_be_known(const char *str); #define disable_trailing_ff_removal() avr_mem_hiaddr(NULL) diff --git a/src/main.c b/src/main.c index da1c90b6..54f6e633 100644 --- a/src/main.c +++ b/src/main.c @@ -1213,7 +1213,7 @@ int main(int argc, char * argv []) m = avr_locate_mem(p, upd->memtype); if (m == NULL) continue; - if ((strcasecmp(m->desc, memname) == 0) && (upd->op == DEVICE_WRITE)) { + if ((strcmp(m->desc, memname) == 0) && (upd->op == DEVICE_WRITE)) { erase = 1; if (quell_progress < 2) { avrdude_message(MSG_INFO, "%s: NOTE: \"%s\" memory has been specified, an erase cycle " From c03f4a7925c8c3ff2e322684f233068cedd12e68 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 17 Aug 2022 16:05:28 +0100 Subject: [PATCH 204/511] Use const in PROGRAMMER function arguments where appropriate In order to get meaningful const properties for the PROGRAMMER, AVRPART and AVRMEM arguments, some code needed to be moved around, otherwise a network of "tainted" assignments risked rendering nothing const: - Change void (*enable)(PROGRAMMER *pgm) to void (*enable)(PROGRAMMER *pgm, const AVRPART *p); this allows changes in the PROGRAMMER structure after the part is known. For example, use TPI, UPDI, PDI functions in that programmer appropriate to the part. This used to be done later in the process, eg, in the initialize() function, which "taints" all other programmer functions wrt const and sometimes requires other finessing with flags etc. Much clearer with the modified enable() interface. - Move TPI initpgm-type code from initialize() to enable() --- note that initpgm() does not have the info at the time when it is called whether or not TPI is required - buspirate.c: move pgm->flag to PDATA(pgm)->flag (so legitimate modification of the flag does not change PROGRAMMER structure) - Move AVRPART_INIT_SMC and AVRPART_WRITE bits from the flags field in AVRPART to jtagmkII.c's private data flags32 fiels as FLAGS32_INIT_SMC and FLAGS32_WRITE bits - Move the xbeeResetPin component to private data in stk500.c as this is needed by xbee when it saddles on the stk500 code (previously, the flags component of the part was re-dedicated to this) - Change the way the "chained" private data are used in jtag3.c whilst keeping the PROGRAMMER structure read-only otherwise - In stk500v2.c move the STK600 pgm update from stk500v2_initialize() to stk500v2_enable() so the former keeps the PROGRAMMER structure read-only (for const assertion). - In usbasp change the code from changing PROGRAMMER functions late to dispatching to TPI or regular SPI protocol functions at runtime; reason being the decision whether to use TPI protocol is done at run-time depending on the capability of the attached programmer Also fixes Issue #1071, the treatment of default eecr value. --- src/arduino.c | 9 +- src/arduino.h | 2 +- src/avr.c | 48 ++--- src/avr910.c | 71 +++---- src/avr910.h | 2 +- src/avrdude.conf.in | 2 +- src/avrftdi.c | 91 ++++----- src/avrftdi.h | 2 +- src/avrftdi_tpi.c | 48 +++-- src/avrftdi_tpi.h | 9 +- src/bitbang.c | 45 ++--- src/bitbang.h | 30 +-- src/buspirate.c | 205 +++++++++----------- src/buspirate.h | 4 +- src/butterfly.c | 87 ++++----- src/butterfly.h | 4 +- src/config_gram.y | 2 +- src/dfu.c | 5 +- src/dfu.h | 2 +- src/doc/avrdude.texi | 2 +- src/flip1.c | 98 ++++------ src/flip1.h | 2 +- src/flip2.c | 91 ++++----- src/flip2.h | 2 +- src/ft245r.c | 113 ++++++----- src/ft245r.h | 2 +- src/jtag3.c | 176 +++++++----------- src/jtag3.h | 22 +-- src/jtagmkI.c | 89 ++++----- src/jtagmkI.h | 2 +- src/jtagmkII.c | 254 ++++++++++--------------- src/jtagmkII.h | 24 +-- src/libavrdude.h | 141 +++++++------- src/linuxgpio.c | 34 ++-- src/linuxgpio.h | 2 +- src/linuxspi.c | 58 +++--- src/linuxspi.h | 2 +- src/main.c | 14 +- src/micronucleus.c | 52 ++---- src/micronucleus.h | 2 +- src/par.c | 78 ++++---- src/par.h | 2 +- src/pgm.c | 69 ++++--- src/pgm_type.c | 2 +- src/pickit2.c | 88 ++++----- src/pickit2.h | 2 +- src/pindefs.c | 4 +- src/ppi.c | 26 +-- src/ppi.h | 16 +- src/ppiwin.c | 39 ++-- src/ser_avrdoper.c | 18 +- src/ser_posix.c | 28 +-- src/ser_win32.c | 34 ++-- src/serbb.h | 2 +- src/serbb_posix.c | 33 ++-- src/serbb_win32.c | 33 ++-- src/serialupdi.c | 74 +++----- src/serialupdi.h | 2 +- src/stk500.c | 94 ++++------ src/stk500.h | 16 +- src/stk500generic.c | 6 +- src/stk500generic.h | 2 +- src/stk500v2.c | 411 ++++++++++++++++++----------------------- src/stk500v2.h | 26 +-- src/stk500v2_private.h | 2 +- src/teensy.c | 55 ++---- src/teensy.h | 2 +- src/updi_link.c | 77 +++----- src/updi_link.h | 32 ++-- src/updi_nvm.c | 116 ++++-------- src/updi_nvm.h | 20 +- src/updi_readwrite.c | 30 +-- src/updi_readwrite.h | 20 +- src/updi_state.c | 21 +-- src/updi_state.h | 14 +- src/usb_hidapi.c | 9 +- src/usb_libusb.c | 11 +- src/usbasp.c | 244 +++++++++++++----------- src/usbasp.h | 2 +- src/usbtiny.c | 75 +++----- src/usbtiny.h | 2 +- src/wiring.c | 9 +- src/wiring.h | 2 +- src/xbee.c | 78 ++------ src/xbee.h | 23 ++- 85 files changed, 1582 insertions(+), 2217 deletions(-) diff --git a/src/arduino.c b/src/arduino.c index f7b60246..c7aa2deb 100644 --- a/src/arduino.c +++ b/src/arduino.c @@ -38,8 +38,7 @@ #include "arduino.h" /* read signature bytes - arduino version */ -static int arduino_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m) -{ +static int arduino_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m) { unsigned char buf[32]; /* Signature byte reads are always 3 bytes. */ @@ -80,8 +79,7 @@ static int arduino_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m) return 3; } -static int arduino_open(PROGRAMMER * pgm, char * port) -{ +static int arduino_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; strcpy(pgm->port, port); pinfo.serialinfo.baud = pgm->baudrate? pgm->baudrate: 115200; @@ -118,8 +116,7 @@ static void arduino_close(PROGRAMMER * pgm) const char arduino_desc[] = "Arduino programmer"; -void arduino_initpgm(PROGRAMMER * pgm) -{ +void arduino_initpgm(PROGRAMMER *pgm) { /* This is mostly a STK500; just the signature is read differently than on real STK500v1 and the DTR signal is set when opening the serial port diff --git a/src/arduino.h b/src/arduino.h index 024d711b..ce1ff9b8 100644 --- a/src/arduino.h +++ b/src/arduino.h @@ -22,7 +22,7 @@ #define arduino_h__ extern const char arduino_desc[]; -void arduino_initpgm (PROGRAMMER * pgm); +void arduino_initpgm(PROGRAMMER *pgm); #endif diff --git a/src/avr.c b/src/avr.c index 49994c47..7a1f34a6 100644 --- a/src/avr.c +++ b/src/avr.c @@ -38,8 +38,7 @@ FP_UpdateProgress update_progress; #define DEBUG 0 /* TPI: returns 1 if NVM controller busy, 0 if free */ -int avr_tpi_poll_nvmbsy(PROGRAMMER *pgm) -{ +int avr_tpi_poll_nvmbsy(const PROGRAMMER *pgm) { unsigned char cmd; unsigned char res; @@ -49,8 +48,7 @@ int avr_tpi_poll_nvmbsy(PROGRAMMER *pgm) } /* TPI chip erase sequence */ -int avr_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +int avr_tpi_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { int err; AVRMEM *mem; @@ -99,8 +97,7 @@ int avr_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p) } /* TPI program enable sequence */ -int avr_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p, unsigned char guard_time) -{ +int avr_tpi_program_enable(const PROGRAMMER *pgm, const AVRPART *p, unsigned char guard_time) { int err, retry; unsigned char cmd[2]; unsigned char response; @@ -149,7 +146,7 @@ int avr_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p, unsigned char guard_ti } /* TPI: setup NVMCMD register and pointer register (PR) for read/write/erase */ -static int avr_tpi_setup_rw(PROGRAMMER * pgm, AVRMEM * mem, +static int avr_tpi_setup_rw(const PROGRAMMER *pgm, const AVRMEM *mem, unsigned long addr, unsigned char nvmcmd) { unsigned char cmd[4]; @@ -178,7 +175,7 @@ static int avr_tpi_setup_rw(PROGRAMMER * pgm, AVRMEM * mem, return 0; } -int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +int avr_read_byte_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value) { unsigned char cmd[4]; @@ -280,7 +277,7 @@ int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, * no-op. Always return an even number since flash is word addressed. * Only apply this optimisation on flash-type memory. */ -int avr_mem_hiaddr(AVRMEM * mem) +int avr_mem_hiaddr(const AVRMEM * mem) { int i, n; static int disableffopt; @@ -322,7 +319,7 @@ int avr_mem_hiaddr(AVRMEM * mem) * * Return the number of bytes read, or < 0 if an error occurs. */ -int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, +int avr_read(const PROGRAMMER *pgm, const AVRPART *p, const char *memtype, AVRPART * v) { unsigned long i, lastaddr; @@ -469,7 +466,7 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, /* * write a page data at the specified address */ -int avr_write_page(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +int avr_write_page(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr) { unsigned char cmd[4]; @@ -529,7 +526,7 @@ int avr_write_page(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } -int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +int avr_write_byte_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data) { unsigned char cmd[4]; @@ -790,7 +787,7 @@ int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, /* * write a byte of data at the specified address */ -int avr_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +int avr_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data) { return pgm->write_byte(pgm, p, mem, addr, data); @@ -806,8 +803,8 @@ int avr_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, * * Return the number of bytes written, or -1 if an error occurs. */ -int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size, - int auto_erase) +int avr_write(const PROGRAMMER *pgm, const AVRPART *p, const char *memtype, + int size, int auto_erase) { int rc; int newpage, page_tainted, flush_page, do_write; @@ -1031,8 +1028,7 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size, /* * read the AVR device's signature bytes */ -int avr_signature(PROGRAMMER * pgm, AVRPART * p) -{ +int avr_signature(const PROGRAMMER *pgm, const AVRPART *p) { int rc; report_progress (0,1,"Reading"); @@ -1084,7 +1080,7 @@ int compare_memory_masked(AVRMEM * m, uint8_t b1, uint8_t b2) { * * Return the number of bytes verified, or -1 if they don't match. */ -int avr_verify(AVRPART * p, AVRPART * v, char * memtype, int size) +int avr_verify(const AVRPART * p, const AVRPART * v, const char * memtype, int size) { int i; unsigned char * buf1, * buf2; @@ -1153,8 +1149,7 @@ int avr_verify(AVRPART * p, AVRPART * v, char * memtype, int size) } -int avr_get_cycle_count(PROGRAMMER * pgm, AVRPART * p, int * cycles) -{ +int avr_get_cycle_count(const PROGRAMMER *pgm, const AVRPART *p, int *cycles) { AVRMEM * a; unsigned int cycle_count = 0; unsigned char v1; @@ -1192,8 +1187,7 @@ int avr_get_cycle_count(PROGRAMMER * pgm, AVRPART * p, int * cycles) } -int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles) -{ +int avr_put_cycle_count(const PROGRAMMER *pgm, const AVRPART *p, int cycles) { AVRMEM * a; unsigned char v1; int rc; @@ -1250,7 +1244,7 @@ void avr_add_mem_order(const char *str) { exit(1); } -int avr_mem_is_flash_type(AVRMEM *mem) { +int avr_mem_is_flash_type(const AVRMEM *mem) { return strcmp(mem->desc, "flash") == 0 || strcmp(mem->desc, "application") == 0 || @@ -1258,7 +1252,7 @@ int avr_mem_is_flash_type(AVRMEM *mem) { strcmp(mem->desc, "boot") == 0; } -int avr_mem_is_eeprom_type(AVRMEM *mem) { +int avr_mem_is_eeprom_type(const AVRMEM *mem) { return strcmp(mem->desc, "eeprom") == 0; } @@ -1279,8 +1273,7 @@ int avr_mem_might_be_known(const char *str) { } -int avr_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +int avr_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { int rc; rc = pgm->chip_erase(pgm, p); @@ -1288,8 +1281,7 @@ int avr_chip_erase(PROGRAMMER * pgm, AVRPART * p) return rc; } -int avr_unlock(PROGRAMMER * pgm, AVRPART * p) -{ +int avr_unlock(const PROGRAMMER *pgm, const AVRPART *p) { int rc = -1; if (pgm->unlock) diff --git a/src/avr910.c b/src/avr910.c index 3e14fdc1..6e2f1f07 100644 --- a/src/avr910.c +++ b/src/avr910.c @@ -71,14 +71,12 @@ static void avr910_teardown(PROGRAMMER * pgm) } -static int avr910_send(PROGRAMMER * pgm, char * buf, size_t len) -{ +static int avr910_send(const PROGRAMMER *pgm, char *buf, size_t len) { return serial_send(&pgm->fd, (unsigned char *)buf, len); } -static int avr910_recv(PROGRAMMER * pgm, char * buf, size_t len) -{ +static int avr910_recv(const PROGRAMMER *pgm, char *buf, size_t len) { int rv; rv = serial_recv(&pgm->fd, (unsigned char *)buf, len); @@ -91,14 +89,12 @@ static int avr910_recv(PROGRAMMER * pgm, char * buf, size_t len) } -static int avr910_drain(PROGRAMMER * pgm, int display) -{ +static int avr910_drain(const PROGRAMMER *pgm, int display) { return serial_drain(&pgm->fd, display); } -static int avr910_vfy_cmd_sent(PROGRAMMER * pgm, char * errmsg) -{ +static int avr910_vfy_cmd_sent(const PROGRAMMER *pgm, char *errmsg) { char c; avr910_recv(pgm, &c, 1); @@ -114,8 +110,7 @@ static int avr910_vfy_cmd_sent(PROGRAMMER * pgm, char * errmsg) /* * issue the 'chip erase' command to the AVR device */ -static int avr910_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int avr910_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { avr910_send(pgm, "e", 1); if (avr910_vfy_cmd_sent(pgm, "chip erase") < 0) return -1; @@ -129,15 +124,13 @@ static int avr910_chip_erase(PROGRAMMER * pgm, AVRPART * p) } -static int avr910_enter_prog_mode(PROGRAMMER * pgm) -{ +static int avr910_enter_prog_mode(const PROGRAMMER *pgm) { avr910_send(pgm, "P", 1); return avr910_vfy_cmd_sent(pgm, "enter prog mode"); } -static int avr910_leave_prog_mode(PROGRAMMER * pgm) -{ +static int avr910_leave_prog_mode(const PROGRAMMER *pgm) { avr910_send(pgm, "L", 1); return avr910_vfy_cmd_sent(pgm, "leave prog mode"); } @@ -146,8 +139,7 @@ static int avr910_leave_prog_mode(PROGRAMMER * pgm) /* * issue the 'program enable' command to the AVR device */ -static int avr910_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +static int avr910_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { return -1; } @@ -155,8 +147,7 @@ static int avr910_program_enable(PROGRAMMER * pgm, AVRPART * p) /* * initialize the AVR device and prepare it to accept commands */ -static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int avr910_initialize(const PROGRAMMER *pgm, const AVRPART *p) { char id[8]; char sw[2]; char hw[2]; @@ -273,16 +264,14 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p) } -static void avr910_disable(PROGRAMMER * pgm) -{ +static void avr910_disable(const PROGRAMMER *pgm) { /* Do nothing. */ return; } -static void avr910_enable(PROGRAMMER * pgm) -{ +static void avr910_enable(PROGRAMMER *pgm, const AVRPART *p) { /* Do nothing. */ return; @@ -293,7 +282,7 @@ static void avr910_enable(PROGRAMMER * pgm) * transmit an AVR device command and return the results; 'cmd' and * 'res' must point to at least a 4 byte data buffer */ -static int avr910_cmd(PROGRAMMER * pgm, const unsigned char *cmd, +static int avr910_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { char buf[5]; @@ -318,8 +307,7 @@ static int avr910_cmd(PROGRAMMER * pgm, const unsigned char *cmd, } -static int avr910_parseextparms(PROGRAMMER * pgm, LISTID extparms) -{ +static int avr910_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) { LNODEID ln; const char *extended_param; int rv = 0; @@ -359,8 +347,7 @@ static int avr910_parseextparms(PROGRAMMER * pgm, LISTID extparms) } -static int avr910_open(PROGRAMMER * pgm, char * port) -{ +static int avr910_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; /* * If baudrate was not specified use 19.200 Baud @@ -393,14 +380,12 @@ static void avr910_close(PROGRAMMER * pgm) } -static void avr910_display(PROGRAMMER * pgm, const char * p) -{ +static void avr910_display(const PROGRAMMER *pgm, const char *p) { return; } -static void avr910_set_addr(PROGRAMMER * pgm, unsigned long addr) -{ +static void avr910_set_addr(const PROGRAMMER *pgm, unsigned long addr) { char cmd[3]; cmd[0] = 'A'; @@ -412,7 +397,7 @@ static void avr910_set_addr(PROGRAMMER * pgm, unsigned long addr) } -static int avr910_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int avr910_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr, unsigned char value) { char cmd[2]; @@ -445,7 +430,7 @@ static int avr910_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } -static int avr910_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int avr910_read_byte_flash(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr, unsigned char * value) { char buf[2]; @@ -468,7 +453,7 @@ static int avr910_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } -static int avr910_read_byte_eeprom(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int avr910_read_byte_eeprom(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr, unsigned char * value) { avr910_set_addr(pgm, addr); @@ -479,7 +464,7 @@ static int avr910_read_byte_eeprom(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } -static int avr910_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int avr910_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr, unsigned char * value) { if (strcmp(m->desc, "flash") == 0) { @@ -494,7 +479,7 @@ static int avr910_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } -static int avr910_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int avr910_paged_write_flash(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -553,8 +538,8 @@ static int avr910_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } -static int avr910_paged_write_eeprom(PROGRAMMER * pgm, AVRPART * p, - AVRMEM * m, +static int avr910_paged_write_eeprom(const PROGRAMMER *pgm, const AVRPART *p, + const AVRMEM * m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -582,7 +567,7 @@ static int avr910_paged_write_eeprom(PROGRAMMER * pgm, AVRPART * p, } -static int avr910_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int avr910_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -642,7 +627,7 @@ static int avr910_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } -static int avr910_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int avr910_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -719,8 +704,7 @@ static int avr910_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, /* Signature byte reads are always 3 bytes. */ -static int avr910_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m) -{ +static int avr910_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m) { unsigned char tmp; if (m->size < 3) { @@ -740,8 +724,7 @@ static int avr910_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m) const char avr910_desc[] = "Serial programmers using protocol described in application note AVR910"; -void avr910_initpgm(PROGRAMMER * pgm) -{ +void avr910_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "avr910"); /* diff --git a/src/avr910.h b/src/avr910.h index 808f7e68..c18e7779 100644 --- a/src/avr910.h +++ b/src/avr910.h @@ -26,7 +26,7 @@ extern "C" { #endif extern const char avr910_desc[]; -void avr910_initpgm (PROGRAMMER * pgm); +void avr910_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index c0c3e168..b4c28a12 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -116,7 +116,7 @@ # idr = ; # IO addr of IDR (OCD) reg # rampz = ; # IO addr of RAMPZ reg # spmcr = ; # mem addr of SPMC[S]R reg -# eecr = ; # mem addr of EECR reg only when != 0x3c +# eecr = ; # mem addr of EECR reg only when != 0x3f # mcu_base = ; # nvm_base = ; # ocd_base = ; diff --git a/src/avrftdi.c b/src/avrftdi.c index 315f23e8..fdb8e557 100644 --- a/src/avrftdi.c +++ b/src/avrftdi.c @@ -50,16 +50,14 @@ #ifdef DO_NOT_BUILD_AVRFTDI -static int avrftdi_noftdi_open (struct programmer_t *pgm, char * name) -{ +static int avrftdi_noftdi_open(PROGRAMMER *pgm, const char *name) { avrdude_message(MSG_INFO, "%s: Error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.\n", progname); return -1; } -void avrftdi_initpgm(PROGRAMMER * pgm) -{ +void avrftdi_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "avrftdi"); pgm->open = avrftdi_noftdi_open; } @@ -227,8 +225,7 @@ static int set_frequency(avrftdi_t* ftdi, uint32_t freq) * Because we configured the pin direction mask earlier, nothing bad can happen * here. */ -static int set_pin(PROGRAMMER * pgm, int pinfunc, int value) -{ +static int set_pin(const PROGRAMMER *pgm, int pinfunc, int value) { avrftdi_t* pdata = to_pdata(pgm); struct pindef_t pin = pgm->pin[pinfunc]; @@ -250,47 +247,43 @@ static int set_pin(PROGRAMMER * pgm, int pinfunc, int value) /* * Mandatory callbacks which boil down to GPIO. */ -static int set_led_pgm(struct programmer_t * pgm, int value) -{ +static int set_led_pgm(const PROGRAMMER *pgm, int value) { return set_pin(pgm, PIN_LED_PGM, value); } -static int set_led_rdy(struct programmer_t * pgm, int value) -{ +static int set_led_rdy(const PROGRAMMER *pgm, int value) { return set_pin(pgm, PIN_LED_RDY, value); } -static int set_led_err(struct programmer_t * pgm, int value) -{ +static int set_led_err(const PROGRAMMER *pgm, int value) { return set_pin(pgm, PIN_LED_ERR, value); } -static int set_led_vfy(struct programmer_t * pgm, int value) -{ +static int set_led_vfy(const PROGRAMMER *pgm, int value) { return set_pin(pgm, PIN_LED_VFY, value); } -static void avrftdi_enable(PROGRAMMER * pgm) -{ +static void avrftdi_enable(PROGRAMMER *pgm, const AVRPART *p) { set_pin(pgm, PPI_AVR_BUFF, ON); + + // Switch to TPI initialisation in avrftdi_tpi.c + if(p->flags & AVRPART_HAS_TPI) + avrftdi_tpi_initpgm(pgm); } -static void avrftdi_disable(PROGRAMMER * pgm) -{ +static void avrftdi_disable(const PROGRAMMER *pgm) { set_pin(pgm, PPI_AVR_BUFF, OFF); } -static void avrftdi_powerup(PROGRAMMER * pgm) -{ +static void avrftdi_powerup(const PROGRAMMER *pgm) { set_pin(pgm, PPI_AVR_VCC, ON); } -static void avrftdi_powerdown(PROGRAMMER * pgm) -{ +static void avrftdi_powerdown(const PROGRAMMER *pgm) { set_pin(pgm, PPI_AVR_VCC, OFF); } -static inline int set_data(PROGRAMMER * pgm, unsigned char *buf, unsigned char data, bool read_data) { +static inline int set_data(const PROGRAMMER *pgm, unsigned char *buf, unsigned char data, bool read_data) { int j; int buf_pos = 0; unsigned char bit = 0x80; @@ -324,7 +317,7 @@ static inline int set_data(PROGRAMMER * pgm, unsigned char *buf, unsigned char d return buf_pos; } -static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, int offset) { +static inline unsigned char extract_data(const PROGRAMMER *pgm, unsigned char *buf, int offset) { int j; unsigned char bit = 0x80; unsigned char r = 0; @@ -342,7 +335,7 @@ static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, i } -static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsigned char *buf, +static int avrftdi_transmit_bb(const PROGRAMMER *pgm, unsigned char mode, const unsigned char *buf, unsigned char *data, int buf_size) { size_t remaining = buf_size; @@ -461,7 +454,7 @@ static int avrftdi_transmit_mpsse(avrftdi_t* pdata, unsigned char mode, const un return written; } -static inline int avrftdi_transmit(PROGRAMMER * pgm, unsigned char mode, const unsigned char *buf, +static inline int avrftdi_transmit(const PROGRAMMER *pgm, unsigned char mode, const unsigned char *buf, unsigned char *data, int buf_size) { avrftdi_t* pdata = to_pdata(pgm); @@ -520,8 +513,7 @@ static int write_flush(avrftdi_t* pdata) } -static int avrftdi_check_pins_bb(PROGRAMMER * pgm, bool output) -{ +static int avrftdi_check_pins_bb(const PROGRAMMER *pgm, bool output) { int pin; /* pin checklist. */ @@ -548,8 +540,7 @@ static int avrftdi_check_pins_bb(PROGRAMMER * pgm, bool output) return pins_check(pgm, pin_checklist, N_PINS, output); } -static int avrftdi_check_pins_mpsse(PROGRAMMER * pgm, bool output) -{ +static int avrftdi_check_pins_mpsse(const PROGRAMMER *pgm, bool output) { int pin; /* pin checklist. */ @@ -593,8 +584,7 @@ static int avrftdi_check_pins_mpsse(PROGRAMMER * pgm, bool output) return pins_check(pgm, pin_checklist, N_PINS, output); } -static int avrftdi_pin_setup(PROGRAMMER * pgm) -{ +static int avrftdi_pin_setup(const PROGRAMMER *pgm) { int pin; /************* @@ -648,8 +638,7 @@ static int avrftdi_pin_setup(PROGRAMMER * pgm) return 0; } -static int avrftdi_open(PROGRAMMER * pgm, char *port) -{ +static int avrftdi_open(PROGRAMMER *pgm, const char *port) { int vid, pid, interface, index, err; const char *serial, *desc; @@ -817,8 +806,7 @@ static void avrftdi_close(PROGRAMMER * pgm) return; } -static int avrftdi_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int avrftdi_initialize(const PROGRAMMER *pgm, const AVRPART *p) { avrftdi_powerup(pgm); if(p->flags & AVRPART_HAS_TPI) @@ -847,21 +835,18 @@ static int avrftdi_initialize(PROGRAMMER * pgm, AVRPART * p) return pgm->program_enable(pgm, p); } -static void avrftdi_display(PROGRAMMER * pgm, const char *p) -{ +static void avrftdi_display(const PROGRAMMER *pgm, const char *p) { // print the full pin definitions as in ft245r ? return; } -static int avrftdi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res) -{ +static int avrftdi_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { return avrftdi_transmit(pgm, MPSSE_DO_READ | MPSSE_DO_WRITE, cmd, res, 4); } -static int avrftdi_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +static int avrftdi_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { int i; unsigned char buf[4]; @@ -892,8 +877,7 @@ static int avrftdi_program_enable(PROGRAMMER * pgm, AVRPART * p) } -static int avrftdi_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int avrftdi_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4]; unsigned char res[4]; @@ -915,8 +899,7 @@ static int avrftdi_chip_erase(PROGRAMMER * pgm, AVRPART * p) /* Load extended address byte command */ static int -avrftdi_lext(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, unsigned int address) -{ +avrftdi_lext(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int address) { /* nothing to do if load extended address command unavailable */ if(m->op[AVR_OP_LOAD_EXT_ADDR] == NULL) return 0; @@ -943,7 +926,7 @@ avrftdi_lext(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, unsigned int address) return 0; } -static int avrftdi_eeprom_write(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, +static int avrftdi_eeprom_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int len) { unsigned char cmd[] = { 0x00, 0x00, 0x00, 0x00 }; @@ -965,7 +948,7 @@ static int avrftdi_eeprom_write(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, return len; } -static int avrftdi_eeprom_read(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, +static int avrftdi_eeprom_read(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int len) { unsigned char cmd[4]; @@ -991,7 +974,7 @@ static int avrftdi_eeprom_read(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, return len; } -static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int avrftdi_flash_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int len) { unsigned int word; @@ -1101,7 +1084,7 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, /* *Reading from flash */ -static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int avrftdi_flash_read(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int len) { OPCODE * readop; @@ -1178,7 +1161,7 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return len; } -static int avrftdi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int avrftdi_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { if (strcmp(m->desc, "flash") == 0) @@ -1189,7 +1172,7 @@ static int avrftdi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return -2; } -static int avrftdi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int avrftdi_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { if (strcmp(m->desc, "flash") == 0) @@ -1238,9 +1221,7 @@ avrftdi_teardown(PROGRAMMER * pgm) } } -void avrftdi_initpgm(PROGRAMMER * pgm) -{ - +void avrftdi_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "avrftdi"); /* diff --git a/src/avrftdi.h b/src/avrftdi.h index af323352..167264df 100644 --- a/src/avrftdi.h +++ b/src/avrftdi.h @@ -29,7 +29,7 @@ extern "C" { extern const char avrftdi_desc[]; -void avrftdi_initpgm (PROGRAMMER * pgm); +void avrftdi_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/avrftdi_tpi.c b/src/avrftdi_tpi.c index efb56266..dcb3d48d 100644 --- a/src/avrftdi_tpi.c +++ b/src/avrftdi_tpi.c @@ -15,8 +15,8 @@ #ifndef DO_NOT_BUILD_AVRFTDI -static void avrftdi_tpi_disable(PROGRAMMER *); -static int avrftdi_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p); +static void avrftdi_tpi_disable(const PROGRAMMER *); +static int avrftdi_tpi_program_enable(const PROGRAMMER *pgm, const AVRPART *p); #ifdef notyet static void @@ -63,23 +63,12 @@ avrftdi_debug_frame(uint16_t frame) #endif /* notyet */ int -avrftdi_tpi_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +avrftdi_tpi_initialize(const PROGRAMMER *pgm, const AVRPART *p) { int ret; avrftdi_t* pdata = to_pdata(pgm); unsigned char buf[] = { MPSSE_DO_WRITE | MPSSE_WRITE_NEG | MPSSE_LSB, 0x01, 0x00, 0xff, 0xff }; - log_info("Using TPI interface\n"); - - pgm->program_enable = avrftdi_tpi_program_enable; - pgm->cmd_tpi = avrftdi_cmd_tpi; - pgm->chip_erase = avr_tpi_chip_erase; - pgm->disable = avrftdi_tpi_disable; - - pgm->paged_load = NULL; - pgm->paged_write = NULL; - log_info("Setting /Reset pin low\n"); pgm->setpin(pgm, PIN_AVR_RESET, OFF); pgm->setpin(pgm, PIN_AVR_SCK, OFF); @@ -101,6 +90,20 @@ avrftdi_tpi_initialize(PROGRAMMER * pgm, AVRPART * p) return ret; } + +void avrftdi_tpi_initpgm(PROGRAMMER *pgm) { + log_info("Using TPI interface\n"); + + pgm->program_enable = avrftdi_tpi_program_enable; + pgm->cmd_tpi = avrftdi_cmd_tpi; + pgm->chip_erase = avr_tpi_chip_erase; + pgm->disable = avrftdi_tpi_disable; + + pgm->paged_load = NULL; + pgm->paged_write = NULL; +} + + #define TPI_PARITY_MASK 0x2000 static inline int count1s(unsigned int x) @@ -148,8 +151,7 @@ tpi_frame2byte(uint16_t frame, uint8_t * byte) #ifdef notyet static int -avrftdi_tpi_break(PROGRAMMER * pgm) -{ +avrftdi_tpi_break(const PROGRAMMER *pgm) { unsigned char buffer[] = { MPSSE_DO_WRITE | MPSSE_WRITE_NEG | MPSSE_LSB, 1, 0, 0, 0 }; E(ftdi_write_data(to_pdata(pgm)->ftdic, buffer, sizeof(buffer)) != sizeof(buffer), to_pdata(pgm)->ftdic); @@ -158,8 +160,7 @@ avrftdi_tpi_break(PROGRAMMER * pgm) #endif /* notyet */ static int -avrftdi_tpi_write_byte(PROGRAMMER * pgm, unsigned char byte) -{ +avrftdi_tpi_write_byte(const PROGRAMMER *pgm, unsigned char byte) { uint16_t frame; struct ftdi_context* ftdic = to_pdata(pgm)->ftdic; @@ -185,8 +186,7 @@ avrftdi_tpi_write_byte(PROGRAMMER * pgm, unsigned char byte) #define TPI_IDLE_BITS 2 static int -avrftdi_tpi_read_byte(PROGRAMMER * pgm, unsigned char * byte) -{ +avrftdi_tpi_read_byte(const PROGRAMMER *pgm, unsigned char *byte) { uint16_t frame; /* use 2 guard bits, 2 default idle bits + 12 frame bits = 16 bits total */ @@ -230,13 +230,12 @@ avrftdi_tpi_read_byte(PROGRAMMER * pgm, unsigned char * byte) } static int -avrftdi_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +avrftdi_tpi_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { return avr_tpi_program_enable(pgm, p, TPIPCR_GT_2b); } int -avrftdi_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, int cmd_len, +avrftdi_cmd_tpi(const PROGRAMMER *pgm, const unsigned char *cmd, int cmd_len, unsigned char *res, int res_len) { int i, err = 0; @@ -259,8 +258,7 @@ avrftdi_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, int cmd_len, } static void -avrftdi_tpi_disable(PROGRAMMER * pgm) -{ +avrftdi_tpi_disable(const PROGRAMMER *pgm) { unsigned char cmd[] = {TPI_OP_SSTCS(TPIPCR), 0}; pgm->cmd_tpi(pgm, cmd, sizeof(cmd), NULL, 0); diff --git a/src/avrftdi_tpi.h b/src/avrftdi_tpi.h index 6082a379..f9a07515 100644 --- a/src/avrftdi_tpi.h +++ b/src/avrftdi_tpi.h @@ -1,9 +1,10 @@ #pragma once -//int avrftdi_tpi_write_byte(PROGRAMMER * pgm, unsigned char byte); -//int avrftdi_tpi_read_byte(PROGRAMMER * pgm, unsigned char * byte); -int avrftdi_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, int cmd_len, +//int avrftdi_tpi_write_byte(PROGRAMMER *pgm, unsigned char byte); +//int avrftdi_tpi_read_byte(PROGRAMMER *pgm, unsigned char * byte); +int avrftdi_cmd_tpi(const PROGRAMMER *pgm, const unsigned char *cmd, int cmd_len, unsigned char *res, int res_len); -int avrftdi_tpi_initialize(PROGRAMMER * pgm, AVRPART * p); +int avrftdi_tpi_initialize(const PROGRAMMER *pgm, const AVRPART *p); +void avrftdi_tpi_initpgm(PROGRAMMER *pgm); diff --git a/src/bitbang.c b/src/bitbang.c index 592ca124..c043d740 100644 --- a/src/bitbang.c +++ b/src/bitbang.c @@ -163,8 +163,7 @@ void bitbang_delay(unsigned int us) /* * transmit and receive a byte of data to/from the AVR device */ -static unsigned char bitbang_txrx(PROGRAMMER * pgm, unsigned char byte) -{ +static unsigned char bitbang_txrx(const PROGRAMMER *pgm, unsigned char byte) { int i; unsigned char r, b, rbyte; @@ -208,8 +207,7 @@ static unsigned char bitbang_txrx(PROGRAMMER * pgm, unsigned char byte) return rbyte; } -static int bitbang_tpi_clk(PROGRAMMER * pgm) -{ +static int bitbang_tpi_clk(const PROGRAMMER *pgm) { unsigned char r = 0; pgm->setpin(pgm, PIN_AVR_SCK, 1); @@ -220,8 +218,7 @@ static int bitbang_tpi_clk(PROGRAMMER * pgm) return r; } -void bitbang_tpi_tx(PROGRAMMER * pgm, unsigned char byte) -{ +void bitbang_tpi_tx(const PROGRAMMER *pgm, unsigned char byte) { int i; unsigned char b, parity; @@ -249,8 +246,7 @@ void bitbang_tpi_tx(PROGRAMMER * pgm, unsigned char byte) bitbang_tpi_clk(pgm); } -int bitbang_tpi_rx(PROGRAMMER * pgm) -{ +int bitbang_tpi_rx(const PROGRAMMER *pgm) { int i; unsigned char b, rbyte, parity; @@ -296,26 +292,22 @@ int bitbang_tpi_rx(PROGRAMMER * pgm) return rbyte; } -int bitbang_rdy_led(PROGRAMMER * pgm, int value) -{ +int bitbang_rdy_led(const PROGRAMMER *pgm, int value) { pgm->setpin(pgm, PIN_LED_RDY, !value); return 0; } -int bitbang_err_led(PROGRAMMER * pgm, int value) -{ +int bitbang_err_led(const PROGRAMMER *pgm, int value) { pgm->setpin(pgm, PIN_LED_ERR, !value); return 0; } -int bitbang_pgm_led(PROGRAMMER * pgm, int value) -{ +int bitbang_pgm_led(const PROGRAMMER *pgm, int value) { pgm->setpin(pgm, PIN_LED_PGM, !value); return 0; } -int bitbang_vfy_led(PROGRAMMER * pgm, int value) -{ +int bitbang_vfy_led(const PROGRAMMER *pgm, int value) { pgm->setpin(pgm, PIN_LED_VFY, !value); return 0; } @@ -325,7 +317,7 @@ int bitbang_vfy_led(PROGRAMMER * pgm, int value) * transmit an AVR device command and return the results; 'cmd' and * 'res' must point to at least a 4 byte data buffer */ -int bitbang_cmd(PROGRAMMER * pgm, const unsigned char *cmd, +int bitbang_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { int i; @@ -350,7 +342,7 @@ int bitbang_cmd(PROGRAMMER * pgm, const unsigned char *cmd, return 0; } -int bitbang_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, +int bitbang_cmd_tpi(const PROGRAMMER *pgm, const unsigned char *cmd, int cmd_len, unsigned char *res, int res_len) { int i, r; @@ -392,7 +384,7 @@ int bitbang_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, * transmit bytes via SPI and return the results; 'cmd' and * 'res' must point to data buffers */ -int bitbang_spi(PROGRAMMER * pgm, const unsigned char *cmd, +int bitbang_spi(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res, int count) { int i; @@ -425,8 +417,7 @@ int bitbang_spi(PROGRAMMER * pgm, const unsigned char *cmd, /* * issue the 'chip erase' command to the AVR device */ -int bitbang_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +int bitbang_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4]; unsigned char res[4]; AVRMEM *mem; @@ -486,8 +477,7 @@ int bitbang_chip_erase(PROGRAMMER * pgm, AVRPART * p) /* * issue the 'program enable' command to the AVR device */ -int bitbang_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +int bitbang_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4]; unsigned char res[4]; int i; @@ -523,8 +513,7 @@ int bitbang_program_enable(PROGRAMMER * pgm, AVRPART * p) /* * initialize the AVR device and prepare it to accept commands */ -int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +int bitbang_initialize(const PROGRAMMER *pgm, const AVRPART *p) { int rc; int tries; int i; @@ -626,8 +615,7 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int verify_pin_assigned(PROGRAMMER * pgm, int pin, char * desc) -{ +static int verify_pin_assigned(const PROGRAMMER *pgm, int pin, char *desc) { if (pgm->pinno[pin] == 0) { avrdude_message(MSG_INFO, "%s: error: no pin has been assigned for %s\n", progname, desc); @@ -640,8 +628,7 @@ static int verify_pin_assigned(PROGRAMMER * pgm, int pin, char * desc) /* * Verify all prerequisites for a bit-bang programmer are present. */ -int bitbang_check_prerequisites(PROGRAMMER *pgm) -{ +int bitbang_check_prerequisites(const PROGRAMMER *pgm) { if (verify_pin_assigned(pgm, PIN_AVR_RESET, "AVR RESET") < 0) return -1; diff --git a/src/bitbang.h b/src/bitbang.h index b0131314..f837c1e5 100644 --- a/src/bitbang.h +++ b/src/bitbang.h @@ -31,25 +31,25 @@ int bitbang_getpin(int fd, int pin); int bitbang_highpulsepin(int fd, int pin); void bitbang_delay(unsigned int us); -int bitbang_check_prerequisites(PROGRAMMER *pgm); +int bitbang_check_prerequisites(const PROGRAMMER *pgm); -int bitbang_rdy_led (PROGRAMMER * pgm, int value); -int bitbang_err_led (PROGRAMMER * pgm, int value); -int bitbang_pgm_led (PROGRAMMER * pgm, int value); -int bitbang_vfy_led (PROGRAMMER * pgm, int value); -int bitbang_cmd (PROGRAMMER * pgm, const unsigned char *cmd, +int bitbang_rdy_led (const PROGRAMMER *pgm, int value); +int bitbang_err_led (const PROGRAMMER *pgm, int value); +int bitbang_pgm_led (const PROGRAMMER *pgm, int value); +int bitbang_vfy_led (const PROGRAMMER *pgm, int value); +int bitbang_cmd (const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res); -int bitbang_cmd_tpi (PROGRAMMER * pgm, const unsigned char *cmd, +int bitbang_cmd_tpi (const PROGRAMMER *pgm, const unsigned char *cmd, int cmd_len, unsigned char *res, int res_len); -int bitbang_spi (PROGRAMMER * pgm, const unsigned char *cmd, +int bitbang_spi (const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res, int count); -int bitbang_chip_erase (PROGRAMMER * pgm, AVRPART * p); -int bitbang_program_enable (PROGRAMMER * pgm, AVRPART * p); -void bitbang_powerup (PROGRAMMER * pgm); -void bitbang_powerdown (PROGRAMMER * pgm); -int bitbang_initialize (PROGRAMMER * pgm, AVRPART * p); -void bitbang_disable (PROGRAMMER * pgm); -void bitbang_enable (PROGRAMMER * pgm); +int bitbang_chip_erase (const PROGRAMMER *pgm, const AVRPART *p); +int bitbang_program_enable (const PROGRAMMER *pgm, const AVRPART *p); +void bitbang_powerup (const PROGRAMMER *pgm); +void bitbang_powerdown (const PROGRAMMER *pgm); +int bitbang_initialize (const PROGRAMMER *pgm, const AVRPART *p); +void bitbang_disable (const PROGRAMMER *pgm); +void bitbang_enable (PROGRAMMER *pgm, const AVRPART *p); #ifdef __cplusplus } diff --git a/src/buspirate.c b/src/buspirate.c index 36848179..72a8134e 100644 --- a/src/buspirate.c +++ b/src/buspirate.c @@ -76,14 +76,14 @@ struct pdata unsigned char pin_dir; /* Last written pin direction for bitbang mode */ unsigned char pin_val; /* Last written pin values for bitbang mode */ int unread_bytes; /* How many bytes we expected, but ignored */ + int flag; }; #define PDATA(pgm) ((struct pdata *)(pgm->cookie)) /* ====== Feature checks ====== */ static inline int -buspirate_uses_ascii(struct programmer_t *pgm) -{ - return (pgm->flag & BP_FLAG_XPARM_FORCE_ASCII); +buspirate_uses_ascii(const PROGRAMMER *pgm) { + return (PDATA(pgm)->flag & BP_FLAG_XPARM_FORCE_ASCII); } /* ====== Serial talker functions - binmode ====== */ @@ -105,8 +105,7 @@ static void dump_mem(const int msglvl, const unsigned char *buf, size_t len) avrdude_message(msglvl, "\n"); } -static int buspirate_send_bin(struct programmer_t *pgm, const unsigned char *data, size_t len) -{ +static int buspirate_send_bin(const PROGRAMMER *pgm, const unsigned char *data, size_t len) { int rc; avrdude_message(MSG_DEBUG, "%s: buspirate_send_bin():\n", progname); @@ -117,8 +116,7 @@ static int buspirate_send_bin(struct programmer_t *pgm, const unsigned char *dat return rc; } -static int buspirate_recv_bin(struct programmer_t *pgm, unsigned char *buf, size_t len) -{ +static int buspirate_recv_bin(const PROGRAMMER *pgm, unsigned char *buf, size_t len) { int rc; rc = serial_recv(&pgm->fd, buf, len); @@ -131,12 +129,12 @@ static int buspirate_recv_bin(struct programmer_t *pgm, unsigned char *buf, size return len; } -static int buspirate_expect_bin(struct programmer_t *pgm, +static int buspirate_expect_bin(const PROGRAMMER *pgm, unsigned char *send_data, size_t send_len, unsigned char *expect_data, size_t expect_len) { unsigned char *recv_buf = alloca(expect_len); - if ((pgm->flag & BP_FLAG_IN_BINMODE) == 0) { + if ((PDATA(pgm)->flag & BP_FLAG_IN_BINMODE) == 0) { avrdude_message(MSG_INFO, "BusPirate: Internal error: buspirate_send_bin() called from ascii mode\n"); return -1; } @@ -148,7 +146,7 @@ static int buspirate_expect_bin(struct programmer_t *pgm, return 1; } -static int buspirate_expect_bin_byte(struct programmer_t *pgm, +static int buspirate_expect_bin_byte(const PROGRAMMER *pgm, unsigned char send_byte, unsigned char expect_byte) { return buspirate_expect_bin(pgm, &send_byte, 1, &expect_byte, 1); @@ -156,12 +154,11 @@ static int buspirate_expect_bin_byte(struct programmer_t *pgm, /* ====== Serial talker functions - ascii mode ====== */ -static int buspirate_getc(struct programmer_t *pgm) -{ +static int buspirate_getc(const PROGRAMMER *pgm) { int rc; unsigned char ch = 0; - if (pgm->flag & BP_FLAG_IN_BINMODE) { + if (PDATA(pgm)->flag & BP_FLAG_IN_BINMODE) { avrdude_message(MSG_INFO, "BusPirate: Internal error: buspirate_getc() called from binmode\n"); return EOF; } @@ -172,8 +169,7 @@ static int buspirate_getc(struct programmer_t *pgm) return ch; } -static char *buspirate_readline_noexit(struct programmer_t *pgm, char *buf, size_t len) -{ +static char *buspirate_readline_noexit(const PROGRAMMER *pgm, char *buf, size_t len) { char *buf_p; int c; long orig_serial_recv_timeout = serial_recv_timeout; @@ -210,8 +206,7 @@ static char *buspirate_readline_noexit(struct programmer_t *pgm, char *buf, size return buf; } -static char *buspirate_readline(struct programmer_t *pgm, char *buf, size_t len) -{ +static char *buspirate_readline(const PROGRAMMER *pgm, char *buf, size_t len) { char *ret; ret = buspirate_readline_noexit(pgm, buf, len); @@ -222,14 +217,13 @@ static char *buspirate_readline(struct programmer_t *pgm, char *buf, size_t len) } return ret; } -static int buspirate_send(struct programmer_t *pgm, const char *str) -{ +static int buspirate_send(const PROGRAMMER *pgm, const char *str) { int rc; const char * readline; avrdude_message(MSG_DEBUG, "%s: buspirate_send(): %s", progname, str); - if (pgm->flag & BP_FLAG_IN_BINMODE) { + if (PDATA(pgm)->flag & BP_FLAG_IN_BINMODE) { avrdude_message(MSG_INFO, "BusPirate: Internal error: buspirate_send() called from binmode\n"); return -1; } @@ -256,7 +250,7 @@ static int buspirate_is_prompt(const char *str) return (str[strlen_str - 1] == '>' || str[strlen_str - 2] == '>'); } -static int buspirate_expect(struct programmer_t *pgm, char *send, +static int buspirate_expect(const PROGRAMMER *pgm, char *send, char *expect, int wait_for_prompt) { int got_it = 0; @@ -285,14 +279,12 @@ static int buspirate_expect(struct programmer_t *pgm, char *send, } /* ====== Do-nothing functions ====== */ -static void buspirate_dummy_6(struct programmer_t *pgm, const char *p) -{ +static void buspirate_dummy_6(const PROGRAMMER *pgm, const char *p) { } /* ====== Config / parameters handling functions ====== */ static int -buspirate_parseextparms(struct programmer_t *pgm, LISTID extparms) -{ +buspirate_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) { LNODEID ln; const char *extended_param; char reset[10]; @@ -305,7 +297,7 @@ buspirate_parseextparms(struct programmer_t *pgm, LISTID extparms) for (ln = lfirst(extparms); ln; ln = lnext(ln)) { extended_param = ldata(ln); if (strcmp(extended_param, "ascii") == 0) { - pgm->flag |= BP_FLAG_XPARM_FORCE_ASCII; + PDATA(pgm)->flag |= BP_FLAG_XPARM_FORCE_ASCII; continue; } @@ -315,11 +307,11 @@ buspirate_parseextparms(struct programmer_t *pgm, LISTID extparms) avrdude_message(MSG_INFO, "BusPirate: see BusPirate manual for details.\n"); return -1; } - if (pgm->flag & BP_FLAG_XPARM_RAWFREQ) { + if (PDATA(pgm)->flag & BP_FLAG_XPARM_RAWFREQ) { avrdude_message(MSG_INFO, "BusPirate: set either spifreq or rawfreq\n"); return -1; } - pgm->flag |= BP_FLAG_XPARM_SPIFREQ; + PDATA(pgm)->flag |= BP_FLAG_XPARM_SPIFREQ; PDATA(pgm)->spifreq = spifreq; continue; } @@ -330,11 +322,11 @@ buspirate_parseextparms(struct programmer_t *pgm, LISTID extparms) "between 0 and 3.\n"); return -1; } - if (pgm->flag & BP_FLAG_XPARM_SPIFREQ) { + if (PDATA(pgm)->flag & BP_FLAG_XPARM_SPIFREQ) { avrdude_message(MSG_INFO, "BusPirate: set either spifreq or rawfreq\n"); return -1; } - pgm->flag |= BP_FLAG_XPARM_RAWFREQ; + PDATA(pgm)->flag |= BP_FLAG_XPARM_RAWFREQ; PDATA(pgm)->spifreq = rawfreq; continue; } @@ -347,7 +339,7 @@ buspirate_parseextparms(struct programmer_t *pgm, LISTID extparms) return -1; } PDATA(pgm)->cpufreq = cpufreq; - pgm->flag |= BP_FLAG_XPARM_CPUFREQ; + PDATA(pgm)->flag |= BP_FLAG_XPARM_CPUFREQ; continue; } @@ -366,17 +358,17 @@ buspirate_parseextparms(struct programmer_t *pgm, LISTID extparms) return -1; } } - pgm->flag |= BP_FLAG_XPARM_RESET; + PDATA(pgm)->flag |= BP_FLAG_XPARM_RESET; continue; } if (strcmp(extended_param, "nopagedwrite") == 0) { - pgm->flag |= BP_FLAG_NOPAGEDWRITE; + PDATA(pgm)->flag |= BP_FLAG_NOPAGEDWRITE; continue; } if (strcmp(extended_param, "nopagedread") == 0) { - pgm->flag |= BP_FLAG_NOPAGEDREAD; + PDATA(pgm)->flag |= BP_FLAG_NOPAGEDREAD; continue; } @@ -397,8 +389,7 @@ buspirate_parseextparms(struct programmer_t *pgm, LISTID extparms) } static int -buspirate_verifyconfig(struct programmer_t *pgm) -{ +buspirate_verifyconfig(const PROGRAMMER *pgm) { /* Default reset pin is CS */ if (PDATA(pgm)->reset == 0x00) PDATA(pgm)->reset |= BP_RESET_CS; @@ -408,7 +399,7 @@ buspirate_verifyconfig(struct programmer_t *pgm) return -1; } - if ( ((pgm->flag & BP_FLAG_XPARM_SPIFREQ) || (pgm->flag & BP_FLAG_XPARM_RAWFREQ)) + if ( ((PDATA(pgm)->flag & BP_FLAG_XPARM_SPIFREQ) || (PDATA(pgm)->flag & BP_FLAG_XPARM_RAWFREQ)) && buspirate_uses_ascii(pgm)) { avrdude_message(MSG_INFO, "BusPirate: SPI speed selection is not supported in ASCII mode\n"); return -1; @@ -418,8 +409,7 @@ buspirate_verifyconfig(struct programmer_t *pgm) } /* ====== Programmer methods ======= */ -static int buspirate_open(struct programmer_t *pgm, char * port) -{ +static int buspirate_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; /* BusPirate runs at 115200 by default */ if(pgm->baudrate == 0) @@ -438,21 +428,20 @@ static int buspirate_open(struct programmer_t *pgm, char * port) return 0; } -static void buspirate_close(struct programmer_t *pgm) +static void buspirate_close(PROGRAMMER *pgm) { serial_close(&pgm->fd); pgm->fd.ifd = -1; } -static void buspirate_reset_from_binmode(struct programmer_t *pgm) -{ +static void buspirate_reset_from_binmode(const PROGRAMMER *pgm) { unsigned char buf[10]; buf[0] = 0x00; /* BinMode: revert to raw bitbang mode */ buspirate_send_bin(pgm, buf, 1); buspirate_recv_bin(pgm, buf, 5); - if (pgm->flag & BP_FLAG_XPARM_CPUFREQ) { + if (PDATA(pgm)->flag & BP_FLAG_XPARM_CPUFREQ) { /* disable pwm */ if (buspirate_expect_bin_byte(pgm, 0x13, 0x01) != 1) { avrdude_message(MSG_INFO, "%s: warning: did not get a response to stop PWM command.\n", progname); @@ -474,7 +463,7 @@ static void buspirate_reset_from_binmode(struct programmer_t *pgm) rc = buspirate_recv_bin(pgm, buf, sizeof(buf) - 1); if (buspirate_is_prompt((const char*)buf)) { - pgm->flag &= ~BP_FLAG_IN_BINMODE; + PDATA(pgm)->flag &= ~BP_FLAG_IN_BINMODE; break; } if (rc == EOF) @@ -482,7 +471,7 @@ static void buspirate_reset_from_binmode(struct programmer_t *pgm) memset(buf, '\0', sizeof(buf)); } - if (pgm->flag & BP_FLAG_IN_BINMODE) { + if (PDATA(pgm)->flag & BP_FLAG_IN_BINMODE) { avrdude_message(MSG_INFO, "BusPirate reset failed. You may need to powercycle it.\n"); return; } @@ -490,7 +479,7 @@ static void buspirate_reset_from_binmode(struct programmer_t *pgm) avrdude_message(MSG_NOTICE, "BusPirate is back in the text mode\n"); } -static int buspirate_start_mode_bin(struct programmer_t *pgm) +static int buspirate_start_mode_bin(PROGRAMMER *pgm) { struct submode { const char *name; /* Name of mode for user messages */ @@ -499,13 +488,13 @@ static int buspirate_start_mode_bin(struct programmer_t *pgm) char config; /* Command to setup submode parameters */ } submode; - if (pgm->flag & BP_FLAG_XPARM_RAWFREQ) { + if (PDATA(pgm)->flag & BP_FLAG_XPARM_RAWFREQ) { submode.name = "Raw-wire"; submode.enter = 0x05; submode.entered_format = "RAW%1d"; submode.config = 0x8C; - pgm->flag |= BP_FLAG_NOPAGEDWRITE; - pgm->flag |= BP_FLAG_NOPAGEDREAD; + PDATA(pgm)->flag |= BP_FLAG_NOPAGEDWRITE; + PDATA(pgm)->flag |= BP_FLAG_NOPAGEDREAD; } else { submode.name = "SPI"; submode.enter = 0x01; @@ -535,9 +524,9 @@ static int buspirate_start_mode_bin(struct programmer_t *pgm) avrdude_message(MSG_NOTICE, "BusPirate binmode version: %d\n", PDATA(pgm)->binmode_version); - pgm->flag |= BP_FLAG_IN_BINMODE; + PDATA(pgm)->flag |= BP_FLAG_IN_BINMODE; - if (pgm->flag & BP_FLAG_XPARM_CPUFREQ) { + if (PDATA(pgm)->flag & BP_FLAG_XPARM_CPUFREQ) { unsigned short pwm_duty; unsigned short pwm_period; @@ -574,7 +563,7 @@ static int buspirate_start_mode_bin(struct programmer_t *pgm) avrdude_message(MSG_NOTICE, "BusPirate %s version: %d\n", submode.name, PDATA(pgm)->submode_version); - if (pgm->flag & BP_FLAG_NOPAGEDWRITE) { + if (PDATA(pgm)->flag & BP_FLAG_NOPAGEDWRITE) { avrdude_message(MSG_NOTICE, "%s: Paged flash write disabled.\n", progname); pgm->paged_write = NULL; } else { @@ -585,7 +574,7 @@ static int buspirate_start_mode_bin(struct programmer_t *pgm) if (buf[0] != 0x01) { /* Disable paged write: */ - pgm->flag |= BP_FLAG_NOPAGEDWRITE; + PDATA(pgm)->flag |= BP_FLAG_NOPAGEDWRITE; pgm->paged_write = NULL; /* Return to SPI mode (0x00s have landed us back in binary bitbang mode): */ @@ -617,7 +606,7 @@ static int buspirate_start_mode_bin(struct programmer_t *pgm) return -1; /* AVR Extended Commands - test for existence */ - if (pgm->flag & BP_FLAG_NOPAGEDREAD) { + if (PDATA(pgm)->flag & BP_FLAG_NOPAGEDREAD) { avrdude_message(MSG_NOTICE, "%s: Paged flash read disabled.\n", progname); pgm->paged_load = NULL; } else { @@ -633,7 +622,7 @@ static int buspirate_start_mode_bin(struct programmer_t *pgm) avrdude_message(MSG_NOTICE, "AVR Extended Commands version %d\n", ver); } else { avrdude_message(MSG_NOTICE, "AVR Extended Commands not found.\n"); - pgm->flag |= BP_FLAG_NOPAGEDREAD; + PDATA(pgm)->flag |= BP_FLAG_NOPAGEDREAD; pgm->paged_load = NULL; } } @@ -641,8 +630,7 @@ static int buspirate_start_mode_bin(struct programmer_t *pgm) return 0; } -static int buspirate_start_spi_mode_ascii(struct programmer_t *pgm) -{ +static int buspirate_start_spi_mode_ascii(const PROGRAMMER *pgm) { int spi_cmd = -1; int cmd; char *rcvd; @@ -700,8 +688,7 @@ static int buspirate_start_spi_mode_ascii(struct programmer_t *pgm) return 0; } -static void buspirate_enable(struct programmer_t *pgm) -{ +static void buspirate_enable(PROGRAMMER *pgm, const AVRPART *p) { static const char *reset_str = "#\n"; static const char *accept_str = "y\n"; char *rcvd; @@ -759,7 +746,7 @@ static void buspirate_enable(struct programmer_t *pgm) avrdude_message(MSG_DEBUG, "** %s", rcvd); } - if (!(pgm->flag & BP_FLAG_IN_BINMODE)) { + if (!(PDATA(pgm)->flag & BP_FLAG_IN_BINMODE)) { avrdude_message(MSG_INFO, "BusPirate: using ASCII mode\n"); if (buspirate_start_spi_mode_ascii(pgm) < 0) { avrdude_message(MSG_INFO, "%s: Failed to start ascii SPI mode\n", progname); @@ -768,9 +755,8 @@ static void buspirate_enable(struct programmer_t *pgm) } } -static void buspirate_disable(struct programmer_t *pgm) -{ - if (pgm->flag & BP_FLAG_IN_BINMODE) { +static void buspirate_disable(const PROGRAMMER *pgm) { + if (PDATA(pgm)->flag & BP_FLAG_IN_BINMODE) { serial_recv_timeout = 100; buspirate_reset_from_binmode(pgm); } else { @@ -778,21 +764,19 @@ static void buspirate_disable(struct programmer_t *pgm) } } -static int buspirate_initialize(struct programmer_t *pgm, AVRPART * p) -{ +static int buspirate_initialize(const PROGRAMMER *pgm, const AVRPART *p) { pgm->powerup(pgm); return pgm->program_enable(pgm, p); } -static void buspirate_powerup(struct programmer_t *pgm) -{ - if (pgm->flag & BP_FLAG_IN_BINMODE) { +static void buspirate_powerup(const PROGRAMMER *pgm) { + if (PDATA(pgm)->flag & BP_FLAG_IN_BINMODE) { /* Powerup in BinMode is handled in binary mode init */ return; } else { if (buspirate_expect(pgm, "W\n", "POWER SUPPLIES ON", 1)) { - if (pgm->flag & BP_FLAG_XPARM_CPUFREQ) { + if (PDATA(pgm)->flag & BP_FLAG_XPARM_CPUFREQ) { char buf[25]; int ok = 0; snprintf(buf, sizeof(buf), "%d\n", PDATA(pgm)->cpufreq); @@ -815,13 +799,12 @@ static void buspirate_powerup(struct programmer_t *pgm) avrdude_message(MSG_INFO, "%s: warning: Trying to continue anyway...\n", progname); } -static void buspirate_powerdown(struct programmer_t *pgm) -{ - if (pgm->flag & BP_FLAG_IN_BINMODE) { +static void buspirate_powerdown(const PROGRAMMER *pgm) { + if (PDATA(pgm)->flag & BP_FLAG_IN_BINMODE) { /* Powerdown in BinMode is handled in binary mode init */ return; } else { - if (pgm->flag & BP_FLAG_XPARM_CPUFREQ) { + if (PDATA(pgm)->flag & BP_FLAG_XPARM_CPUFREQ) { if (!buspirate_expect(pgm, "g\n", "PWM disabled", 1)) { avrdude_message(MSG_INFO, "%s: warning: did not get a response to stop PWM command.\n", progname); } @@ -833,7 +816,7 @@ static void buspirate_powerdown(struct programmer_t *pgm) avrdude_message(MSG_INFO, "%s: warning: did not get a response to PowerDown command.\n", progname); } -static int buspirate_cmd_bin(struct programmer_t *pgm, +static int buspirate_cmd_bin(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { @@ -851,7 +834,7 @@ static int buspirate_cmd_bin(struct programmer_t *pgm, return 0; } -static int buspirate_cmd_ascii(struct programmer_t *pgm, +static int buspirate_cmd_ascii(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { @@ -888,25 +871,20 @@ static int buspirate_cmd_ascii(struct programmer_t *pgm, return 0; } -static int buspirate_cmd(struct programmer_t *pgm, +static int buspirate_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { - if (pgm->flag & BP_FLAG_IN_BINMODE) + if (PDATA(pgm)->flag & BP_FLAG_IN_BINMODE) return buspirate_cmd_bin(pgm, cmd, res); else return buspirate_cmd_ascii(pgm, cmd, res); } /* Paged load function which utilizes the AVR Extended Commands set */ -static int buspirate_paged_load( - PROGRAMMER *pgm, - AVRPART *p, - AVRMEM *m, - unsigned int page_size, - unsigned int address, - unsigned int n_bytes) -{ +static int buspirate_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, + unsigned int page_size, unsigned int address, unsigned int n_bytes) { + unsigned char commandbuf[10]; unsigned char buf[275]; unsigned int addr = 0; @@ -914,7 +892,7 @@ static int buspirate_paged_load( avrdude_message(MSG_NOTICE, "BusPirate: buspirate_paged_load(..,%s,%d,%d,%d)\n",m->desc,m->page_size,address,n_bytes); // This should never happen, but still... - if (pgm->flag & BP_FLAG_NOPAGEDREAD) { + if (PDATA(pgm)->flag & BP_FLAG_NOPAGEDREAD) { avrdude_message(MSG_INFO, "BusPirate: buspirate_paged_load() called while in nopagedread mode!\n"); return -1; } @@ -956,13 +934,9 @@ static int buspirate_paged_load( return n_bytes; } /* Paged write function which utilizes the Bus Pirate's "Write then Read" binary SPI instruction */ -static int buspirate_paged_write(struct programmer_t *pgm, - AVRPART *p, - AVRMEM *m, - unsigned int page_size, - unsigned int base_addr, - unsigned int n_data_bytes) -{ +static int buspirate_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, + unsigned int page_size, unsigned int base_addr, unsigned int n_data_bytes) { + int page, i; int addr = base_addr; int n_page_writes; @@ -970,12 +944,12 @@ static int buspirate_paged_write(struct programmer_t *pgm, unsigned char cmd_buf[4096] = {'\0'}; unsigned char send_byte, recv_byte; - if (!(pgm->flag & BP_FLAG_IN_BINMODE)) { + if (!(PDATA(pgm)->flag & BP_FLAG_IN_BINMODE)) { /* Return if we are not in binary mode. */ return -1; } - if (pgm->flag & BP_FLAG_NOPAGEDWRITE) { + if (PDATA(pgm)->flag & BP_FLAG_NOPAGEDWRITE) { /* Return if we've nominated not to use paged writes. */ return -1; } @@ -1074,12 +1048,11 @@ static int buspirate_paged_write(struct programmer_t *pgm, return n_data_bytes; } -static int buspirate_program_enable(struct programmer_t *pgm, AVRPART * p) -{ +static int buspirate_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4]; unsigned char res[4]; - if (pgm->flag & BP_FLAG_IN_BINMODE) { + if (PDATA(pgm)->flag & BP_FLAG_IN_BINMODE) { /* Clear configured reset pin(s): CS and/or AUX and/or AUX2 */ PDATA(pgm)->current_peripherals_config &= ~PDATA(pgm)->reset; if (buspirate_expect_bin_byte(pgm, PDATA(pgm)->current_peripherals_config, 0x01) < 0) @@ -1104,8 +1077,7 @@ static int buspirate_program_enable(struct programmer_t *pgm, AVRPART * p) return 0; } -static int buspirate_chip_erase(struct programmer_t *pgm, AVRPART * p) -{ +static int buspirate_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4]; unsigned char res[4]; @@ -1130,7 +1102,7 @@ static int buspirate_chip_erase(struct programmer_t *pgm, AVRPART * p) } /* Interface - management */ -static void buspirate_setup(struct programmer_t *pgm) +static void buspirate_setup(PROGRAMMER *pgm) { /* Allocate private data */ if ((pgm->cookie = calloc(1, sizeof(struct pdata))) == 0) { @@ -1141,14 +1113,13 @@ static void buspirate_setup(struct programmer_t *pgm) PDATA(pgm)->serial_recv_timeout = 100; } -static void buspirate_teardown(struct programmer_t *pgm) +static void buspirate_teardown(PROGRAMMER *pgm) { free(pgm->cookie); } const char buspirate_desc[] = "Using the Bus Pirate's SPI interface for programming"; -void buspirate_initpgm(struct programmer_t *pgm) -{ +void buspirate_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "BusPirate"); pgm->display = buspirate_dummy_6; @@ -1181,8 +1152,7 @@ void buspirate_initpgm(struct programmer_t *pgm) /* Bitbang support */ -static void buspirate_bb_enable(struct programmer_t *pgm) -{ +static void buspirate_bb_enable(PROGRAMMER *pgm, const AVRPART *p) { unsigned char buf[20] = { '\0' }; if (bitbang_check_prerequisites(pgm) < 0) @@ -1210,7 +1180,7 @@ static void buspirate_bb_enable(struct programmer_t *pgm) avrdude_message(MSG_INFO, "BusPirate binmode version: %d\n", PDATA(pgm)->binmode_version); - pgm->flag |= BP_FLAG_IN_BINMODE; + PDATA(pgm)->flag |= BP_FLAG_IN_BINMODE; /* Set pin directions and an initial pin status (all high) */ PDATA(pgm)->pin_dir = 0x12; /* AUX, MISO input; everything else output */ @@ -1241,8 +1211,7 @@ static void buspirate_bb_enable(struct programmer_t *pgm) Both respond with a byte with current status: 0|POWER|PULLUP|AUX|MOSI|CLK|MISO|CS */ -static int buspirate_bb_getpin(struct programmer_t *pgm, int pinfunc) -{ +static int buspirate_bb_getpin(const PROGRAMMER *pgm, int pinfunc) { unsigned char buf[10]; int value = 0; int pin = pgm->pinno[pinfunc]; @@ -1277,8 +1246,7 @@ static int buspirate_bb_getpin(struct programmer_t *pgm, int pinfunc) return value; } -static int buspirate_bb_setpin_internal(struct programmer_t *pgm, int pin, int value) -{ +static int buspirate_bb_setpin_internal(const PROGRAMMER *pgm, int pin, int value) { unsigned char buf[10]; if (pin & PIN_INVERSE) { @@ -1307,14 +1275,12 @@ static int buspirate_bb_setpin_internal(struct programmer_t *pgm, int pin, int v return 0; } -static int buspirate_bb_setpin(struct programmer_t *pgm, int pinfunc, int value) -{ +static int buspirate_bb_setpin(const PROGRAMMER *pgm, int pinfunc, int value) { return buspirate_bb_setpin_internal(pgm, pgm->pinno[pinfunc], value); } -static int buspirate_bb_highpulsepin(struct programmer_t *pgm, int pinfunc) -{ +static int buspirate_bb_highpulsepin(const PROGRAMMER *pgm, int pinfunc) { int ret; ret = buspirate_bb_setpin(pgm, pinfunc, 1); if (ret < 0) @@ -1322,20 +1288,17 @@ static int buspirate_bb_highpulsepin(struct programmer_t *pgm, int pinfunc) return buspirate_bb_setpin(pgm, pinfunc, 0); } -static void buspirate_bb_powerup(struct programmer_t *pgm) -{ +static void buspirate_bb_powerup(const PROGRAMMER *pgm) { buspirate_bb_setpin_internal(pgm, 7, 1); } -static void buspirate_bb_powerdown(struct programmer_t *pgm) -{ +static void buspirate_bb_powerdown(const PROGRAMMER *pgm) { buspirate_bb_setpin_internal(pgm, 7, 0); } const char buspirate_bb_desc[] = "Using the Bus Pirate's bitbang interface for programming"; -void buspirate_bb_initpgm(struct programmer_t *pgm) -{ +void buspirate_bb_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "BusPirate_BB"); pgm_fill_old_pins(pgm); // TODO to be removed if old pin data no longer needed diff --git a/src/buspirate.h b/src/buspirate.h index 835334a2..12a68a1a 100644 --- a/src/buspirate.h +++ b/src/buspirate.h @@ -26,7 +26,7 @@ extern const char buspirate_desc[]; extern const char buspirate_bb_desc[]; -void buspirate_initpgm (struct programmer_t *pgm); -void buspirate_bb_initpgm (struct programmer_t *pgm); +void buspirate_initpgm(PROGRAMMER *pgm); +void buspirate_bb_initpgm(PROGRAMMER *pgm); #endif diff --git a/src/butterfly.c b/src/butterfly.c index 1d5fafdf..2cc6cb0b 100644 --- a/src/butterfly.c +++ b/src/butterfly.c @@ -75,14 +75,12 @@ static void butterfly_teardown(PROGRAMMER * pgm) free(pgm->cookie); } -static int butterfly_send(PROGRAMMER * pgm, char * buf, size_t len) -{ +static int butterfly_send(const PROGRAMMER *pgm, char *buf, size_t len) { return serial_send(&pgm->fd, (unsigned char *)buf, len); } -static int butterfly_recv(PROGRAMMER * pgm, char * buf, size_t len) -{ +static int butterfly_recv(const PROGRAMMER *pgm, char *buf, size_t len) { int rv; rv = serial_recv(&pgm->fd, (unsigned char *)buf, len); @@ -95,14 +93,12 @@ static int butterfly_recv(PROGRAMMER * pgm, char * buf, size_t len) } -static int butterfly_drain(PROGRAMMER * pgm, int display) -{ +static int butterfly_drain(const PROGRAMMER *pgm, int display) { return serial_drain(&pgm->fd, display); } -static int butterfly_vfy_cmd_sent(PROGRAMMER * pgm, char * errmsg) -{ +static int butterfly_vfy_cmd_sent(const PROGRAMMER *pgm, char *errmsg) { char c; butterfly_recv(pgm, &c, 1); @@ -115,32 +111,28 @@ static int butterfly_vfy_cmd_sent(PROGRAMMER * pgm, char * errmsg) } -static int butterfly_rdy_led(PROGRAMMER * pgm, int value) -{ +static int butterfly_rdy_led(const PROGRAMMER *pgm, int value) { /* Do nothing. */ return 0; } -static int butterfly_err_led(PROGRAMMER * pgm, int value) -{ +static int butterfly_err_led(const PROGRAMMER *pgm, int value) { /* Do nothing. */ return 0; } -static int butterfly_pgm_led(PROGRAMMER * pgm, int value) -{ +static int butterfly_pgm_led(const PROGRAMMER *pgm, int value) { /* Do nothing. */ return 0; } -static int butterfly_vfy_led(PROGRAMMER * pgm, int value) -{ +static int butterfly_vfy_led(const PROGRAMMER *pgm, int value) { /* Do nothing. */ return 0; @@ -150,8 +142,7 @@ static int butterfly_vfy_led(PROGRAMMER * pgm, int value) /* * issue the 'chip erase' command to the butterfly board */ -static int butterfly_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int butterfly_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { butterfly_send(pgm, "e", 1); if (butterfly_vfy_cmd_sent(pgm, "chip erase") < 0) return -1; @@ -160,15 +151,13 @@ static int butterfly_chip_erase(PROGRAMMER * pgm, AVRPART * p) } -static void butterfly_enter_prog_mode(PROGRAMMER * pgm) -{ +static void butterfly_enter_prog_mode(const PROGRAMMER *pgm) { butterfly_send(pgm, "P", 1); butterfly_vfy_cmd_sent(pgm, "enter prog mode"); } -static void butterfly_leave_prog_mode(PROGRAMMER * pgm) -{ +static void butterfly_leave_prog_mode(const PROGRAMMER *pgm) { butterfly_send(pgm, "L", 1); butterfly_vfy_cmd_sent(pgm, "leave prog mode"); } @@ -177,8 +166,7 @@ static void butterfly_leave_prog_mode(PROGRAMMER * pgm) /* * issue the 'program enable' command to the AVR device */ -static int butterfly_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +static int butterfly_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { return -1; } @@ -186,8 +174,7 @@ static int butterfly_program_enable(PROGRAMMER * pgm, AVRPART * p) /* * apply power to the AVR processor */ -static void butterfly_powerup(PROGRAMMER * pgm) -{ +static void butterfly_powerup(const PROGRAMMER *pgm) { /* Do nothing. */ return; @@ -197,8 +184,7 @@ static void butterfly_powerup(PROGRAMMER * pgm) /* * remove power from the AVR processor */ -static void butterfly_powerdown(PROGRAMMER * pgm) -{ +static void butterfly_powerdown(const PROGRAMMER *pgm) { /* Do nothing. */ return; @@ -209,8 +195,7 @@ static void butterfly_powerdown(PROGRAMMER * pgm) /* * initialize the AVR device and prepare it to accept commands */ -static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int butterfly_initialize(const PROGRAMMER *pgm, const AVRPART *p) { char id[8]; char sw[2]; char hw[2]; @@ -367,22 +352,19 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p) -static void butterfly_disable(PROGRAMMER * pgm) -{ +static void butterfly_disable(const PROGRAMMER *pgm) { butterfly_leave_prog_mode(pgm); return; } -static void butterfly_enable(PROGRAMMER * pgm) -{ +static void butterfly_enable(PROGRAMMER *pgm, const AVRPART *p) { return; } -static int butterfly_open(PROGRAMMER * pgm, char * port) -{ +static int butterfly_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; strcpy(pgm->port, port); /* @@ -417,14 +399,12 @@ static void butterfly_close(PROGRAMMER * pgm) } -static void butterfly_display(PROGRAMMER * pgm, const char * p) -{ +static void butterfly_display(const PROGRAMMER *pgm, const char *p) { return; } -static void butterfly_set_addr(PROGRAMMER * pgm, unsigned long addr) -{ +static void butterfly_set_addr(const PROGRAMMER *pgm, unsigned long addr) { char cmd[3]; cmd[0] = 'A'; @@ -436,8 +416,7 @@ static void butterfly_set_addr(PROGRAMMER * pgm, unsigned long addr) } -static void butterfly_set_extaddr(PROGRAMMER * pgm, unsigned long addr) -{ +static void butterfly_set_extaddr(const PROGRAMMER *pgm, unsigned long addr) { char cmd[4]; cmd[0] = 'H'; @@ -451,7 +430,7 @@ static void butterfly_set_extaddr(PROGRAMMER * pgm, unsigned long addr) -static int butterfly_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int butterfly_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr, unsigned char value) { char cmd[6]; @@ -495,7 +474,7 @@ static int butterfly_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } -static int butterfly_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int butterfly_read_byte_flash(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr, unsigned char * value) { static int cached = 0; @@ -536,7 +515,7 @@ static int butterfly_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } -static int butterfly_read_byte_eeprom(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int butterfly_read_byte_eeprom(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr, unsigned char * value) { butterfly_set_addr(pgm, addr); @@ -545,8 +524,7 @@ static int butterfly_read_byte_eeprom(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return 0; } -static int butterfly_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned int addr) -{ +static int butterfly_page_erase(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int addr) { if (strcmp(m->desc, "flash") == 0) return -1; /* not supported */ if (strcmp(m->desc, "eeprom") == 0) @@ -556,7 +534,7 @@ static int butterfly_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsig return -1; } -static int butterfly_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int butterfly_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr, unsigned char * value) { char cmd; @@ -592,7 +570,7 @@ static int butterfly_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, -static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int butterfly_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -647,7 +625,7 @@ static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, -static int butterfly_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int butterfly_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -693,8 +671,7 @@ static int butterfly_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, /* Signature byte reads are always 3 bytes. */ -static int butterfly_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m) -{ +static int butterfly_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m) { unsigned char tmp; if (m->size < 3) { @@ -714,8 +691,7 @@ static int butterfly_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m) const char butterfly_desc[] = "Atmel Butterfly evaluation board; Atmel AppNotes AVR109, AVR911"; -void butterfly_initpgm(PROGRAMMER * pgm) -{ +void butterfly_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "butterfly"); /* @@ -755,8 +731,7 @@ void butterfly_initpgm(PROGRAMMER * pgm) const char butterfly_mk_desc[] = "Mikrokopter.de Butterfly"; -void butterfly_mk_initpgm(PROGRAMMER * pgm) -{ +void butterfly_mk_initpgm(PROGRAMMER *pgm) { butterfly_initpgm(pgm); strcpy(pgm->type, "butterfly_mk"); pgm->flag = IS_BUTTERFLY_MK; diff --git a/src/butterfly.h b/src/butterfly.h index 6f6a54c8..2d4bfa64 100644 --- a/src/butterfly.h +++ b/src/butterfly.h @@ -27,8 +27,8 @@ extern "C" { extern const char butterfly_desc[]; extern const char butterfly_mk_desc[]; -void butterfly_initpgm (PROGRAMMER * pgm); -void butterfly_mk_initpgm (PROGRAMMER * pgm); +void butterfly_initpgm(PROGRAMMER *pgm); +void butterfly_mk_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/config_gram.y b/src/config_gram.y index c4c144a7..bd32de16 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -315,7 +315,7 @@ prog_decl : | K_PROGRAMMER K_PARENT TKN_STRING { - struct programmer_t * pgm = locate_programmer(programmers, $3->value.string); + PROGRAMMER * pgm = locate_programmer(programmers, $3->value.string); if (pgm == NULL) { yyerror("parent programmer %s not found", $3->value.string); free_token($3); diff --git a/src/dfu.c b/src/dfu.c index 8e014e3c..efa58c8a 100644 --- a/src/dfu.c +++ b/src/dfu.c @@ -38,7 +38,7 @@ #ifndef HAVE_LIBUSB -struct dfu_dev *dfu_open(char *port_name) { +struct dfu_dev *dfu_open(const char *port_name) { avrdude_message(MSG_INFO, "%s: Error: No USB support in this compile of avrdude\n", progname); return NULL; @@ -99,8 +99,7 @@ static char * get_usb_string(usb_dev_handle * dev_handle, int index); /* EXPORTED FUNCTION DEFINITIONS */ -struct dfu_dev * dfu_open(char *port_spec) -{ +struct dfu_dev *dfu_open(const char *port_spec) { struct dfu_dev *dfu; char *bus_name = NULL; char *dev_name = NULL; diff --git a/src/dfu.h b/src/dfu.h index fa5da416..6be53a18 100644 --- a/src/dfu.h +++ b/src/dfu.h @@ -114,7 +114,7 @@ struct dfu_status { // FUNCTIONS -extern struct dfu_dev * dfu_open(char *port_spec); +extern struct dfu_dev *dfu_open(const char *port_spec); extern int dfu_init(struct dfu_dev *dfu, unsigned short vid, unsigned short pid); extern void dfu_close(struct dfu_dev *dfu); diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index a9242b4d..cdc7602b 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -1809,7 +1809,7 @@ part rampz = ; # IO addr of RAMPZ reg. spmcr = ; # mem addr of SPMC[S]R reg. eecr = ; # mem addr of EECR reg. - # (only when != 0x3c) + # (only when != 0x3F) is_at90s1200 = ; # AT90S1200 part is_avr32 = ; # AVR32 part diff --git a/src/flip1.c b/src/flip1.c index 4db54aad..dbddfaf0 100644 --- a/src/flip1.c +++ b/src/flip1.c @@ -136,23 +136,23 @@ enum flip1_mem_unit { /* EXPORTED PROGRAMMER FUNCTION PROTOTYPES */ -static int flip1_open(PROGRAMMER *pgm, char *port_spec); -static int flip1_initialize(PROGRAMMER* pgm, AVRPART *part); +static int flip1_open(PROGRAMMER *pgm, const char *port_spec); +static int flip1_initialize(const PROGRAMMER *pgm, const AVRPART *part); static void flip1_close(PROGRAMMER* pgm); -static void flip1_enable(PROGRAMMER* pgm); -static void flip1_disable(PROGRAMMER* pgm); -static void flip1_display(PROGRAMMER* pgm, const char *prefix); -static int flip1_program_enable(PROGRAMMER* pgm, AVRPART *part); -static int flip1_chip_erase(PROGRAMMER* pgm, AVRPART *part); -static int flip1_read_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +static void flip1_enable(PROGRAMMER *pgm, const AVRPART *p); +static void flip1_disable(const PROGRAMMER *pgm); +static void flip1_display(const PROGRAMMER *pgm, const char *prefix); +static int flip1_program_enable(const PROGRAMMER *pgm, const AVRPART *part); +static int flip1_chip_erase(const PROGRAMMER *pgm, const AVRPART *part); +static int flip1_read_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned long addr, unsigned char *value); -static int flip1_write_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +static int flip1_write_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned long addr, unsigned char value); -static int flip1_paged_load(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +static int flip1_paged_load(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -static int flip1_paged_write(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +static int flip1_paged_write(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -static int flip1_read_sig_bytes(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem); +static int flip1_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem); static void flip1_setup(PROGRAMMER * pgm); static void flip1_teardown(PROGRAMMER * pgm); @@ -162,7 +162,7 @@ static void flip1_teardown(PROGRAMMER * pgm); static void flip1_show_info(struct flip1 *flip1); -static int flip1_read_memory(PROGRAMMER * pgm, +static int flip1_read_memory(const PROGRAMMER *pgm, enum flip1_mem_unit mem_unit, uint32_t addr, void *ptr, int size); static int flip1_write_memory(struct dfu_dev *dfu, enum flip1_mem_unit mem_unit, uint32_t addr, const void *ptr, int size); @@ -176,8 +176,7 @@ static enum flip1_mem_unit flip1_mem_unit(const char *name); /* THE INITPGM FUNCTION DEFINITIONS */ -void flip1_initpgm(PROGRAMMER *pgm) -{ +void flip1_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "flip1"); /* Mandatory Functions */ @@ -201,14 +200,12 @@ void flip1_initpgm(PROGRAMMER *pgm) #ifdef HAVE_LIBUSB /* EXPORTED PROGRAMMER FUNCTION DEFINITIONS */ -int flip1_open(PROGRAMMER *pgm, char *port_spec) -{ +int flip1_open(PROGRAMMER *pgm, const char *port_spec) { FLIP1(pgm)->dfu = dfu_open(port_spec); return (FLIP1(pgm)->dfu != NULL) ? 0 : -1; } -int flip1_initialize(PROGRAMMER* pgm, AVRPART *part) -{ +int flip1_initialize(const PROGRAMMER *pgm, const AVRPART *part) { unsigned short vid, pid; int result; struct dfu_dev *dfu = FLIP1(pgm)->dfu; @@ -322,31 +319,26 @@ flip1_initialize_fail: return 0; } -void flip1_close(PROGRAMMER* pgm) -{ +void flip1_close(PROGRAMMER *pgm) { if (FLIP1(pgm)->dfu != NULL) { dfu_close(FLIP1(pgm)->dfu); FLIP1(pgm)->dfu = NULL; } } -void flip1_enable(PROGRAMMER* pgm) -{ +void flip1_enable(PROGRAMMER *pgm, const AVRPART *p) { /* Nothing to do. */ } -void flip1_disable(PROGRAMMER* pgm) -{ +void flip1_disable(const PROGRAMMER *pgm) { /* Nothing to do. */ } -void flip1_display(PROGRAMMER* pgm, const char *prefix) -{ +void flip1_display(const PROGRAMMER *pgm, const char *prefix) { /* Nothing to do. */ } -int flip1_program_enable(PROGRAMMER* pgm, AVRPART *part) -{ +int flip1_program_enable(const PROGRAMMER *pgm, const AVRPART *part) { /* I couldn't find anything that uses this function, although it is marked * as "mandatory" in pgm.c. In case anyone does use it, we'll report an * error if we failed to initialize. @@ -355,8 +347,7 @@ int flip1_program_enable(PROGRAMMER* pgm, AVRPART *part) return (FLIP1(pgm)->dfu != NULL) ? 0 : -1; } -int flip1_chip_erase(PROGRAMMER* pgm, AVRPART *part) -{ +int flip1_chip_erase(const PROGRAMMER *pgm, const AVRPART *part) { struct dfu_status status; int cmd_result = 0; int aux_result; @@ -387,7 +378,7 @@ int flip1_chip_erase(PROGRAMMER* pgm, AVRPART *part) return 0; } -int flip1_read_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip1_read_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned long addr, unsigned char *value) { enum flip1_mem_unit mem_unit; @@ -424,7 +415,7 @@ int flip1_read_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, return flip1_read_memory(pgm, mem_unit, addr, value, 1); } -int flip1_write_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip1_write_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned long addr, unsigned char value) { enum flip1_mem_unit mem_unit; @@ -445,7 +436,7 @@ int flip1_write_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, return flip1_write_memory(FLIP1(pgm)->dfu, mem_unit, addr, &value, 1); } -int flip1_paged_load(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip1_paged_load(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { enum flip1_mem_unit mem_unit; @@ -470,7 +461,7 @@ int flip1_paged_load(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, return flip1_read_memory(pgm, mem_unit, addr, mem->buf + addr, n_bytes); } -int flip1_paged_write(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip1_paged_write(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { enum flip1_mem_unit mem_unit; @@ -502,8 +493,7 @@ int flip1_paged_write(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, return (result == 0) ? n_bytes : -1; } -int flip1_read_sig_bytes(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem) -{ +int flip1_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem) { avrdude_message(MSG_NOTICE2, "%s: flip1_read_sig_bytes(): ", progname); if (FLIP1(pgm)->dfu == NULL) @@ -605,7 +595,7 @@ void flip1_show_info(struct flip1 *flip1) (unsigned short) flip1->dfu->dev_desc.bMaxPacketSize0); } -int flip1_read_memory(PROGRAMMER * pgm, +int flip1_read_memory(const PROGRAMMER *pgm, enum flip1_mem_unit mem_unit, uint32_t addr, void *ptr, int size) { struct dfu_dev *dfu = FLIP1(pgm)->dfu; @@ -864,15 +854,13 @@ enum flip1_mem_unit flip1_mem_unit(const char *name) { } #else /* HAVE_LIBUSB */ // Dummy functions -int flip1_open(PROGRAMMER *pgm, char *port_spec) -{ +int flip1_open(PROGRAMMER *pgm, const char *port_spec) { fprintf(stderr, "%s: Error: No USB support in this compile of avrdude\n", progname); return -1; } -int flip1_initialize(PROGRAMMER* pgm, AVRPART *part) -{ +int flip1_initialize(const PROGRAMMER *pgm, const AVRPART *part) { return -1; } @@ -880,54 +868,48 @@ void flip1_close(PROGRAMMER* pgm) { } -void flip1_enable(PROGRAMMER* pgm) -{ +void flip1_enable(PROGRAMMER *pgm, const AVRPART *p) { } -void flip1_disable(PROGRAMMER* pgm) -{ +void flip1_disable(const PROGRAMMER *pgm) { } -void flip1_display(PROGRAMMER* pgm, const char *prefix) -{ +void flip1_display(const PROGRAMMER *pgm, const char *prefix) { } -int flip1_program_enable(PROGRAMMER* pgm, AVRPART *part) -{ +int flip1_program_enable(const PROGRAMMER *pgm, const AVRPART *part) { return -1; } -int flip1_chip_erase(PROGRAMMER* pgm, AVRPART *part) -{ +int flip1_chip_erase(const PROGRAMMER *pgm, const AVRPART *part) { return -1; } -int flip1_read_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip1_read_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned long addr, unsigned char *value) { return -1; } -int flip1_write_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip1_write_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned long addr, unsigned char value) { return -1; } -int flip1_paged_load(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip1_paged_load(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { return -1; } -int flip1_paged_write(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip1_paged_write(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { return -1; } -int flip1_read_sig_bytes(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem) -{ +int flip1_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem) { return -1; } diff --git a/src/flip1.h b/src/flip1.h index c5f4986b..276229e3 100644 --- a/src/flip1.h +++ b/src/flip1.h @@ -26,7 +26,7 @@ extern "C" { #endif extern const char flip1_desc[]; -extern void flip1_initpgm(PROGRAMMER * pgm); +extern void flip1_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/flip2.c b/src/flip2.c index a1bebc1c..a26da242 100644 --- a/src/flip2.c +++ b/src/flip2.c @@ -123,23 +123,23 @@ enum flip2_mem_unit { /* EXPORTED PROGRAMMER FUNCTION PROTOTYPES */ -static int flip2_open(PROGRAMMER *pgm, char *port_spec); -static int flip2_initialize(PROGRAMMER* pgm, AVRPART *part); +static int flip2_open(PROGRAMMER *pgm, const char *port_spec); +static int flip2_initialize(const PROGRAMMER *pgm, const AVRPART *part); static void flip2_close(PROGRAMMER* pgm); -static void flip2_enable(PROGRAMMER* pgm); -static void flip2_disable(PROGRAMMER* pgm); -static void flip2_display(PROGRAMMER* pgm, const char *prefix); -static int flip2_program_enable(PROGRAMMER* pgm, AVRPART *part); -static int flip2_chip_erase(PROGRAMMER* pgm, AVRPART *part); -static int flip2_read_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +static void flip2_enable(PROGRAMMER *pgm, const AVRPART *p); +static void flip2_disable(const PROGRAMMER *pgm); +static void flip2_display(const PROGRAMMER *pgm, const char *prefix); +static int flip2_program_enable(const PROGRAMMER *pgm, const AVRPART *part); +static int flip2_chip_erase(const PROGRAMMER *pgm, const AVRPART *part); +static int flip2_read_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned long addr, unsigned char *value); -static int flip2_write_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +static int flip2_write_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned long addr, unsigned char value); -static int flip2_paged_load(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +static int flip2_paged_load(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -static int flip2_paged_write(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +static int flip2_paged_write(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -static int flip2_read_sig_bytes(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem); +static int flip2_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem); static void flip2_setup(PROGRAMMER * pgm); static void flip2_teardown(PROGRAMMER * pgm); @@ -170,8 +170,7 @@ static enum flip2_mem_unit flip2_mem_unit(const char *name); /* THE INITPGM FUNCTION DEFINITIONS */ -void flip2_initpgm(PROGRAMMER *pgm) -{ +void flip2_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "flip2"); /* Mandatory Functions */ @@ -195,14 +194,12 @@ void flip2_initpgm(PROGRAMMER *pgm) #ifdef HAVE_LIBUSB /* EXPORTED PROGRAMMER FUNCTION DEFINITIONS */ -int flip2_open(PROGRAMMER *pgm, char *port_spec) -{ +int flip2_open(PROGRAMMER *pgm, const char *port_spec) { FLIP2(pgm)->dfu = dfu_open(port_spec); return (FLIP2(pgm)->dfu != NULL) ? 0 : -1; } -int flip2_initialize(PROGRAMMER* pgm, AVRPART *part) -{ +int flip2_initialize(const PROGRAMMER *pgm, const AVRPART *part) { unsigned short vid, pid; int result; struct dfu_dev *dfu = FLIP2(pgm)->dfu; @@ -323,23 +320,19 @@ void flip2_close(PROGRAMMER* pgm) } } -void flip2_enable(PROGRAMMER* pgm) -{ +void flip2_enable(PROGRAMMER *pgm, const AVRPART *p) { /* Nothing to do. */ } -void flip2_disable(PROGRAMMER* pgm) -{ +void flip2_disable(const PROGRAMMER *pgm) { /* Nothing to do. */ } -void flip2_display(PROGRAMMER* pgm, const char *prefix) -{ +void flip2_display(const PROGRAMMER *pgm, const char *prefix) { /* Nothing to do. */ } -int flip2_program_enable(PROGRAMMER* pgm, AVRPART *part) -{ +int flip2_program_enable(const PROGRAMMER *pgm, const AVRPART *part) { /* I couldn't find anything that uses this function, although it is marked * as "mandatory" in pgm.c. In case anyone does use it, we'll report an * error if we failed to initialize. @@ -348,8 +341,7 @@ int flip2_program_enable(PROGRAMMER* pgm, AVRPART *part) return (FLIP2(pgm)->dfu != NULL) ? 0 : -1; } -int flip2_chip_erase(PROGRAMMER* pgm, AVRPART *part) -{ +int flip2_chip_erase(const PROGRAMMER *pgm, const AVRPART *part) { struct dfu_status status; int cmd_result = 0; int aux_result; @@ -383,7 +375,7 @@ int flip2_chip_erase(PROGRAMMER* pgm, AVRPART *part) return cmd_result; } -int flip2_read_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip2_read_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned long addr, unsigned char *value) { enum flip2_mem_unit mem_unit; @@ -406,7 +398,7 @@ int flip2_read_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, return flip2_read_memory(FLIP2(pgm)->dfu, mem_unit, addr, value, 1); } -int flip2_write_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip2_write_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned long addr, unsigned char value) { enum flip2_mem_unit mem_unit; @@ -429,7 +421,7 @@ int flip2_write_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, return flip2_write_memory(FLIP2(pgm)->dfu, mem_unit, addr, &value, 1); } -int flip2_paged_load(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip2_paged_load(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { enum flip2_mem_unit mem_unit; @@ -463,7 +455,7 @@ int flip2_paged_load(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, return (result == 0) ? n_bytes : -1; } -int flip2_paged_write(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip2_paged_write(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { enum flip2_mem_unit mem_unit; @@ -497,8 +489,7 @@ int flip2_paged_write(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, return (result == 0) ? n_bytes : -1; } -int flip2_read_sig_bytes(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem) -{ +int flip2_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem) { if (FLIP2(pgm)->dfu == NULL) return -1; @@ -918,15 +909,13 @@ enum flip2_mem_unit flip2_mem_unit(const char *name) { /* EXPORTED PROGRAMMER FUNCTION DEFINITIONS */ -int flip2_open(PROGRAMMER *pgm, char *port_spec) -{ +int flip2_open(PROGRAMMER *pgm, const char *port_spec) { fprintf(stderr, "%s: Error: No USB support in this compile of avrdude\n", progname); return -1; } -int flip2_initialize(PROGRAMMER* pgm, AVRPART *part) -{ +int flip2_initialize(const PROGRAMMER *pgm, const AVRPART *part) { return -1; } @@ -934,54 +923,48 @@ void flip2_close(PROGRAMMER* pgm) { } -void flip2_enable(PROGRAMMER* pgm) -{ +void flip2_enable(PROGRAMMER *pgm, const AVRPART *p) { } -void flip2_disable(PROGRAMMER* pgm) -{ +void flip2_disable(const PROGRAMMER *pgm) { } -void flip2_display(PROGRAMMER* pgm, const char *prefix) -{ +void flip2_display(const PROGRAMMER *pgm, const char *prefix) { } -int flip2_program_enable(PROGRAMMER* pgm, AVRPART *part) -{ +int flip2_program_enable(const PROGRAMMER *pgm, const AVRPART *part) { return -1; } -int flip2_chip_erase(PROGRAMMER* pgm, AVRPART *part) -{ +int flip2_chip_erase(const PROGRAMMER *pgm, const AVRPART *part) { return -1; } -int flip2_read_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip2_read_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned long addr, unsigned char *value) { return -1; } -int flip2_write_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip2_write_byte(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned long addr, unsigned char value) { return -1; } -int flip2_paged_load(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip2_paged_load(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { return -1; } -int flip2_paged_write(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem, +int flip2_paged_write(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { return -1; } -int flip2_read_sig_bytes(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem) -{ +int flip2_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *mem) { return -1; } diff --git a/src/flip2.h b/src/flip2.h index 4b1e576d..002d3b3c 100644 --- a/src/flip2.h +++ b/src/flip2.h @@ -26,7 +26,7 @@ extern "C" { #endif extern const char flip2_desc[]; -extern void flip2_initpgm(PROGRAMMER * pgm); +extern void flip2_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/ft245r.c b/src/ft245r.c index 04790143..9048cc2f 100644 --- a/src/ft245r.c +++ b/src/ft245r.c @@ -93,14 +93,14 @@ #if defined(DO_NOT_BUILD_FT245R) -static int ft245r_noftdi_open (struct programmer_t *pgm, char * name) { +static int ft245r_noftdi_open(PROGRAMMER *pgm, const char *name) { avrdude_message(MSG_INFO, "%s: error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.\n", progname); return -1; } -void ft245r_initpgm(PROGRAMMER * pgm) { +void ft245r_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "ftdi_syncbb"); pgm->open = ft245r_noftdi_open; } @@ -153,25 +153,25 @@ static struct { uint8_t buf[FT245R_BUFSIZE]; // receive ring buffer } rx; -static int ft245r_cmd(PROGRAMMER * pgm, const unsigned char *cmd, +static int ft245r_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res); -static int ft245r_tpi_tx(PROGRAMMER * pgm, uint8_t byte); -static int ft245r_tpi_rx(PROGRAMMER * pgm, uint8_t *bytep); +static int ft245r_tpi_tx(const PROGRAMMER *pgm, uint8_t byte); +static int ft245r_tpi_rx(const PROGRAMMER *pgm, uint8_t *bytep); // Discard all data from the receive buffer. -static void ft245r_rx_buf_purge(PROGRAMMER * pgm) { +static void ft245r_rx_buf_purge(const PROGRAMMER *pgm) { rx.len = 0; rx.rd = rx.wr = 0; } -static void ft245r_rx_buf_put(PROGRAMMER * pgm, uint8_t byte) { +static void ft245r_rx_buf_put(const PROGRAMMER *pgm, uint8_t byte) { rx.len++; rx.buf[rx.wr++] = byte; if (rx.wr >= sizeof(rx.buf)) rx.wr = 0; } -static uint8_t ft245r_rx_buf_get(PROGRAMMER * pgm) { +static uint8_t ft245r_rx_buf_get(const PROGRAMMER *pgm) { rx.len--; uint8_t byte = rx.buf[rx.rd++]; if (rx.rd >= sizeof(rx.buf)) @@ -180,7 +180,7 @@ static uint8_t ft245r_rx_buf_get(PROGRAMMER * pgm) { } /* Fill receive buffer with data from the FTDI receive FIFO. */ -static int ft245r_fill(PROGRAMMER * pgm) { +static int ft245r_fill(const PROGRAMMER *pgm) { uint8_t raw[FT245R_MIN_FIFO_SIZE]; int i, nread; @@ -197,8 +197,7 @@ static int ft245r_fill(PROGRAMMER * pgm) { return nread; } -static int ft245r_rx_buf_fill_and_get(PROGRAMMER* pgm) -{ +static int ft245r_rx_buf_fill_and_get(const PROGRAMMER *pgm) { while (rx.len == 0) { int result = ft245r_fill(pgm); @@ -212,7 +211,7 @@ static int ft245r_rx_buf_fill_and_get(PROGRAMMER* pgm) } /* Flush pending TX data to the FTDI send FIFO. */ -static int ft245r_flush(PROGRAMMER * pgm) { +static int ft245r_flush(const PROGRAMMER *pgm) { int rv, len = tx.len, avail; uint8_t *src = tx.buf; @@ -251,7 +250,7 @@ static int ft245r_flush(PROGRAMMER * pgm) { return 0; } -static int ft245r_send2(PROGRAMMER * pgm, unsigned char * buf, size_t len, +static int ft245r_send2(const PROGRAMMER *pgm, unsigned char *buf, size_t len, bool discard_rx_data) { int i, j; @@ -267,16 +266,16 @@ static int ft245r_send2(PROGRAMMER * pgm, unsigned char * buf, size_t len, return 0; } -static int ft245r_send(PROGRAMMER * pgm, unsigned char * buf, size_t len) { +static int ft245r_send(const PROGRAMMER *pgm, unsigned char *buf, size_t len) { return ft245r_send2(pgm, buf, len, false); } -static int ft245r_send_and_discard(PROGRAMMER * pgm, unsigned char * buf, +static int ft245r_send_and_discard(const PROGRAMMER *pgm, unsigned char *buf, size_t len) { return ft245r_send2(pgm, buf, len, true); } -static int ft245r_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len) { +static int ft245r_recv(const PROGRAMMER *pgm, unsigned char *buf, size_t len) { int i, j; ft245r_flush(pgm); @@ -318,7 +317,7 @@ static int ft245r_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len) { } -static int ft245r_drain(PROGRAMMER * pgm, int display) { +static int ft245r_drain(const PROGRAMMER *pgm, int display) { int r; // flush the buffer in the chip by changing the mode..... @@ -334,13 +333,13 @@ static int ft245r_drain(PROGRAMMER * pgm, int display) { /* Ensure any pending writes are sent to the FTDI chip before sleeping. */ -static void ft245r_usleep(PROGRAMMER * pgm, useconds_t usec) { +static void ft245r_usleep(const PROGRAMMER *pgm, useconds_t usec) { ft245r_flush(pgm); usleep(usec); } -static int ft245r_chip_erase(PROGRAMMER * pgm, AVRPART * p) { +static int ft245r_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4] = {0,0,0,0}; unsigned char res[4]; @@ -360,7 +359,7 @@ static int ft245r_chip_erase(PROGRAMMER * pgm, AVRPART * p) { } -static int ft245r_set_bitclock(PROGRAMMER * pgm) { +static int ft245r_set_bitclock(const PROGRAMMER *pgm) { // libftdi1 multiplies bitbang baudrate by 4: int r, rate = 0, ftdi_rate = 3000000 / 4; @@ -395,7 +394,7 @@ static int ft245r_set_bitclock(PROGRAMMER * pgm) { return 0; } -static int get_pin(PROGRAMMER *pgm, int pinname) { +static int get_pin(const PROGRAMMER *pgm, int pinname) { uint8_t byte; ft245r_flush(pgm); @@ -407,7 +406,7 @@ static int get_pin(PROGRAMMER *pgm, int pinname) { return GET_BITS_0(byte, pgm, pinname) != 0; } -static int set_pin(PROGRAMMER * pgm, int pinname, int val) { +static int set_pin(const PROGRAMMER *pgm, int pinname, int val) { unsigned char buf[1]; if (pgm->pin[pinname].mask[0] == 0) { @@ -422,46 +421,45 @@ static int set_pin(PROGRAMMER * pgm, int pinname, int val) { return 0; } -static int set_sck(PROGRAMMER * pgm, int value) { +static int set_sck(const PROGRAMMER *pgm, int value) { return set_pin(pgm, PIN_AVR_SCK, value); } -static int set_reset(PROGRAMMER * pgm, int value) { +static int set_reset(const PROGRAMMER *pgm, int value) { return set_pin(pgm, PIN_AVR_RESET, value); } -static int set_buff(PROGRAMMER * pgm, int value) { +static int set_buff(const PROGRAMMER *pgm, int value) { return set_pin(pgm, PPI_AVR_BUFF, value); } -static int set_vcc(PROGRAMMER * pgm, int value) { +static int set_vcc(const PROGRAMMER *pgm, int value) { return set_pin(pgm, PPI_AVR_VCC, value); } /* these functions are callbacks, which go into the * PROGRAMMER data structure ("optional functions") */ -static int set_led_pgm(struct programmer_t * pgm, int value) { +static int set_led_pgm(const PROGRAMMER *pgm, int value) { return set_pin(pgm, PIN_LED_PGM, value); } -static int set_led_rdy(struct programmer_t * pgm, int value) { +static int set_led_rdy(const PROGRAMMER *pgm, int value) { return set_pin(pgm, PIN_LED_RDY, value); } -static int set_led_err(struct programmer_t * pgm, int value) { +static int set_led_err(const PROGRAMMER *pgm, int value) { return set_pin(pgm, PIN_LED_ERR, value); } -static int set_led_vfy(struct programmer_t * pgm, int value) { +static int set_led_vfy(const PROGRAMMER *pgm, int value) { return set_pin(pgm, PIN_LED_VFY, value); } /* * apply power to the AVR processor */ -static void ft245r_powerup(PROGRAMMER * pgm) -{ +static void ft245r_powerup(const PROGRAMMER *pgm) { set_vcc(pgm, ON); /* power up */ ft245r_usleep(pgm, 100); } @@ -470,18 +468,17 @@ static void ft245r_powerup(PROGRAMMER * pgm) /* * remove power from the AVR processor */ -static void ft245r_powerdown(PROGRAMMER * pgm) -{ +static void ft245r_powerdown(const PROGRAMMER *pgm) { set_vcc(pgm, OFF); /* power down */ } -static void ft245r_disable(PROGRAMMER * pgm) { +static void ft245r_disable(const PROGRAMMER *pgm) { set_buff(pgm, OFF); } -static void ft245r_enable(PROGRAMMER * pgm) { +static void ft245r_enable(PROGRAMMER *pgm, const AVRPART *p) { /* * Prepare to start talking to the connected device - pull reset low * first, delay a few milliseconds, then enable the buffer. This @@ -500,7 +497,7 @@ static void ft245r_enable(PROGRAMMER * pgm) { /* * issue the 'program enable' command to the AVR device */ -static int ft245r_program_enable(PROGRAMMER * pgm, AVRPART * p) { +static int ft245r_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4] = {0,0,0,0}; unsigned char res[4]; int i; @@ -547,7 +544,7 @@ static int ft245r_program_enable(PROGRAMMER * pgm, AVRPART * p) { /* * initialize the AVR device and prepare it to accept commands */ -static int ft245r_initialize(PROGRAMMER * pgm, AVRPART * p) { +static int ft245r_initialize(const PROGRAMMER *pgm, const AVRPART *p) { /* Apply power between VCC and GND while RESET and SCK are set to “0”. In some systems, * the programmer can not guarantee that SCK is held low during power-up. In this @@ -616,7 +613,7 @@ static int ft245r_initialize(PROGRAMMER * pgm, AVRPART * p) { return ft245r_program_enable(pgm, p); } -static inline void add_bit(PROGRAMMER * pgm, unsigned char *buf, int *buf_pos, +static inline void add_bit(const PROGRAMMER *pgm, unsigned char *buf, int *buf_pos, uint8_t bit) { ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_MOSI, bit); ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0); @@ -628,7 +625,7 @@ static inline void add_bit(PROGRAMMER * pgm, unsigned char *buf, int *buf_pos, (*buf_pos)++; } -static inline int set_data(PROGRAMMER * pgm, unsigned char *buf, unsigned char data) { +static inline int set_data(const PROGRAMMER *pgm, unsigned char *buf, unsigned char data) { int j; int buf_pos = 0; unsigned char bit = 0x80; @@ -640,7 +637,7 @@ static inline int set_data(PROGRAMMER * pgm, unsigned char *buf, unsigned char d return buf_pos; } -static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, int offset) { +static inline unsigned char extract_data(const PROGRAMMER *pgm, unsigned char *buf, int offset) { int j; int buf_pos = FT245R_CYCLES; /* MISO data is valid AFTER rising SCK edge, i.e. in next clock cycle */ @@ -660,7 +657,7 @@ static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, i /* to check data */ #if 0 -static inline unsigned char extract_data_out(PROGRAMMER * pgm, unsigned char *buf, int offset) { +static inline unsigned char extract_data_out(const PROGRAMMER *pgm, unsigned char *buf, int offset) { int j; int buf_pos = 1; unsigned char bit = 0x80; @@ -683,7 +680,7 @@ static inline unsigned char extract_data_out(PROGRAMMER * pgm, unsigned char *bu * transmit an AVR device command and return the results; 'cmd' and * 'res' must point to at least a 4 byte data buffer */ -static int ft245r_cmd(PROGRAMMER * pgm, const unsigned char *cmd, +static int ft245r_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { int i,buf_pos; unsigned char buf[128]; @@ -705,7 +702,7 @@ static int ft245r_cmd(PROGRAMMER * pgm, const unsigned char *cmd, return 0; } -static inline uint8_t extract_tpi_data(PROGRAMMER * pgm, unsigned char *buf, +static inline uint8_t extract_tpi_data(const PROGRAMMER *pgm, unsigned char *buf, int *buf_pos) { uint8_t bit = 0x1, byte = 0; int j; @@ -719,7 +716,7 @@ static inline uint8_t extract_tpi_data(PROGRAMMER * pgm, unsigned char *buf, return byte; } -static inline int set_tpi_data(PROGRAMMER * pgm, unsigned char *buf, +static inline int set_tpi_data(const PROGRAMMER *pgm, unsigned char *buf, uint8_t byte) { uint8_t bit = 0x1, parity = 0; int j, buf_pos = 0; @@ -742,7 +739,7 @@ static inline int set_tpi_data(PROGRAMMER * pgm, unsigned char *buf, return buf_pos; } -static int ft245r_tpi_tx(PROGRAMMER * pgm, uint8_t byte) { +static int ft245r_tpi_tx(const PROGRAMMER *pgm, uint8_t byte) { uint8_t buf[128]; int len; @@ -751,7 +748,7 @@ static int ft245r_tpi_tx(PROGRAMMER * pgm, uint8_t byte) { return 0; } -static int ft245r_tpi_rx(PROGRAMMER * pgm, uint8_t *bytep) { +static int ft245r_tpi_rx(const PROGRAMMER *pgm, uint8_t *bytep) { uint8_t buf[128], bit, parity; int i, buf_pos = 0, len = 0; uint32_t res, m, byte; @@ -796,7 +793,7 @@ static int ft245r_tpi_rx(PROGRAMMER * pgm, uint8_t *bytep) { return 0; } -static int ft245r_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, +static int ft245r_cmd_tpi(const PROGRAMMER *pgm, const unsigned char *cmd, int cmd_len, unsigned char *res, int res_len) { int i, ret = 0; @@ -832,7 +829,7 @@ static const struct pin_checklist_t pin_checklist[] = { { PPI_AVR_BUFF, 0, &valid_pins}, }; -static int ft245r_open(PROGRAMMER * pgm, char * port) { +static int ft245r_open(PROGRAMMER *pgm, const char *port) { int rv; int devnum = -1; char device[9] = ""; @@ -987,13 +984,13 @@ static void ft245r_close(PROGRAMMER * pgm) { } } -static void ft245r_display(PROGRAMMER * pgm, const char * p) { +static void ft245r_display(const PROGRAMMER *pgm, const char *p) { avrdude_message(MSG_INFO, "%sPin assignment : 0..7 = DBUS0..7\n",p);/* , 8..11 = GPIO0..3\n",p);*/ pgm_display_generic_mask(pgm, p, SHOW_ALL_PINS); } -static int ft245r_paged_write_gen(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, +static int ft245r_paged_write_gen(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { for(int i=0; i < (int) n_bytes; i++, addr++) @@ -1035,7 +1032,7 @@ static void put_request(int addr, int bytes, int n) { } } -static int do_request(PROGRAMMER * pgm, AVRMEM *m) { +static int do_request(const PROGRAMMER *pgm, const AVRMEM *m) { struct ft245r_request *p; int addr, bytes, j, n; unsigned char buf[FT245R_FRAGMENT_SIZE+1+128]; @@ -1060,7 +1057,7 @@ static int do_request(PROGRAMMER * pgm, AVRMEM *m) { } -static int ft245r_paged_write_flash(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, +static int ft245r_paged_write_flash(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { int i, j, addr_save, buf_pos, req_count, do_page_write; @@ -1127,7 +1124,7 @@ static int ft245r_paged_write_flash(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, } -static int ft245r_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int ft245r_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { if(!n_bytes) @@ -1142,7 +1139,7 @@ static int ft245r_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return -2; } -static int ft245r_paged_load_gen(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, +static int ft245r_paged_load_gen(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { for(int i=0; i < (int) n_bytes; i++) { @@ -1158,7 +1155,7 @@ static int ft245r_paged_load_gen(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, } -static int ft245r_paged_load_flash(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, +static int ft245r_paged_load_flash(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { int i, j, addr_save, buf_pos, req_count; @@ -1225,7 +1222,7 @@ static int ft245r_paged_load_flash(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, return 0; } -static int ft245r_paged_load(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, +static int ft245r_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { if(!n_bytes) @@ -1240,7 +1237,7 @@ static int ft245r_paged_load(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, return -2; } -void ft245r_initpgm(PROGRAMMER * pgm) { +void ft245r_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "ftdi_syncbb"); /* diff --git a/src/ft245r.h b/src/ft245r.h index 40602e22..2495dc87 100644 --- a/src/ft245r.h +++ b/src/ft245r.h @@ -2,7 +2,7 @@ #define ft245r_h extern const char ft245r_desc[]; -void ft245r_initpgm (PROGRAMMER * pgm); +void ft245r_initpgm(PROGRAMMER *pgm); #endif /* ft245r_h */ diff --git a/src/jtag3.c b/src/jtag3.c index a13c5c39..94b2b695 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -75,7 +75,7 @@ struct pdata bool use_hvupdi; /* Function to set the appropriate clock parameter */ - int (*set_sck)(PROGRAMMER *, unsigned char *); + int (*set_sck)(const PROGRAMMER *, unsigned char *); }; #define PDATA(pgm) ((struct pdata *)(pgm->cookie)) @@ -90,25 +90,25 @@ struct pdata #define PGM_FL_IS_EDBG (0x0008) #define PGM_FL_IS_UPDI (0x0010) -static int jtag3_open(PROGRAMMER * pgm, char * port); -static int jtag3_edbg_prepare(PROGRAMMER * pgm); -static int jtag3_edbg_signoff(PROGRAMMER * pgm); -static int jtag3_edbg_send(PROGRAMMER * pgm, unsigned char * data, size_t len); -static int jtag3_edbg_recv_frame(PROGRAMMER * pgm, unsigned char **msg); +static int jtag3_open(PROGRAMMER *pgm, const char *port); +static int jtag3_edbg_prepare(const PROGRAMMER *pgm); +static int jtag3_edbg_signoff(const PROGRAMMER *pgm); +static int jtag3_edbg_send(const PROGRAMMER *pgm, unsigned char *data, size_t len); +static int jtag3_edbg_recv_frame(const PROGRAMMER *pgm, unsigned char **msg); -static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p); -static int jtag3_chip_erase(PROGRAMMER * pgm, AVRPART * p); -static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p); +static int jtag3_chip_erase(const PROGRAMMER *pgm, const AVRPART *p); +static int jtag3_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value); -static int jtag3_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int jtag3_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data); -static int jtag3_set_sck_period(PROGRAMMER * pgm, double v); -static void jtag3_print_parms1(PROGRAMMER * pgm, const char * p); -static int jtag3_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtag3_set_sck_period(const PROGRAMMER *pgm, double v); +static void jtag3_print_parms1(const PROGRAMMER *pgm, const char *p); +static int jtag3_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -static unsigned char jtag3_memtype(PROGRAMMER * pgm, AVRPART * p, unsigned long addr); -static unsigned int jtag3_memaddr(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned long addr); +static unsigned char jtag3_memtype(const PROGRAMMER *pgm, const AVRPART *p, unsigned long addr); +static unsigned int jtag3_memaddr(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr); void jtag3_setup(PROGRAMMER * pgm) @@ -188,8 +188,7 @@ static void jtag3_print_data(unsigned char *b, size_t s) putc('\n', stderr); } -static void jtag3_prmsg(PROGRAMMER * pgm, unsigned char * data, size_t len) -{ +static void jtag3_prmsg(const PROGRAMMER *pgm, unsigned char *data, size_t len) { int i; if (verbose >= 4) { @@ -324,8 +323,7 @@ static int jtag3_errcode(int reason) return LIBAVRDUDE_GENERAL_FAILURE; } -static void jtag3_prevent(PROGRAMMER * pgm, unsigned char * data, size_t len) -{ +static void jtag3_prevent(const PROGRAMMER *pgm, unsigned char *data, size_t len) { int i; if (verbose >= 4) { @@ -416,8 +414,7 @@ static void jtag3_prevent(PROGRAMMER * pgm, unsigned char * data, size_t len) -int jtag3_send(PROGRAMMER * pgm, unsigned char * data, size_t len) -{ +int jtag3_send(const PROGRAMMER *pgm, unsigned char *data, size_t len) { unsigned char *buf; if (pgm->flag & PGM_FL_IS_EDBG) @@ -450,8 +447,7 @@ int jtag3_send(PROGRAMMER * pgm, unsigned char * data, size_t len) return 0; } -static int jtag3_edbg_send(PROGRAMMER * pgm, unsigned char * data, size_t len) -{ +static int jtag3_edbg_send(const PROGRAMMER *pgm, unsigned char *data, size_t len) { unsigned char buf[USBDEV_MAX_XFER_3]; unsigned char status[USBDEV_MAX_XFER_3]; int rv; @@ -533,8 +529,7 @@ static int jtag3_edbg_send(PROGRAMMER * pgm, unsigned char * data, size_t len) /* * Send out all the CMSIS-DAP stuff needed to prepare the ICE. */ -static int jtag3_edbg_prepare(PROGRAMMER * pgm) -{ +static int jtag3_edbg_prepare(const PROGRAMMER *pgm) { unsigned char buf[USBDEV_MAX_XFER_3]; unsigned char status[USBDEV_MAX_XFER_3]; int rv; @@ -591,8 +586,7 @@ static int jtag3_edbg_prepare(PROGRAMMER * pgm) /* * Send out all the CMSIS-DAP stuff when signing off. */ -static int jtag3_edbg_signoff(PROGRAMMER * pgm) -{ +static int jtag3_edbg_signoff(const PROGRAMMER *pgm) { unsigned char buf[USBDEV_MAX_XFER_3]; unsigned char status[USBDEV_MAX_XFER_3]; int rv; @@ -643,8 +637,7 @@ static int jtag3_edbg_signoff(PROGRAMMER * pgm) } -static int jtag3_drain(PROGRAMMER * pgm, int display) -{ +static int jtag3_drain(const PROGRAMMER *pgm, int display) { return serial_drain(&pgm->fd, display); } @@ -657,7 +650,7 @@ static int jtag3_drain(PROGRAMMER * pgm, int display) * * Caller must eventually free the buffer. */ -static int jtag3_recv_frame(PROGRAMMER * pgm, unsigned char **msg) { +static int jtag3_recv_frame(const PROGRAMMER *pgm, unsigned char **msg) { int rv; unsigned char *buf = NULL; @@ -689,7 +682,7 @@ static int jtag3_recv_frame(PROGRAMMER * pgm, unsigned char **msg) { return rv; } -static int jtag3_edbg_recv_frame(PROGRAMMER * pgm, unsigned char **msg) { +static int jtag3_edbg_recv_frame(const PROGRAMMER *pgm, unsigned char **msg) { int rv, len = 0; unsigned char *buf = NULL; unsigned char *request; @@ -803,7 +796,7 @@ static int jtag3_edbg_recv_frame(PROGRAMMER * pgm, unsigned char **msg) { return len; } -int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) { +int jtag3_recv(const PROGRAMMER *pgm, unsigned char **msg) { unsigned short r_seqno; int rv; @@ -845,7 +838,7 @@ int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) { } } -int jtag3_command(PROGRAMMER *pgm, unsigned char *cmd, unsigned int cmdlen, +int jtag3_command(const PROGRAMMER *pgm, unsigned char *cmd, unsigned int cmdlen, unsigned char **resp, const char *descr) { int status; @@ -890,7 +883,7 @@ int jtag3_command(PROGRAMMER *pgm, unsigned char *cmd, unsigned int cmdlen, } -int jtag3_getsync(PROGRAMMER * pgm, int mode) { +int jtag3_getsync(const PROGRAMMER *pgm, int mode) { unsigned char buf[3], *resp; @@ -921,8 +914,7 @@ int jtag3_getsync(PROGRAMMER * pgm, int mode) { /* * issue the 'chip erase' command to the AVR device */ -static int jtag3_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtag3_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char buf[8], *resp; buf[0] = SCOPE_AVR; @@ -941,8 +933,7 @@ static int jtag3_chip_erase(PROGRAMMER * pgm, AVRPART * p) /* * UPDI 'unlock' -> 'enter progmode' with chip erase key */ -static int jtag3_unlock_erase_key(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtag3_unlock_erase_key(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char buf[8], *resp; buf[0] = 1; /* Enable */ @@ -969,8 +960,7 @@ static int jtag3_unlock_erase_key(PROGRAMMER * pgm, AVRPART * p) /* * There is no chip erase functionality in debugWire mode. */ -static int jtag3_chip_erase_dw(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtag3_chip_erase_dw(const PROGRAMMER *pgm, const AVRPART *p) { avrdude_message(MSG_INFO, "%s: Chip erase not supported in debugWire mode\n", progname); @@ -978,13 +968,11 @@ static int jtag3_chip_erase_dw(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int jtag3_program_enable_dummy(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtag3_program_enable_dummy(const PROGRAMMER *pgm, const AVRPART *p) { return 0; } -static int jtag3_program_enable(PROGRAMMER * pgm) -{ +static int jtag3_program_enable(const PROGRAMMER *pgm) { unsigned char buf[3], *resp; int status; @@ -1005,8 +993,7 @@ static int jtag3_program_enable(PROGRAMMER * pgm) return status; } -static int jtag3_program_disable(PROGRAMMER * pgm) -{ +static int jtag3_program_disable(const PROGRAMMER *pgm) { unsigned char buf[3], *resp; if (!PDATA(pgm)->prog_enabled) @@ -1026,18 +1013,15 @@ static int jtag3_program_disable(PROGRAMMER * pgm) return 0; } -static int jtag3_set_sck_xmega_pdi(PROGRAMMER *pgm, unsigned char *clk) -{ +static int jtag3_set_sck_xmega_pdi(const PROGRAMMER *pgm, unsigned char *clk) { return jtag3_setparm(pgm, SCOPE_AVR, 1, PARM3_CLK_XMEGA_PDI, clk, 2); } -static int jtag3_set_sck_xmega_jtag(PROGRAMMER *pgm, unsigned char *clk) -{ +static int jtag3_set_sck_xmega_jtag(const PROGRAMMER *pgm, unsigned char *clk) { return jtag3_setparm(pgm, SCOPE_AVR, 1, PARM3_CLK_XMEGA_JTAG, clk, 2); } -static int jtag3_set_sck_mega_jtag(PROGRAMMER *pgm, unsigned char *clk) -{ +static int jtag3_set_sck_mega_jtag(const PROGRAMMER *pgm, unsigned char *clk) { return jtag3_setparm(pgm, SCOPE_AVR, 1, PARM3_CLK_MEGA_PROG, clk, 2); } @@ -1045,8 +1029,7 @@ static int jtag3_set_sck_mega_jtag(PROGRAMMER *pgm, unsigned char *clk) /* * initialize the AVR device and prepare it to accept commands */ -static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char conn = 0, parm[4]; const char *ifname; unsigned char cmd[4], *resp; @@ -1365,12 +1348,11 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) md.allow_full_page_bitstream = (p->flags & AVRPART_ALLOWFULLPAGEBITSTREAM) != 0; md.idr_address = p->idr; - if (p->eecr == 0) - p->eecr = 0x3f; /* matches most "modern" mega/tiny AVRs */ - md.eearh_address = p->eecr - 0x20 + 3; - md.eearl_address = p->eecr - 0x20 + 2; - md.eecr_address = p->eecr - 0x20; - md.eedr_address = p->eecr - 0x20 + 1; + unsigned char eecr = p->eecr? p->eecr: 0x3f; // Use default 0x3f if not set + md.eearh_address = eecr - 0x20 + 3; + md.eearl_address = eecr - 0x20 + 2; + md.eecr_address = eecr - 0x20; + md.eedr_address = eecr - 0x20 + 1; md.spmcr_address = p->spmcr; //md.osccal_address = p->osccal; // do we need it at all? @@ -1459,8 +1441,7 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) return 0; } -static void jtag3_disable(PROGRAMMER * pgm) -{ +static void jtag3_disable(const PROGRAMMER *pgm) { free(PDATA(pgm)->flash_pagecache); PDATA(pgm)->flash_pagecache = NULL; @@ -1475,13 +1456,11 @@ static void jtag3_disable(PROGRAMMER * pgm) (void)jtag3_program_disable(pgm); } -static void jtag3_enable(PROGRAMMER * pgm) -{ +static void jtag3_enable(PROGRAMMER *pgm, const AVRPART *p) { return; } -static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms) -{ +static int jtag3_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) { LNODEID ln; const char *extended_param; int rv = 0; @@ -1524,8 +1503,7 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms) return rv; } -int jtag3_open_common(PROGRAMMER * pgm, char * port) -{ +int jtag3_open_common(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; LNODEID usbpid; int rv = -1; @@ -1620,8 +1598,7 @@ int jtag3_open_common(PROGRAMMER * pgm, char * port) -static int jtag3_open(PROGRAMMER * pgm, char * port) -{ +static int jtag3_open(PROGRAMMER *pgm, const char *port) { avrdude_message(MSG_NOTICE2, "%s: jtag3_open()\n", progname); if (jtag3_open_common(pgm, port) < 0) @@ -1633,8 +1610,7 @@ static int jtag3_open(PROGRAMMER * pgm, char * port) return 0; } -static int jtag3_open_dw(PROGRAMMER * pgm, char * port) -{ +static int jtag3_open_dw(PROGRAMMER *pgm, const char *port) { avrdude_message(MSG_NOTICE2, "%s: jtag3_open_dw()\n", progname); if (jtag3_open_common(pgm, port) < 0) @@ -1646,8 +1622,7 @@ static int jtag3_open_dw(PROGRAMMER * pgm, char * port) return 0; } -static int jtag3_open_pdi(PROGRAMMER * pgm, char * port) -{ +static int jtag3_open_pdi(PROGRAMMER *pgm, const char *port) { avrdude_message(MSG_NOTICE2, "%s: jtag3_open_pdi()\n", progname); if (jtag3_open_common(pgm, port) < 0) @@ -1659,8 +1634,7 @@ static int jtag3_open_pdi(PROGRAMMER * pgm, char * port) return 0; } -static int jtag3_open_updi(PROGRAMMER * pgm, char * port) -{ +static int jtag3_open_updi(PROGRAMMER *pgm, const char *port) { avrdude_message(MSG_NOTICE2, "%s: jtag3_open_updi()\n", progname); LNODEID ln; @@ -1708,7 +1682,7 @@ void jtag3_close(PROGRAMMER * pgm) pgm->fd.ifd = -1; } -static int jtag3_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtag3_page_erase(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int addr) { unsigned char cmd[8], *resp; @@ -1754,7 +1728,7 @@ static int jtag3_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return 0; } -static int jtag3_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtag3_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -1864,7 +1838,7 @@ static int jtag3_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return n_bytes; } -static int jtag3_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtag3_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -1950,7 +1924,7 @@ static int jtag3_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return n_bytes; } -static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int jtag3_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value) { unsigned char cmd[12]; @@ -2123,7 +2097,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, return 0; } -static int jtag3_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int jtag3_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data) { unsigned char cmd[14]; @@ -2247,8 +2221,7 @@ static int jtag3_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, * As the STK500 expresses it as a period length (and we actualy do * program a period length as well), we rather call it by that name. */ -static int jtag3_set_sck_period(PROGRAMMER * pgm, double v) -{ +static int jtag3_set_sck_period(const PROGRAMMER *pgm, double v) { unsigned char parm[2]; unsigned int clock = 1E-3 / v; /* kHz */ @@ -2268,7 +2241,7 @@ static int jtag3_set_sck_period(PROGRAMMER * pgm, double v) /* * Read (an) emulator parameter(s). */ -int jtag3_getparm(PROGRAMMER * pgm, unsigned char scope, +int jtag3_getparm(const PROGRAMMER *pgm, unsigned char scope, unsigned char section, unsigned char parm, unsigned char *value, unsigned char length) { @@ -2310,7 +2283,7 @@ int jtag3_getparm(PROGRAMMER * pgm, unsigned char scope, /* * Write an emulator parameter. */ -int jtag3_setparm(PROGRAMMER * pgm, unsigned char scope, +int jtag3_setparm(const PROGRAMMER *pgm, unsigned char scope, unsigned char section, unsigned char parm, unsigned char *value, unsigned char length) { @@ -2347,8 +2320,7 @@ int jtag3_setparm(PROGRAMMER * pgm, unsigned char scope, return status; } -int jtag3_read_sib(PROGRAMMER * pgm, AVRPART * p, char * sib) -{ +int jtag3_read_sib(const PROGRAMMER *pgm, const AVRPART *p, char *sib) { int status; unsigned char cmd[12]; unsigned char *resp = NULL; @@ -2370,8 +2342,7 @@ int jtag3_read_sib(PROGRAMMER * pgm, AVRPART * p, char * sib) return 0; } -static int jtag3_set_vtarget(PROGRAMMER * pgm, double v) -{ +static int jtag3_set_vtarget(const PROGRAMMER *pgm, double v) { unsigned uaref, utarg; unsigned char buf[2]; @@ -2397,8 +2368,7 @@ static int jtag3_set_vtarget(PROGRAMMER * pgm, double v) return 0; } -static void jtag3_display(PROGRAMMER * pgm, const char * p) -{ +static void jtag3_display(const PROGRAMMER *pgm, const char *p) { unsigned char parms[5]; unsigned char cmd[4], *resp, c; int status; @@ -2440,8 +2410,7 @@ static void jtag3_display(PROGRAMMER * pgm, const char * p) } -static void jtag3_print_parms1(PROGRAMMER * pgm, const char * p) -{ +static void jtag3_print_parms1(const PROGRAMMER *pgm, const char *p) { unsigned char buf[2]; if (jtag3_getparm(pgm, SCOPE_GENERAL, 1, PARM3_VTARGET, buf, 2) < 0) @@ -2483,13 +2452,11 @@ static void jtag3_print_parms1(PROGRAMMER * pgm, const char * p) } } -static void jtag3_print_parms(PROGRAMMER * pgm) -{ +static void jtag3_print_parms(const PROGRAMMER *pgm) { jtag3_print_parms1(pgm, ""); } -static unsigned char jtag3_memtype(PROGRAMMER * pgm, AVRPART * p, unsigned long addr) -{ +static unsigned char jtag3_memtype(const PROGRAMMER *pgm, const AVRPART *p, unsigned long addr) { if ( p->flags & AVRPART_HAS_PDI ) { if (addr >= PDATA(pgm)->boot_start) return MTYPE_BOOT_FLASH; @@ -2500,8 +2467,7 @@ static unsigned char jtag3_memtype(PROGRAMMER * pgm, AVRPART * p, unsigned long } } -static unsigned int jtag3_memaddr(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned long addr) -{ +static unsigned int jtag3_memaddr(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr) { if ((p->flags & AVRPART_HAS_PDI) != 0) { if (addr >= PDATA(pgm)->boot_start) /* @@ -2533,8 +2499,7 @@ static unsigned int jtag3_memaddr(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, uns const char jtag3_desc[] = "Atmel JTAGICE3"; -void jtag3_initpgm(PROGRAMMER * pgm) -{ +void jtag3_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "JTAGICE3"); /* @@ -2568,8 +2533,7 @@ void jtag3_initpgm(PROGRAMMER * pgm) const char jtag3_dw_desc[] = "Atmel JTAGICE3 in debugWire mode"; -void jtag3_dw_initpgm(PROGRAMMER * pgm) -{ +void jtag3_dw_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "JTAGICE3_DW"); /* @@ -2600,8 +2564,7 @@ void jtag3_dw_initpgm(PROGRAMMER * pgm) const char jtag3_pdi_desc[] = "Atmel JTAGICE3 in PDI mode"; -void jtag3_pdi_initpgm(PROGRAMMER * pgm) -{ +void jtag3_pdi_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "JTAGICE3_PDI"); /* @@ -2634,8 +2597,7 @@ void jtag3_pdi_initpgm(PROGRAMMER * pgm) const char jtag3_updi_desc[] = "Atmel JTAGICE3 in UPDI mode"; -void jtag3_updi_initpgm(PROGRAMMER * pgm) -{ +void jtag3_updi_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "JTAGICE3_UPDI"); /* diff --git a/src/jtag3.h b/src/jtag3.h index 4e49c586..c871c019 100644 --- a/src/jtag3.h +++ b/src/jtag3.h @@ -25,27 +25,27 @@ extern "C" { #endif -int jtag3_open_common(PROGRAMMER * pgm, char * port); -int jtag3_send(PROGRAMMER * pgm, unsigned char * data, size_t len); -int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg); +int jtag3_open_common(PROGRAMMER *pgm, const char *port); +int jtag3_send(const PROGRAMMER *pgm, unsigned char *data, size_t len); +int jtag3_recv(const PROGRAMMER *pgm, unsigned char **msg); void jtag3_close(PROGRAMMER * pgm); -int jtag3_getsync(PROGRAMMER * pgm, int mode); -int jtag3_getparm(PROGRAMMER * pgm, unsigned char scope, +int jtag3_getsync(const PROGRAMMER *pgm, int mode); +int jtag3_getparm(const PROGRAMMER *pgm, unsigned char scope, unsigned char section, unsigned char parm, unsigned char *value, unsigned char length); -int jtag3_setparm(PROGRAMMER * pgm, unsigned char scope, +int jtag3_setparm(const PROGRAMMER *pgm, unsigned char scope, unsigned char section, unsigned char parm, unsigned char *value, unsigned char length); -int jtag3_command(PROGRAMMER *pgm, unsigned char *cmd, unsigned int cmdlen, +int jtag3_command(const PROGRAMMER *pgm, unsigned char *cmd, unsigned int cmdlen, unsigned char **resp, const char *descr); extern const char jtag3_desc[]; extern const char jtag3_dw_desc[]; extern const char jtag3_pdi_desc[]; extern const char jtag3_updi_desc[]; -void jtag3_initpgm (PROGRAMMER * pgm); -void jtag3_dw_initpgm (PROGRAMMER * pgm); -void jtag3_pdi_initpgm (PROGRAMMER * pgm); -void jtag3_updi_initpgm (PROGRAMMER * pgm); +void jtag3_initpgm(PROGRAMMER *pgm); +void jtag3_dw_initpgm(PROGRAMMER *pgm); +void jtag3_pdi_initpgm(PROGRAMMER *pgm); +void jtag3_updi_initpgm(PROGRAMMER *pgm); /* * These functions are referenced from stk500v2.c for JTAGICE3 in diff --git a/src/jtagmkI.c b/src/jtagmkI.c index 2e84eb5c..a9b2dda8 100644 --- a/src/jtagmkI.c +++ b/src/jtagmkI.c @@ -95,18 +95,18 @@ const static struct { /* { 14400L, 0xf8 }, */ /* not supported by serial driver */ }; -static int jtagmkI_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int jtagmkI_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value); -static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int jtagmkI_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data); -static int jtagmkI_set_sck_period(PROGRAMMER * pgm, double v); -static int jtagmkI_getparm(PROGRAMMER * pgm, unsigned char parm, +static int jtagmkI_set_sck_period(const PROGRAMMER *pgm, double v); +static int jtagmkI_getparm(const PROGRAMMER *pgm, unsigned char parm, unsigned char * value); -static int jtagmkI_setparm(PROGRAMMER * pgm, unsigned char parm, +static int jtagmkI_setparm(const PROGRAMMER *pgm, unsigned char parm, unsigned char value); -static void jtagmkI_print_parms1(PROGRAMMER * pgm, const char * p); +static void jtagmkI_print_parms1(const PROGRAMMER *pgm, const char *p); -static int jtagmkI_resync(PROGRAMMER *pgm, int maxtries, int signon); +static int jtagmkI_resync(const PROGRAMMER *pgm, int maxtries, int signon); static void jtagmkI_setup(PROGRAMMER * pgm) { @@ -139,8 +139,7 @@ u16_to_b2(unsigned char *b, unsigned short l) b[1] = (l >> 8) & 0xff; } -static void jtagmkI_prmsg(PROGRAMMER * pgm, unsigned char * data, size_t len) -{ +static void jtagmkI_prmsg(const PROGRAMMER *pgm, unsigned char *data, size_t len) { int i; if (verbose >= 4) { @@ -193,8 +192,7 @@ static void jtagmkI_prmsg(PROGRAMMER * pgm, unsigned char * data, size_t len) } -static int jtagmkI_send(PROGRAMMER * pgm, unsigned char * data, size_t len) -{ +static int jtagmkI_send(const PROGRAMMER *pgm, unsigned char *data, size_t len) { unsigned char *buf; avrdude_message(MSG_DEBUG, "\n%s: jtagmkI_send(): sending %u bytes\n", @@ -223,8 +221,7 @@ static int jtagmkI_send(PROGRAMMER * pgm, unsigned char * data, size_t len) return 0; } -static int jtagmkI_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len) -{ +static int jtagmkI_recv(const PROGRAMMER *pgm, unsigned char *buf, size_t len) { if (serial_recv(&pgm->fd, buf, len) != 0) { avrdude_message(MSG_INFO, "\n%s: jtagmkI_recv(): failed to send command to serial port\n", progname); @@ -238,14 +235,12 @@ static int jtagmkI_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len) } -static int jtagmkI_drain(PROGRAMMER * pgm, int display) -{ +static int jtagmkI_drain(const PROGRAMMER *pgm, int display) { return serial_drain(&pgm->fd, display); } -static int jtagmkI_resync(PROGRAMMER * pgm, int maxtries, int signon) -{ +static int jtagmkI_resync(const PROGRAMMER *pgm, int maxtries, int signon) { int tries; unsigned char buf[4], resp[9]; long otimeout = serial_recv_timeout; @@ -316,8 +311,7 @@ static int jtagmkI_resync(PROGRAMMER * pgm, int maxtries, int signon) return 0; } -static int jtagmkI_getsync(PROGRAMMER * pgm) -{ +static int jtagmkI_getsync(const PROGRAMMER *pgm) { unsigned char buf[1], resp[9]; if (jtagmkI_resync(pgm, 5, 1) < 0) { @@ -345,8 +339,7 @@ static int jtagmkI_getsync(PROGRAMMER * pgm) /* * issue the 'chip erase' command to the AVR device */ -static int jtagmkI_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtagmkI_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char buf[1], resp[2]; buf[0] = CMD_CHIP_ERASE; @@ -372,8 +365,7 @@ static int jtagmkI_chip_erase(PROGRAMMER * pgm, AVRPART * p) return 0; } -static void jtagmkI_set_devdescr(PROGRAMMER * pgm, AVRPART * p) -{ +static void jtagmkI_set_devdescr(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char resp[2]; LNODEID ln; AVRMEM * m; @@ -419,8 +411,7 @@ static void jtagmkI_set_devdescr(PROGRAMMER * pgm, AVRPART * p) /* * Reset the target. */ -static int jtagmkI_reset(PROGRAMMER * pgm) -{ +static int jtagmkI_reset(const PROGRAMMER *pgm) { unsigned char buf[1], resp[2]; buf[0] = CMD_RESET; @@ -445,14 +436,12 @@ static int jtagmkI_reset(PROGRAMMER * pgm) return 0; } -static int jtagmkI_program_enable_dummy(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtagmkI_program_enable_dummy(const PROGRAMMER *pgm, const AVRPART *p) { return 0; } -static int jtagmkI_program_enable(PROGRAMMER * pgm) -{ +static int jtagmkI_program_enable(const PROGRAMMER *pgm) { unsigned char buf[1], resp[2]; if (PDATA(pgm)->prog_enabled) @@ -483,8 +472,7 @@ static int jtagmkI_program_enable(PROGRAMMER * pgm) return 0; } -static int jtagmkI_program_disable(PROGRAMMER * pgm) -{ +static int jtagmkI_program_disable(const PROGRAMMER *pgm) { unsigned char buf[1], resp[2]; if (!PDATA(pgm)->prog_enabled) @@ -530,8 +518,7 @@ static unsigned char jtagmkI_get_baud(long baud) /* * initialize the AVR device and prepare it to accept commands */ -static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtagmkI_initialize(const PROGRAMMER *pgm, const AVRPART *p) { AVRMEM hfuse; unsigned char cmd[1], resp[5]; unsigned char b; @@ -621,8 +608,7 @@ static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p) } -static void jtagmkI_disable(PROGRAMMER * pgm) -{ +static void jtagmkI_disable(const PROGRAMMER *pgm) { free(PDATA(pgm)->flash_pagecache); PDATA(pgm)->flash_pagecache = NULL; @@ -632,13 +618,12 @@ static void jtagmkI_disable(PROGRAMMER * pgm) (void)jtagmkI_program_disable(pgm); } -static void jtagmkI_enable(PROGRAMMER * pgm) -{ +static void jtagmkI_enable(PROGRAMMER *pgm, const AVRPART *p) { return; } -static int jtagmkI_open(PROGRAMMER * pgm, char * port) +static int jtagmkI_open(PROGRAMMER *pgm, const char *port) { size_t i; @@ -712,7 +697,7 @@ static void jtagmkI_close(PROGRAMMER * pgm) } -static int jtagmkI_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtagmkI_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -846,7 +831,7 @@ static int jtagmkI_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return n_bytes; } -static int jtagmkI_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtagmkI_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -937,7 +922,7 @@ static int jtagmkI_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return n_bytes; } -static int jtagmkI_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int jtagmkI_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value) { unsigned char cmd[6]; @@ -1053,7 +1038,7 @@ static int jtagmkI_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, return 0; } -static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int jtagmkI_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data) { unsigned char cmd[6], datacmd[1 * 2 + 1]; @@ -1175,8 +1160,7 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, * As the STK500 expresses it as a period length (and we actualy do * program a period length as well), we rather call it by that name. */ -static int jtagmkI_set_sck_period(PROGRAMMER * pgm, double v) -{ +static int jtagmkI_set_sck_period(const PROGRAMMER *pgm, double v) { unsigned char dur; v = 1 / v; /* convert to frequency */ @@ -1198,7 +1182,7 @@ static int jtagmkI_set_sck_period(PROGRAMMER * pgm, double v) * multi-byte parameters get two different parameter names for * their components. */ -static int jtagmkI_getparm(PROGRAMMER * pgm, unsigned char parm, +static int jtagmkI_getparm(const PROGRAMMER *pgm, const unsigned char parm, unsigned char * value) { unsigned char buf[2], resp[3]; @@ -1242,7 +1226,7 @@ static int jtagmkI_getparm(PROGRAMMER * pgm, unsigned char parm, /* * Write an emulator parameter. */ -static int jtagmkI_setparm(PROGRAMMER * pgm, unsigned char parm, +static int jtagmkI_setparm(const PROGRAMMER *pgm, unsigned char parm, unsigned char value) { unsigned char buf[3], resp[2]; @@ -1274,9 +1258,7 @@ static int jtagmkI_setparm(PROGRAMMER * pgm, unsigned char parm, } -static void jtagmkI_display(PROGRAMMER * pgm, const char * p) -{ - +static void jtagmkI_display(const PROGRAMMER *pgm, const char *p) { unsigned char hw, fw; if (jtagmkI_getparm(pgm, PARM_HW_VERSION, &hw) < 0 || @@ -1292,8 +1274,7 @@ static void jtagmkI_display(PROGRAMMER * pgm, const char * p) } -static void jtagmkI_print_parms1(PROGRAMMER * pgm, const char * p) -{ +static void jtagmkI_print_parms1(const PROGRAMMER *pgm, const char *p) { unsigned char vtarget, jtag_clock; const char *clkstr; double clk; @@ -1337,15 +1318,13 @@ static void jtagmkI_print_parms1(PROGRAMMER * pgm, const char * p) } -static void jtagmkI_print_parms(PROGRAMMER * pgm) -{ +static void jtagmkI_print_parms(const PROGRAMMER *pgm) { jtagmkI_print_parms1(pgm, ""); } const char jtagmkI_desc[] = "Atmel JTAG ICE mkI"; -void jtagmkI_initpgm(PROGRAMMER * pgm) -{ +void jtagmkI_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "JTAGMKI"); /* diff --git a/src/jtagmkI.h b/src/jtagmkI.h index fbc0d161..2a250c04 100644 --- a/src/jtagmkI.h +++ b/src/jtagmkI.h @@ -26,7 +26,7 @@ extern "C" { #endif extern const char jtagmkI_desc[]; -void jtagmkI_initpgm (PROGRAMMER * pgm); +void jtagmkI_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/jtagmkII.c b/src/jtagmkII.c index 98ee87b1..f4323799 100644 --- a/src/jtagmkII.c +++ b/src/jtagmkII.c @@ -83,6 +83,11 @@ struct pdata /* Major firmware version (needed for Xmega programming) */ unsigned int fwver; + +#define FLAGS32_INIT_SMC 1 // Part will undergo chip erase +#define FLAGS32_WRITE 2 // At least one write operation specified + // Couple of flag bits for AVR32 programming + int flags32; }; #define PDATA(pgm) ((struct pdata *)(pgm->cookie)) @@ -127,64 +132,57 @@ static struct { #define PGM_FL_IS_PDI (0x0002) #define PGM_FL_IS_JTAG (0x0004) -static int jtagmkII_open(PROGRAMMER * pgm, char * port); +static int jtagmkII_open(PROGRAMMER *pgm, const char *port); -static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p); -static int jtagmkII_chip_erase(PROGRAMMER * pgm, AVRPART * p); -static int jtagmkII_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int jtagmkII_initialize(const PROGRAMMER *pgm, const AVRPART *p); +static int jtagmkII_chip_erase(const PROGRAMMER *pgm, const AVRPART *p); +static int jtagmkII_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value); -static int jtagmkII_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int jtagmkII_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data); -static int jtagmkII_reset(PROGRAMMER * pgm, unsigned char flags); -static int jtagmkII_set_sck_period(PROGRAMMER * pgm, double v); -static int jtagmkII_setparm(PROGRAMMER * pgm, unsigned char parm, +static int jtagmkII_reset(const PROGRAMMER *pgm, unsigned char flags); +static int jtagmkII_set_sck_period(const PROGRAMMER *pgm, double v); +static int jtagmkII_setparm(const PROGRAMMER *pgm, unsigned char parm, unsigned char * value); -static void jtagmkII_print_parms1(PROGRAMMER * pgm, const char * p); -static int jtagmkII_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static void jtagmkII_print_parms1(const PROGRAMMER *pgm, const char *p); +static int jtagmkII_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -static unsigned char jtagmkII_memtype(PROGRAMMER * pgm, AVRPART * p, unsigned long addr); -static unsigned int jtagmkII_memaddr(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned long addr); +static unsigned char jtagmkII_memtype(const PROGRAMMER *pgm, const AVRPART *p, unsigned long addr); +static unsigned int jtagmkII_memaddr(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr); // AVR32 #define ERROR_SAB 0xFFFFFFFF -static int jtagmkII_open32(PROGRAMMER * pgm, char * port); +static int jtagmkII_open32(PROGRAMMER *pgm, const char *port); static void jtagmkII_close32(PROGRAMMER * pgm); -static int jtagmkII_reset32(PROGRAMMER * pgm, unsigned short flags); -static int jtagmkII_initialize32(PROGRAMMER * pgm, AVRPART * p); -static int jtagmkII_chip_erase32(PROGRAMMER * pgm, AVRPART * p); -static unsigned long jtagmkII_read_SABaddr(PROGRAMMER * pgm, unsigned long addr, +static int jtagmkII_reset32(const PROGRAMMER *pgm, unsigned short flags); +static int jtagmkII_initialize32(const PROGRAMMER *pgm, const AVRPART *p); +static int jtagmkII_chip_erase32(const PROGRAMMER *pgm, const AVRPART *p); +static unsigned long jtagmkII_read_SABaddr(const PROGRAMMER *pgm, unsigned long addr, unsigned int prefix); // ERROR_SAB illegal -static int jtagmkII_write_SABaddr(PROGRAMMER * pgm, unsigned long addr, +static int jtagmkII_write_SABaddr(const PROGRAMMER *pgm, unsigned long addr, unsigned int prefix, unsigned long val); -static int jtagmkII_avr32_reset(PROGRAMMER * pgm, unsigned char val, +static int jtagmkII_avr32_reset(const PROGRAMMER *pgm, unsigned char val, unsigned char ret1, unsigned char ret2); -static int jtagmkII_smc_init32(PROGRAMMER * pgm); -static int jtagmkII_paged_write32(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtagmkII_smc_init32(const PROGRAMMER *pgm); +static int jtagmkII_paged_write32(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -static int jtagmkII_flash_lock32(PROGRAMMER * pgm, unsigned char lock, +static int jtagmkII_flash_lock32(const PROGRAMMER *pgm, unsigned char lock, unsigned int page); -static int jtagmkII_flash_erase32(PROGRAMMER * pgm, unsigned int page); -static int jtagmkII_flash_write_page32(PROGRAMMER * pgm, unsigned int page); -static int jtagmkII_flash_clear_pagebuffer32(PROGRAMMER * pgm); -static int jtagmkII_paged_load32(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtagmkII_flash_erase32(const PROGRAMMER *pgm, unsigned int page); +static int jtagmkII_flash_write_page32(const PROGRAMMER *pgm, unsigned int page); +static int jtagmkII_flash_clear_pagebuffer32(const PROGRAMMER *pgm); +static int jtagmkII_paged_load32(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -void jtagmkII_setup(PROGRAMMER * pgm) -{ - if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) { - avrdude_message(MSG_INFO, "%s: jtagmkII_setup(): Out of memory allocating private data\n", - progname); - exit(1); - } - memset(pgm->cookie, 0, sizeof(struct pdata)); +void jtagmkII_setup(PROGRAMMER *pgm) { + pgm->cookie = cfg_malloc("jtagmkII_setup()", sizeof(struct pdata)); } -void jtagmkII_teardown(PROGRAMMER * pgm) -{ +void jtagmkII_teardown(PROGRAMMER *pgm) { free(pgm->cookie); } @@ -279,8 +277,7 @@ static void jtagmkII_print_memory(unsigned char *b, size_t s) putc('\n', stderr); } -static void jtagmkII_prmsg(PROGRAMMER * pgm, unsigned char * data, size_t len) -{ +static void jtagmkII_prmsg(const PROGRAMMER *pgm, unsigned char *data, size_t len) { int i; if (verbose >= 4) { @@ -420,8 +417,7 @@ static void jtagmkII_prmsg(PROGRAMMER * pgm, unsigned char * data, size_t len) } -int jtagmkII_send(PROGRAMMER * pgm, unsigned char * data, size_t len) -{ +int jtagmkII_send(const PROGRAMMER *pgm, unsigned char *data, size_t len) { unsigned char *buf; avrdude_message(MSG_DEBUG, "\n%s: jtagmkII_send(): sending %lu bytes\n", @@ -455,8 +451,7 @@ int jtagmkII_send(PROGRAMMER * pgm, unsigned char * data, size_t len) } -static int jtagmkII_drain(PROGRAMMER * pgm, int display) -{ +static int jtagmkII_drain(const PROGRAMMER *pgm, int display) { return serial_drain(&pgm->fd, display); } @@ -469,7 +464,7 @@ static int jtagmkII_drain(PROGRAMMER * pgm, int display) * * Caller must eventually free the buffer. */ -static int jtagmkII_recv_frame(PROGRAMMER * pgm, unsigned char **msg, +static int jtagmkII_recv_frame(const PROGRAMMER *pgm, unsigned char **msg, unsigned short * seqno) { enum states { sSTART, /* NB: do NOT change the sequence of the following: */ @@ -615,7 +610,7 @@ static int jtagmkII_recv_frame(PROGRAMMER * pgm, unsigned char **msg, return msglen; } -int jtagmkII_recv(PROGRAMMER * pgm, unsigned char **msg) { +int jtagmkII_recv(const PROGRAMMER *pgm, unsigned char **msg) { unsigned short r_seqno; int rv; @@ -671,7 +666,7 @@ int jtagmkII_recv(PROGRAMMER * pgm, unsigned char **msg) { } -int jtagmkII_getsync(PROGRAMMER * pgm, int mode) { +int jtagmkII_getsync(const PROGRAMMER *pgm, int mode) { int tries; #define MAXTRIES 10 unsigned char buf[3], *resp, c = 0xff; @@ -883,8 +878,7 @@ retry: /* * issue the 'chip erase' command to the AVR device */ -static int jtagmkII_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtagmkII_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { int status, len; unsigned char buf[6], *resp, c; @@ -934,8 +928,7 @@ static int jtagmkII_chip_erase(PROGRAMMER * pgm, AVRPART * p) /* * There is no chip erase functionality in debugWire mode. */ -static int jtagmkII_chip_erase_dw(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtagmkII_chip_erase_dw(const PROGRAMMER *pgm, const AVRPART *p) { avrdude_message(MSG_INFO, "%s: Chip erase not supported in debugWire mode\n", progname); @@ -943,8 +936,7 @@ static int jtagmkII_chip_erase_dw(PROGRAMMER * pgm, AVRPART * p) return 0; } -static void jtagmkII_set_devdescr(PROGRAMMER * pgm, AVRPART * p) -{ +static void jtagmkII_set_devdescr(const PROGRAMMER *pgm, const AVRPART *p) { int status; unsigned char *resp, c; LNODEID ln; @@ -959,7 +951,7 @@ static void jtagmkII_set_devdescr(PROGRAMMER * pgm, AVRPART * p) sendbuf.dd.ucSPMCRAddress = p->spmcr; sendbuf.dd.ucRAMPZAddress = p->rampz; sendbuf.dd.ucIDRAddress = p->idr; - u16_to_b2(sendbuf.dd.EECRAddress, p->eecr); + u16_to_b2(sendbuf.dd.EECRAddress, p->eecr? p->eecr: 0x3f); // Unset eecr means 0x3f sendbuf.dd.ucAllowFullPageBitstream = (p->flags & AVRPART_ALLOWFULLPAGEBITSTREAM) != 0; sendbuf.dd.EnablePageProgramming = @@ -1014,8 +1006,7 @@ static void jtagmkII_set_devdescr(PROGRAMMER * pgm, AVRPART * p) } } -static void jtagmkII_set_xmega_params(PROGRAMMER * pgm, AVRPART * p) -{ +static void jtagmkII_set_xmega_params(const PROGRAMMER *pgm, const AVRPART *p) { int status; unsigned char *resp, c; LNODEID ln; @@ -1095,8 +1086,7 @@ static void jtagmkII_set_xmega_params(PROGRAMMER * pgm, AVRPART * p) /* * Reset the target. */ -static int jtagmkII_reset(PROGRAMMER * pgm, unsigned char flags) -{ +static int jtagmkII_reset(const PROGRAMMER *pgm, unsigned char flags) { int status; unsigned char buf[2], *resp, c; @@ -1142,13 +1132,11 @@ static int jtagmkII_reset(PROGRAMMER * pgm, unsigned char flags) return 0; } -static int jtagmkII_program_enable_INFO(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtagmkII_program_enable_INFO(const PROGRAMMER *pgm, const AVRPART *p) { return 0; } -static int jtagmkII_program_enable(PROGRAMMER * pgm) -{ +static int jtagmkII_program_enable(const PROGRAMMER *pgm) { int status; unsigned char buf[1], *resp, c; int use_ext_reset; @@ -1203,8 +1191,7 @@ static int jtagmkII_program_enable(PROGRAMMER * pgm) return 0; } -static int jtagmkII_program_disable(PROGRAMMER * pgm) -{ +static int jtagmkII_program_disable(const PROGRAMMER *pgm) { int status; unsigned char buf[1], *resp, c; @@ -1296,8 +1283,7 @@ static unsigned char jtagmkII_get_baud(long baud) /* * initialize the AVR device and prepare it to accept commands */ -static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtagmkII_initialize(const PROGRAMMER *pgm, const AVRPART *p) { AVRMEM hfuse; unsigned char b; int ok; @@ -1449,8 +1435,7 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p) return 0; } -static void jtagmkII_disable(PROGRAMMER * pgm) -{ +static void jtagmkII_disable(const PROGRAMMER *pgm) { free(PDATA(pgm)->flash_pagecache); PDATA(pgm)->flash_pagecache = NULL; @@ -1465,13 +1450,11 @@ static void jtagmkII_disable(PROGRAMMER * pgm) (void)jtagmkII_program_disable(pgm); } -static void jtagmkII_enable(PROGRAMMER * pgm) -{ +static void jtagmkII_enable(PROGRAMMER * pgm, const AVRPART *p) { return; } -static int jtagmkII_parseextparms(PROGRAMMER * pgm, LISTID extparms) -{ +static int jtagmkII_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) { LNODEID ln; const char *extended_param; int rv = 0; @@ -1509,8 +1492,7 @@ static int jtagmkII_parseextparms(PROGRAMMER * pgm, LISTID extparms) } -static int jtagmkII_open(PROGRAMMER * pgm, char * port) -{ +static int jtagmkII_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; avrdude_message(MSG_NOTICE2, "%s: jtagmkII_open()\n", progname); @@ -1562,8 +1544,7 @@ static int jtagmkII_open(PROGRAMMER * pgm, char * port) return 0; } -static int jtagmkII_open_dw(PROGRAMMER * pgm, char * port) -{ +static int jtagmkII_open_dw(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; avrdude_message(MSG_NOTICE2, "%s: jtagmkII_open_dw()\n", progname); @@ -1615,8 +1596,7 @@ static int jtagmkII_open_dw(PROGRAMMER * pgm, char * port) return 0; } -static int jtagmkII_open_pdi(PROGRAMMER * pgm, char * port) -{ +static int jtagmkII_open_pdi(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; avrdude_message(MSG_NOTICE2, "%s: jtagmkII_open_pdi()\n", progname); @@ -1669,8 +1649,7 @@ static int jtagmkII_open_pdi(PROGRAMMER * pgm, char * port) } -static int jtagmkII_dragon_open(PROGRAMMER * pgm, char * port) -{ +static int jtagmkII_dragon_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; avrdude_message(MSG_NOTICE2, "%s: jtagmkII_dragon_open()\n", progname); @@ -1723,8 +1702,7 @@ static int jtagmkII_dragon_open(PROGRAMMER * pgm, char * port) } -static int jtagmkII_dragon_open_dw(PROGRAMMER * pgm, char * port) -{ +static int jtagmkII_dragon_open_dw(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; avrdude_message(MSG_NOTICE2, "%s: jtagmkII_dragon_open_dw()\n", progname); @@ -1777,8 +1755,7 @@ static int jtagmkII_dragon_open_dw(PROGRAMMER * pgm, char * port) } -static int jtagmkII_dragon_open_pdi(PROGRAMMER * pgm, char * port) -{ +static int jtagmkII_dragon_open_pdi(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; avrdude_message(MSG_NOTICE2, "%s: jtagmkII_dragon_open_pdi()\n", progname); @@ -1899,7 +1876,7 @@ void jtagmkII_close(PROGRAMMER * pgm) pgm->fd.ifd = -1; } -static int jtagmkII_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtagmkII_page_erase(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int addr) { unsigned char cmd[6]; @@ -1995,7 +1972,7 @@ static int jtagmkII_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return 0; } -static int jtagmkII_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtagmkII_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -2131,7 +2108,7 @@ static int jtagmkII_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return n_bytes; } -static int jtagmkII_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtagmkII_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -2233,7 +2210,8 @@ static int jtagmkII_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return n_bytes; } -static int jtagmkII_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, + +static int jtagmkII_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value) { unsigned char cmd[10]; @@ -2412,7 +2390,7 @@ fail: return -1; } -static int jtagmkII_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int jtagmkII_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data) { unsigned char cmd[12]; @@ -2545,8 +2523,7 @@ fail: * As the STK500 expresses it as a period length (and we actualy do * program a period length as well), we rather call it by that name. */ -static int jtagmkII_set_sck_period(PROGRAMMER * pgm, double v) -{ +static int jtagmkII_set_sck_period(const PROGRAMMER *pgm, double v) { unsigned char dur; v = 1 / v; /* convert to frequency */ @@ -2568,7 +2545,7 @@ static int jtagmkII_set_sck_period(PROGRAMMER * pgm, double v) * bytes by now, we always copy out 4 bytes to *value, so the caller * must have allocated sufficient space. */ -int jtagmkII_getparm(PROGRAMMER * pgm, unsigned char parm, +int jtagmkII_getparm(const PROGRAMMER *pgm, unsigned char parm, unsigned char * value) { int status; @@ -2615,7 +2592,7 @@ int jtagmkII_getparm(PROGRAMMER * pgm, unsigned char parm, /* * Write an emulator parameter. */ -static int jtagmkII_setparm(PROGRAMMER * pgm, unsigned char parm, +static int jtagmkII_setparm(const PROGRAMMER *pgm, unsigned char parm, unsigned char * value) { int status; @@ -2681,8 +2658,7 @@ static int jtagmkII_setparm(PROGRAMMER * pgm, unsigned char parm, } -static void jtagmkII_display(PROGRAMMER * pgm, const char * p) -{ +static void jtagmkII_display(const PROGRAMMER *pgm, const char *p) { unsigned char hw[4], fw[4]; if (jtagmkII_getparm(pgm, PAR_HW_VERSION, hw) < 0 || @@ -2702,8 +2678,7 @@ static void jtagmkII_display(PROGRAMMER * pgm, const char * p) } -static void jtagmkII_print_parms1(PROGRAMMER * pgm, const char * p) -{ +static void jtagmkII_print_parms1(const PROGRAMMER *pgm, const char *p) { unsigned char vtarget[4], jtag_clock[4]; char clkbuf[20]; double clk; @@ -2739,13 +2714,11 @@ static void jtagmkII_print_parms1(PROGRAMMER * pgm, const char * p) return; } -static void jtagmkII_print_parms(PROGRAMMER * pgm) -{ +static void jtagmkII_print_parms(const PROGRAMMER *pgm) { jtagmkII_print_parms1(pgm, ""); } -static unsigned char jtagmkII_memtype(PROGRAMMER * pgm, AVRPART * p, unsigned long addr) -{ +static unsigned char jtagmkII_memtype(const PROGRAMMER *pgm, const AVRPART *p, unsigned long addr) { if ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) { if (addr >= PDATA(pgm)->boot_start) return MTYPE_BOOT_FLASH; @@ -2756,8 +2729,7 @@ static unsigned char jtagmkII_memtype(PROGRAMMER * pgm, AVRPART * p, unsigned lo } } -static unsigned int jtagmkII_memaddr(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned long addr) -{ +static unsigned int jtagmkII_memaddr(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr) { /* * Xmega devices handled by V7+ firmware don't want to be told their * m->offset within the write memory command. @@ -2786,7 +2758,7 @@ static unsigned int jtagmkII_memaddr(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, #pragma mark - #endif -static int jtagmkII_avr32_reset(PROGRAMMER * pgm, unsigned char val, +static int jtagmkII_avr32_reset(const PROGRAMMER *pgm, unsigned char val, unsigned char ret1, unsigned char ret2) { int status; @@ -2827,8 +2799,7 @@ static int jtagmkII_avr32_reset(PROGRAMMER * pgm, unsigned char val, } // At init: AVR32_RESET_READ_IR | AVR32_RESET_READ_READ_CHIPINFO -static int jtagmkII_reset32(PROGRAMMER * pgm, unsigned short flags) -{ +static int jtagmkII_reset32(const PROGRAMMER *pgm, unsigned short flags) { int status, j, lineno; unsigned char *resp, buf[3]; unsigned long val=0; @@ -3017,8 +2988,7 @@ static int jtagmkII_reset32(PROGRAMMER * pgm, unsigned short flags) return -1; } -static int jtagmkII_smc_init32(PROGRAMMER * pgm) -{ +static int jtagmkII_smc_init32(const PROGRAMMER *pgm) { int status, lineno; unsigned long val; @@ -3120,8 +3090,7 @@ static int jtagmkII_smc_init32(PROGRAMMER * pgm) /* * initialize the AVR device and prepare it to accept commands */ -static int jtagmkII_initialize32(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtagmkII_initialize32(const PROGRAMMER *pgm, const AVRPART *p) { int status, j; unsigned char buf[6], *resp; @@ -3197,8 +3166,7 @@ static int jtagmkII_initialize32(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int jtagmkII_chip_erase32(PROGRAMMER * pgm, AVRPART * p) -{ +static int jtagmkII_chip_erase32(const PROGRAMMER *pgm, const AVRPART *p) { int status=0, loops; unsigned char *resp, buf[3], x, ret[4], *retP; unsigned long val=0; @@ -3258,7 +3226,7 @@ static int jtagmkII_chip_erase32(PROGRAMMER * pgm, AVRPART * p) return -1; } -static unsigned long jtagmkII_read_SABaddr(PROGRAMMER * pgm, unsigned long addr, +static unsigned long jtagmkII_read_SABaddr(const PROGRAMMER *pgm, unsigned long addr, unsigned int prefix) { unsigned char buf[6], *resp; @@ -3320,7 +3288,7 @@ static unsigned long jtagmkII_read_SABaddr(PROGRAMMER * pgm, unsigned long addr, return val; } -static int jtagmkII_write_SABaddr(PROGRAMMER * pgm, unsigned long addr, +static int jtagmkII_write_SABaddr(const PROGRAMMER *pgm, unsigned long addr, unsigned int prefix, unsigned long val) { unsigned char buf[10], *resp; @@ -3355,8 +3323,7 @@ static int jtagmkII_write_SABaddr(PROGRAMMER * pgm, unsigned long addr, return 0; } -static int jtagmkII_open32(PROGRAMMER * pgm, char * port) -{ +static int jtagmkII_open32(PROGRAMMER *pgm, const char *port) { int status; unsigned char buf[6], *resp; union pinfo pinfo; @@ -3492,7 +3459,7 @@ static void jtagmkII_close32(PROGRAMMER * pgm) goto ret; } -static int jtagmkII_paged_load32(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtagmkII_paged_load32(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -3509,23 +3476,16 @@ static int jtagmkII_paged_load32(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, serial_recv_timeout = 256; - if(!(p->flags & AVRPART_WRITE)) { + if(!(PDATA(pgm)->flags32 & FLAGS32_WRITE)) { status = jtagmkII_reset32(pgm, AVR32_RESET_READ); if(status != 0) {lineno = __LINE__; goto eRR;} } // Init SMC and set clocks - if(!(p->flags & AVRPART_INIT_SMC)) { + if(!(PDATA(pgm)->flags32 & FLAGS32_INIT_SMC)) { status = jtagmkII_smc_init32(pgm); if(status != 0) {lineno = __LINE__; goto eRR;} // PLL 0 - p->flags |= AVRPART_INIT_SMC; - } - - // Init SMC and set clocks - if(!(p->flags & AVRPART_INIT_SMC)) { - status = jtagmkII_smc_init32(pgm); - if(status != 0) {lineno = __LINE__; goto eRR;} // PLL 0 - p->flags |= AVRPART_INIT_SMC; + PDATA(pgm)->flags32 |= FLAGS32_INIT_SMC; } //avrdude_message(MSG_INFO, "\n pageSize=%d bytes=%d pages=%d m->offset=0x%x pgm->page_size %d\n", @@ -3580,7 +3540,7 @@ static int jtagmkII_paged_load32(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return -1; } -static int jtagmkII_paged_write32(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int jtagmkII_paged_write32(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -3598,7 +3558,7 @@ static int jtagmkII_paged_write32(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, status = jtagmkII_reset32(pgm, AVR32_RESET_WRITE); if(status != 0) {lineno = __LINE__; goto eRR;} - p->flags |= AVRPART_WRITE; + PDATA(pgm)->flags32 |= FLAGS32_WRITE; pages = (n_bytes - addr - 1)/page_size + 1; sPageNum = addr/page_size; @@ -3612,10 +3572,10 @@ static int jtagmkII_paged_write32(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } // Init SMC and set clocks - if(!(p->flags & AVRPART_INIT_SMC)) { + if(!(p->flags & FLAGS32_INIT_SMC)) { status = jtagmkII_smc_init32(pgm); if(status != 0) {lineno = __LINE__; goto eRR;} // PLL 0 - p->flags |= AVRPART_INIT_SMC; + PDATA(pgm)->flags32 |= FLAGS32_INIT_SMC; } // First unlock the pages @@ -3694,8 +3654,7 @@ static int jtagmkII_paged_write32(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } -static int jtagmkII_flash_lock32(PROGRAMMER * pgm, unsigned char lock, unsigned int page) -{ +static int jtagmkII_flash_lock32(const PROGRAMMER *pgm, unsigned char lock, unsigned int page) { int status, lineno, i; unsigned long val, cmd=0; @@ -3721,8 +3680,7 @@ static int jtagmkII_flash_lock32(PROGRAMMER * pgm, unsigned char lock, unsigned return -1; } -static int jtagmkII_flash_erase32(PROGRAMMER * pgm, unsigned int page) -{ +static int jtagmkII_flash_erase32(const PROGRAMMER *pgm, unsigned int page) { int status, lineno, i; unsigned long val=0, cmd=0, err=0; @@ -3761,8 +3719,7 @@ static int jtagmkII_flash_erase32(PROGRAMMER * pgm, unsigned int page) return -1; } -static int jtagmkII_flash_write_page32(PROGRAMMER * pgm, unsigned int page) -{ +static int jtagmkII_flash_write_page32(const PROGRAMMER *pgm, unsigned int page) { int status, lineno, i; unsigned long val=0, cmd, err; @@ -3791,8 +3748,7 @@ static int jtagmkII_flash_write_page32(PROGRAMMER * pgm, unsigned int page) return -1; } -static int jtagmkII_flash_clear_pagebuffer32(PROGRAMMER * pgm) -{ +static int jtagmkII_flash_clear_pagebuffer32(const PROGRAMMER *pgm) { int status, lineno, i; unsigned long val=0, cmd, err; @@ -3826,8 +3782,7 @@ static int jtagmkII_flash_clear_pagebuffer32(PROGRAMMER * pgm) const char jtagmkII_desc[] = "Atmel JTAG ICE mkII"; -void jtagmkII_initpgm(PROGRAMMER * pgm) -{ +void jtagmkII_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "JTAGMKII"); /* @@ -3861,8 +3816,7 @@ void jtagmkII_initpgm(PROGRAMMER * pgm) const char jtagmkII_dw_desc[] = "Atmel JTAG ICE mkII in debugWire mode"; -void jtagmkII_dw_initpgm(PROGRAMMER * pgm) -{ +void jtagmkII_dw_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "JTAGMKII_DW"); /* @@ -3893,8 +3847,7 @@ void jtagmkII_dw_initpgm(PROGRAMMER * pgm) const char jtagmkII_pdi_desc[] = "Atmel JTAG ICE mkII in PDI mode"; -void jtagmkII_pdi_initpgm(PROGRAMMER * pgm) -{ +void jtagmkII_pdi_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "JTAGMKII_PDI"); /* @@ -3926,8 +3879,7 @@ void jtagmkII_pdi_initpgm(PROGRAMMER * pgm) const char jtagmkII_updi_desc[] = "Atmel JTAG ICE mkII in UPDI mode"; -void jtagmkII_updi_initpgm(PROGRAMMER * pgm) -{ +void jtagmkII_updi_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "JTAGMKII_UPDI"); /* @@ -3959,8 +3911,7 @@ void jtagmkII_updi_initpgm(PROGRAMMER * pgm) const char jtagmkII_dragon_desc[] = "Atmel AVR Dragon in JTAG mode"; -void jtagmkII_dragon_initpgm(PROGRAMMER * pgm) -{ +void jtagmkII_dragon_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "DRAGON_JTAG"); /* @@ -3994,8 +3945,7 @@ void jtagmkII_dragon_initpgm(PROGRAMMER * pgm) const char jtagmkII_dragon_dw_desc[] = "Atmel AVR Dragon in debugWire mode"; -void jtagmkII_dragon_dw_initpgm(PROGRAMMER * pgm) -{ +void jtagmkII_dragon_dw_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "DRAGON_DW"); /* @@ -4026,8 +3976,7 @@ void jtagmkII_dragon_dw_initpgm(PROGRAMMER * pgm) const char jtagmkII_avr32_desc[] = "Atmel JTAG ICE mkII in AVR32 mode"; -void jtagmkII_avr32_initpgm(PROGRAMMER * pgm) -{ +void jtagmkII_avr32_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "JTAGMKII_AVR32"); /* @@ -4060,8 +4009,7 @@ void jtagmkII_avr32_initpgm(PROGRAMMER * pgm) const char jtagmkII_dragon_pdi_desc[] = "Atmel AVR Dragon in PDI mode"; -void jtagmkII_dragon_pdi_initpgm(PROGRAMMER * pgm) -{ +void jtagmkII_dragon_pdi_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "DRAGON_PDI"); /* diff --git a/src/jtagmkII.h b/src/jtagmkII.h index 34004d6d..f420edf9 100644 --- a/src/jtagmkII.h +++ b/src/jtagmkII.h @@ -25,11 +25,11 @@ extern "C" { #endif -int jtagmkII_send(PROGRAMMER * pgm, unsigned char * data, size_t len); -int jtagmkII_recv(PROGRAMMER * pgm, unsigned char **msg); +int jtagmkII_send(const PROGRAMMER *pgm, unsigned char *data, size_t len); +int jtagmkII_recv(const PROGRAMMER *pgm, unsigned char **msg); void jtagmkII_close(PROGRAMMER * pgm); -int jtagmkII_getsync(PROGRAMMER * pgm, int mode); -int jtagmkII_getparm(PROGRAMMER * pgm, unsigned char parm, +int jtagmkII_getsync(const PROGRAMMER *pgm, int mode); +int jtagmkII_getparm(const PROGRAMMER *pgm, unsigned char parm, unsigned char * value); extern const char jtagmkII_desc[]; @@ -40,14 +40,14 @@ extern const char jtagmkII_updi_desc[]; extern const char jtagmkII_dragon_desc[]; extern const char jtagmkII_dragon_dw_desc[]; extern const char jtagmkII_dragon_pdi_desc[]; -void jtagmkII_initpgm (PROGRAMMER * pgm); -void jtagmkII_avr32_initpgm (PROGRAMMER * pgm); -void jtagmkII_dw_initpgm (PROGRAMMER * pgm); -void jtagmkII_pdi_initpgm (PROGRAMMER * pgm); -void jtagmkII_updi_initpgm (PROGRAMMER * pgm); -void jtagmkII_dragon_initpgm (PROGRAMMER * pgm); -void jtagmkII_dragon_dw_initpgm (PROGRAMMER * pgm); -void jtagmkII_dragon_pdi_initpgm (PROGRAMMER * pgm); +void jtagmkII_initpgm(PROGRAMMER *pgm); +void jtagmkII_avr32_initpgm(PROGRAMMER *pgm); +void jtagmkII_dw_initpgm(PROGRAMMER *pgm); +void jtagmkII_pdi_initpgm(PROGRAMMER *pgm); +void jtagmkII_updi_initpgm(PROGRAMMER *pgm); +void jtagmkII_dragon_initpgm(PROGRAMMER *pgm); +void jtagmkII_dragon_dw_initpgm(PROGRAMMER *pgm); +void jtagmkII_dragon_pdi_initpgm(PROGRAMMER *pgm); /* * These functions are referenced from stk500v2.c for JTAG ICE mkII diff --git a/src/libavrdude.h b/src/libavrdude.h index eef7a67c..627bb89b 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -193,8 +193,6 @@ typedef struct opcode { #define AVRPART_HAS_DW 0x0040 /* part has a debugWire i/f */ #define AVRPART_HAS_PDI 0x0080 /* part has PDI i/f rather than ISP (ATxmega) */ #define AVRPART_AVR32 0x0100 /* part is in AVR32 family */ -#define AVRPART_INIT_SMC 0x0200 /* part will undergo chip erase */ -#define AVRPART_WRITE 0x0400 /* at least one write operation specified */ #define AVRPART_HAS_TPI 0x0800 /* part has TPI i/f rather than ISP (ATtiny4/5/9/10) */ #define AVRPART_IS_AT90S1200 0x1000 /* part is an AT90S1200 (needs special treatment) */ #define AVRPART_HAS_UPDI 0x2000 /* part has UPDI i/f (AVR8X) */ @@ -614,18 +612,17 @@ union pinfo }; -struct serial_device -{ +struct serial_device { // open should return -1 on error, other values on success - int (*open)(char * port, union pinfo pinfo, union filedescriptor *fd); - int (*setparams)(union filedescriptor *fd, long baud, unsigned long cflags); + int (*open)(const char *port, union pinfo pinfo, union filedescriptor *fd); + int (*setparams)(const union filedescriptor *fd, long baud, unsigned long cflags); void (*close)(union filedescriptor *fd); - int (*send)(union filedescriptor *fd, const unsigned char * buf, size_t buflen); - int (*recv)(union filedescriptor *fd, unsigned char * buf, size_t buflen); - int (*drain)(union filedescriptor *fd, int display); + int (*send)(const union filedescriptor *fd, const unsigned char * buf, size_t buflen); + int (*recv)(const union filedescriptor *fd, unsigned char * buf, size_t buflen); + int (*drain)(const union filedescriptor *fd, int display); - int (*set_dtr_rts)(union filedescriptor *fd, int is_on); + int (*set_dtr_rts)(const union filedescriptor *fd, int is_on); int flags; #define SERDEV_FL_NONE 0x0000 /* no flags */ @@ -684,8 +681,8 @@ typedef enum { typedef struct programmer_t { LISTID id; const char *desc; - void (*initpgm)(struct programmer_t *pgm); - LISTID comments; // Used by developer options -c*/[ASsr...] + void (*initpgm)(struct programmer_t *pgm); // Sets up the AVRDUDE programmer + LISTID comments; // Used by developer options -c*/[ASsr...] const char *parent_id; // Used by developer options struct pindef_t pin[N_PINS]; conntype_t conntype; @@ -712,60 +709,60 @@ typedef struct programmer_t { int page_size; // Page size if the programmer supports paged write/load double bitclock; // JTAG ICE clock period in microseconds - int (*rdy_led) (struct programmer_t * pgm, int value); - int (*err_led) (struct programmer_t * pgm, int value); - int (*pgm_led) (struct programmer_t * pgm, int value); - int (*vfy_led) (struct programmer_t * pgm, int value); - int (*initialize) (struct programmer_t * pgm, AVRPART * p); - void (*display) (struct programmer_t * pgm, const char * p); - void (*enable) (struct programmer_t * pgm); - void (*disable) (struct programmer_t * pgm); - void (*powerup) (struct programmer_t * pgm); - void (*powerdown) (struct programmer_t * pgm); - int (*program_enable) (struct programmer_t * pgm, AVRPART * p); - int (*chip_erase) (struct programmer_t * pgm, AVRPART * p); - int (*unlock) (struct programmer_t * pgm, AVRPART * p); - int (*cmd) (struct programmer_t * pgm, const unsigned char *cmd, + int (*rdy_led) (const struct programmer_t *pgm, int value); + int (*err_led) (const struct programmer_t *pgm, int value); + int (*pgm_led) (const struct programmer_t *pgm, int value); + int (*vfy_led) (const struct programmer_t *pgm, int value); + int (*initialize) (const struct programmer_t *pgm, const AVRPART *p); // Sets up the physical programmer + void (*display) (const struct programmer_t *pgm, const char *p); + void (*enable) (struct programmer_t *pgm, const AVRPART *p); + void (*disable) (const struct programmer_t *pgm); + void (*powerup) (const struct programmer_t *pgm); + void (*powerdown) (const struct programmer_t *pgm); + int (*program_enable) (const struct programmer_t *pgm, const AVRPART *p); + int (*chip_erase) (const struct programmer_t *pgm, const AVRPART *p); + int (*unlock) (const struct programmer_t *pgm, const AVRPART *p); + int (*cmd) (const struct programmer_t *pgm, const unsigned char *cmd, unsigned char *res); - int (*cmd_tpi) (struct programmer_t * pgm, const unsigned char *cmd, + int (*cmd_tpi) (const struct programmer_t *pgm, const unsigned char *cmd, int cmd_len, unsigned char res[], int res_len); - int (*spi) (struct programmer_t * pgm, const unsigned char *cmd, + int (*spi) (const struct programmer_t *pgm, const unsigned char *cmd, unsigned char *res, int count); - int (*open) (struct programmer_t * pgm, char * port); - void (*close) (struct programmer_t * pgm); - int (*paged_write) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m, + int (*open) (struct programmer_t *pgm, const char *port); + void (*close) (struct programmer_t *pgm); + int (*paged_write) (const struct programmer_t *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int baseaddr, unsigned int n_bytes); - int (*paged_load) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m, + int (*paged_load) (const struct programmer_t *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int baseaddr, unsigned int n_bytes); - int (*page_erase) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m, + int (*page_erase) (const struct programmer_t *pgm, const AVRPART *p, const AVRMEM *m, unsigned int baseaddr); - void (*write_setup) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m); - int (*write_byte) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m, + void (*write_setup) (const struct programmer_t *pgm, const AVRPART *p, const AVRMEM *m); + int (*write_byte) (const struct programmer_t *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr, unsigned char value); - int (*read_byte) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m, - unsigned long addr, unsigned char * value); - int (*read_sig_bytes) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m); - int (*read_sib) (struct programmer_t * pgm, AVRPART * p, char *sib); - void (*print_parms) (struct programmer_t * pgm); - int (*set_vtarget) (struct programmer_t * pgm, double v); - int (*set_varef) (struct programmer_t * pgm, unsigned int chan, double v); - int (*set_fosc) (struct programmer_t * pgm, double v); - int (*set_sck_period) (struct programmer_t * pgm, double v); - int (*setpin) (struct programmer_t * pgm, int pinfunc, int value); - int (*getpin) (struct programmer_t * pgm, int pinfunc); - int (*highpulsepin) (struct programmer_t * pgm, int pinfunc); - int (*parseexitspecs) (struct programmer_t * pgm, char *s); - int (*perform_osccal) (struct programmer_t * pgm); - int (*parseextparams) (struct programmer_t * pgm, LISTID xparams); - void (*setup) (struct programmer_t * pgm); - void (*teardown) (struct programmer_t * pgm); + int (*read_byte) (const struct programmer_t *pgm, const AVRPART *p, const AVRMEM *m, + unsigned long addr, unsigned char *value); + int (*read_sig_bytes) (const struct programmer_t *pgm, const AVRPART *p, const AVRMEM *m); + int (*read_sib) (const struct programmer_t *pgm, const AVRPART *p, char *sib); + void (*print_parms) (const struct programmer_t *pgm); + int (*set_vtarget) (const struct programmer_t *pgm, double v); + int (*set_varef) (const struct programmer_t *pgm, unsigned int chan, double v); + int (*set_fosc) (const struct programmer_t *pgm, double v); + int (*set_sck_period) (const struct programmer_t *pgm, double v); + int (*setpin) (const struct programmer_t *pgm, int pinfunc, int value); + int (*getpin) (const struct programmer_t *pgm, int pinfunc); + int (*highpulsepin) (const struct programmer_t *pgm, int pinfunc); + int (*parseexitspecs) (struct programmer_t *pgm, const char *s); + int (*perform_osccal) (const struct programmer_t *pgm); + int (*parseextparams) (const struct programmer_t *pgm, const LISTID xparams); + void (*setup) (struct programmer_t *pgm); + void (*teardown) (struct programmer_t *pgm); const char *config_file; // Config file where defined int lineno; // Config file line number void *cookie; // For private use by the programmer - char flag; // For private use of the programmer + char flag; // For use by pgm->initpgm() } PROGRAMMER; #ifdef __cplusplus @@ -812,50 +809,50 @@ extern FP_UpdateProgress update_progress; extern "C" { #endif -int avr_tpi_poll_nvmbsy(PROGRAMMER *pgm); -int avr_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p); -int avr_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p, unsigned char guard_time); -int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +int avr_tpi_poll_nvmbsy(const PROGRAMMER *pgm); +int avr_tpi_chip_erase(const PROGRAMMER *pgm, const AVRPART *p); +int avr_tpi_program_enable(const PROGRAMMER *pgm, const AVRPART *p, unsigned char guard_time); +int avr_read_byte_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value); -int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, AVRPART * v); +int avr_read(const PROGRAMMER * pgm, const AVRPART *p, const char *memtype, AVRPART *v); -int avr_write_page(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +int avr_write_page(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr); -int avr_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +int avr_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data); -int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +int avr_write_byte_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data); -int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size, +int avr_write(const PROGRAMMER *pgm, const AVRPART *p, const char *memtype, int size, int auto_erase); -int avr_signature(PROGRAMMER * pgm, AVRPART * p); +int avr_signature(const PROGRAMMER *pgm, const AVRPART *p); -int avr_verify(AVRPART * p, AVRPART * v, char * memtype, int size); +int avr_verify(const AVRPART * p, const AVRPART * v, const char * memtype, int size); -int avr_get_cycle_count(PROGRAMMER * pgm, AVRPART * p, int * cycles); +int avr_get_cycle_count(const PROGRAMMER *pgm, const AVRPART *p, int *cycles); -int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles); +int avr_put_cycle_count(const PROGRAMMER *pgm, const AVRPART *p, int cycles); void avr_add_mem_order(const char *str); -int avr_mem_is_flash_type(AVRMEM *mem); +int avr_mem_is_flash_type(const AVRMEM *mem); -int avr_mem_is_eeprom_type(AVRMEM *mem); +int avr_mem_is_eeprom_type(const AVRMEM *mem); int avr_mem_is_known(const char *str); int avr_mem_might_be_known(const char *str); #define disable_trailing_ff_removal() avr_mem_hiaddr(NULL) -int avr_mem_hiaddr(AVRMEM * mem); +int avr_mem_hiaddr(const AVRMEM * mem); -int avr_chip_erase(PROGRAMMER * pgm, AVRPART * p); +int avr_chip_erase(const PROGRAMMER *pgm, const AVRPART *p); -int avr_unlock(PROGRAMMER * pgm, AVRPART * p); +int avr_unlock(const PROGRAMMER *pgm, const AVRPART *p); void report_progress (int completed, int total, char *hdr); @@ -983,7 +980,7 @@ int update_dryrun(struct avrpart *p, UPDATE *upd); typedef struct programmer_type_t { const char * const id; - void (*initpgm)(struct programmer_t * pgm); + void (*initpgm)(struct programmer_t *pgm); const char * const desc; } PROGRAMMER_TYPE; diff --git a/src/linuxgpio.c b/src/linuxgpio.c index 86fefd76..639597c3 100644 --- a/src/linuxgpio.c +++ b/src/linuxgpio.c @@ -144,8 +144,7 @@ static int linuxgpio_dir_in(unsigned int gpio) static int linuxgpio_fds[N_GPIO] ; -static int linuxgpio_setpin(PROGRAMMER * pgm, int pinfunc, int value) -{ +static int linuxgpio_setpin(const PROGRAMMER *pgm, int pinfunc, int value) { int r; int pin = pgm->pinno[pinfunc]; // TODO @@ -171,8 +170,7 @@ static int linuxgpio_setpin(PROGRAMMER * pgm, int pinfunc, int value) return 0; } -static int linuxgpio_getpin(PROGRAMMER * pgm, int pinfunc) -{ +static int linuxgpio_getpin(const PROGRAMMER *pgm, int pinfunc) { unsigned char invert=0; char c; int pin = pgm->pinno[pinfunc]; // TODO @@ -198,11 +196,9 @@ static int linuxgpio_getpin(PROGRAMMER * pgm, int pinfunc) return 1-invert; else return -1; - } -static int linuxgpio_highpulsepin(PROGRAMMER * pgm, int pinfunc) -{ +static int linuxgpio_highpulsepin(const PROGRAMMER *pgm, int pinfunc) { int pin = pgm->pinno[pinfunc]; // TODO if ( linuxgpio_fds[pin & PIN_MASK] < 0 ) @@ -216,34 +212,28 @@ static int linuxgpio_highpulsepin(PROGRAMMER * pgm, int pinfunc) -static void linuxgpio_display(PROGRAMMER *pgm, const char *p) -{ +static void linuxgpio_display(const PROGRAMMER *pgm, const char *p) { avrdude_message(MSG_INFO, "%sPin assignment : /sys/class/gpio/gpio{n}\n",p); pgm_display_generic_mask(pgm, p, SHOW_AVR_PINS); } -static void linuxgpio_enable(PROGRAMMER *pgm) -{ +static void linuxgpio_enable(PROGRAMMER *pgm, const AVRPART *p) { /* nothing */ } -static void linuxgpio_disable(PROGRAMMER *pgm) -{ +static void linuxgpio_disable(const PROGRAMMER *pgm) { /* nothing */ } -static void linuxgpio_powerup(PROGRAMMER *pgm) -{ +static void linuxgpio_powerup(const PROGRAMMER *pgm) { /* nothing */ } -static void linuxgpio_powerdown(PROGRAMMER *pgm) -{ +static void linuxgpio_powerdown(const PROGRAMMER *pgm) { /* nothing */ } -static int linuxgpio_open(PROGRAMMER *pgm, char *port) -{ +static int linuxgpio_open(PROGRAMMER *pgm, const char *port) { int r, i, pin; if (bitbang_check_prerequisites(pgm) < 0) @@ -311,8 +301,7 @@ static void linuxgpio_close(PROGRAMMER *pgm) } } -void linuxgpio_initpgm(PROGRAMMER *pgm) -{ +void linuxgpio_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "linuxgpio"); pgm_fill_old_pins(pgm); // TODO to be removed if old pin data no longer needed @@ -344,8 +333,7 @@ const char linuxgpio_desc[] = "GPIO bitbanging using the Linux sysfs interface"; #else /* !HAVE_LINUXGPIO */ -void linuxgpio_initpgm(PROGRAMMER * pgm) -{ +void linuxgpio_initpgm(PROGRAMMER *pgm) { avrdude_message(MSG_INFO, "%s: Linux sysfs GPIO support not available in this configuration\n", progname); } diff --git a/src/linuxgpio.h b/src/linuxgpio.h index dc477982..5c07d7c4 100644 --- a/src/linuxgpio.h +++ b/src/linuxgpio.h @@ -27,7 +27,7 @@ extern "C" { #endif extern const char linuxgpio_desc[]; -void linuxgpio_initpgm (PROGRAMMER * pgm); +void linuxgpio_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/linuxspi.c b/src/linuxspi.c index df497057..df57c7e6 100644 --- a/src/linuxspi.c +++ b/src/linuxspi.c @@ -68,8 +68,7 @@ static int fd_spidev, fd_gpiochip, fd_linehandle; * @brief Sends/receives a message in full duplex mode * @return -1 on failure, otherwise number of bytes sent/received */ -static int linuxspi_spi_duplex(PROGRAMMER *pgm, const unsigned char *tx, unsigned char *rx, int len) -{ +static int linuxspi_spi_duplex(const PROGRAMMER *pgm, const unsigned char *tx, unsigned char *rx, int len) { struct spi_ioc_transfer tr; int ret; @@ -89,16 +88,13 @@ static int linuxspi_spi_duplex(PROGRAMMER *pgm, const unsigned char *tx, unsigne return (ret == -1) ? -1 : 0; } -static void linuxspi_setup(PROGRAMMER *pgm) -{ +static void linuxspi_setup(PROGRAMMER *pgm) { } -static void linuxspi_teardown(PROGRAMMER* pgm) -{ +static void linuxspi_teardown(PROGRAMMER* pgm) { } -static int linuxspi_reset_mcu(PROGRAMMER *pgm, bool active) -{ +static int linuxspi_reset_mcu(const PROGRAMMER *pgm, bool active) { struct gpiohandle_data data; int ret; @@ -128,13 +124,13 @@ static int linuxspi_reset_mcu(PROGRAMMER *pgm, bool active) return 0; } -static int linuxspi_open(PROGRAMMER *pgm, char *port) -{ +static int linuxspi_open(PROGRAMMER *pgm, const char *pt) { const char *port_error = "%s: error: Unknown port specification. " "Please use the format /dev/spidev:/dev/gpiochip[:resetno]\n"; char port_default[] = "/dev/spidev0.0:/dev/gpiochip0"; char *spidev, *gpiochip, *reset_pin; + char *port = cfg_strdup("linuxspi_open()", pt); struct gpiohandle_request req; int ret; @@ -243,8 +239,7 @@ close_spidev: return ret; } -static void linuxspi_close(PROGRAMMER *pgm) -{ +static void linuxspi_close(PROGRAMMER *pgm) { switch (pgm->exit_reset) { case EXIT_RESET_ENABLED: linuxspi_reset_mcu(pgm, true); @@ -263,20 +258,16 @@ static void linuxspi_close(PROGRAMMER *pgm) close(fd_gpiochip); } -static void linuxspi_disable(PROGRAMMER* pgm) -{ +static void linuxspi_disable(const PROGRAMMER* pgm) { } -static void linuxspi_enable(PROGRAMMER* pgm) -{ +static void linuxspi_enable(PROGRAMMER *pgm, const AVRPART *p) { } -static void linuxspi_display(PROGRAMMER* pgm, const char* p) -{ +static void linuxspi_display(const PROGRAMMER* pgm, const char* p) { } -static int linuxspi_initialize(PROGRAMMER *pgm, AVRPART *p) -{ +static int linuxspi_initialize(const PROGRAMMER *pgm, const AVRPART *p) { int tries, ret; if (p->flags & AVRPART_HAS_TPI) { @@ -300,13 +291,12 @@ static int linuxspi_initialize(PROGRAMMER *pgm, AVRPART *p) return ret; } -static int linuxspi_cmd(PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) +static int linuxspi_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { return linuxspi_spi_duplex(pgm, cmd, res, 4); } -static int linuxspi_program_enable(PROGRAMMER *pgm, AVRPART *p) -{ +static int linuxspi_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4], res[4]; if (!p->op[AVR_OP_PGM_ENABLE]) { @@ -349,8 +339,7 @@ static int linuxspi_program_enable(PROGRAMMER *pgm, AVRPART *p) return 0; } -static int linuxspi_chip_erase(PROGRAMMER *pgm, AVRPART *p) -{ +static int linuxspi_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4], res[4]; if (!p->op[AVR_OP_CHIP_ERASE]) { @@ -367,12 +356,12 @@ static int linuxspi_chip_erase(PROGRAMMER *pgm, AVRPART *p) return 0; } -static int linuxspi_parseexitspecs(PROGRAMMER *pgm, char *s) -{ - char *cp; +static int linuxspi_parseexitspecs(PROGRAMMER *pgm, const char *sp) { + char *cp, *s, *str = cfg_strdup("linuxspi_parseextitspecs()", sp); + s = str; while ((cp = strtok(s, ","))) { - s = 0; + s = NULL; if (!strcmp(cp, "reset")) { pgm->exit_reset = EXIT_RESET_ENABLED; continue; @@ -381,14 +370,15 @@ static int linuxspi_parseexitspecs(PROGRAMMER *pgm, char *s) pgm->exit_reset = EXIT_RESET_DISABLED; continue; } + free(str); return -1; } + free(str); return 0; } -void linuxspi_initpgm(PROGRAMMER *pgm) -{ +void linuxspi_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, LINUXSPI); pgm_fill_old_pins(pgm); // TODO to be removed if old pin data no longer needed @@ -416,10 +406,8 @@ const char linuxspi_desc[] = "SPI using Linux spidev driver"; #else /* !HAVE_LINUXSPI */ -void linuxspi_initpgm(PROGRAMMER * pgm) -{ - avrdude_message(MSG_INFO, "%s: Linux SPI driver not available in this configuration\n", - progname); +void linuxspi_initpgm(PROGRAMMER *pgm) { + avrdude_message(MSG_INFO, "%s: Linux SPI driver not available in this configuration\n", progname); } const char linuxspi_desc[] = "SPI using Linux spidev driver (not available)"; diff --git a/src/linuxspi.h b/src/linuxspi.h index 06c6dd20..21c65d46 100644 --- a/src/linuxspi.h +++ b/src/linuxspi.h @@ -25,7 +25,7 @@ extern "C" { #endif extern const char linuxspi_desc[]; -void linuxspi_initpgm (PROGRAMMER * pgm); +void linuxspi_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/main.c b/src/main.c index 54f6e633..51dbc879 100644 --- a/src/main.c +++ b/src/main.c @@ -279,7 +279,7 @@ int main(int argc, char * argv []) int calibrate; /* 1=calibrate RC oscillator, 0=don't */ char * port; /* device port (/dev/xxx) */ int terminal; /* 1=enter terminal mode, 0=don't */ - char * exitspecs; /* exit specs string from command line */ + const char *exitspecs; /* exit specs string from command line */ char * programmer; /* programmer id */ char * partdesc; /* part id */ char sys_config[PATH_MAX]; /* system wide config file */ @@ -869,12 +869,13 @@ int main(int argc, char * argv []) case CONNTYPE_SPI: #ifdef HAVE_LINUXSPI - port = *default_spi? default_spi: "unknown"; + port = cfg_strdup("main()", *default_spi? default_spi: "unknown"); #endif break; } } + if (partdesc == NULL) { avrdude_message(MSG_INFO, "%s: No AVR part has been specified, use \"-p Part\"\n\n", progname); @@ -884,7 +885,6 @@ int main(int argc, char * argv []) exit(1); } - p = locate_part(part_list, partdesc); if (p == NULL) { avrdude_message(MSG_INFO, "%s: AVR Part \"%s\" not found.\n\n", @@ -895,7 +895,6 @@ int main(int argc, char * argv []) exit(1); } - if (exitspecs != NULL) { if (pgm->parseexitspecs == NULL) { avrdude_message(MSG_INFO, "%s: WARNING: -E option not supported by this programmer type\n", @@ -908,10 +907,9 @@ int main(int argc, char * argv []) } } - if (avr_initmem(p) != 0) - { + if (avr_initmem(p) != 0) { avrdude_message(MSG_INFO, "\n%s: failed to initialize memories\n", - progname); + progname); exit(1); } @@ -1024,7 +1022,7 @@ int main(int argc, char * argv []) /* * enable the programmer */ - pgm->enable(pgm); + pgm->enable(pgm, p); /* * turn off all the status leds diff --git a/src/micronucleus.c b/src/micronucleus.c index c3dd007d..029edab9 100644 --- a/src/micronucleus.c +++ b/src/micronucleus.c @@ -567,8 +567,7 @@ static void micronucleus_teardown(PROGRAMMER* pgm) free(pgm->cookie); } -static int micronucleus_initialize(PROGRAMMER* pgm, AVRPART* p) -{ +static int micronucleus_initialize(const PROGRAMMER *pgm, const AVRPART *p) { avrdude_message(MSG_DEBUG, "%s: micronucleus_initialize()\n", progname); pdata_t* pdata = PDATA(pgm); @@ -582,18 +581,15 @@ static int micronucleus_initialize(PROGRAMMER* pgm, AVRPART* p) return 0; } -static void micronucleus_display(PROGRAMMER* pgm, const char* prefix) -{ +static void micronucleus_display(const PROGRAMMER *pgm, const char *prefix) { avrdude_message(MSG_DEBUG, "%s: micronucleus_display()\n", progname); } -static void micronucleus_powerup(PROGRAMMER* pgm) -{ +static void micronucleus_powerup(const PROGRAMMER *pgm) { avrdude_message(MSG_DEBUG, "%s: micronucleus_powerup()\n", progname); } -static void micronucleus_powerdown(PROGRAMMER* pgm) -{ +static void micronucleus_powerdown(const PROGRAMMER *pgm) { avrdude_message(MSG_DEBUG, "%s: micronucleus_powerdown()\n", progname); pdata_t* pdata = PDATA(pgm); @@ -618,24 +614,20 @@ static void micronucleus_powerdown(PROGRAMMER* pgm) } } -static void micronucleus_enable(PROGRAMMER* pgm) -{ +static void micronucleus_enable(PROGRAMMER *pgm, const AVRPART *p) { avrdude_message(MSG_DEBUG, "%s: micronucleus_enable()\n", progname); } -static void micronucleus_disable(PROGRAMMER* pgm) -{ +static void micronucleus_disable(const PROGRAMMER *pgm) { avrdude_message(MSG_DEBUG, "%s: micronucleus_disable()\n", progname); } -static int micronucleus_program_enable(PROGRAMMER* pgm, AVRPART* p) -{ +static int micronucleus_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { avrdude_message(MSG_DEBUG, "%s: micronucleus_program_enable()\n", progname); return 0; } -static int micronucleus_read_sig_bytes(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem) -{ +static int micronucleus_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem) { avrdude_message(MSG_DEBUG, "%s: micronucleus_read_sig_bytes()\n", progname); if (mem->size < 3) @@ -651,20 +643,18 @@ static int micronucleus_read_sig_bytes(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem) return 0; } -static int micronucleus_chip_erase(PROGRAMMER* pgm, AVRPART* p) -{ +static int micronucleus_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { avrdude_message(MSG_DEBUG, "%s: micronucleus_chip_erase()\n", progname); pdata_t* pdata = PDATA(pgm); return micronucleus_erase_device(pdata); } -static int micronucleus_open(PROGRAMMER* pgm, char* port) -{ +static int micronucleus_open(PROGRAMMER* pgm, const char *port) { avrdude_message(MSG_DEBUG, "%s: micronucleus_open(\"%s\")\n", progname, port); pdata_t* pdata = PDATA(pgm); - char* bus_name = NULL; + const char *bus_name = NULL; char* dev_name = NULL; // if no -P was given or '-P usb' was given @@ -829,7 +819,7 @@ static void micronucleus_close(PROGRAMMER* pgm) } } -static int micronucleus_read_byte(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, +static int micronucleus_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char* value) { avrdude_message(MSG_DEBUG, "%s: micronucleus_read_byte(desc=%s, addr=0x%0X)\n", @@ -850,7 +840,7 @@ static int micronucleus_read_byte(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, } } -static int micronucleus_write_byte(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, +static int micronucleus_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char value) { avrdude_message(MSG_DEBUG, "%s: micronucleus_write_byte(desc=%s, addr=0x%0X)\n", @@ -858,7 +848,7 @@ static int micronucleus_write_byte(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, return -1; } -static int micronucleus_paged_load(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, +static int micronucleus_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -867,7 +857,7 @@ static int micronucleus_paged_load(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, return -1; } -static int micronucleus_paged_write(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, +static int micronucleus_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -926,8 +916,7 @@ static int micronucleus_paged_write(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, } } -static int micronucleus_parseextparams(PROGRAMMER* pgm, LISTID xparams) -{ +static int micronucleus_parseextparams(const PROGRAMMER *pgm, const LISTID xparams) { avrdude_message(MSG_DEBUG, "%s: micronucleus_parseextparams()\n", progname); pdata_t* pdata = PDATA(pgm); @@ -955,8 +944,7 @@ static int micronucleus_parseextparams(PROGRAMMER* pgm, LISTID xparams) return 0; } -void micronucleus_initpgm(PROGRAMMER* pgm) -{ +void micronucleus_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "Micronucleus V2.0"); pgm->setup = micronucleus_setup; @@ -983,14 +971,12 @@ void micronucleus_initpgm(PROGRAMMER* pgm) #else /* !HAVE_LIBUSB */ // Give a proper error if we were not compiled with libusb -static int micronucleus_nousb_open(struct programmer_t* pgm, char* name) -{ +static int micronucleus_nousb_open(PROGRAMMER* pgm, const char* name) { avrdude_message(MSG_INFO, "%s: error: No usb support. Please compile again with libusb installed.\n", progname); return -1; } -void micronucleus_initpgm(PROGRAMMER* pgm) -{ +void micronucleus_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "micronucleus"); pgm->open = micronucleus_nousb_open; } diff --git a/src/micronucleus.h b/src/micronucleus.h index 46c67182..729fa126 100644 --- a/src/micronucleus.h +++ b/src/micronucleus.h @@ -26,7 +26,7 @@ extern "C" { #endif extern const char micronucleus_desc[]; -void micronucleus_initpgm(PROGRAMMER* pgm); +void micronucleus_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/par.c b/src/par.c index 9dcb8db8..d06cacb7 100644 --- a/src/par.c +++ b/src/par.c @@ -73,8 +73,7 @@ static struct ppipins_t ppipins[] = { #define NPINS (sizeof(ppipins)/sizeof(struct ppipins_t)) -static int par_setpin_internal(PROGRAMMER * pgm, int pin, int value) -{ +static int par_setpin_internal(const PROGRAMMER *pgm, int pin, int value) { int inverted; inverted = pin & PIN_INVERSE; @@ -102,13 +101,11 @@ static int par_setpin_internal(PROGRAMMER * pgm, int pin, int value) return 0; } -static int par_setpin(PROGRAMMER * pgm, int pinfunc, int value) -{ +static int par_setpin(const PROGRAMMER * pgm, int pinfunc, int value) { return par_setpin_internal(pgm, pgm->pinno[pinfunc], value); } -static void par_setmany(PROGRAMMER * pgm, int pinfunc, int value) -{ +static void par_setmany(const PROGRAMMER *pgm, int pinfunc, int value) { int pin, mask; int pinset = pgm->pinno[pinfunc]; @@ -121,8 +118,7 @@ static void par_setmany(PROGRAMMER * pgm, int pinfunc, int value) } } -static int par_getpin(PROGRAMMER * pgm, int pinfunc) -{ +static int par_getpin(const PROGRAMMER * pgm, int pinfunc) { int value; int inverted; int pin = pgm->pinno[pinfunc]; @@ -150,8 +146,7 @@ static int par_getpin(PROGRAMMER * pgm, int pinfunc) } -static int par_highpulsepin(PROGRAMMER * pgm, int pinfunc) -{ +static int par_highpulsepin(const PROGRAMMER *pgm, int pinfunc) { int inverted; int pin = pgm->pinno[pinfunc]; @@ -190,8 +185,7 @@ static int par_highpulsepin(PROGRAMMER * pgm, int pinfunc) /* * apply power to the AVR processor */ -static void par_powerup(PROGRAMMER * pgm) -{ +static void par_powerup(const PROGRAMMER *pgm) { par_setmany(pgm, PPI_AVR_VCC, 1); /* power up */ usleep(100000); } @@ -200,18 +194,15 @@ static void par_powerup(PROGRAMMER * pgm) /* * remove power from the AVR processor */ -static void par_powerdown(PROGRAMMER * pgm) -{ +static void par_powerdown(const PROGRAMMER *pgm) { par_setmany(pgm, PPI_AVR_VCC, 0); /* power down */ } -static void par_disable(PROGRAMMER * pgm) -{ +static void par_disable(const PROGRAMMER *pgm) { par_setmany(pgm, PPI_AVR_BUFF, 1); /* turn off */ } -static void par_enable(PROGRAMMER * pgm) -{ +static void par_enable(PROGRAMMER *pgm, const AVRPART *p) { /* * Prepare to start talking to the connected device - pull reset low * first, delay a few milliseconds, then enable the buffer. This @@ -232,8 +223,7 @@ static void par_enable(PROGRAMMER * pgm) par_setmany(pgm, PPI_AVR_BUFF, 0); } -static int par_open(PROGRAMMER * pgm, char * port) -{ +static int par_open(PROGRAMMER *pgm, const char *port) { int rc; if (bitbang_check_prerequisites(pgm) < 0) @@ -267,8 +257,7 @@ static int par_open(PROGRAMMER * pgm, char * port) } -static void par_close(PROGRAMMER * pgm) -{ +static void par_close(PROGRAMMER *pgm) { /* * Restore pin values before closing, @@ -331,40 +320,41 @@ static void par_close(PROGRAMMER * pgm) /* * parse the -E string */ -static int par_parseexitspecs(PROGRAMMER * pgm, char *s) -{ - char *cp; +static int par_parseexitspecs(PROGRAMMER *pgm, const char *sp) { + char *cp, *s, *str = cfg_strdup("par_parseexitspecs()", sp); - while ((cp = strtok(s, ","))) { - if (strcmp(cp, "reset") == 0) { + s = str; + while((cp = strtok(s, ","))) { + if(strcmp(cp, "reset") == 0) pgm->exit_reset = EXIT_RESET_ENABLED; - } - else if (strcmp(cp, "noreset") == 0) { + + else if(strcmp(cp, "noreset") == 0) pgm->exit_reset = EXIT_RESET_DISABLED; - } - else if (strcmp(cp, "vcc") == 0) { + + else if(strcmp(cp, "vcc") == 0) pgm->exit_vcc = EXIT_VCC_ENABLED; - } - else if (strcmp(cp, "novcc") == 0) { + + else if(strcmp(cp, "novcc") == 0) pgm->exit_vcc = EXIT_VCC_DISABLED; - } - else if (strcmp(cp, "d_high") == 0) { + + else if(strcmp(cp, "d_high") == 0) pgm->exit_datahigh = EXIT_DATAHIGH_ENABLED; - } - else if (strcmp(cp, "d_low") == 0) { + + else if(strcmp(cp, "d_low") == 0) pgm->exit_datahigh = EXIT_DATAHIGH_DISABLED; - } + else { + free(str); return -1; } - s = 0; /* strtok() should be called with the actual string only once */ + s = NULL; // Only call strtok() once with the actual string } + free(str); return 0; } -void par_initpgm(PROGRAMMER * pgm) -{ +void par_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "PPI"); pgm_fill_old_pins(pgm); // TODO to be removed if old pin data no longer needed @@ -400,10 +390,8 @@ void par_initpgm(PROGRAMMER * pgm) #else /* !HAVE_PARPORT */ -void par_initpgm(PROGRAMMER * pgm) -{ - avrdude_message(MSG_INFO, "%s: parallel port access not available in this configuration\n", - progname); +void par_initpgm(PROGRAMMER *pgm) { + avrdude_message(MSG_INFO, "%s: parallel port access not available in this configuration\n", progname); } #endif /* HAVE_PARPORT */ diff --git a/src/par.h b/src/par.h index 70899703..de3b8759 100644 --- a/src/par.h +++ b/src/par.h @@ -26,7 +26,7 @@ extern "C" { #endif extern const char par_desc[]; -void par_initpgm (PROGRAMMER * pgm); +void par_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/pgm.c b/src/pgm.c index 518b208e..2880a212 100644 --- a/src/pgm.c +++ b/src/pgm.c @@ -28,36 +28,37 @@ #include "avrdude.h" #include "libavrdude.h" -static int pgm_default_2 (struct programmer_t *, AVRPART *); -static int pgm_default_3 (struct programmer_t * pgm, AVRPART * p, AVRMEM * mem, - unsigned long addr, unsigned char * value); -static void pgm_default_4 (struct programmer_t *); -static int pgm_default_5 (struct programmer_t * pgm, AVRPART * p, AVRMEM * mem, - unsigned long addr, unsigned char data); -static void pgm_default_6 (struct programmer_t *, const char *); +static void pgm_default(void); +static int pgm_default_2(const PROGRAMMER *, const AVRPART *); +static int pgm_default_3(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, + unsigned long addr, unsigned char * value); +static void pgm_default_4(const PROGRAMMER *); +static int pgm_default_5(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, + unsigned long addr, unsigned char data); +static void pgm_default_6(const PROGRAMMER *, const char *); -static int pgm_default_open (struct programmer_t *pgm, char * name) -{ - avrdude_message(MSG_INFO, "\n%s: Fatal error: Programmer does not support open()", - progname); +static int pgm_default_open(PROGRAMMER *pgm, const char *name) { + avrdude_message(MSG_INFO, "\n%s: programmer does not support open()", progname); return -1; } -static int pgm_default_led (struct programmer_t * pgm, int value) -{ - /* - * If programmer has no LEDs, just do nothing. - */ +static void pgm_default_close(PROGRAMMER *pgm) { + pgm_default(); +} + +static void pgm_default_enable(PROGRAMMER *pgm, const AVRPART *p) { + pgm_default(); +} + +static int pgm_default_led(const PROGRAMMER *pgm, int value) { + // If programmer has no LEDs, just do nothing return 0; } -static void pgm_default_powerup_powerdown (struct programmer_t * pgm) -{ - /* - * If programmer does not support powerup/down, just do nothing. - */ +static void pgm_default_powerup_powerdown(const PROGRAMMER *pgm) { + // If programmer does not support powerup/down, just do nothing } @@ -94,14 +95,14 @@ PROGRAMMER *pgm_new(void) { */ pgm->initialize = pgm_default_2; pgm->display = pgm_default_6; - pgm->enable = pgm_default_4; + pgm->enable = pgm_default_enable; pgm->disable = pgm_default_4; pgm->powerup = pgm_default_powerup_powerdown; pgm->powerdown = pgm_default_powerup_powerdown; pgm->program_enable = pgm_default_2; pgm->chip_erase = pgm_default_2; pgm->open = pgm_default_open; - pgm->close = pgm_default_4; + pgm->close = pgm_default_close; pgm->read_byte = pgm_default_3; pgm->write_byte = pgm_default_5; @@ -189,39 +190,33 @@ PROGRAMMER *pgm_dup(const PROGRAMMER *src) { } -static void pgm_default(void) -{ +static void pgm_default(void) { avrdude_message(MSG_INFO, "%s: programmer operation not supported\n", progname); } -static int pgm_default_2 (struct programmer_t * pgm, AVRPART * p) -{ +static int pgm_default_2 (const PROGRAMMER *pgm, const AVRPART *p) { pgm_default(); return -1; } -static int pgm_default_3 (struct programmer_t * pgm, AVRPART * p, AVRMEM * mem, - unsigned long addr, unsigned char * value) -{ +static int pgm_default_3 (const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, + unsigned long addr, unsigned char * value) { pgm_default(); return -1; } -static void pgm_default_4 (struct programmer_t * pgm) -{ +static void pgm_default_4 (const PROGRAMMER *pgm) { pgm_default(); } -static int pgm_default_5 (struct programmer_t * pgm, AVRPART * p, AVRMEM * mem, - unsigned long addr, unsigned char data) -{ +static int pgm_default_5 (const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, + unsigned long addr, unsigned char data) { pgm_default(); return -1; } -static void pgm_default_6 (struct programmer_t * pgm, const char * p) -{ +static void pgm_default_6 (const PROGRAMMER *pgm, const char *p) { pgm_default(); } diff --git a/src/pgm_type.c b/src/pgm_type.c index 46090424..45ce8dca 100644 --- a/src/pgm_type.c +++ b/src/pgm_type.c @@ -129,7 +129,7 @@ const PROGRAMMER_TYPE * locate_programmer_type(const char * id) } // Return type id given the init function or "" if not found -const char *locate_programmer_type_id(void (*initpgm)(struct programmer_t *pgm)) { +const char *locate_programmer_type_id(void (*initpgm)(PROGRAMMER *pgm)) { for (int i=0; i < sizeof programmers_types/sizeof*programmers_types; i++) if(programmers_types[i].initpgm == initpgm) return programmers_types[i].id; diff --git a/src/pickit2.c b/src/pickit2.c index a1d32f88..dada4e12 100644 --- a/src/pickit2.c +++ b/src/pickit2.c @@ -104,8 +104,8 @@ static int usb_open_device(struct usb_dev_handle **dev, int vid, int pid); #define USB_ERROR_IO 5 #endif // WIN32 -static int pickit2_write_report(PROGRAMMER *pgm, const unsigned char report[65]); -static int pickit2_read_report(PROGRAMMER *pgm, unsigned char report[65]); +static int pickit2_write_report(const PROGRAMMER *pgm, const unsigned char report[65]); +static int pickit2_read_report(const PROGRAMMER *pgm, unsigned char report[65]); #ifndef MIN #define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) @@ -179,8 +179,7 @@ static void pickit2_teardown(PROGRAMMER * pgm) free(pgm->cookie); } -static int pickit2_open(PROGRAMMER * pgm, char * port) -{ +static int pickit2_open(PROGRAMMER *pgm, const char *port) { #if (defined(WIN32) && defined(HAVE_LIBHID)) PDATA(pgm)->usb_handle = open_hid(PICKIT2_VID, PICKIT2_PID); @@ -241,8 +240,7 @@ static void pickit2_close(PROGRAMMER * pgm) } -static int pickit2_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int pickit2_initialize(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char temp[4]; memset(temp, 0, sizeof(temp)); @@ -317,8 +315,7 @@ static int pickit2_initialize(PROGRAMMER * pgm, AVRPART * p) return -1; } -static void pickit2_disable(PROGRAMMER * pgm) -{ +static void pickit2_disable(const PROGRAMMER *pgm) { /* make sure all pins are floating & all voltages are off */ static const unsigned char report[65] = { @@ -339,15 +336,11 @@ static void pickit2_disable(PROGRAMMER * pgm) return; } -static void pickit2_enable(PROGRAMMER * pgm) -{ - /* Do nothing. */ - +static void pickit2_enable(PROGRAMMER *pgm, const AVRPART *p) { return; } -static void pickit2_display(PROGRAMMER * pgm, const char * p) -{ +static void pickit2_display(const PROGRAMMER *pgm, const char *p) { DEBUG( "%s: Found \"%s\" version %d.%d.%d\n", progname, p, 1, 1, 1); return; } @@ -356,14 +349,12 @@ static void pickit2_display(PROGRAMMER * pgm, const char * p) #define readReport(x) 0 #if 0 -static int pickit2_rdy_led (struct programmer_t * pgm, int value) -{ +static int pickit2_rdy_led(const PROGRAMMER *pgm, int value) { // no rdy led return 0; } -static int pickit2_err_led(struct programmer_t * pgm, int value) -{ +static int pickit2_err_led(const PROGRAMMER *pgm, int value) { // there is no error led, so just flash the busy led a few times uint8_t report[65] = { @@ -386,8 +377,7 @@ static int pickit2_err_led(struct programmer_t * pgm, int value) } #endif -static int pickit2_pgm_led (struct programmer_t * pgm, int value) -{ +static int pickit2_pgm_led(const PROGRAMMER *pgm, int value) { // script to set busy led appropriately uint8_t report[65] = {0, CMD_EXEC_SCRIPT_2(1), value ? SCR_BUSY_LED_ON : SCR_BUSY_LED_OFF, @@ -397,26 +387,22 @@ static int pickit2_pgm_led (struct programmer_t * pgm, int value) return pickit2_write_report(pgm, report) != -1; } -static int pickit2_vfy_led (struct programmer_t * pgm, int value) -{ +static int pickit2_vfy_led(const PROGRAMMER *pgm, int value) { // no such thing - maybe just call pgm_led return pgm->pgm_led(pgm, value); } -static void pickit2_powerup(struct programmer_t * pgm) -{ +static void pickit2_powerup(const PROGRAMMER *pgm) { // turn vdd on? } -static void pickit2_powerdown(struct programmer_t * pgm) -{ +static void pickit2_powerdown(const PROGRAMMER *pgm) { // do what? pgm->disable(pgm); } -static int pickit2_program_enable(struct programmer_t * pgm, AVRPART * p) -{ +static int pickit2_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4]; unsigned char res[4]; @@ -449,8 +435,7 @@ static int pickit2_program_enable(struct programmer_t * pgm, AVRPART * p) return 0; } -static int pickit2_chip_erase(struct programmer_t * pgm, AVRPART * p) -{ +static int pickit2_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4]; unsigned char res[4]; @@ -475,9 +460,9 @@ static int pickit2_chip_erase(struct programmer_t * pgm, AVRPART * p) return 0; } -static int pickit2_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, - unsigned int page_size, unsigned int addr, unsigned int n_bytes) -{ +static int pickit2_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, + unsigned int page_size, unsigned int addr, unsigned int n_bytes) { + // only supporting flash & eeprom page reads if ((!mem->paged || page_size <= 1) || (strcmp(mem->desc, "flash") != 0 && strcmp(mem->desc, "eeprom") != 0)) { @@ -568,7 +553,7 @@ static int pickit2_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } -static int pickit2_commit_page(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int pickit2_commit_page(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr) { OPCODE * wp, * lext; @@ -618,7 +603,7 @@ static int pickit2_commit_page(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } // not actually a paged write, but a bulk/batch write -static int pickit2_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int pickit2_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { // only paged write for flash implemented @@ -731,14 +716,14 @@ static int pickit2_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } -static int pickit2_cmd(struct programmer_t * pgm, const unsigned char *cmd, +static int pickit2_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { return pgm->spi(pgm, cmd, res, 4); } // breaks up the cmd[] data into packets & sends to the pickit2. Data shifted in is stored in res[]. -static int pickit2_spi(struct programmer_t * pgm, const unsigned char *cmd, +static int pickit2_spi(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res, int n_bytes) { int retval = 0, temp1 = 0, temp2 = 0, count = n_bytes; @@ -1058,8 +1043,7 @@ static HANDLE open_hid(unsigned short vid, unsigned short pid) } // simple read with timeout -static int usb_read_interrupt(PROGRAMMER *pgm, void *buff, int size, int timeout) -{ +static int usb_read_interrupt(const PROGRAMMER *pgm, void *buff, int size, int timeout) { OVERLAPPED ovr; DWORD bytesRead = 0; @@ -1084,8 +1068,7 @@ static int usb_read_interrupt(PROGRAMMER *pgm, void *buff, int size, int timeout } // simple write with timeout -static int usb_write_interrupt(PROGRAMMER *pgm, const void *buff, int size, int timeout) -{ +static int usb_write_interrupt(const PROGRAMMER *pgm, const void *buff, int size, int timeout) { OVERLAPPED ovr; DWORD bytesWritten = 0; @@ -1109,13 +1092,11 @@ static int usb_write_interrupt(PROGRAMMER *pgm, const void *buff, int size, int return bytesWritten > 0 ? bytesWritten : -1; } -static int pickit2_write_report(PROGRAMMER * pgm, const unsigned char report[65]) -{ +static int pickit2_write_report(const PROGRAMMER *pgm, const unsigned char report[65]) { return usb_write_interrupt(pgm, report, 65, PDATA(pgm)->transaction_timeout); // XXX } -static int pickit2_read_report(PROGRAMMER * pgm, unsigned char report[65]) -{ +static int pickit2_read_report(const PROGRAMMER *pgm, unsigned char report[65]) { return usb_read_interrupt(pgm, report, 65, PDATA(pgm)->transaction_timeout); } @@ -1180,21 +1161,18 @@ static int usb_open_device(struct usb_dev_handle **device, int vendor, int produ return -1; } -static int pickit2_write_report(PROGRAMMER * pgm, const unsigned char report[65]) -{ +static int pickit2_write_report(const PROGRAMMER *pgm, const unsigned char report[65]) { // endpoint 1 OUT?? return usb_interrupt_write(PDATA(pgm)->usb_handle, USB_ENDPOINT_OUT | 1, (char*)(report+1), 64, PDATA(pgm)->transaction_timeout); } -static int pickit2_read_report(PROGRAMMER * pgm, unsigned char report[65]) -{ +static int pickit2_read_report(const PROGRAMMER *pgm, unsigned char report[65]) { // endpoint 1 IN?? return usb_interrupt_read(PDATA(pgm)->usb_handle, USB_ENDPOINT_IN | 1, (char*)(report+1), 64, PDATA(pgm)->transaction_timeout); } #endif // WIN32 -static int pickit2_parseextparams(struct programmer_t * pgm, LISTID extparms) -{ +static int pickit2_parseextparams(const PROGRAMMER *pgm, const LISTID extparms) { LNODEID ln; const char *extended_param; int rv = 0; @@ -1251,8 +1229,7 @@ static int pickit2_parseextparams(struct programmer_t * pgm, LISTID extparms) } -void pickit2_initpgm (PROGRAMMER * pgm) -{ +void pickit2_initpgm(PROGRAMMER *pgm) { /* * mandatory functions - these are called without checking to see * whether they are assigned or not @@ -1307,7 +1284,7 @@ void pickit2_initpgm (PROGRAMMER * pgm) strncpy(pgm->type, "pickit2", sizeof(pgm->type)); } #else -static int pickit2_nousb_open (struct programmer_t *pgm, char * name) { +static int pickit2_nousb_open(PROGRAMMER *pgm, const char *name) { avrdude_message(MSG_INFO, #ifdef WIN32 "%s: error: no usb or hid support. Please compile again with libusb or HID support from Win32 DDK installed.\n", @@ -1319,8 +1296,7 @@ static int pickit2_nousb_open (struct programmer_t *pgm, char * name) { return -1; } -void pickit2_initpgm (PROGRAMMER * pgm) -{ +void pickit2_initpgm(PROGRAMMER *pgm) { /* * mandatory functions - these are called without checking to see * whether they are assigned or not diff --git a/src/pickit2.h b/src/pickit2.h index cdd58d96..4663266f 100644 --- a/src/pickit2.h +++ b/src/pickit2.h @@ -26,7 +26,7 @@ extern "C" { #endif extern const char pickit2_desc[]; -void pickit2_initpgm (PROGRAMMER * pgm); +void pickit2_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/pindefs.c b/src/pindefs.c index 2e78c8df..7127f539 100644 --- a/src/pindefs.c +++ b/src/pindefs.c @@ -118,7 +118,7 @@ static int pin_fill_old_pinlist(const struct pindef_t * const pindef, unsigned i * * @param[inout] pgm programmer whose pins shall be converted. */ -int pgm_fill_old_pins(struct programmer_t * const pgm) { +int pgm_fill_old_pins(PROGRAMMER * const pgm) { if (pin_fill_old_pinlist(&(pgm->pin[PPI_AVR_VCC]), &(pgm->pinno[PPI_AVR_VCC])) < 0) return -1; @@ -218,7 +218,7 @@ const char * pinmask_to_str(const pinmask_t * const pinmask) { * @param[in] size the number of entries in checklist * @returns 0 if all pin definitions are valid, -1 otherwise */ -int pins_check(const struct programmer_t * const pgm, const struct pin_checklist_t * const checklist, const int size, const bool output) { +int pins_check(const PROGRAMMER *const pgm, const struct pin_checklist_t *const checklist, const int size, const bool output) { static const struct pindef_t no_valid_pins = {{0}, {0}}; // default value if check list does not contain anything else int rv = 0; // return value int pinname; // loop counter through pinnames diff --git a/src/ppi.c b/src/ppi.c index 4478115f..f99e44c9 100644 --- a/src/ppi.c +++ b/src/ppi.c @@ -51,7 +51,7 @@ enum { PPI_SHADOWREAD }; -static int ppi_shadow_access(union filedescriptor *fdp, int reg, +static int ppi_shadow_access(const union filedescriptor *fdp, int reg, unsigned char *v, unsigned char action) { static unsigned char shadow[3]; @@ -93,8 +93,7 @@ static int ppi_shadow_access(union filedescriptor *fdp, int reg, /* * set the indicated bit of the specified register. */ -int ppi_set(union filedescriptor *fdp, int reg, int bit) -{ +int ppi_set(const union filedescriptor *fdp, int reg, int bit) { unsigned char v; int rc; @@ -112,8 +111,7 @@ int ppi_set(union filedescriptor *fdp, int reg, int bit) /* * clear the indicated bit of the specified register. */ -int ppi_clr(union filedescriptor *fdp, int reg, int bit) -{ +int ppi_clr(const union filedescriptor *fdp, int reg, int bit) { unsigned char v; int rc; @@ -131,8 +129,7 @@ int ppi_clr(union filedescriptor *fdp, int reg, int bit) /* * get the indicated bit of the specified register. */ -int ppi_get(union filedescriptor *fdp, int reg, int bit) -{ +int ppi_get(const union filedescriptor *fdp, int reg, int bit) { unsigned char v; int rc; @@ -148,8 +145,7 @@ int ppi_get(union filedescriptor *fdp, int reg, int bit) /* * toggle the indicated bit of the specified register. */ -int ppi_toggle(union filedescriptor *fdp, int reg, int bit) -{ +int ppi_toggle(const union filedescriptor *fdp, int reg, int bit) { unsigned char v; int rc; @@ -167,8 +163,7 @@ int ppi_toggle(union filedescriptor *fdp, int reg, int bit) /* * get all bits of the specified register. */ -int ppi_getall(union filedescriptor *fdp, int reg) -{ +int ppi_getall(const union filedescriptor *fdp, int reg) { unsigned char v; int rc; @@ -183,8 +178,7 @@ int ppi_getall(union filedescriptor *fdp, int reg) /* * set all bits of the specified register to val. */ -int ppi_setall(union filedescriptor *fdp, int reg, int val) -{ +int ppi_setall(const union filedescriptor *fdp, int reg, int val) { unsigned char v; int rc; @@ -198,8 +192,7 @@ int ppi_setall(union filedescriptor *fdp, int reg, int val) } -void ppi_open(char * port, union filedescriptor *fdp) -{ +void ppi_open(const char *port, union filedescriptor *fdp) { int fd; unsigned char v; @@ -225,8 +218,7 @@ void ppi_open(char * port, union filedescriptor *fdp) } -void ppi_close(union filedescriptor *fdp) -{ +void ppi_close(const union filedescriptor *fdp) { ppi_release (fdp->ifd); close(fdp->ifd); } diff --git a/src/ppi.h b/src/ppi.h index 38fc1e8b..ec692735 100644 --- a/src/ppi.h +++ b/src/ppi.h @@ -34,21 +34,21 @@ enum { extern "C" { #endif -int ppi_get (union filedescriptor *fdp, int reg, int bit); +int ppi_get (const union filedescriptor *fdp, int reg, int bit); -int ppi_set (union filedescriptor *fdp, int reg, int bit); +int ppi_set (const union filedescriptor *fdp, int reg, int bit); -int ppi_clr (union filedescriptor *fdp, int reg, int bit); +int ppi_clr (const union filedescriptor *fdp, int reg, int bit); -int ppi_getall (union filedescriptor *fdp, int reg); +int ppi_getall (const union filedescriptor *fdp, int reg); -int ppi_setall (union filedescriptor *fdp, int reg, int val); +int ppi_setall (const union filedescriptor *fdp, int reg, int val); -int ppi_toggle (union filedescriptor *fdp, int reg, int bit); +int ppi_toggle (const union filedescriptor *fdp, int reg, int bit); -void ppi_open (char * port, union filedescriptor *fdp); +void ppi_open (const char *port, union filedescriptor *fdp); -void ppi_close (union filedescriptor *fdp); +void ppi_close (const union filedescriptor *fdp); #ifdef __cplusplus } diff --git a/src/ppiwin.c b/src/ppiwin.c index 71ec0a9f..76122eb8 100644 --- a/src/ppiwin.c +++ b/src/ppiwin.c @@ -84,8 +84,7 @@ static void outb(unsigned char value, unsigned short port); /* FUNCTION DEFINITIONS */ -void ppi_open(char *port, union filedescriptor *fdp) -{ +void ppi_open(const char *port, union filedescriptor *fdp) { unsigned char i; int fd; @@ -138,8 +137,7 @@ void ppi_open(char *port, union filedescriptor *fdp) #define DRIVERNAME "\\\\.\\giveio" -static int winnt_pp_open(void) -{ +static int winnt_pp_open(void) { // Only try to use giveio under Windows NT/2000/XP. OSVERSIONINFO ver_info; @@ -178,8 +176,7 @@ static int winnt_pp_open(void) -void ppi_close(union filedescriptor *fdp) -{ +void ppi_close(const union filedescriptor *fdp) { return; } @@ -188,8 +185,7 @@ void ppi_close(union filedescriptor *fdp) /* * set the indicated bit of the specified register. */ -int ppi_set(union filedescriptor *fdp, int reg, int bit) -{ +int ppi_set(const union filedescriptor *fdp, int reg, int bit) { unsigned char v; unsigned short port; @@ -204,8 +200,7 @@ int ppi_set(union filedescriptor *fdp, int reg, int bit) /* * clear the indicated bit of the specified register. */ -int ppi_clr(union filedescriptor *fdp, int reg, int bit) -{ +int ppi_clr(const union filedescriptor *fdp, int reg, int bit) { unsigned char v; unsigned short port; @@ -221,8 +216,7 @@ int ppi_clr(union filedescriptor *fdp, int reg, int bit) /* * get the indicated bit of the specified register. */ -int ppi_get(union filedescriptor *fdp, int reg, int bit) -{ +int ppi_get(const union filedescriptor *fdp, int reg, int bit) { unsigned char v; v = inb(port_get(fdp, reg)); @@ -237,8 +231,7 @@ int ppi_get(union filedescriptor *fdp, int reg, int bit) /* * toggle the indicated bit of the specified register. */ -int ppi_toggle(union filedescriptor *fdp, int reg, int bit) -{ +int ppi_toggle(const union filedescriptor *fdp, int reg, int bit) { unsigned char v; unsigned short port; @@ -255,8 +248,7 @@ int ppi_toggle(union filedescriptor *fdp, int reg, int bit) /* * get all bits of the specified register. */ -int ppi_getall(union filedescriptor *fdp, int reg) -{ +int ppi_getall(const union filedescriptor *fdp, int reg) { unsigned char v; v = inb(port_get(fdp, reg)); @@ -270,8 +262,7 @@ int ppi_getall(union filedescriptor *fdp, int reg) /* * set all bits of the specified register to val. */ -int ppi_setall(union filedescriptor *fdp, int reg, int val) -{ +int ppi_setall(const union filedescriptor *fdp, int reg, int val) { outb((unsigned char)val, port_get(fdp, reg)); return 0; } @@ -280,15 +271,13 @@ int ppi_setall(union filedescriptor *fdp, int reg, int val) /* Calculate port address to access. */ -static unsigned short port_get(union filedescriptor *fdp, int reg) -{ +static unsigned short port_get(const union filedescriptor *fdp, int reg) { return((unsigned short)(fdp->ifd + reg2offset(reg))); } /* Convert register enum to offset of base address. */ -static unsigned char reg2offset(int reg) -{ +static unsigned char reg2offset(int reg) { unsigned char offset = 0; switch(reg) @@ -315,8 +304,7 @@ static unsigned char reg2offset(int reg) /* Read in value from port. */ -static unsigned char inb(unsigned short port) -{ +static unsigned char inb(unsigned short port) { unsigned char t; asm volatile ("in %1, %0" @@ -328,8 +316,7 @@ static unsigned char inb(unsigned short port) /* Write value to port. */ -static void outb(unsigned char value, unsigned short port) -{ +static void outb(unsigned char value, unsigned short port) { asm volatile ("out %1, %0" : : "d" (port), "a" (value) ); diff --git a/src/ser_avrdoper.c b/src/ser_avrdoper.c index e459f921..d77465b0 100644 --- a/src/ser_avrdoper.c +++ b/src/ser_avrdoper.c @@ -96,8 +96,7 @@ static void usbCloseDevice(union filedescriptor *fdp) /* ------------------------------------------------------------------------- */ -static int usbSetReport(union filedescriptor *fdp, int reportType, char *buffer, int len) -{ +static int usbSetReport(const union filedescriptor *fdp, int reportType, char *buffer, int len) { hid_device *udev = (hid_device *)fdp->usb.handle; int bytesSent = -1; @@ -122,7 +121,7 @@ static int usbSetReport(union filedescriptor *fdp, int reportType, char *buffer, /* ------------------------------------------------------------------------- */ -static int usbGetReport(union filedescriptor *fdp, int reportType, int reportNumber, +static int usbGetReport(const union filedescriptor *fdp, int reportType, int reportNumber, char *buffer, int *len) { hid_device *udev = (hid_device *)fdp->usb.handle; @@ -221,7 +220,7 @@ static char *usbErrorText(int usbErrno) /* ------------------------------------------------------------------------- */ -static int avrdoper_open(char *port, union pinfo pinfo, union filedescriptor *fdp) +static int avrdoper_open(const char *port, union pinfo pinfo, union filedescriptor *fdp) { int rval; char *vname = "obdev.at"; @@ -255,7 +254,7 @@ static int chooseDataSize(int len) return i - 1; } -static int avrdoper_send(union filedescriptor *fdp, const unsigned char *buf, size_t buflen) +static int avrdoper_send(const union filedescriptor *fdp, const unsigned char *buf, size_t buflen) { if(verbose > 3) dumpBlock("Send", buf, buflen); @@ -282,8 +281,7 @@ static int avrdoper_send(union filedescriptor *fdp, const unsigned char *buf, si /* ------------------------------------------------------------------------- */ -static int avrdoperFillBuffer(union filedescriptor *fdp) -{ +static int avrdoperFillBuffer(const union filedescriptor *fdp) { int bytesPending = reportDataSizes[1]; /* guess how much data is buffered in device */ avrdoperRxPosition = avrdoperRxLength = 0; @@ -316,7 +314,7 @@ static int avrdoperFillBuffer(union filedescriptor *fdp) return 0; } -static int avrdoper_recv(union filedescriptor *fdp, unsigned char *buf, size_t buflen) +static int avrdoper_recv(const union filedescriptor *fdp, unsigned char *buf, size_t buflen) { unsigned char *p = buf; int remaining = buflen; @@ -341,7 +339,7 @@ static int avrdoper_recv(union filedescriptor *fdp, unsigned char *buf, size_t b /* ------------------------------------------------------------------------- */ -static int avrdoper_drain(union filedescriptor *fdp, int display) +static int avrdoper_drain(const union filedescriptor *fdp, int display) { do{ if (avrdoperFillBuffer(fdp) < 0) @@ -352,7 +350,7 @@ static int avrdoper_drain(union filedescriptor *fdp, int display) /* ------------------------------------------------------------------------- */ -static int avrdoper_set_dtr_rts(union filedescriptor *fdp, int is_on) +static int avrdoper_set_dtr_rts(const union filedescriptor *fdp, int is_on) { avrdude_message(MSG_INFO, "%s: AVR-Doper doesn't support DTR/RTS setting\n", progname); return -1; diff --git a/src/ser_posix.c b/src/ser_posix.c index 53d8cd15..d48abad7 100644 --- a/src/ser_posix.c +++ b/src/ser_posix.c @@ -122,8 +122,7 @@ static struct baud_mapping baud_lookup_table [] = { static struct termios original_termios; static int saved_original_termios; -static speed_t serial_baud_lookup(long baud, bool *nonstandard) -{ +static speed_t serial_baud_lookup(long baud, bool *nonstandard) { struct baud_mapping *map = baud_lookup_table; *nonstandard = false; @@ -146,8 +145,7 @@ static speed_t serial_baud_lookup(long baud, bool *nonstandard) return baud; } -static int ser_setparams(union filedescriptor *fd, long baud, unsigned long cflags) -{ +static int ser_setparams(const union filedescriptor *fd, long baud, unsigned long cflags) { int rc; struct termios termios; bool nonstandard; @@ -283,9 +281,7 @@ static int ser_setparams(union filedescriptor *fd, long baud, unsigned long cfla * terminal/console server with serial parameters configured * appropriately (e. g. 115200-8-N-1 for a STK500.) */ -static int -net_open(const char *port, union filedescriptor *fdp) -{ +static int net_open(const char *port, union filedescriptor *fdp) { char *hp, *hstr, *pstr; int s, fd, ret = -1; struct addrinfo hints; @@ -361,8 +357,7 @@ error: } -static int ser_set_dtr_rts(union filedescriptor *fdp, int is_on) -{ +static int ser_set_dtr_rts(const union filedescriptor *fdp, int is_on) { unsigned int ctl; int r; @@ -390,8 +385,7 @@ static int ser_set_dtr_rts(union filedescriptor *fdp, int is_on) return 0; } -static int ser_open(char * port, union pinfo pinfo, union filedescriptor *fdp) -{ +static int ser_open(const char *port, union pinfo pinfo, union filedescriptor *fdp) { int rc; int fd; @@ -428,8 +422,7 @@ static int ser_open(char * port, union pinfo pinfo, union filedescriptor *fdp) return 0; } -static void ser_close(union filedescriptor *fd) -{ +static void ser_close(union filedescriptor *fd) { /* * restore original termios settings from ser_open */ @@ -446,8 +439,7 @@ static void ser_close(union filedescriptor *fd) } -static int ser_send(union filedescriptor *fd, const unsigned char * buf, size_t buflen) -{ +static int ser_send(const union filedescriptor *fd, const unsigned char * buf, size_t buflen) { int rc; const unsigned char * p = buf; size_t len = buflen; @@ -491,8 +483,7 @@ static int ser_send(union filedescriptor *fd, const unsigned char * buf, size_t } -static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen) -{ +static int ser_recv(const union filedescriptor *fd, unsigned char * buf, size_t buflen) { struct timeval timeout, to2; fd_set rfds; int nfds; @@ -564,8 +555,7 @@ static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen } -static int ser_drain(union filedescriptor *fd, int display) -{ +static int ser_drain(const union filedescriptor *fd, int display) { struct timeval timeout; fd_set rfds; int nfds; diff --git a/src/ser_win32.c b/src/ser_win32.c index 970a3ecb..252499e2 100644 --- a/src/ser_win32.c +++ b/src/ser_win32.c @@ -95,8 +95,7 @@ static BOOL serial_w32SetTimeOut(HANDLE hComPort, DWORD timeout) // in ms return SetCommTimeouts(hComPort, &ctmo); } -static int ser_setparams(union filedescriptor *fd, long baud, unsigned long cflags) -{ +static int ser_setparams(const union filedescriptor *fd, long baud, unsigned long cflags) { if (serial_over_ethernet) { return -ENOTTY; } else { @@ -150,9 +149,7 @@ static int ser_setparams(union filedescriptor *fd, long baud, unsigned long cfla } } -static int -net_open(const char *port, union filedescriptor *fdp) -{ +static int net_open(const char *port, union filedescriptor *fdp) { WSADATA wsaData; LPVOID lpMsgBuf; @@ -243,8 +240,7 @@ net_open(const char *port, union filedescriptor *fdp) } -static int ser_open(char * port, union pinfo pinfo, union filedescriptor *fdp) -{ +static int ser_open(const char *port, union pinfo pinfo, union filedescriptor *fdp) { LPVOID lpMsgBuf; HANDLE hComPort=INVALID_HANDLE_VALUE; char *newname = 0; @@ -325,8 +321,7 @@ static int ser_open(char * port, union pinfo pinfo, union filedescriptor *fdp) } -static void ser_close(union filedescriptor *fd) -{ +static void ser_close(union filedescriptor *fd) { if (serial_over_ethernet) { closesocket(fd->ifd); WSACleanup(); @@ -339,8 +334,7 @@ static void ser_close(union filedescriptor *fd) } } -static int ser_set_dtr_rts(union filedescriptor *fd, int is_on) -{ +static int ser_set_dtr_rts(const union filedescriptor *fd, int is_on) { if (serial_over_ethernet) { return 0; } else { @@ -357,8 +351,7 @@ static int ser_set_dtr_rts(union filedescriptor *fd, int is_on) } } -static int net_send(union filedescriptor *fd, const unsigned char * buf, size_t buflen) -{ +static int net_send(const union filedescriptor *fd, const unsigned char * buf, size_t buflen) { LPVOID lpMsgBuf; int rc; const unsigned char *p = buf; @@ -417,8 +410,7 @@ static int net_send(union filedescriptor *fd, const unsigned char * buf, size_t } -static int ser_send(union filedescriptor *fd, const unsigned char * buf, size_t buflen) -{ +static int ser_send(const union filedescriptor *fd, const unsigned char * buf, size_t buflen) { if (serial_over_ethernet) { return net_send(fd, buf, buflen); } @@ -476,8 +468,7 @@ static int ser_send(union filedescriptor *fd, const unsigned char * buf, size_t } -static int net_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen) -{ +static int net_recv(const union filedescriptor *fd, unsigned char * buf, size_t buflen) { LPVOID lpMsgBuf; struct timeval timeout, to2; fd_set rfds; @@ -570,8 +561,7 @@ reselect: return 0; } -static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen) -{ +static int ser_recv(const union filedescriptor *fd, unsigned char * buf, size_t buflen) { if (serial_over_ethernet) { return net_recv(fd, buf, buflen); } @@ -639,8 +629,7 @@ static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen return 0; } -static int net_drain(union filedescriptor *fd, int display) -{ +static int net_drain(const union filedescriptor *fd, int display) { LPVOID lpMsgBuf; struct timeval timeout; fd_set rfds; @@ -718,8 +707,7 @@ static int net_drain(union filedescriptor *fd, int display) return 0; } -static int ser_drain(union filedescriptor *fd, int display) -{ +static int ser_drain(const union filedescriptor *fd, int display) { if (serial_over_ethernet) { return net_drain(fd, display); } diff --git a/src/serbb.h b/src/serbb.h index 3257ea0f..da7c9a31 100644 --- a/src/serbb.h +++ b/src/serbb.h @@ -26,7 +26,7 @@ extern "C" { #endif extern const char serbb_desc[]; -void serbb_initpgm (PROGRAMMER * pgm); +void serbb_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/serbb_posix.c b/src/serbb_posix.c index 9f10dccf..7addad4e 100644 --- a/src/serbb_posix.c +++ b/src/serbb_posix.c @@ -70,8 +70,7 @@ static char *serpins[DB9PINS + 1] = { "NONE", "CD", "RXD", "TXD", "DTR", "GND", "DSR", "RTS", "CTS", "RI" }; #endif -static int serbb_setpin(PROGRAMMER * pgm, int pinfunc, int value) -{ +static int serbb_setpin(const PROGRAMMER *pgm, int pinfunc, int value) { unsigned int ctl; int r; int pin = pgm->pinno[pinfunc]; // get its value @@ -127,8 +126,7 @@ static int serbb_setpin(PROGRAMMER * pgm, int pinfunc, int value) return 0; } -static int serbb_getpin(PROGRAMMER * pgm, int pinfunc) -{ +static int serbb_getpin(const PROGRAMMER *pgm, int pinfunc) { unsigned int ctl; unsigned char invert; int r; @@ -178,8 +176,7 @@ static int serbb_getpin(PROGRAMMER * pgm, int pinfunc) } } -static int serbb_highpulsepin(PROGRAMMER * pgm, int pinfunc) -{ +static int serbb_highpulsepin(const PROGRAMMER *pgm, int pinfunc) { int pin = pgm->pinno[pinfunc]; // replace pin name by its value if ( (pin & PIN_MASK) < 1 || (pin & PIN_MASK) > DB9PINS ) @@ -193,33 +190,27 @@ static int serbb_highpulsepin(PROGRAMMER * pgm, int pinfunc) -static void serbb_display(PROGRAMMER *pgm, const char *p) -{ +static void serbb_display(const PROGRAMMER *pgm, const char *p) { /* MAYBE */ } -static void serbb_enable(PROGRAMMER *pgm) -{ +static void serbb_enable(PROGRAMMER *pgm, const AVRPART *p) { /* nothing */ } -static void serbb_disable(PROGRAMMER *pgm) -{ +static void serbb_disable(const PROGRAMMER *pgm) { /* nothing */ } -static void serbb_powerup(PROGRAMMER *pgm) -{ +static void serbb_powerup(const PROGRAMMER *pgm) { /* nothing */ } -static void serbb_powerdown(PROGRAMMER *pgm) -{ +static void serbb_powerdown(const PROGRAMMER *pgm) { /* nothing */ } -static int serbb_open(PROGRAMMER *pgm, char *port) -{ +static int serbb_open(PROGRAMMER *pgm, const char *port) { struct termios mode; int flags; int r; @@ -276,8 +267,7 @@ static int serbb_open(PROGRAMMER *pgm, char *port) return(0); } -static void serbb_close(PROGRAMMER *pgm) -{ +static void serbb_close(PROGRAMMER *pgm) { if (pgm->fd.ifd != -1) { (void)tcsetattr(pgm->fd.ifd, TCSANOW, &oldmode); @@ -289,8 +279,7 @@ static void serbb_close(PROGRAMMER *pgm) const char serbb_desc[] = "Serial port bitbanging"; -void serbb_initpgm(PROGRAMMER *pgm) -{ +void serbb_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "SERBB"); pgm_fill_old_pins(pgm); // TODO to be removed if old pin data no longer needed diff --git a/src/serbb_win32.c b/src/serbb_win32.c index 9a58be10..181d177d 100644 --- a/src/serbb_win32.c +++ b/src/serbb_win32.c @@ -61,8 +61,7 @@ static int dtr, rts, txd; #define DB9PINS 9 -static int serbb_setpin(PROGRAMMER * pgm, int pinfunc, int value) -{ +static int serbb_setpin(const PROGRAMMER *pgm, int pinfunc, int value) { int pin = pgm->pinno[pinfunc]; HANDLE hComPort = (HANDLE)pgm->fd.pfd; LPVOID lpMsgBuf; @@ -129,8 +128,7 @@ static int serbb_setpin(PROGRAMMER * pgm, int pinfunc, int value) return 0; } -static int serbb_getpin(PROGRAMMER * pgm, int pinfunc) -{ +static int serbb_getpin(const PROGRAMMER *pgm, int pinfunc) { int pin = pgm->pinno[pinfunc]; HANDLE hComPort = (HANDLE)pgm->fd.pfd; LPVOID lpMsgBuf; @@ -216,8 +214,7 @@ static int serbb_getpin(PROGRAMMER * pgm, int pinfunc) return rv; } -static int serbb_highpulsepin(PROGRAMMER * pgm, int pinfunc) -{ +static int serbb_highpulsepin(const PROGRAMMER *pgm, int pinfunc) { int pin = pgm->pinno[pinfunc]; if ( (pin & PIN_MASK) < 1 || (pin & PIN_MASK) > DB9PINS ) return -1; @@ -229,33 +226,27 @@ static int serbb_highpulsepin(PROGRAMMER * pgm, int pinfunc) } -static void serbb_display(PROGRAMMER *pgm, const char *p) -{ +static void serbb_display(const PROGRAMMER *pgm, const char *p) { /* MAYBE */ } -static void serbb_enable(PROGRAMMER *pgm) -{ +static void serbb_enable(PROGRAMMER *pgm, const AVRPART *p) { /* nothing */ } -static void serbb_disable(PROGRAMMER *pgm) -{ +static void serbb_disable(const PROGRAMMER *pgm) { /* nothing */ } -static void serbb_powerup(PROGRAMMER *pgm) -{ +static void serbb_powerup(const PROGRAMMER *pgm) { /* nothing */ } -static void serbb_powerdown(PROGRAMMER *pgm) -{ +static void serbb_powerdown(const PROGRAMMER *pgm) { /* nothing */ } -static int serbb_open(PROGRAMMER *pgm, char *port) -{ +static int serbb_open(PROGRAMMER *pgm, const char *port) { DCB dcb; LPVOID lpMsgBuf; HANDLE hComPort = INVALID_HANDLE_VALUE; @@ -319,8 +310,7 @@ static int serbb_open(PROGRAMMER *pgm, char *port) return 0; } -static void serbb_close(PROGRAMMER *pgm) -{ +static void serbb_close(PROGRAMMER *pgm) { HANDLE hComPort=(HANDLE)pgm->fd.pfd; if (hComPort != INVALID_HANDLE_VALUE) { @@ -335,8 +325,7 @@ static void serbb_close(PROGRAMMER *pgm) const char serbb_desc[] = "Serial port bitbanging"; -void serbb_initpgm(PROGRAMMER *pgm) -{ +void serbb_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "SERBB"); pgm_fill_old_pins(pgm); // TODO to be removed if old pin data no longer needed diff --git a/src/serialupdi.c b/src/serialupdi.c index cb72daee..e8cd4565 100644 --- a/src/serialupdi.c +++ b/src/serialupdi.c @@ -43,8 +43,8 @@ #include "updi_nvm.h" #include "updi_constants.h" -static int serialupdi_enter_progmode(PROGRAMMER * pgm); -static int serialupdi_leave_progmode(PROGRAMMER * pgm); +static int serialupdi_enter_progmode(const PROGRAMMER *pgm); +static int serialupdi_leave_progmode(const PROGRAMMER *pgm); static void serialupdi_setup(PROGRAMMER * pgm) { @@ -64,8 +64,7 @@ static void serialupdi_teardown(PROGRAMMER * pgm) free(pgm->cookie); } -static int serialupdi_open(PROGRAMMER * pgm, char * port) -{ +static int serialupdi_open(PROGRAMMER *pgm, const char *port) { strcpy(pgm->port, port); return updi_link_open(pgm); } @@ -75,8 +74,7 @@ typedef enum { RELEASE_RESET } reset_mode; -static int serialupdi_reset(PROGRAMMER * pgm, reset_mode mode) -{ +static int serialupdi_reset(const PROGRAMMER *pgm, reset_mode mode) { /* def reset(self, apply_reset): """ @@ -102,8 +100,7 @@ static int serialupdi_reset(PROGRAMMER * pgm, reset_mode mode) return -1; } -static int serialupdi_reset_connection(PROGRAMMER * pgm) -{ +static int serialupdi_reset_connection(const PROGRAMMER *pgm) { if (serialupdi_reset(pgm, APPLY_RESET) < 0) { avrdude_message(MSG_INFO, "%s: Apply reset operation failed\n", progname); return -1; @@ -117,8 +114,7 @@ static int serialupdi_reset_connection(PROGRAMMER * pgm) return updi_link_init(pgm); } -static int serialupdi_decode_sib(PROGRAMMER * pgm, updi_sib_info * sib_info) -{ +static int serialupdi_decode_sib(const PROGRAMMER *pgm, updi_sib_info *sib_info) { char * str_ptr; sib_info->sib_string[SIB_INFO_STRING_LENGTH]=0; @@ -192,7 +188,7 @@ static void serialupdi_close(PROGRAMMER * pgm) updi_link_close(pgm); } -static int serialupdi_wait_for_unlock(PROGRAMMER * pgm, unsigned int ms) { +static int serialupdi_wait_for_unlock(const PROGRAMMER *pgm, unsigned int ms) { /* def wait_unlocked(self, timeout_ms): """ @@ -236,7 +232,7 @@ typedef enum { WAIT_FOR_UROW_HIGH } urow_wait_mode; -static int serialupdi_wait_for_urow(PROGRAMMER * pgm, unsigned int ms, urow_wait_mode mode) { +static int serialupdi_wait_for_urow(const PROGRAMMER *pgm, unsigned int ms, urow_wait_mode mode) { /* def wait_urow_prog(self, timeout_ms, wait_for_high): """ @@ -286,8 +282,7 @@ static int serialupdi_wait_for_urow(PROGRAMMER * pgm, unsigned int ms, urow_wait return -1; } -static int serialupdi_in_prog_mode(PROGRAMMER * pgm, uint8_t * in_prog_mode) -{ +static int serialupdi_in_prog_mode(const PROGRAMMER *pgm, uint8_t *in_prog_mode) { /* def in_prog_mode(self): """ @@ -315,8 +310,7 @@ static int serialupdi_in_prog_mode(PROGRAMMER * pgm, uint8_t * in_prog_mode) return 0; } -static int serialupdi_enter_progmode(PROGRAMMER * pgm) -{ +static int serialupdi_enter_progmode(const PROGRAMMER *pgm) { /* def enter_progmode(self): """ @@ -415,8 +409,7 @@ def enter_progmode(self): return 0; } -static int serialupdi_leave_progmode(PROGRAMMER * pgm) -{ +static int serialupdi_leave_progmode(const PROGRAMMER *pgm) { /* def leave_progmode(self): """ @@ -441,7 +434,7 @@ static int serialupdi_leave_progmode(PROGRAMMER * pgm) return updi_write_cs(pgm, UPDI_CS_CTRLB, (1 << UPDI_CTRLB_UPDIDIS_BIT) | (1 << UPDI_CTRLB_CCDETDIS_BIT)); } -static int serialupdi_write_userrow(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int serialupdi_write_userrow(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -576,8 +569,7 @@ static int serialupdi_write_userrow(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return 0; } -static int serialupdi_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int serialupdi_initialize(const PROGRAMMER *pgm, const AVRPART *p) { uint8_t value; uint8_t reset_link_required=0; @@ -660,26 +652,23 @@ static int serialupdi_initialize(PROGRAMMER * pgm, AVRPART * p) return 0; } -static void serialupdi_disable(PROGRAMMER * pgm) -{ +static void serialupdi_disable(const PROGRAMMER *pgm) { /* Do nothing. */ return; } -static void serialupdi_enable(PROGRAMMER * pgm) -{ +static void serialupdi_enable(PROGRAMMER * pgm, const AVRPART *p) { /* Do nothing. */ return; } -static void serialupdi_display(PROGRAMMER * pgm, const char * p) -{ +static void serialupdi_display(const PROGRAMMER *pgm, const char *p) { return; } -static int serialupdi_cmd(PROGRAMMER * pgm, const unsigned char * cmd, +static int serialupdi_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char * res) { avrdude_message(MSG_INFO, "%s: error: cmd %s[%s] not implemented yet\n", @@ -687,20 +676,19 @@ static int serialupdi_cmd(PROGRAMMER * pgm, const unsigned char * cmd, return -1; } -static int serialupdi_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +static int serialupdi_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { avrdude_message(MSG_INFO, "%s: error: program enable not implemented yet\n", progname); return -1; } -static int serialupdi_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int serialupdi_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value) { return updi_read_byte(pgm, mem->offset + addr, value); } -static int serialupdi_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int serialupdi_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char value) { if (strstr(mem->desc, "fuse") != 0) { @@ -723,7 +711,7 @@ static int serialupdi_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } -static int serialupdi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int serialupdi_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -750,7 +738,7 @@ static int serialupdi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } } -static int serialupdi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int serialupdi_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -806,8 +794,7 @@ static int serialupdi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } } -static int serialupdi_unlock(PROGRAMMER * pgm, AVRPART * p) -{ +static int serialupdi_unlock(const PROGRAMMER *pgm, const AVRPART *p) { /* def unlock(self): """ @@ -875,8 +862,7 @@ static int serialupdi_unlock(PROGRAMMER * pgm, AVRPART * p) return serialupdi_enter_progmode(pgm); } -static int serialupdi_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int serialupdi_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { uint8_t value; if (updi_read_cs(pgm, UPDI_ASI_SYS_STATUS, &value)<0) { @@ -896,7 +882,7 @@ static int serialupdi_chip_erase(PROGRAMMER * pgm, AVRPART * p) return -1; } -static int serialupdi_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int serialupdi_page_erase(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int baseaddr) { avrdude_message(MSG_INFO, "%s: error: page erase not implemented yet\n", @@ -904,7 +890,7 @@ static int serialupdi_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return -1; } -static int serialupdi_read_signature(PROGRAMMER * pgm, AVRPART *p, AVRMEM *m) { +static int serialupdi_read_signature(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m) { uint8_t value; @@ -926,7 +912,7 @@ static int serialupdi_read_signature(PROGRAMMER * pgm, AVRPART *p, AVRMEM *m) { return 3; } -static int serialupdi_read_sib(PROGRAMMER * pgm, AVRPART *p, char *sib) { +static int serialupdi_read_sib(const PROGRAMMER *pgm, const AVRPART *p, char *sib) { updi_sib_info * sib_info = updi_get_sib_info(pgm); @@ -935,8 +921,7 @@ static int serialupdi_read_sib(PROGRAMMER * pgm, AVRPART *p, char *sib) { return 0; } -static int serialupdi_parseextparms(PROGRAMMER * pgm, LISTID extparms) -{ +static int serialupdi_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) { LNODEID ln; const char *extended_param; char rts_mode[5]; @@ -965,8 +950,7 @@ static int serialupdi_parseextparms(PROGRAMMER * pgm, LISTID extparms) return rv; } -void serialupdi_initpgm(PROGRAMMER * pgm) -{ +void serialupdi_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "serialupdi"); /* diff --git a/src/serialupdi.h b/src/serialupdi.h index ff7270d5..701a915f 100644 --- a/src/serialupdi.h +++ b/src/serialupdi.h @@ -34,7 +34,7 @@ extern "C" { #endif extern const char serialupdi_desc[]; -void serialupdi_initpgm (PROGRAMMER * pgm); +void serialupdi_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/stk500.c b/src/stk500.c index 27334297..89667477 100644 --- a/src/stk500.c +++ b/src/stk500.c @@ -45,28 +45,17 @@ #define STK500_XTAL 7372800U #define MAX_SYNC_ATTEMPTS 10 -struct pdata -{ - unsigned char ext_addr_byte; // Record ext-addr byte set in the target device (if used) - int retry_attempts; // Number of connection attempts provided by the user -}; - -#define PDATA(pgm) ((struct pdata *)(pgm->cookie)) +static int stk500_getparm(const PROGRAMMER *pgm, unsigned parm, unsigned *value); +static int stk500_setparm(const PROGRAMMER *pgm, unsigned parm, unsigned value); +static void stk500_print_parms1(const PROGRAMMER *pgm, const char *p); -static int stk500_getparm(PROGRAMMER * pgm, unsigned parm, unsigned * value); -static int stk500_setparm(PROGRAMMER * pgm, unsigned parm, unsigned value); -static void stk500_print_parms1(PROGRAMMER * pgm, const char * p); - - -static int stk500_send(PROGRAMMER * pgm, unsigned char * buf, size_t len) -{ +static int stk500_send(const PROGRAMMER *pgm, unsigned char *buf, size_t len) { return serial_send(&pgm->fd, buf, len); } -static int stk500_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len) -{ +static int stk500_recv(const PROGRAMMER *pgm, unsigned char *buf, size_t len) { int rv; rv = serial_recv(&pgm->fd, buf, len); @@ -79,14 +68,12 @@ static int stk500_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len) } -int stk500_drain(PROGRAMMER * pgm, int display) -{ +int stk500_drain(const PROGRAMMER *pgm, int display) { return serial_drain(&pgm->fd, display); } -int stk500_getsync(PROGRAMMER * pgm) -{ +int stk500_getsync(const PROGRAMMER *pgm) { unsigned char buf[32], resp[32]; int attempt; int max_sync_attempts; @@ -148,7 +135,7 @@ int stk500_getsync(PROGRAMMER * pgm) * transmit an AVR device command and return the results; 'cmd' and * 'res' must point to at least a 4 byte data buffer */ -static int stk500_cmd(PROGRAMMER * pgm, const unsigned char *cmd, +static int stk500_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { unsigned char buf[32]; @@ -190,8 +177,7 @@ static int stk500_cmd(PROGRAMMER * pgm, const unsigned char *cmd, /* * issue the 'chip erase' command to the AVR device */ -static int stk500_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4]; unsigned char res[4]; @@ -224,8 +210,7 @@ static int stk500_chip_erase(PROGRAMMER * pgm, AVRPART * p) /* * issue the 'program enable' command to the AVR device */ -static int stk500_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char buf[16]; int tries=0; @@ -283,7 +268,7 @@ static int stk500_program_enable(PROGRAMMER * pgm, AVRPART * p) -static int stk500_set_extended_parms(PROGRAMMER * pgm, int n, +static int stk500_set_extended_parms(const PROGRAMMER *pgm, int n, unsigned char * cmd) { unsigned char buf[16]; @@ -351,8 +336,7 @@ static int stk500_set_extended_parms(PROGRAMMER * pgm, int n, * Crossbow MIB510 initialization and shutdown. Use cmd = 1 to * initialize, cmd = 0 to close. */ -static int mib510_isp(PROGRAMMER * pgm, unsigned char cmd) -{ +static int mib510_isp(const PROGRAMMER *pgm, unsigned char cmd) { unsigned char buf[9]; int tries = 0; @@ -420,8 +404,7 @@ static int mib510_isp(PROGRAMMER * pgm, unsigned char cmd) /* * initialize the AVR device and prepare it to accept commands */ -static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500_initialize(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char buf[32]; AVRMEM * m; int tries; @@ -609,7 +592,7 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p) return pgm->program_enable(pgm, p); } -static int stk500_parseextparms(PROGRAMMER * pgm, LISTID extparms) +static int stk500_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) { LNODEID ln; const char *extended_param; @@ -634,8 +617,7 @@ static int stk500_parseextparms(PROGRAMMER * pgm, LISTID extparms) return rv; } -static void stk500_disable(PROGRAMMER * pgm) -{ +static void stk500_disable(const PROGRAMMER *pgm) { unsigned char buf[16]; int tries=0; @@ -683,14 +665,12 @@ static void stk500_disable(PROGRAMMER * pgm) return; } -static void stk500_enable(PROGRAMMER * pgm) -{ +static void stk500_enable(PROGRAMMER *pgm, const AVRPART *p) { return; } -static int stk500_open(PROGRAMMER * pgm, char * port) -{ +static int stk500_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; strcpy(pgm->port, port); pinfo.serialinfo.baud = pgm->baudrate? pgm->baudrate: 115200; @@ -727,8 +707,7 @@ static void stk500_close(PROGRAMMER * pgm) } -static int stk500_loadaddr(PROGRAMMER * pgm, AVRMEM * mem, unsigned int addr) -{ +static int stk500_loadaddr(const PROGRAMMER *pgm, const AVRMEM *mem, const unsigned int addr) { unsigned char buf[16]; int tries; unsigned char ext_byte; @@ -791,7 +770,7 @@ static int stk500_loadaddr(PROGRAMMER * pgm, AVRMEM * mem, unsigned int addr) } -static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -887,7 +866,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return n_bytes; } -static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -984,8 +963,7 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } -static int stk500_set_vtarget(PROGRAMMER * pgm, double v) -{ +static int stk500_set_vtarget(const PROGRAMMER *pgm, double v) { unsigned uaref, utarg; utarg = (unsigned)((v + 0.049) * 10); @@ -1007,7 +985,7 @@ static int stk500_set_vtarget(PROGRAMMER * pgm, double v) } -static int stk500_set_varef(PROGRAMMER * pgm, unsigned int chan /* unused */, +static int stk500_set_varef(const PROGRAMMER *pgm, unsigned int chan /* unused */, double v) { unsigned uaref, utarg; @@ -1030,8 +1008,7 @@ static int stk500_set_varef(PROGRAMMER * pgm, unsigned int chan /* unused */, } -static int stk500_set_fosc(PROGRAMMER * pgm, double v) -{ +static int stk500_set_fosc(const PROGRAMMER *pgm, double v) { unsigned prescale, cmatch, fosc; static unsigned ps[] = { 1, 8, 32, 64, 128, 256, 1024 @@ -1087,8 +1064,7 @@ static int stk500_set_fosc(PROGRAMMER * pgm, double v) For small duration values, the actual SCK width is larger than expected. As the duration value increases, the SCK width error diminishes. */ -static int stk500_set_sck_period(PROGRAMMER * pgm, double v) -{ +static int stk500_set_sck_period(const PROGRAMMER *pgm, double v) { int dur; double min, max; @@ -1110,8 +1086,7 @@ static int stk500_set_sck_period(PROGRAMMER * pgm, double v) } -static int stk500_getparm(PROGRAMMER * pgm, unsigned parm, unsigned * value) -{ +static int stk500_getparm(const PROGRAMMER *pgm, unsigned parm, unsigned *value) { unsigned char buf[16]; unsigned v; int tries = 0; @@ -1167,8 +1142,7 @@ static int stk500_getparm(PROGRAMMER * pgm, unsigned parm, unsigned * value) } -static int stk500_setparm(PROGRAMMER * pgm, unsigned parm, unsigned value) -{ +static int stk500_setparm(const PROGRAMMER *pgm, unsigned parm, unsigned value) { unsigned char buf[16]; int tries = 0; @@ -1222,8 +1196,7 @@ static int stk500_setparm(PROGRAMMER * pgm, unsigned parm, unsigned value) } -static void stk500_display(PROGRAMMER * pgm, const char * p) -{ +static void stk500_display(const PROGRAMMER *pgm, const char *p) { unsigned maj, min, hdw, topcard; stk500_getparm(pgm, Parm_STK_HW_VER, &hdw); @@ -1254,8 +1227,7 @@ static void stk500_display(PROGRAMMER * pgm, const char * p) } -static void stk500_print_parms1(PROGRAMMER * pgm, const char * p) -{ +static void stk500_print_parms1(const PROGRAMMER *pgm, const char *p) { unsigned vtarget, vadjust, osc_pscale, osc_cmatch, sck_duration; stk500_getparm(pgm, Parm_STK_VTARGET, &vtarget); @@ -1301,8 +1273,7 @@ static void stk500_print_parms1(PROGRAMMER * pgm, const char * p) } -static void stk500_print_parms(PROGRAMMER * pgm) -{ +static void stk500_print_parms(const PROGRAMMER *pgm) { stk500_print_parms1(pgm, ""); } @@ -1314,8 +1285,8 @@ static void stk500_setup(PROGRAMMER * pgm) return; } memset(pgm->cookie, 0, sizeof(struct pdata)); - PDATA(pgm)->ext_addr_byte = 0xff; /* Ensures it is programmed before - * first memory address */ + PDATA(pgm)->ext_addr_byte = 0xff; + PDATA(pgm)->xbeeResetPin = XBEE_DEFAULT_RESET_PIN; } static void stk500_teardown(PROGRAMMER * pgm) @@ -1325,8 +1296,7 @@ static void stk500_teardown(PROGRAMMER * pgm) const char stk500_desc[] = "Atmel STK500 Version 1.x firmware"; -void stk500_initpgm(PROGRAMMER * pgm) -{ +void stk500_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "STK500"); /* diff --git a/src/stk500.h b/src/stk500.h index d0bce452..3d28b064 100644 --- a/src/stk500.h +++ b/src/stk500.h @@ -26,16 +26,26 @@ extern "C" { #endif extern const char stk500_desc[]; -void stk500_initpgm (PROGRAMMER * pgm); +void stk500_initpgm(PROGRAMMER *pgm); /* used by arduino.c to avoid duplicate code */ -int stk500_getsync(PROGRAMMER * pgm); -int stk500_drain(PROGRAMMER * pgm, int display); +int stk500_getsync(const PROGRAMMER *pgm); +int stk500_drain(const PROGRAMMER *pgm, int display); #ifdef __cplusplus } #endif +#include "xbee.h" + +struct pdata { + unsigned char ext_addr_byte; // Record ext-addr byte set in the target device (if used) + int retry_attempts; // Number of connection attempts provided by the user + int xbeeResetPin; // Piggy back variable used by xbee programmmer +}; + +#define PDATA(pgm) ((struct pdata *)(pgm->cookie)) + #endif diff --git a/src/stk500generic.c b/src/stk500generic.c index 9c1ea403..76031f7d 100644 --- a/src/stk500generic.c +++ b/src/stk500generic.c @@ -38,8 +38,7 @@ #include "stk500.h" #include "stk500v2.h" -static int stk500generic_open(PROGRAMMER * pgm, char * port) -{ +static int stk500generic_open(PROGRAMMER *pgm, const char *port) { stk500_initpgm(pgm); if (pgm->open(pgm, port) >= 0) { @@ -80,8 +79,7 @@ static void stk500generic_teardown(PROGRAMMER * pgm) const char stk500generic_desc[] = "Atmel STK500, autodetect firmware version"; -void stk500generic_initpgm(PROGRAMMER * pgm) -{ +void stk500generic_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "STK500GENERIC"); pgm->open = stk500generic_open; diff --git a/src/stk500generic.h b/src/stk500generic.h index 0c059012..c970ac42 100644 --- a/src/stk500generic.h +++ b/src/stk500generic.h @@ -22,7 +22,7 @@ #define stk500generic_h__ extern const char stk500generic_desc[]; -void stk500generic_initpgm (PROGRAMMER * pgm); +void stk500generic_initpgm(PROGRAMMER *pgm); #endif diff --git a/src/stk500v2.c b/src/stk500v2.c index 8f16ae41..bdff4612 100644 --- a/src/stk500v2.c +++ b/src/stk500v2.c @@ -257,29 +257,29 @@ static const struct carddata socket_cards[] = { 0xF1, "STK600-DIP" }, }; -static int stk500v2_getparm(PROGRAMMER * pgm, unsigned char parm, unsigned char * value); -static int stk500v2_setparm(PROGRAMMER * pgm, unsigned char parm, unsigned char value); -static int stk500v2_getparm2(PROGRAMMER * pgm, unsigned char parm, unsigned int * value); -static int stk500v2_setparm2(PROGRAMMER * pgm, unsigned char parm, unsigned int value); -static int stk500v2_setparm_real(PROGRAMMER * pgm, unsigned char parm, unsigned char value); -static void stk500v2_print_parms1(PROGRAMMER * pgm, const char * p); -static int stk500v2_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500v2_getparm(const PROGRAMMER *pgm, unsigned char parm, unsigned char *value); +static int stk500v2_setparm(const PROGRAMMER *pgm, unsigned char parm, unsigned char value); +static int stk500v2_getparm2(const PROGRAMMER *pgm, unsigned char parm, unsigned int *value); +static int stk500v2_setparm2(const PROGRAMMER *pgm, unsigned char parm, unsigned int value); +static int stk500v2_setparm_real(const PROGRAMMER *pgm, unsigned char parm, unsigned char value); +static void stk500v2_print_parms1(const PROGRAMMER *pgm, const char *p); +static int stk500v2_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -static int stk500v2_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500v2_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes); static unsigned int stk500v2_mode_for_pagesize(unsigned int pagesize); -static double stk500v2_sck_to_us(PROGRAMMER * pgm, unsigned char dur); -static int stk500v2_set_sck_period_mk2(PROGRAMMER * pgm, double v); +static double stk500v2_sck_to_us(const PROGRAMMER *pgm, unsigned char dur); +static int stk500v2_set_sck_period_mk2(const PROGRAMMER *pgm, double v); -static int stk600_set_sck_period(PROGRAMMER * pgm, double v); +static int stk600_set_sck_period(const PROGRAMMER *pgm, double v); -static void stk600_setup_xprog(PROGRAMMER * pgm); -static void stk600_setup_isp(PROGRAMMER * pgm); -static int stk600_xprog_program_enable(PROGRAMMER * pgm, AVRPART * p); +static void stk600_setup_xprog(PROGRAMMER *pgm); +static void stk600_setup_isp(PROGRAMMER *pgm); +static int stk600_xprog_program_enable(const PROGRAMMER *pgm, const AVRPART *p); void stk500v2_setup(PROGRAMMER * pgm) { @@ -380,8 +380,7 @@ b2_to_u16(unsigned char *b) return l; } -static int stk500v2_send_mk2(PROGRAMMER * pgm, unsigned char * data, size_t len) -{ +static int stk500v2_send_mk2(const PROGRAMMER *pgm, unsigned char *data, size_t len) { if (serial_send(&pgm->fd, data, len) != 0) { avrdude_message(MSG_INFO, "%s: stk500_send_mk2(): failed to send command to serial port\n",progname); return -1; @@ -405,12 +404,10 @@ static unsigned short get_jtagisp_return_size(unsigned char cmd) * response buffer prepended, and replies with RSP_SPI_DATA * if successful. */ -static int stk500v2_jtagmkII_send(PROGRAMMER * pgm, unsigned char * data, size_t len) -{ +static int stk500v2_jtagmkII_send(const PROGRAMMER *pgm, unsigned char *data, size_t len) { unsigned char *cmdbuf; int rv; unsigned short sz; - void *mycookie; sz = get_jtagisp_return_size(data[0]); if (sz == 0) { @@ -438,15 +435,15 @@ static int stk500v2_jtagmkII_send(PROGRAMMER * pgm, unsigned char * data, size_t progname); exit(1); } - mycookie = pgm->cookie; - pgm->cookie = PDATA(pgm)->chained_pdata; + PROGRAMMER *pgmcp = pgm_dup(pgm); + pgmcp->cookie = PDATA(pgm)->chained_pdata; cmdbuf[0] = CMND_ISP_PACKET; cmdbuf[1] = sz & 0xff; cmdbuf[2] = (sz >> 8) & 0xff; memcpy(cmdbuf + 3, data, len); - rv = jtagmkII_send(pgm, cmdbuf, len + 3); + rv = jtagmkII_send(pgmcp, cmdbuf, len + 3); free(cmdbuf); - pgm->cookie = mycookie; + pgm_free(pgmcp); return rv; } @@ -454,30 +451,28 @@ static int stk500v2_jtagmkII_send(PROGRAMMER * pgm, unsigned char * data, size_t /* * Send the data as a JTAGICE3 encapsulated ISP packet. */ -static int stk500v2_jtag3_send(PROGRAMMER * pgm, unsigned char * data, size_t len) -{ +static int stk500v2_jtag3_send(const PROGRAMMER *pgm, unsigned char *data, size_t len) { unsigned char *cmdbuf; int rv; - void *mycookie; if ((cmdbuf = malloc(len + 1)) == NULL) { avrdude_message(MSG_INFO, "%s: out of memory for command packet\n", progname); exit(1); } - mycookie = pgm->cookie; - pgm->cookie = PDATA(pgm)->chained_pdata; + + PROGRAMMER *pgmcp = pgm_dup(pgm); + pgmcp->cookie = PDATA(pgm)->chained_pdata; cmdbuf[0] = SCOPE_AVR_ISP; memcpy(cmdbuf + 1, data, len); - rv = jtag3_send(pgm, cmdbuf, len + 1); + rv = jtag3_send(pgmcp, cmdbuf, len + 1); free(cmdbuf); - pgm->cookie = mycookie; + pgm_free(pgmcp); return rv; } -static int stk500v2_send(PROGRAMMER * pgm, unsigned char * data, size_t len) -{ +static int stk500v2_send(const PROGRAMMER *pgm, unsigned char *data, size_t len) { unsigned char buf[275 + 6]; // max MESSAGE_BODY of 275 bytes, 6 bytes overhead if (PDATA(pgm)->pgmtype == PGMTYPE_AVRISP_MKII || @@ -514,12 +509,11 @@ static int stk500v2_send(PROGRAMMER * pgm, unsigned char * data, size_t len) } -int stk500v2_drain(PROGRAMMER * pgm, int display) -{ +int stk500v2_drain(const PROGRAMMER *pgm, int display) { return serial_drain(&pgm->fd, display); } -static int stk500v2_recv_mk2(PROGRAMMER * pgm, unsigned char *msg, +static int stk500v2_recv_mk2(const PROGRAMMER *pgm, unsigned char *msg, size_t maxsize) { int rv; @@ -533,17 +527,16 @@ static int stk500v2_recv_mk2(PROGRAMMER * pgm, unsigned char *msg, return rv; } -static int stk500v2_jtagmkII_recv(PROGRAMMER * pgm, unsigned char *msg, +static int stk500v2_jtagmkII_recv(const PROGRAMMER *pgm, unsigned char *msg, size_t maxsize) { int rv; unsigned char *jtagmsg; - void *mycookie; - mycookie = pgm->cookie; - pgm->cookie = PDATA(pgm)->chained_pdata; - rv = jtagmkII_recv(pgm, &jtagmsg); - pgm->cookie = mycookie; + PROGRAMMER *pgmcp = pgm_dup(pgm); + pgmcp->cookie = PDATA(pgm)->chained_pdata; + rv = jtagmkII_recv(pgmcp, &jtagmsg); + pgm_free(pgmcp); if (rv <= 0) { avrdude_message(MSG_INFO, "%s: stk500v2_jtagmkII_recv(): error in jtagmkII_recv()\n", progname); @@ -575,17 +568,17 @@ static int stk500v2_jtagmkII_recv(PROGRAMMER * pgm, unsigned char *msg, return rv; } -static int stk500v2_jtag3_recv(PROGRAMMER * pgm, unsigned char *msg, +static int stk500v2_jtag3_recv(const PROGRAMMER *pgm, unsigned char *msg, size_t maxsize) { int rv; unsigned char *jtagmsg; - void *mycookie; - mycookie = pgm->cookie; - pgm->cookie = PDATA(pgm)->chained_pdata; - rv = jtag3_recv(pgm, &jtagmsg); - pgm->cookie = mycookie; + PROGRAMMER *pgmcp = pgm_dup(pgm); + pgmcp->cookie = PDATA(pgm)->chained_pdata; + rv = jtag3_recv(pgmcp, &jtagmsg); + pgm_free(pgmcp); + if (rv <= 0) { avrdude_message(MSG_INFO, "%s: stk500v2_jtag3_recv(): error in jtagmkII_recv()\n", progname); @@ -611,7 +604,7 @@ static int stk500v2_jtag3_recv(PROGRAMMER * pgm, unsigned char *msg, return rv; } -static int stk500v2_recv(PROGRAMMER * pgm, unsigned char *msg, size_t maxsize) { +static int stk500v2_recv(const PROGRAMMER *pgm, unsigned char *msg, size_t maxsize) { enum states { sINIT, sSTART, sSEQNUM, sSIZE1, sSIZE2, sTOKEN, sDATA, sCSUM, sDONE } state = sSTART; unsigned int msglen = 0; unsigned int curlen = 0; @@ -731,7 +724,7 @@ static int stk500v2_recv(PROGRAMMER * pgm, unsigned char *msg, size_t maxsize) { -int stk500v2_getsync(PROGRAMMER * pgm) { +int stk500v2_getsync(const PROGRAMMER *pgm) { int tries = 0; unsigned char buf[1], resp[32]; int status; @@ -810,7 +803,7 @@ retry: return 0; } -static int stk500v2_command(PROGRAMMER * pgm, unsigned char * buf, +static int stk500v2_command(const PROGRAMMER *pgm, unsigned char *buf, size_t len, size_t maxlen) { int tries = 0; int status; @@ -923,7 +916,7 @@ retry: return 0; } -static int stk500v2_cmd(PROGRAMMER * pgm, const unsigned char *cmd, +static int stk500v2_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { unsigned char buf[8]; @@ -960,7 +953,7 @@ static int stk500v2_cmd(PROGRAMMER * pgm, const unsigned char *cmd, } -static int stk500v2_jtag3_cmd(PROGRAMMER * pgm, const unsigned char *cmd, +static int stk500v2_jtag3_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { avrdude_message(MSG_INFO, "%s: stk500v2_jtag3_cmd(): Not available in JTAGICE3\n", @@ -973,8 +966,7 @@ static int stk500v2_jtag3_cmd(PROGRAMMER * pgm, const unsigned char *cmd, /* * issue the 'chip erase' command to the AVR device */ -static int stk500v2_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500v2_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { int result; unsigned char buf[16]; @@ -1003,8 +995,7 @@ static int stk500v2_chip_erase(PROGRAMMER * pgm, AVRPART * p) /* * issue the 'chip erase' command to the AVR device, generic HV mode */ -static int stk500hv_chip_erase(PROGRAMMER * pgm, AVRPART * p, enum hvmode mode) -{ +static int stk500hv_chip_erase(const PROGRAMMER *pgm, const AVRPART *p, enum hvmode mode) { int result; unsigned char buf[3]; @@ -1031,16 +1022,14 @@ static int stk500hv_chip_erase(PROGRAMMER * pgm, AVRPART * p, enum hvmode mode) /* * issue the 'chip erase' command to the AVR device, parallel mode */ -static int stk500pp_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500pp_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { return stk500hv_chip_erase(pgm, p, PPMODE); } /* * issue the 'chip erase' command to the AVR device, HVSP mode */ -static int stk500hvsp_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500hvsp_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { return stk500hv_chip_erase(pgm, p, HVSPMODE); } @@ -1091,8 +1080,7 @@ stk500v2_translate_conn_status(unsigned char status, char *msg) /* * issue the 'program enable' command to the AVR device */ -static int stk500v2_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500v2_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char buf[16]; char msg[100]; /* see remarks above about size needed */ int rv, tries; @@ -1144,19 +1132,18 @@ retry: case PGMTYPE_JTAGICE3: if (buf[1] == STATUS_CMD_FAILED && (p->flags & AVRPART_HAS_DW) != 0) { - void *mycookie; unsigned char cmd[4], *resp; /* Try debugWIRE, and MONCON_DISABLE */ avrdude_message(MSG_NOTICE2, "%s: No response in ISP mode, trying debugWIRE\n", progname); - mycookie = pgm->cookie; - pgm->cookie = PDATA(pgm)->chained_pdata; + PROGRAMMER *pgmcp = pgm_dup(pgm); + pgmcp->cookie = PDATA(pgm)->chained_pdata; cmd[0] = PARM3_CONN_DW; - if (jtag3_setparm(pgm, SCOPE_AVR, 1, PARM3_CONNECTION, cmd, 1) < 0) { - pgm->cookie = mycookie; + if (jtag3_setparm(pgmcp, SCOPE_AVR, 1, PARM3_CONNECTION, cmd, 1) < 0) { + pgm_free(pgmcp); break; } @@ -1164,19 +1151,19 @@ retry: cmd[1] = CMD3_SIGN_ON; cmd[2] = cmd[3] = 0; - if (jtag3_command(pgm, cmd, 4, &resp, "AVR sign-on") >= 0) { + if (jtag3_command(pgmcp, cmd, 4, &resp, "AVR sign-on") >= 0) { free(resp); cmd[1] = CMD3_START_DW_DEBUG; - if (jtag3_command(pgm, cmd, 4, &resp, "start DW debug") >= 0) { + if (jtag3_command(pgmcp, cmd, 4, &resp, "start DW debug") >= 0) { free(resp); cmd[1] = CMD3_MONCON_DISABLE; - if (jtag3_command(pgm, cmd, 3, &resp, "MonCon disable") >= 0) + if (jtag3_command(pgmcp, cmd, 3, &resp, "MonCon disable") >= 0) free(resp); } } - pgm->cookie = mycookie; + pgm_free(pgmcp); if (tries++ > 3) { avrdude_message(MSG_INFO, "%s: Failed to return from debugWIRE to ISP.\n", progname); @@ -1201,8 +1188,7 @@ retry: /* * issue the 'program enable' command to the AVR device, parallel mode */ -static int stk500pp_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500pp_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char buf[16]; PDATA(pgm)->lastpart = p; @@ -1222,8 +1208,7 @@ static int stk500pp_program_enable(PROGRAMMER * pgm, AVRPART * p) /* * issue the 'program enable' command to the AVR device, HVSP mode */ -static int stk500hvsp_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500hvsp_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char buf[16]; PDATA(pgm)->lastpart = p; @@ -1247,8 +1232,7 @@ static int stk500hvsp_program_enable(PROGRAMMER * pgm, AVRPART * p) /* * initialize the AVR device and prepare it to accept commands */ -static int stk500v2_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500v2_initialize(const PROGRAMMER *pgm, const AVRPART *p) { LNODEID ln; AVRMEM * m; @@ -1274,9 +1258,9 @@ static int stk500v2_initialize(PROGRAMMER * pgm, AVRPART * p) PDATA(pgm)->boot_start = bootmem->offset - flashmem->offset; } } - stk600_setup_xprog(pgm); + // stk600_setup_xprog(pgm); [moved to pgm->enable()] } else { - stk600_setup_isp(pgm); + // stk600_setup_isp(pgm); [moved to pgm->enable()] } /* @@ -1331,12 +1315,10 @@ static int stk500v2_initialize(PROGRAMMER * pgm, AVRPART * p) /* * initialize the AVR device and prepare it to accept commands */ -static int stk500v2_jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500v2_jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char parm[4], *resp; LNODEID ln; AVRMEM * m; - void *mycookie; if ((p->flags & AVRPART_HAS_PDI) || (p->flags & AVRPART_HAS_TPI)) { @@ -1345,38 +1327,38 @@ static int stk500v2_jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) return -1; } - mycookie = pgm->cookie; - pgm->cookie = PDATA(pgm)->chained_pdata; + PROGRAMMER *pgmcp = pgm_dup(pgm); + pgmcp->cookie = PDATA(pgm)->chained_pdata; if (p->flags & AVRPART_HAS_DW) parm[0] = PARM3_ARCH_TINY; else parm[0] = PARM3_ARCH_MEGA; - if (jtag3_setparm(pgm, SCOPE_AVR, 0, PARM3_ARCH, parm, 1) < 0) { - pgm->cookie = mycookie; + if (jtag3_setparm(pgmcp, SCOPE_AVR, 0, PARM3_ARCH, parm, 1) < 0) { + pgm_free(pgmcp); return -1; } parm[0] = PARM3_SESS_PROGRAMMING; - if (jtag3_setparm(pgm, SCOPE_AVR, 0, PARM3_SESS_PURPOSE, parm, 1) < 0) { - pgm->cookie = mycookie; + if (jtag3_setparm(pgmcp, SCOPE_AVR, 0, PARM3_SESS_PURPOSE, parm, 1) < 0) { + pgm_free(pgmcp); return -1; } parm[0] = PARM3_CONN_ISP; - if (jtag3_setparm(pgm, SCOPE_AVR, 1, PARM3_CONNECTION, parm, 1) < 0) { - pgm->cookie = mycookie; + if (jtag3_setparm(pgmcp, SCOPE_AVR, 1, PARM3_CONNECTION, parm, 1) < 0) { + pgm_free(pgmcp); return -1; } parm[0] = SCOPE_AVR_ISP; parm[1] = 0x1e; - jtag3_send(pgm, parm, 2); + jtag3_send(pgmcp, parm, 2); - if (jtag3_recv(pgm, &resp) > 0) + if (jtag3_recv(pgmcp, &resp) > 0) free(resp); - pgm->cookie = mycookie; + free(pgmcp); /* * Examine the avrpart's memory definitions, and initialize the page @@ -1421,8 +1403,7 @@ static int stk500v2_jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) /* * initialize the AVR device and prepare it to accept commands, generic HV mode */ -static int stk500hv_initialize(PROGRAMMER * pgm, AVRPART * p, enum hvmode mode) -{ +static int stk500hv_initialize(const PROGRAMMER *pgm, const AVRPART *p, enum hvmode mode) { unsigned char buf[CTL_STACK_SIZE + 1]; int result; LNODEID ln; @@ -1491,21 +1472,18 @@ static int stk500hv_initialize(PROGRAMMER * pgm, AVRPART * p, enum hvmode mode) /* * initialize the AVR device and prepare it to accept commands, PP mode */ -static int stk500pp_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500pp_initialize(const PROGRAMMER *pgm, const AVRPART *p) { return stk500hv_initialize(pgm, p, PPMODE); } /* * initialize the AVR device and prepare it to accept commands, HVSP mode */ -static int stk500hvsp_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk500hvsp_initialize(const PROGRAMMER *pgm, const AVRPART *p) { return stk500hv_initialize(pgm, p, HVSPMODE); } -static void stk500v2_jtag3_disable(PROGRAMMER * pgm) -{ +static void stk500v2_jtag3_disable(const PROGRAMMER *pgm) { unsigned char buf[16]; int result; @@ -1528,8 +1506,7 @@ static void stk500v2_jtag3_disable(PROGRAMMER * pgm) return; } -static void stk500v2_disable(PROGRAMMER * pgm) -{ +static void stk500v2_disable(const PROGRAMMER *pgm) { unsigned char buf[16]; int result; @@ -1550,8 +1527,7 @@ static void stk500v2_disable(PROGRAMMER * pgm) /* * Leave programming mode, generic HV mode */ -static void stk500hv_disable(PROGRAMMER * pgm, enum hvmode mode) -{ +static void stk500hv_disable(const PROGRAMMER *pgm, enum hvmode mode) { unsigned char buf[16]; int result; @@ -1581,27 +1557,35 @@ static void stk500hv_disable(PROGRAMMER * pgm, enum hvmode mode) /* * Leave programming mode, PP mode */ -static void stk500pp_disable(PROGRAMMER * pgm) -{ +static void stk500pp_disable(const PROGRAMMER *pgm) { stk500hv_disable(pgm, PPMODE); } /* * Leave programming mode, HVSP mode */ -static void stk500hvsp_disable(PROGRAMMER * pgm) -{ +static void stk500hvsp_disable(const PROGRAMMER *pgm) { stk500hv_disable(pgm, HVSPMODE); } -static void stk500v2_enable(PROGRAMMER * pgm) -{ +static void stk500v2_enable(PROGRAMMER *pgm, const AVRPART *p) { + // Previously stk500v2_initialize() set up pgm + if(pgm->initialize == stk500v2_initialize) { + if((PDATA(pgm)->pgmtype == PGMTYPE_STK600 || + PDATA(pgm)->pgmtype == PGMTYPE_AVRISP_MKII || + PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE_MKII) != 0 + && (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_TPI)) != 0) { + stk600_setup_xprog(pgm); + } else { + stk600_setup_isp(pgm); + } + } + return; } -static int stk500v2_open(PROGRAMMER * pgm, char * port) -{ +static int stk500v2_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo = { .serialinfo.baud = 115200, .serialinfo.cflags = SERIAL_8N1 }; DEBUG("STK500V2: stk500v2_open()\n"); @@ -1668,8 +1652,7 @@ static int stk500v2_open(PROGRAMMER * pgm, char * port) } -static int stk600_open(PROGRAMMER * pgm, char * port) -{ +static int stk600_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo = { .serialinfo.baud = 115200, .serialinfo.cflags = SERIAL_8N1 }; DEBUG("STK500V2: stk600_open()\n"); @@ -1726,8 +1709,7 @@ static int stk600_open(PROGRAMMER * pgm, char * port) } -static void stk500v2_close(PROGRAMMER * pgm) -{ +static void stk500v2_close(PROGRAMMER *pgm) { DEBUG("STK500V2: stk500v2_close()\n"); serial_close(&pgm->fd); @@ -1735,8 +1717,7 @@ static void stk500v2_close(PROGRAMMER * pgm) } -static int stk500v2_loadaddr(PROGRAMMER * pgm, unsigned int addr) -{ +static int stk500v2_loadaddr(const PROGRAMMER *pgm, unsigned int addr) { unsigned char buf[16]; int result; @@ -1763,7 +1744,7 @@ static int stk500v2_loadaddr(PROGRAMMER * pgm, unsigned int addr) /* * Read a single byte, generic HV mode */ -static int stk500hv_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int stk500hv_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value, enum hvmode mode) { @@ -1872,7 +1853,7 @@ static int stk500hv_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, /* * Read a single byte, PP mode */ -static int stk500pp_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int stk500pp_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value) { return stk500hv_read_byte(pgm, p, mem, addr, value, PPMODE); @@ -1881,7 +1862,7 @@ static int stk500pp_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, /* * Read a single byte, HVSP mode */ -static int stk500hvsp_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int stk500hvsp_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value) { return stk500hv_read_byte(pgm, p, mem, addr, value, HVSPMODE); @@ -1893,7 +1874,7 @@ static int stk500hvsp_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, * By now, only used on the JTAGICE3 which does not implement the * CMD_SPI_MULTI SPI passthrough command. */ -static int stk500isp_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int stk500isp_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value) { int result, pollidx; @@ -1991,7 +1972,7 @@ static int stk500isp_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, /* * Write one byte, generic HV mode */ -static int stk500hv_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int stk500hv_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data, enum hvmode mode) { @@ -2132,7 +2113,7 @@ static int stk500hv_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, /* * Write one byte, PP mode */ -static int stk500pp_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int stk500pp_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data) { return stk500hv_write_byte(pgm, p, mem, addr, data, PPMODE); @@ -2141,7 +2122,7 @@ static int stk500pp_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, /* * Write one byte, HVSP mode */ -static int stk500hvsp_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int stk500hvsp_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data) { return stk500hv_write_byte(pgm, p, mem, addr, data, HVSPMODE); @@ -2151,7 +2132,7 @@ static int stk500hvsp_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, /* * Write one byte, ISP mode */ -static int stk500isp_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int stk500isp_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data) { int result; @@ -2258,7 +2239,7 @@ static int stk500isp_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, return 0; } -static int stk500v2_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500v2_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -2393,7 +2374,7 @@ static int stk500v2_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, /* * Write pages of flash/EEPROM, generic HV mode */ -static int stk500hv_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500hv_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes, enum hvmode mode) @@ -2488,7 +2469,7 @@ static int stk500hv_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, /* * Write pages of flash/EEPROM, PP mode */ -static int stk500pp_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500pp_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -2498,14 +2479,14 @@ static int stk500pp_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, /* * Write pages of flash/EEPROM, HVSP mode */ -static int stk500hvsp_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500hvsp_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { return stk500hv_paged_write(pgm, p, m, page_size, addr, n_bytes, HVSPMODE); } -static int stk500v2_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500v2_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -2600,7 +2581,7 @@ static int stk500v2_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, /* * Read pages of flash/EEPROM, generic HV mode */ -static int stk500hv_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500hv_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes, enum hvmode mode) @@ -2679,7 +2660,7 @@ static int stk500hv_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, /* * Read pages of flash/EEPROM, PP mode */ -static int stk500pp_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500pp_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -2689,7 +2670,7 @@ static int stk500pp_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, /* * Read pages of flash/EEPROM, HVSP mode */ -static int stk500hvsp_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500hvsp_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -2697,7 +2678,7 @@ static int stk500hvsp_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, } -static int stk500v2_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk500v2_page_erase(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int addr) { avrdude_message(MSG_INFO, "%s: stk500v2_page_erase(): this function must never be called\n", @@ -2705,8 +2686,7 @@ static int stk500v2_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return -1; } -static int stk500v2_set_vtarget(PROGRAMMER * pgm, double v) -{ +static int stk500v2_set_vtarget(const PROGRAMMER *pgm, double v) { unsigned char uaref, utarg; utarg = (unsigned)((v + 0.049) * 10); @@ -2728,7 +2708,7 @@ static int stk500v2_set_vtarget(PROGRAMMER * pgm, double v) } -static int stk500v2_set_varef(PROGRAMMER * pgm, unsigned int chan /* unused */, +static int stk500v2_set_varef(const PROGRAMMER *pgm, unsigned int chan /* unused */, double v) { unsigned char uaref, utarg; @@ -2751,8 +2731,7 @@ static int stk500v2_set_varef(PROGRAMMER * pgm, unsigned int chan /* unused */, } -static int stk500v2_set_fosc(PROGRAMMER * pgm, double v) -{ +static int stk500v2_set_fosc(const PROGRAMMER *pgm, double v) { int fosc; unsigned char prescale, cmatch; static unsigned ps[] = { @@ -2825,8 +2804,7 @@ static double avrispmkIIfreqs[] = { 65.0, 61.9, 59.0, 56.3, 53.6, 51.1 }; -static int stk500v2_set_sck_period_mk2(PROGRAMMER * pgm, double v) -{ +static int stk500v2_set_sck_period_mk2(const PROGRAMMER *pgm, double v) { size_t i; for (i = 0; i < sizeof(avrispmkIIfreqs) / sizeof(avrispmkIIfreqs[0]); i++) { @@ -2879,8 +2857,7 @@ static unsigned int stk500v2_mode_for_pagesize(unsigned int pagesize) * uses a different algorithm below), it's probably not worth the * hassle. */ -static int stk500v2_set_sck_period(PROGRAMMER * pgm, double v) -{ +static int stk500v2_set_sck_period(const PROGRAMMER *pgm, double v) { unsigned int d; unsigned char dur; double f = 1 / v; @@ -2902,8 +2879,7 @@ static int stk500v2_set_sck_period(PROGRAMMER * pgm, double v) return stk500v2_setparm(pgm, PARAM_SCK_DURATION, dur); } -static double stk500v2_sck_to_us(PROGRAMMER * pgm, unsigned char dur) -{ +static double stk500v2_sck_to_us(const PROGRAMMER *pgm, unsigned char dur) { double x; if (dur == 0) @@ -2923,8 +2899,7 @@ static double stk500v2_sck_to_us(PROGRAMMER * pgm, unsigned char dur) } -static int stk600_set_vtarget(PROGRAMMER * pgm, double v) -{ +static int stk600_set_vtarget(const PROGRAMMER *pgm, double v) { unsigned char utarg; unsigned int uaref; int rv; @@ -2975,8 +2950,7 @@ static int stk600_set_vtarget(PROGRAMMER * pgm, double v) } -static int stk600_set_varef(PROGRAMMER * pgm, unsigned int chan, double v) -{ +static int stk600_set_varef(const PROGRAMMER *pgm, unsigned int chan, double v) { unsigned char utarg; unsigned int uaref; @@ -3011,8 +2985,7 @@ static int stk600_set_varef(PROGRAMMER * pgm, unsigned int chan, double v) } -static int stk600_set_fosc(PROGRAMMER * pgm, double v) -{ +static int stk600_set_fosc(const PROGRAMMER *pgm, double v) { unsigned int oct, dac; oct = 1.443 * log(v / 1039.0); @@ -3021,8 +2994,7 @@ static int stk600_set_fosc(PROGRAMMER * pgm, double v) return stk500v2_setparm2(pgm, PARAM2_CLOCK_CONF, (oct << 12) | (dac << 2)); } -static int stk600_set_sck_period(PROGRAMMER * pgm, double v) -{ +static int stk600_set_sck_period(const PROGRAMMER *pgm, double v) { unsigned int sck; sck = ceil((16e6 / (2 * 1.0 / v)) - 1); @@ -3033,8 +3005,7 @@ static int stk600_set_sck_period(PROGRAMMER * pgm, double v) return stk500v2_setparm2(pgm, PARAM2_SCK_DURATION, sck); } -static int stk500v2_jtag3_set_sck_period(PROGRAMMER * pgm, double v) -{ +static int stk500v2_jtag3_set_sck_period(const PROGRAMMER *pgm, double v) { unsigned char value[3]; unsigned int sck; @@ -3056,8 +3027,7 @@ static int stk500v2_jtag3_set_sck_period(PROGRAMMER * pgm, double v) return 0; } -static int stk500v2_getparm(PROGRAMMER * pgm, unsigned char parm, unsigned char * value) -{ +static int stk500v2_getparm(const PROGRAMMER *pgm, unsigned char parm, unsigned char *value) { unsigned char buf[32]; buf[0] = CMD_GET_PARAMETER; @@ -3074,8 +3044,7 @@ static int stk500v2_getparm(PROGRAMMER * pgm, unsigned char parm, unsigned char return 0; } -static int stk500v2_setparm_real(PROGRAMMER * pgm, unsigned char parm, unsigned char value) -{ +static int stk500v2_setparm_real(const PROGRAMMER *pgm, unsigned char parm, unsigned char value) { unsigned char buf[32]; buf[0] = CMD_SET_PARAMETER; @@ -3091,8 +3060,7 @@ static int stk500v2_setparm_real(PROGRAMMER * pgm, unsigned char parm, unsigned return 0; } -static int stk500v2_setparm(PROGRAMMER * pgm, unsigned char parm, unsigned char value) -{ +static int stk500v2_setparm(const PROGRAMMER *pgm, unsigned char parm, unsigned char value) { unsigned char current_value = value; int res; @@ -3111,8 +3079,7 @@ static int stk500v2_setparm(PROGRAMMER * pgm, unsigned char parm, unsigned char return stk500v2_setparm_real(pgm, parm, value); } -static int stk500v2_getparm2(PROGRAMMER * pgm, unsigned char parm, unsigned int * value) -{ +static int stk500v2_getparm2(const PROGRAMMER *pgm, unsigned char parm, unsigned int *value) { unsigned char buf[32]; buf[0] = CMD_GET_PARAMETER; @@ -3129,8 +3096,7 @@ static int stk500v2_getparm2(PROGRAMMER * pgm, unsigned char parm, unsigned int return 0; } -static int stk500v2_setparm2(PROGRAMMER * pgm, unsigned char parm, unsigned int value) -{ +static int stk500v2_setparm2(const PROGRAMMER *pgm, unsigned char parm, unsigned int value) { unsigned char buf[32]; buf[0] = CMD_SET_PARAMETER; @@ -3164,8 +3130,7 @@ static const char *stk600_get_cardname(const struct carddata *table, } -static void stk500v2_display(PROGRAMMER * pgm, const char * p) -{ +static void stk500v2_display(const PROGRAMMER *pgm, const char *p) { unsigned char maj = 0, min = 0, hdw = 0, topcard = 0, maj_s1 = 0, min_s1 = 0, maj_s2 = 0, min_s2 = 0; unsigned int rev = 0; @@ -3245,30 +3210,28 @@ f_to_kHz_MHz(double f, const char **unit) return f; } -static void stk500v2_print_parms1(PROGRAMMER * pgm, const char * p) -{ +static void stk500v2_print_parms1(const PROGRAMMER *pgm, const char *p) { unsigned char vtarget = 0, vadjust = 0, osc_pscale = 0, osc_cmatch = 0, sck_duration =0; //XXX 0 is not correct, check caller unsigned int sck_stk600, clock_conf, dac, oct, varef; unsigned char vtarget_jtag[4]; int prescale; double f; const char *unit; - void *mycookie; memset(vtarget_jtag, 0, sizeof vtarget_jtag); if (PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE_MKII) { - mycookie = pgm->cookie; - pgm->cookie = PDATA(pgm)->chained_pdata; - jtagmkII_getparm(pgm, PAR_OCD_VTARGET, vtarget_jtag); - pgm->cookie = mycookie; + PROGRAMMER *pgmcp = pgm_dup(pgm); + pgmcp->cookie = PDATA(pgm)->chained_pdata; + jtagmkII_getparm(pgmcp, PAR_OCD_VTARGET, vtarget_jtag); + pgm_free(pgmcp); avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p, b2_to_u16(vtarget_jtag) / 1000.0); } else if (PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE3) { - mycookie = pgm->cookie; - pgm->cookie = PDATA(pgm)->chained_pdata; - jtag3_getparm(pgm, SCOPE_GENERAL, 1, PARM3_VTARGET, vtarget_jtag, 2); - pgm->cookie = mycookie; + PROGRAMMER *pgmcp = pgm_dup(pgm); + pgmcp->cookie = PDATA(pgm)->chained_pdata; + jtag3_getparm(pgmcp, SCOPE_GENERAL, 1, PARM3_VTARGET, vtarget_jtag, 2); + pgm_free(pgmcp); avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p, b2_to_u16(vtarget_jtag) / 1000.0); @@ -3356,13 +3319,11 @@ static void stk500v2_print_parms1(PROGRAMMER * pgm, const char * p) } -static void stk500v2_print_parms(PROGRAMMER * pgm) -{ +static void stk500v2_print_parms(const PROGRAMMER *pgm) { stk500v2_print_parms1(pgm, ""); } -static int stk500v2_perform_osccal(PROGRAMMER * pgm) -{ +static int stk500v2_perform_osccal(const PROGRAMMER *pgm) { unsigned char buf[32]; int rv; @@ -3388,8 +3349,7 @@ static int stk500v2_perform_osccal(PROGRAMMER * pgm) /* * Open a JTAG ICE mkII in ISP mode. */ -static int stk500v2_jtagmkII_open(PROGRAMMER * pgm, char * port) -{ +static int stk500v2_jtagmkII_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; void *mycookie; int rv; @@ -3501,8 +3461,7 @@ static void stk500v2_jtag3_close(PROGRAMMER * pgm) /* * Open an AVR Dragon in ISP mode. */ -static int stk500v2_dragon_isp_open(PROGRAMMER * pgm, char * port) -{ +static int stk500v2_dragon_isp_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; void *mycookie; @@ -3580,10 +3539,8 @@ static int stk500v2_dragon_isp_open(PROGRAMMER * pgm, char * port) /* * Open an AVR Dragon in HV mode (HVSP or parallel). */ -static int stk500v2_dragon_hv_open(PROGRAMMER * pgm, char * port) -{ +static int stk500v2_dragon_hv_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; - void *mycookie; avrdude_message(MSG_NOTICE2, "%s: stk500v2_dragon_hv_open()\n", progname); @@ -3628,16 +3585,15 @@ static int stk500v2_dragon_hv_open(PROGRAMMER * pgm, char * port) */ stk500v2_drain(pgm, 0); - mycookie = pgm->cookie; - pgm->cookie = PDATA(pgm)->chained_pdata; - if (jtagmkII_getsync(pgm, EMULATOR_MODE_HV) != 0) { + PROGRAMMER *pgmcp = pgm_dup(pgm); + pgmcp->cookie = PDATA(pgm)->chained_pdata; + if (jtagmkII_getsync(pgmcp, EMULATOR_MODE_HV) != 0) { avrdude_message(MSG_INFO, "%s: failed to sync with the AVR Dragon in HV mode\n", progname); - pgm->cookie = mycookie; + pgm_free(pgmcp); return -1; } - pgm->cookie = mycookie; - + pgm_free(pgmcp); PDATA(pgm)->pgmtype = PGMTYPE_JTAGICE_MKII; if (pgm->bitclock != 0.0) { @@ -3658,8 +3614,7 @@ static int stk500v2_dragon_hv_open(PROGRAMMER * pgm, char * port) /* * Open a JTAGICE3 in ISP mode. */ -static int stk500v2_jtag3_open(PROGRAMMER * pgm, char * port) -{ +static int stk500v2_jtag3_open(PROGRAMMER *pgm, const char *port) { void *mycookie; int rv; @@ -3693,7 +3648,7 @@ static int stk500v2_jtag3_open(PROGRAMMER * pgm, char * port) /* * XPROG wrapper */ -static int stk600_xprog_command(PROGRAMMER * pgm, unsigned char *b, +static int stk600_xprog_command(const PROGRAMMER *pgm, unsigned char *b, unsigned int cmdsize, unsigned int responsesize) { unsigned char *newb; @@ -3727,8 +3682,7 @@ static int stk600_xprog_command(PROGRAMMER * pgm, unsigned char *b, /* * issue the 'program enable' command to the AVR device, XPROG version */ -static int stk600_xprog_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk600_xprog_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char buf[16]; unsigned int eepagesize = 42; unsigned int nvm_base; @@ -3830,8 +3784,7 @@ static int stk600_xprog_program_enable(PROGRAMMER * pgm, AVRPART * p) return 0; } -static unsigned char stk600_xprog_memtype(PROGRAMMER * pgm, unsigned long addr) -{ +static unsigned char stk600_xprog_memtype(const PROGRAMMER *pgm, unsigned long addr) { if (addr >= PDATA(pgm)->boot_start) return XPRG_MEM_TYPE_BOOT; else @@ -3839,8 +3792,7 @@ static unsigned char stk600_xprog_memtype(PROGRAMMER * pgm, unsigned long addr) } -static void stk600_xprog_disable(PROGRAMMER * pgm) -{ +static void stk600_xprog_disable(const PROGRAMMER *pgm) { unsigned char buf[2]; buf[0] = XPRG_CMD_LEAVE_PROGMODE; @@ -3850,7 +3802,7 @@ static void stk600_xprog_disable(PROGRAMMER * pgm) } } -static int stk600_xprog_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int stk600_xprog_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char data) { unsigned char b[9 + 256]; @@ -3932,7 +3884,7 @@ static int stk600_xprog_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } -static int stk600_xprog_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int stk600_xprog_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char * value) { unsigned char b[8]; @@ -3982,7 +3934,7 @@ static int stk600_xprog_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } -static int stk600_xprog_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int stk600_xprog_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -4084,7 +4036,7 @@ static int stk600_xprog_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, return n_bytes_orig; } -static int stk600_xprog_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, +static int stk600_xprog_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -4260,8 +4212,7 @@ static int stk600_xprog_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, return n_bytes_orig; } -static int stk600_xprog_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int stk600_xprog_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char b[6]; AVRMEM *mem; unsigned int addr = 0; @@ -4289,7 +4240,7 @@ static int stk600_xprog_chip_erase(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int stk600_xprog_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int stk600_xprog_page_erase(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int addr) { unsigned char b[6]; @@ -4359,8 +4310,7 @@ static void stk600_setup_isp(PROGRAMMER * pgm) const char stk500v2_desc[] = "Atmel STK500 Version 2.x firmware"; -void stk500v2_initpgm(PROGRAMMER * pgm) -{ +void stk500v2_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "STK500V2"); /* @@ -4397,8 +4347,7 @@ void stk500v2_initpgm(PROGRAMMER * pgm) const char stk500pp_desc[] = "Atmel STK500 V2 in parallel programming mode"; -void stk500pp_initpgm(PROGRAMMER * pgm) -{ +void stk500pp_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "STK500PP"); /* @@ -4432,8 +4381,7 @@ void stk500pp_initpgm(PROGRAMMER * pgm) const char stk500hvsp_desc[] = "Atmel STK500 V2 in high-voltage serial programming mode"; -void stk500hvsp_initpgm(PROGRAMMER * pgm) -{ +void stk500hvsp_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "STK500HVSP"); /* @@ -4467,8 +4415,7 @@ void stk500hvsp_initpgm(PROGRAMMER * pgm) const char stk500v2_jtagmkII_desc[] = "Atmel JTAG ICE mkII in ISP mode"; -void stk500v2_jtagmkII_initpgm(PROGRAMMER * pgm) -{ +void stk500v2_jtagmkII_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "JTAGMKII_ISP"); /* @@ -4502,8 +4449,7 @@ void stk500v2_jtagmkII_initpgm(PROGRAMMER * pgm) const char stk500v2_dragon_isp_desc[] = "Atmel AVR Dragon in ISP mode"; -void stk500v2_dragon_isp_initpgm(PROGRAMMER * pgm) -{ +void stk500v2_dragon_isp_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "DRAGON_ISP"); /* @@ -4536,8 +4482,7 @@ void stk500v2_dragon_isp_initpgm(PROGRAMMER * pgm) const char stk500v2_dragon_pp_desc[] = "Atmel AVR Dragon in PP mode"; -void stk500v2_dragon_pp_initpgm(PROGRAMMER * pgm) -{ +void stk500v2_dragon_pp_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "DRAGON_PP"); /* @@ -4571,8 +4516,7 @@ void stk500v2_dragon_pp_initpgm(PROGRAMMER * pgm) const char stk500v2_dragon_hvsp_desc[] = "Atmel AVR Dragon in HVSP mode"; -void stk500v2_dragon_hvsp_initpgm(PROGRAMMER * pgm) -{ +void stk500v2_dragon_hvsp_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "DRAGON_HVSP"); /* @@ -4606,8 +4550,7 @@ void stk500v2_dragon_hvsp_initpgm(PROGRAMMER * pgm) const char stk600_desc[] = "Atmel STK600"; -void stk600_initpgm(PROGRAMMER * pgm) -{ +void stk600_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "STK600"); /* @@ -4644,8 +4587,7 @@ void stk600_initpgm(PROGRAMMER * pgm) const char stk600pp_desc[] = "Atmel STK600 in parallel programming mode"; -void stk600pp_initpgm(PROGRAMMER * pgm) -{ +void stk600pp_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "STK600PP"); /* @@ -4679,8 +4621,7 @@ void stk600pp_initpgm(PROGRAMMER * pgm) const char stk600hvsp_desc[] = "Atmel STK600 in high-voltage serial programming mode"; -void stk600hvsp_initpgm(PROGRAMMER * pgm) -{ +void stk600hvsp_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "STK600HVSP"); /* @@ -4714,8 +4655,7 @@ void stk600hvsp_initpgm(PROGRAMMER * pgm) const char stk500v2_jtag3_desc[] = "Atmel JTAGICE3 in ISP mode"; -void stk500v2_jtag3_initpgm(PROGRAMMER * pgm) -{ +void stk500v2_jtag3_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "JTAG3_ISP"); /* @@ -4746,4 +4686,3 @@ void stk500v2_jtag3_initpgm(PROGRAMMER * pgm) pgm->teardown = stk500v2_jtag3_teardown; pgm->page_size = 256; } - diff --git a/src/stk500v2.h b/src/stk500v2.h index c56056bd..89e40ded 100644 --- a/src/stk500v2.h +++ b/src/stk500v2.h @@ -37,22 +37,22 @@ extern const char stk500v2_jtag3_desc[]; extern const char stk600_desc[]; extern const char stk600hvsp_desc[]; extern const char stk600pp_desc[]; -void stk500v2_initpgm (PROGRAMMER * pgm); -void stk500hvsp_initpgm (PROGRAMMER * pgm); -void stk500pp_initpgm (PROGRAMMER * pgm); -void stk500v2_jtagmkII_initpgm(PROGRAMMER * pgm); -void stk500v2_jtag3_initpgm(PROGRAMMER * pgm); -void stk500v2_dragon_hvsp_initpgm(PROGRAMMER * pgm); -void stk500v2_dragon_isp_initpgm(PROGRAMMER * pgm); -void stk500v2_dragon_pp_initpgm(PROGRAMMER * pgm); -void stk600_initpgm (PROGRAMMER * pgm); -void stk600hvsp_initpgm (PROGRAMMER * pgm); -void stk600pp_initpgm (PROGRAMMER * pgm); +void stk500v2_initpgm(PROGRAMMER *pgm); +void stk500hvsp_initpgm(PROGRAMMER *pgm); +void stk500pp_initpgm(PROGRAMMER *pgm); +void stk500v2_jtagmkII_initpgm(PROGRAMMER *pgm); +void stk500v2_jtag3_initpgm(PROGRAMMER *pgm); +void stk500v2_dragon_hvsp_initpgm(PROGRAMMER *pgm); +void stk500v2_dragon_isp_initpgm(PROGRAMMER *pgm); +void stk500v2_dragon_pp_initpgm(PROGRAMMER *pgm); +void stk600_initpgm(PROGRAMMER *pgm); +void stk600hvsp_initpgm(PROGRAMMER *pgm); +void stk600pp_initpgm(PROGRAMMER *pgm); void stk500v2_setup(PROGRAMMER * pgm); void stk500v2_teardown(PROGRAMMER * pgm); -int stk500v2_drain(PROGRAMMER * pgm, int display); -int stk500v2_getsync(PROGRAMMER * pgm); +int stk500v2_drain(const PROGRAMMER *pgm, int display); +int stk500v2_getsync(const PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/stk500v2_private.h b/src/stk500v2_private.h index 2ac0d05c..5531a269 100644 --- a/src/stk500v2_private.h +++ b/src/stk500v2_private.h @@ -312,7 +312,7 @@ struct pdata } pgmtype; - AVRPART *lastpart; + const AVRPART *lastpart; /* Start address of Xmega boot area */ unsigned long boot_start; diff --git a/src/teensy.c b/src/teensy.c index b6bfc772..2aa286df 100644 --- a/src/teensy.c +++ b/src/teensy.c @@ -86,8 +86,7 @@ static void delay_ms(uint32_t duration) usleep(duration * 1000); } -static int teensy_get_bootloader_info(pdata_t* pdata, AVRPART* p) -{ +static int teensy_get_bootloader_info(pdata_t* pdata, const AVRPART* p) { switch (pdata->hid_usage) { case 0x19: @@ -253,8 +252,7 @@ static void teensy_teardown(PROGRAMMER* pgm) free(pgm->cookie); } -static int teensy_initialize(PROGRAMMER* pgm, AVRPART* p) -{ +static int teensy_initialize(const PROGRAMMER *pgm, const AVRPART *p) { avrdude_message(MSG_DEBUG, "%s: teensy_initialize()\n", progname); pdata_t* pdata = PDATA(pgm); @@ -268,18 +266,15 @@ static int teensy_initialize(PROGRAMMER* pgm, AVRPART* p) return 0; } -static void teensy_display(PROGRAMMER* pgm, const char* prefix) -{ +static void teensy_display(const PROGRAMMER *pgm, const char *prefix) { avrdude_message(MSG_DEBUG, "%s: teensy_display()\n", progname); } -static void teensy_powerup(PROGRAMMER* pgm) -{ +static void teensy_powerup(const PROGRAMMER *pgm) { avrdude_message(MSG_DEBUG, "%s: teensy_powerup()\n", progname); } -static void teensy_powerdown(PROGRAMMER* pgm) -{ +static void teensy_powerdown(const PROGRAMMER *pgm) { avrdude_message(MSG_DEBUG, "%s: teensy_powerdown()\n", progname); pdata_t* pdata = PDATA(pgm); @@ -297,24 +292,20 @@ static void teensy_powerdown(PROGRAMMER* pgm) } } -static void teensy_enable(PROGRAMMER* pgm) -{ +static void teensy_enable(PROGRAMMER* pgm, const AVRPART *p) { avrdude_message(MSG_DEBUG, "%s: teensy_enable()\n", progname); } -static void teensy_disable(PROGRAMMER* pgm) -{ +static void teensy_disable(const PROGRAMMER *pgm) { avrdude_message(MSG_DEBUG, "%s: teensy_disable()\n", progname); } -static int teensy_program_enable(PROGRAMMER* pgm, AVRPART* p) -{ +static int teensy_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { avrdude_message(MSG_DEBUG, "%s: teensy_program_enable()\n", progname); return 0; } -static int teensy_read_sig_bytes(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem) -{ +static int teensy_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem) { avrdude_message(MSG_DEBUG, "%s: teensy_read_sig_bytes()\n", progname); if (mem->size < 3) @@ -329,8 +320,7 @@ static int teensy_read_sig_bytes(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem) return 0; } -static int teensy_chip_erase(PROGRAMMER* pgm, AVRPART* p) -{ +static int teensy_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { avrdude_message(MSG_DEBUG, "%s: teensy_chip_erase()\n", progname); pdata_t* pdata = PDATA(pgm); @@ -341,12 +331,11 @@ static int teensy_chip_erase(PROGRAMMER* pgm, AVRPART* p) return 0; } -static int teensy_open(PROGRAMMER* pgm, char* port) -{ +static int teensy_open(PROGRAMMER *pgm, const char *port) { avrdude_message(MSG_DEBUG, "%s: teensy_open(\"%s\")\n", progname, port); pdata_t* pdata = PDATA(pgm); - char* bus_name = NULL; + const char *bus_name = NULL; char* dev_name = NULL; // if no -P was given or '-P usb' was given @@ -472,7 +461,7 @@ static void teensy_close(PROGRAMMER* pgm) } } -static int teensy_read_byte(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, +static int teensy_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char* value) { avrdude_message(MSG_DEBUG, "%s: teensy_read_byte(desc=%s, addr=0x%0X)\n", @@ -493,7 +482,7 @@ static int teensy_read_byte(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, } } -static int teensy_write_byte(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, +static int teensy_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr, unsigned char value) { avrdude_message(MSG_DEBUG, "%s: teensy_write_byte(desc=%s, addr=0x%0X)\n", @@ -501,7 +490,7 @@ static int teensy_write_byte(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, return -1; } -static int teensy_paged_load(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, +static int teensy_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -510,7 +499,7 @@ static int teensy_paged_load(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, return -1; } -static int teensy_paged_write(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, +static int teensy_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -567,8 +556,7 @@ static int teensy_paged_write(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem, } } -static int teensy_parseextparams(PROGRAMMER* pgm, LISTID xparams) -{ +static int teensy_parseextparams(const PROGRAMMER *pgm, const LISTID xparams) { avrdude_message(MSG_DEBUG, "%s: teensy_parseextparams()\n", progname); pdata_t* pdata = PDATA(pgm); @@ -596,8 +584,7 @@ static int teensy_parseextparams(PROGRAMMER* pgm, LISTID xparams) return 0; } -void teensy_initpgm(PROGRAMMER* pgm) -{ +void teensy_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "teensy"); pgm->setup = teensy_setup; @@ -624,14 +611,12 @@ void teensy_initpgm(PROGRAMMER* pgm) #else /* !HAVE_LIBHIDAPI */ // Give a proper error if we were not compiled with libhidapi -static int teensy_nousb_open(struct programmer_t* pgm, char* name) -{ +static int teensy_nousb_open(PROGRAMMER *pgm, const char *name) { avrdude_message(MSG_INFO, "%s: error: No HID support. Please compile again with libhidapi installed.\n", progname); return -1; } -void teensy_initpgm(PROGRAMMER* pgm) -{ +void teensy_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "teensy"); pgm->open = teensy_nousb_open; } diff --git a/src/teensy.h b/src/teensy.h index 8cec458a..f617e9d5 100644 --- a/src/teensy.h +++ b/src/teensy.h @@ -26,7 +26,7 @@ extern "C" { #endif extern const char teensy_desc[]; -void teensy_initpgm(PROGRAMMER* pgm); +void teensy_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/updi_link.c b/src/updi_link.c index 1f179398..aff93906 100644 --- a/src/updi_link.c +++ b/src/updi_link.c @@ -39,8 +39,7 @@ #include "updi_constants.h" #include "updi_state.h" -static void updi_set_rtsdtr_mode(PROGRAMMER* pgm) -{ +static void updi_set_rtsdtr_mode(const PROGRAMMER *pgm) { updi_rts_mode rts_mode = updi_get_rts_mode(pgm); if (rts_mode == RTS_MODE_DEFAULT) { @@ -87,8 +86,7 @@ static void updi_physical_close(PROGRAMMER* pgm) pgm->fd.ifd = -1; } -static int updi_physical_send(PROGRAMMER * pgm, unsigned char * buf, size_t len) -{ +static int updi_physical_send(const PROGRAMMER *pgm, unsigned char *buf, size_t len) { size_t i; int rv; @@ -106,8 +104,7 @@ static int updi_physical_send(PROGRAMMER * pgm, unsigned char * buf, size_t len) return rv; } -static int updi_physical_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len) -{ +static int updi_physical_recv(const PROGRAMMER *pgm, unsigned char *buf, size_t len) { size_t i; int rv; @@ -131,8 +128,7 @@ static int updi_physical_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len) return len; } -static int updi_physical_send_double_break(PROGRAMMER * pgm) -{ +static int updi_physical_send_double_break(const PROGRAMMER *pgm) { unsigned char buffer[1]; avrdude_message(MSG_DEBUG, "%s: Sending double break\n", progname); @@ -171,8 +167,7 @@ static int updi_physical_send_double_break(PROGRAMMER * pgm) return 0; } -int updi_physical_sib(PROGRAMMER * pgm, unsigned char * buffer, uint8_t size) -{ +int updi_physical_sib(const PROGRAMMER *pgm, unsigned char *buffer, uint8_t size) { /* def sib(self): """ @@ -196,8 +191,7 @@ int updi_physical_sib(PROGRAMMER * pgm, unsigned char * buffer, uint8_t size) return updi_physical_recv(pgm, buffer, size); } -int updi_link_open(PROGRAMMER * pgm) -{ +int updi_link_open(PROGRAMMER *pgm) { unsigned char init_buffer[1]; if (updi_physical_open(pgm, pgm->baudrate? pgm->baudrate: 115200, SERIAL_8E2) < 0) { @@ -208,13 +202,11 @@ int updi_link_open(PROGRAMMER * pgm) return updi_physical_send(pgm, init_buffer, 1); } -void updi_link_close(PROGRAMMER * pgm) -{ +void updi_link_close(PROGRAMMER *pgm) { updi_physical_close(pgm); } -static int updi_link_init_session_parameters(PROGRAMMER * pgm) -{ +static int updi_link_init_session_parameters(const PROGRAMMER *pgm) { /* def _init_session_parameters(self): """ @@ -234,8 +226,7 @@ static int updi_link_init_session_parameters(PROGRAMMER * pgm) return 0; } -static int updi_link_check(PROGRAMMER * pgm) -{ +static int updi_link_check(const PROGRAMMER *pgm) { /* def _check_datalink(self): """ @@ -269,8 +260,7 @@ static int updi_link_check(PROGRAMMER * pgm) } -int updi_link_init(PROGRAMMER * pgm) -{ +int updi_link_init(const PROGRAMMER *pgm) { /* def init_datalink(self): """ @@ -308,8 +298,7 @@ int updi_link_init(PROGRAMMER * pgm) return 0; } -int updi_link_ldcs(PROGRAMMER * pgm, uint8_t address, uint8_t * value) -{ +int updi_link_ldcs(const PROGRAMMER *pgm, uint8_t address, uint8_t *value) { /* def ldcs(self, address): """ @@ -347,8 +336,7 @@ int updi_link_ldcs(PROGRAMMER * pgm, uint8_t address, uint8_t * value) return 0; } -int updi_link_stcs(PROGRAMMER * pgm, uint8_t address, uint8_t value) -{ +int updi_link_stcs(const PROGRAMMER *pgm, uint8_t address, uint8_t value) { /* def stcs(self, address, value): """ @@ -368,8 +356,7 @@ int updi_link_stcs(PROGRAMMER * pgm, uint8_t address, uint8_t value) return updi_physical_send(pgm, buffer, 3); } -int updi_link_ld_ptr_inc(PROGRAMMER * pgm, unsigned char * buffer, uint16_t size) -{ +int updi_link_ld_ptr_inc(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t size) { /* def ld_ptr_inc(self, size): """ @@ -394,8 +381,7 @@ int updi_link_ld_ptr_inc(PROGRAMMER * pgm, unsigned char * buffer, uint16_t size return updi_physical_recv(pgm, buffer, size); } -int updi_link_ld_ptr_inc16(PROGRAMMER * pgm, unsigned char * buffer, uint16_t words) -{ +int updi_link_ld_ptr_inc16(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t words) { /* def ld_ptr_inc16(self, words): """ @@ -420,8 +406,7 @@ int updi_link_ld_ptr_inc16(PROGRAMMER * pgm, unsigned char * buffer, uint16_t wo return updi_physical_recv(pgm, buffer, words << 2); } -int updi_link_st_ptr_inc(PROGRAMMER * pgm, unsigned char * buffer, uint16_t size) -{ +int updi_link_st_ptr_inc(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t size) { /* def st_ptr_inc(self, data): """ @@ -484,8 +469,7 @@ int updi_link_st_ptr_inc(PROGRAMMER * pgm, unsigned char * buffer, uint16_t size return 0; } -int updi_link_st_ptr_inc16(PROGRAMMER * pgm, unsigned char * buffer, uint16_t words) -{ +int updi_link_st_ptr_inc16(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t words) { /* def st_ptr_inc16(self, data): """ @@ -550,7 +534,7 @@ int updi_link_st_ptr_inc16(PROGRAMMER * pgm, unsigned char * buffer, uint16_t wo return 0; } -int updi_link_st_ptr_inc16_RSD(PROGRAMMER * pgm, unsigned char * buffer, uint16_t words, int blocksize) { +int updi_link_st_ptr_inc16_RSD(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t words, int blocksize) { /* def st_ptr_inc16_RSD(self, data, blocksize): """ @@ -653,8 +637,7 @@ int updi_link_st_ptr_inc16_RSD(PROGRAMMER * pgm, unsigned char * buffer, uint16_ return 0; } -int updi_link_repeat(PROGRAMMER * pgm, uint16_t repeats) -{ +int updi_link_repeat(const PROGRAMMER *pgm, uint16_t repeats) { /* def repeat(self, repeats): """ @@ -683,8 +666,7 @@ int updi_link_repeat(PROGRAMMER * pgm, uint16_t repeats) return updi_physical_send(pgm, buffer, 3); } -int updi_link_read_sib(PROGRAMMER * pgm, unsigned char * buffer, uint16_t size) -{ +int updi_link_read_sib(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t size) { /* def read_sib(self): """ @@ -695,8 +677,7 @@ int updi_link_read_sib(PROGRAMMER * pgm, unsigned char * buffer, uint16_t size) return updi_physical_sib(pgm, buffer, size); } -int updi_link_key(PROGRAMMER * pgm, unsigned char * buffer, uint8_t size_type, uint16_t size) -{ +int updi_link_key(const PROGRAMMER *pgm, unsigned char *buffer, uint8_t size_type, uint16_t size) { /* def key(self, size, key): """ @@ -732,8 +713,7 @@ int updi_link_key(PROGRAMMER * pgm, unsigned char * buffer, uint8_t size_type, u return updi_physical_send(pgm, reversed_key, size); } -int updi_link_ld(PROGRAMMER * pgm, uint32_t address, uint8_t * value) -{ +int updi_link_ld(const PROGRAMMER *pgm, uint32_t address, uint8_t *value) { /* def ld(self, address): """ @@ -768,8 +748,7 @@ int updi_link_ld(PROGRAMMER * pgm, uint32_t address, uint8_t * value) return 0; } -int updi_link_ld16(PROGRAMMER * pgm, uint32_t address, uint16_t * value) -{ +int updi_link_ld16(const PROGRAMMER *pgm, uint32_t address, uint16_t *value) { /* def ld16(self, address): """ @@ -804,8 +783,7 @@ int updi_link_ld16(PROGRAMMER * pgm, uint32_t address, uint16_t * value) return 0; } -static int updi_link_st_data_phase(PROGRAMMER * pgm, unsigned char * buffer, uint8_t size) -{ +static int updi_link_st_data_phase(const PROGRAMMER *pgm, unsigned char *buffer, uint8_t size) { /* def _st_data_phase(self, values): """ @@ -848,8 +826,7 @@ static int updi_link_st_data_phase(PROGRAMMER * pgm, unsigned char * buffer, uin return 0; } -int updi_link_st(PROGRAMMER * pgm, uint32_t address, uint8_t value) -{ +int updi_link_st(const PROGRAMMER *pgm, uint32_t address, uint8_t value) { /* def st(self, address, value): """ @@ -879,8 +856,7 @@ int updi_link_st(PROGRAMMER * pgm, uint32_t address, uint8_t value) return updi_link_st_data_phase(pgm, send_buffer, 1); } -int updi_link_st16(PROGRAMMER * pgm, uint32_t address, uint16_t value) -{ +int updi_link_st16(const PROGRAMMER *pgm, uint32_t address, uint16_t value) { /* def st16(self, address, value): """ @@ -911,8 +887,7 @@ int updi_link_st16(PROGRAMMER * pgm, uint32_t address, uint16_t value) return updi_link_st_data_phase(pgm, send_buffer, 2); } -int updi_link_st_ptr(PROGRAMMER * pgm, uint32_t address) -{ +int updi_link_st_ptr(const PROGRAMMER *pgm, uint32_t address) { /* def st_ptr(self, address): """ diff --git a/src/updi_link.h b/src/updi_link.h index 5b5e5bda..796788ad 100644 --- a/src/updi_link.h +++ b/src/updi_link.h @@ -35,22 +35,22 @@ extern "C" { int updi_link_open(PROGRAMMER * pgm); void updi_link_close(PROGRAMMER * pgm); -int updi_link_init(PROGRAMMER * pgm); -int updi_link_ldcs(PROGRAMMER * pgm, uint8_t address, uint8_t * value); -int updi_link_stcs(PROGRAMMER * pgm, uint8_t address, uint8_t value); -int updi_link_ld_ptr_inc(PROGRAMMER * pgm, unsigned char * buffer, uint16_t size); -int updi_link_ld_ptr_inc16(PROGRAMMER * pgm, unsigned char * buffer, uint16_t words); -int updi_link_st_ptr_inc(PROGRAMMER * pgm, unsigned char * buffer, uint16_t size); -int updi_link_st_ptr_inc16(PROGRAMMER * pgm, unsigned char * buffer, uint16_t words); -int updi_link_st_ptr_inc16_RSD(PROGRAMMER * pgm, unsigned char * buffer, uint16_t words, int blocksize); -int updi_link_repeat(PROGRAMMER * pgm, uint16_t repeats); -int updi_link_read_sib(PROGRAMMER * pgm, unsigned char * buffer, uint16_t size); -int updi_link_key(PROGRAMMER * pgm, unsigned char * buffer, uint8_t size_type, uint16_t size); -int updi_link_ld(PROGRAMMER * pgm, uint32_t address, uint8_t * value); -int updi_link_ld16(PROGRAMMER * pgm, uint32_t address, uint16_t * value); -int updi_link_st(PROGRAMMER * pgm, uint32_t address, uint8_t value); -int updi_link_st16(PROGRAMMER * pgm, uint32_t address, uint16_t value); -int updi_link_st_ptr(PROGRAMMER * pgm, uint32_t address); +int updi_link_init(const PROGRAMMER *pgm); +int updi_link_ldcs(const PROGRAMMER *pgm, uint8_t address, uint8_t *value); +int updi_link_stcs(const PROGRAMMER *pgm, uint8_t address, uint8_t value); +int updi_link_ld_ptr_inc(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t size); +int updi_link_ld_ptr_inc16(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t words); +int updi_link_st_ptr_inc(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t size); +int updi_link_st_ptr_inc16(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t words); +int updi_link_st_ptr_inc16_RSD(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t words, int blocksize); +int updi_link_repeat(const PROGRAMMER *pgm, uint16_t repeats); +int updi_link_read_sib(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t size); +int updi_link_key(const PROGRAMMER *pgm, unsigned char *buffer, uint8_t size_type, uint16_t size); +int updi_link_ld(const PROGRAMMER *pgm, uint32_t address, uint8_t *value); +int updi_link_ld16(const PROGRAMMER *pgm, uint32_t address, uint16_t *value); +int updi_link_st(const PROGRAMMER *pgm, uint32_t address, uint8_t value); +int updi_link_st16(const PROGRAMMER *pgm, uint32_t address, uint16_t value); +int updi_link_st_ptr(const PROGRAMMER *pgm, uint32_t address); #ifdef __cplusplus } diff --git a/src/updi_nvm.c b/src/updi_nvm.c index f3d899a9..9b1275f6 100644 --- a/src/updi_nvm.c +++ b/src/updi_nvm.c @@ -47,8 +47,7 @@ typedef enum #define USE_DEFAULT_COMMAND 0xFF -static int nvm_chip_erase_V0(PROGRAMMER * pgm, AVRPART * p) -{ +static int nvm_chip_erase_V0(const PROGRAMMER *pgm, const AVRPART *p) { /* def chip_erase(self): """ @@ -88,8 +87,7 @@ static int nvm_chip_erase_V0(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int nvm_erase_flash_page_V0(PROGRAMMER * pgm, AVRPART * p, uint32_t address) -{ +static int nvm_erase_flash_page_V0(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address) { /* def erase_flash_page(self, address): """ @@ -136,8 +134,7 @@ static int nvm_erase_flash_page_V0(PROGRAMMER * pgm, AVRPART * p, uint32_t addre return 0; } -static int nvm_erase_eeprom_V0(PROGRAMMER * pgm, AVRPART * p) -{ +static int nvm_erase_eeprom_V0(const PROGRAMMER *pgm, const AVRPART *p) { /* def erase_eeprom(self): """ @@ -172,8 +169,7 @@ static int nvm_erase_eeprom_V0(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int nvm_erase_user_row_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uint16_t size) -{ +static int nvm_erase_user_row_V0(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, uint16_t size) { /* def erase_user_row(self, address, size): """ @@ -226,14 +222,13 @@ static int nvm_erase_user_row_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, return 0; } -static int nvm_write_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, +static int nvm_write_V0(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size, access_mode mode, uint8_t nvm_command); -static int nvm_write_eeprom_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size); +static int nvm_write_eeprom_V0(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size); -static int nvm_write_flash_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size) -{ +static int nvm_write_flash_V0(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size) { /* def write_flash(self, address, data): """ @@ -247,8 +242,7 @@ static int nvm_write_flash_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, un return nvm_write_V0(pgm, p, address, buffer, size, USE_WORD_ACCESS, USE_DEFAULT_COMMAND); } -static int nvm_write_user_row_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size) -{ +static int nvm_write_user_row_V0(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size) { /* def write_user_row(self, address, data): """ @@ -263,8 +257,7 @@ static int nvm_write_user_row_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, return nvm_write_eeprom_V0(pgm, p, address, buffer, size); } -static int nvm_write_eeprom_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size) -{ +static int nvm_write_eeprom_V0(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size) { /* def write_eeprom(self, address, data): """ @@ -279,8 +272,7 @@ static int nvm_write_eeprom_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, u return nvm_write_V0(pgm, p, address, buffer, size, DONT_USE_WORD_ACCESS, UPDI_V0_NVMCTRL_CTRLA_ERASE_WRITE_PAGE); } -static int nvm_write_fuse_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uint8_t value) -{ +static int nvm_write_fuse_V0(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, uint8_t value) { /* def write_fuse(self, address, data): """ @@ -340,7 +332,7 @@ static int nvm_write_fuse_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uin return 0; } -static int nvm_write_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, +static int nvm_write_V0(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size, access_mode mode, uint8_t nvm_command) { /* @@ -423,8 +415,7 @@ static int nvm_write_V0(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned return 0; } -static int nvm_chip_erase_V2(PROGRAMMER * pgm, AVRPART * p) -{ +static int nvm_chip_erase_V2(const PROGRAMMER *pgm, const AVRPART *p) { /* def chip_erase(self): """ @@ -463,8 +454,7 @@ static int nvm_chip_erase_V2(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int nvm_erase_flash_page_V2(PROGRAMMER * pgm, AVRPART * p, uint32_t address) -{ +static int nvm_erase_flash_page_V2(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address) { /* def erase_flash_page(self, address): """ @@ -515,8 +505,7 @@ static int nvm_erase_flash_page_V2(PROGRAMMER * pgm, AVRPART * p, uint32_t addre return 0; } -static int nvm_erase_eeprom_V2(PROGRAMMER * pgm, AVRPART * p) -{ +static int nvm_erase_eeprom_V2(const PROGRAMMER *pgm, const AVRPART *p) { /* def erase_eeprom(self): """ @@ -560,8 +549,7 @@ static int nvm_erase_eeprom_V2(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int nvm_erase_user_row_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uint16_t size) -{ +static int nvm_erase_user_row_V2(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, uint16_t size) { /* def erase_user_row(self, address, size): """ @@ -578,11 +566,10 @@ static int nvm_erase_user_row_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, return nvm_erase_flash_page_V2(pgm, p, address); } -static int nvm_write_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, +static int nvm_write_V2(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size, access_mode mode); -static int nvm_write_flash_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size) -{ +static int nvm_write_flash_V2(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size) { /* def write_flash(self, address, data): """ @@ -596,8 +583,7 @@ static int nvm_write_flash_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, un return nvm_write_V2(pgm, p, address, buffer, size, USE_WORD_ACCESS); } -static int nvm_write_user_row_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size) -{ +static int nvm_write_user_row_V2(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size) { /* def write_user_row(self, address, data): """ @@ -612,8 +598,7 @@ static int nvm_write_user_row_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, return nvm_write_V2(pgm, p, address, buffer, size, DONT_USE_WORD_ACCESS); } -static int nvm_write_eeprom_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size) -{ +static int nvm_write_eeprom_V2(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size) { /* def write_eeprom(self, address, data): """ @@ -668,8 +653,7 @@ static int nvm_write_eeprom_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, u return 0; } -static int nvm_write_fuse_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uint8_t value) -{ +static int nvm_write_fuse_V2(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, uint8_t value) { /* def write_fuse(self, address, data): """ @@ -686,7 +670,7 @@ static int nvm_write_fuse_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uin return nvm_write_eeprom_V2(pgm, p, address, buffer, 1); } -static int nvm_write_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, +static int nvm_write_V2(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size, access_mode mode) { /* @@ -755,8 +739,7 @@ static int nvm_write_V2(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned return 0; } -static int nvm_chip_erase_V3(PROGRAMMER * pgm, AVRPART * p) -{ +static int nvm_chip_erase_V3(const PROGRAMMER *pgm, const AVRPART *p) { /* def chip_erase(self): """ @@ -805,8 +788,7 @@ static int nvm_chip_erase_V3(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int nvm_erase_flash_page_V3(PROGRAMMER * pgm, AVRPART * p, uint32_t address) -{ +static int nvm_erase_flash_page_V3(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address) { /* def erase_flash_page(self, address): """ @@ -858,8 +840,7 @@ static int nvm_erase_flash_page_V3(PROGRAMMER * pgm, AVRPART * p, uint32_t addre return 0; } -static int nvm_erase_eeprom_V3(PROGRAMMER * pgm, AVRPART * p) -{ +static int nvm_erase_eeprom_V3(const PROGRAMMER *pgm, const AVRPART *p) { /* def erase_eeprom(self): """ @@ -903,8 +884,7 @@ static int nvm_erase_eeprom_V3(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int nvm_erase_user_row_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uint16_t size) -{ +static int nvm_erase_user_row_V3(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, uint16_t size) { /* def erase_user_row(self, address, size): """ @@ -923,11 +903,10 @@ static int nvm_erase_user_row_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, return nvm_erase_flash_page_V3(pgm, p, address); } -static int nvm_write_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, +static int nvm_write_V3(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size, access_mode mode, uint8_t nvm_command); -static int nvm_write_flash_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size) -{ +static int nvm_write_flash_V3(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size) { /* def write_flash(self, address, data): """ @@ -941,8 +920,7 @@ static int nvm_write_flash_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, un return nvm_write_V3(pgm, p, address, buffer, size, USE_WORD_ACCESS, USE_DEFAULT_COMMAND); } -static int nvm_write_user_row_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size) -{ +static int nvm_write_user_row_V3(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size) { /* def write_user_row(self, address, data): """ @@ -957,8 +935,7 @@ static int nvm_write_user_row_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, return nvm_write_V3(pgm, p, address, buffer, size, USE_WORD_ACCESS, USE_DEFAULT_COMMAND); } -static int nvm_write_eeprom_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size) -{ +static int nvm_write_eeprom_V3(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size) { /* def write_eeprom(self, address, data): """ @@ -973,8 +950,7 @@ static int nvm_write_eeprom_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, u return nvm_write_V3(pgm, p, address, buffer, size, DONT_USE_WORD_ACCESS, UPDI_V3_NVMCTRL_CTRLA_EEPROM_PAGE_ERASE_WRITE); } -static int nvm_write_fuse_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uint8_t value) -{ +static int nvm_write_fuse_V3(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, uint8_t value) { /* def write_fuse(self, address, data): """ @@ -990,7 +966,7 @@ static int nvm_write_fuse_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uin return nvm_write_eeprom_V3(pgm, p, address, buffer, 1); } -static int nvm_write_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, +static int nvm_write_V3(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size, access_mode mode, uint8_t nvm_command) { /* @@ -1081,8 +1057,7 @@ static int nvm_write_V3(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned } -int updi_nvm_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +int updi_nvm_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { switch(updi_get_nvm_mode(pgm)) { case UPDI_NVM_MODE_V0: @@ -1097,8 +1072,7 @@ int updi_nvm_chip_erase(PROGRAMMER * pgm, AVRPART * p) } } -int updi_nvm_erase_flash_page(PROGRAMMER * pgm, AVRPART *p, uint32_t address) -{ +int updi_nvm_erase_flash_page(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address) { switch(updi_get_nvm_mode(pgm)) { case UPDI_NVM_MODE_V0: @@ -1113,8 +1087,7 @@ int updi_nvm_erase_flash_page(PROGRAMMER * pgm, AVRPART *p, uint32_t address) } } -int updi_nvm_erase_eeprom(PROGRAMMER * pgm, AVRPART *p) -{ +int updi_nvm_erase_eeprom(const PROGRAMMER *pgm, const AVRPART *p) { switch(updi_get_nvm_mode(pgm)) { case UPDI_NVM_MODE_V0: @@ -1129,8 +1102,7 @@ int updi_nvm_erase_eeprom(PROGRAMMER * pgm, AVRPART *p) } } -int updi_nvm_erase_user_row(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uint16_t size) -{ +int updi_nvm_erase_user_row(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, uint16_t size) { switch(updi_get_nvm_mode(pgm)) { case UPDI_NVM_MODE_V0: @@ -1145,8 +1117,7 @@ int updi_nvm_erase_user_row(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uint } } -int updi_nvm_write_flash(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size) -{ +int updi_nvm_write_flash(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size) { switch(updi_get_nvm_mode(pgm)) { case UPDI_NVM_MODE_V0: @@ -1161,8 +1132,7 @@ int updi_nvm_write_flash(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigne } } -int updi_nvm_write_user_row(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size) -{ +int updi_nvm_write_user_row(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size) { switch(updi_get_nvm_mode(pgm)) { case UPDI_NVM_MODE_V0: @@ -1177,8 +1147,7 @@ int updi_nvm_write_user_row(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsi } } -int updi_nvm_write_eeprom(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size) -{ +int updi_nvm_write_eeprom(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size) { switch(updi_get_nvm_mode(pgm)) { case UPDI_NVM_MODE_V0: @@ -1193,8 +1162,7 @@ int updi_nvm_write_eeprom(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsign } } -int updi_nvm_write_fuse(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uint8_t value) -{ +int updi_nvm_write_fuse(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, uint8_t value) { switch(updi_get_nvm_mode(pgm)) { case UPDI_NVM_MODE_V0: @@ -1209,8 +1177,7 @@ int updi_nvm_write_fuse(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uint8_t } } -int updi_nvm_wait_ready(PROGRAMMER * pgm, AVRPART *p) -{ +int updi_nvm_wait_ready(const PROGRAMMER *pgm, const AVRPART *p) { /* def wait_nvm_ready(self): """ @@ -1257,8 +1224,7 @@ int updi_nvm_wait_ready(PROGRAMMER * pgm, AVRPART *p) return -1; } -int updi_nvm_command(PROGRAMMER * pgm, AVRPART *p, uint8_t command) -{ +int updi_nvm_command(const PROGRAMMER *pgm, const AVRPART *p, uint8_t command) { /* def execute_nvm_command(self, command): """ diff --git a/src/updi_nvm.h b/src/updi_nvm.h index c0c1544e..a6439f01 100644 --- a/src/updi_nvm.h +++ b/src/updi_nvm.h @@ -33,16 +33,16 @@ extern "C" { #endif -int updi_nvm_chip_erase(PROGRAMMER * pgm, AVRPART * p); -int updi_nvm_erase_flash_page(PROGRAMMER * pgm, AVRPART *p, uint32_t address); -int updi_nvm_erase_eeprom(PROGRAMMER * pgm, AVRPART *p); -int updi_nvm_erase_user_row(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uint16_t size); -int updi_nvm_write_flash(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size); -int updi_nvm_write_user_row(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size); -int updi_nvm_write_eeprom(PROGRAMMER * pgm, AVRPART *p, uint32_t address, unsigned char * buffer, uint16_t size); -int updi_nvm_write_fuse(PROGRAMMER * pgm, AVRPART *p, uint32_t address, uint8_t value); -int updi_nvm_wait_ready(PROGRAMMER * pgm, AVRPART *p); -int updi_nvm_command(PROGRAMMER * pgm, AVRPART *p, uint8_t command); +int updi_nvm_chip_erase(const PROGRAMMER *pgm, const AVRPART *p); +int updi_nvm_erase_flash_page(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address); +int updi_nvm_erase_eeprom(const PROGRAMMER *pgm, const AVRPART *p); +int updi_nvm_erase_user_row(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, uint16_t size); +int updi_nvm_write_flash(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size); +int updi_nvm_write_user_row(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size); +int updi_nvm_write_eeprom(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, unsigned char *buffer, uint16_t size); +int updi_nvm_write_fuse(const PROGRAMMER *pgm, const AVRPART *p, uint32_t address, uint8_t value); +int updi_nvm_wait_ready(const PROGRAMMER *pgm, const AVRPART *p); +int updi_nvm_command(const PROGRAMMER *pgm, const AVRPART *p, uint8_t command); #ifdef __cplusplus } diff --git a/src/updi_readwrite.c b/src/updi_readwrite.c index dcc3a849..08b6eb4a 100644 --- a/src/updi_readwrite.c +++ b/src/updi_readwrite.c @@ -39,8 +39,7 @@ #include "updi_link.h" #include "updi_readwrite.h" -int updi_read_cs(PROGRAMMER * pgm, uint8_t address, uint8_t * value) -{ +int updi_read_cs(const PROGRAMMER *pgm, uint8_t address, uint8_t *value) { /* def read_cs(self, address): """ @@ -54,8 +53,7 @@ int updi_read_cs(PROGRAMMER * pgm, uint8_t address, uint8_t * value) return updi_link_ldcs(pgm, address, value); } -int updi_write_cs(PROGRAMMER * pgm, uint8_t address, uint8_t value) -{ +int updi_write_cs(const PROGRAMMER *pgm, uint8_t address, uint8_t value) { /* def write_cs(self, address, value): """ @@ -69,8 +67,7 @@ int updi_write_cs(PROGRAMMER * pgm, uint8_t address, uint8_t value) return updi_link_stcs(pgm, address, value); } -int updi_write_key(PROGRAMMER * pgm, unsigned char * buffer, uint8_t size_type, uint16_t size) -{ +int updi_write_key(const PROGRAMMER *pgm, unsigned char *buffer, uint8_t size_type, uint16_t size) { /* def write_key(self, size, key): """ @@ -84,8 +81,7 @@ int updi_write_key(PROGRAMMER * pgm, unsigned char * buffer, uint8_t size_type, return updi_link_key(pgm, buffer, size_type, size); } -int updi_read_sib(PROGRAMMER * pgm, unsigned char * buffer, uint16_t size) -{ +int updi_read_sib(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t size) { /* def read_sib(self): """ @@ -98,8 +94,7 @@ int updi_read_sib(PROGRAMMER * pgm, unsigned char * buffer, uint16_t size) return updi_link_read_sib(pgm, buffer, size); } -int updi_read_byte(PROGRAMMER * pgm, uint32_t address, uint8_t * value) -{ +int updi_read_byte(const PROGRAMMER *pgm, uint32_t address, uint8_t *value) { /* def read_byte(self, address): """ @@ -113,8 +108,7 @@ int updi_read_byte(PROGRAMMER * pgm, uint32_t address, uint8_t * value) return updi_link_ld(pgm, address, value); } -int updi_write_byte(PROGRAMMER * pgm, uint32_t address, uint8_t value) -{ +int updi_write_byte(const PROGRAMMER *pgm, uint32_t address, uint8_t value) { /* def write_byte(self, address, value): """ @@ -128,8 +122,7 @@ int updi_write_byte(PROGRAMMER * pgm, uint32_t address, uint8_t value) return updi_link_st(pgm, address, value); } -int updi_read_data(PROGRAMMER * pgm, uint32_t address, uint8_t * buffer, uint16_t size) -{ +int updi_read_data(const PROGRAMMER *pgm, uint32_t address, uint8_t *buffer, uint16_t size) { /* def read_data(self, address, size): """ @@ -174,8 +167,7 @@ int updi_read_data(PROGRAMMER * pgm, uint32_t address, uint8_t * buffer, uint16_ return updi_link_ld_ptr_inc(pgm, buffer, size); } -int updi_write_data(PROGRAMMER * pgm, uint32_t address, uint8_t * buffer, uint16_t size) -{ +int updi_write_data(const PROGRAMMER *pgm, uint32_t address, uint8_t *buffer, uint16_t size) { /* def write_data(self, address, data): """ @@ -228,8 +220,7 @@ int updi_write_data(PROGRAMMER * pgm, uint32_t address, uint8_t * buffer, uint16 return updi_link_st_ptr_inc(pgm, buffer, size); } -int updi_read_data_words(PROGRAMMER * pgm, uint32_t address, uint8_t * buffer, uint16_t size) -{ +int updi_read_data_words(const PROGRAMMER *pgm, uint32_t address, uint8_t *buffer, uint16_t size) { /* def read_data_words(self, address, words): """ @@ -275,8 +266,7 @@ int updi_read_data_words(PROGRAMMER * pgm, uint32_t address, uint8_t * buffer, u return updi_link_ld_ptr_inc16(pgm, buffer, size); } -int updi_write_data_words(PROGRAMMER * pgm, uint32_t address, uint8_t * buffer, uint16_t size) -{ +int updi_write_data_words(const PROGRAMMER *pgm, uint32_t address, uint8_t *buffer, uint16_t size) { /* def write_data_words(self, address, data): """ diff --git a/src/updi_readwrite.h b/src/updi_readwrite.h index 9519d179..53e74520 100644 --- a/src/updi_readwrite.h +++ b/src/updi_readwrite.h @@ -33,16 +33,16 @@ extern "C" { #endif -int updi_read_cs(PROGRAMMER * pgm, uint8_t address, uint8_t * value); -int updi_write_cs(PROGRAMMER * pgm, uint8_t address, uint8_t value); -int updi_write_key(PROGRAMMER * pgm, unsigned char * buffer, uint8_t size_type, uint16_t size); -int updi_read_sib(PROGRAMMER * pgm, unsigned char * buffer, uint16_t size); -int updi_read_byte(PROGRAMMER * pgm, uint32_t address, uint8_t * value); -int updi_write_byte(PROGRAMMER * pgm, uint32_t address, uint8_t value); -int updi_read_data(PROGRAMMER * pgm, uint32_t address, uint8_t * buffer, uint16_t size); -int updi_write_data(PROGRAMMER * pgm, uint32_t address, uint8_t * buffer, uint16_t size); -int updi_read_data_words(PROGRAMMER * pgm, uint32_t address, uint8_t * buffer, uint16_t size); -int updi_write_data_words(PROGRAMMER * pgm, uint32_t address, uint8_t * buffer, uint16_t size); +int updi_read_cs(const PROGRAMMER *pgm, uint8_t address, uint8_t *value); +int updi_write_cs(const PROGRAMMER *pgm, uint8_t address, uint8_t value); +int updi_write_key(const PROGRAMMER *pgm, unsigned char *buffer, uint8_t size_type, uint16_t size); +int updi_read_sib(const PROGRAMMER *pgm, unsigned char *buffer, uint16_t size); +int updi_read_byte(const PROGRAMMER *pgm, uint32_t address, uint8_t *value); +int updi_write_byte(const PROGRAMMER *pgm, uint32_t address, uint8_t value); +int updi_read_data(const PROGRAMMER *pgm, uint32_t address, uint8_t *buffer, uint16_t size); +int updi_write_data(const PROGRAMMER *pgm, uint32_t address, uint8_t *buffer, uint16_t size); +int updi_read_data_words(const PROGRAMMER *pgm, uint32_t address, uint8_t *buffer, uint16_t size); +int updi_write_data_words(const PROGRAMMER *pgm, uint32_t address, uint8_t *buffer, uint16_t size); #ifdef __cplusplus } diff --git a/src/updi_state.c b/src/updi_state.c index 2ca583c7..4e2a9b20 100644 --- a/src/updi_state.c +++ b/src/updi_state.c @@ -29,37 +29,30 @@ #include "libavrdude.h" #include "updi_state.h" -updi_sib_info* updi_get_sib_info(PROGRAMMER * pgm) -{ +updi_sib_info* updi_get_sib_info(const PROGRAMMER *pgm) { return &((updi_state *)(pgm->cookie))->sib_info; } -updi_datalink_mode updi_get_datalink_mode(PROGRAMMER * pgm) -{ +updi_datalink_mode updi_get_datalink_mode(const PROGRAMMER *pgm) { return ((updi_state *)(pgm->cookie))->datalink_mode; } -void updi_set_datalink_mode(PROGRAMMER * pgm, updi_datalink_mode mode) -{ +void updi_set_datalink_mode(const PROGRAMMER *pgm, updi_datalink_mode mode) { ((updi_state *)(pgm->cookie))->datalink_mode = mode; } -updi_nvm_mode updi_get_nvm_mode(PROGRAMMER * pgm) -{ +updi_nvm_mode updi_get_nvm_mode(const PROGRAMMER *pgm) { return ((updi_state *)(pgm->cookie))->nvm_mode; } -void updi_set_nvm_mode(PROGRAMMER * pgm, updi_nvm_mode mode) -{ +void updi_set_nvm_mode(const PROGRAMMER *pgm, updi_nvm_mode mode) { ((updi_state *)(pgm->cookie))->nvm_mode = mode; } -updi_rts_mode updi_get_rts_mode(PROGRAMMER * pgm) -{ +updi_rts_mode updi_get_rts_mode(const PROGRAMMER *pgm) { return ((updi_state *)(pgm->cookie))->rts_mode; } -void updi_set_rts_mode(PROGRAMMER * pgm, updi_rts_mode mode) -{ +void updi_set_rts_mode(const PROGRAMMER *pgm, updi_rts_mode mode) { ((updi_state *)(pgm->cookie))->rts_mode = mode; } diff --git a/src/updi_state.h b/src/updi_state.h index a8a2702a..2fa6ca14 100644 --- a/src/updi_state.h +++ b/src/updi_state.h @@ -80,13 +80,13 @@ typedef struct extern "C" { #endif -updi_sib_info* updi_get_sib_info(PROGRAMMER * pgm); -updi_datalink_mode updi_get_datalink_mode(PROGRAMMER * pgm); -void updi_set_datalink_mode(PROGRAMMER * pgm, updi_datalink_mode mode); -updi_nvm_mode updi_get_nvm_mode(PROGRAMMER * pgm); -void updi_set_nvm_mode(PROGRAMMER * pgm, updi_nvm_mode mode); -updi_rts_mode updi_get_rts_mode(PROGRAMMER * pgm); -void updi_set_rts_mode(PROGRAMMER * pgm, updi_rts_mode mode); +updi_sib_info* updi_get_sib_info(const PROGRAMMER *pgm); +updi_datalink_mode updi_get_datalink_mode(const PROGRAMMER *pgm); +void updi_set_datalink_mode(const PROGRAMMER *pgm, updi_datalink_mode mode); +updi_nvm_mode updi_get_nvm_mode(const PROGRAMMER *pgm); +void updi_set_nvm_mode(const PROGRAMMER *pgm, updi_nvm_mode mode); +updi_rts_mode updi_get_rts_mode(const PROGRAMMER *pgm); +void updi_set_rts_mode(const PROGRAMMER *pgm, updi_rts_mode mode); #ifdef __cplusplus } diff --git a/src/usb_hidapi.c b/src/usb_hidapi.c index 5ceca60a..82c2e255 100644 --- a/src/usb_hidapi.c +++ b/src/usb_hidapi.c @@ -46,8 +46,7 @@ * The "baud" parameter is meaningless for USB devices, so we reuse it * to pass the desired USB device ID. */ -static int usbhid_open(char * port, union pinfo pinfo, union filedescriptor *fd) -{ +static int usbhid_open(const char *port, union pinfo pinfo, union filedescriptor *fd) { hid_device *dev; char *serno, *cp2; size_t x; @@ -233,7 +232,7 @@ static void usbhid_close(union filedescriptor *fd) } -static int usbhid_send(union filedescriptor *fd, const unsigned char *bp, size_t mlen) +static int usbhid_send(const union filedescriptor *fd, const unsigned char *bp, size_t mlen) { hid_device *udev = (hid_device *)fd->usb.handle; int rv; @@ -282,7 +281,7 @@ static int usbhid_send(union filedescriptor *fd, const unsigned char *bp, size_t return 0; } -static int usbhid_recv(union filedescriptor *fd, unsigned char *buf, size_t nbytes) +static int usbhid_recv(const union filedescriptor *fd, unsigned char *buf, size_t nbytes) { hid_device *udev = (hid_device *)fd->usb.handle; int i, rv; @@ -320,7 +319,7 @@ static int usbhid_recv(union filedescriptor *fd, unsigned char *buf, size_t nbyt return rv; } -static int usbhid_drain(union filedescriptor *fd, int display) +static int usbhid_drain(const union filedescriptor *fd, int display) { /* * There is not much point in trying to flush any data diff --git a/src/usb_libusb.c b/src/usb_libusb.c index 0d9ad440..5929be9d 100644 --- a/src/usb_libusb.c +++ b/src/usb_libusb.c @@ -62,8 +62,7 @@ static int usb_interface; * The "baud" parameter is meaningless for USB devices, so we reuse it * to pass the desired USB device ID. */ -static int usbdev_open(char * port, union pinfo pinfo, union filedescriptor *fd) -{ +static int usbdev_open(const char *port, union pinfo pinfo, union filedescriptor *fd) { char string[256]; char product[256]; struct usb_bus *bus; @@ -328,7 +327,7 @@ static void usbdev_close(union filedescriptor *fd) } -static int usbdev_send(union filedescriptor *fd, const unsigned char *bp, size_t mlen) +static int usbdev_send(const union filedescriptor *fd, const unsigned char *bp, size_t mlen) { usb_dev_handle *udev = (usb_dev_handle *)fd->usb.handle; int rv; @@ -415,7 +414,7 @@ usb_fill_buf(usb_dev_handle *udev, int maxsize, int ep, int use_interrupt_xfer) return 0; } -static int usbdev_recv(union filedescriptor *fd, unsigned char *buf, size_t nbytes) +static int usbdev_recv(const union filedescriptor *fd, unsigned char *buf, size_t nbytes) { usb_dev_handle *udev = (usb_dev_handle *)fd->usb.handle; int i, amnt; @@ -470,7 +469,7 @@ static int usbdev_recv(union filedescriptor *fd, unsigned char *buf, size_t nbyt * * This is used for the AVRISP mkII device. */ -static int usbdev_recv_frame(union filedescriptor *fd, unsigned char *buf, size_t nbytes) +static int usbdev_recv_frame(const union filedescriptor *fd, unsigned char *buf, size_t nbytes) { usb_dev_handle *udev = (usb_dev_handle *)fd->usb.handle; int rv, n; @@ -570,7 +569,7 @@ static int usbdev_recv_frame(union filedescriptor *fd, unsigned char *buf, size_ return n; } -static int usbdev_drain(union filedescriptor *fd, int display) +static int usbdev_drain(const union filedescriptor *fd, int display) { /* * There is not much point in trying to flush any data diff --git a/src/usbasp.c b/src/usbasp.c index 2b4c4831..6a0e00f0 100644 --- a/src/usbasp.c +++ b/src/usbasp.c @@ -154,9 +154,9 @@ struct pdata // interface - management static void usbasp_setup(PROGRAMMER * pgm); static void usbasp_teardown(PROGRAMMER * pgm); -static int usbasp_parseextparms(PROGRAMMER * pgm, LISTID extparms); +static int usbasp_parseextparms(const PROGRAMMER *pgm, const LISTID extparms); // internal functions -static int usbasp_transmit(PROGRAMMER * pgm, unsigned char receive, +static int usbasp_transmit(const PROGRAMMER *pgm, unsigned char receive, unsigned char functionid, const unsigned char *send, unsigned char *buffer, int buffersize); #ifdef USE_LIBUSB_1_0 @@ -165,39 +165,98 @@ static int usbOpenDevice(libusb_device_handle **device, int vendor, const char * static int usbOpenDevice(usb_dev_handle **device, int vendor, const char *vendorName, int product, const char *productName); #endif // interface - prog. -static int usbasp_open(PROGRAMMER * pgm, char * port); -static void usbasp_close(PROGRAMMER * pgm); +static int usbasp_open(PROGRAMMER *pgm, const char *port); +static void usbasp_close(PROGRAMMER *pgm); // dummy functions -static void usbasp_disable(PROGRAMMER * pgm); -static void usbasp_enable(PROGRAMMER * pgm); -static void usbasp_display(PROGRAMMER * pgm, const char * p); +static void usbasp_disable(const PROGRAMMER *pgm); +static void usbasp_enable(PROGRAMMER *pgm, const AVRPART *p); +static void usbasp_display(const PROGRAMMER *pgm, const char *p); // universal functions -static int usbasp_initialize(PROGRAMMER * pgm, AVRPART * p); +static int usbasp_initialize(const PROGRAMMER *pgm, const AVRPART *p); // SPI specific functions -static int usbasp_spi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res); -static int usbasp_spi_program_enable(PROGRAMMER * pgm, AVRPART * p); -static int usbasp_spi_chip_erase(PROGRAMMER * pgm, AVRPART * p); -static int usbasp_spi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int usbasp_spi_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res); +static int usbasp_spi_program_enable(const PROGRAMMER *pgm, const AVRPART *p); +static int usbasp_spi_chip_erase(const PROGRAMMER *pgm, const AVRPART *p); +static int usbasp_spi_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -static int usbasp_spi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int usbasp_spi_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -static int usbasp_spi_set_sck_period(PROGRAMMER *pgm, double sckperiod); +static int usbasp_spi_set_sck_period(const PROGRAMMER *pgm, double sckperiod); // TPI specific functions -static void usbasp_tpi_send_byte(PROGRAMMER * pgm, uint8_t b); -static int usbasp_tpi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res); -static int usbasp_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p); -static int usbasp_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p); -static int usbasp_tpi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static void usbasp_tpi_send_byte(const PROGRAMMER *pgm, uint8_t b); +static int usbasp_tpi_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res); +static int usbasp_tpi_program_enable(const PROGRAMMER *pgm, const AVRPART *p); +static int usbasp_tpi_chip_erase(const PROGRAMMER *pgm, const AVRPART *p); +static int usbasp_tpi_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -static int usbasp_tpi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int usbasp_tpi_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes); -static int usbasp_tpi_set_sck_period(PROGRAMMER *pgm, double sckperiod); -static int usbasp_tpi_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned long addr, unsigned char * value); -static int usbasp_tpi_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned long addr, unsigned char data); +static int usbasp_tpi_set_sck_period(const PROGRAMMER *pgm, double sckperiod); +static int usbasp_tpi_read_byte(const PROGRAMMER * pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr, unsigned char *value); +static int usbasp_tpi_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr, unsigned char data); + + +// Dispatching wrappers + +static int usbasp_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { + return PDATA(pgm)->use_tpi? + usbasp_tpi_cmd(pgm, cmd, res): + usbasp_spi_cmd(pgm, cmd, res); +} + +static int usbasp_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { + return PDATA(pgm)->use_tpi? + usbasp_tpi_program_enable(pgm, p): + usbasp_spi_program_enable(pgm, p); +} + +static int usbasp_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { + return PDATA(pgm)->use_tpi? + usbasp_tpi_chip_erase(pgm, p): + usbasp_spi_chip_erase(pgm, p); +} + +static int usbasp_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, + unsigned int page_size, unsigned int addr, unsigned int n_bytes) { + + return PDATA(pgm)->use_tpi? + usbasp_tpi_paged_load(pgm, p, m, page_size, addr, n_bytes): + usbasp_spi_paged_load(pgm, p, m, page_size, addr, n_bytes); +} + +static int usbasp_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, + unsigned int page_size, unsigned int addr, unsigned int n_bytes) { + + return PDATA(pgm)->use_tpi? + usbasp_tpi_paged_write(pgm, p, m, page_size, addr, n_bytes): + usbasp_spi_paged_write(pgm, p, m, page_size, addr, n_bytes); +} + +static int usbasp_set_sck_period(const PROGRAMMER *pgm, double sckperiod) { + return PDATA(pgm)->use_tpi? + usbasp_tpi_set_sck_period(pgm, sckperiod): + usbasp_spi_set_sck_period(pgm, sckperiod); +} + +static int usbasp_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, + unsigned long addr, unsigned char * value) { + + return PDATA(pgm)->use_tpi? + usbasp_tpi_read_byte(pgm, p, m, addr, value): + avr_read_byte_default(pgm, p, m, addr, value); +} + +static int usbasp_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, + unsigned long addr, unsigned char data) { + + return PDATA(pgm)->use_tpi? + usbasp_tpi_write_byte(pgm, p, m, addr, data): + avr_write_byte_default(pgm, p, m, addr, data); +} /* Interface - management */ @@ -216,8 +275,7 @@ static void usbasp_teardown(PROGRAMMER * pgm) free(pgm->cookie); } -static int usbasp_parseextparms(PROGRAMMER * pgm, LISTID extparms) -{ +static int usbasp_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) { LNODEID ln; const char *extended_param; int rv = 0; @@ -270,7 +328,7 @@ static const char *usbasp_get_funcname(unsigned char functionid) /* * wrapper for usb_control_msg call */ -static int usbasp_transmit(PROGRAMMER * pgm, +static int usbasp_transmit(const PROGRAMMER *pgm, unsigned char receive, unsigned char functionid, const unsigned char *send, unsigned char *buffer, int buffersize) @@ -491,8 +549,7 @@ static int didUsbInit = 0; /* Interface - prog. */ -static int usbasp_open(PROGRAMMER * pgm, char * port) -{ +static int usbasp_open(PROGRAMMER *pgm, const char *port) { avrdude_message(MSG_DEBUG, "%s: usbasp_open(\"%s\")\n", progname, port); @@ -582,29 +639,28 @@ static void usbasp_close(PROGRAMMER * pgm) /* Dummy functions */ -static void usbasp_disable(PROGRAMMER * pgm) -{ +static void usbasp_disable(const PROGRAMMER *pgm) { /* Do nothing. */ return; } -static void usbasp_enable(PROGRAMMER * pgm) -{ +static void usbasp_enable(PROGRAMMER *pgm, const AVRPART *p) { /* Do nothing. */ return; } -static void usbasp_display(PROGRAMMER * pgm, const char * p) -{ +static void usbasp_display(const PROGRAMMER *pgm, const char *p) { return; } + +// @@@ + /* Universal functions: for both SPI and TPI */ -static int usbasp_initialize(PROGRAMMER * pgm, AVRPART * p) -{ +static int usbasp_initialize(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char temp[4]; unsigned char res[4]; IMPORT_PDATA(pgm); @@ -618,7 +674,7 @@ static int usbasp_initialize(PROGRAMMER * pgm, AVRPART * p) else pdata->capabilities = 0; - pdata->use_tpi = ((pdata->capabilities & USBASP_CAP_TPI) != 0 && (p->flags & AVRPART_HAS_TPI) != 0) ? 1 : 0; + pdata->use_tpi = (pdata->capabilities & USBASP_CAP_TPI) && (p->flags & AVRPART_HAS_TPI); // query support for 3 MHz SCK in UsbAsp-flash firmware // https://github.com/nofeletru/UsbAsp-flash pdata->sck_3mhz = ((pdata->capabilities & USBASP_CAP_3MHZ) != 0) ? 1 :0; @@ -636,16 +692,6 @@ static int usbasp_initialize(PROGRAMMER * pgm, AVRPART * p) /* connect */ usbasp_transmit(pgm, 1, USBASP_FUNC_TPI_CONNECT, temp, res, sizeof(res)); - - /* change interface */ - pgm->program_enable = usbasp_tpi_program_enable; - pgm->chip_erase = usbasp_tpi_chip_erase; - pgm->cmd = usbasp_tpi_cmd; - pgm->read_byte = usbasp_tpi_read_byte; - pgm->write_byte = usbasp_tpi_write_byte; - pgm->paged_write = usbasp_tpi_paged_write; - pgm->paged_load = usbasp_tpi_paged_load; - pgm->set_sck_period = usbasp_tpi_set_sck_period; } else { @@ -654,16 +700,6 @@ static int usbasp_initialize(PROGRAMMER * pgm, AVRPART * p) /* connect to target device */ usbasp_transmit(pgm, 1, USBASP_FUNC_CONNECT, temp, res, sizeof(res)); - - /* change interface */ - pgm->program_enable = usbasp_spi_program_enable; - pgm->chip_erase = usbasp_spi_chip_erase; - pgm->cmd = usbasp_spi_cmd; - pgm->read_byte = avr_read_byte_default; - pgm->write_byte = avr_write_byte_default; - pgm->paged_write = usbasp_spi_paged_write; - pgm->paged_load = usbasp_spi_paged_load; - pgm->set_sck_period = usbasp_spi_set_sck_period; } /* wait, so device is ready to receive commands */ @@ -673,7 +709,7 @@ static int usbasp_initialize(PROGRAMMER * pgm, AVRPART * p) } /* SPI specific functions */ -static int usbasp_spi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, +static int usbasp_spi_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { avrdude_message(MSG_DEBUG, "%s: usbasp_spi_cmd(0x%02x, 0x%02x, 0x%02x, 0x%02x)%s", @@ -698,8 +734,7 @@ static int usbasp_spi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, return 0; } -static int usbasp_spi_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +static int usbasp_spi_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char res[4]; unsigned char cmd[4]; memset(cmd, 0, sizeof(cmd)); @@ -722,8 +757,7 @@ static int usbasp_spi_program_enable(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int usbasp_spi_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int usbasp_spi_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4]; unsigned char res[4]; @@ -746,10 +780,9 @@ static int usbasp_spi_chip_erase(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int usbasp_spi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, - unsigned int page_size, - unsigned int address, unsigned int n_bytes) -{ +static int usbasp_spi_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, + unsigned int page_size, unsigned int address, unsigned int n_bytes) { + int n; unsigned char cmd[4]; int wbytes = n_bytes; @@ -813,10 +846,9 @@ static int usbasp_spi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return n_bytes; } -static int usbasp_spi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, - unsigned int page_size, - unsigned int address, unsigned int n_bytes) -{ +static int usbasp_spi_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, + unsigned int page_size, unsigned int address, unsigned int n_bytes) { + int n; unsigned char cmd[4]; int wbytes = n_bytes; @@ -907,8 +939,7 @@ static struct sckoptions_t usbaspSCKoptions[] = { * Set sck period (in seconds) * Find next possible sck period and write it to the programmer. */ -static int usbasp_spi_set_sck_period(PROGRAMMER *pgm, double sckperiod) -{ +static int usbasp_spi_set_sck_period(const PROGRAMMER *pgm, double sckperiod) { char clockoption = USBASP_ISP_SCK_AUTO; unsigned char res[4]; unsigned char cmd[4]; @@ -980,8 +1011,7 @@ static int usbasp_spi_set_sck_period(PROGRAMMER *pgm, double sckperiod) } /* TPI specific functions */ -static void usbasp_tpi_send_byte(PROGRAMMER * pgm, uint8_t b) -{ +static void usbasp_tpi_send_byte(const PROGRAMMER *pgm, uint8_t b) { unsigned char temp[4]; memset(temp, 0, sizeof(temp)); @@ -991,8 +1021,7 @@ static void usbasp_tpi_send_byte(PROGRAMMER * pgm, uint8_t b) } -static int usbasp_tpi_recv_byte(PROGRAMMER * pgm) -{ +static int usbasp_tpi_recv_byte(const PROGRAMMER *pgm) { unsigned char temp[4]; memset(temp, 0, sizeof(temp)); @@ -1006,8 +1035,7 @@ static int usbasp_tpi_recv_byte(PROGRAMMER * pgm) } -static int usbasp_tpi_nvm_waitbusy(PROGRAMMER * pgm) -{ +static int usbasp_tpi_nvm_waitbusy(const PROGRAMMER *pgm) { int retry; avrdude_message(MSG_DEBUG, "%s: usbasp_tpi_nvm_waitbusy() ...", progname); @@ -1028,14 +1056,12 @@ static int usbasp_tpi_nvm_waitbusy(PROGRAMMER * pgm) return -1; } -static int usbasp_tpi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res) -{ +static int usbasp_tpi_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { avrdude_message(MSG_INFO, "%s: error: spi_cmd used in TPI mode: not allowed\n", progname); return -1; } -static int usbasp_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p) -{ +static int usbasp_tpi_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { int retry; avrdude_message(MSG_DEBUG, "%s: usbasp_tpi_program_enable()\n", progname); @@ -1075,8 +1101,7 @@ static int usbasp_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int usbasp_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int usbasp_tpi_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { int pr_0; int pr_1; int nvm_cmd; @@ -1117,10 +1142,9 @@ static int usbasp_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p) return 0; } -static int usbasp_tpi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, - unsigned int page_size, - unsigned int addr, unsigned int n_bytes) -{ +static int usbasp_tpi_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, + unsigned int page_size, unsigned int addr, unsigned int n_bytes) { + unsigned char cmd[4]; unsigned char* dptr; int readed, clen, n; @@ -1160,10 +1184,9 @@ static int usbasp_tpi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return n_bytes; } -static int usbasp_tpi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, - unsigned int page_size, - unsigned int addr, unsigned int n_bytes) -{ +static int usbasp_tpi_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, + unsigned int page_size, unsigned int addr, unsigned int n_bytes) { + unsigned char cmd[4]; unsigned char* sptr; int writed, clen, n; @@ -1227,12 +1250,11 @@ static int usbasp_tpi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return n_bytes; } -static int usbasp_tpi_set_sck_period(PROGRAMMER *pgm, double sckperiod) -{ +static int usbasp_tpi_set_sck_period(const PROGRAMMER *pgm, double sckperiod) { return 0; } -static int usbasp_tpi_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned long addr, unsigned char * value) -{ + +static int usbasp_tpi_read_byte(const PROGRAMMER * pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr, unsigned char *value) { unsigned char cmd[4]; int n; uint16_t pr; @@ -1257,15 +1279,15 @@ static int usbasp_tpi_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsig return 0; } -static int usbasp_tpi_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned long addr, unsigned char data) -{ +static int usbasp_tpi_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, + unsigned long addr, unsigned char data) { // FIXME: use avr_write_byte_cache() when implemented + avrdude_message(MSG_INFO, "%s: error: usbasp_write_byte in TPI mode: all writes have to be done at page level\n", progname); return -1; } -void usbasp_initpgm(PROGRAMMER * pgm) -{ +void usbasp_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "usbasp"); /* @@ -1276,23 +1298,23 @@ void usbasp_initpgm(PROGRAMMER * pgm) pgm->display = usbasp_display; pgm->enable = usbasp_enable; pgm->disable = usbasp_disable; - pgm->program_enable = usbasp_spi_program_enable; - pgm->chip_erase = usbasp_spi_chip_erase; - pgm->cmd = usbasp_spi_cmd; + pgm->program_enable = usbasp_program_enable; + pgm->chip_erase = usbasp_chip_erase; + pgm->cmd = usbasp_cmd; pgm->open = usbasp_open; pgm->close = usbasp_close; - pgm->read_byte = avr_read_byte_default; - pgm->write_byte = avr_write_byte_default; + pgm->read_byte = usbasp_read_byte; + pgm->write_byte = usbasp_write_byte; /* * optional functions */ - pgm->paged_write = usbasp_spi_paged_write; - pgm->paged_load = usbasp_spi_paged_load; + pgm->paged_write = usbasp_paged_write; + pgm->paged_load = usbasp_paged_load; pgm->setup = usbasp_setup; pgm->teardown = usbasp_teardown; - pgm->set_sck_period = usbasp_spi_set_sck_period; + pgm->set_sck_period = usbasp_set_sck_period; pgm->parseextparams = usbasp_parseextparms; } @@ -1300,16 +1322,14 @@ void usbasp_initpgm(PROGRAMMER * pgm) #else /* HAVE_LIBUSB */ -static int usbasp_nousb_open (struct programmer_t *pgm, char * name) -{ +static int usbasp_nousb_open(PROGRAMMER *pgm, const char *name) { avrdude_message(MSG_INFO, "%s: error: no usb support. please compile again with libusb installed.\n", progname); return -1; } -void usbasp_initpgm(PROGRAMMER * pgm) -{ +void usbasp_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "usbasp"); pgm->open = usbasp_nousb_open; diff --git a/src/usbasp.h b/src/usbasp.h index 11f98293..b91aeaaf 100644 --- a/src/usbasp.h +++ b/src/usbasp.h @@ -130,7 +130,7 @@ extern "C" { #endif extern const char usbasp_desc[]; -void usbasp_initpgm (PROGRAMMER * pgm); +void usbasp_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/usbtiny.c b/src/usbtiny.c index 75c88be6..5cdaad4a 100644 --- a/src/usbtiny.c +++ b/src/usbtiny.c @@ -61,9 +61,6 @@ typedef unsigned int uint_t; typedef unsigned long ulong_t; #endif -extern int avr_write_byte_default ( PROGRAMMER* pgm, AVRPART* p, - AVRMEM* mem, ulong_t addr, - unsigned char data ); /* * Private data for this programmer. */ @@ -95,7 +92,7 @@ static void usbtiny_teardown(PROGRAMMER * pgm) } // Wrapper for simple usb_control_msg messages -static int usb_control (PROGRAMMER * pgm, +static int usb_control (const PROGRAMMER *pgm, unsigned int requestid, unsigned int val, unsigned int index ) { int nbytes; @@ -114,7 +111,7 @@ static int usb_control (PROGRAMMER * pgm, } // Wrapper for simple usb_control_msg messages to receive data from programmer -static int usb_in (PROGRAMMER * pgm, +static int usb_in (const PROGRAMMER *pgm, unsigned int requestid, unsigned int val, unsigned int index, unsigned char* buffer, int buflen, int bitclk ) { @@ -144,8 +141,7 @@ static int usb_in (PROGRAMMER * pgm, } // Report the number of retries, and reset the counter. -static void check_retries (PROGRAMMER * pgm, const char* operation) -{ +static void check_retries (const PROGRAMMER *pgm, const char *operation) { if (PDATA(pgm)->retries > 0 && quell_progress < 2) { avrdude_message(MSG_INFO, "%s: %d retries during %s\n", progname, PDATA(pgm)->retries, operation); @@ -154,7 +150,7 @@ static void check_retries (PROGRAMMER * pgm, const char* operation) } // Wrapper for simple usb_control_msg messages to send data to programmer -static int usb_out (PROGRAMMER * pgm, +static int usb_out (const PROGRAMMER *pgm, unsigned int requestid, unsigned int val, unsigned int index, unsigned char* buffer, int buflen, int bitclk ) { @@ -221,8 +217,7 @@ static unsigned short tpi_frame(unsigned char b) { /* Transmit a single byte encapsulated in a 32-bit transfer. Unused bits are padded with 1s. */ -static int usbtiny_tpi_tx(PROGRAMMER *pgm, unsigned char b0) -{ +static int usbtiny_tpi_tx(const PROGRAMMER *pgm, unsigned char b0) { unsigned char res[4]; if (usb_in(pgm, USBTINY_SPI, tpi_frame(b0), 0xffff, @@ -235,7 +230,7 @@ static int usbtiny_tpi_tx(PROGRAMMER *pgm, unsigned char b0) /* Transmit a two bytes encapsulated in a 32-bit transfer. Unused bits are padded with 1s. */ -static int usbtiny_tpi_txtx(PROGRAMMER *pgm, +static int usbtiny_tpi_txtx(const PROGRAMMER *pgm, unsigned char b0, unsigned char b1) { unsigned char res[4]; @@ -253,8 +248,7 @@ static int usbtiny_tpi_txtx(PROGRAMMER *pgm, the start bit of the byte being received arrives within at most 2 TPICLKs. We ensure this by calling avr_tpi_program_enable() with delay==TPIPCR_GT_0b. */ -static int usbtiny_tpi_txrx(PROGRAMMER *pgm, unsigned char b0) -{ +static int usbtiny_tpi_txrx(const PROGRAMMER *pgm, unsigned char b0) { unsigned char res[4], r; short w; @@ -287,7 +281,7 @@ static int usbtiny_tpi_txrx(PROGRAMMER *pgm, unsigned char b0) // a function. Here we wrap this request for an operation so that we // can just specify the part and operation and it'll do the right stuff // to get the information from AvrDude and send to the USBtiny -static int usbtiny_avr_op (PROGRAMMER * pgm, AVRPART * p, +static int usbtiny_avr_op (const PROGRAMMER *pgm, const AVRPART *p, int op, unsigned char *res) { @@ -307,11 +301,10 @@ static int usbtiny_avr_op (PROGRAMMER * pgm, AVRPART * p, /* Find a device with the correct VID/PID match for USBtiny */ -static int usbtiny_open(PROGRAMMER* pgm, char* name) -{ +static int usbtiny_open(PROGRAMMER *pgm, const char *name) { struct usb_bus *bus; struct usb_device *dev = 0; - char *bus_name = NULL; + const char *bus_name = NULL; char *dev_name = NULL; int vid, pid; @@ -402,8 +395,7 @@ static void usbtiny_close ( PROGRAMMER* pgm ) /* A simple calculator function determines the maximum size of data we can shove through a USB connection without getting errors */ -static void usbtiny_set_chunk_size (PROGRAMMER * pgm, int period) -{ +static void usbtiny_set_chunk_size (const PROGRAMMER *pgm, int period) { PDATA(pgm)->chunk_size = CHUNK_SIZE; // start with the maximum (default) while (PDATA(pgm)->chunk_size > 8 && period > 16) { // Reduce the chunk size for a slow SCK to reduce @@ -415,8 +407,7 @@ static void usbtiny_set_chunk_size (PROGRAMMER * pgm, int period) /* Given a SCK bit-clock speed (in useconds) we verify its an OK speed and tell the USBtiny to update itself to the new frequency */ -static int usbtiny_set_sck_period (PROGRAMMER *pgm, double v) -{ +static int usbtiny_set_sck_period (const PROGRAMMER *pgm, double v) { PDATA(pgm)->sck_period = (int)(v * 1e6 + 0.5); // convert from us to 'int', the 0.5 is for rounding up // Make sure its not 0, as that will confuse the usbtiny @@ -441,8 +432,7 @@ static int usbtiny_set_sck_period (PROGRAMMER *pgm, double v) } -static int usbtiny_initialize (PROGRAMMER *pgm, AVRPART *p ) -{ +static int usbtiny_initialize (const PROGRAMMER *pgm, const AVRPART *p ) { unsigned char res[4]; // store the response from usbtinyisp int tries; @@ -511,8 +501,7 @@ static int usbtiny_initialize (PROGRAMMER *pgm, AVRPART *p ) return 0; } -static int usbtiny_setpin(struct programmer_t * pgm, int pinfunc, int value) -{ +static int usbtiny_setpin(const PROGRAMMER *pgm, int pinfunc, int value) { /* USBtiny is not a bit bang device, but it can set RESET */ if(pinfunc == PIN_AVR_RESET) { if (usb_control(pgm, USBTINY_POWERUP, @@ -526,8 +515,7 @@ static int usbtiny_setpin(struct programmer_t * pgm, int pinfunc, int value) } /* Tell the USBtiny to release the output pins, etc */ -static void usbtiny_powerdown(PROGRAMMER * pgm) -{ +static void usbtiny_powerdown(const PROGRAMMER *pgm) { if (!PDATA(pgm)->usb_handle) { return; // wasn't connected in the first place } @@ -536,8 +524,7 @@ static void usbtiny_powerdown(PROGRAMMER * pgm) /* Send a 4-byte SPI command to the USBtinyISP for execution This procedure is used by higher-level Avrdude procedures */ -static int usbtiny_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res) -{ +static int usbtiny_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) { int nbytes; // Make sure its empty so we don't read previous calls if it fails @@ -558,7 +545,7 @@ static int usbtiny_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char res[2] == cmd[1]); // AVR's do a delayed-echo thing } -int usbtiny_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, +int usbtiny_cmd_tpi(const PROGRAMMER *pgm, const unsigned char *cmd, int cmd_len, unsigned char *res, int res_len) { unsigned char b0, b1; @@ -594,8 +581,7 @@ int usbtiny_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, return 0; } -static int usbtiny_spi(struct programmer_t * pgm, const unsigned char *cmd, unsigned char *res, int count) -{ +static int usbtiny_spi(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res, int count) { int i; // Clear the receive buffer so we don't read old data in case of failure @@ -616,8 +602,7 @@ static int usbtiny_spi(struct programmer_t * pgm, const unsigned char *cmd, unsi } /* Send the chip-erase command */ -static int usbtiny_chip_erase(PROGRAMMER * pgm, AVRPART * p) -{ +static int usbtiny_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char res[4]; if (p->flags & AVRPART_HAS_TPI) @@ -642,9 +627,11 @@ static int usbtiny_chip_erase(PROGRAMMER * pgm, AVRPART * p) } // These are required functions but don't actually do anything -static void usbtiny_enable ( PROGRAMMER* pgm ) {} +static void usbtiny_enable(PROGRAMMER *pgm, const AVRPART *p) { +} -static void usbtiny_disable ( PROGRAMMER* pgm ) {} +static void usbtiny_disable(const PROGRAMMER *pgm) { +} /* To speed up programming and reading, we do a 'chunked' read. @@ -652,7 +639,7 @@ static void usbtiny_disable ( PROGRAMMER* pgm ) {} * given to read in the data. Much faster than sending a 4-byte SPI request * per byte */ -static int usbtiny_paged_load (PROGRAMMER * pgm, AVRPART * p, AVRMEM* m, +static int usbtiny_paged_load (const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -722,7 +709,7 @@ static int usbtiny_paged_load (PROGRAMMER * pgm, AVRPART * p, AVRMEM* m, * given to write the data. Much faster than sending a 4-byte SPI request * per byte. */ -static int usbtiny_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, +static int usbtiny_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { @@ -783,8 +770,7 @@ static int usbtiny_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return n_bytes; } -static int usbtiny_program_enable(PROGRAMMER *pgm, AVRPART *p) -{ +static int usbtiny_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char buf[4]; if (p->flags & AVRPART_HAS_TPI) @@ -793,8 +779,7 @@ static int usbtiny_program_enable(PROGRAMMER *pgm, AVRPART *p) return usbtiny_avr_op(pgm, p, AVR_OP_PGM_ENABLE, buf); } -void usbtiny_initpgm ( PROGRAMMER* pgm ) -{ +void usbtiny_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "USBtiny"); /* Mandatory Functions */ @@ -826,16 +811,14 @@ void usbtiny_initpgm ( PROGRAMMER* pgm ) // Give a proper error if we were not compiled with libusb -static int usbtiny_nousb_open(struct programmer_t *pgm, char * name) -{ +static int usbtiny_nousb_open(PROGRAMMER *pgm, const char *name) { avrdude_message(MSG_INFO, "%s: error: no usb support. Please compile again with libusb installed.\n", progname); return -1; } -void usbtiny_initpgm(PROGRAMMER * pgm) -{ +void usbtiny_initpgm(PROGRAMMER *pgm) { strcpy(pgm->type, "usbtiny"); pgm->open = usbtiny_nousb_open; diff --git a/src/usbtiny.h b/src/usbtiny.h index b663ced1..153d75c4 100644 --- a/src/usbtiny.h +++ b/src/usbtiny.h @@ -59,7 +59,7 @@ extern "C" { #endif extern const char usbtiny_desc[]; -void usbtiny_initpgm (PROGRAMMER * pgm); +void usbtiny_initpgm(PROGRAMMER *pgm); #ifdef __cplusplus } diff --git a/src/wiring.c b/src/wiring.c index c0a68055..204bde5c 100644 --- a/src/wiring.c +++ b/src/wiring.c @@ -109,8 +109,7 @@ static void wiring_teardown(PROGRAMMER * pgm) stk500v2_teardown(pgm); } -static int wiring_parseextparms(PROGRAMMER * pgm, LISTID extparms) -{ +static int wiring_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) { LNODEID ln; const char *extended_param; int rv = 0; @@ -143,8 +142,7 @@ static int wiring_parseextparms(PROGRAMMER * pgm, LISTID extparms) return rv; } -static int wiring_open(PROGRAMMER * pgm, char * port) -{ +static int wiring_open(PROGRAMMER *pgm, const char *port) { int timetosnooze; void *mycookie = STK500V2PDATA(pgm)->chained_pdata; union pinfo pinfo; @@ -205,8 +203,7 @@ static void wiring_close(PROGRAMMER * pgm) const char wiring_desc[] = "http://wiring.org.co/, Basically STK500v2 protocol, with some glue to trigger the bootloader."; -void wiring_initpgm(PROGRAMMER * pgm) -{ +void wiring_initpgm(PROGRAMMER *pgm) { /* The Wiring bootloader uses a near-complete STK500v2 protocol. */ stk500v2_initpgm(pgm); diff --git a/src/wiring.h b/src/wiring.h index ed1362de..dbe42b8b 100644 --- a/src/wiring.h +++ b/src/wiring.h @@ -22,7 +22,7 @@ #define wiring_h__ extern const char wiring_desc[]; -void wiring_initpgm(PROGRAMMER * pgm); +void wiring_initpgm(PROGRAMMER *pgm); #endif diff --git a/src/xbee.c b/src/xbee.c index 1f974e55..dbc0f511 100644 --- a/src/xbee.c +++ b/src/xbee.c @@ -30,12 +30,12 @@ #include "ac_cfg.h" -#include /* gettimeofday() */ +#include -#include /* sscanf() */ -#include /* malloc() */ -#include /* memmove() etc. */ -#include /* usleep() */ +#include +#include +#include +#include #include "avrdude.h" #include "libavrdude.h" @@ -43,27 +43,6 @@ #include "stk500.h" #include "xbee.h" -/* - * For non-direct mode (Over-The-Air) we need to issue XBee commands - * to the remote XBee in order to reset the AVR CPU and initiate the - * XBeeBoot bootloader. - * - * XBee IO port 3 is a somewhat-arbitrarily chosen pin that can be - * connected directly to the AVR reset pin. - * - * Note that port 7 was not used because it is the only pin that can - * be used as a CTS flow control output. Port 6 is the only pin that - * can be used as an RTS flow control input. - * - * Some off-the-shelf Arduino shields select a different pin. For - * example this one uses XBee IO port 7. - * - * https://wiki.dfrobot.com/Xbee_Shield_For_Arduino__no_Xbee___SKU_DFR0015_ - */ -#ifndef XBEE_DEFAULT_RESET_PIN -#define XBEE_DEFAULT_RESET_PIN 3 -#endif - /* * After eight seconds the AVR bootloader watchdog will kick in. But * to allow for the possibility of eight seconds upstream and another @@ -125,8 +104,7 @@ * Read signature bytes - Direct copy of the Arduino behaviour to * satisfy Optiboot. */ -static int xbee_read_sig_bytes(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m) -{ +static int xbee_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m) { unsigned char buf[32]; /* Signature byte reads are always 3 bytes. */ @@ -318,7 +296,7 @@ static void XBeeBootSessionInit(struct XBeeBootSession *xbs) { #define xbeebootsession(fdp) (struct XBeeBootSession*)((fdp)->pfd) -static void xbeedev_setresetpin(union filedescriptor *fdp, int xbeeResetPin) +static void xbeedev_setresetpin(const union filedescriptor *fdp, int xbeeResetPin) { struct XBeeBootSession *xbs = xbeebootsession(fdp); xbs->xbeeResetPin = xbeeResetPin; @@ -1106,7 +1084,7 @@ static void xbeedev_close(union filedescriptor *fdp) xbeedev_free(xbs); } -static int xbeedev_open(char *port, union pinfo pinfo, +static int xbeedev_open(const char *port, union pinfo pinfo, union filedescriptor *fdp) { /* @@ -1329,7 +1307,7 @@ static int xbeedev_open(char *port, union pinfo pinfo, return 0; } -static int xbeedev_send(union filedescriptor *fdp, +static int xbeedev_send(const union filedescriptor *fdp, const unsigned char *buf, size_t buflen) { struct XBeeBootSession *xbs = xbeebootsession(fdp); @@ -1453,7 +1431,7 @@ static int xbeedev_send(union filedescriptor *fdp, return 0; } -static int xbeedev_recv(union filedescriptor *fdp, +static int xbeedev_recv(const union filedescriptor *fdp, unsigned char *buf, size_t buflen) { struct XBeeBootSession *xbs = xbeebootsession(fdp); @@ -1528,7 +1506,7 @@ static int xbeedev_recv(union filedescriptor *fdp, return -1; } -static int xbeedev_drain(union filedescriptor *fdp, int display) +static int xbeedev_drain(const union filedescriptor *fdp, int display) { struct XBeeBootSession *xbs = xbeebootsession(fdp); @@ -1547,7 +1525,7 @@ static int xbeedev_drain(union filedescriptor *fdp, int display) return 0; } -static int xbeedev_set_dtr_rts(union filedescriptor *fdp, int is_on) +static int xbeedev_set_dtr_rts(const union filedescriptor *fdp, int is_on) { struct XBeeBootSession *xbs = xbeebootsession(fdp); @@ -1587,8 +1565,7 @@ static struct serial_device xbee_serdev_frame = { .flags = SERDEV_FL_NONE, }; -static int xbee_getsync(PROGRAMMER *pgm) -{ +static int xbee_getsync(const PROGRAMMER *pgm) { unsigned char buf[2], resp[2]; /* @@ -1637,8 +1614,7 @@ static int xbee_getsync(PROGRAMMER *pgm) return 0; } -static int xbee_open(PROGRAMMER *pgm, char *port) -{ +static int xbee_open(PROGRAMMER *pgm, const char *port) { union pinfo pinfo; strcpy(pgm->port, port); pinfo.serialinfo.baud = pgm->baudrate; @@ -1653,13 +1629,7 @@ static int xbee_open(PROGRAMMER *pgm, char *port) return -1; } - /* - * NB: Because we are making use of the STK500 programmer - * implementation, we can't readily use pgm->cookie ourselves. We - * can use the private "flag" field in the PROGRAMMER though, as - * it's unused by stk500.c. - */ - xbeedev_setresetpin(&pgm->fd, pgm->flag); + xbeedev_setresetpin(&pgm->fd, PDATA(pgm)->xbeeResetPin); /* Clear DTR and RTS */ serial_set_dtr_rts(&pgm->fd, 0); @@ -1723,8 +1693,7 @@ static void xbee_close(PROGRAMMER *pgm) pgm->fd.pfd = NULL; } -static int xbee_parseextparms(PROGRAMMER *pgm, LISTID extparms) -{ +static int xbee_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) { LNODEID ln; const char *extended_param; int rc = 0; @@ -1744,7 +1713,7 @@ static int xbee_parseextparms(PROGRAMMER *pgm, LISTID extparms) continue; } - pgm->flag = resetpin; + PDATA(pgm)->xbeeResetPin = resetpin; continue; } @@ -1759,12 +1728,11 @@ static int xbee_parseextparms(PROGRAMMER *pgm, LISTID extparms) const char xbee_desc[] = "XBee Series 2 Over-The-Air (XBeeBoot)"; -void xbee_initpgm(PROGRAMMER *pgm) -{ +void xbee_initpgm(PROGRAMMER *pgm) { /* * This behaves like an Arduino, but with packet encapsulation of * the serial streams, XBee device management, and XBee GPIO for the - * Auto-Reset feature. + * Auto-Reset feature. stk500.c sets PDATA(pgm)->xbeeResetPin */ stk500_initpgm(pgm); @@ -1773,13 +1741,5 @@ void xbee_initpgm(PROGRAMMER *pgm) pgm->open = xbee_open; pgm->close = xbee_close; - /* - * NB: Because we are making use of the STK500 programmer - * implementation, we can't readily use pgm->cookie ourselves, nor - * can we override setup() and teardown(). We can use the private - * "flag" field in the PROGRAMMER though, as it's unused by - * stk500.c. - */ pgm->parseextparams = xbee_parseextparms; - pgm->flag = XBEE_DEFAULT_RESET_PIN; } diff --git a/src/xbee.h b/src/xbee.h index 9830d853..00a1682b 100644 --- a/src/xbee.h +++ b/src/xbee.h @@ -22,6 +22,27 @@ #define xbee_h__ extern const char xbee_desc[]; -void xbee_initpgm (PROGRAMMER * pgm); +void xbee_initpgm(PROGRAMMER *pgm); + +/* + * For non-direct mode (Over-The-Air) we need to issue XBee commands + * to the remote XBee in order to reset the AVR CPU and initiate the + * XBeeBoot bootloader. + * + * XBee IO port 3 is a somewhat-arbitrarily chosen pin that can be + * connected directly to the AVR reset pin. + * + * Note that port 7 was not used because it is the only pin that can + * be used as a CTS flow control output. Port 6 is the only pin that + * can be used as an RTS flow control input. + * + * Some off-the-shelf Arduino shields select a different pin. For + * example this one uses XBee IO port 7. + * + * https://wiki.dfrobot.com/Xbee_Shield_For_Arduino__no_Xbee___SKU_DFR0015_ + */ +#ifndef XBEE_DEFAULT_RESET_PIN +#define XBEE_DEFAULT_RESET_PIN 3 +#endif #endif From 38aa1313f94fb2ece97ea9a87d5384e8b7cb2b89 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 19 Aug 2022 23:14:19 +0100 Subject: [PATCH 205/511] Print device code in avr910.c as unsigned char --- src/avr910.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/avr910.c b/src/avr910.c index 3e14fdc1..f54c5b3b 100644 --- a/src/avr910.c +++ b/src/avr910.c @@ -234,7 +234,7 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p) break; part = locate_part_by_avr910_devcode(part_list, c); - avrdude_message(MSG_INFO, " Device code: 0x%02x = %s\n", c, part ? part->desc : "(unknown)"); + avrdude_message(MSG_INFO, " Device code: 0x%02x = %s\n", c & 0xff, part? part->desc: "(unknown)"); /* FIXME: Need to lookup devcode and report the device. */ From f8dd9bc97d57183b0b03f1b44d2009f3fda50c38 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sat, 20 Aug 2022 14:08:04 +0100 Subject: [PATCH 206/511] Correct flash paged write for avrftdi.c --- src/avrftdi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/avrftdi.c b/src/avrftdi.c index 315f23e8..dbeb9b16 100644 --- a/src/avrftdi.c +++ b/src/avrftdi.c @@ -1059,12 +1059,11 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, /* find a poll byte. We cannot poll a value of 0xff, so look * for a value != 0xff */ - for(poll_index = addr+len-1; poll_index > addr-1; poll_index--) + for(poll_index = addr+len-1; (int) poll_index >= (int) addr; poll_index--) if(m->buf[poll_index] != 0xff) break; - if((poll_index < addr + len) && m->buf[poll_index] != 0xff) - { + if((int) poll_index >= (int) addr) { buf_size = bufptr - buf; if(verbose > TRACE) From 56aae55737e3c17f37ea3871e5d25cc408a3d706 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 21 Aug 2022 00:05:44 +0100 Subject: [PATCH 207/511] Replace loop/if condition and reduce signed comparison warnings in avrftfi.c Change (int) poll_index >= (int) addr to poll_index+1 > addr as the former might turn out to be implementation-defined. The latter is always defined and what we want here (poll_index+1 won't overflow). Originally, the condition was poll_index > addr-1, which was always false for addr=0 owing to 2^n modulo arithmetic of unsigned. Also changed a few comparisons so they no longer are between signed and unsigned integers reducing compiler warnings. --- src/avrftdi.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/avrftdi.c b/src/avrftdi.c index dbeb9b16..1d69f4e0 100644 --- a/src/avrftdi.c +++ b/src/avrftdi.c @@ -351,7 +351,7 @@ static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsig size_t blocksize = pdata->rx_buffer_size/2; // we are reading 2 bytes per data byte // determine a maximum size of data block - size_t max_size = MIN(pdata->ftdic->max_packet_size,pdata->tx_buffer_size); + size_t max_size = MIN(pdata->ftdic->max_packet_size, (unsigned int) pdata->tx_buffer_size); // select block size so that resulting commands does not exceed max_size if possible blocksize = MAX(1,(max_size-7)/((8*2*6)+(8*1*2))); //avrdude_message(MSG_INFO, "blocksize %d \n",blocksize); @@ -368,9 +368,8 @@ static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsig // (8*1) inputs per data byte, 2 transmit bytes per input (GET_BITS_LOW/HIGH), // 1x SEND_IMMEDIATE int len = 0; - int i; - for(i = 0 ; i< transfer_size; i++) { + for(size_t i = 0 ; i < transfer_size; i++) { len += set_data(pgm, send_buffer + len, buf[written+i], (mode & MPSSE_DO_READ) != 0); } @@ -387,14 +386,14 @@ static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsig E(ftdi_write_data(pdata->ftdic, send_buffer, len) != len, pdata->ftdic); if (mode & MPSSE_DO_READ) { int n; - int k = 0; + size_t k = 0; do { n = ftdi_read_data(pdata->ftdic, &recv_buffer[k], 2*16*transfer_size - k); E(n < 0, pdata->ftdic); k += n; } while (k < transfer_size); - for(i = 0 ; i< transfer_size; i++) { + for(size_t i = 0 ; i< transfer_size; i++) { data[written + i] = extract_data(pgm, recv_buffer, i); } } @@ -437,7 +436,7 @@ static int avrftdi_transmit_mpsse(avrftdi_t* pdata, unsigned char mode, const un { size_t transfer_size = (remaining > blocksize) ? blocksize : remaining; - E(ftdi_write_data(pdata->ftdic, (unsigned char*)&buf[written], transfer_size) != transfer_size, pdata->ftdic); + E((size_t) ftdi_write_data(pdata->ftdic, (unsigned char*)&buf[written], transfer_size) != transfer_size, pdata->ftdic); #if 0 if(remaining < blocksize) E(ftdi_write_data(pdata->ftdic, &si, sizeof(si)) != sizeof(si), pdata->ftdic); @@ -445,7 +444,7 @@ static int avrftdi_transmit_mpsse(avrftdi_t* pdata, unsigned char mode, const un if (mode & MPSSE_DO_READ) { int n; - int k = 0; + size_t k = 0; do { n = ftdi_read_data(pdata->ftdic, &data[written + k], transfer_size - k); E(n < 0, pdata->ftdic); @@ -1015,7 +1014,7 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return -1; } - if(page_size != m->page_size) { + if(page_size != (unsigned int) m->page_size) { log_warn("Parameter page_size is %d, ", page_size); log_warn("but m->page_size is %d. Using the latter.\n", m->page_size); } @@ -1059,11 +1058,11 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, /* find a poll byte. We cannot poll a value of 0xff, so look * for a value != 0xff */ - for(poll_index = addr+len-1; (int) poll_index >= (int) addr; poll_index--) + for(poll_index = addr+len-1; poll_index+1 > addr; poll_index--) if(m->buf[poll_index] != 0xff) break; - if((int) poll_index >= (int) addr) { + if(poll_index+1 > addr) { buf_size = bufptr - buf; if(verbose > TRACE) @@ -1104,12 +1103,11 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned int page_size, unsigned int addr, unsigned int len) { OPCODE * readop; - int byte, word; unsigned int buf_size = 4 * len + 4; unsigned char* o_buf = alloca(buf_size); unsigned char* i_buf = alloca(buf_size); - unsigned int index; + memset(o_buf, 0, buf_size); memset(i_buf, 0, buf_size); @@ -1128,7 +1126,7 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, return -1; /* word addressing! */ - for(word = addr/2, index = 0; word < (addr + len)/2; word++) + for(unsigned int word = addr/2, index = 0; word < (addr + len)/2; word++) { /* one byte is transferred via a 4-byte opcode. * TODO: reduce magic numbers @@ -1159,7 +1157,7 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, memset(&m->buf[addr], 0, page_size); /* every (read) op is 4 bytes in size and yields one byte of memory data */ - for(byte = 0; byte < page_size; byte++) { + for(unsigned int byte = 0; byte < page_size; byte++) { if(byte & 1) readop = m->op[AVR_OP_READ_HI]; else From c7951813ef4a5a5be19db2abc13d18e6c429ab6a Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 21 Aug 2022 23:49:54 +0100 Subject: [PATCH 208/511] Make avr910 programmer initialize() less verbose --- src/avr910.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/avr910.c b/src/avr910.c index f54c5b3b..3ccf8398 100644 --- a/src/avr910.c +++ b/src/avr910.c @@ -194,7 +194,7 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p) avr910_send(pgm, "a", 1); avr910_recv(pgm, &PDATA(pgm)->has_auto_incr_addr, 1); if (PDATA(pgm)->has_auto_incr_addr == 'Y') - avrdude_message(MSG_INFO, "Programmer supports auto addr increment.\n"); + avrdude_message(MSG_NOTICE, "Programmer supports auto addr increment.\n"); /* Check support for buffered memory access, ignore if not available */ @@ -206,7 +206,7 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p) PDATA(pgm)->buffersize = (unsigned int)(unsigned char)c<<8; avr910_recv(pgm, &c, 1); PDATA(pgm)->buffersize += (unsigned int)(unsigned char)c; - avrdude_message(MSG_INFO, "Programmer supports buffered memory access with " + avrdude_message(MSG_NOTICE, "Programmer supports buffered memory access with " "buffersize = %u bytes.\n", PDATA(pgm)->buffersize); PDATA(pgm)->use_blockmode = 1; @@ -224,7 +224,7 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p) /* Get list of devices that the programmer supports. */ avr910_send(pgm, "t", 1); - avrdude_message(MSG_INFO, "\nProgrammer supports the following devices:\n"); + avrdude_message(MSG_NOTICE, "\nProgrammer supports the following devices:\n"); devtype_1st = 0; while (1) { avr910_recv(pgm, &c, 1); @@ -234,14 +234,14 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p) break; part = locate_part_by_avr910_devcode(part_list, c); - avrdude_message(MSG_INFO, " Device code: 0x%02x = %s\n", c & 0xff, part? part->desc: "(unknown)"); + avrdude_message(MSG_NOTICE, " Device code: 0x%02x = %s\n", c & 0xff, part? part->desc: "(unknown)"); /* FIXME: Need to lookup devcode and report the device. */ if (p->avr910_devcode == c) dev_supported = 1; }; - avrdude_message(MSG_INFO, "\n"); + avrdude_message(MSG_NOTICE, "\n"); if (!dev_supported) { avrdude_message(MSG_INFO, "%s: %s: selected device is not supported by programmer: %s\n", From c6ef6a9b9b94fb29de8871b49e8237197bf7b75c Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 22 Aug 2022 00:00:39 +0100 Subject: [PATCH 209/511] Adapt indentation of a line in buspirate.c to neighbouring lines --- src/buspirate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/buspirate.c b/src/buspirate.c index 72a8134e..17e83c74 100644 --- a/src/buspirate.c +++ b/src/buspirate.c @@ -76,7 +76,7 @@ struct pdata unsigned char pin_dir; /* Last written pin direction for bitbang mode */ unsigned char pin_val; /* Last written pin values for bitbang mode */ int unread_bytes; /* How many bytes we expected, but ignored */ - int flag; + int flag; }; #define PDATA(pgm) ((struct pdata *)(pgm->cookie)) From 5f910580b735d348d1de878a57a274c6281c6984 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 23 Aug 2022 16:57:09 +0100 Subject: [PATCH 210/511] Extend const args to avr_set_*() and developer_opts.c ... and print programming modes for -p*/d --- src/avrpart.c | 13 +++--- src/developer_opts.c | 96 ++++++++++++++++++++++++++++---------------- src/libavrdude.h | 10 ++--- 3 files changed, 71 insertions(+), 48 deletions(-) diff --git a/src/avrpart.c b/src/avrpart.c index df514f1d..fb04a157 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -69,8 +69,7 @@ int intlog2(unsigned int n) { * * Set instruction bits in the specified command based on the opcode. */ -int avr_set_bits(OPCODE * op, unsigned char * cmd) -{ +int avr_set_bits(const OPCODE *op, unsigned char *cmd) { int i, j, bit; unsigned char mask; @@ -96,8 +95,7 @@ int avr_set_bits(OPCODE * op, unsigned char * cmd) * Set address bits in the specified command based on the opcode, and * the address. */ -int avr_set_addr(OPCODE * op, unsigned char * cmd, unsigned long addr) -{ +int avr_set_addr(const OPCODE *op, unsigned char *cmd, unsigned long addr) { int i, j, bit; unsigned long value; unsigned char mask; @@ -128,7 +126,7 @@ int avr_set_addr(OPCODE * op, unsigned char * cmd, unsigned long addr) * opcode) or, if positive, bn+1 where bn is bit number of the highest * necessary bit that the opcode does not provide. */ -int avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long addr) { +int avr_set_addr_mem(const AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long addr) { int ret, isflash, lo, hi, memsize, pagesize; OPCODE *op; @@ -220,8 +218,7 @@ int avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long a * Set input data bits in the specified command based on the opcode, * and the data byte. */ -int avr_set_input(OPCODE * op, unsigned char * cmd, unsigned char data) -{ +int avr_set_input(const OPCODE *op, unsigned char *cmd, unsigned char data) { int i, j, bit; unsigned char value; unsigned char mask; @@ -858,7 +855,7 @@ const char *opcodename(int opnum) { // Unique string representation of an opcode -char *opcode2str(OPCODE *op, int opnum, int detailed) { +char *opcode2str(const OPCODE *op, int opnum, int detailed) { char cb, space[1024], *sp = space; int compact = 1; diff --git a/src/developer_opts.c b/src/developer_opts.c index dc7a4063..b2255281 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -54,7 +54,7 @@ #include "developer_opts_private.h" // Return 0 if op code would encode (essentially) the same SPI command -static int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum) { +static int opcodecmp(const OPCODE *op1, const OPCODE *op2, int opnum) { char *opstr1, *opstr2, *p; int cmp; @@ -86,7 +86,7 @@ static int opcodecmp(OPCODE *op1, OPCODE *op2, int opnum) { } -static void printopcode(AVRPART *p, const char *d, OPCODE *op, int opnum) { +static void printopcode(const AVRPART *p, const char *d, const OPCODE *op, int opnum) { unsigned char cmd[4]; int i; @@ -103,51 +103,77 @@ static void printopcode(AVRPART *p, const char *d, OPCODE *op, int opnum) { } } -static void printallopcodes(AVRPART *p, const char *d, OPCODE **opa) { +static void printallopcodes(const AVRPART *p, const char *d, OPCODE * const *opa) { for(int i=0; iflags & AVRPART_HAS_TPI) // TPI devices don't have the SPM opcode + && strcmp(p->id, "t4") // Nor have these early ones + && strcmp(p->id, "t5") + && strcmp(p->id, "t9") + && strcmp(p->id, "t10") + && strcmp(p->id, "t11") + && strcmp(p->id, "t12") + && strcmp(p->id, "t15") + && strcmp(p->id, "t20") + && strcmp(p->id, "t26") + && strcmp(p->id, "t28") + && strcmp(p->id, "t40")) + strcpy(type, "PM_SPM"); + switch(p->flags & (AVRPART_HAS_PDI | AVRPART_AVR32 | AVRPART_HAS_TPI | AVRPART_HAS_UPDI)) { - case 0: strcpy(type, "ISP"); break; - case AVRPART_HAS_PDI: strcpy(type, "PDI"); break; - case AVRPART_AVR32: strcpy(type, "AVR32"); break; - case AVRPART_HAS_TPI: strcpy(type, "TPI"); break; - case AVRPART_HAS_UPDI: strcpy(type, "UPDI"); break; - default: strcpy(type, "UNKNOWN"); break; + case AVRPART_HAS_TPI: // AVR8L family + strcat(type, "|PM_TPI"); + break; + case 0: // AVR8 family, "classic" parts + if(p->flags & AVRPART_SERIALOK) // ATmega406 has no ISP + strcat(type, "|PM_ISP"); + break; + case AVRPART_HAS_PDI: // AVR8_XMEGA family + strcat(type, "|PM_PDI"); + break; + case AVRPART_HAS_UPDI: // AVR8X family + strcat(type, "|PM_UPDI"); + break; + case AVRPART_AVR32: // AVR32 family + strcat(type, "|PM_aWire"); + break; + default: + strcat(type, "|PM_UNKNOWN"); } - if((p->flags & AVRPART_SERIALOK) == 0) - strcat(type, "|NOTSERIAL"); - if((p->flags & AVRPART_PARALLELOK) == 0) - strcat(type, "|NOTPARALLEL"); - if(p->flags & AVRPART_PSEUDOPARALLEL) - strcat(type, "|PSEUDOPARALLEL"); - if(p->flags & AVRPART_IS_AT90S1200) - strcat(type, "|IS_AT90S1200"); + switch(p->ctl_stack_type) { + case CTL_STACK_PP: + strcat(type, "|PM_HVPP"); + break; + case CTL_STACK_HVSP: + strcat(type, "|PM_HVSP"); + break; + default: + break; + } if(p->flags & AVRPART_HAS_DW) - strcat(type, "|DW"); + strcat(type, "|PM_debugWIRE"); if(p->flags & AVRPART_HAS_JTAG) - strcat(type, "|JTAG"); - if(p->flags & AVRPART_ALLOWFULLPAGEBITSTREAM) - strcat(type, "|PAGEBITSTREAM"); - if((p->flags & AVRPART_ENABLEPAGEPROGRAMMING) == 0) - strcat(type, "|NOPAGEPROGRAMMING"); + strcat(type, "|PM_JTAG"); - return type; + return type + (*type == '|'); } // Check whether address bits are where they should be in ISP commands -static void checkaddr(int memsize, int pagesize, int opnum, OPCODE *op, AVRPART *p, AVRMEM *m) { +static void checkaddr(int memsize, int pagesize, int opnum, const OPCODE *op, const AVRPART *p, const AVRMEM *m) { int i, lo, hi; const char *opstr = opcodename(opnum); @@ -293,7 +319,7 @@ static int dev_part_strct_entry(bool tsv, // Print as spreadsheet? } -static const char *dev_controlstack_name(AVRPART *p) { +static const char *dev_controlstack_name(const AVRPART *p) { return p->ctl_stack_type == CTL_STACK_PP? "pp_controlstack": p->ctl_stack_type == CTL_STACK_HVSP? "hvsp_controlstack": @@ -302,7 +328,7 @@ static const char *dev_controlstack_name(AVRPART *p) { } -static void dev_stack_out(bool tsv, AVRPART *p, const char *name, unsigned char *stack, int ns) { +static void dev_stack_out(bool tsv, const AVRPART *p, const char *name, const unsigned char *stack, int ns) { if(!strcmp(name, "NULL")) { name = "pp_controlstack"; ns = 0; @@ -362,7 +388,7 @@ static int avrmem_deep_copy(AVRMEMdeep *d, const AVRMEM *m) { return 0; } -static int memorycmp(AVRMEM *m1, AVRMEM *m2) { +static int memorycmp(const AVRMEM *m1, const AVRMEM *m2) { AVRMEMdeep dm1, dm2; if(!m1 && !m2) @@ -478,7 +504,7 @@ static char *opsnm(const char *pre, int opnum) { return ret; } -static void dev_part_raw(AVRPART *part) { +static void dev_part_raw(const AVRPART *part) { AVRPARTdeep dp; int di = avrpart_deep_copy(&dp, part); @@ -499,7 +525,7 @@ static void dev_part_raw(AVRPART *part) { } -static void dev_part_strct(AVRPART *p, bool tsv, AVRPART *base) { +static void dev_part_strct(const AVRPART *p, bool tsv, const AVRPART *base) { char *descstr = cfg_escape(p->desc); COMMENT *cp; @@ -966,7 +992,7 @@ void dev_output_part_defs(char *partdesc) { nfuses, ok, p->flags, - parttype(p), + prog_modes(p), p->config_file, p->lineno ); } @@ -1008,7 +1034,7 @@ void dev_output_part_defs(char *partdesc) { } -static void dev_pgm_raw(PROGRAMMER *pgm) { +static void dev_pgm_raw(const PROGRAMMER *pgm) { PROGRAMMER dp; int len, idx; char *id = ldata(lfirst(pgm->id)); @@ -1070,7 +1096,7 @@ static const char *connstr(conntype_t conntype) { } } -static void dev_pgm_strct(PROGRAMMER *pgm, bool tsv, PROGRAMMER *base) { +static void dev_pgm_strct(const PROGRAMMER *pgm, bool tsv, const PROGRAMMER *base) { char *id = ldata(lfirst(pgm->id)); LNODEID ln; COMMENT *cp; diff --git a/src/libavrdude.h b/src/libavrdude.h index 627bb89b..9288b43b 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -323,16 +323,16 @@ int intlog2(unsigned int n); /* Functions for OPCODE structures */ OPCODE * avr_new_opcode(void); void avr_free_opcode(OPCODE * op); -int avr_set_bits(OPCODE * op, unsigned char * cmd); -int avr_set_addr(OPCODE * op, unsigned char * cmd, unsigned long addr); -int avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long addr); -int avr_set_input(OPCODE * op, unsigned char * cmd, unsigned char data); +int avr_set_bits(const OPCODE *op, unsigned char *cmd); +int avr_set_addr(const OPCODE *op, unsigned char *cmd, unsigned long addr); +int avr_set_addr_mem(const AVRMEM *mem, int opnum, unsigned char *cmd, unsigned long addr); +int avr_set_input(const OPCODE *op, unsigned char *cmd, unsigned char data); int avr_get_output(const OPCODE *op, const unsigned char *res, unsigned char *data); int avr_get_output_index(const OPCODE *op); char cmdbitchar(CMDBIT cb); char *cmdbitstr(CMDBIT cb); const char *opcodename(int opnum); -char *opcode2str(OPCODE *op, int opnum, int detailed); +char *opcode2str(const OPCODE *op, int opnum, int detailed); /* Functions for AVRMEM structures */ AVRMEM * avr_new_memtype(void); From 731d5813985ff88608c2199fc42f0c30decc16e2 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 23 Aug 2022 17:23:47 +0100 Subject: [PATCH 211/511] Update NEWS --- NEWS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 15f9e955..c239ccba 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,11 @@ Changes since version 7.0: listing programmers where id starts with dot #1059 - Fix logfile short option in man-page; fix install dir for man page #1063 + - Use const for programmer functions where useful; add second + argument for programmer enable interface function + void (*enable)(PROGRAMMER *pgm, const AVRPART *p) #1078 + - Make avr910 programmer initialize() less verbose #1083 + - Fix flash paged write for avrftdi.c #1074 * Internals: From 3e49f078b3ffc8c0e647fc3600da8ea69e47e487 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 24 Aug 2022 00:03:45 +0100 Subject: [PATCH 212/511] Harden list management in pgm.c/config_gram.y --- src/config_gram.y | 38 ++++++++++++++++---------------------- src/pgm.c | 43 +++++++++++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 38 deletions(-) diff --git a/src/config_gram.y b/src/config_gram.y index bd32de16..dfdf50b5 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -536,25 +536,22 @@ usb_pid_list: TKN_NUMBER { { /* overwrite pids, so clear the existing entries */ - ldestroy_cb(current_prog->usbpid, free); + if(current_prog->usbpid) + ldestroy_cb(current_prog->usbpid, free); current_prog->usbpid = lcreat(NULL, 0); } { - int *ip = malloc(sizeof(int)); - if (ip) { - *ip = $1->value.number; - ladd(current_prog->usbpid, ip); - } + int *ip = cfg_malloc("usb_pid_list", sizeof(int)); + *ip = $1->value.number; + ladd(current_prog->usbpid, ip); free_token($1); } } | usb_pid_list TKN_COMMA TKN_NUMBER { { - int *ip = malloc(sizeof(int)); - if (ip) { - *ip = $3->value.number; - ladd(current_prog->usbpid, ip); - } + int *ip = cfg_malloc("usb_pid_list", sizeof(int)); + *ip = $3->value.number; + ladd(current_prog->usbpid, ip); free_token($3); } } @@ -568,25 +565,22 @@ hvupdi_support_list: TKN_NUMBER { { /* overwrite list entries, so clear the existing entries */ - ldestroy_cb(current_prog->hvupdi_support, free); + if(current_prog->hvupdi_support) + ldestroy_cb(current_prog->hvupdi_support, free); current_prog->hvupdi_support = lcreat(NULL, 0); } { - int *ip = malloc(sizeof(int)); - if (ip) { - *ip = $1->value.number; - ladd(current_prog->hvupdi_support, ip); - } + int *ip = cfg_malloc("hvupdi_support_list", sizeof(int)); + *ip = $1->value.number; + ladd(current_prog->hvupdi_support, ip); free_token($1); } } | hvupdi_support_list TKN_COMMA TKN_NUMBER { { - int *ip = malloc(sizeof(int)); - if (ip) { - *ip = $3->value.number; - ladd(current_prog->hvupdi_support, ip); - } + int *ip = cfg_malloc("hvupdi_support_list", sizeof(int)); + *ip = $3->value.number; + ladd(current_prog->hvupdi_support, ip); free_token($3); } } diff --git a/src/pgm.c b/src/pgm.c index 2880a212..4c2b7cee 100644 --- a/src/pgm.c +++ b/src/pgm.c @@ -152,12 +152,18 @@ PROGRAMMER *pgm_new(void) { void pgm_free(PROGRAMMER *p) { if(p) { - ldestroy_cb(p->id, free); - ldestroy_cb(p->usbpid, free); - ldestroy_cb(p->hvupdi_support, free); - p->id = NULL; - p->usbpid = NULL; - p->hvupdi_support = NULL; + if(p->id) { + ldestroy_cb(p->id, free); + p->id = NULL; + } + if(p->usbpid) { + ldestroy_cb(p->usbpid, free); + p->usbpid = NULL; + } + if(p->hvupdi_support) { + ldestroy_cb(p->hvupdi_support, free); + p->hvupdi_support = NULL; + } // Never free const char *, eg, p->desc, which are set by cache_string() // p->cookie is freed by pgm_teardown free(p); @@ -168,22 +174,27 @@ PROGRAMMER *pgm_dup(const PROGRAMMER *src) { PROGRAMMER *pgm = pgm_new(); if(src) { + ldestroy_cb(pgm->id, free); + ldestroy_cb(pgm->usbpid, free); + ldestroy_cb(pgm->hvupdi_support, free); memcpy(pgm, src, sizeof(*pgm)); pgm->id = lcreat(NULL, 0); pgm->usbpid = lcreat(NULL, 0); pgm->hvupdi_support = lcreat(NULL, 0); // Leave id list empty but copy usbpid and hvupdi_support over - for(LNODEID ln = lfirst(src->hvupdi_support); ln; ln = lnext(ln)) { - int *ip = cfg_malloc("pgm_dup()", sizeof(int)); - *ip = *(int *) ldata(ln); - ladd(pgm->hvupdi_support, ip); - } - for(LNODEID ln = lfirst(src->usbpid); ln; ln = lnext(ln)) { - int *ip = cfg_malloc("pgm_dup()", sizeof(int)); - *ip = *(int *) ldata(ln); - ladd(pgm->usbpid, ip); - } + if(src->hvupdi_support) + for(LNODEID ln = lfirst(src->hvupdi_support); ln; ln = lnext(ln)) { + int *ip = cfg_malloc("pgm_dup()", sizeof(int)); + *ip = *(int *) ldata(ln); + ladd(pgm->hvupdi_support, ip); + } + if(src->usbpid) + for(LNODEID ln = lfirst(src->usbpid); ln; ln = lnext(ln)) { + int *ip = cfg_malloc("pgm_dup()", sizeof(int)); + *ip = *(int *) ldata(ln); + ladd(pgm->usbpid, ip); + } } return pgm; From 09d14601afa96dd24cf264e5a428e59ae520371b Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 24 Aug 2022 00:54:11 +0100 Subject: [PATCH 213/511] Fix 4 parts wrt to their interfaces in avrdude.conf --- src/avrdude.conf.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index b4c28a12..6a177488 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -1801,6 +1801,7 @@ part stk500_devcode = 0x11; signature = 0x1e 0x90 0x04; chip_erase_delay = 20000; + serial = no; timeout = 200; hvsp_controlstack = @@ -7989,6 +7990,7 @@ part stk500_devcode = 0x22; avr910_devcode = 0x5c; signature = 0x1e 0x91 0x07; + serial = no; pp_controlstack = 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, @@ -15533,7 +15535,7 @@ part parent "x16a4u" id = "x16a4"; desc = "ATxmega16A4"; signature = 0x1e 0x94 0x41; - has_jtag = yes; + has_jtag = no; memory "fuse0" size = 1; @@ -15622,7 +15624,7 @@ part parent "x32a4u" id = "x32a4"; desc = "ATxmega32A4"; signature = 0x1e 0x95 0x41; - has_jtag = yes; + has_jtag = no; memory "fuse0" size = 1; From 57ebd36a012b90d5658287cb5c508dfd12fe1550 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 24 Aug 2022 01:10:51 +0100 Subject: [PATCH 214/511] Rewrite avrdude.conf.in file from avrdude -c* -p* output Some manual editing is still necessary to cater for the @HAVE_PARPORT_BEGIN@ etc sections. This commit also fixes superfluous whitesapce at the end of avrdude.conf.in lines Although the avrdude.conf file has changed much, the internal representation in avrdude has not. This can be verified by exporting the raw internal data through avrdude -c*/r -p*/r >/tmp/avrdude.raw before the change and by comparing again after the change: avrdude -c*/r -p*/r | diff - /tmp/avrdude.raw --- src/avrdude.conf.in | 24119 +++++++++++++++++------------------------ src/developer_opts.c | 2 +- 2 files changed, 9950 insertions(+), 14171 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 6a177488..2cca8a11 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -159,9 +159,9 @@ # complain. # # Parts can also inherit parameters from previously defined parts -# using the following syntax. In this case specified integer and -# string values override parameter values from the parent part. New -# memory definitions are added to the definitions inherited from the +# using the following syntax. In this case specified integer and +# string values override parameter values from the parent part. New +# memory definitions are added to the definitions inherited from the # parent. If, however, a new memory definition refers to an existing # one of the same name for that part then, from v7.1, the existing # memory definition is extended, and components overwritten with new @@ -175,7 +175,7 @@ # ; # # NOTES: -# * 'devicecode' is the device code used by the STK500 (see codes +# * 'devicecode' is the device code used by the STK500 (see codes # listed below) # * Not all memory types will implement all instructions. # * AVR Fuse bits and Lock bits are implemented as a type of memory. @@ -374,1075 +374,6 @@ default_serial = "@DEFAULT_SER_PORT@"; default_spi = "@DEFAULT_SPI_PORT@"; # default_bitclock = 2.5; -# -# PROGRAMMER DEFINITIONS -# - -# http://wiring.org.co/ -# Basically STK500v2 protocol, with some glue to trigger the -# bootloader. -programmer - id = "wiring"; - desc = "Wiring"; - type = "wiring"; - connection_type = serial; -; - -programmer - id = "arduino"; - desc = "Arduino"; - type = "arduino"; - connection_type = serial; -; - -programmer - id = "xbee"; - desc = "XBee Series 2 Over-The-Air (XBeeBoot)"; - type = "xbee"; - connection_type = serial; -; - -# this will interface with the chips on these programmers: -# -# http://real.kiev.ua/old/avreal/en/adapters -# http://www.amontec.com/jtagkey.shtml, jtagkey-tiny.shtml -# http://www.olimex.com/dev/arm-usb-ocd.html, arm-usb-tiny.html -# http://www.ethernut.de/en/hardware/turtelizer/index.html -# http://elk.informatik.fh-augsburg.de/hhweb/doc/openocd/usbjtag/usbjtag.html -# http://dangerousprototypes.com/docs/FT2232_breakout_board -# http://www.ftdichip.com/Products/Modules/DLPModules.htm,DLP-2232*,DLP-USB1232H -# http://flashrom.org/FT2232SPI_Programmer -# -# The drivers will look for a specific device and use the first one found. -# If you have mulitple devices, then look for unique information (like SN) -# And fill that in here. -# -# Note that the pin numbers for the main ISP signals (reset, sck, -# mosi, miso) are fixed and cannot be changed, since they must match -# the way the Multi-Protocol Synchronous Serial Engine (MPSSE) of -# these FTDI ICs has been designed. - -programmer - id = "avrftdi"; - desc = "FT2232D based generic programmer"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; - usbpid = 0x6010; - usbvendor = ""; - usbproduct = ""; - usbdev = "A"; - usbsn = ""; -#ISP-signals - lower ADBUS-Nibble (default) - reset = 3; - sck = 0; - mosi = 1; - miso = 2; -#LED SIGNALs - higher ADBUS-Nibble -# errled = 4; -# rdyled = 5; -# pgmled = 6; -# vfyled = 7; -#Buffer Signal - ACBUS - Nibble -# buff = 8; -; -# This is an implementation of the above with a buffer IC (74AC244) and -# 4 LEDs directly attached, all active low. -programmer - id = "2232HIO"; - desc = "FT2232H based generic programmer"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; -# Note: This PID is reserved for generic H devices and -# should be programmed into the EEPROM -# usbpid = 0x8A48; - usbpid = 0x6010; - usbdev = "A"; - usbvendor = ""; - usbproduct = ""; - usbsn = ""; -#ISP-signals - reset = 3; - sck = 0; - mosi = 1; - miso = 2; - buff = ~4; -#LED SIGNALs - errled = ~ 11; - rdyled = ~ 14; - pgmled = ~ 13; - vfyled = ~ 12; -; - -#The FT4232H can be treated as FT2232H, but it has a different USB -#device ID of 0x6011. -programmer parent "avrftdi" - id = "4232h"; - desc = "FT4232H based generic programmer"; - usbpid = 0x6011; -; - -programmer - id = "jtagkey"; - desc = "Amontec JTAGKey, JTAGKey-Tiny and JTAGKey2"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; -# Note: This PID is used in all JTAGKey variants - usbpid = 0xCFF8; - usbdev = "A"; - usbvendor = ""; - usbproduct = ""; - usbsn = ""; -#ISP-signals => 20 - Pin connector on JTAGKey - reset = 3; # TMS 7 violet - sck = 0; # TCK 9 white - mosi = 1; # TDI 5 green - miso = 2; # TDO 13 orange - buff = ~4; -# VTG VREF 1 brown with red tip -# GND GND 20 black -# The colors are on the 20 pin breakout cable -# from Amontec -; - -programmer - id = "ft232h"; - desc = "FT232H in MPSSE mode"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; - usbpid = 0x6014; - usbdev = "A"; - usbvendor = ""; - usbproduct = ""; - usbsn = ""; -#ISP-signals - sck = 0; # AD0 (TCK) - mosi = 1; # AD1 (TDI) - miso = 2; # AD2 (TDO) - reset = 3; # AD3 (TMS) -; - -# Pin J2-7 (AD0) is SCK -# Pin J2-8 (AD1) is MOSI -# Pin J2-9 (AD2) is MISO -# Pin J2-10 (AD3) is RESET -# Pin J2-6 is GND -# Use the -b flag to set the SPI clock rate eg -b 3750000 is the fastest I could get -# a 16MHz Atmega1280 to program reliably. The 232H is conveniently 5V tolerant. -programmer parent "ft232h" - id = "um232h"; - desc = "UM232H module from FTDI"; -; - -# Orange (Pin 2) is SCK -# Yellow (Pin 3) is MOSI -# Green (Pin 4) is MISO -# Brown (Pin 5) is RESET -# Black (Pin 10) is GND -# Use the -b flag to set the SPI clock rate eg -b 3750000 is the fastest I could get -# a 16MHz Atmega1280 to program reliably. The 232H is conveniently 5V tolerant. -programmer parent "ft232h" - id = "c232hm"; - desc = "C232HM cable from FTDI"; -; - -# On the adapter you can read "O-Link". On the PCB is printed "OpenJTAG v3.1" -# You can find it as "OpenJTAG ARM JTAG USB" in the internet. -# (But there are also several projects called Open JTAG, eg. -# http://www.openjtag.org, which are completely different.) -# http://www.100ask.net/shop/english.html (website seems to be outdated) -# http://item.taobao.com/item.htm?id=1559277013 -# http://www.micro4you.com/store/openjtag-arm-jtag-usb.html (schematics!) -# some other sources which call it O-Link -# http://www.andahammer.com/olink/ -# http://www.developmentboard.net/31-o-link-debugger.html -# http://armwerks.com/catalog/o-link-debugger-copy/ -# or just have a look at ebay ... -# It is basically the same entry as jtagkey with different usb ids. -programmer parent "jtagkey" - id = "o-link"; - desc = "O-Link, OpenJTAG from www.100ask.net"; - usbvid = 0x1457; - usbpid = 0x5118; - usbvendor = "www.100ask.net"; - usbproduct = "USB<=>JTAG&RS232"; -; - -# http://wiki.openmoko.org/wiki/Debug_Board_v3 -programmer - id = "openmoko"; - desc = "Openmoko debug board (v3)"; - type = "avrftdi"; - usbvid = 0x1457; - usbpid = 0x5118; - usbdev = "A"; - usbvendor = ""; - usbproduct = ""; - usbsn = ""; - reset = 3; # TMS 7 - sck = 0; # TCK 9 - mosi = 1; # TDI 5 - miso = 2; # TDO 13 -; - -# Only Rev. A boards. -# Schematic and user manual: http://www.cs.put.poznan.pl/wswitala/download/pdf/811EVBK.pdf -programmer - id = "lm3s811"; - desc = "Luminary Micro LM3S811 Eval Board (Rev. A)"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; - usbpid = 0xbcd9; - usbvendor = "LMI"; - usbproduct = "LM3S811 Evaluation Board"; - usbdev = "A"; - usbsn = ""; -#ISP-signals - lower ACBUS-Nibble (default) - reset = 3; - sck = 0; - mosi = 1; - miso = 2; -# Enable correct buffers - buff = 7; -; - -# submitted as bug #46020 -programmer - id = "tumpa"; - desc = "TIAO USB Multi-Protocol Adapter"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; - usbpid = 0x8A98; - usbdev = "A"; - usbvendor = "TIAO"; - usbproduct = ""; - usbsn = ""; - sck = 0; # TCK 9 - mosi = 1; # TDI 5 - miso = 2; # TDO 13 - reset = 3; # TMS 7 -; - -# Kristech KT-LINK FT2232H interface with IO switching and voltage buffers. -# Created on 20220410 by CeDeROM Tomasz CEDRO (www.cederom.io). -# Interface DataSheet: https://kristech.pl/files/KT-LINK-UM-ENG.pdf -# AVRDUDE FT2232H PIN NUMBER DECODE: -# | 0 | 1 | .. | 7 | 8 | 9 | .. | 15 | -# | ADBUS0 | ADBUS1 | .. | ADBUS7 | ACBUS0 | ACBUS1 | .. | ACBUS7 | -# KT-LINK JTAG CONN: -# 1=Vsense(->EXT13), 19=5V(EXT1->EXT3), 20=GND, 3=TPIRST, 9=TPICLK, 7=TPIDATA. -# INTERNALS CONFIGURATION ("~" MEANS ACTIVE LOW): -# ~TRST_EN=10(ACBUS2), ~CLK_EN=14(ACBUS6), ~MOSI_EN=13(ACBUS5), -# TMS_SEL=5(ADBUS5), ~TMS_EN=12(ACBUS4), LED=~15(ACBUS7). -# CONNECTION NOTES: -# * Connect EXT connector pin 1 with 3 to get 5V on JTAG connector pin 19. -# * Connect JTAG connector pin 1 to 5V (i.e. EXT pin 13 or JTAG pin 19). -# * For TPI connection use resistors: TDO --[470R]-- TPIDATA --[470R]-- TDI. -# * Powering target from JTAG pin 19 allows KT-LINK current measurement. -programmer - id = "ktlink"; - desc = "KT-LINK FT2232H interface with IO switching and voltage buffers."; - type = "avrftdi"; - connection_type = usb; - usbvid= 0x0403; - usbpid= 0xBBE2; - usbdev= "A"; - reset = 8; - sck = 0; - mosi = 1; - miso = 2; - buff = ~10,~14,~13,5; - rdyled = ~15; -; - -programmer - id = "serialupdi"; - desc = "SerialUPDI"; - type = "serialupdi"; - connection_type = serial; - hvupdi_support = 1; -; - -programmer - id = "avrisp"; - desc = "Atmel AVR ISP"; - type = "stk500"; - connection_type = serial; -; - -programmer - id = "avrispv2"; - desc = "Atmel AVR ISP V2"; - type = "stk500v2"; - connection_type = serial; -; - -programmer - id = "avrispmkII"; - desc = "Atmel AVR ISP mkII"; - type = "stk500v2"; - connection_type = usb; -; - -programmer parent "avrispmkII" - id = "avrisp2"; -; - -programmer - id = "buspirate"; - desc = "The Bus Pirate"; - type = "buspirate"; - connection_type = serial; -; - -programmer - id = "buspirate_bb"; - desc = "The Bus Pirate (bitbang interface, supports TPI)"; - type = "buspirate_bb"; - connection_type = serial; - # pins are bits in bitbang byte (numbers are 87654321) - # 1|POWER|PULLUP|AUX|MOSI|CLK|MISO|CS - reset = 1; - sck = 3; - mosi = 4; - miso = 2; - #vcc = 7; This is internally set independent of this setting. -; - -# This is supposed to be the "default" STK500 entry. -# Attempts to select the correct firmware version -# by probing for it. Better use one of the entries -# below instead. -programmer - id = "stk500"; - desc = "Atmel STK500"; - type = "stk500generic"; - connection_type = serial; -; - -programmer - id = "stk500v1"; - desc = "Atmel STK500 Version 1.x firmware"; - type = "stk500"; - connection_type = serial; -; - -programmer - id = "mib510"; - desc = "Crossbow MIB510 programming board"; - type = "stk500"; - connection_type = serial; -; - -programmer - id = "stk500v2"; - desc = "Atmel STK500 Version 2.x firmware"; - type = "stk500v2"; - connection_type = serial; -; - -programmer - id = "stk500pp"; - desc = "Atmel STK500 V2 in parallel programming mode"; - type = "stk500pp"; - connection_type = serial; -; - -programmer - id = "stk500hvsp"; - desc = "Atmel STK500 V2 in high-voltage serial programming mode"; - type = "stk500hvsp"; - connection_type = serial; -; - -programmer - id = "stk600"; - desc = "Atmel STK600"; - type = "stk600"; - connection_type = usb; -; - -programmer - id = "stk600pp"; - desc = "Atmel STK600 in parallel programming mode"; - type = "stk600pp"; - connection_type = usb; -; - -programmer - id = "stk600hvsp"; - desc = "Atmel STK600 in high-voltage serial programming mode"; - type = "stk600hvsp"; - connection_type = usb; -; - -programmer - id = "avr910"; - desc = "Atmel Low Cost Serial Programmer"; - type = "avr910"; - connection_type = serial; -; - -programmer - id = "ft245r"; - desc = "FT245R Synchronous BitBang"; - type = "ftdi_syncbb"; - connection_type = usb; - miso = 1; # D1 - sck = 0; # D0 - mosi = 2; # D2 - reset = 4; # D4 -; - -programmer - id = "ft232r"; - desc = "FT232R Synchronous BitBang"; - type = "ftdi_syncbb"; - connection_type = usb; - miso = 1; # RxD - sck = 0; # TxD - mosi = 2; # RTS - reset = 4; # DTR -; - -# see http://www.bitwizard.nl/wiki/index.php/FTDI_ATmega -programmer - id = "bwmega"; - desc = "BitWizard ftdi_atmega builtin programmer"; - type = "ftdi_syncbb"; - connection_type = usb; - miso = 5; # DSR - sck = 6; # DCD - mosi = 3; # CTS - reset = 7; # RI -; - -# see http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html -# Note: pins are numbered from 1! -programmer - id = "arduino-ft232r"; - desc = "Arduino: FT232R connected to ISP"; - type = "ftdi_syncbb"; - connection_type = usb; - miso = 3; # CTS X3(1) - sck = 5; # DSR X3(2) - mosi = 6; # DCD X3(3) - reset = 7; # RI X3(4) -; - -programmer - id = "tc2030"; - desc = "Tag-Connect TC2030"; - type = "ftdi_syncbb"; - connection_type = usb; - # FOR TPI devices: - mosi = 0; # TxD = D0 (wire to TPIDATA via 1k resistor) - miso = 1; # RxD = D1 (wire to TPIDATA directly) - sck = 2; # RTS = D2 (wire to SCK) - reset = 3; # CTS = D3 (wire to ~RESET) -; - -# website mentioned above uses this id -programmer parent "arduino-ft232r" - id = "diecimila"; - desc = "alias for arduino-ft232r"; -; - -# There is a ATmega328P kit PCB called "uncompatino". -# This board allows ISP via its on-board FT232R. -# This is designed like Arduino Duemilanove but has no standard ICPS header. -# Its 4 pairs of pins are shorted to enable ftdi_syncbb. -# http://akizukidenshi.com/catalog/g/gP-07487/ -# http://akizukidenshi.com/download/ds/akizuki/k6096_manual_20130816.pdf -programmer - id = "uncompatino"; - desc = "uncompatino with all pairs of pins shorted"; - type = "ftdi_syncbb"; - connection_type = usb; - miso = 3; # cts - sck = 5; # dsr - mosi = 6; # dcd - reset = 7; # ri -; - -# FTDI USB to serial cable TTL-232R-5V with a custom adapter for ICSP -# http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm -# http://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_TTL-232R_CABLES.pdf -# For ICSP pinout see for example http://www.atmel.com/images/doc2562.pdf -# (Figure 1. ISP6PIN header pinout and Table 1. Connections required for ISP ...) -# TTL-232R GND 1 Black -> ICPS GND (pin 6) -# TTL-232R CTS 2 Brown -> ICPS MOSI (pin 4) -# TTL-232R VCC 3 Red -> ICPS VCC (pin 2) -# TTL-232R TXD 4 Orange -> ICPS RESET (pin 5) -# TTL-232R RXD 5 Yellow -> ICPS SCK (pin 3) -# TTL-232R RTS 6 Green -> ICPS MISO (pin 1) -# Except for VCC and GND, you can connect arbitual pairs as long as -# the following table is adjusted. -programmer - id = "ttl232r"; - desc = "FTDI TTL232R-5V with ICSP adapter"; - type = "ftdi_syncbb"; - connection_type = usb; - miso = 2; # rts - sck = 1; # rxd - mosi = 3; # cts - reset = 0; # txd -; - -programmer - id = "usbasp"; - desc = "USBasp, http://www.fischl.de/usbasp/"; - type = "usbasp"; - connection_type = usb; - usbvid = 0x16C0; # VOTI - usbpid = 0x05DC; # Obdev's free shared PID - usbvendor = "www.fischl.de"; - usbproduct = "USBasp"; - - # following variants are autodetected for id "usbasp" - - # original usbasp from fischl.de - # see above "usbasp" - - # old usbasp from fischl.de - #usbvid = 0x03EB; # ATMEL - #usbpid = 0xC7B4; # (unoffical) USBasp - #usbvendor = "www.fischl.de"; - #usbproduct = "USBasp"; - - # NIBObee (only if -P nibobee is given on command line) - # see below "nibobee" -; - -programmer - id = "nibobee"; - desc = "NIBObee"; - type = "usbasp"; - connection_type = usb; - usbvid = 0x16C0; # VOTI - usbpid = 0x092F; # NIBObee PID - usbvendor = "www.nicai-systems.com"; - usbproduct = "NIBObee"; -; - -programmer - id = "usbasp-clone"; - desc = "Any usbasp clone with correct VID/PID"; - type = "usbasp"; - connection_type = usb; - usbvid = 0x16C0; # VOTI - usbpid = 0x05DC; # Obdev's free shared PID - #usbvendor = ""; - #usbproduct = ""; -; - -# USBtiny can also be used for TPI programming. -# In that case, a resistor of 1 kOhm is needed between MISO and MOSI -# pins of the connector, and MISO (pin 1 of the 6-pin connector) -# connects to TPIDATA. -programmer - id = "usbtiny"; - desc = "USBtiny simple USB programmer, https://learn.adafruit.com/usbtinyisp"; - type = "usbtiny"; - connection_type = usb; - usbvid = 0x1781; - usbpid = 0x0c9f; -; - -programmer - id = "arduinoisp"; - desc = "Arduino ISP Programmer"; - type = "usbtiny"; - connection_type = usb; - usbvid = 0x2341; - usbpid = 0x0049; -; - -programmer - id = "arduinoisporg"; - desc = "Arduino ISP Programmer"; - type = "usbtiny"; - connection_type = usb; - usbvid = 0x2A03; - usbpid = 0x0049; -; - -# commercial version of USBtiny, using a separate VID/PID -programmer - id = "ehajo-isp"; - desc = "avr-isp-programmer from eHaJo, http://www.eHaJo.de"; - type = "usbtiny"; - connection_type = usb; - usbvid = 0x16D0; - usbpid = 0x0BA5; -; - -# commercial version of USBtiny, using a separate VID/PID -# https://github.com/IowaScaledEngineering/ckt-avrprogrammer -programmer - id = "iseavrprog"; - desc = "USBtiny-based programmer, https://iascaled.com"; - type = "usbtiny"; - connection_type = usb; - usbvid = 0x1209; - usbpid = 0x6570; -; - -programmer - id = "micronucleus"; - desc = "Micronucleus Bootloader"; - type = "micronucleus"; - connection_type = usb; - usbvid = 0x16D0; - usbpid = 0x0753; -; - -programmer - id = "teensy"; - desc = "Teensy Bootloader"; - type = "teensy"; - connection_type = usb; - usbvid = 0x16C0; - usbpid = 0x0478; -; - -programmer - id = "butterfly"; - desc = "Atmel Butterfly Development Board"; - type = "butterfly"; - connection_type = serial; -; - -programmer - id = "avr109"; - desc = "Atmel AppNote AVR109 Boot Loader"; - type = "butterfly"; - connection_type = serial; -; - -programmer - id = "avr911"; - desc = "Atmel AppNote AVR911 AVROSP"; - type = "butterfly"; - connection_type = serial; -; - -# suggested in http://forum.mikrokopter.de/topic-post48317.html -programmer - id = "mkbutterfly"; - desc = "Mikrokopter.de Butterfly"; - type = "butterfly_mk"; - connection_type = serial; -; - -programmer parent "mkbutterfly" - id = "butterfly_mk"; -; - -programmer - id = "jtagmkI"; - desc = "Atmel JTAG ICE (mkI)"; - baudrate = 115200; # default is 115200 - type = "jtagmki"; - connection_type = serial; -; - -# easier to type -programmer parent "jtagmkI" - id = "jtag1"; -; - -# easier to type -programmer parent "jtag1" - id = "jtag1slow"; - baudrate = 19200; -; - -# The JTAG ICE mkII has both, serial and USB connectivity. As it is -# mostly used through USB these days (AVR Studio 5 only supporting it -# that way), we make connection_type = usb the default. Users are -# still free to use a serial port with the -P option. - -programmer - id = "jtagmkII"; - desc = "Atmel JTAG ICE mkII"; - baudrate = 19200; # default is 19200 - type = "jtagmkii"; - connection_type = usb; -; - -# easier to type -programmer parent "jtagmkII" - id = "jtag2slow"; -; - -# JTAG ICE mkII @ 115200 Bd -programmer parent "jtag2slow" - id = "jtag2fast"; - baudrate = 115200; -; - -# make the fast one the default, people will love that -programmer parent "jtag2fast" - id = "jtag2"; -; - -# JTAG ICE mkII in ISP mode -programmer - id = "jtag2isp"; - desc = "Atmel JTAG ICE mkII in ISP mode"; - baudrate = 115200; - type = "jtagmkii_isp"; - connection_type = usb; -; - -# JTAG ICE mkII in debugWire mode -programmer - id = "jtag2dw"; - desc = "Atmel JTAG ICE mkII in debugWire mode"; - baudrate = 115200; - type = "jtagmkii_dw"; - connection_type = usb; -; - -# JTAG ICE mkII in AVR32 mode -programmer - id = "jtagmkII_avr32"; - desc = "Atmel JTAG ICE mkII im AVR32 mode"; - baudrate = 115200; - type = "jtagmkii_avr32"; - connection_type = usb; -; - -# JTAG ICE mkII in AVR32 mode -programmer - id = "jtag2avr32"; - desc = "Atmel JTAG ICE mkII im AVR32 mode"; - baudrate = 115200; - type = "jtagmkii_avr32"; - connection_type = usb; -; - -# JTAG ICE mkII in PDI mode -programmer - id = "jtag2pdi"; - desc = "Atmel JTAG ICE mkII PDI mode"; - baudrate = 115200; - type = "jtagmkii_pdi"; - connection_type = usb; -; - -# AVR Dragon in JTAG mode -programmer - id = "dragon_jtag"; - desc = "Atmel AVR Dragon in JTAG mode"; - baudrate = 115200; - type = "dragon_jtag"; - connection_type = usb; -; - -# AVR Dragon in ISP mode -programmer - id = "dragon_isp"; - desc = "Atmel AVR Dragon in ISP mode"; - baudrate = 115200; - type = "dragon_isp"; - connection_type = usb; -; - -# AVR Dragon in PP mode -programmer - id = "dragon_pp"; - desc = "Atmel AVR Dragon in PP mode"; - baudrate = 115200; - type = "dragon_pp"; - connection_type = usb; -; - -# AVR Dragon in HVSP mode -programmer - id = "dragon_hvsp"; - desc = "Atmel AVR Dragon in HVSP mode"; - baudrate = 115200; - type = "dragon_hvsp"; - connection_type = usb; -; - -# AVR Dragon in debugWire mode -programmer - id = "dragon_dw"; - desc = "Atmel AVR Dragon in debugWire mode"; - baudrate = 115200; - type = "dragon_dw"; - connection_type = usb; -; - -# AVR Dragon in PDI mode -programmer - id = "dragon_pdi"; - desc = "Atmel AVR Dragon in PDI mode"; - baudrate = 115200; - type = "dragon_pdi"; - connection_type = usb; -; - -programmer - id = "jtag3"; - desc = "Atmel AVR JTAGICE3 in JTAG mode"; - type = "jtagice3"; - connection_type = usb; - usbpid = 0x2110, 0x2140; -; - -programmer - id = "jtag3pdi"; - desc = "Atmel AVR JTAGICE3 in PDI mode"; - type = "jtagice3_pdi"; - connection_type = usb; - usbpid = 0x2110, 0x2140; -; - -programmer - id = "jtag3updi"; - desc = "Atmel AVR JTAGICE3 in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2110, 0x2140; - hvupdi_support = 1; -; - -programmer - id = "jtag3dw"; - desc = "Atmel AVR JTAGICE3 in debugWIRE mode"; - type = "jtagice3_dw"; - connection_type = usb; - usbpid = 0x2110, 0x2140; -; - -programmer - id = "jtag3isp"; - desc = "Atmel AVR JTAGICE3 in ISP mode"; - type = "jtagice3_isp"; - connection_type = usb; - usbpid = 0x2110, 0x2140; -; - -programmer - id = "xplainedpro"; - desc = "Atmel AVR XplainedPro in JTAG mode"; - type = "jtagice3"; - connection_type = usb; - usbpid = 0x2111; -; - -programmer - id = "xplainedpro_updi"; - desc = "Atmel AVR XplainedPro in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2111; - hvupdi_support = 1; -; - -programmer - id = "xplainedmini"; - desc = "Atmel AVR XplainedMini in ISP mode"; - type = "jtagice3_isp"; - connection_type = usb; - usbpid = 0x2145; -; - -programmer - id = "xplainedmini_dw"; - desc = "Atmel AVR XplainedMini in debugWIRE mode"; - type = "jtagice3_dw"; - connection_type = usb; - usbpid = 0x2145; -; - -programmer - id = "xplainedmini_updi"; - desc = "Atmel AVR XplainedMini in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2145; - hvupdi_support = 1; -; - -programmer - id = "atmelice"; - desc = "Atmel-ICE (ARM/AVR) in JTAG mode"; - type = "jtagice3"; - connection_type = usb; - usbpid = 0x2141; -; - -programmer - id = "atmelice_pdi"; - desc = "Atmel-ICE (ARM/AVR) in PDI mode"; - type = "jtagice3_pdi"; - connection_type = usb; - usbpid = 0x2141; -; - -programmer - id = "atmelice_updi"; - desc = "Atmel-ICE (ARM/AVR) in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2141; - hvupdi_support = 1; -; - -programmer - id = "atmelice_dw"; - desc = "Atmel-ICE (ARM/AVR) in debugWIRE mode"; - type = "jtagice3_dw"; - connection_type = usb; - usbpid = 0x2141; -; - -programmer - id = "atmelice_isp"; - desc = "Atmel-ICE (ARM/AVR) in ISP mode"; - type = "jtagice3_isp"; - connection_type = usb; - usbpid = 0x2141; -; - -programmer - id = "powerdebugger"; - desc = "Atmel PowerDebugger (ARM/AVR) in JTAG mode"; - type = "jtagice3"; - connection_type = usb; - usbpid = 0x2144; -; - -programmer - id = "powerdebugger_pdi"; - desc = "Atmel PowerDebugger (ARM/AVR) in PDI mode"; - type = "jtagice3_pdi"; - connection_type = usb; - usbpid = 0x2144; -; - -programmer - id = "powerdebugger_updi"; - desc = "Atmel PowerDebugger (ARM/AVR) in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2144; - hvupdi_support = 0, 1; -; - -programmer - id = "powerdebugger_dw"; - desc = "Atmel PowerDebugger (ARM/AVR) in debugWire mode"; - type = "jtagice3_dw"; - connection_type = usb; - usbpid = 0x2144; -; - -programmer - id = "powerdebugger_isp"; - desc = "Atmel PowerDebugger (ARM/AVR) in ISP mode"; - type = "jtagice3_isp"; - connection_type = usb; - usbpid = 0x2144; -; - -programmer - id = "pickit4_updi"; - desc = "MPLAB(R) PICkit 4 in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2177, 0x2178, 0x2179; - hvupdi_support = 0, 1, 2; -; - -programmer - id = "pickit4_pdi"; - desc = "MPLAB(R) PICkit 4 in PDI mode"; - type = "jtagice3_pdi"; - connection_type = usb; - usbpid = 0x2177, 0x2178, 0x2179; -; - -programmer - id = "pickit4_isp"; - desc = "MPLAB(R) PICkit 4 in ISP mode"; - type = "jtagice3_isp"; - connection_type = usb; - usbpid = 0x2177, 0x2178, 0x2179; -; - -programmer - id = "snap_updi"; - desc = "MPLAB(R) SNAP in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x217F, 0x2180, 0x2181; - hvupdi_support = 1; -; - -programmer - id = "snap_pdi"; - desc = "MPLAB(R) SNAP in PDI mode"; - type = "jtagice3_pdi"; - connection_type = usb; - usbpid = 0x217F, 0x2180, 0x2181; -; - -programmer - id = "snap_isp"; - desc = "MPLAB(R) SNAP in ISP mode"; - type = "jtagice3_isp"; - connection_type = usb; - usbpid = 0x217F, 0x2180, 0x2181; -; - -programmer - id = "pkobn_updi"; - desc = "Curiosity nano (nEDBG) in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2175; - hvupdi_support = 1; -; - -programmer - id = "pavr"; - desc = "Jason Kyle's pAVR Serial Programmer"; - type = "avr910"; - connection_type = serial; -; - -programmer - id = "pickit2"; - desc = "MicroChip's PICkit2 Programmer"; - type = "pickit2"; - connection_type = usb; -; - -programmer - id = "flip1"; - desc = "FLIP USB DFU protocol version 1 (doc7618)"; - type = "flip1"; - connection_type = usb; -; - -programmer - id = "flip2"; - desc = "FLIP USB DFU protocol version 2 (AVR4023)"; - type = "flip2"; - connection_type = usb; -; - @HAVE_PARPORT_BEGIN@ # Parallel port programmers. @@ -1478,7 +409,7 @@ programmer programmer parent "stk200" id = "pony-stk200"; desc = "Pony Prog STK200"; - pgmled = 8; + pgmled = 8; ; programmer @@ -1563,7 +494,7 @@ programmer # From the contributor of the "xil" jtag cable: # The "vcc" definition isn't really vcc (the cable gets its power from # the programming circuit) but is necessary to switch one of the -# buffer lines (trying to add it to the "buff" lines doesn't work in +# buffer lines (trying to add it to the "buff" lines doesn't work in # avrdude versions before 5.5j). # With this, TMS connects to RESET, TDI to MOSI, TDO to MISO and TCK # to SCK (plus vcc/gnd of course) @@ -1691,8 +622,1513 @@ programmer ; @HAVE_LINUXSPI_END@ -# some ultra cheap programmers use bitbanging on the -# serialport. +# +# PROGRAMMER DEFINITIONS +# + +#------------------------------------------------------------ +# wiring +#------------------------------------------------------------ + +# http://wiring.org.co/ +# Basically STK500v2 protocol, with some glue to trigger the +# bootloader. +programmer + id = "wiring"; + desc = "Wiring"; + type = "wiring"; + connection_type = serial; +; + +#------------------------------------------------------------ +# arduino +#------------------------------------------------------------ + +programmer + id = "arduino"; + desc = "Arduino"; + type = "arduino"; + connection_type = serial; +; + +#------------------------------------------------------------ +# xbee +#------------------------------------------------------------ + +programmer + id = "xbee"; + desc = "XBee Series 2 Over-The-Air (XBeeBoot)"; + type = "xbee"; + connection_type = serial; +; + +#------------------------------------------------------------ +# avrftdi +#------------------------------------------------------------ + +# this will interface with the chips on these programmers: +# +# http://real.kiev.ua/old/avreal/en/adapters +# http://www.amontec.com/jtagkey.shtml, jtagkey-tiny.shtml +# http://www.olimex.com/dev/arm-usb-ocd.html, arm-usb-tiny.html +# http://www.ethernut.de/en/hardware/turtelizer/index.html +# http://elk.informatik.fh-augsburg.de/hhweb/doc/openocd/usbjtag/usbjtag.html +# http://dangerousprototypes.com/docs/FT2232_breakout_board +# http://www.ftdichip.com/Products/Modules/DLPModules.htm,DLP-2232*,DLP-USB1232H +# http://flashrom.org/FT2232SPI_Programmer +# +# The drivers will look for a specific device and use the first one found. +# If you have mulitple devices, then look for unique information (like SN) +# And fill that in here. +# +# Note that the pin numbers for the main ISP signals (reset, sck, +# mosi, miso) are fixed and cannot be changed, since they must match +# the way the Multi-Protocol Synchronous Serial Engine (MPSSE) of +# these FTDI ICs has been designed. + +programmer + id = "avrftdi"; + desc = "FT2232D based generic programmer"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; + usbpid = 0x6010; + usbdev = "A"; +#ISP-signals - lower ADBUS-Nibble (default) + reset = 3; + sck = 0; + mosi = 1; + miso = 2; +#LED SIGNALs - higher ADBUS-Nibble +# errled = 4; +# rdyled = 5; +# pgmled = 6; +# vfyled = 7; +#Buffer Signal - ACBUS - Nibble +# buff = 8; +; + +#------------------------------------------------------------ +# 2232HIO +#------------------------------------------------------------ + +# This is an implementation of the above with a buffer IC (74AC244) and +# 4 LEDs directly attached, all active low. +programmer + id = "2232HIO"; + desc = "FT2232H based generic programmer"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; +# Note: This PID is reserved for generic H devices and +# should be programmed into the EEPROM +# usbpid = 0x8A48; + usbpid = 0x6010; + usbdev = "A"; + buff = ~4; +#ISP-signals + reset = 3; + sck = 0; + mosi = 1; + miso = 2; +#LED SIGNALs + errled = ~11; + rdyled = ~14; + pgmled = ~13; + vfyled = ~12; +; + +#------------------------------------------------------------ +# 4232h +#------------------------------------------------------------ + +#The FT4232H can be treated as FT2232H, but it has a different USB +#device ID of 0x6011. +programmer parent "avrftdi" + id = "4232h"; + desc = "FT4232H based generic programmer"; + type = "avrftdi"; + usbpid = 0x6011; + reset = 3; + sck = 0; + mosi = 1; + miso = 2; +; + +#------------------------------------------------------------ +# jtagkey +#------------------------------------------------------------ + +programmer + id = "jtagkey"; + desc = "Amontec JTAGKey, JTAGKey-Tiny and JTAGKey2"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; +# Note: This PID is used in all JTAGKey variants + usbpid = 0xcff8; + usbdev = "A"; + buff = ~4; +#ISP-signals => 20 - Pin connector on JTAGKey + reset = 3; # TMS 7 violet + sck = 0; # TCK 9 white + mosi = 1; # TDI 5 green + miso = 2; # TDO 13 orange +# VTG VREF 1 brown with red tip +# GND GND 20 black +# The colors are on the 20 pin breakout cable +# from Amontec +; + +#------------------------------------------------------------ +# ft232h +#------------------------------------------------------------ + +programmer + id = "ft232h"; + desc = "FT232H in MPSSE mode"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; + usbpid = 0x6014; + usbdev = "A"; + reset = 3; # AD3 (TMS) +#ISP-signals + sck = 0; # AD0 (TCK) + mosi = 1; # AD1 (TDI) + miso = 2; # AD2 (TDO) +; + +#------------------------------------------------------------ +# um232h +#------------------------------------------------------------ + +# Pin J2-7 (AD0) is SCK +# Pin J2-8 (AD1) is MOSI +# Pin J2-9 (AD2) is MISO +# Pin J2-10 (AD3) is RESET +# Pin J2-6 is GND +# Use the -b flag to set the SPI clock rate eg -b 3750000 is the fastest I could get +# a 16MHz Atmega1280 to program reliably. The 232H is conveniently 5V tolerant. +programmer parent "ft232h" + id = "um232h"; + desc = "UM232H module from FTDI"; + type = "avrftdi"; + usbpid = 0x6014; + reset = 3; + sck = 0; + mosi = 1; + miso = 2; +; + +#------------------------------------------------------------ +# c232hm +#------------------------------------------------------------ + +# Orange (Pin 2) is SCK +# Yellow (Pin 3) is MOSI +# Green (Pin 4) is MISO +# Brown (Pin 5) is RESET +# Black (Pin 10) is GND +# Use the -b flag to set the SPI clock rate eg -b 3750000 is the fastest I could get +# a 16MHz Atmega1280 to program reliably. The 232H is conveniently 5V tolerant. +programmer parent "ft232h" + id = "c232hm"; + desc = "C232HM cable from FTDI"; + type = "avrftdi"; + usbpid = 0x6014; + reset = 3; + sck = 0; + mosi = 1; + miso = 2; +; + +#------------------------------------------------------------ +# o-link +#------------------------------------------------------------ + +# On the adapter you can read "O-Link". On the PCB is printed "OpenJTAG v3.1" +# You can find it as "OpenJTAG ARM JTAG USB" in the internet. +# (But there are also several projects called Open JTAG, eg. +# http://www.openjtag.org, which are completely different.) +# http://www.100ask.net/shop/english.html (website seems to be outdated) +# http://item.taobao.com/item.htm?id=1559277013 +# http://www.micro4you.com/store/openjtag-arm-jtag-usb.html (schematics!) +# some other sources which call it O-Link +# http://www.andahammer.com/olink/ +# http://www.developmentboard.net/31-o-link-debugger.html +# http://armwerks.com/catalog/o-link-debugger-copy/ +# or just have a look at ebay ... +# It is basically the same entry as jtagkey with different usb ids. +programmer parent "jtagkey" + id = "o-link"; + desc = "O-Link, OpenJTAG from www.100ask.net"; + type = "avrftdi"; + usbvid = 0x1457; + usbpid = 0x5118; + usbvendor = "www.100ask.net"; + usbproduct = "USB<=>JTAG&RS232"; + buff = ~4; + reset = 3; + sck = 0; + mosi = 1; + miso = 2; +; + +#------------------------------------------------------------ +# openmoko +#------------------------------------------------------------ + +# http://wiki.openmoko.org/wiki/Debug_Board_v3 +programmer + id = "openmoko"; + desc = "Openmoko debug board (v3)"; + type = "avrftdi"; + usbvid = 0x1457; + usbpid = 0x5118; + usbdev = "A"; + reset = 3; # TMS 7 + sck = 0; # TCK 9 + mosi = 1; # TDI 5 + miso = 2; # TDO 13 +; + +#------------------------------------------------------------ +# lm3s811 +#------------------------------------------------------------ + +# Only Rev. A boards. +# Schematic and user manual: http://www.cs.put.poznan.pl/wswitala/download/pdf/811EVBK.pdf +programmer + id = "lm3s811"; + desc = "Luminary Micro LM3S811 Eval Board (Rev. A)"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; + usbpid = 0xbcd9; + usbdev = "A"; + usbvendor = "LMI"; + usbproduct = "LM3S811 Evaluation Board"; +# Enable correct buffers + buff = 7; +#ISP-signals - lower ACBUS-Nibble (default) + reset = 3; + sck = 0; + mosi = 1; + miso = 2; +; + +#------------------------------------------------------------ +# tumpa +#------------------------------------------------------------ + +# submitted as bug #46020 +programmer + id = "tumpa"; + desc = "TIAO USB Multi-Protocol Adapter"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; + usbpid = 0x8a98; + usbdev = "A"; + usbvendor = "TIAO"; + reset = 3; # TMS 7 + sck = 0; # TCK 9 + mosi = 1; # TDI 5 + miso = 2; # TDO 13 +; + +#------------------------------------------------------------ +# ktlink +#------------------------------------------------------------ + +# Kristech KT-LINK FT2232H interface with IO switching and voltage buffers. +# Created on 20220410 by CeDeROM Tomasz CEDRO (www.cederom.io). +# Interface DataSheet: https://kristech.pl/files/KT-LINK-UM-ENG.pdf +# AVRDUDE FT2232H PIN NUMBER DECODE: +# | 0 | 1 | .. | 7 | 8 | 9 | .. | 15 | +# | ADBUS0 | ADBUS1 | .. | ADBUS7 | ACBUS0 | ACBUS1 | .. | ACBUS7 | +# KT-LINK JTAG CONN: +# 1=Vsense(->EXT13), 19=5V(EXT1->EXT3), 20=GND, 3=TPIRST, 9=TPICLK, 7=TPIDATA. +# INTERNALS CONFIGURATION ("~" MEANS ACTIVE LOW): +# ~TRST_EN=10(ACBUS2), ~CLK_EN=14(ACBUS6), ~MOSI_EN=13(ACBUS5), +# TMS_SEL=5(ADBUS5), ~TMS_EN=12(ACBUS4), LED=~15(ACBUS7). +# CONNECTION NOTES: +# * Connect EXT connector pin 1 with 3 to get 5V on JTAG connector pin 19. +# * Connect JTAG connector pin 1 to 5V (i.e. EXT pin 13 or JTAG pin 19). +# * For TPI connection use resistors: TDO --[470R]-- TPIDATA --[470R]-- TDI. +# * Powering target from JTAG pin 19 allows KT-LINK current measurement. +programmer + id = "ktlink"; + desc = "KT-LINK FT2232H interface with IO switching and voltage buffers."; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; + usbpid = 0xbbe2; + usbdev = "A"; + buff = 5, ~10, ~13, ~14; + reset = 8; + sck = 0; + mosi = 1; + miso = 2; + rdyled = ~15; +; + +#------------------------------------------------------------ +# serialupdi +#------------------------------------------------------------ + +programmer + id = "serialupdi"; + desc = "SerialUPDI"; + type = "serialupdi"; + connection_type = serial; + hvupdi_support = 1; +; + +#------------------------------------------------------------ +# avrisp +#------------------------------------------------------------ + +programmer + id = "avrisp"; + desc = "Atmel AVR ISP"; + type = "stk500"; + connection_type = serial; +; + +#------------------------------------------------------------ +# avrispv2 +#------------------------------------------------------------ + +programmer + id = "avrispv2"; + desc = "Atmel AVR ISP V2"; + type = "stk500v2"; + connection_type = serial; +; + +#------------------------------------------------------------ +# avrispmkII +#------------------------------------------------------------ + +programmer + id = "avrispmkII"; + desc = "Atmel AVR ISP mkII"; + type = "stk500v2"; + connection_type = usb; +; + +#------------------------------------------------------------ +# avrisp2 +#------------------------------------------------------------ + +programmer parent "avrispmkII" + id = "avrisp2"; + type = "stk500v2"; +; + +#------------------------------------------------------------ +# buspirate +#------------------------------------------------------------ + +programmer + id = "buspirate"; + desc = "The Bus Pirate"; + type = "buspirate"; + connection_type = serial; +; + +#------------------------------------------------------------ +# buspirate_bb +#------------------------------------------------------------ + +programmer + id = "buspirate_bb"; + desc = "The Bus Pirate (bitbang interface, supports TPI)"; + type = "buspirate_bb"; + connection_type = serial; + # pins are bits in bitbang byte (numbers are 87654321) + # 1|POWER|PULLUP|AUX|MOSI|CLK|MISO|CS + reset = 1; + sck = 3; + mosi = 4; + miso = 2; + #vcc = 7; This is internally set independent of this setting. +; + +#------------------------------------------------------------ +# stk500 +#------------------------------------------------------------ + +# This is supposed to be the "default" STK500 entry. +# Attempts to select the correct firmware version +# by probing for it. Better use one of the entries +# below instead. +programmer + id = "stk500"; + desc = "Atmel STK500"; + type = "stk500generic"; + connection_type = serial; +; + +#------------------------------------------------------------ +# stk500v1 +#------------------------------------------------------------ + +programmer + id = "stk500v1"; + desc = "Atmel STK500 Version 1.x firmware"; + type = "stk500"; + connection_type = serial; +; + +#------------------------------------------------------------ +# mib510 +#------------------------------------------------------------ + +programmer + id = "mib510"; + desc = "Crossbow MIB510 programming board"; + type = "stk500"; + connection_type = serial; +; + +#------------------------------------------------------------ +# stk500v2 +#------------------------------------------------------------ + +programmer + id = "stk500v2"; + desc = "Atmel STK500 Version 2.x firmware"; + type = "stk500v2"; + connection_type = serial; +; + +#------------------------------------------------------------ +# stk500pp +#------------------------------------------------------------ + +programmer + id = "stk500pp"; + desc = "Atmel STK500 V2 in parallel programming mode"; + type = "stk500pp"; + connection_type = serial; +; + +#------------------------------------------------------------ +# stk500hvsp +#------------------------------------------------------------ + +programmer + id = "stk500hvsp"; + desc = "Atmel STK500 V2 in high-voltage serial programming mode"; + type = "stk500hvsp"; + connection_type = serial; +; + +#------------------------------------------------------------ +# stk600 +#------------------------------------------------------------ + +programmer + id = "stk600"; + desc = "Atmel STK600"; + type = "stk600"; + connection_type = usb; +; + +#------------------------------------------------------------ +# stk600pp +#------------------------------------------------------------ + +programmer + id = "stk600pp"; + desc = "Atmel STK600 in parallel programming mode"; + type = "stk600pp"; + connection_type = usb; +; + +#------------------------------------------------------------ +# stk600hvsp +#------------------------------------------------------------ + +programmer + id = "stk600hvsp"; + desc = "Atmel STK600 in high-voltage serial programming mode"; + type = "stk600hvsp"; + connection_type = usb; +; + +#------------------------------------------------------------ +# avr910 +#------------------------------------------------------------ + +programmer + id = "avr910"; + desc = "Atmel Low Cost Serial Programmer"; + type = "avr910"; + connection_type = serial; +; + +#------------------------------------------------------------ +# ft245r +#------------------------------------------------------------ + +programmer + id = "ft245r"; + desc = "FT245R Synchronous BitBang"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 4; # D4 + sck = 0; # D0 + mosi = 2; # D2 + miso = 1; # D1 +; + +#------------------------------------------------------------ +# ft232r +#------------------------------------------------------------ + +programmer + id = "ft232r"; + desc = "FT232R Synchronous BitBang"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 4; # DTR + sck = 0; # TxD + mosi = 2; # RTS + miso = 1; # RxD +; + +#------------------------------------------------------------ +# bwmega +#------------------------------------------------------------ + +# see http://www.bitwizard.nl/wiki/index.php/FTDI_ATmega +programmer + id = "bwmega"; + desc = "BitWizard ftdi_atmega builtin programmer"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 7; # RI + sck = 6; # DCD + mosi = 3; # CTS + miso = 5; # DSR +; + +#------------------------------------------------------------ +# arduino-ft232r +#------------------------------------------------------------ + +# see http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html +# Note: pins are numbered from 1! +programmer + id = "arduino-ft232r"; + desc = "Arduino: FT232R connected to ISP"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 7; # RI X3(4) + sck = 5; # DSR X3(2) + mosi = 6; # DCD X3(3) + miso = 3; # CTS X3(1) +; + +#------------------------------------------------------------ +# tc2030 +#------------------------------------------------------------ + +programmer + id = "tc2030"; + desc = "Tag-Connect TC2030"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 3; # CTS = D3 (wire to ~RESET) + sck = 2; # RTS = D2 (wire to SCK) + # FOR TPI devices: + mosi = 0; # TxD = D0 (wire to TPIDATA via 1k resistor) + miso = 1; # RxD = D1 (wire to TPIDATA directly) +; + +#------------------------------------------------------------ +# diecimila +#------------------------------------------------------------ + +# website mentioned above uses this id +programmer parent "arduino-ft232r" + id = "diecimila"; + desc = "alias for arduino-ft232r"; + type = "ftdi_syncbb"; + reset = 7; + sck = 5; + mosi = 6; + miso = 3; +; + +#------------------------------------------------------------ +# uncompatino +#------------------------------------------------------------ + +# There is a ATmega328P kit PCB called "uncompatino". +# This board allows ISP via its on-board FT232R. +# This is designed like Arduino Duemilanove but has no standard ICPS header. +# Its 4 pairs of pins are shorted to enable ftdi_syncbb. +# http://akizukidenshi.com/catalog/g/gP-07487/ +# http://akizukidenshi.com/download/ds/akizuki/k6096_manual_20130816.pdf +programmer + id = "uncompatino"; + desc = "uncompatino with all pairs of pins shorted"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 7; # ri + sck = 5; # dsr + mosi = 6; # dcd + miso = 3; # cts +; + +#------------------------------------------------------------ +# ttl232r +#------------------------------------------------------------ + +# FTDI USB to serial cable TTL-232R-5V with a custom adapter for ICSP +# http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm +# http://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_TTL-232R_CABLES.pdf +# For ICSP pinout see for example http://www.atmel.com/images/doc2562.pdf +# (Figure 1. ISP6PIN header pinout and Table 1. Connections required for ISP ...) +# TTL-232R GND 1 Black -> ICPS GND (pin 6) +# TTL-232R CTS 2 Brown -> ICPS MOSI (pin 4) +# TTL-232R VCC 3 Red -> ICPS VCC (pin 2) +# TTL-232R TXD 4 Orange -> ICPS RESET (pin 5) +# TTL-232R RXD 5 Yellow -> ICPS SCK (pin 3) +# TTL-232R RTS 6 Green -> ICPS MISO (pin 1) +# Except for VCC and GND, you can connect arbitual pairs as long as +# the following table is adjusted. +programmer + id = "ttl232r"; + desc = "FTDI TTL232R-5V with ICSP adapter"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 0; # txd + sck = 1; # rxd + mosi = 3; # cts + miso = 2; # rts +; + +#------------------------------------------------------------ +# usbasp +#------------------------------------------------------------ + +programmer + id = "usbasp"; + desc = "USBasp, http://www.fischl.de/usbasp/"; + type = "usbasp"; + connection_type = usb; + usbvid = 0x16c0; # VOTI + usbpid = 0x05dc; # Obdev's free shared PID + usbvendor = "www.fischl.de"; + usbproduct = "USBasp"; + # following variants are autodetected for id "usbasp" + + # original usbasp from fischl.de + # see above "usbasp" + + # old usbasp from fischl.de + #usbvid = 0x03EB; # ATMEL + #usbpid = 0xC7B4; # (unoffical) USBasp + #usbvendor = "www.fischl.de"; + #usbproduct = "USBasp"; + + # NIBObee (only if -P nibobee is given on command line) + # see below "nibobee" +; + +#------------------------------------------------------------ +# nibobee +#------------------------------------------------------------ + +programmer + id = "nibobee"; + desc = "NIBObee"; + type = "usbasp"; + connection_type = usb; + usbvid = 0x16c0; # VOTI + usbpid = 0x092f; # NIBObee PID + usbvendor = "www.nicai-systems.com"; + usbproduct = "NIBObee"; +; + +#------------------------------------------------------------ +# usbasp-clone +#------------------------------------------------------------ + +programmer + id = "usbasp-clone"; + desc = "Any usbasp clone with correct VID/PID"; + type = "usbasp"; + connection_type = usb; + usbvid = 0x16c0; # VOTI + usbpid = 0x05dc; # Obdev's free shared PID + #usbvendor = ""; + #usbproduct = ""; +; + +#------------------------------------------------------------ +# usbtiny +#------------------------------------------------------------ + +# USBtiny can also be used for TPI programming. +# In that case, a resistor of 1 kOhm is needed between MISO and MOSI +# pins of the connector, and MISO (pin 1 of the 6-pin connector) +# connects to TPIDATA. +programmer + id = "usbtiny"; + desc = "USBtiny simple USB programmer, https://learn.adafruit.com/usbtinyisp"; + type = "usbtiny"; + connection_type = usb; + usbvid = 0x1781; + usbpid = 0x0c9f; +; + +#------------------------------------------------------------ +# arduinoisp +#------------------------------------------------------------ + +programmer + id = "arduinoisp"; + desc = "Arduino ISP Programmer"; + type = "usbtiny"; + connection_type = usb; + usbvid = 0x2341; + usbpid = 0x0049; +; + +#------------------------------------------------------------ +# arduinoisporg +#------------------------------------------------------------ + +programmer + id = "arduinoisporg"; + desc = "Arduino ISP Programmer"; + type = "usbtiny"; + connection_type = usb; + usbvid = 0x2a03; + usbpid = 0x0049; +; + +#------------------------------------------------------------ +# ehajo-isp +#------------------------------------------------------------ + +# commercial version of USBtiny, using a separate VID/PID +programmer + id = "ehajo-isp"; + desc = "avr-isp-programmer from eHaJo, http://www.eHaJo.de"; + type = "usbtiny"; + connection_type = usb; + usbvid = 0x16d0; + usbpid = 0x0ba5; +; + +#------------------------------------------------------------ +# iseavrprog +#------------------------------------------------------------ + +# commercial version of USBtiny, using a separate VID/PID +# https://github.com/IowaScaledEngineering/ckt-avrprogrammer +programmer + id = "iseavrprog"; + desc = "USBtiny-based programmer, https://iascaled.com"; + type = "usbtiny"; + connection_type = usb; + usbvid = 0x1209; + usbpid = 0x6570; +; + +#------------------------------------------------------------ +# micronucleus +#------------------------------------------------------------ + +programmer + id = "micronucleus"; + desc = "Micronucleus Bootloader"; + type = "micronucleus"; + connection_type = usb; + usbvid = 0x16d0; + usbpid = 0x0753; +; + +#------------------------------------------------------------ +# teensy +#------------------------------------------------------------ + +programmer + id = "teensy"; + desc = "Teensy Bootloader"; + type = "teensy"; + connection_type = usb; + usbvid = 0x16c0; + usbpid = 0x0478; +; + +#------------------------------------------------------------ +# butterfly +#------------------------------------------------------------ + +programmer + id = "butterfly"; + desc = "Atmel Butterfly Development Board"; + type = "butterfly"; + connection_type = serial; +; + +#------------------------------------------------------------ +# avr109 +#------------------------------------------------------------ + +programmer + id = "avr109"; + desc = "Atmel AppNote AVR109 Boot Loader"; + type = "butterfly"; + connection_type = serial; +; + +#------------------------------------------------------------ +# avr911 +#------------------------------------------------------------ + +programmer + id = "avr911"; + desc = "Atmel AppNote AVR911 AVROSP"; + type = "butterfly"; + connection_type = serial; +; + +#------------------------------------------------------------ +# mkbutterfly +#------------------------------------------------------------ + +# suggested in http://forum.mikrokopter.de/topic-post48317.html +programmer + id = "mkbutterfly"; + desc = "Mikrokopter.de Butterfly"; + type = "butterfly_mk"; + connection_type = serial; +; + +#------------------------------------------------------------ +# butterfly_mk +#------------------------------------------------------------ + +programmer parent "mkbutterfly" + id = "butterfly_mk"; + type = "butterfly_mk"; +; + +#------------------------------------------------------------ +# jtagmkI +#------------------------------------------------------------ + +programmer + id = "jtagmkI"; + desc = "Atmel JTAG ICE (mkI)"; + type = "jtagmki"; + connection_type = serial; + baudrate = 115200; # default is 115200 +; + +#------------------------------------------------------------ +# jtag1 +#------------------------------------------------------------ + +# easier to type +programmer parent "jtagmkI" + id = "jtag1"; + type = "jtagmki"; +; + +#------------------------------------------------------------ +# jtag1slow +#------------------------------------------------------------ + +# easier to type +programmer parent "jtag1" + id = "jtag1slow"; + type = "jtagmki"; + baudrate = 19200; +; + +#------------------------------------------------------------ +# jtagmkII +#------------------------------------------------------------ + +# The JTAG ICE mkII has both, serial and USB connectivity. As it is +# mostly used through USB these days (AVR Studio 5 only supporting it +# that way), we make connection_type = usb the default. Users are +# still free to use a serial port with the -P option. + +programmer + id = "jtagmkII"; + desc = "Atmel JTAG ICE mkII"; + type = "jtagmkii"; + connection_type = usb; + baudrate = 19200; # default is 19200 +; + +#------------------------------------------------------------ +# jtag2slow +#------------------------------------------------------------ + +# easier to type +programmer parent "jtagmkII" + id = "jtag2slow"; + type = "jtagmkii"; +; + +#------------------------------------------------------------ +# jtag2fast +#------------------------------------------------------------ + +# JTAG ICE mkII @ 115200 Bd +programmer parent "jtag2slow" + id = "jtag2fast"; + type = "jtagmkii"; + baudrate = 115200; +; + +#------------------------------------------------------------ +# jtag2 +#------------------------------------------------------------ + +# make the fast one the default, people will love that +programmer parent "jtag2fast" + id = "jtag2"; + type = "jtagmkii"; +; + +#------------------------------------------------------------ +# jtag2isp +#------------------------------------------------------------ + +# JTAG ICE mkII in ISP mode +programmer + id = "jtag2isp"; + desc = "Atmel JTAG ICE mkII in ISP mode"; + type = "jtagmkii_isp"; + connection_type = usb; + baudrate = 115200; +; + +#------------------------------------------------------------ +# jtag2dw +#------------------------------------------------------------ + +# JTAG ICE mkII in debugWire mode +programmer + id = "jtag2dw"; + desc = "Atmel JTAG ICE mkII in debugWire mode"; + type = "jtagmkii_dw"; + connection_type = usb; + baudrate = 115200; +; + +#------------------------------------------------------------ +# jtagmkII_avr32 +#------------------------------------------------------------ + +# JTAG ICE mkII in AVR32 mode +programmer + id = "jtagmkII_avr32"; + desc = "Atmel JTAG ICE mkII im AVR32 mode"; + type = "jtagmkii_avr32"; + connection_type = usb; + baudrate = 115200; +; + +#------------------------------------------------------------ +# jtag2avr32 +#------------------------------------------------------------ + +# JTAG ICE mkII in AVR32 mode +programmer + id = "jtag2avr32"; + desc = "Atmel JTAG ICE mkII im AVR32 mode"; + type = "jtagmkii_avr32"; + connection_type = usb; + baudrate = 115200; +; + +#------------------------------------------------------------ +# jtag2pdi +#------------------------------------------------------------ + +# JTAG ICE mkII in PDI mode +programmer + id = "jtag2pdi"; + desc = "Atmel JTAG ICE mkII PDI mode"; + type = "jtagmkii_pdi"; + connection_type = usb; + baudrate = 115200; +; + +#------------------------------------------------------------ +# dragon_jtag +#------------------------------------------------------------ + +# AVR Dragon in JTAG mode +programmer + id = "dragon_jtag"; + desc = "Atmel AVR Dragon in JTAG mode"; + type = "dragon_jtag"; + connection_type = usb; + baudrate = 115200; +; + +#------------------------------------------------------------ +# dragon_isp +#------------------------------------------------------------ + +# AVR Dragon in ISP mode +programmer + id = "dragon_isp"; + desc = "Atmel AVR Dragon in ISP mode"; + type = "dragon_isp"; + connection_type = usb; + baudrate = 115200; +; + +#------------------------------------------------------------ +# dragon_pp +#------------------------------------------------------------ + +# AVR Dragon in PP mode +programmer + id = "dragon_pp"; + desc = "Atmel AVR Dragon in PP mode"; + type = "dragon_pp"; + connection_type = usb; + baudrate = 115200; +; + +#------------------------------------------------------------ +# dragon_hvsp +#------------------------------------------------------------ + +# AVR Dragon in HVSP mode +programmer + id = "dragon_hvsp"; + desc = "Atmel AVR Dragon in HVSP mode"; + type = "dragon_hvsp"; + connection_type = usb; + baudrate = 115200; +; + +#------------------------------------------------------------ +# dragon_dw +#------------------------------------------------------------ + +# AVR Dragon in debugWire mode +programmer + id = "dragon_dw"; + desc = "Atmel AVR Dragon in debugWire mode"; + type = "dragon_dw"; + connection_type = usb; + baudrate = 115200; +; + +#------------------------------------------------------------ +# dragon_pdi +#------------------------------------------------------------ + +# AVR Dragon in PDI mode +programmer + id = "dragon_pdi"; + desc = "Atmel AVR Dragon in PDI mode"; + type = "dragon_pdi"; + connection_type = usb; + baudrate = 115200; +; + +#------------------------------------------------------------ +# jtag3 +#------------------------------------------------------------ + +programmer + id = "jtag3"; + desc = "Atmel AVR JTAGICE3 in JTAG mode"; + type = "jtagice3"; + connection_type = usb; + usbpid = 0x2110, 0x2140; +; + +#------------------------------------------------------------ +# jtag3pdi +#------------------------------------------------------------ + +programmer + id = "jtag3pdi"; + desc = "Atmel AVR JTAGICE3 in PDI mode"; + type = "jtagice3_pdi"; + connection_type = usb; + usbpid = 0x2110, 0x2140; +; + +#------------------------------------------------------------ +# jtag3updi +#------------------------------------------------------------ + +programmer + id = "jtag3updi"; + desc = "Atmel AVR JTAGICE3 in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2110, 0x2140; + hvupdi_support = 1; +; + +#------------------------------------------------------------ +# jtag3dw +#------------------------------------------------------------ + +programmer + id = "jtag3dw"; + desc = "Atmel AVR JTAGICE3 in debugWIRE mode"; + type = "jtagice3_dw"; + connection_type = usb; + usbpid = 0x2110, 0x2140; +; + +#------------------------------------------------------------ +# jtag3isp +#------------------------------------------------------------ + +programmer + id = "jtag3isp"; + desc = "Atmel AVR JTAGICE3 in ISP mode"; + type = "jtagice3_isp"; + connection_type = usb; + usbpid = 0x2110, 0x2140; +; + +#------------------------------------------------------------ +# xplainedpro +#------------------------------------------------------------ + +programmer + id = "xplainedpro"; + desc = "Atmel AVR XplainedPro in JTAG mode"; + type = "jtagice3"; + connection_type = usb; + usbpid = 0x2111; +; + +#------------------------------------------------------------ +# xplainedpro_updi +#------------------------------------------------------------ + +programmer + id = "xplainedpro_updi"; + desc = "Atmel AVR XplainedPro in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2111; + hvupdi_support = 1; +; + +#------------------------------------------------------------ +# xplainedmini +#------------------------------------------------------------ + +programmer + id = "xplainedmini"; + desc = "Atmel AVR XplainedMini in ISP mode"; + type = "jtagice3_isp"; + connection_type = usb; + usbpid = 0x2145; +; + +#------------------------------------------------------------ +# xplainedmini_dw +#------------------------------------------------------------ + +programmer + id = "xplainedmini_dw"; + desc = "Atmel AVR XplainedMini in debugWIRE mode"; + type = "jtagice3_dw"; + connection_type = usb; + usbpid = 0x2145; +; + +#------------------------------------------------------------ +# xplainedmini_updi +#------------------------------------------------------------ + +programmer + id = "xplainedmini_updi"; + desc = "Atmel AVR XplainedMini in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2145; + hvupdi_support = 1; +; + +#------------------------------------------------------------ +# atmelice +#------------------------------------------------------------ + +programmer + id = "atmelice"; + desc = "Atmel-ICE (ARM/AVR) in JTAG mode"; + type = "jtagice3"; + connection_type = usb; + usbpid = 0x2141; +; + +#------------------------------------------------------------ +# atmelice_pdi +#------------------------------------------------------------ + +programmer + id = "atmelice_pdi"; + desc = "Atmel-ICE (ARM/AVR) in PDI mode"; + type = "jtagice3_pdi"; + connection_type = usb; + usbpid = 0x2141; +; + +#------------------------------------------------------------ +# atmelice_updi +#------------------------------------------------------------ + +programmer + id = "atmelice_updi"; + desc = "Atmel-ICE (ARM/AVR) in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2141; + hvupdi_support = 1; +; + +#------------------------------------------------------------ +# atmelice_dw +#------------------------------------------------------------ + +programmer + id = "atmelice_dw"; + desc = "Atmel-ICE (ARM/AVR) in debugWIRE mode"; + type = "jtagice3_dw"; + connection_type = usb; + usbpid = 0x2141; +; + +#------------------------------------------------------------ +# atmelice_isp +#------------------------------------------------------------ + +programmer + id = "atmelice_isp"; + desc = "Atmel-ICE (ARM/AVR) in ISP mode"; + type = "jtagice3_isp"; + connection_type = usb; + usbpid = 0x2141; +; + +#------------------------------------------------------------ +# powerdebugger +#------------------------------------------------------------ + +programmer + id = "powerdebugger"; + desc = "Atmel PowerDebugger (ARM/AVR) in JTAG mode"; + type = "jtagice3"; + connection_type = usb; + usbpid = 0x2144; +; + +#------------------------------------------------------------ +# powerdebugger_pdi +#------------------------------------------------------------ + +programmer + id = "powerdebugger_pdi"; + desc = "Atmel PowerDebugger (ARM/AVR) in PDI mode"; + type = "jtagice3_pdi"; + connection_type = usb; + usbpid = 0x2144; +; + +#------------------------------------------------------------ +# powerdebugger_updi +#------------------------------------------------------------ + +programmer + id = "powerdebugger_updi"; + desc = "Atmel PowerDebugger (ARM/AVR) in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2144; + hvupdi_support = 0, 1; +; + +#------------------------------------------------------------ +# powerdebugger_dw +#------------------------------------------------------------ + +programmer + id = "powerdebugger_dw"; + desc = "Atmel PowerDebugger (ARM/AVR) in debugWire mode"; + type = "jtagice3_dw"; + connection_type = usb; + usbpid = 0x2144; +; + +#------------------------------------------------------------ +# powerdebugger_isp +#------------------------------------------------------------ + +programmer + id = "powerdebugger_isp"; + desc = "Atmel PowerDebugger (ARM/AVR) in ISP mode"; + type = "jtagice3_isp"; + connection_type = usb; + usbpid = 0x2144; +; + +#------------------------------------------------------------ +# pickit4_updi +#------------------------------------------------------------ + +programmer + id = "pickit4_updi"; + desc = "MPLAB(R) PICkit 4 in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2177, 0x2178, 0x2179; + hvupdi_support = 0, 1, 2; +; + +#------------------------------------------------------------ +# pickit4_pdi +#------------------------------------------------------------ + +programmer + id = "pickit4_pdi"; + desc = "MPLAB(R) PICkit 4 in PDI mode"; + type = "jtagice3_pdi"; + connection_type = usb; + usbpid = 0x2177, 0x2178, 0x2179; +; + +#------------------------------------------------------------ +# pickit4_isp +#------------------------------------------------------------ + +programmer + id = "pickit4_isp"; + desc = "MPLAB(R) PICkit 4 in ISP mode"; + type = "jtagice3_isp"; + connection_type = usb; + usbpid = 0x2177, 0x2178, 0x2179; +; + +#------------------------------------------------------------ +# snap_updi +#------------------------------------------------------------ + +programmer + id = "snap_updi"; + desc = "MPLAB(R) SNAP in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x217f, 0x2180, 0x2181; + hvupdi_support = 1; +; + +#------------------------------------------------------------ +# snap_pdi +#------------------------------------------------------------ + +programmer + id = "snap_pdi"; + desc = "MPLAB(R) SNAP in PDI mode"; + type = "jtagice3_pdi"; + connection_type = usb; + usbpid = 0x217f, 0x2180, 0x2181; +; + +#------------------------------------------------------------ +# snap_isp +#------------------------------------------------------------ + +programmer + id = "snap_isp"; + desc = "MPLAB(R) SNAP in ISP mode"; + type = "jtagice3_isp"; + connection_type = usb; + usbpid = 0x217f, 0x2180, 0x2181; +; + +#------------------------------------------------------------ +# pkobn_updi +#------------------------------------------------------------ + +programmer + id = "pkobn_updi"; + desc = "Curiosity nano (nEDBG) in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2175; + hvupdi_support = 1; +; + +#------------------------------------------------------------ +# pavr +#------------------------------------------------------------ + +programmer + id = "pavr"; + desc = "Jason Kyle's pAVR Serial Programmer"; + type = "avr910"; + connection_type = serial; +; + +#------------------------------------------------------------ +# pickit2 +#------------------------------------------------------------ + +programmer + id = "pickit2"; + desc = "MicroChip's PICkit2 Programmer"; + type = "pickit2"; + connection_type = usb; +; + +#------------------------------------------------------------ +# flip1 +#------------------------------------------------------------ + +programmer + id = "flip1"; + desc = "FLIP USB DFU protocol version 1 (doc7618)"; + type = "flip1"; + connection_type = usb; +; + +#------------------------------------------------------------ +# flip2 +#------------------------------------------------------------ + +programmer + id = "flip2"; + desc = "FLIP USB DFU protocol version 2 (AVR4023)"; + type = "flip2"; + connection_type = usb; +; + +#------------------------------------------------------------ +# ponyser +#------------------------------------------------------------ + +# some ultra cheap programmers use bitbanging on the serialport # # PC - DB9 - Pins for RS232: # @@ -1713,76 +2149,101 @@ programmer # reset=!txd sck=rts mosi=dtr miso=cts programmer - id = "ponyser"; - desc = "design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts"; - type = "serbb"; - connection_type = serial; - reset = ~3; - sck = 7; - mosi = 4; - miso = 8; + id = "ponyser"; + desc = "design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts"; + type = "serbb"; + connection_type = serial; + reset = ~3; + sck = 7; + mosi = 4; + miso = 8; ; +#------------------------------------------------------------ +# siprog +#------------------------------------------------------------ + # Same as above, different name # reset=!txd sck=rts mosi=dtr miso=cts programmer parent "ponyser" - id = "siprog"; - desc = "Lancos SI-Prog "; + id = "siprog"; + desc = "Lancos SI-Prog "; + type = "serbb"; + reset = ~3; + sck = 7; + mosi = 4; + miso = 8; ; +#------------------------------------------------------------ +# dasa +#------------------------------------------------------------ + # unknown (dasa in uisp) # reset=rts sck=dtr mosi=txd miso=cts programmer - id = "dasa"; - desc = "serial port banging, reset=rts sck=dtr mosi=txd miso=cts"; - type = "serbb"; - connection_type = serial; - reset = 7; - sck = 4; - mosi = 3; - miso = 8; + id = "dasa"; + desc = "serial port banging, reset=rts sck=dtr mosi=txd miso=cts"; + type = "serbb"; + connection_type = serial; + reset = 7; + sck = 4; + mosi = 3; + miso = 8; ; +#------------------------------------------------------------ +# dasa3 +#------------------------------------------------------------ + # unknown (dasa3 in uisp) # reset=!dtr sck=rts mosi=txd miso=cts programmer - id = "dasa3"; - desc = "serial port banging, reset=!dtr sck=rts mosi=txd miso=cts"; - type = "serbb"; - connection_type = serial; - reset = ~4; - sck = 7; - mosi = 3; - miso = 8; + id = "dasa3"; + desc = "serial port banging, reset=!dtr sck=rts mosi=txd miso=cts"; + type = "serbb"; + connection_type = serial; + reset = ~4; + sck = 7; + mosi = 3; + miso = 8; ; +#------------------------------------------------------------ +# c2n232i +#------------------------------------------------------------ + # C2N232i (jumper configuration "auto") # reset=dtr sck=!rts mosi=!txd miso=!cts programmer - id = "c2n232i"; - desc = "serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts"; - type = "serbb"; - connection_type = serial; - reset = 4; - sck = ~7; - mosi = ~3; - miso = ~8; + id = "c2n232i"; + desc = "serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts"; + type = "serbb"; + connection_type = serial; + reset = 4; + sck = ~7; + mosi = ~3; + miso = ~8; ; +#------------------------------------------------------------ +# jtag2updi +#------------------------------------------------------------ + # JTAG2UPDI # https://github.com/ElTangas/jtag2updi programmer - id = "jtag2updi"; - desc = "JTAGv2 to UPDI bridge"; - type = "jtagmkii_updi"; - connection_type = serial; - baudrate = 115200; - hvupdi_support = 1; + id = "jtag2updi"; + desc = "JTAGv2 to UPDI bridge"; + type = "jtagmkii_updi"; + connection_type = serial; + baudrate = 115200; + hvupdi_support = 1; ; # @@ -1796,62 +2257,57 @@ programmer # This is an HVSP-only device. part - id = "t11"; desc = "ATtiny11"; + id = "t11"; stk500_devcode = 0x11; - signature = 0x1e 0x90 0x04; chip_erase_delay = 20000; - serial = no; - - timeout = 200; - hvsp_controlstack = - 0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x00, + signature = 0x1e 0x90 0x04; + serial = no; + timeout = 200; + hvsp_controlstack = + 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x00, 0x68, 0x78, 0x68, 0x68, 0x00, 0x00, 0x68, 0x78, - 0x78, 0x00, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10, + 0x78, 0x00, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; hventerstabdelay = 100; - progmodedelay = 0; - hvspcmdexedelay = 0; - synchcycles = 6; latchcycles = 1; togglevtg = 1; poweroffdelay = 25; - resetdelayms = 0; resetdelayus = 50; hvleavestabdelay = 100; resetdelay = 25; chiperasepolltimeout = 40; - chiperasetime = 0; programfusepolltimeout = 25; programlockpolltimeout = 25; + synchcycles = 6; memory "eeprom" size = 64; - blocksize = 64; - readsize = 256; - delay = 5; + delay = 5; + blocksize = 64; + readsize = 256; ; memory "flash" size = 1024; - blocksize = 128; - readsize = 256; - delay = 3; + delay = 3; + blocksize = 128; + readsize = 256; ; - memory "signature" - size = 3; + memory "fuse" + size = 1; ; memory "lock" size = 1; ; - memory "calibration" - size = 1; + memory "signature" + size = 3; ; - memory "fuse" + memory "calibration" size = 1; ; ; @@ -1861,131 +2317,91 @@ part #------------------------------------------------------------ part - id = "t12"; desc = "ATtiny12"; + id = "t12"; stk500_devcode = 0x12; avr910_devcode = 0x55; - signature = 0x1e 0x90 0x05; chip_erase_delay = 20000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + signature = 0x1e 0x90 0x05; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; hvsp_controlstack = - 0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x00, + 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x00, 0x68, 0x78, 0x68, 0x68, 0x00, 0x00, 0x68, 0x78, - 0x78, 0x00, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10, + 0x78, 0x00, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; hventerstabdelay = 100; - hvspcmdexedelay = 0; - synchcycles = 6; latchcycles = 1; togglevtg = 1; poweroffdelay = 25; - resetdelayms = 0; resetdelayus = 50; hvleavestabdelay = 100; resetdelay = 25; chiperasepolltimeout = 40; - chiperasetime = 0; programfusepolltimeout = 25; programlockpolltimeout = 25; + synchcycles = 6; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 64; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 x x x x x x x x", - "x x a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = "1 1 0 0 0 0 0 0 x x x x x x x x", - "x x a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - mode = 0x04; - delay = 8; - blocksize = 64; - readsize = 256; + readback = 0xff 0xff; + mode = 4; + delay = 8; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xxaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; ; memory "flash" size = 1024; min_write_delay = 4500; max_write_delay = 20000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - write_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 5; - blocksize = 128; - readsize = 256; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x x x x x x o o x"; - - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 i i 1", - "x x x x x x x x x x x x x x x x"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; + readback = 0xff 0xff; + mode = 4; + delay = 5; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" size = 1; - read = "0 1 0 1 0 0 0 0 x x x x x x x x", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 x x x x x", - "x x x x x x x x i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--101x.xxxx--xxxx.xxxx--iiii.iiii"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -1994,83 +2410,60 @@ part #------------------------------------------------------------ part - id = "t13"; desc = "ATtiny13"; - has_debugwire = yes; - flash_instr = 0xB4, 0x0E, 0x1E; - eeprom_instr = 0xBB, 0xFE, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBC, 0x0E, 0xB4, 0x0E, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; + id = "t13"; stk500_devcode = 0x14; - signature = 0x1e 0x90 0x07; chip_erase_delay = 4000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - hvsp_controlstack = - 0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66, - 0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78, - 0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10, + signature = 0x1e 0x90 0x07; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + hvsp_controlstack = + 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, + 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, + 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; + flash_instr = 0xb4, 0x0e, 0x1e; + eeprom_instr = + 0xbb, 0xfe, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xbc, 0x0e, 0xb4, 0x0e, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; hventerstabdelay = 100; - progmodedelay = 0; - hvspcmdexedelay = 0; - synchcycles = 6; latchcycles = 1; togglevtg = 1; poweroffdelay = 25; - resetdelayms = 0; resetdelayus = 90; hvleavestabdelay = 100; resetdelay = 25; chiperasepolltimeout = 40; - chiperasetime = 0; programfusepolltimeout = 25; programlockpolltimeout = 25; - + synchcycles = 6; ocdrev = 0; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 64; page_size = 4; min_write_delay = 4000; max_write_delay = 4000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 0 x x x x x", - "x x a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = "1 1 0 0 0 0 0 0 0 0 0 x x x x x", - "x x a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 5; - blocksize = 4; - readsize = 256; + readback = 0xff 0xff; + mode = 65; + delay = 5; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--xxaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xxaa.aa00--xxxx.xxxx"; ; memory "flash" @@ -2080,86 +2473,51 @@ part num_pages = 32; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 0 0 0 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 0 0 0 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 0 0 0 a8", - " a7 a6 a5 a4 x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 32; - readsize = 256; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - - memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "calibration" - size = 2; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 a0 o o o o o o o o"; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.000a--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.000a--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.000a--aaaa.xxxx--xxxx.xxxx"; ; memory "lfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; + memory "lock" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - ; + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 2; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + ; ; #------------------------------------------------------------ @@ -2167,140 +2525,101 @@ part #------------------------------------------------------------ part parent "t13" - id = "t13a"; - desc = "ATtiny13A"; - ; + desc = "ATtiny13A"; + id = "t13a"; +; #------------------------------------------------------------ # ATtiny15 #------------------------------------------------------------ part - id = "t15"; desc = "ATtiny15"; + id = "t15"; stk500_devcode = 0x13; avr910_devcode = 0x56; - signature = 0x1e 0x90 0x06; chip_erase_delay = 8200; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + signature = 0x1e 0x90 0x06; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; hvsp_controlstack = - 0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x00, + 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x00, 0x68, 0x78, 0x68, 0x68, 0x00, 0x00, 0x68, 0x78, - 0x78, 0x00, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10, + 0x78, 0x00, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; hventerstabdelay = 100; - hvspcmdexedelay = 5; - synchcycles = 6; latchcycles = 16; togglevtg = 1; poweroffdelay = 25; - resetdelayms = 0; resetdelayus = 50; hvleavestabdelay = 100; resetdelay = 25; chiperasepolltimeout = 40; - chiperasetime = 0; programfusepolltimeout = 25; programlockpolltimeout = 25; + synchcycles = 6; + hvspcmdexedelay = 5; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 64; min_write_delay = 8200; max_write_delay = 8200; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 x x x x x x x x", - "x x a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = "1 1 0 0 0 0 0 0 x x x x x x x x", - "x x a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - mode = 0x04; - delay = 10; - blocksize = 64; - readsize = 256; + readback = 0xff 0xff; + mode = 4; + delay = 10; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xxaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; ; memory "flash" size = 1024; min_write_delay = 4100; max_write_delay = 4100; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - write_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 5; - blocksize = 128; - readsize = 256; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x x x x x x o o x"; - - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 i i 1", - "x x x x x x x x x x x x x x x x"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; + readback = 0xff 0xff; + mode = 4; + delay = 5; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" size = 1; - read = "0 1 0 1 0 0 0 0 x x x x x x x x", - "x x x x x x x x o o o o x x o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 x x x x x", - "x x x x x x x x i i i i 1 1 i i"; min_write_delay = 9000; max_write_delay = 9000; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--oooo.xxoo"; + write = "1010.1100--101x.xxxx--xxxx.xxxx--iiii.11ii"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -2309,4517 +2628,2972 @@ part #------------------------------------------------------------ part - id = "1200"; - desc = "AT90S1200"; - is_at90s1200 = yes; - stk500_devcode = 0x33; - avr910_devcode = 0x13; - signature = 0x1e 0x90 0x01; - pagel = 0xd7; - bs2 = 0xa0; - chip_erase_delay = 20000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 1; - bytedelay = 0; - pollindex = 0; - pollvalue = 0xFF; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "AT90S1200"; + id = "1200"; + stk500_devcode = 0x33; + avr910_devcode = 0x13; + chip_erase_delay = 20000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x90 0x01; + is_at90s1200 = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 1; + pollvalue = 0xff; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 0; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; chiperasepulsewidth = 15; - chiperasepolltimeout = 0; programfusepulsewidth = 2; - programfusepolltimeout = 0; - programlockpulsewidth = 0; programlockpolltimeout = 1; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 64; min_write_delay = 4000; max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 x x x x x x x x", - "x x a5 a4 a3 a2 a1 a0 o o o o o o o o"; + readback = 0x00 0xff; + mode = 4; + delay = 20; + blocksize = 32; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xxaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + ; - write = "1 1 0 0 0 0 0 0 x x x x x x x x", - "x x a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - mode = 0x04; - delay = 20; - blocksize = 32; - readsize = 256; - ; memory "flash" size = 1024; min_write_delay = 4000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0xff 0xff; + mode = 2; + delay = 15; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - write_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x02; - delay = 15; - blocksize = 128; - readsize = 256; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; memory "fuse" size = 1; - ; + ; + memory "lock" size = 1; min_write_delay = 9000; max_write_delay = 20000; - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 i i 1", - "x x x x x x x x x x x x x x x x"; - ; - ; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90s4414 #------------------------------------------------------------ part - id = "4414"; - desc = "AT90S4414"; - stk500_devcode = 0x50; - avr910_devcode = 0x28; - signature = 0x1e 0x92 0x01; - chip_erase_delay = 20000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "AT90S4414"; + id = "4414"; + stk500_devcode = 0x50; + avr910_devcode = 0x28; + chip_erase_delay = 20000; + signature = 0x1e 0x92 0x01; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01; hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 0; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; chiperasepulsewidth = 15; - chiperasepolltimeout = 0; programfusepulsewidth = 2; - programfusepolltimeout = 0; - programlockpulsewidth = 0; programlockpolltimeout = 1; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 256; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0x80; - readback_p2 = 0x7f; - read = " 1 0 1 0 0 0 0 0 x x x x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + readback = 0x80 0x7f; + mode = 4; + delay = 12; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + ; - write = " 1 1 0 0 0 0 0 0 x x x x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 64; - readsize = 256; - ; memory "flash" size = 4096; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0x7f; - readback_p2 = 0x7f; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0x7f 0x7f; + mode = 4; + delay = 12; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write_lo = " 0 1 0 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - write_hi = " 0 1 0 0 1 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 64; - readsize = 256; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; memory "fuse" - size = 1; - ; + size = 1; + ; + memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 i i 1", - "x x x x x x x x x x x x x x x x"; + size = 1; min_write_delay = 9000; max_write_delay = 9000; - ; - ; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90s2313 #------------------------------------------------------------ part - id = "2313"; - desc = "AT90S2313"; - stk500_devcode = 0x40; - avr910_devcode = 0x20; - signature = 0x1e 0x91 0x01; - chip_erase_delay = 20000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "AT90S2313"; + id = "2313"; + stk500_devcode = 0x40; + avr910_devcode = 0x20; + chip_erase_delay = 20000; + signature = 0x1e 0x91 0x01; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 0; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; chiperasepulsewidth = 15; - chiperasepolltimeout = 0; programfusepulsewidth = 2; - programfusepolltimeout = 0; - programlockpulsewidth = 0; programlockpolltimeout = 1; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 128; min_write_delay = 4000; max_write_delay = 9000; - readback_p1 = 0x80; - readback_p2 = 0x7f; - read = "1 0 1 0 0 0 0 0 x x x x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + readback = 0x80 0x7f; + mode = 4; + delay = 12; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + ; - write = "1 1 0 0 0 0 0 0 x x x x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 64; - readsize = 256; - ; memory "flash" size = 2048; min_write_delay = 4000; max_write_delay = 9000; - readback_p1 = 0x7f; - readback_p2 = 0x7f; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0x7f 0x7f; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - write_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 128; - readsize = 256; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; memory "fuse" size = 1; - ; + ; + memory "lock" size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x i i x", - "x x x x x x x x x x x x x x x x"; min_write_delay = 9000; max_write_delay = 9000; - ; - ; + write = "1010.1100--111x.xiix--xxxx.xxxx--xxxx.xxxx"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90s2333 #------------------------------------------------------------ part - id = "2333"; ##### WARNING: No XML file for device 'AT90S2333'! ##### - desc = "AT90S2333"; - stk500_devcode = 0x42; - avr910_devcode = 0x34; - signature = 0x1e 0x91 0x05; - chip_erase_delay = 20000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "AT90S2333"; + id = "2333"; + stk500_devcode = 0x42; + avr910_devcode = 0x34; + chip_erase_delay = 20000; + signature = 0x1e 0x91 0x05; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 0; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; chiperasepulsewidth = 15; - chiperasepolltimeout = 0; programfusepulsewidth = 2; - programfusepolltimeout = 0; - programlockpulsewidth = 0; programlockpolltimeout = 1; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 128; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0x00; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 x x x x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = "1 1 0 0 0 0 0 0 x x x x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 128; - readsize = 256; - ; + readback = 0x00 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + ; memory "flash" size = 2048; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0xff 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - write_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 128; - readsize = 256; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; memory "fuse" size = 1; min_write_delay = 9000; max_write_delay = 20000; pwroff_after_write = yes; - read = "0 1 0 1 0 0 0 0 x x x x x x x x", - "x x x x x x x x x x o o o o o o"; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xxoo.oooo"; + write = "1010.1100--101i.iiii--xxxx.xxxx--xxxx.xxxx"; + ; - write = "1 0 1 0 1 1 0 0 1 0 1 i i i i i", - "x x x x x x x x x x x x x x x x"; - ; memory "lock" size = 1; min_write_delay = 9000; max_write_delay = 20000; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x x x x x x o o x"; - - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 i i 1", - "x x x x x x x x x x x x x x x x"; - ; - ; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + ; + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90s2343 (also AT90s2323 and ATtiny22) #------------------------------------------------------------ part - id = "2343"; - desc = "AT90S2343"; - stk500_devcode = 0x43; - avr910_devcode = 0x4c; - signature = 0x1e 0x91 0x03; - chip_erase_delay = 18000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "AT90S2343"; + id = "2343"; + stk500_devcode = 0x43; + avr910_devcode = 0x4c; + chip_erase_delay = 18000; + signature = 0x1e 0x91 0x03; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; hvsp_controlstack = - 0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x00, + 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x00, 0x68, 0x78, 0x68, 0x68, 0x00, 0x00, 0x68, 0x78, - 0x78, 0x00, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10, + 0x78, 0x00, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; hventerstabdelay = 100; - hvspcmdexedelay = 0; - synchcycles = 6; latchcycles = 1; - togglevtg = 0; poweroffdelay = 25; - resetdelayms = 0; resetdelayus = 50; hvleavestabdelay = 100; resetdelay = 25; chiperasepolltimeout = 40; - chiperasetime = 0; programfusepolltimeout = 25; programlockpolltimeout = 25; + synchcycles = 6; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 128; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0x00; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0", - "x a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + readback = 0x00 0xff; + mode = 4; + delay = 12; + blocksize = 64; + readsize = 256; + read = "1010.0000--0000.0000--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.0000--xaaa.aaaa--iiii.iiii"; + ; - write = "1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0", - "x a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 64; - readsize = 256; - ; memory "flash" size = 2048; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0xff 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 128; + read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - write_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 128; - readsize = 128; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; memory "fuse" size = 1; min_write_delay = 9000; max_write_delay = 20000; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x o o o x x x x o"; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--ooox.xxxo"; + write = "1010.1100--1011.111i--xxxx.xxxx--xxxx.xxxx"; + ; - write = "1 0 1 0 1 1 0 0 1 0 1 1 1 1 1 i", - "x x x x x x x x x x x x x x x x"; - ; memory "lock" size = 1; min_write_delay = 9000; max_write_delay = 20000; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x o o o x x x x o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 i i 1", - "x x x x x x x x x x x x x x x x"; - ; - ; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--ooox.xxxo"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + ; + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90s4433 #------------------------------------------------------------ part - id = "4433"; - desc = "AT90S4433"; - stk500_devcode = 0x51; - avr910_devcode = 0x30; - signature = 0x1e 0x92 0x03; - chip_erase_delay = 20000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "AT90S4433"; + id = "4433"; + stk500_devcode = 0x51; + avr910_devcode = 0x30; + chip_erase_delay = 20000; + signature = 0x1e 0x92 0x03; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 0; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; chiperasepulsewidth = 15; - chiperasepolltimeout = 0; programfusepulsewidth = 2; - programfusepolltimeout = 0; - programlockpulsewidth = 0; programlockpolltimeout = 1; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 256; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0x00; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0 x x x x x x x x", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + readback = 0x00 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read = "1010.0000--xxxx.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--aaaa.aaaa--iiii.iiii"; + ; - write = " 1 1 0 0 0 0 0 0 x x x x x x x x", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 128; - readsize = 256; - ; memory "flash" size = 4096; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0xff 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write_lo = " 0 1 0 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - write_hi = " 0 1 0 0 1 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 128; - readsize = 256; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; memory "fuse" size = 1; min_write_delay = 9000; max_write_delay = 20000; pwroff_after_write = yes; - read = "0 1 0 1 0 0 0 0 x x x x x x x x", - "x x x x x x x x x x o o o o o o"; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xxoo.oooo"; + write = "1010.1100--101i.iiii--xxxx.xxxx--xxxx.xxxx"; + ; - write = "1 0 1 0 1 1 0 0 1 0 1 i i i i i", - "x x x x x x x x x x x x x x x x"; - ; memory "lock" size = 1; min_write_delay = 9000; max_write_delay = 20000; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x x x x x x o o x"; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + ; - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 i i 1", - "x x x x x x x x x x x x x x x x"; - ; - ; + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90s4434 #------------------------------------------------------------ part - id = "4434"; ##### WARNING: No XML file for device 'AT90S4434'! ##### - desc = "AT90S4434"; - stk500_devcode = 0x52; - avr910_devcode = 0x6c; - signature = 0x1e 0x92 0x02; - chip_erase_delay = 20000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; + desc = "AT90S4434"; + id = "4434"; + stk500_devcode = 0x52; + avr910_devcode = 0x6c; + chip_erase_delay = 20000; + signature = 0x1e 0x92 0x02; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 256; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0x00; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0 x x x x x x x x", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + readback = 0x00 0xff; + read = "1010.0000--xxxx.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--aaaa.aaaa--iiii.iiii"; + ; - write = " 1 1 0 0 0 0 0 0 x x x x x x x x", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - ; memory "flash" size = 4096; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0xff 0xff; + read_lo = "0010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write_lo = " 0 1 0 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - write_hi = " 0 1 0 0 1 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; memory "fuse" size = 1; min_write_delay = 9000; max_write_delay = 20000; - read = "0 1 0 1 0 0 0 0 x x x x x x x x", - "x x x x x x x x x x o o o o o o"; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xxoo.oooo"; + write = "1010.1100--101i.iiii--xxxx.xxxx--xxxx.xxxx"; + ; - write = "1 0 1 0 1 1 0 0 1 0 1 i i i i i", - "x x x x x x x x x x x x x x x x"; - ; memory "lock" size = 1; min_write_delay = 9000; max_write_delay = 20000; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x x x x x x o o x"; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + ; - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 i i 1", - "x x x x x x x x x x x x x x x x"; - ; - ; + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90s8515 #------------------------------------------------------------ part - id = "8515"; - desc = "AT90S8515"; - stk500_devcode = 0x60; - avr910_devcode = 0x38; - signature = 0x1e 0x93 0x01; - chip_erase_delay = 20000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "AT90S8515"; + id = "8515"; + stk500_devcode = 0x60; + avr910_devcode = 0x38; + chip_erase_delay = 20000; + signature = 0x1e 0x93 0x01; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 0; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; resetdelay = 15; chiperasepulsewidth = 15; - chiperasepolltimeout = 0; programfusepulsewidth = 2; - programfusepolltimeout = 0; - programlockpulsewidth = 0; programlockpolltimeout = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 512; min_write_delay = 4000; max_write_delay = 9000; - readback_p1 = 0x80; - readback_p2 = 0x7f; - read = " 1 0 1 0 0 0 0 0 x x x x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + readback = 0x80 0x7f; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + ; - write = " 1 1 0 0 0 0 0 0 x x x x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 128; - readsize = 256; - ; memory "flash" size = 8192; min_write_delay = 4000; max_write_delay = 9000; - readback_p1 = 0x7f; - readback_p2 = 0x7f; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0x7f 0x7f; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write_lo = " 0 1 0 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - write_hi = " 0 1 0 0 1 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 128; - readsize = 256; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; memory "fuse" - size = 1; - ; + size = 1; + ; + memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 i i 1", - "x x x x x x x x x x x x x x x x"; + size = 1; min_write_delay = 9000; max_write_delay = 9000; - ; - ; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90s8535 #------------------------------------------------------------ part - id = "8535"; - desc = "AT90S8535"; - stk500_devcode = 0x61; - avr910_devcode = 0x68; - signature = 0x1e 0x93 0x03; - chip_erase_delay = 20000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "AT90S8535"; + id = "8535"; + stk500_devcode = 0x61; + avr910_devcode = 0x68; + chip_erase_delay = 20000; + signature = 0x1e 0x93 0x03; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 0; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; chiperasepulsewidth = 15; - chiperasepolltimeout = 0; programfusepulsewidth = 2; - programfusepolltimeout = 0; - programlockpulsewidth = 0; programlockpolltimeout = 1; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 512; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0x00; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0 x x x x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + readback = 0x00 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + ; - write = " 1 1 0 0 0 0 0 0 x x x x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 128; - readsize = 256; - ; memory "flash" size = 8192; min_write_delay = 9000; max_write_delay = 20000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0xff 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + memory "fuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxxo"; + write = "1010.1100--1011.111i--xxxx.xxxx--xxxx.xxxx"; + ; - write_lo = " 0 1 0 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--ooxx.xxxx"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + ; - write_hi = " 0 1 0 0 1 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 128; - readsize = 256; - ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - memory "fuse" - size = 1; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x x x x x x x x o"; - write = "1 0 1 0 1 1 0 0 1 0 1 1 1 1 1 i", - "x x x x x x x x x x x x x x x x"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x o o x x x x x x"; - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 i i 1", - "x x x x x x x x x x x x x x x x"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega103 #------------------------------------------------------------ part - id = "m103"; - desc = "ATmega103"; - stk500_devcode = 0xB1; - avr910_devcode = 0x41; - signature = 0x1e 0x97 0x01; - chip_erase_delay = 112000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "ATmega103"; + id = "m103"; + stk500_devcode = 0xb1; + avr910_devcode = 0x41; + chip_erase_delay = 112000; + signature = 0x1e 0x97 0x01; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x8E, 0x9E, 0x2E, 0x3E, 0xAE, 0xBE, - 0x4E, 0x5E, 0xCE, 0xDE, 0x6E, 0x7E, 0xEE, 0xDE, - 0x66, 0x76, 0xE6, 0xF6, 0x6A, 0x7A, 0xEA, 0x7A, - 0x7F, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x8e, 0x9e, 0x2e, 0x3e, 0xae, 0xbe, + 0x4e, 0x5e, 0xce, 0xde, 0x6e, 0x7e, 0xee, 0xde, + 0x66, 0x76, 0xe6, 0xf6, 0x6a, 0x7a, 0xea, 0x7a, + 0x7f, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 0; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; chiperasepulsewidth = 15; - chiperasepolltimeout = 0; programfusepulsewidth = 2; - programfusepolltimeout = 0; - programlockpulsewidth = 0; programlockpolltimeout = 10; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 4096; min_write_delay = 4000; max_write_delay = 9000; - readback_p1 = 0x80; - readback_p2 = 0x7f; - read = " 1 0 1 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 64; - readsize = 256; - ; + readback = 0x80 0x7f; + mode = 4; + delay = 12; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + ; memory "flash" paged = yes; - size = 131072; + size = 0x20000; page_size = 256; num_pages = 512; min_write_delay = 22000; max_write_delay = 56000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x11; - delay = 70; - blocksize = 256; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 17; + delay = 70; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; memory "fuse" size = 1; - read = "0 1 0 1 0 0 0 0 x x x x x x x x", - "x x x x x x x x x x o x o 1 o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 1 i 1 i i", - "x x x x x x x x x x x x x x x x"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xxox.o1oo"; + write = "1010.1100--1011.i1ii--xxxx.xxxx--xxxx.xxxx"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x x x x x x o o x"; - - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 i i 1", - "x x x x x x x x x x x x x x x x"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; - + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega64 #------------------------------------------------------------ part - id = "m64"; - desc = "ATmega64"; - has_jtag = yes; - stk500_devcode = 0xA0; - avr910_devcode = 0x45; - signature = 0x1e 0x96 0x02; - chip_erase_delay = 9000; - pagel = 0xD7; - bs2 = 0xA0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "ATmega64"; + id = "m64"; + stk500_devcode = 0xa0; + avr910_devcode = 0x45; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x96 0x02; + has_jtag = yes; + allowfullpagebitstream = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 6; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x22; spmcr = 0x68; - allowfullpagebitstream = yes; - ocdrev = 2; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ size = 2048; + page_size = 8; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 20; - blocksize = 64; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 4; + delay = 20; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + ; memory "flash" paged = yes; - size = 65536; + size = 0x10000; page_size = 256; num_pages = 256; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " x a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " x a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 6; - blocksize = 128; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--xaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; - - memory "calibration" - size = 4; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 4; + read = "0011.1000--xxxx.xxxx--0000.00aa--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega64A #------------------------------------------------------------ part parent "m64" - id = "m64a"; - desc = "ATmega64A"; - ; + desc = "ATmega64A"; + id = "m64a"; +; #------------------------------------------------------------ # ATmega128 #------------------------------------------------------------ part - id = "m128"; - desc = "ATmega128"; - has_jtag = yes; - stk500_devcode = 0xB2; - avr910_devcode = 0x43; - signature = 0x1e 0x97 0x02; - chip_erase_delay = 9000; - pagel = 0xD7; - bs2 = 0xA0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 6; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; - hvleavestabdelay = 15; - chiperasepulsewidth = 0; - chiperasepolltimeout = 10; - programfusepulsewidth = 0; - programfusepolltimeout = 5; - programlockpulsewidth = 0; - programlockpolltimeout = 5; - - idr = 0x22; - spmcr = 0x68; - rampz = 0x3b; + desc = "ATmega128"; + id = "m128"; + stk500_devcode = 0xb2; + avr910_devcode = 0x43; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x97 0x02; + has_jtag = yes; allowfullpagebitstream = yes; - + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; + programfusepolltimeout = 5; + programlockpolltimeout = 5; + idr = 0x22; + rampz = 0x3b; + spmcr = 0x68; ocdrev = 1; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ size = 4096; + page_size = 8; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 12; - blocksize = 64; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 4; + delay = 12; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + ; memory "flash" paged = yes; - size = 131072; + size = 0x20000; page_size = 256; num_pages = 512; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 6; - blocksize = 128; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; - - memory "calibration" - size = 4; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 4; + read = "0011.1000--xxxx.xxxx--0000.00aa--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega128A #------------------------------------------------------------ part parent "m128" - id = "m128a"; - desc = "ATmega128A"; - ; + desc = "ATmega128A"; + id = "m128a"; +; #------------------------------------------------------------ # AT90CAN128 #------------------------------------------------------------ part - id = "c128"; - desc = "AT90CAN128"; - has_jtag = yes; - stk500_devcode = 0xB3; + desc = "AT90CAN128"; + id = "c128"; + stk500_devcode = 0xb3; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; # avr910_devcode = 0x43; - signature = 0x1e 0x97 0x81; - chip_erase_delay = 9000; - pagel = 0xD7; - bs2 = 0xA0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + signature = 0x1e 0x97 0x81; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 6; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; rampz = 0x3b; + spmcr = 0x57; eecr = 0x3f; - allowfullpagebitstream = no; - ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ size = 4096; + page_size = 8; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - - mode = 0x41; - delay = 20; - blocksize = 8; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 8; + readsize = 256; + read = "1010.0000--000x.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 131072; + size = 0x20000; page_size = 256; num_pages = 512; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 256; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90CAN64 #------------------------------------------------------------ part - id = "c64"; - desc = "AT90CAN64"; - has_jtag = yes; - stk500_devcode = 0xB3; + desc = "AT90CAN64"; + id = "c64"; + stk500_devcode = 0xb3; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; # avr910_devcode = 0x43; - signature = 0x1e 0x96 0x81; - chip_erase_delay = 9000; - pagel = 0xD7; - bs2 = 0xA0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + signature = 0x1e 0x96 0x81; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 6; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; rampz = 0x3b; + spmcr = 0x57; eecr = 0x3f; - allowfullpagebitstream = no; - ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ size = 2048; + page_size = 8; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - - mode = 0x41; - delay = 20; - blocksize = 8; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 8; + readsize = 256; + read = "1010.0000--000x.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 65536; + size = 0x10000; page_size = 256; num_pages = 256; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 256; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90CAN32 #------------------------------------------------------------ part - id = "c32"; - desc = "AT90CAN32"; - has_jtag = yes; - stk500_devcode = 0xB3; + desc = "AT90CAN32"; + id = "c32"; + stk500_devcode = 0xb3; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; # avr910_devcode = 0x43; - signature = 0x1e 0x95 0x81; - chip_erase_delay = 9000; - pagel = 0xD7; - bs2 = 0xA0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + signature = 0x1e 0x95 0x81; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 6; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; rampz = 0x3b; + spmcr = 0x57; eecr = 0x3f; - allowfullpagebitstream = no; - ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ size = 1024; + page_size = 8; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - - mode = 0x41; - delay = 20; - blocksize = 8; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 8; + readsize = 256; + read = "1010.0000--000x.xxaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.xxaa--aaaa.a000--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 32768; + size = 0x8000; page_size = 256; num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 256; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega16 #------------------------------------------------------------ part - id = "m16"; - desc = "ATmega16"; - has_jtag = yes; - stk500_devcode = 0x82; - avr910_devcode = 0x74; - signature = 0x1e 0x94 0x03; - pagel = 0xd7; - bs2 = 0xa0; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "ATmega16"; + id = "m16"; + stk500_devcode = 0x82; + avr910_devcode = 0x74; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x94 0x03; + has_jtag = yes; + allowfullpagebitstream = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; progmodedelay = 100; latchcycles = 6; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; resetdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; spmcr = 0x57; - allowfullpagebitstream = yes; - ocdrev = 2; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ size = 512; + page_size = 4; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x04; - delay = 10; - blocksize = 128; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 4; + delay = 10; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.xxaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 16384; + size = 0x4000; page_size = 128; num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 6; - blocksize = 128; - readsize = 256; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - min_write_delay = 9000; - max_write_delay = 9000; - ; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + memory "calibration" size = 4; - - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; - ; + read = "0011.1000--000x.xxxx--0000.00aa--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega16A #------------------------------------------------------------ part parent "m16" - id = "m16a"; - desc = "ATmega16A"; - ; + desc = "ATmega16A"; + id = "m16a"; +; #------------------------------------------------------------ # ATmega324P #------------------------------------------------------------ part - id = "m324p"; - desc = "ATmega324P"; - has_jtag = yes; - stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one - avr910_devcode = 0x74; - signature = 0x1e 0x95 0x08; - pagel = 0xd7; - bs2 = 0xa0; - chip_erase_delay = 55000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "ATmega324P"; + id = "m324p"; + stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one + avr910_devcode = 0x74; + chip_erase_delay = 55000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x95 0x08; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; spmcr = 0x57; - allowfullpagebitstream = no; - ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ size = 1024; + page_size = 4; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 128; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 32768; + size = 0x8000; page_size = 128; num_pages = 256; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 6; - blocksize = 256; - readsize = 256; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - min_write_delay = 9000; - max_write_delay = 9000; - ; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--0aaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x 1 1 1 1 1 i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.1iii"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; memory "calibration" size = 1; - - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - ; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega164P #------------------------------------------------------------ part parent "m324p" - id = "m164p"; - desc = "ATmega164P"; - signature = 0x1e 0x94 0x0a; + desc = "ATmega164P"; + id = "m164p"; + signature = 0x1e 0x94 0x0a; memory "eeprom" - paged = no; /* leave this "no" */ size = 512; - page_size = 4; - min_write_delay = 9000; - max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 128; - readsize = 256; - ; + ; memory "flash" - paged = yes; - size = 16384; - page_size = 128; + size = 0x4000; num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 6; - blocksize = 256; - readsize = 256; - ; - - ; + ; +; #------------------------------------------------------------ # ATmega164PA #------------------------------------------------------------ part parent "m164p" - id = "m164pa"; - desc = "ATmega164PA"; - ; + desc = "ATmega164PA"; + id = "m164pa"; +; #------------------------------------------------------------ # ATmega164A #------------------------------------------------------------ part parent "m164p" - id = "m164a"; - desc = "ATmega164A"; - signature = 0x1e 0x94 0x0f; - ; + desc = "ATmega164A"; + id = "m164a"; + signature = 0x1e 0x94 0x0f; +; #------------------------------------------------------------ # ATmega324PB #------------------------------------------------------------ part parent "m324p" - id = "m324pb"; - desc = "ATmega324PB"; - signature = 0x1e 0x95 0x17; - ; + desc = "ATmega324PB"; + id = "m324pb"; + signature = 0x1e 0x95 0x17; +; #------------------------------------------------------------ # ATmega324PA #------------------------------------------------------------ part parent "m324p" - id = "m324pa"; - desc = "ATmega324PA"; - signature = 0x1e 0x95 0x11; - ; + desc = "ATmega324PA"; + id = "m324pa"; + signature = 0x1e 0x95 0x11; +; #------------------------------------------------------------ # ATmega324A #------------------------------------------------------------ part parent "m324p" - id = "m324a"; - desc = "ATmega324A"; - signature = 0x1e 0x95 0x15; - ; + desc = "ATmega324A"; + id = "m324a"; + signature = 0x1e 0x95 0x15; +; #------------------------------------------------------------ # ATmega644 #------------------------------------------------------------ part - id = "m644"; - desc = "ATmega644"; - has_jtag = yes; - stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one - avr910_devcode = 0x74; - signature = 0x1e 0x96 0x09; - pagel = 0xd7; - bs2 = 0xa0; - chip_erase_delay = 55000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "ATmega644"; + id = "m644"; + stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one + avr910_devcode = 0x74; + chip_erase_delay = 55000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x96 0x09; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 6; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; spmcr = 0x57; - allowfullpagebitstream = no; - ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ size = 2048; + page_size = 8; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 128; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 65536; + size = 0x10000; page_size = 256; num_pages = 256; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 6; - blocksize = 256; - readsize = 256; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - min_write_delay = 9000; - max_write_delay = 9000; - ; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x 1 1 1 1 1 i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.1iii"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; memory "calibration" size = 1; - - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - ; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega644A #------------------------------------------------------------ part parent "m644" - id = "m644a"; - desc = "ATmega644A"; - ; + desc = "ATmega644A"; + id = "m644a"; +; #------------------------------------------------------------ # ATmega644P #------------------------------------------------------------ part parent "m644" - id = "m644p"; - desc = "ATmega644P"; - signature = 0x1e 0x96 0x0a; - ; + desc = "ATmega644P"; + id = "m644p"; + signature = 0x1e 0x96 0x0a; +; #------------------------------------------------------------ # ATmega644PA #------------------------------------------------------------ part parent "m644" - id = "m644pa"; - desc = "ATmega644PA"; - signature = 0x1e 0x96 0x0a; - ; + desc = "ATmega644PA"; + id = "m644pa"; + signature = 0x1e 0x96 0x0a; +; #------------------------------------------------------------ # ATmega1284 #------------------------------------------------------------ part - id = "m1284"; - desc = "ATmega1284"; - has_jtag = yes; - stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one - avr910_devcode = 0x74; - signature = 0x1e 0x97 0x06; - pagel = 0xd7; - bs2 = 0xa0; - chip_erase_delay = 55000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + desc = "ATmega1284"; + id = "m1284"; + stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one + avr910_devcode = 0x74; + chip_erase_delay = 55000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x97 0x06; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 6; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; spmcr = 0x57; - allowfullpagebitstream = no; - ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ size = 4096; + page_size = 8; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 128; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 131072; + size = 0x20000; page_size = 256; num_pages = 512; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 256; - readsize = 256; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - min_write_delay = 9000; - max_write_delay = 9000; - ; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x 1 1 1 1 1 i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.1iii"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; memory "calibration" size = 1; - - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - ; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega1284P #------------------------------------------------------------ part parent "m1284" - id = "m1284p"; - desc = "ATmega1284P"; - signature = 0x1e 0x97 0x05; - ; + desc = "ATmega1284P"; + id = "m1284p"; + signature = 0x1e 0x97 0x05; +; #------------------------------------------------------------ # ATmega162 #------------------------------------------------------------ part - id = "m162"; - desc = "ATmega162"; - has_jtag = yes; - stk500_devcode = 0x83; - avr910_devcode = 0x63; - signature = 0x1e 0x94 0x04; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - - idr = 0x04; - spmcr = 0x57; + desc = "ATmega162"; + id = "m162"; + stk500_devcode = 0x83; + avr910_devcode = 0x63; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x94 0x04; + has_jtag = yes; allowfullpagebitstream = yes; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - ocdrev = 2; - - memory "flash" - paged = yes; - size = 16384; - page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - mode = 0x41; - delay = 10; - blocksize = 128; - readsize = 256; - - ; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 6; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; - hvleavestabdelay = 15; - chiperasepulsewidth = 0; - chiperasepolltimeout = 10; - programfusepulsewidth = 0; - programfusepolltimeout = 5; - programlockpulsewidth = 0; - programlockpolltimeout = 5; - - memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ - size = 512; - min_write_delay = 9000; - max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - - read = " 1 0 1 0 0 0 0 0", - " 0 0 x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; - - memory "lfuse" - size = 1; - min_write_delay = 16000; - max_write_delay = 16000; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; - - memory "hfuse" - size = 1; - min_write_delay = 16000; - max_write_delay = 16000; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; - - memory "efuse" - size = 1; - min_write_delay = 16000; - max_write_delay = 16000; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x 1 1 1 1 1 i i i"; - ; - - memory "lock" - size = 1; - min_write_delay = 16000; - max_write_delay = 16000; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "signature" - size = 3; - - read = "0 0 1 1 0 0 0 0 0 0 x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - - memory "calibration" - size = 1; - - read = "0 0 1 1 1 0 0 0 0 0 x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; -; - - - -#------------------------------------------------------------ -# ATmega163 -#------------------------------------------------------------ - -part - id = "m163"; - desc = "ATmega163"; - stk500_devcode = 0x81; - avr910_devcode = 0x64; - signature = 0x1e 0x94 0x02; - chip_erase_delay = 32000; - pagel = 0xd7; - bs2 = 0xa0; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - timeout = 200; stabdelay = 100; cmdexedelay = 25; synchloops = 32; - bytedelay = 0; pollindex = 3; pollvalue = 0x53; predelay = 1; postdelay = 1; - pollmethod = 0; - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 0; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; - hvleavestabdelay = 15; - chiperasepulsewidth = 0; - chiperasepolltimeout = 30; - programfusepulsewidth = 0; - programfusepolltimeout = 2; - programlockpulsewidth = 0; - programlockpolltimeout = 2; - - - memory "eeprom" - size = 512; - min_write_delay = 4000; - max_write_delay = 4000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; - - memory "flash" - paged = yes; - size = 16384; - page_size = 128; - num_pages = 128; - min_write_delay = 16000; - max_write_delay = 16000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x11; - delay = 20; - blocksize = 128; - readsize = 256; - ; - - memory "lfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o x x o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i 1 1 i i i i"; - ; - - memory "hfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x x x x x 1 o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x 1 1 1 1 1 i i i"; - ; - - memory "lock" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x 0 x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATmega169 -#------------------------------------------------------------ - -part - id = "m169"; - desc = "ATmega169"; - has_jtag = yes; - stk500_devcode = 0x85; - avr910_devcode = 0x78; - signature = 0x1e 0x94 0x05; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - resetdelayus = 0; - hvleavestabdelay = 15; - chiperasepulsewidth = 0; - chiperasepolltimeout = 10; - programfusepulsewidth = 0; - programfusepolltimeout = 5; - programlockpulsewidth = 0; - programlockpolltimeout = 5; - - idr = 0x31; - spmcr = 0x57; - - ocdrev = 2; - - memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ - size = 512; - min_write_delay = 9000; - max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; - - memory "flash" - paged = yes; - size = 16384; - page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - ; - - memory "lfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; - - memory "hfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; - - memory "efuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - ; - - memory "lock" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATmega169A -#------------------------------------------------------------ - -part parent "m169" - id = "m169a"; - desc = "ATmega169A"; - signature = 0x1E 0x94 0x11; - ; - -#------------------------------------------------------------ -# ATmega169P -#------------------------------------------------------------ - -part parent "m169" - id = "m169p"; - desc = "ATmega169P"; - signature = 0x1E 0x94 0x05; - ; - -#------------------------------------------------------------ -# ATmega169PA -#------------------------------------------------------------ - -part parent "m169" - id = "m169pa"; - desc = "ATmega169PA"; - signature = 0x1E 0x94 0x05; - ; - -#------------------------------------------------------------ -# ATmega329 -#------------------------------------------------------------ - -part - id = "m329"; - desc = "ATmega329"; - has_jtag = yes; -# stk500_devcode = 0x85; # no STK500 support, only STK500v2 -# avr910_devcode = 0x?; # try the ATmega169 one: - avr910_devcode = 0x75; - signature = 0x1e 0x95 0x03; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - resetdelayus = 0; - hvleavestabdelay = 15; - chiperasepulsewidth = 0; - chiperasepolltimeout = 10; - programfusepulsewidth = 0; - programfusepolltimeout = 5; - programlockpulsewidth = 0; - programlockpolltimeout = 5; - - idr = 0x31; - spmcr = 0x57; - - ocdrev = 3; - - memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ - size = 1024; - min_write_delay = 9000; - max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 8; - readsize = 256; - ; - - memory "flash" - paged = yes; - size = 32768; - page_size = 128; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " x a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " x a14 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 256; - readsize = 256; - ; - - memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; - - memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; - - memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x i i i"; - ; - - memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATmega329A -#------------------------------------------------------------ - -part parent "m329" - id = "m329a"; - desc = "ATmega329A"; - ; - -#------------------------------------------------------------ -# ATmega329P -#------------------------------------------------------------ - -part parent "m329" - id = "m329p"; - desc = "ATmega329P"; - signature = 0x1e 0x95 0x0b; - ; - -#------------------------------------------------------------ -# ATmega329PA -#------------------------------------------------------------ - -part parent "m329" - id = "m329pa"; - desc = "ATmega329PA"; - signature = 0x1e 0x95 0x0b; - ; - -#------------------------------------------------------------ -# ATmega3290 -#------------------------------------------------------------ - -part parent "m329" - id = "m3290"; - desc = "ATmega3290"; - signature = 0x1e 0x95 0x04; - ; - -#------------------------------------------------------------ -# ATmega3290A -#------------------------------------------------------------ - -part parent "m329" - id = "m3290a"; - desc = "ATmega3290A"; - signature = 0x1e 0x95 0x04; - ; - -#------------------------------------------------------------ -# ATmega3290P -#------------------------------------------------------------ - -part parent "m329" - id = "m3290p"; - desc = "ATmega3290P"; - signature = 0x1e 0x95 0x0c; - ; - -#------------------------------------------------------------ -# ATmega3290PA -#------------------------------------------------------------ - -part parent "m329" - id = "m3290pa"; - desc = "ATmega3290PA"; - signature = 0x1e 0x95 0x0c; - ; - -#------------------------------------------------------------ -# ATmega649 -#------------------------------------------------------------ - -part - id = "m649"; - desc = "ATmega649"; - has_jtag = yes; -# stk500_devcode = 0x85; # no STK500 support, only STK500v2 -# avr910_devcode = 0x?; # try the ATmega169 one: - avr910_devcode = 0x75; - signature = 0x1e 0x96 0x03; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - resetdelayus = 0; - hvleavestabdelay = 15; - chiperasepulsewidth = 0; - chiperasepolltimeout = 10; - programfusepulsewidth = 0; - programfusepolltimeout = 5; - programlockpulsewidth = 0; - programlockpolltimeout = 5; - - idr = 0x31; - spmcr = 0x57; - - ocdrev = 3; - - memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ - size = 2048; - min_write_delay = 9000; - max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 8; - readsize = 256; - ; - - memory "flash" - paged = yes; - size = 65536; - page_size = 256; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 256; - readsize = 256; - ; - - memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; - - memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; - - memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x i i i"; - ; - - memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATmega649A -#------------------------------------------------------------ - -part parent "m649" - id = "m649a"; - desc = "ATmega649A"; - ; - -#------------------------------------------------------------ -# ATmega649P -#------------------------------------------------------------ - -part parent "m649" - id = "m649p"; - desc = "ATmega649P"; - signature = 0x1e 0x96 0x0b; - ; - -#------------------------------------------------------------ -# ATmega6490 -#------------------------------------------------------------ - -part parent "m649" - id = "m6490"; - desc = "ATmega6490"; - signature = 0x1e 0x96 0x04; - ; - -#------------------------------------------------------------ -# ATmega6490A -#------------------------------------------------------------ - -part parent "m649" - id = "m6490a"; - desc = "ATmega6490A"; - signature = 0x1e 0x96 0x04; - ; - -#------------------------------------------------------------ -# ATmega6490P -#------------------------------------------------------------ - -part parent "m649" - id = "m6490p"; - desc = "ATmega6490P"; - signature = 0x1e 0x96 0x0C; - ; - -#------------------------------------------------------------ -# ATmega32 -#------------------------------------------------------------ - -part - id = "m32"; - desc = "ATmega32"; - has_jtag = yes; - stk500_devcode = 0x91; - avr910_devcode = 0x72; - signature = 0x1e 0x95 0x02; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 6; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - - idr = 0x31; + idr = 0x04; spmcr = 0x57; - allowfullpagebitstream = yes; - ocdrev = 2; - - memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ - size = 1024; - min_write_delay = 9000; - max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x04; - delay = 10; - blocksize = 64; - readsize = 256; - ; - - memory "flash" - paged = yes; - size = 32768; - page_size = 128; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 6; - blocksize = 64; - readsize = 256; - ; - - memory "lfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; - - memory "hfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; - - memory "lock" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - - memory "calibration" - size = 4; - read = "0 0 1 1 1 0 0 0 0 0 x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATmega161 -#------------------------------------------------------------ - -part - id = "m161"; - desc = "ATmega161"; - stk500_devcode = 0x80; - avr910_devcode = 0x60; - signature = 0x1e 0x94 0x01; - chip_erase_delay = 28000; - pagel = 0xd7; - bs2 = 0xa0; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 0; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; - hvleavestabdelay = 15; - chiperasepulsewidth = 0; - chiperasepolltimeout = 30; - programfusepulsewidth = 0; - programfusepolltimeout = 2; - programlockpulsewidth = 0; - programlockpolltimeout = 2; - - memory "eeprom" - size = 512; - min_write_delay = 3400; - max_write_delay = 3400; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 5; - blocksize = 128; - readsize = 256; - ; - - memory "flash" - paged = yes; - size = 16384; - page_size = 128; - num_pages = 128; - min_write_delay = 14000; - max_write_delay = 14000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 16; - blocksize = 128; - readsize = 256; - ; - - memory "fuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0 1 0 1 0 0 0 0 x x x x x x x x", - "x x x x x x x x x o x o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 x x x x x", - "x x x x x x x x 1 i 1 i i i i i"; - ; - - memory "lock" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATmega32A -#------------------------------------------------------------ - -part parent "m32" - id = "m32a"; - desc = "ATmega32A"; - ; - -#------------------------------------------------------------ -# ATmega8 -#------------------------------------------------------------ - -part - id = "m8"; - desc = "ATmega8"; - stk500_devcode = 0x70; - avr910_devcode = 0x76; - signature = 0x1e 0x93 0x07; - pagel = 0xd7; - bs2 = 0xc2; - chip_erase_delay = 10000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 2; - resetdelayus = 0; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepulsewidth = 0; - chiperasepolltimeout = 10; - programfusepulsewidth = 0; - programfusepolltimeout = 5; - programlockpulsewidth = 0; - programlockpolltimeout = 5; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 512; page_size = 4; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--00xx.xxaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; + ; - write = " 1 1 0 0 0 0 0 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; + memory "flash" + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 16000; + max_write_delay = 16000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 16000; + max_write_delay = 16000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 16000; + max_write_delay = 16000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.1iii"; + ; + + memory "lock" + size = 1; + min_write_delay = 16000; + max_write_delay = 16000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--00xx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--00xx.xxxx--0000.0000--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATmega163 +#------------------------------------------------------------ + +part + desc = "ATmega163"; + id = "m163"; + stk500_devcode = 0x81; + avr910_devcode = 0x64; + chip_erase_delay = 32000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x94 0x02; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + hventerstabdelay = 100; + hvleavestabdelay = 15; + chiperasepolltimeout = 30; + programfusepolltimeout = 2; + programlockpolltimeout = 2; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 512; + min_write_delay = 4000; + max_write_delay = 4000; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + ; + + memory "flash" + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 16000; + max_write_delay = 16000; + readback = 0xff 0xff; + mode = 17; + delay = 20; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.0000--0000.0000--xxxx.xxxx--ooxx.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--ii11.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.1000--xxxx.xxxx--xxxx.1ooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--1111.1iii"; + ; + + memory "lock" + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.0000--xxxx.0xxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATmega169 +#------------------------------------------------------------ + +part + desc = "ATmega169"; + id = "m169"; + stk500_devcode = 0x85; + avr910_devcode = 0x78; + chip_erase_delay = 9000; + signature = 0x1e 0x94 0x05; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; + programfusepolltimeout = 5; + programlockpolltimeout = 5; + idr = 0x31; + spmcr = 0x57; + ocdrev = 2; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 512; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + ; + + memory "flash" + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + ; + + memory "lock" + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATmega169A +#------------------------------------------------------------ + +part parent "m169" + desc = "ATmega169A"; + id = "m169a"; + signature = 0x1e 0x94 0x11; +; + +#------------------------------------------------------------ +# ATmega169P +#------------------------------------------------------------ + +part parent "m169" + desc = "ATmega169P"; + id = "m169p"; +; + +#------------------------------------------------------------ +# ATmega169PA +#------------------------------------------------------------ + +part parent "m169" + desc = "ATmega169PA"; + id = "m169pa"; +; + +#------------------------------------------------------------ +# ATmega329 +#------------------------------------------------------------ + +part + desc = "ATmega329"; + id = "m329"; +# stk500_devcode = 0x85; # no STK500 support, only STK500v2 +# avr910_devcode = 0x?; # try the ATmega169 one: + avr910_devcode = 0x75; + chip_erase_delay = 9000; + signature = 0x1e 0x95 0x03; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; + programfusepolltimeout = 5; + programlockpolltimeout = 5; + idr = 0x31; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 1024; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; + ; + + memory "flash" + paged = yes; + size = 0x8000; + page_size = 128; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--xaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--xaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + ; + + memory "lock" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATmega329A +#------------------------------------------------------------ + +part parent "m329" + desc = "ATmega329A"; + id = "m329a"; +; + +#------------------------------------------------------------ +# ATmega329P +#------------------------------------------------------------ + +part parent "m329" + desc = "ATmega329P"; + id = "m329p"; + signature = 0x1e 0x95 0x0b; +; + +#------------------------------------------------------------ +# ATmega329PA +#------------------------------------------------------------ + +part parent "m329" + desc = "ATmega329PA"; + id = "m329pa"; + signature = 0x1e 0x95 0x0b; +; + +#------------------------------------------------------------ +# ATmega3290 +#------------------------------------------------------------ + +part parent "m329" + desc = "ATmega3290"; + id = "m3290"; + signature = 0x1e 0x95 0x04; +; + +#------------------------------------------------------------ +# ATmega3290A +#------------------------------------------------------------ + +part parent "m329" + desc = "ATmega3290A"; + id = "m3290a"; + signature = 0x1e 0x95 0x04; +; + +#------------------------------------------------------------ +# ATmega3290P +#------------------------------------------------------------ + +part parent "m329" + desc = "ATmega3290P"; + id = "m3290p"; + signature = 0x1e 0x95 0x0c; +; + +#------------------------------------------------------------ +# ATmega3290PA +#------------------------------------------------------------ + +part parent "m329" + desc = "ATmega3290PA"; + id = "m3290pa"; + signature = 0x1e 0x95 0x0c; +; + +#------------------------------------------------------------ +# ATmega649 +#------------------------------------------------------------ + +part + desc = "ATmega649"; + id = "m649"; +# stk500_devcode = 0x85; # no STK500 support, only STK500v2 +# avr910_devcode = 0x?; # try the ATmega169 one: + avr910_devcode = 0x75; + chip_erase_delay = 9000; + signature = 0x1e 0x96 0x03; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; + programfusepolltimeout = 5; + programlockpolltimeout = 5; + idr = 0x31; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 2048; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; + ; + + memory "flash" + paged = yes; + size = 0x10000; + page_size = 256; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + ; + + memory "lock" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATmega649A +#------------------------------------------------------------ + +part parent "m649" + desc = "ATmega649A"; + id = "m649a"; +; + +#------------------------------------------------------------ +# ATmega649P +#------------------------------------------------------------ + +part parent "m649" + desc = "ATmega649P"; + id = "m649p"; + signature = 0x1e 0x96 0x0b; +; + +#------------------------------------------------------------ +# ATmega6490 +#------------------------------------------------------------ + +part parent "m649" + desc = "ATmega6490"; + id = "m6490"; + signature = 0x1e 0x96 0x04; +; + +#------------------------------------------------------------ +# ATmega6490A +#------------------------------------------------------------ + +part parent "m649" + desc = "ATmega6490A"; + id = "m6490a"; + signature = 0x1e 0x96 0x04; +; + +#------------------------------------------------------------ +# ATmega6490P +#------------------------------------------------------------ + +part parent "m649" + desc = "ATmega6490P"; + id = "m6490p"; + signature = 0x1e 0x96 0x0c; +; + +#------------------------------------------------------------ +# ATmega32 +#------------------------------------------------------------ + +part + desc = "ATmega32"; + id = "m32"; + stk500_devcode = 0x91; + avr910_devcode = 0x72; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x95 0x02; + has_jtag = yes; + allowfullpagebitstream = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; + programfusepolltimeout = 5; + programlockpolltimeout = 5; + idr = 0x31; + spmcr = 0x57; + ocdrev = 2; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 1024; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 4; + delay = 10; + blocksize = 64; + readsize = 256; + read = "1010.0000--00xx.xxaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; + ; + + memory "flash" + paged = yes; + size = 0x8000; + page_size = 128; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "lock" + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 4; + read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATmega161 +#------------------------------------------------------------ + +part + desc = "ATmega161"; + id = "m161"; + stk500_devcode = 0x80; + avr910_devcode = 0x60; + chip_erase_delay = 28000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x94 0x01; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + hventerstabdelay = 100; + hvleavestabdelay = 15; + chiperasepolltimeout = 30; + programfusepolltimeout = 2; + programlockpolltimeout = 2; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 512; + min_write_delay = 3400; + max_write_delay = 3400; + readback = 0xff 0xff; + mode = 4; + delay = 5; + blocksize = 128; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + ; + + memory "flash" + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 14000; + max_write_delay = 14000; + readback = 0xff 0xff; + mode = 33; + delay = 16; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; + + memory "fuse" + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xoxo.oooo"; + write = "1010.1100--101x.xxxx--xxxx.xxxx--1i1i.iiii"; + ; + + memory "lock" + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATmega32A +#------------------------------------------------------------ + +part parent "m32" + desc = "ATmega32A"; + id = "m32a"; +; + +#------------------------------------------------------------ +# ATmega8 +#------------------------------------------------------------ + +part + desc = "ATmega8"; + id = "m8"; + stk500_devcode = 0x70; + avr910_devcode = 0x76; + chip_erase_delay = 10000; + pagel = 0xd7; + bs2 = 0xc2; + signature = 0x1e 0x93 0x07; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 2; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; + programfusepolltimeout = 5; + programlockpolltimeout = 5; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 512; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 4; + delay = 20; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; + ; - mode = 0x04; - delay = 20; - blocksize = 128; - readsize = 256; - ; memory "flash" paged = yes; size = 8192; @@ -6827,165 +5601,108 @@ part num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 0 x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 0 x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 10; - blocksize = 64; - readsize = 256; - ; + readback = 0xff 0x00; + mode = 33; + delay = 10; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--0000.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--0000.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; min_write_delay = 2000; max_write_delay = 2000; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; min_write_delay = 2000; max_write_delay = 2000; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "lock" size = 1; min_write_delay = 2000; max_write_delay = 2000; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "calibration" - size = 4; - read = "0 0 1 1 1 0 0 0 0 0 x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; - + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + memory "calibration" + size = 4; + read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega8A #------------------------------------------------------------ part parent "m8" - id = "m8a"; - desc = "ATmega8A"; - ; + desc = "ATmega8A"; + id = "m8a"; +; #------------------------------------------------------------ # ATmega8515 #------------------------------------------------------------ part - id = "m8515"; - desc = "ATmega8515"; - stk500_devcode = 0x63; - avr910_devcode = 0x3A; - signature = 0x1e 0x93 0x06; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "ATmega8515"; + id = "m8515"; + stk500_devcode = 0x63; + avr910_devcode = 0x3a; + chip_erase_delay = 9000; + signature = 0x1e 0x93 0x06; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 6; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 512; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0xff 0xff; + mode = 4; + delay = 20; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; + ; - write = " 1 1 0 0 0 0 0 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 20; - blocksize = 128; - readsize = 256; - ; memory "flash" paged = yes; size = 8192; @@ -6993,159 +5710,101 @@ part num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 0 x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 0 x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 6; - blocksize = 64; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--0000.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--0000.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "lock" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "calibration" - size = 4; - read = "0 0 1 1 1 0 0 0 0 0 x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; - - + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + memory "calibration" + size = 4; + read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega8535 #------------------------------------------------------------ part - id = "m8535"; - desc = "ATmega8535"; - stk500_devcode = 0x64; - avr910_devcode = 0x69; - signature = 0x1e 0x93 0x08; - pagel = 0xd7; - bs2 = 0xa0; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + desc = "ATmega8535"; + id = "m8535"; + stk500_devcode = 0x64; + avr910_devcode = 0x69; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x93 0x08; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 6; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 512; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0xff 0xff; + mode = 4; + delay = 20; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; + ; - write = " 1 1 0 0 0 0 0 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - mode = 0x04; - delay = 20; - blocksize = 128; - readsize = 256; - ; memory "flash" paged = yes; size = 8192; @@ -7153,152 +5812,102 @@ part num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 0 x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 0 x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 6; - blocksize = 64; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--0000.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--0000.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; min_write_delay = 2000; max_write_delay = 2000; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; min_write_delay = 2000; max_write_delay = 2000; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "lock" size = 1; min_write_delay = 2000; max_write_delay = 2000; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "calibration" - size = 4; - read = "0 0 1 1 1 0 0 0 0 0 x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + memory "calibration" + size = 4; + read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATtiny26 #------------------------------------------------------------ part - id = "t26"; desc = "ATtiny26"; + id = "t26"; stk500_devcode = 0x21; avr910_devcode = 0x5e; - signature = 0x1e 0x91 0x09; + chip_erase_delay = 9000; pagel = 0xb3; bs2 = 0xb2; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + signature = 0x1e 0x91 0x09; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0xC4, 0xE4, 0xC4, 0xE4, 0xCC, 0xEC, 0xCC, 0xEC, - 0xD4, 0xF4, 0xD4, 0xF4, 0xDC, 0xFC, 0xDC, 0xFC, - 0xC8, 0xE8, 0xD8, 0xF8, 0x4C, 0x6C, 0x5C, 0x7C, - 0xEC, 0xBC, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00; + 0xc4, 0xe4, 0xc4, 0xe4, 0xcc, 0xec, 0xcc, 0xec, + 0xd4, 0xf4, 0xd4, 0xf4, 0xdc, 0xfc, 0xdc, 0xfc, + 0xc8, 0xe8, 0xd8, 0xf8, 0x4c, 0x6c, 0x5c, 0x7c, + 0xec, 0xbc, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 2; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" size = 128; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 x x x x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = "1 1 0 0 0 0 0 0 x x x x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - mode = 0x04; - delay = 10; - blocksize = 64; - readsize = 256; + readback = 0xff 0xff; + mode = 4; + delay = 10; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; ; memory "flash" @@ -7308,82 +5917,50 @@ part num_pages = 64; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 6; - blocksize = 16; - readsize = 256; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x x x x x x x o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 1 i i", - "x x x x x x x x x x x x x x x x"; - min_write_delay = 9000; - max_write_delay = 9000; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 16; + readsize = 256; + read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxxx.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxx.xxaa--aaaa.xxxx--xxxx.xxxx"; ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x x x x i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--xxxi.iiii"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxoo"; + write = "1010.1100--1111.11ii--xxxx.xxxx--xxxx.xxxx"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; + ; memory "calibration" size = 4; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; + read = "0011.1000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; ; @@ -7392,89 +5969,61 @@ part #------------------------------------------------------------ part - id = "t261"; desc = "ATtiny261"; - has_debugwire = yes; - flash_instr = 0xB4, 0x00, 0x10; - eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBC, 0x00, 0xB4, 0x00, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; + id = "t261"; + chip_erase_delay = 4000; + pagel = 0xb3; + bs2 = 0xb2; # stk500_devcode = 0x21; # avr910_devcode = 0x5e; signature = 0x1e 0x91 0x0c; - pagel = 0xb3; - bs2 = 0xb2; - chip_erase_delay = 4000; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0xC4, 0xE4, 0xC4, 0xE4, 0xCC, 0xEC, 0xCC, 0xEC, - 0xD4, 0xF4, 0xD4, 0xF4, 0xDC, 0xFC, 0xDC, 0xFC, - 0xC8, 0xE8, 0xD8, 0xF8, 0x4C, 0x6C, 0x5C, 0x7C, - 0xEC, 0xBC, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00; + 0xc4, 0xe4, 0xc4, 0xe4, 0xcc, 0xec, 0xcc, 0xec, + 0xd4, 0xf4, 0xd4, 0xf4, 0xdc, 0xfc, 0xdc, 0xfc, + 0xc8, 0xe8, 0xd8, 0xf8, 0x4c, 0x6c, 0x5c, 0x7c, + 0xec, 0xbc, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb4, 0x00, 0x10; + eeprom_instr = + 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xbc, 0x00, 0xb4, 0x00, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 2; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; size = 128; page_size = 4; num_pages = 32; min_write_delay = 4000; max_write_delay = 4000; - readback_p1 = 0xff; - readback_p2 = 0xff; - - read = "1 0 1 0 0 0 0 0 x x x x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = "1 1 0 0 0 0 0 0 x x x x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " x a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 4; - readsize = 256; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; ; memory "flash" @@ -7484,94 +6033,58 @@ part num_pages = 64; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " x x x x x x a9 a8", - " a7 a6 a5 a4 x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 32; - readsize = 256; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x x x x x x x o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 1 i i", - "x x x x x x x x x x x x x x x x"; - min_write_delay = 4500; - max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxxx.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxx.xxaa--aaaa.xxxx--xxxx.xxxx"; ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 4500; max_write_delay = 4500; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 4500; max_write_delay = 4500; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 4500; max_write_delay = 4500; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; + + memory "lock" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxoo"; + write = "1010.1100--1111.11ii--xxxx.xxxx--xxxx.xxxx"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; + ; memory "calibration" size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -7580,98 +6093,70 @@ part #------------------------------------------------------------ part parent "t261" - id = "t261a"; - desc = "ATtiny261A"; - ; + desc = "ATtiny261A"; + id = "t261a"; +; #------------------------------------------------------------ # ATtiny461 #------------------------------------------------------------ part - id = "t461"; desc = "ATtiny461"; - has_debugwire = yes; - flash_instr = 0xB4, 0x00, 0x10; - eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBC, 0x00, 0xB4, 0x00, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; + id = "t461"; + chip_erase_delay = 4000; + pagel = 0xb3; + bs2 = 0xb2; # stk500_devcode = 0x21; # avr910_devcode = 0x5e; signature = 0x1e 0x92 0x08; - pagel = 0xb3; - bs2 = 0xb2; - chip_erase_delay = 4000; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0xC4, 0xE4, 0xC4, 0xE4, 0xCC, 0xEC, 0xCC, 0xEC, - 0xD4, 0xF4, 0xD4, 0xF4, 0xDC, 0xFC, 0xDC, 0xFC, - 0xC8, 0xE8, 0xD8, 0xF8, 0x4C, 0x6C, 0x5C, 0x7C, - 0xEC, 0xBC, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00; + 0xc4, 0xe4, 0xc4, 0xe4, 0xcc, 0xec, 0xcc, 0xec, + 0xd4, 0xf4, 0xd4, 0xf4, 0xdc, 0xfc, 0xdc, 0xfc, + 0xc8, 0xe8, 0xd8, 0xf8, 0x4c, 0x6c, 0x5c, 0x7c, + 0xec, 0xbc, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb4, 0x00, 0x10; + eeprom_instr = + 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xbc, 0x00, 0xb4, 0x00, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 2; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; size = 256; page_size = 4; num_pages = 64; min_write_delay = 4000; max_write_delay = 4000; - readback_p1 = 0xff; - readback_p2 = 0xff; - - read = " 1 0 1 0 0 0 0 0 x x x x x x x x", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0 x x x x x x x x", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 4; - readsize = 256; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; ; memory "flash" @@ -7681,94 +6166,58 @@ part num_pages = 64; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 64; - readsize = 256; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x x x x x x x o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 1 i i", - "x x x x x x x x x x x x x x x x"; - min_write_delay = 4500; - max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxx.xaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 4500; max_write_delay = 4500; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 4500; max_write_delay = 4500; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 4500; max_write_delay = 4500; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; + + memory "lock" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxoo"; + write = "1010.1100--1111.11ii--xxxx.xxxx--xxxx.xxxx"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; + ; memory "calibration" size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -7777,98 +6226,70 @@ part #------------------------------------------------------------ part parent "t461" - id = "t461a"; - desc = "ATtiny461A"; - ; + desc = "ATtiny461A"; + id = "t461a"; +; #------------------------------------------------------------ # ATtiny861 #------------------------------------------------------------ part - id = "t861"; desc = "ATtiny861"; - has_debugwire = yes; - flash_instr = 0xB4, 0x00, 0x10; - eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBC, 0x00, 0xB4, 0x00, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; + id = "t861"; + chip_erase_delay = 4000; + pagel = 0xb3; + bs2 = 0xb2; # stk500_devcode = 0x21; # avr910_devcode = 0x5e; signature = 0x1e 0x93 0x0d; - pagel = 0xb3; - bs2 = 0xb2; - chip_erase_delay = 4000; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0xC4, 0xE4, 0xC4, 0xE4, 0xCC, 0xEC, 0xCC, 0xEC, - 0xD4, 0xF4, 0xD4, 0xF4, 0xDC, 0xFC, 0xDC, 0xFC, - 0xC8, 0xE8, 0xD8, 0xF8, 0x4C, 0x6C, 0x5C, 0x7C, - 0xEC, 0xBC, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00; + 0xc4, 0xe4, 0xc4, 0xe4, 0xcc, 0xec, 0xcc, 0xec, + 0xd4, 0xf4, 0xd4, 0xf4, 0xdc, 0xfc, 0xdc, 0xfc, + 0xc8, 0xe8, 0xd8, 0xf8, 0x4c, 0x6c, 0x5c, 0x7c, + 0xec, 0xbc, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb4, 0x00, 0x10; + eeprom_instr = + 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xbc, 0x00, 0xb4, 0x00, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 2; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; size = 512; - num_pages = 128; page_size = 4; + num_pages = 128; min_write_delay = 4000; max_write_delay = 4000; - readback_p1 = 0xff; - readback_p2 = 0xff; - - read = " 1 0 1 0 0 0 0 0 x x x x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0 x x x x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 4; - readsize = 256; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" @@ -7878,94 +6299,58 @@ part num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - - read_lo = " 0 0 1 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 64; - readsize = 256; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 x x x x x x x x", - "x x x x x x x x x x x x x x o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 1 1 1 i i", - "x x x x x x x x x x x x x x x x"; - min_write_delay = 4500; - max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxx.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 4500; max_write_delay = 4500; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 4500; max_write_delay = 4500; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 4500; max_write_delay = 4500; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; + + memory "lock" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxoo"; + write = "1010.1100--1111.11ii--xxxx.xxxx--xxxx.xxxx"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; + ; memory "calibration" size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -7974,9 +6359,9 @@ part #------------------------------------------------------------ part parent "t861" - id = "t861a"; - desc = "ATtiny861A"; - ; + desc = "ATtiny861A"; + id = "t861a"; +; #------------------------------------------------------------ # ATtiny28 @@ -7985,151 +6370,111 @@ part parent "t861" # This is an HVPP-only device. part - id = "t28"; desc = "ATtiny28"; + id = "t28"; stk500_devcode = 0x22; avr910_devcode = 0x5c; signature = 0x1e 0x91 0x07; - serial = no; - + serial = no; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 0; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; hvleavestabdelay = 15; resetdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; memory "flash" size = 2048; page_size = 2; - readsize = 256; delay = 5; + readsize = 256; ; - memory "signature" - size = 3; + memory "fuse" + size = 1; ; memory "lock" size = 1; ; + memory "signature" + size = 3; + ; + memory "calibration" size = 1; ; - - memory "fuse" - size = 1; - ; ; - - #------------------------------------------------------------ # ATmega48 #------------------------------------------------------------ part - id = "m48"; - desc = "ATmega48"; - has_debugwire = yes; - flash_instr = 0xB6, 0x01, 0x11; - eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, - 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF, - 0x99, 0xF9, 0xBB, 0xAF; - stk500_devcode = 0x59; + desc = "ATmega48"; + id = "m48"; + stk500_devcode = 0x59; + chip_erase_delay = 45000; + pagel = 0xd7; + bs2 = 0xc2; # avr910_devcode = 0x; - signature = 0x1e 0x92 0x05; - pagel = 0xd7; - bs2 = 0xc2; - chip_erase_delay = 45000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + signature = 0x1e 0x92 0x05; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = + 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, + 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, + 0x99, 0xf9, 0xbb, 0xaf; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; resetdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; - page_size = 4; size = 256; + page_size = 4; min_write_delay = 3600; max_write_delay = 3600; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 x x x x x", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; + ; - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; memory "flash" paged = yes; size = 4096; @@ -8137,227 +6482,163 @@ part num_pages = 64; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 64; - readsize = 256; - ; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; memory "lock" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega48A #------------------------------------------------------------ part parent "m48" - id = "m48a"; - desc = "ATmega48A"; - ; + desc = "ATmega48A"; + id = "m48a"; +; #------------------------------------------------------------ # ATmega48P #------------------------------------------------------------ part parent "m48" - id = "m48p"; - desc = "ATmega48P"; - signature = 0x1e 0x92 0x0a; - ; + desc = "ATmega48P"; + id = "m48p"; + signature = 0x1e 0x92 0x0a; +; #------------------------------------------------------------ # ATmega48PA #------------------------------------------------------------ part parent "m48" - id = "m48pa"; - desc = "ATmega48PA"; - signature = 0x1e 0x92 0x0a; - ; + desc = "ATmega48PA"; + id = "m48pa"; + signature = 0x1e 0x92 0x0a; +; #------------------------------------------------------------ # ATmega48PB #------------------------------------------------------------ part parent "m48" - id = "m48pb"; - desc = "ATmega48PB"; - signature = 0x1e 0x92 0x10; - chip_erase_delay = 10500; - ; + desc = "ATmega48PB"; + id = "m48pb"; + chip_erase_delay = 10500; + signature = 0x1e 0x92 0x10; +; #------------------------------------------------------------ # ATmega88 #------------------------------------------------------------ part - id = "m88"; - desc = "ATmega88"; - has_debugwire = yes; - flash_instr = 0xB6, 0x01, 0x11; - eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, - 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF, - 0x99, 0xF9, 0xBB, 0xAF; - stk500_devcode = 0x73; + desc = "ATmega88"; + id = "m88"; + stk500_devcode = 0x73; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc2; # avr910_devcode = 0x; - signature = 0x1e 0x93 0x0a; - pagel = 0xd7; - bs2 = 0xc2; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + signature = 0x1e 0x93 0x0a; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = + 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, + 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, + 0x99, 0xf9, 0xbb, 0xaf; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; resetdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; - page_size = 4; size = 512; + page_size = 4; min_write_delay = 3600; max_write_delay = 3600; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + ; - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; memory "flash" paged = yes; size = 8192; @@ -8365,324 +6646,224 @@ part num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 64; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x i i i"; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + ; memory "lock" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega88A #------------------------------------------------------------ part parent "m88" - id = "m88a"; - desc = "ATmega88A"; - ; + desc = "ATmega88A"; + id = "m88a"; +; #------------------------------------------------------------ # ATmega88P #------------------------------------------------------------ part parent "m88" - id = "m88p"; - desc = "ATmega88P"; - signature = 0x1e 0x93 0x0f; - ; + desc = "ATmega88P"; + id = "m88p"; + signature = 0x1e 0x93 0x0f; +; #------------------------------------------------------------ # ATmega88PA #------------------------------------------------------------ part parent "m88" - id = "m88pa"; - desc = "ATmega88PA"; - signature = 0x1e 0x93 0x0f; - ; + desc = "ATmega88PA"; + id = "m88pa"; + signature = 0x1e 0x93 0x0f; +; #------------------------------------------------------------ # ATmega88PB #------------------------------------------------------------ part parent "m88" - id = "m88pb"; - desc = "ATmega88PB"; - signature = 0x1e 0x93 0x16; - chip_erase_delay = 10500; - ; + desc = "ATmega88PB"; + id = "m88pb"; + chip_erase_delay = 10500; + signature = 0x1e 0x93 0x16; +; #------------------------------------------------------------ # ATmega168 #------------------------------------------------------------ part - id = "m168"; - desc = "ATmega168"; - has_debugwire = yes; - flash_instr = 0xB6, 0x01, 0x11; - eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, - 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF, - 0x99, 0xF9, 0xBB, 0xAF; - stk500_devcode = 0x86; + desc = "ATmega168"; + id = "m168"; + stk500_devcode = 0x86; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc2; # avr910_devcode = 0x; - signature = 0x1e 0x94 0x06; - pagel = 0xd7; - bs2 = 0xc2; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + signature = 0x1e 0x94 0x06; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = + 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, + 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, + 0x99, 0xf9, 0xbb, 0xaf; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; resetdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; - page_size = 4; size = 512; + page_size = 4; min_write_delay = 3600; max_write_delay = 3600; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 16384; + size = 0x4000; page_size = 128; num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--000a.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--000a.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--000a.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - - ; - memory "lfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; - + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + memory "hfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; - + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + memory "efuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x i i i"; - ; - + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + ; + memory "lock" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; ; #------------------------------------------------------------ @@ -8690,130 +6871,102 @@ part #------------------------------------------------------------ part parent "m168" - id = "m168a"; - desc = "ATmega168A"; - ; + desc = "ATmega168A"; + id = "m168a"; +; #------------------------------------------------------------ # ATmega168P #------------------------------------------------------------ part parent "m168" - id = "m168p"; - desc = "ATmega168P"; - signature = 0x1e 0x94 0x0b; - ; + desc = "ATmega168P"; + id = "m168p"; + signature = 0x1e 0x94 0x0b; +; #------------------------------------------------------------ # ATmega168PA #------------------------------------------------------------ part parent "m168" - id = "m168pa"; - desc = "ATmega168PA"; - signature = 0x1e 0x94 0x0b; - ; + desc = "ATmega168PA"; + id = "m168pa"; + signature = 0x1e 0x94 0x0b; +; #------------------------------------------------------------ # ATmega168PB #------------------------------------------------------------ part parent "m168" - id = "m168pb"; - desc = "ATmega168PB"; - signature = 0x1e 0x94 0x15; - chip_erase_delay = 10500; - ; + desc = "ATmega168PB"; + id = "m168pb"; + chip_erase_delay = 10500; + signature = 0x1e 0x94 0x15; +; #------------------------------------------------------------ # ATtiny828 #------------------------------------------------------------ part - id = "t828"; - desc = "ATtiny828"; - has_debugwire = yes; - flash_instr = 0xB6, 0x01, 0x11; - eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, - 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF, - 0x99, 0xF9, 0xBB, 0xAF; - stk500_devcode = 0x86; + desc = "ATtiny828"; + id = "t828"; + stk500_devcode = 0x86; + chip_erase_delay = 15000; + pagel = 0xd7; + bs2 = 0xc2; # avr910_devcode = 0x; - signature = 0x1e 0x93 0x14; - pagel = 0xd7; - bs2 = 0xc2; - chip_erase_delay = 15000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + signature = 0x1e 0x93 0x14; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = + 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, + 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, + 0x99, 0xf9, 0xbb, 0xaf; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; resetdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; - page_size = 4; size = 256; + page_size = 4; min_write_delay = 3600; max_write_delay = 3600; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - -writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 5; - blocksize = 4; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 5; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; @@ -8822,95 +6975,59 @@ writepage = " 1 1 0 0 0 0 1 0", num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - - ; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x 1 1 1 i i i i i"; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--111i.iiii"; + ; memory "lock" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; ; #------------------------------------------------------------ @@ -8918,474 +7035,322 @@ writepage = " 1 1 0 0 0 0 1 0", #------------------------------------------------------------ part parent "t828" - id = "t828r"; - desc = "ATtiny828R"; - ; + desc = "ATtiny828R"; + id = "t828r"; +; #------------------------------------------------------------ # ATtiny87 #------------------------------------------------------------ part - id = "t87"; - desc = "ATtiny87"; - has_debugwire = yes; - flash_instr = 0xB6, 0x01, 0x11; - eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, - 0x00, 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, - 0xBF, 0x99, 0xF9, 0xBB, 0xAF; + desc = "ATtiny87"; + id = "t87"; ## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; + stk500_devcode = 0x14; ## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - signature = 0x1e 0x93 0x87; - reset = io; - chip_erase_delay = 15000; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + avr910_devcode = 0x20; + chip_erase_delay = 15000; + signature = 0x1e 0x93 0x87; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E, - 0x4E, 0x5E, 0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E, - 0x06, 0x16, 0x46, 0x56, 0x0A, 0x1A, 0x4A, 0x5A, - 0x1E, 0x7C, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0e, 0x1e, 0x2e, 0x3e, 0x2e, 0x3e, + 0x4e, 0x5e, 0x4e, 0x5e, 0x6e, 0x7e, 0x6e, 0x7e, + 0x06, 0x16, 0x46, 0x56, 0x0a, 0x1a, 0x4a, 0x5a, + 0x1e, 0x7c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = + 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, + 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, + 0x99, 0xf9, 0xbb, 0xaf; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 20; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - - idr = 0x00; spmcr = 0x57; - allowfullpagebitstream = no; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; - memory "eeprom" - size = 512; - paged = no; + memory "eeprom" + size = 512; page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 x x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 4; + readsize = 256; + read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + ; - write = "1 1 0 0 0 0 0 0 0 0 x x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; + memory "flash" + paged = yes; + size = 8192; + page_size = 128; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--000a.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--000a.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + ; - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; - mode = 0x41; - delay = 10; - blocksize = 4; - readsize = 256; - ; - memory "flash" - paged = yes; - size = 8192; - page_size = 128; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 64; - readsize = 256; - ; + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; + ; # ATtiny87 has Signature Bytes: 0x1E 0x93 0x87. - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; - memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x x x x x x x i i"; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 a0 o o o o o o o o"; - ; - ; + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATtiny167 #------------------------------------------------------------ part - id = "t167"; - desc = "ATtiny167"; - has_debugwire = yes; - flash_instr = 0xB6, 0x01, 0x11; - eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, - 0x00, 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, - 0xBF, 0x99, 0xF9, 0xBB, 0xAF; + desc = "ATtiny167"; + id = "t167"; ## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; + stk500_devcode = 0x14; ## avr910_devcode = ?; ## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - signature = 0x1e 0x94 0x87; - reset = io; - chip_erase_delay = 15000; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 0; - + avr910_devcode = 0x20; + chip_erase_delay = 15000; + signature = 0x1e 0x94 0x87; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; pp_controlstack = - 0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E, - 0x4E, 0x5E, 0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E, - 0x06, 0x16, 0x46, 0x56, 0x0A, 0x1A, 0x4A, 0x5A, - 0x1E, 0x7C, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0e, 0x1e, 0x2e, 0x3e, 0x2e, 0x3e, + 0x4e, 0x5e, 0x4e, 0x5e, 0x6e, 0x7e, 0x6e, 0x7e, + 0x06, 0x16, 0x46, 0x56, 0x0a, 0x1a, 0x4a, 0x5a, + 0x1e, 0x7c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = + 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, + 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, + 0x99, 0xf9, 0xbb, 0xaf; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 20; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - - idr = 0x00; spmcr = 0x57; - allowfullpagebitstream = no; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; - memory "eeprom" - size = 512; - paged = no; + memory "eeprom" + size = 512; page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 x x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 4; + readsize = 256; + read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + ; - write = "1 1 0 0 0 0 0 0 0 0 x x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; + memory "flash" + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--000a.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--000a.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--000a.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; - mode = 0x41; - delay = 10; - blocksize = 4; - readsize = 256; - ; - memory "flash" - paged = yes; - size = 16384; - page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 64; - readsize = 256; - ; + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; + ; # ATtiny167 has Signature Bytes: 0x1E 0x94 0x87. - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; - memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x x x x x x x i i"; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 a0 o o o o o o o o"; - ; - ; + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATtiny48 #------------------------------------------------------------ part - id = "t48"; - desc = "ATtiny48"; - has_debugwire = yes; - flash_instr = 0xB6, 0x01, 0x11; - eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, - 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF, - 0x99, 0xF9, 0xBB, 0xAF; - stk500_devcode = 0x73; + desc = "ATtiny48"; + id = "t48"; + stk500_devcode = 0x73; + chip_erase_delay = 15000; + pagel = 0xd7; + bs2 = 0xc2; # avr910_devcode = 0x; - signature = 0x1e 0x92 0x09; - pagel = 0xd7; - bs2 = 0xc2; - chip_erase_delay = 15000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - + signature = 0x1e 0x92 0x09; + has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; synchloops = 32; - bytedelay = 0; pollindex = 3; pollvalue = 0x53; predelay = 1; postdelay = 1; pollmethod = 1; - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = + 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, + 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, + 0x99, 0xf9, 0xbb, 0xaf; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; resetdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; - page_size = 4; size = 64; + page_size = 4; min_write_delay = 3600; max_write_delay = 3600; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " x a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; + readback = 0xff 0xff; + mode = 65; delay = 20; blocksize = 4; readsize = 64; - ; + read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; + ; + memory "flash" paged = yes; size = 4096; @@ -9393,187 +7358,124 @@ part num_pages = 64; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; + readback = 0xff 0xff; + mode = 65; delay = 6; blocksize = 64; readsize = 256; - ; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x 1 1 1 1 1 1 1 i"; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.111i"; + ; memory "lock" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATtiny88 #------------------------------------------------------------ part - id = "t88"; - desc = "ATtiny88"; - has_debugwire = yes; - flash_instr = 0xB6, 0x01, 0x11; - eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, - 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF, - 0x99, 0xF9, 0xBB, 0xAF; - stk500_devcode = 0x73; + desc = "ATtiny88"; + id = "t88"; + stk500_devcode = 0x73; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc2; # avr910_devcode = 0x; - signature = 0x1e 0x93 0x11; - pagel = 0xd7; - bs2 = 0xc2; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + signature = 0x1e 0x93 0x11; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = + 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, + 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, + 0x99, 0xf9, 0xbb, 0xaf; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; resetdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; - page_size = 4; size = 64; + page_size = 4; min_write_delay = 3600; max_write_delay = 3600; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 64; + read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; + ; - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " x a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 64; - ; memory "flash" paged = yes; size = 8192; @@ -9581,283 +7483,183 @@ part num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 64; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; memory "lock" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega328 #------------------------------------------------------------ part - id = "m328"; - desc = "ATmega328"; - has_debugwire = yes; - flash_instr = 0xB6, 0x01, 0x11; - eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, - 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF, - 0x99, 0xF9, 0xBB, 0xAF; - stk500_devcode = 0x86; + desc = "ATmega328"; + id = "m328"; + stk500_devcode = 0x86; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc2; # avr910_devcode = 0x; - signature = 0x1e 0x95 0x14; - pagel = 0xd7; - bs2 = 0xc2; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - resetdelayus = 0; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepulsewidth = 0; + signature = 0x1e 0x95 0x14; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = + 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, + 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, + 0x99, 0xf9, 0xbb, 0xaf; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + resetdelay = 15; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; - page_size = 4; - size = 1024; - min_write_delay = 3600; - max_write_delay = 3600; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 x x x a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; + size = 1024; + page_size = 4; + min_write_delay = 3600; + max_write_delay = 3600; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 32768; - page_size = 128; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - + paged = yes; + size = 0x8000; + page_size = 128; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x i i i"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -9866,9 +7668,9 @@ part #------------------------------------------------------------ part parent "m328" - id = "m328p"; - desc = "ATmega328P"; - signature = 0x1e 0x95 0x0f; + desc = "ATmega328P"; + id = "m328p"; + signature = 0x1e 0x95 0x0f; ; #------------------------------------------------------------ @@ -9876,20 +7678,13 @@ part parent "m328" #------------------------------------------------------------ part parent "m328" - id = "m328pb"; - desc = "ATmega328PB"; - signature = 0x1e 0x95 0x16; - chip_erase_delay = 10500; + desc = "ATmega328PB"; + id = "m328pb"; + chip_erase_delay = 10500; + signature = 0x1e 0x95 0x16; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x i i i i"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; ; ; @@ -9898,21 +7693,15 @@ part parent "m328" #------------------------------------------------------------ part parent "m328" - id = "m32m1"; - desc = "ATmega32M1"; + desc = "ATmega32M1"; + id = "m32m1"; + bs2 = 0xe2; # stk500_devcode = 0x; # avr910_devcode = 0x; - signature = 0x1e 0x95 0x84; - bs2 = 0xe2; + signature = 0x1e 0x95 0x84; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x i i i i i i"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxii.iiii"; ; ; @@ -9921,97 +7710,34 @@ part parent "m328" #------------------------------------------------------------ part parent "m328" - id = "m64m1"; - desc = "ATmega64M1"; + desc = "ATmega64M1"; + id = "m64m1"; + bs2 = 0xe2; # stk500_devcode = 0x; # avr910_devcode = 0x; - signature = 0x1e 0x96 0x84; - bs2 = 0xe2; + signature = 0x1e 0x96 0x84; memory "eeprom" - paged = no; size = 2048; page_size = 8; - min_write_delay = 3600; - max_write_delay = 3600; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; + read = "1010.0000--000x.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 65536; + size = 0x10000; page_size = 256; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x i i i i i i"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxii.iiii"; ; ; @@ -10020,564 +7746,390 @@ part parent "m328" #------------------------------------------------------------ part - id = "t2313"; - desc = "ATtiny2313"; - has_debugwire = yes; - flash_instr = 0xB2, 0x0F, 0x1F; - eeprom_instr = 0xBB, 0xFE, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBA, 0x0F, 0xB2, 0x0F, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; - stk500_devcode = 0x23; + desc = "ATtiny2313"; + id = "t2313"; + stk500_devcode = 0x23; ## Use the ATtiny26 devcode: - avr910_devcode = 0x5e; - signature = 0x1e 0x91 0x0a; - pagel = 0xD4; - bs2 = 0xD6; - reset = io; - chip_erase_delay = 9000; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + avr910_devcode = 0x5e; + chip_erase_delay = 9000; + pagel = 0xd4; + bs2 = 0xd6; + signature = 0x1e 0x91 0x0a; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E, - 0x4E, 0x5E, 0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E, - 0x26, 0x36, 0x66, 0x76, 0x2A, 0x3A, 0x6A, 0x7A, - 0x2E, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0e, 0x1e, 0x2e, 0x3e, 0x2e, 0x3e, + 0x4e, 0x5e, 0x4e, 0x5e, 0x6e, 0x7e, 0x6e, 0x7e, + 0x26, 0x36, 0x66, 0x76, 0x2a, 0x3a, 0x6a, 0x7a, + 0x2e, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb2, 0x0f, 0x1f; + eeprom_instr = + 0xbb, 0xfe, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xba, 0x0f, 0xb2, 0x0f, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 0; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; - memory "eeprom" - size = 128; - paged = no; + memory "eeprom" + size = 128; page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 0 x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = "1 1 0 0 0 0 0 0 0 0 0 x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " x a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 4; - readsize = 256; - ; - memory "flash" - paged = yes; - size = 2048; - page_size = 32; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 0 0 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 0 0 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; + ; + memory "flash" + paged = yes; + size = 2048; + page_size = 32; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.00aa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.00aa--aaaa.aaaa--oooo.oooo"; # The information in the data sheet of April/2004 is wrong, this works: - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - + loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; # The information in the data sheet of April/2004 is wrong, this works: - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - + loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; # The information in the data sheet of April/2004 is wrong, this works: - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 0 0 a9 a8", - " a7 a6 a5 a4 x x x x", - " x x x x x x x x"; + writepage = "0100.1100--0000.00aa--aaaa.xxxx--xxxx.xxxx"; + ; - mode = 0x41; - delay = 6; - blocksize = 32; - readsize = 256; - ; + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; # ATtiny2313 has Signature Bytes: 0x1E 0x91 0x0A. - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; # The Tiny2313 has calibration data for both 4 MHz and 8 MHz. # The information in the data sheet of April/2004 is wrong, this works: - memory "calibration" - size = 2; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 a0 o o o o o o o o"; - ; - ; + memory "calibration" + size = 2; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATtiny2313A #------------------------------------------------------------ part parent "t2313" - id = "t2313a"; - desc = "ATtiny2313A"; - ; + desc = "ATtiny2313A"; + id = "t2313a"; +; #------------------------------------------------------------ # ATtiny4313 #------------------------------------------------------------ part - id = "t4313"; - desc = "ATtiny4313"; - has_debugwire = yes; - flash_instr = 0xB2, 0x0F, 0x1F; - eeprom_instr = 0xBB, 0xFE, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBA, 0x0F, 0xB2, 0x0F, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; - stk500_devcode = 0x23; + desc = "ATtiny4313"; + id = "t4313"; + stk500_devcode = 0x23; ## Use the ATtiny26 devcode: - avr910_devcode = 0x5e; - signature = 0x1e 0x92 0x0d; - pagel = 0xD4; - bs2 = 0xD6; - reset = io; - chip_erase_delay = 9000; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + avr910_devcode = 0x5e; + chip_erase_delay = 9000; + pagel = 0xd4; + bs2 = 0xd6; + signature = 0x1e 0x92 0x0d; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E, - 0x4E, 0x5E, 0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E, - 0x26, 0x36, 0x66, 0x76, 0x2A, 0x3A, 0x6A, 0x7A, - 0x2E, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0e, 0x1e, 0x2e, 0x3e, 0x2e, 0x3e, + 0x4e, 0x5e, 0x4e, 0x5e, 0x6e, 0x7e, 0x6e, 0x7e, + 0x26, 0x36, 0x66, 0x76, 0x2a, 0x3a, 0x6a, 0x7a, + 0x2e, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb2, 0x0f, 0x1f; + eeprom_instr = + 0xbb, 0xfe, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xba, 0x0f, 0xb2, 0x0f, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 0; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; - memory "eeprom" - size = 256; - paged = no; + memory "eeprom" + size = 256; page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 0 x x x x x", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; + ; - write = "1 1 0 0 0 0 0 0 0 0 0 x x x x x", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; + memory "flash" + paged = yes; + size = 4096; + page_size = 64; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; + ; - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; - mode = 0x41; - delay = 6; - blocksize = 4; - readsize = 256; - ; - memory "flash" - paged = yes; - size = 4096; - page_size = 64; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 32; - readsize = 256; - ; + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; # ATtiny4313 has Signature Bytes: 0x1E 0x92 0x0D. - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 2; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 a0 o o o o o o o o"; - ; - ; + memory "calibration" + size = 2; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90PWM2 #------------------------------------------------------------ part - id = "pwm2"; - desc = "AT90PWM2"; - has_debugwire = yes; - flash_instr = 0xB6, 0x01, 0x11; - eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, - 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF, - 0x99, 0xF9, 0xBB, 0xAF; - stk500_devcode = 0x65; + desc = "AT90PWM2"; + id = "pwm2"; + stk500_devcode = 0x65; + chip_erase_delay = 9000; + pagel = 0xd8; + bs2 = 0xe2; ## avr910_devcode = ?; - signature = 0x1e 0x93 0x81; - pagel = 0xD8; - bs2 = 0xE2; - reset = io; - chip_erase_delay = 9000; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + signature = 0x1e 0x93 0x81; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = + 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, + 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, + 0x99, 0xf9, 0xbb, 0xaf; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; - memory "eeprom" - size = 512; - paged = no; + memory "eeprom" + size = 512; page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 0 x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + ; - write = "1 1 0 0 0 0 0 0 0 0 0 x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; + memory "flash" + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + ; - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; - mode = 0x41; - delay = 6; - blocksize = 4; - readsize = 256; - ; - memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 64; - readsize = 256; - ; + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; # AT90PWM2 has Signature Bytes: 0x1E 0x93 0x81. - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; + memory "signature" + size = 3; + read = "0011.0000--00xx.xxxx--xxxx.xxaa--oooo.oooo"; + ; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - ; + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90PWM3 @@ -10586,9 +8138,9 @@ part # Completely identical to AT90PWM2 (including the signature!) part parent "pwm2" - id = "pwm3"; - desc = "AT90PWM3"; - ; + desc = "AT90PWM3"; + id = "pwm3"; +; #------------------------------------------------------------ # AT90PWM2B @@ -10596,12 +8148,11 @@ part parent "pwm2" # Same as AT90PWM2 but different signature. part parent "pwm2" - id = "pwm2b"; - desc = "AT90PWM2B"; - signature = 0x1e 0x93 0x83; - + desc = "AT90PWM2B"; + id = "pwm2b"; + signature = 0x1e 0x93 0x83; ocdrev = 1; - ; +; #------------------------------------------------------------ # AT90PWM3B @@ -10610,11 +8161,9 @@ part parent "pwm2" # Completely identical to AT90PWM2B (including the signature!) part parent "pwm2b" - id = "pwm3b"; - desc = "AT90PWM3B"; - - ocdrev = 1; - ; + desc = "AT90PWM3B"; + id = "pwm3b"; +; #------------------------------------------------------------ # AT90PWM316 @@ -10623,52 +8172,22 @@ part parent "pwm2b" # Similar to AT90PWM3B, but with 16 kiB flash, 512 B EEPROM, and 1024 B SRAM. part parent "pwm3b" - id = "pwm316"; - desc = "AT90PWM316"; - signature = 0x1e 0x94 0x83; - - ocdrev = 1; + desc = "AT90PWM316"; + id = "pwm316"; + signature = 0x1e 0x94 0x83; memory "flash" - paged = yes; - size = 16384; + size = 0x4000; page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x21; - delay = 6; - blocksize = 128; - readsize = 256; - ; - ; + mode = 33; + blocksize = 128; + read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; +; #------------------------------------------------------------ # AT90PWM216 @@ -10676,2188 +8195,203 @@ part parent "pwm3b" # Completely identical to AT90PWM316 (including the signature!) part parent "pwm316" - id = "pwm216"; - desc = "AT90PWM216"; - ; + desc = "AT90PWM216"; + id = "pwm216"; +; #------------------------------------------------------------ # ATtiny25 #------------------------------------------------------------ part - id = "t25"; - desc = "ATtiny25"; - has_debugwire = yes; - flash_instr = 0xB4, 0x02, 0x12; - eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBC, 0x02, 0xB4, 0x02, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; + desc = "ATtiny25"; + id = "t25"; ## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; + stk500_devcode = 0x14; ## avr910_devcode = ?; ## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - signature = 0x1e 0x91 0x08; - reset = io; - chip_erase_delay = 4500; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + avr910_devcode = 0x20; + chip_erase_delay = 4500; + signature = 0x1e 0x91 0x08; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; hvsp_controlstack = - 0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66, - 0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78, - 0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10, + 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, + 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, + 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; + flash_instr = 0xb4, 0x02, 0x12; + eeprom_instr = + 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xbc, 0x02, 0xb4, 0x02, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; hventerstabdelay = 100; - hvspcmdexedelay = 0; - synchcycles = 6; latchcycles = 1; togglevtg = 1; poweroffdelay = 25; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 100; resetdelay = 25; chiperasepolltimeout = 40; - chiperasetime = 0; programfusepolltimeout = 25; programlockpolltimeout = 25; - + synchcycles = 6; ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; - memory "eeprom" - size = 128; - paged = no; + memory "eeprom" + size = 128; page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 0 x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; + ; - write = "1 1 0 0 0 0 0 0 0 0 0 x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; + memory "flash" + paged = yes; + size = 2048; + page_size = 32; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.00aa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.00aa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.00aa--aaaa.xxxx--xxxx.xxxx"; + ; - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " x a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; - mode = 0x41; - delay = 6; - blocksize = 4; - readsize = 256; - ; - memory "flash" - paged = yes; - size = 2048; - page_size = 32; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 0 0 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 0 0 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 0 0 a9 a8", - " a7 a6 a5 a4 x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 32; - readsize = 256; - ; + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; # ATtiny25 has Signature Bytes: 0x1E 0x91 0x08. - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 a0 o o o o o o o o"; - ; - ; + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATtiny45 #------------------------------------------------------------ part - id = "t45"; - desc = "ATtiny45"; - has_debugwire = yes; - flash_instr = 0xB4, 0x02, 0x12; - eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBC, 0x02, 0xB4, 0x02, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; - stk500_devcode = 0x14; + desc = "ATtiny45"; + id = "t45"; + stk500_devcode = 0x14; ## avr910_devcode = ?; ## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - signature = 0x1e 0x92 0x06; - reset = io; - chip_erase_delay = 4500; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - hvsp_controlstack = - 0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66, - 0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78, - 0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10, - 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; - hvspcmdexedelay = 0; - synchcycles = 6; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayms = 1; - resetdelayus = 0; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; - chiperasetime = 0; - programfusepolltimeout = 25; - programlockpolltimeout = 25; - - ocdrev = 1; - - memory "eeprom" - size = 256; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 0 x x x x x", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = "1 1 0 0 0 0 0 0 0 0 0 x x x x x", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 4; - readsize = 256; - ; - memory "flash" - paged = yes; - size = 4096; - page_size = 64; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 32; - readsize = 256; - ; -# ATtiny45 has Signature Bytes: 0x1E 0x92 0x08. (Data sheet 2586C-AVR-06/05 (doc2586.pdf) indicates otherwise!) - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 a0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATtiny85 -#------------------------------------------------------------ - -part - id = "t85"; - desc = "ATtiny85"; - has_debugwire = yes; - flash_instr = 0xB4, 0x02, 0x12; - eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBC, 0x02, 0xB4, 0x02, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; -## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - signature = 0x1e 0x93 0x0b; - reset = io; - chip_erase_delay = 4500; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - hvsp_controlstack = - 0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66, - 0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78, - 0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10, - 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; - hventerstabdelay = 100; - hvspcmdexedelay = 0; - synchcycles = 6; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayms = 1; - resetdelayus = 0; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; - chiperasetime = 0; - programfusepolltimeout = 25; - programlockpolltimeout = 25; - - ocdrev = 1; - - memory "eeprom" - size = 512; - paged = no; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 0 x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = "1 1 0 0 0 0 0 0 0 0 0 x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 4; - readsize = 256; - ; - memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 32; - readsize = 256; - ; -# ATtiny85 has Signature Bytes: 0x1E 0x93 0x08. - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 a0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATmega640 -#------------------------------------------------------------ -# Almost same as ATmega1280, except for different memory sizes - -part - id = "m640"; - desc = "ATmega640"; - signature = 0x1e 0x96 0x08; - has_jtag = yes; -# stk500_devcode = 0xB2; -# avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xD7; - bs2 = 0xA0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - resetdelayus = 0; - hvleavestabdelay = 15; - chiperasepulsewidth = 0; - chiperasepolltimeout = 10; - programfusepulsewidth = 0; - programfusepolltimeout = 5; - programlockpulsewidth = 0; - programlockpolltimeout = 5; - - idr = 0x31; - spmcr = 0x57; - rampz = 0x3b; - allowfullpagebitstream = no; - - ocdrev = 3; - - memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ - size = 4096; - min_write_delay = 9000; - max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 8; - readsize = 256; - ; - - memory "flash" - paged = yes; - size = 65536; - page_size = 256; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 256; - readsize = 256; - ; - - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATmega1280 -#------------------------------------------------------------ - -part - id = "m1280"; - desc = "ATmega1280"; - signature = 0x1e 0x97 0x03; - has_jtag = yes; -# stk500_devcode = 0xB2; -# avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xD7; - bs2 = 0xA0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - resetdelayus = 0; - hvleavestabdelay = 15; - chiperasepulsewidth = 0; - chiperasepolltimeout = 10; - programfusepulsewidth = 0; - programfusepolltimeout = 5; - programlockpulsewidth = 0; - programlockpolltimeout = 5; - - idr = 0x31; - spmcr = 0x57; - rampz = 0x3b; - allowfullpagebitstream = no; - - ocdrev = 3; - - memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ - size = 4096; - min_write_delay = 9000; - max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 8; - readsize = 256; - ; - - memory "flash" - paged = yes; - size = 131072; - page_size = 256; - num_pages = 512; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 256; - readsize = 256; - ; - - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATmega1281 -#------------------------------------------------------------ -# Identical to ATmega1280 - -part parent "m1280" - id = "m1281"; - desc = "ATmega1281"; - signature = 0x1e 0x97 0x04; - - ocdrev = 3; - ; - -#------------------------------------------------------------ -# ATmega2560 -#------------------------------------------------------------ - -part - id = "m2560"; - desc = "ATmega2560"; - signature = 0x1e 0x98 0x01; - has_jtag = yes; - stk500_devcode = 0xB2; -# avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xD7; - bs2 = 0xA0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02; - hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - resetdelayus = 0; - hvleavestabdelay = 15; - chiperasepulsewidth = 0; - chiperasepolltimeout = 10; - programfusepulsewidth = 0; - programfusepolltimeout = 5; - programlockpulsewidth = 0; - programlockpolltimeout = 5; - - idr = 0x31; - spmcr = 0x57; - rampz = 0x3b; - allowfullpagebitstream = no; - - ocdrev = 4; - - memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ - size = 4096; - min_write_delay = 9000; - max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 8; - readsize = 256; - ; - - memory "flash" - paged = yes; - size = 262144; - page_size = 256; - num_pages = 1024; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - load_ext_addr = " 0 1 0 0 1 1 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 0 a16", - " 0 0 0 0 0 0 0 0"; - - mode = 0x41; - delay = 10; - blocksize = 256; - readsize = 256; - ; - - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATmega2561 -#------------------------------------------------------------ - -part parent "m2560" - id = "m2561"; - desc = "ATmega2561"; - signature = 0x1e 0x98 0x02; - - ocdrev = 4; - ; - -#------------------------------------------------------------ -# ATmega128RFA1 -#------------------------------------------------------------ -# Identical to ATmega2561 but half the ROM - -part parent "m2561" - id = "m128rfa1"; - desc = "ATmega128RFA1"; - signature = 0x1e 0xa7 0x01; - chip_erase_delay = 55000; - bs2 = 0xE2; - - ocdrev = 3; - - memory "flash" - paged = yes; - size = 131072; - page_size = 256; - num_pages = 512; - min_write_delay = 50000; - max_write_delay = 50000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - load_ext_addr = NULL; - - mode = 0x41; - delay = 20; - blocksize = 256; - readsize = 256; - ; - ; - -#------------------------------------------------------------ -# ATmega256RFR2 -#------------------------------------------------------------ - -part parent "m2561" - id = "m256rfr2"; - desc = "ATmega256RFR2"; - signature = 0x1e 0xa8 0x02; - chip_erase_delay = 18500; - bs2 = 0xE2; - - memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ - size = 8192; - min_write_delay = 13000; - max_write_delay = 13000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 8; - readsize = 256; - ; - - - ocdrev = 4; - ; - -#------------------------------------------------------------ -# ATmega128RFR2 -#------------------------------------------------------------ - -part parent "m128rfa1" - id = "m128rfr2"; - desc = "ATmega128RFR2"; - signature = 0x1e 0xa7 0x02; - - - ocdrev = 3; - ; - -#------------------------------------------------------------ -# ATmega64RFR2 -#------------------------------------------------------------ - -part parent "m128rfa1" - id = "m64rfr2"; - desc = "ATmega64RFR2"; - signature = 0x1e 0xa6 0x02; - - - ocdrev = 3; - - memory "flash" - paged = yes; - size = 65536; - page_size = 256; - num_pages = 256; - min_write_delay = 50000; - max_write_delay = 50000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 256; - readsize = 256; - ; - - memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ - size = 2048; - min_write_delay = 13000; - max_write_delay = 13000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 8; - readsize = 256; - ; - - - ; - -#------------------------------------------------------------ -# ATmega2564RFR2 -#------------------------------------------------------------ - -part parent "m256rfr2" - id = "m2564rfr2"; - desc = "ATmega2564RFR2"; - signature = 0x1e 0xa8 0x03; - ; - -#------------------------------------------------------------ -# ATmega1284RFR2 -#------------------------------------------------------------ - -part parent "m128rfr2" - id = "m1284rfr2"; - desc = "ATmega1284RFR2"; - signature = 0x1e 0xa7 0x03; - ; - -#------------------------------------------------------------ -# ATmega644RFR2 -#------------------------------------------------------------ - -part parent "m64rfr2" - id = "m644rfr2"; - desc = "ATmega644RFR2"; - signature = 0x1e 0xa6 0x03; - ; - -#------------------------------------------------------------ -# ATtiny24 -#------------------------------------------------------------ - -part - id = "t24"; - desc = "ATtiny24"; - has_debugwire = yes; - flash_instr = 0xB4, 0x07, 0x17; - eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBC, 0x07, 0xB4, 0x07, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; -## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - signature = 0x1e 0x91 0x0b; - reset = io; - chip_erase_delay = 4500; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - hvsp_controlstack = - 0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66, - 0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78, - 0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10, - 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0F; - hventerstabdelay = 100; - hvspcmdexedelay = 0; - synchcycles = 6; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayms = 0; - resetdelayus = 70; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; - chiperasetime = 0; - programfusepolltimeout = 25; - programlockpolltimeout = 25; - - ocdrev = 1; - - memory "eeprom" - size = 128; - paged = no; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 0 x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = "1 1 0 0 0 0 0 0 0 0 0 x x x x x", - "x a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " x a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 4; - readsize = 256; - ; - memory "flash" - paged = yes; - size = 2048; - page_size = 32; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 0 0 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 0 0 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 0 0 a9 a8", - " a7 a6 a5 a4 x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 32; - readsize = 256; - ; -# ATtiny24 has Signature Bytes: 0x1E 0x91 0x0B. - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x x x x x x x i i"; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 a0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATtiny24A -#------------------------------------------------------------ - -part parent "t24" - id = "t24a"; - desc = "ATtiny24A"; - ; - -#------------------------------------------------------------ -# ATtiny44 -#------------------------------------------------------------ - -part - id = "t44"; - desc = "ATtiny44"; - has_debugwire = yes; - flash_instr = 0xB4, 0x07, 0x17; - eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBC, 0x07, 0xB4, 0x07, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; -## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - signature = 0x1e 0x92 0x07; - reset = io; - chip_erase_delay = 4500; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - hvsp_controlstack = - 0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66, - 0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78, - 0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10, - 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0F; - hventerstabdelay = 100; - hvspcmdexedelay = 0; - synchcycles = 6; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayms = 0; - resetdelayus = 70; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; - chiperasetime = 0; - programfusepolltimeout = 25; - programlockpolltimeout = 25; - - ocdrev = 1; - - memory "eeprom" - size = 256; - paged = no; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 0 x x x x x", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = "1 1 0 0 0 0 0 0 0 0 0 x x x x x", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 4; - readsize = 256; - ; - memory "flash" - paged = yes; - size = 4096; - page_size = 64; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 32; - readsize = 256; - ; -# ATtiny44 has Signature Bytes: 0x1E 0x92 0x07. - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x x x x x x x i i"; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 a0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATtiny44A -#------------------------------------------------------------ - -part parent "t44" - id = "t44a"; - desc = "ATtiny44A"; - ; - -#------------------------------------------------------------ -# ATtiny84 -#------------------------------------------------------------ - -part - id = "t84"; - desc = "ATtiny84"; - has_debugwire = yes; - flash_instr = 0xB4, 0x07, 0x17; - eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBC, 0x07, 0xB4, 0x07, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; -## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - signature = 0x1e 0x93 0x0c; - reset = io; - chip_erase_delay = 4500; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - hvsp_controlstack = - 0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66, - 0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78, - 0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10, - 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0F; - hventerstabdelay = 100; - hvspcmdexedelay = 0; - synchcycles = 6; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayms = 0; - resetdelayus = 70; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; - chiperasetime = 0; - programfusepolltimeout = 25; - programlockpolltimeout = 25; - - ocdrev = 1; - - memory "eeprom" - size = 512; - paged = no; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 0 x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; - - write = "1 1 0 0 0 0 0 0 0 0 0 x x x x a8", - "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 4; - readsize = 256; - ; - memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 32; - readsize = 256; - ; -# ATtiny84 has Signature Bytes: 0x1E 0x93 0x0C. - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - - memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x x x x x x x i i"; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "lfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "hfuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 a0 o o o o o o o o"; - ; - ; - -#------------------------------------------------------------ -# ATtiny84A -#------------------------------------------------------------ - -part parent "t84" - id = "t84a"; - desc = "ATtiny84A"; - ; - -#------------------------------------------------------------ -# ATtiny441 -#------------------------------------------------------------ - -part parent "t44" - id = "t441"; - desc = "ATtiny441"; - signature = 0x1e 0x92 0x15; - - memory "flash" - paged = yes; - size = 4096; - page_size = 16; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x x x a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x x x a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 16; - readsize = 256; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; -; - -#------------------------------------------------------------ -# ATtiny841 -#------------------------------------------------------------ - -part parent "t84" - id = "t841"; - desc = "ATtiny841"; - signature = 0x1e 0x93 0x15; - - memory "flash" - paged = yes; - size = 8192; - page_size = 16; - num_pages = 512; - min_write_delay = 4500; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x x x a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x x x a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 16; - readsize = 256; - ; - - memory "efuse" - size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 9000; - max_write_delay = 9000; - ; -; - -#------------------------------------------------------------ -# ATtiny43U -#------------------------------------------------------------ - -part - id = "t43u"; - desc = "ATtiny43U"; - has_debugwire = yes; - flash_instr = 0xB4, 0x07, 0x17; - eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, - 0xBC, 0x07, 0xB4, 0x07, 0xBA, 0x0D, 0xBB, 0xBC, - 0x99, 0xE1, 0xBB, 0xAC; - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - signature = 0x1e 0x92 0x0C; - reset = io; - chip_erase_delay = 1000; - - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; + avr910_devcode = 0x20; + chip_erase_delay = 4500; + signature = 0x1e 0x92 0x06; + reset = io; + has_debugwire = yes; + timeout = 200; stabdelay = 100; cmdexedelay = 25; synchloops = 32; - bytedelay = 0; pollindex = 3; pollvalue = 0x53; predelay = 1; postdelay = 1; pollmethod = 1; - pp_controlstack = 0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E, 0x4E, 0x5E, - 0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E, 0x06, 0x16, 0x46, 0x56, - 0x0A, 0x1A, 0x4A, 0x5A, 0x1E, 0x7C, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00; + hvsp_controlstack = + 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, + 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, + 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, + 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; + flash_instr = 0xb4, 0x02, 0x12; + eeprom_instr = + 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xbc, 0x02, 0xb4, 0x02, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; hventerstabdelay = 100; - progmodedelay = 0; - hvspcmdexedelay = 0; - latchcycles = 5; + latchcycles = 1; togglevtg = 1; - poweroffdelay = 20; + poweroffdelay = 25; resetdelayms = 1; - resetdelayus = 0; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepulsewidth = 0; - chiperasepolltimeout = 10; - programfusepulsewidth = 0; - programfusepolltimeout = 5; - programlockpulsewidth = 0; - programlockpolltimeout = 5; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; + programfusepolltimeout = 25; + programlockpolltimeout = 25; + synchcycles = 6; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + memory "eeprom" - size = 64; - paged = yes; - page_size = 4; - num_pages = 16; - min_write_delay = 4000; - max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = "1 0 1 0 0 0 0 0 0 0 0 x x x x x", - "0 0 a5 a4 a3 a2 a1 a0 o o o o o o o o"; + size = 256; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; + ; - write = "1 1 0 0 0 0 0 0 0 0 0 x x x x x", - "0 0 a5 a4 a3 a2 a1 a0 i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " 0 0 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 5; - blocksize = 4; - readsize = 256; - ; memory "flash" paged = yes; size = 4096; @@ -12865,91 +8399,1264 @@ part num_pages = 64; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 64; - readsize = 256; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - memory "lock" - size = 1; - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 4500; - max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 4500; - max_write_delay = 4500; - ; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 4500; - max_write_delay = 4500; - ; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x x x x i"; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - min_write_delay = 4500; - max_write_delay = 4500; + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; +# ATtiny45 has Signature Bytes: 0x1E 0x92 0x08. (Data sheet 2586C-AVR-06/05 (doc2586.pdf) indicates otherwise!) + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 a0 o o o o o o o o"; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATtiny85 +#------------------------------------------------------------ + +part + desc = "ATtiny85"; + id = "t85"; +## no STK500 devcode in XML file, use the ATtiny45 one + stk500_devcode = 0x14; +## avr910_devcode = ?; +## Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 4500; + signature = 0x1e 0x93 0x0b; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + hvsp_controlstack = + 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, + 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, + 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, + 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; + flash_instr = 0xb4, 0x02, 0x12; + eeprom_instr = + 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xbc, 0x02, 0xb4, 0x02, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayms = 1; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; + programfusepolltimeout = 25; + programlockpolltimeout = 25; + synchcycles = 6; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 512; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + ; + + memory "flash" + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; +# ATtiny85 has Signature Bytes: 0x1E 0x93 0x08. + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATmega640 +#------------------------------------------------------------ +# Almost same as ATmega1280, except for different memory sizes + +part + desc = "ATmega640"; + id = "m640"; +# stk500_devcode = 0xB2; +# avr910_devcode = 0x43; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x96 0x08; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; + programfusepolltimeout = 5; + programlockpolltimeout = 5; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 4096; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 10; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + ; + + memory "flash" + paged = yes; + size = 0x10000; + page_size = 256; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 10; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--0aaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATmega1280 +#------------------------------------------------------------ + +part + desc = "ATmega1280"; + id = "m1280"; +# stk500_devcode = 0xB2; +# avr910_devcode = 0x43; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x97 0x03; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; + programfusepolltimeout = 5; + programlockpolltimeout = 5; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 4096; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 10; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + ; + + memory "flash" + paged = yes; + size = 0x20000; + page_size = 256; + num_pages = 512; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 10; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATmega1281 +#------------------------------------------------------------ +# Identical to ATmega1280 + +part parent "m1280" + desc = "ATmega1281"; + id = "m1281"; + signature = 0x1e 0x97 0x04; +; + +#------------------------------------------------------------ +# ATmega2560 +#------------------------------------------------------------ + +part + desc = "ATmega2560"; + id = "m2560"; + stk500_devcode = 0xb2; +# avr910_devcode = 0x43; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x98 0x01; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; + programfusepolltimeout = 5; + programlockpolltimeout = 5; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + ocdrev = 4; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 4096; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 10; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + ; + + memory "flash" + paged = yes; + size = 0x40000; + page_size = 256; + num_pages = 1024; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 10; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + load_ext_addr = "0100.1101--0000.0000--0000.000a--0000.0000"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATmega2561 +#------------------------------------------------------------ + +part parent "m2560" + desc = "ATmega2561"; + id = "m2561"; + signature = 0x1e 0x98 0x02; +; + +#------------------------------------------------------------ +# ATmega128RFA1 +#------------------------------------------------------------ +# Identical to ATmega2561 but half the ROM + +part parent "m2561" + desc = "ATmega128RFA1"; + id = "m128rfa1"; + chip_erase_delay = 55000; + bs2 = 0xe2; + signature = 0x1e 0xa7 0x01; + ocdrev = 3; + + memory "flash" + size = 0x20000; + num_pages = 512; + min_write_delay = 50000; + max_write_delay = 50000; + delay = 20; + load_ext_addr = NULL; + ; +; + +#------------------------------------------------------------ +# ATmega256RFR2 +#------------------------------------------------------------ + +part parent "m2561" + desc = "ATmega256RFR2"; + id = "m256rfr2"; + chip_erase_delay = 18500; + bs2 = 0xe2; + signature = 0x1e 0xa8 0x02; + + memory "eeprom" + size = 8192; + min_write_delay = 13000; + max_write_delay = 13000; + read = "1010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxa.aaaa--aaaa.aaaa--iiii.iiii"; + writepage = "1100.0010--00xa.aaaa--aaaa.a000--xxxx.xxxx"; + ; +; + +#------------------------------------------------------------ +# ATmega128RFR2 +#------------------------------------------------------------ + +part parent "m128rfa1" + desc = "ATmega128RFR2"; + id = "m128rfr2"; + signature = 0x1e 0xa7 0x02; +; + +#------------------------------------------------------------ +# ATmega64RFR2 +#------------------------------------------------------------ + +part parent "m128rfa1" + desc = "ATmega64RFR2"; + id = "m64rfr2"; + signature = 0x1e 0xa6 0x02; + + memory "eeprom" + size = 2048; + min_write_delay = 13000; + max_write_delay = 13000; + read = "1010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; + ; + + memory "flash" + size = 0x10000; + num_pages = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + writepage = "0100.1100--0aaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; +; + +#------------------------------------------------------------ +# ATmega2564RFR2 +#------------------------------------------------------------ + +part parent "m256rfr2" + desc = "ATmega2564RFR2"; + id = "m2564rfr2"; + signature = 0x1e 0xa8 0x03; +; + +#------------------------------------------------------------ +# ATmega1284RFR2 +#------------------------------------------------------------ + +part parent "m128rfr2" + desc = "ATmega1284RFR2"; + id = "m1284rfr2"; + signature = 0x1e 0xa7 0x03; +; + +#------------------------------------------------------------ +# ATmega644RFR2 +#------------------------------------------------------------ + +part parent "m64rfr2" + desc = "ATmega644RFR2"; + id = "m644rfr2"; + signature = 0x1e 0xa6 0x03; +; + +#------------------------------------------------------------ +# ATtiny24 +#------------------------------------------------------------ + +part + desc = "ATtiny24"; + id = "t24"; +## no STK500 devcode in XML file, use the ATtiny45 one + stk500_devcode = 0x14; +## avr910_devcode = ?; +## Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 4500; + signature = 0x1e 0x91 0x0b; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + hvsp_controlstack = + 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, + 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, + 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, + 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0f; + flash_instr = 0xb4, 0x07, 0x17; + eeprom_instr = + 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xbc, 0x07, 0xb4, 0x07, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayus = 70; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; + programfusepolltimeout = 25; + programlockpolltimeout = 25; + synchcycles = 6; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 128; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; + ; + + memory "flash" + paged = yes; + size = 2048; + page_size = 32; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.00aa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.00aa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.00aa--aaaa.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; + ; +# ATtiny24 has Signature Bytes: 0x1E 0x91 0x0B. + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATtiny24A +#------------------------------------------------------------ + +part parent "t24" + desc = "ATtiny24A"; + id = "t24a"; +; + +#------------------------------------------------------------ +# ATtiny44 +#------------------------------------------------------------ + +part + desc = "ATtiny44"; + id = "t44"; +## no STK500 devcode in XML file, use the ATtiny45 one + stk500_devcode = 0x14; +## avr910_devcode = ?; +## Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 4500; + signature = 0x1e 0x92 0x07; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + hvsp_controlstack = + 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, + 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, + 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, + 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0f; + flash_instr = 0xb4, 0x07, 0x17; + eeprom_instr = + 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xbc, 0x07, 0xb4, 0x07, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayus = 70; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; + programfusepolltimeout = 25; + programlockpolltimeout = 25; + synchcycles = 6; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 256; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; + ; + + memory "flash" + paged = yes; + size = 4096; + page_size = 64; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; + ; +# ATtiny44 has Signature Bytes: 0x1E 0x92 0x07. + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATtiny44A +#------------------------------------------------------------ + +part parent "t44" + desc = "ATtiny44A"; + id = "t44a"; +; + +#------------------------------------------------------------ +# ATtiny84 +#------------------------------------------------------------ + +part + desc = "ATtiny84"; + id = "t84"; +## no STK500 devcode in XML file, use the ATtiny45 one + stk500_devcode = 0x14; +## avr910_devcode = ?; +## Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 4500; + signature = 0x1e 0x93 0x0c; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + hvsp_controlstack = + 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, + 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, + 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, + 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0f; + flash_instr = 0xb4, 0x07, 0x17; + eeprom_instr = + 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xbc, 0x07, 0xb4, 0x07, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayus = 70; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; + programfusepolltimeout = 25; + programlockpolltimeout = 25; + synchcycles = 6; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + size = 512; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + ; + + memory "flash" + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; + ; +# ATtiny84 has Signature Bytes: 0x1E 0x93 0x0C. + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + ; +; + +#------------------------------------------------------------ +# ATtiny84A +#------------------------------------------------------------ + +part parent "t84" + desc = "ATtiny84A"; + id = "t84a"; +; + +#------------------------------------------------------------ +# ATtiny441 +#------------------------------------------------------------ + +part parent "t44" + desc = "ATtiny441"; + id = "t441"; + signature = 0x1e 0x92 0x15; + + memory "flash" + page_size = 16; + num_pages = 256; + blocksize = 16; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.xaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.xaaa--iiii.iiii"; + writepage = "0100.1100--0000.0aaa--aaaa.axxx--xxxx.xxxx"; + ; + + memory "efuse" + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + ; +; + +#------------------------------------------------------------ +# ATtiny841 +#------------------------------------------------------------ + +part parent "t84" + desc = "ATtiny841"; + id = "t841"; + signature = 0x1e 0x93 0x15; + + memory "flash" + page_size = 16; + num_pages = 512; + blocksize = 16; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.xaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.xaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaaa.axxx--xxxx.xxxx"; + ; + + memory "efuse" + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + ; +; + +#------------------------------------------------------------ +# ATtiny43U +#------------------------------------------------------------ + +part + desc = "ATtiny43U"; + id = "t43u"; + stk500_devcode = 0x14; +## avr910_devcode = ?; +## Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 1000; + signature = 0x1e 0x92 0x0c; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0e, 0x1e, 0x2e, 0x3e, 0x2e, 0x3e, + 0x4e, 0x5e, 0x4e, 0x5e, 0x6e, 0x7e, 0x6e, 0x7e, + 0x06, 0x16, 0x46, 0x56, 0x0a, 0x1a, 0x4a, 0x5a, + 0x1e, 0x7c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb4, 0x07, 0x17; + eeprom_instr = + 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, + 0xbc, 0x07, 0xb4, 0x07, 0xba, 0x0d, 0xbb, 0xbc, + 0x99, 0xe1, 0xbb, 0xac; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 20; + resetdelayms = 1; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; + programfusepolltimeout = 5; + programlockpolltimeout = 5; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + + memory "eeprom" + paged = yes; + size = 64; + page_size = 4; + num_pages = 16; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 5; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--00aa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--00aa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--00aa.aa00--xxxx.xxxx"; + ; + + memory "flash" + paged = yes; + size = 4096; + page_size = 64; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; + ; + + memory "lfuse" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; + + memory "hfuse" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; + + memory "efuse" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + ; + + memory "lock" + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -12958,573 +9665,363 @@ part #------------------------------------------------------------ part - id = "m16u4"; - desc = "ATmega16U4"; - signature = 0x1e 0x94 0x88; - usbpid = 0x2ff4; - has_jtag = yes; + desc = "ATmega16U4"; + id = "m16u4"; # stk500_devcode = 0xB2; # avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xD7; - bs2 = 0xA0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x94 0x88; + usbpid = 0x2ff4; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; rampz = 0x3b; - allowfullpagebitstream = no; - + spmcr = 0x57; ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ size = 512; + page_size = 4; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 16384; + size = 0x4000; page_size = 128; num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - ; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x 1 1 1 1 i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.iiii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x 0 0 o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--00oo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega32u4 #------------------------------------------------------------ part - id = "m32u4"; - desc = "ATmega32U4"; - signature = 0x1e 0x95 0x87; - usbpid = 0x2ff4; - has_jtag = yes; + desc = "ATmega32U4"; + id = "m32u4"; # stk500_devcode = 0xB2; # avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xD7; - bs2 = 0xA0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x95 0x87; + usbpid = 0x2ff4; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; rampz = 0x3b; - allowfullpagebitstream = no; - + spmcr = 0x57; ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ size = 1024; + page_size = 4; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 32768; + size = 0x8000; page_size = 128; num_pages = 256; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - ; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x 1 1 1 1 i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.iiii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90USB646 #------------------------------------------------------------ part - id = "usb646"; - desc = "AT90USB646"; - signature = 0x1e 0x96 0x82; - usbpid = 0x2ff9; - has_jtag = yes; + desc = "AT90USB646"; + id = "usb646"; # stk500_devcode = 0xB2; # avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xD7; - bs2 = 0xA0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x96 0x82; + usbpid = 0x2ff9; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; rampz = 0x3b; - allowfullpagebitstream = no; - + spmcr = 0x57; ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ size = 2048; + page_size = 8; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x x a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 8; - readsize = 256; - ; + mode = 65; + delay = 10; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 65536; + size = 0x10000; page_size = 256; num_pages = 256; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 256; - readsize = 256; - ; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--0aaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90USB647 @@ -13532,203 +10029,130 @@ part # identical to AT90USB646 part parent "usb646" - id = "usb647"; - desc = "AT90USB647"; - signature = 0x1e 0x96 0x82; - - ocdrev = 3; - ; + desc = "AT90USB647"; + id = "usb647"; +; #------------------------------------------------------------ # AT90USB1286 #------------------------------------------------------------ part - id = "usb1286"; - desc = "AT90USB1286"; - signature = 0x1e 0x97 0x82; - usbpid = 0x2ffb; - has_jtag = yes; + desc = "AT90USB1286"; + id = "usb1286"; # stk500_devcode = 0xB2; # avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xD7; - bs2 = 0xA0; - reset = dedicated; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x97 0x82; + usbpid = 0x2ffb; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; rampz = 0x3b; - allowfullpagebitstream = no; - + spmcr = 0x57; ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ size = 4096; + page_size = 8; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " x x x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x a11 a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 10; - blocksize = 8; - readsize = 256; - ; + mode = 65; + delay = 10; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 131072; + size = 0x20000; page_size = 256; num_pages = 512; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 x x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 256; - readsize = 256; - ; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 x x x x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 x x x x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90USB1287 @@ -13736,195 +10160,127 @@ part # identical to AT90USB1286 part parent "usb1286" - id = "usb1287"; - desc = "AT90USB1287"; - signature = 0x1e 0x97 0x82; - - ocdrev = 3; - ; + desc = "AT90USB1287"; + id = "usb1287"; +; #------------------------------------------------------------ # AT90USB162 #------------------------------------------------------------ part - id = "usb162"; - desc = "AT90USB162"; - has_jtag = no; - has_debugwire = yes; - signature = 0x1e 0x94 0x82; - usbpid = 0x2ffa; - chip_erase_delay = 9000; - reset = io; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - pagel = 0xD7; - bs2 = 0xC6; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; + desc = "AT90USB162"; + id = "usb162"; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc6; + signature = 0x1e 0x94 0x82; + usbpid = 0x2ffa; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ size = 512; + page_size = 4; num_pages = 128; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 16384; + size = 0x4000; page_size = 128; num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - ; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; memory "calibration" size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # AT90USB82 @@ -13935,87 +10291,57 @@ part # num_pages = 64; part - id = "usb82"; - desc = "AT90USB82"; - has_jtag = no; - has_debugwire = yes; - signature = 0x1e 0x93 0x82; - usbpid = 0x2ff7; - chip_erase_delay = 9000; - reset = io; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - pagel = 0xD7; - bs2 = 0xC6; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; + desc = "AT90USB82"; + id = "usb82"; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc6; + signature = 0x1e 0x93 0x82; + usbpid = 0x2ff7; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ size = 512; + page_size = 4; num_pages = 128; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; @@ -14024,94 +10350,59 @@ part num_pages = 64; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - ; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; memory "calibration" size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega32U2 @@ -14124,183 +10415,119 @@ part # size = 1024; # num_pages = 256; part - id = "m32u2"; - desc = "ATmega32U2"; - has_jtag = no; - has_debugwire = yes; - signature = 0x1e 0x95 0x8a; - usbpid = 0x2ff0; - chip_erase_delay = 9000; - reset = io; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - pagel = 0xD7; - bs2 = 0xC6; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; + desc = "ATmega32U2"; + id = "m32u2"; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc6; + signature = 0x1e 0x95 0x8a; + usbpid = 0x2ff0; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ size = 1024; + page_size = 4; num_pages = 256; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 32768; + size = 0x8000; page_size = 128; num_pages = 256; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - ; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; memory "calibration" size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; + #------------------------------------------------------------ # ATmega16U2 #------------------------------------------------------------ @@ -14312,183 +10539,118 @@ part # size = 512; # num_pages = 128; part - id = "m16u2"; - desc = "ATmega16U2"; - has_jtag = no; - has_debugwire = yes; - signature = 0x1e 0x94 0x89; - usbpid = 0x2fef; - chip_erase_delay = 9000; - reset = io; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - pagel = 0xD7; - bs2 = 0xC6; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; + desc = "ATmega16U2"; + id = "m16u2"; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc6; + signature = 0x1e 0x94 0x89; + usbpid = 0x2fef; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ size = 512; + page_size = 4; num_pages = 128; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 16384; + size = 0x4000; page_size = 128; num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - ; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; memory "calibration" size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega8U2 @@ -14500,87 +10662,57 @@ part # blocksize = 64; part - id = "m8u2"; - desc = "ATmega8U2"; - has_jtag = no; - has_debugwire = yes; - signature = 0x1e 0x93 0x89; - usbpid = 0x2fee; - chip_erase_delay = 9000; - reset = io; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - pagel = 0xD7; - bs2 = 0xC6; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; + desc = "ATmega8U2"; + id = "m8u2"; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc6; + signature = 0x1e 0x93 0x89; + usbpid = 0x2fee; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ size = 512; + page_size = 4; num_pages = 128; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 0 0 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 20; - blocksize = 4; - readsize = 256; - ; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; @@ -14589,868 +10721,622 @@ part num_pages = 64; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " x x x x x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - "a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - ; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x i i i i i i i i"; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + ; memory "lock" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; + + memory "signature" + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; memory "calibration" size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - memory "signature" - size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; - ; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega165 #------------------------------------------------------------ part - id = "m165"; - desc = "ATmega165"; - signature = 0x1e 0x94 0x10; - has_jtag = yes; + desc = "ATmega165"; + id = "m165"; # stk500_devcode = 0x??; # avr910_devcode = 0x??; - chip_erase_delay = 9000; - reset = io; - pagel = 0xd7; - bs2 = 0xa0; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 6; - togglevtg = 0; - poweroffdelay = 0; - resetdelayms = 0; - resetdelayus = 0; - hvleavestabdelay = 15; - chiperasepulsewidth = 0; - resetdelay = 15; - chiperasepolltimeout = 10; - programfusepulsewidth = 0; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x94 0x10; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - - idr = 0x31; - spmcr = 0x57; - eecr = 0x3f; - allowfullpagebitstream = no; - - ocdrev = 3; + idr = 0x31; + spmcr = 0x57; + eecr = 0x3f; + ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; - page_size = 4; size = 512; + page_size = 4; num_pages = 128; min_write_delay = 3600; max_write_delay = 3600; - readback_p1 = 0x00; - readback_p2 = 0x00; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 0 0 0 x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 0 0 0 x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 0 0 0 0 x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; + mode = 65; delay = 20; blocksize = 4; readsize = 256; - ; + read = "1010.0000--0000.00xa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.00xa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.00xa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 16384; + size = 0x4000; page_size = 128; num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0x00; - readback_p2 = 0x00; - read_lo = " 0 0 1 0 0 0 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 0 x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 0 x x x x", - " x x a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " x x x a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", - " x x x x x x x x"; - - mode = 0x41; + mode = 65; delay = 10; blocksize = 128; readsize = 256; - ; + read_lo = "0010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--0000.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--0000.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxa.aaaa--aaxx.xxxx--xxxx.xxxx"; + ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x x i i i i"; - ; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 i i i i i i"; - ; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x a1 a0 o o o o o o o o"; - ; + read = "0011.0000--0000.0000--xxxx.xxaa--oooo.oooo"; + ; memory "calibration" size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - ; - ; + read = "0011.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega165A #------------------------------------------------------------ part parent "m165" - id = "m165a"; - desc = "ATmega165A"; - signature = 0x1e 0x94 0x10; - ; + desc = "ATmega165A"; + id = "m165a"; +; #------------------------------------------------------------ # ATmega165P #------------------------------------------------------------ part parent "m165" - id = "m165p"; - desc = "ATmega165P"; - signature = 0x1e 0x94 0x07; - ; + desc = "ATmega165P"; + id = "m165p"; + signature = 0x1e 0x94 0x07; +; #------------------------------------------------------------ # ATmega165PA #------------------------------------------------------------ part parent "m165" - id = "m165pa"; - desc = "ATmega165PA"; - signature = 0x1e 0x94 0x07; - ; + desc = "ATmega165PA"; + id = "m165pa"; + signature = 0x1e 0x94 0x07; +; #------------------------------------------------------------ # ATmega325 #------------------------------------------------------------ part - id = "m325"; - desc = "ATmega325"; - signature = 0x1e 0x95 0x05; - has_jtag = yes; + desc = "ATmega325"; + id = "m325"; # stk500_devcode = 0x??; # No STK500v1 support? # avr910_devcode = 0x??; # Try the ATmega16 one - avr910_devcode = 0x74; - pagel = 0xd7; - bs2 = 0xa0; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; - + avr910_devcode = 0x74; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x95 0x05; + has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; synchloops = 32; - bytedelay = 0; pollindex = 3; pollvalue = 0x53; predelay = 1; postdelay = 1; pollmethod = 1; - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; spmcr = 0x57; - allowfullpagebitstream = no; - ocdrev = 3; + chip_erase = "1010.1100--1000.0000--0000.0000--0000.0000"; + pgm_enable = "1010.1100--0101.0011--0000.0000--0000.0000"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 4; /* for parallel programming */ size = 1024; + page_size = 4; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 0 0 0 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 0 0 0 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 0 0 0 0 a9 a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; + readback = 0xff 0xff; + mode = 65; delay = 10; blocksize = 4; readsize = 256; - ; + read = "1010.0000--0000.00aa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.00aa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.00aa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 32768; + size = 0x8000; page_size = 128; num_pages = 256; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 0 0 0 0 0", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 0 0 0 0 0", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " x x x x x x x x"; - - mode = 0x41; + readback = 0xff 0xff; + mode = 65; delay = 10; blocksize = 128; readsize = 256; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 0 0 0 0 0", - "0 0 0 0 0 0 0 0 1 1 i i i i i i"; - min_write_delay = 9000; - max_write_delay = 9000; - ; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--0000.0000--aaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--0000.0000--aaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--0aaa.aaaa--aaaa.aaaa--xxxx.xxxx"; + ; memory "lfuse" size = 1; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "0 0 0 0 0 0 0 0 i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--1010.0000--0000.0000--iiii.iiii"; + ; memory "hfuse" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "0 0 0 0 0 0 0 0 i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--0000.0000--oooo.oooo"; + write = "1010.1100--1010.1000--0000.0000--iiii.iiii"; + ; memory "efuse" size = 1; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "0 0 0 0 0 0 0 0 1 1 1 1 1 i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--0000.0000--oooo.oooo"; + write = "1010.1100--1010.0100--0000.0000--1111.1iii"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1110.0000--0000.0000--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; + read = "0011.0000--0000.0000--0000.00aa--oooo.oooo"; + ; memory "calibration" size = 1; - - read = "0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - ; + read = "0011.1000--0000.0000--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega325A #------------------------------------------------------------ part parent "m325" - id = "m325a"; - desc = "ATmega325A"; - ; + desc = "ATmega325A"; + id = "m325a"; +; #------------------------------------------------------------ # ATmega325P #------------------------------------------------------------ part parent "m325" - id = "m325p"; - desc = "ATmega325P"; - signature = 0x1e 0x95 0x0d; - ; + desc = "ATmega325P"; + id = "m325p"; + signature = 0x1e 0x95 0x0d; +; #------------------------------------------------------------ # ATmega325PA #------------------------------------------------------------ part parent "m325" - id = "m325pa"; - desc = "ATmega325PA"; - signature = 0x1e 0x95 0x0d; - ; + desc = "ATmega325PA"; + id = "m325pa"; + signature = 0x1e 0x95 0x0d; +; #------------------------------------------------------------ # ATmega645 #------------------------------------------------------------ part - id = "m645"; - desc = "ATmega645"; - signature = 0x1E 0x96 0x05; - has_jtag = yes; + desc = "ATmega645"; + id = "m645"; # stk500_devcode = 0x??; # No STK500v1 support? # avr910_devcode = 0x??; # Try the ATmega16 one - avr910_devcode = 0x74; - pagel = 0xd7; - bs2 = 0xa0; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; - + avr910_devcode = 0x74; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x96 0x05; + has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; synchloops = 32; - bytedelay = 0; pollindex = 3; pollvalue = 0x53; predelay = 1; postdelay = 1; pollmethod = 1; - pp_controlstack = - 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, - 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, - 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, - 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; - progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; - idr = 0x31; spmcr = 0x57; - allowfullpagebitstream = no; - ocdrev = 3; + chip_erase = "1010.1100--1000.0000--0000.0000--0000.0000"; + pgm_enable = "1010.1100--0101.0011--0000.0000--0000.0000"; memory "eeprom" - paged = no; /* leave this "no" */ - page_size = 8; /* for parallel programming */ size = 2048; + page_size = 8; min_write_delay = 9000; max_write_delay = 9000; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 0 0 0 a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", - " x x x x x x x x"; - - mode = 0x41; + readback = 0xff 0xff; + mode = 65; delay = 10; blocksize = 8; readsize = 256; - ; + read = "1010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.0aaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--0000.0aaa--aaaa.a000--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 65536; + size = 0x10000; page_size = 256; num_pages = 256; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 0 0 0 0 0", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 0 0 0 0 0", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " a15 a14 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " 0 0 0 0 0 0 0 0"; - - mode = 0x41; + readback = 0xff 0xff; + mode = 65; delay = 10; blocksize = 128; readsize = 256; - ; - - memory "lock" - size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 0 0 0 0 0", - "0 0 0 0 0 0 0 0 1 1 i i i i i i"; - min_write_delay = 9000; - max_write_delay = 9000; - ; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--0000.0000--aaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--0000.0000--aaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaaa.aaaa--0000.0000"; + ; memory "lfuse" size = 1; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "0 0 0 0 0 0 0 0 i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--1010.0000--0000.0000--iiii.iiii"; + ; memory "hfuse" size = 1; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "0 0 0 0 0 0 0 0 i i i i i i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.1000--0000.1000--0000.0000--oooo.oooo"; + write = "1010.1100--1010.1000--0000.0000--iiii.iiii"; + ; memory "efuse" size = 1; - - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "0 0 0 0 0 0 0 0 1 1 1 1 1 i i i"; min_write_delay = 9000; max_write_delay = 9000; - ; + read = "0101.0000--0000.1000--0000.0000--oooo.oooo"; + write = "1010.1100--1010.0100--0000.0000--1111.1iii"; + ; + + memory "lock" + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1110.0000--0000.0000--11ii.iiii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 a1 a0 o o o o o o o o"; - ; + read = "0011.0000--0000.0000--0000.00aa--oooo.oooo"; + ; memory "calibration" size = 1; - - read = "0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; - ; + read = "0011.1000--0000.0000--0000.0000--oooo.oooo"; + ; +; #------------------------------------------------------------ # ATmega645A #------------------------------------------------------------ part parent "m645" - id = "m645a"; - desc = "ATmega645A"; - ; + desc = "ATmega645A"; + id = "m645a"; +; #------------------------------------------------------------ # ATmega645P #------------------------------------------------------------ part parent "m645" - id = "m645p"; - desc = "ATmega645P"; - signature = 0x1e 0x96 0x0d; - ; + desc = "ATmega645P"; + id = "m645p"; + signature = 0x1e 0x96 0x0d; +; #------------------------------------------------------------ # ATmega3250 #------------------------------------------------------------ part parent "m325" - id = "m3250"; - desc = "ATmega3250"; - signature = 0x1E 0x95 0x06; - ; + desc = "ATmega3250"; + id = "m3250"; + signature = 0x1e 0x95 0x06; +; #------------------------------------------------------------ # ATmega3250A #------------------------------------------------------------ part parent "m325" - id = "m3250a"; - desc = "ATmega3250A"; - signature = 0x1E 0x95 0x06; - ; + desc = "ATmega3250A"; + id = "m3250a"; + signature = 0x1e 0x95 0x06; +; #------------------------------------------------------------ # ATmega3250P #------------------------------------------------------------ part parent "m325" - id = "m3250p"; - desc = "ATmega3250P"; - signature = 0x1E 0x95 0x0e; - ; + desc = "ATmega3250P"; + id = "m3250p"; + signature = 0x1e 0x95 0x0e; +; #------------------------------------------------------------ # ATmega3250PA #------------------------------------------------------------ part parent "m325" - id = "m3250pa"; - desc = "ATmega3250PA"; - signature = 0x1E 0x95 0x0e; - ; + desc = "ATmega3250PA"; + id = "m3250pa"; + signature = 0x1e 0x95 0x0e; +; #------------------------------------------------------------ # ATmega6450 #------------------------------------------------------------ part parent "m645" - id = "m6450"; - desc = "ATmega6450"; - signature = 0x1E 0x96 0x06; - ; + desc = "ATmega6450"; + id = "m6450"; + signature = 0x1e 0x96 0x06; +; #------------------------------------------------------------ # ATmega6450A #------------------------------------------------------------ part parent "m645" - id = "m6450a"; - desc = "ATmega6450A"; - signature = 0x1E 0x96 0x06; - ; + desc = "ATmega6450A"; + id = "m6450a"; + signature = 0x1e 0x96 0x06; +; #------------------------------------------------------------ # ATmega6450P #------------------------------------------------------------ part parent "m645" - id = "m6450p"; - desc = "ATmega6450P"; - signature = 0x1E 0x96 0x0e; - ; + desc = "ATmega6450P"; + id = "m6450p"; + signature = 0x1e 0x96 0x0e; +; #------------------------------------------------------------ # AVR XMEGA family common values #------------------------------------------------------------ part - id = ".xmega"; - desc = "AVR XMEGA family common values"; - has_pdi = yes; - nvm_base = 0x01c0; - mcu_base = 0x0090; - - memory "signature" - size = 3; - offset = 0x1000090; - ; - - memory "prodsig" - size = 0x32; - offset = 0x8e0200; - page_size = 0x32; - readsize = 0x32; - ; + desc = "AVR XMEGA family common values"; + id = ".xmega"; + has_pdi = yes; + mcu_base = 0x0090; + nvm_base = 0x01c0; memory "fuse1" - size = 1; - offset = 0x8f0021; + size = 1; + offset = 0x8f0021; ; memory "fuse2" - size = 1; - offset = 0x8f0022; + size = 1; + offset = 0x8f0022; ; memory "fuse4" - size = 1; - offset = 0x8f0024; + size = 1; + offset = 0x8f0024; ; memory "fuse5" - size = 1; - offset = 0x8f0025; + size = 1; + offset = 0x8f0025; ; memory "lock" - size = 1; - offset = 0x8f0027; + size = 1; + offset = 0x8f0027; + ; + + memory "signature" + size = 3; + offset = 0x1000090; + ; + + memory "prodsig" + size = 50; + page_size = 50; + offset = 0x8e0200; + readsize = 50; ; memory "data" # SRAM, only used to supply the offset - offset = 0x1000000; + offset = 0x1000000; ; ; @@ -15459,51 +11345,51 @@ part #------------------------------------------------------------ part parent ".xmega" - id = "x16a4u"; - desc = "ATxmega16A4U"; - signature = 0x1e 0x94 0x41; - usbpid = 0x2fe3; + desc = "ATxmega16A4U"; + id = "x16a4u"; + signature = 0x1e 0x94 0x41; + usbpid = 0x2fe3; memory "eeprom" - size = 0x400; - offset = 0x8c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x4000; - offset = 0x800000; - page_size = 0x100; - readsize = 0x100; - ; - - memory "apptable" - size = 0x1000; - offset = 0x803000; - page_size = 0x100; - readsize = 0x100; - ; - - memory "boot" - size = 0x1000; - offset = 0x804000; - page_size = 0x100; - readsize = 0x100; + size = 1024; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x5000; - offset = 0x800000; - page_size = 0x100; - readsize = 0x100; + size = 0x5000; + page_size = 256; + offset = 0x800000; + readsize = 256; + ; + + memory "application" + size = 0x4000; + page_size = 256; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 4096; + page_size = 256; + offset = 0x803000; + readsize = 256; + ; + + memory "boot" + size = 4096; + page_size = 256; + offset = 0x804000; + readsize = 256; ; memory "usersig" - size = 0x100; - offset = 0x8e0400; - page_size = 0x100; - readsize = 0x100; + size = 256; + page_size = 256; + offset = 0x8e0400; + readsize = 256; ; ; @@ -15512,9 +11398,9 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x16a4u" - id = "x16c4"; - desc = "ATxmega16C4"; - signature = 0x1e 0x94 0x43; + desc = "ATxmega16C4"; + id = "x16c4"; + signature = 0x1e 0x94 0x43; ; #------------------------------------------------------------ @@ -15522,9 +11408,9 @@ part parent "x16a4u" #------------------------------------------------------------ part parent "x16a4u" - id = "x16d4"; - desc = "ATxmega16D4"; - signature = 0x1e 0x94 0x42; + desc = "ATxmega16D4"; + id = "x16d4"; + signature = 0x1e 0x94 0x42; ; #------------------------------------------------------------ @@ -15532,14 +11418,12 @@ part parent "x16a4u" #------------------------------------------------------------ part parent "x16a4u" - id = "x16a4"; - desc = "ATxmega16A4"; - signature = 0x1e 0x94 0x41; - has_jtag = no; + desc = "ATxmega16A4"; + id = "x16a4"; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; ; @@ -15548,51 +11432,51 @@ part parent "x16a4u" #------------------------------------------------------------ part parent ".xmega" - id = "x32a4u"; - desc = "ATxmega32A4U"; - signature = 0x1e 0x95 0x41; - usbpid = 0x2fe4; + desc = "ATxmega32A4U"; + id = "x32a4u"; + signature = 0x1e 0x95 0x41; + usbpid = 0x2fe4; memory "eeprom" - size = 0x400; - offset = 0x8c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x8000; - offset = 0x800000; - page_size = 0x100; - readsize = 0x100; - ; - - memory "apptable" - size = 0x1000; - offset = 0x807000; - page_size = 0x100; - readsize = 0x100; - ; - - memory "boot" - size = 0x1000; - offset = 0x808000; - page_size = 0x100; - readsize = 0x100; + size = 1024; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x9000; - offset = 0x800000; - page_size = 0x100; - readsize = 0x100; + size = 0x9000; + page_size = 256; + offset = 0x800000; + readsize = 256; + ; + + memory "application" + size = 0x8000; + page_size = 256; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 4096; + page_size = 256; + offset = 0x807000; + readsize = 256; + ; + + memory "boot" + size = 4096; + page_size = 256; + offset = 0x808000; + readsize = 256; ; memory "usersig" - size = 0x100; - offset = 0x8e0400; - page_size = 0x100; - readsize = 0x100; + size = 256; + page_size = 256; + offset = 0x8e0400; + readsize = 256; ; ; @@ -15601,9 +11485,9 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x32a4u" - id = "x32c4"; - desc = "ATxmega32C4"; - signature = 0x1e 0x95 0x44; + desc = "ATxmega32C4"; + id = "x32c4"; + signature = 0x1e 0x95 0x44; ; #------------------------------------------------------------ @@ -15611,9 +11495,9 @@ part parent "x32a4u" #------------------------------------------------------------ part parent "x32a4u" - id = "x32d4"; - desc = "ATxmega32D4"; - signature = 0x1e 0x95 0x42; + desc = "ATxmega32D4"; + id = "x32d4"; + signature = 0x1e 0x95 0x42; ; #------------------------------------------------------------ @@ -15621,14 +11505,12 @@ part parent "x32a4u" #------------------------------------------------------------ part parent "x32a4u" - id = "x32a4"; - desc = "ATxmega32A4"; - signature = 0x1e 0x95 0x41; - has_jtag = no; + desc = "ATxmega32A4"; + id = "x32a4"; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; ; @@ -15637,51 +11519,51 @@ part parent "x32a4u" #------------------------------------------------------------ part parent ".xmega" - id = "x64a4u"; - desc = "ATxmega64A4U"; - signature = 0x1e 0x96 0x46; - usbpid = 0x2fe5; + desc = "ATxmega64A4U"; + id = "x64a4u"; + signature = 0x1e 0x96 0x46; + usbpid = 0x2fe5; memory "eeprom" - size = 0x800; - offset = 0x8c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x10000; - offset = 0x800000; - page_size = 0x100; - readsize = 0x100; - ; - - memory "apptable" - size = 0x1000; - offset = 0x80f000; - page_size = 0x100; - readsize = 0x100; - ; - - memory "boot" - size = 0x1000; - offset = 0x810000; - page_size = 0x100; - readsize = 0x100; + size = 2048; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x11000; - offset = 0x800000; - page_size = 0x100; - readsize = 0x100; + size = 0x11000; + page_size = 256; + offset = 0x800000; + readsize = 256; + ; + + memory "application" + size = 0x10000; + page_size = 256; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 4096; + page_size = 256; + offset = 0x80f000; + readsize = 256; + ; + + memory "boot" + size = 4096; + page_size = 256; + offset = 0x810000; + readsize = 256; ; memory "usersig" - size = 0x100; - offset = 0x8e0400; - page_size = 0x100; - readsize = 0x100; + size = 256; + page_size = 256; + offset = 0x8e0400; + readsize = 256; ; ; @@ -15690,10 +11572,10 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x64a4u" - id = "x64c3"; - desc = "ATxmega64C3"; - signature = 0x1e 0x96 0x49; - usbpid = 0x2fd6; + desc = "ATxmega64C3"; + id = "x64c3"; + signature = 0x1e 0x96 0x49; + usbpid = 0x2fd6; ; #------------------------------------------------------------ @@ -15701,9 +11583,9 @@ part parent "x64a4u" #------------------------------------------------------------ part parent "x64a4u" - id = "x64d3"; - desc = "ATxmega64D3"; - signature = 0x1e 0x96 0x4a; + desc = "ATxmega64D3"; + id = "x64d3"; + signature = 0x1e 0x96 0x4a; ; #------------------------------------------------------------ @@ -15711,9 +11593,9 @@ part parent "x64a4u" #------------------------------------------------------------ part parent "x64a4u" - id = "x64d4"; - desc = "ATxmega64D4"; - signature = 0x1e 0x96 0x47; + desc = "ATxmega64D4"; + id = "x64d4"; + signature = 0x1e 0x96 0x47; ; #------------------------------------------------------------ @@ -15721,14 +11603,14 @@ part parent "x64a4u" #------------------------------------------------------------ part parent "x64a4u" - id = "x64a1"; - desc = "ATxmega64A1"; - signature = 0x1e 0x96 0x4e; - has_jtag = yes; + desc = "ATxmega64A1"; + id = "x64a1"; + signature = 0x1e 0x96 0x4e; + has_jtag = yes; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; ; @@ -15737,10 +11619,9 @@ part parent "x64a4u" #------------------------------------------------------------ part parent "x64a1" - id = "x64a1u"; - desc = "ATxmega64A1U"; - signature = 0x1e 0x96 0x4e; - usbpid = 0x2fe8; + desc = "ATxmega64A1U"; + id = "x64a1u"; + usbpid = 0x2fe8; ; #------------------------------------------------------------ @@ -15748,9 +11629,9 @@ part parent "x64a1" #------------------------------------------------------------ part parent "x64a1" - id = "x64a3"; - desc = "ATxmega64A3"; - signature = 0x1e 0x96 0x42; + desc = "ATxmega64A3"; + id = "x64a3"; + signature = 0x1e 0x96 0x42; ; #------------------------------------------------------------ @@ -15758,10 +11639,9 @@ part parent "x64a1" #------------------------------------------------------------ part parent "x64a1" - id = "x64a3u"; - desc = "ATxmega64A3U"; - signature = 0x1e 0x96 0x42; - usbpid = 0x2fe5; + desc = "ATxmega64A3U"; + id = "x64a3u"; + signature = 0x1e 0x96 0x42; ; #------------------------------------------------------------ @@ -15769,9 +11649,9 @@ part parent "x64a1" #------------------------------------------------------------ part parent "x64a1" - id = "x64a4"; - desc = "ATxmega64A4"; - signature = 0x1e 0x96 0x46; + desc = "ATxmega64A4"; + id = "x64a4"; + signature = 0x1e 0x96 0x46; ; #------------------------------------------------------------ @@ -15779,10 +11659,10 @@ part parent "x64a1" #------------------------------------------------------------ part parent "x64a1" - id = "x64b1"; - desc = "ATxmega64B1"; - signature = 0x1e 0x96 0x52; - usbpid = 0x2fe1; + desc = "ATxmega64B1"; + id = "x64b1"; + signature = 0x1e 0x96 0x52; + usbpid = 0x2fe1; ; #------------------------------------------------------------ @@ -15790,10 +11670,10 @@ part parent "x64a1" #------------------------------------------------------------ part parent "x64a1" - id = "x64b3"; - desc = "ATxmega64B3"; - signature = 0x1e 0x96 0x51; - usbpid = 0x2fdf; + desc = "ATxmega64B3"; + id = "x64b3"; + signature = 0x1e 0x96 0x51; + usbpid = 0x2fdf; ; #------------------------------------------------------------ @@ -15801,51 +11681,51 @@ part parent "x64a1" #------------------------------------------------------------ part parent ".xmega" - id = "x128c3"; - desc = "ATxmega128C3"; - signature = 0x1e 0x97 0x52; - usbpid = 0x2fd7; + desc = "ATxmega128C3"; + id = "x128c3"; + signature = 0x1e 0x97 0x52; + usbpid = 0x2fd7; memory "eeprom" - size = 0x800; - offset = 0x8c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x20000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; - - memory "apptable" - size = 0x2000; - offset = 0x81e000; - page_size = 0x200; - readsize = 0x100; - ; - - memory "boot" - size = 0x2000; - offset = 0x820000; - page_size = 0x200; - readsize = 0x100; + size = 2048; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x22000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; + size = 0x22000; + page_size = 512; + offset = 0x800000; + readsize = 256; + ; + + memory "application" + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 8192; + page_size = 512; + offset = 0x81e000; + readsize = 256; + ; + + memory "boot" + size = 8192; + page_size = 512; + offset = 0x820000; + readsize = 256; ; memory "usersig" - size = 0x200; - offset = 0x8e0400; - page_size = 0x200; - readsize = 0x100; + size = 512; + page_size = 512; + offset = 0x8e0400; + readsize = 256; ; ; @@ -15854,9 +11734,9 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x128c3" - id = "x128d3"; - desc = "ATxmega128D3"; - signature = 0x1e 0x97 0x48; + desc = "ATxmega128D3"; + id = "x128d3"; + signature = 0x1e 0x97 0x48; ; #------------------------------------------------------------ @@ -15864,15 +11744,12 @@ part parent "x128c3" #------------------------------------------------------------ part parent "x128c3" - id = "x128d4"; - desc = "ATxmega128D4"; - signature = 0x1e 0x97 0x47; + desc = "ATxmega128D4"; + id = "x128d4"; + signature = 0x1e 0x97 0x47; memory "flash" - size = 0x22000; - offset = 0x800000; - page_size = 0x100; - readsize = 0x100; + page_size = 256; ; ; @@ -15881,14 +11758,14 @@ part parent "x128c3" #------------------------------------------------------------ part parent "x128c3" - id = "x128a1"; - desc = "ATxmega128A1"; - signature = 0x1e 0x97 0x4c; - has_jtag = yes; + desc = "ATxmega128A1"; + id = "x128a1"; + signature = 0x1e 0x97 0x4c; + has_jtag = yes; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; ; @@ -15897,9 +11774,9 @@ part parent "x128c3" #------------------------------------------------------------ part parent "x128a1" - id = "x128a1d"; - desc = "ATxmega128A1revD"; - signature = 0x1e 0x97 0x41; + desc = "ATxmega128A1revD"; + id = "x128a1d"; + signature = 0x1e 0x97 0x41; ; #------------------------------------------------------------ @@ -15907,10 +11784,9 @@ part parent "x128a1" #------------------------------------------------------------ part parent "x128a1" - id = "x128a1u"; - desc = "ATxmega128A1U"; - signature = 0x1e 0x97 0x4c; - usbpid = 0x2fed; + desc = "ATxmega128A1U"; + id = "x128a1u"; + usbpid = 0x2fed; ; #------------------------------------------------------------ @@ -15918,9 +11794,9 @@ part parent "x128a1" #------------------------------------------------------------ part parent "x128a1" - id = "x128a3"; - desc = "ATxmega128A3"; - signature = 0x1e 0x97 0x42; + desc = "ATxmega128A3"; + id = "x128a3"; + signature = 0x1e 0x97 0x42; ; #------------------------------------------------------------ @@ -15928,10 +11804,10 @@ part parent "x128a1" #------------------------------------------------------------ part parent "x128a1" - id = "x128a3u"; - desc = "ATxmega128A3U"; - signature = 0x1e 0x97 0x42; - usbpid = 0x2fe6; + desc = "ATxmega128A3U"; + id = "x128a3u"; + signature = 0x1e 0x97 0x42; + usbpid = 0x2fe6; ; #------------------------------------------------------------ @@ -15939,56 +11815,56 @@ part parent "x128a1" #------------------------------------------------------------ part parent ".xmega" - id = "x128a4"; - desc = "ATxmega128A4"; - signature = 0x1e 0x97 0x46; - has_jtag = yes; + desc = "ATxmega128A4"; + id = "x128a4"; + signature = 0x1e 0x97 0x46; + has_jtag = yes; memory "eeprom" - size = 0x800; - offset = 0x8c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x20000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; - - memory "apptable" - size = 0x1000; - offset = 0x81f000; - page_size = 0x200; - readsize = 0x100; - ; - - memory "boot" - size = 0x2000; - offset = 0x820000; - page_size = 0x200; - readsize = 0x100; + size = 2048; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x22000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; + size = 0x22000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; - memory "usersig" - size = 0x200; - offset = 0x8e0400; - page_size = 0x200; - readsize = 0x100; + memory "application" + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 4096; + page_size = 512; + offset = 0x81f000; + readsize = 256; + ; + + memory "boot" + size = 8192; + page_size = 512; + offset = 0x820000; + readsize = 256; ; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; + ; + + memory "usersig" + size = 512; + page_size = 512; + offset = 0x8e0400; + readsize = 256; ; ; @@ -15997,51 +11873,51 @@ part parent ".xmega" #------------------------------------------------------------ part parent ".xmega" - id = "x128a4u"; - desc = "ATxmega128A4U"; - signature = 0x1e 0x97 0x46; - usbpid = 0x2fde; + desc = "ATxmega128A4U"; + id = "x128a4u"; + signature = 0x1e 0x97 0x46; + usbpid = 0x2fde; memory "eeprom" - size = 0x800; - offset = 0x8c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x20000; - offset = 0x800000; - page_size = 0x100; - readsize = 0x100; - ; - - memory "apptable" - size = 0x1000; - offset = 0x81f000; - page_size = 0x100; - readsize = 0x100; - ; - - memory "boot" - size = 0x2000; - offset = 0x820000; - page_size = 0x100; - readsize = 0x100; + size = 2048; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x22000; - offset = 0x800000; - page_size = 0x100; - readsize = 0x100; + size = 0x22000; + page_size = 256; + offset = 0x800000; + readsize = 256; + ; + + memory "application" + size = 0x20000; + page_size = 256; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 4096; + page_size = 256; + offset = 0x81f000; + readsize = 256; + ; + + memory "boot" + size = 8192; + page_size = 256; + offset = 0x820000; + readsize = 256; ; memory "usersig" - size = 0x100; - offset = 0x8e0400; - page_size = 0x100; - readsize = 0x100; + size = 256; + page_size = 256; + offset = 0x8e0400; + readsize = 256; ; ; @@ -16050,57 +11926,57 @@ part parent ".xmega" #------------------------------------------------------------ part parent ".xmega" - id = "x128b1"; - desc = "ATxmega128B1"; - signature = 0x1e 0x97 0x4d; - usbpid = 0x2fea; - has_jtag = yes; + desc = "ATxmega128B1"; + id = "x128b1"; + signature = 0x1e 0x97 0x4d; + usbpid = 0x2fea; + has_jtag = yes; memory "eeprom" - size = 0x800; - offset = 0x8c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x20000; - offset = 0x800000; - page_size = 0x100; - readsize = 0x100; - ; - - memory "apptable" - size = 0x2000; - offset = 0x81e000; - page_size = 0x100; - readsize = 0x100; - ; - - memory "boot" - size = 0x2000; - offset = 0x820000; - page_size = 0x100; - readsize = 0x100; + size = 2048; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x22000; - offset = 0x800000; - page_size = 0x100; - readsize = 0x100; + size = 0x22000; + page_size = 256; + offset = 0x800000; + readsize = 256; ; - memory "usersig" - size = 0x100; - offset = 0x8e0400; - page_size = 0x100; - readsize = 0x100; + memory "application" + size = 0x20000; + page_size = 256; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 8192; + page_size = 256; + offset = 0x81e000; + readsize = 256; + ; + + memory "boot" + size = 8192; + page_size = 256; + offset = 0x820000; + readsize = 256; ; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; + ; + + memory "usersig" + size = 256; + page_size = 256; + offset = 0x8e0400; + readsize = 256; ; ; @@ -16109,10 +11985,10 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x128b1" - id = "x128b3"; - desc = "ATxmega128B3"; - signature = 0x1e 0x97 0x4b; - usbpid = 0x2fe0; + desc = "ATxmega128B3"; + id = "x128b3"; + signature = 0x1e 0x97 0x4b; + usbpid = 0x2fe0; ; #------------------------------------------------------------ @@ -16120,51 +11996,51 @@ part parent "x128b1" #------------------------------------------------------------ part parent ".xmega" - id = "x192c3"; - desc = "ATxmega192C3"; - signature = 0x1e 0x97 0x51; + desc = "ATxmega192C3"; + id = "x192c3"; + signature = 0x1e 0x97 0x51; # usbpid = 0x2f??; memory "eeprom" - size = 0x800; - offset = 0x8c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x30000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; - - memory "apptable" - size = 0x2000; - offset = 0x82e000; - page_size = 0x200; - readsize = 0x100; - ; - - memory "boot" - size = 0x2000; - offset = 0x830000; - page_size = 0x200; - readsize = 0x100; + size = 2048; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x32000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; + size = 0x32000; + page_size = 512; + offset = 0x800000; + readsize = 256; + ; + + memory "application" + size = 0x30000; + page_size = 512; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 8192; + page_size = 512; + offset = 0x82e000; + readsize = 256; + ; + + memory "boot" + size = 8192; + page_size = 512; + offset = 0x830000; + readsize = 256; ; memory "usersig" - size = 0x200; - offset = 0x8e0400; - page_size = 0x200; - readsize = 0x100; + size = 512; + page_size = 512; + offset = 0x8e0400; + readsize = 256; ; ; @@ -16173,9 +12049,9 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x192c3" - id = "x192d3"; - desc = "ATxmega192D3"; - signature = 0x1e 0x97 0x49; + desc = "ATxmega192D3"; + id = "x192d3"; + signature = 0x1e 0x97 0x49; ; #------------------------------------------------------------ @@ -16183,14 +12059,14 @@ part parent "x192c3" #------------------------------------------------------------ part parent "x192c3" - id = "x192a1"; - desc = "ATxmega192A1"; - signature = 0x1e 0x97 0x4e; - has_jtag = yes; + desc = "ATxmega192A1"; + id = "x192a1"; + signature = 0x1e 0x97 0x4e; + has_jtag = yes; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; ; @@ -16199,9 +12075,9 @@ part parent "x192c3" #------------------------------------------------------------ part parent "x192a1" - id = "x192a3"; - desc = "ATxmega192A3"; - signature = 0x1e 0x97 0x44; + desc = "ATxmega192A3"; + id = "x192a3"; + signature = 0x1e 0x97 0x44; ; #------------------------------------------------------------ @@ -16209,10 +12085,10 @@ part parent "x192a1" #------------------------------------------------------------ part parent "x192a1" - id = "x192a3u"; - desc = "ATxmega192A3U"; - signature = 0x1e 0x97 0x44; - usbpid = 0x2fe7; + desc = "ATxmega192A3U"; + id = "x192a3u"; + signature = 0x1e 0x97 0x44; + usbpid = 0x2fe7; ; #------------------------------------------------------------ @@ -16220,51 +12096,51 @@ part parent "x192a1" #------------------------------------------------------------ part parent ".xmega" - id = "x256c3"; - desc = "ATxmega256C3"; - signature = 0x1e 0x98 0x46; - usbpid = 0x2fda; + desc = "ATxmega256C3"; + id = "x256c3"; + signature = 0x1e 0x98 0x46; + usbpid = 0x2fda; memory "eeprom" - size = 0x1000; - offset = 0x8c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x40000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; - - memory "apptable" - size = 0x2000; - offset = 0x83e000; - page_size = 0x200; - readsize = 0x100; - ; - - memory "boot" - size = 0x2000; - offset = 0x840000; - page_size = 0x200; - readsize = 0x100; + size = 4096; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x42000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; + size = 0x42000; + page_size = 512; + offset = 0x800000; + readsize = 256; + ; + + memory "application" + size = 0x40000; + page_size = 512; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 8192; + page_size = 512; + offset = 0x83e000; + readsize = 256; + ; + + memory "boot" + size = 8192; + page_size = 512; + offset = 0x840000; + readsize = 256; ; memory "usersig" - size = 0x200; - offset = 0x8e0400; - page_size = 0x200; - readsize = 0x100; + size = 512; + page_size = 512; + offset = 0x8e0400; + readsize = 256; ; ; @@ -16273,9 +12149,9 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x256c3" - id = "x256d3"; - desc = "ATxmega256D3"; - signature = 0x1e 0x98 0x44; + desc = "ATxmega256D3"; + id = "x256d3"; + signature = 0x1e 0x98 0x44; ; #------------------------------------------------------------ @@ -16283,14 +12159,13 @@ part parent "x256c3" #------------------------------------------------------------ part parent "x256c3" - id = "x256a1"; - desc = "ATxmega256A1"; - signature = 0x1e 0x98 0x46; - has_jtag = yes; + desc = "ATxmega256A1"; + id = "x256a1"; + has_jtag = yes; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; ; @@ -16299,9 +12174,9 @@ part parent "x256c3" #------------------------------------------------------------ part parent "x256a1" - id = "x256a3"; - desc = "ATxmega256A3"; - signature = 0x1e 0x98 0x42; + desc = "ATxmega256A3"; + id = "x256a3"; + signature = 0x1e 0x98 0x42; ; #------------------------------------------------------------ @@ -16309,10 +12184,10 @@ part parent "x256a1" #------------------------------------------------------------ part parent "x256a1" - id = "x256a3u"; - desc = "ATxmega256A3U"; - signature = 0x1e 0x98 0x42; - usbpid = 0x2fec; + desc = "ATxmega256A3U"; + id = "x256a3u"; + signature = 0x1e 0x98 0x42; + usbpid = 0x2fec; ; #------------------------------------------------------------ @@ -16320,9 +12195,9 @@ part parent "x256a1" #------------------------------------------------------------ part parent "x256a1" - id = "x256a3b"; - desc = "ATxmega256A3B"; - signature = 0x1e 0x98 0x43; + desc = "ATxmega256A3B"; + id = "x256a3b"; + signature = 0x1e 0x98 0x43; ; #------------------------------------------------------------ @@ -16330,10 +12205,10 @@ part parent "x256a1" #------------------------------------------------------------ part parent "x256a1" - id = "x256a3bu"; - desc = "ATxmega256A3BU"; - signature = 0x1e 0x98 0x43; - usbpid = 0x2fe2; + desc = "ATxmega256A3BU"; + id = "x256a3bu"; + signature = 0x1e 0x98 0x43; + usbpid = 0x2fe2; ; #------------------------------------------------------------ @@ -16341,51 +12216,51 @@ part parent "x256a1" #------------------------------------------------------------ part parent ".xmega" - id = "x384c3"; - desc = "ATxmega384C3"; - signature = 0x1e 0x98 0x45; - usbpid = 0x2fdb; + desc = "ATxmega384C3"; + id = "x384c3"; + signature = 0x1e 0x98 0x45; + usbpid = 0x2fdb; memory "eeprom" - size = 0x1000; - offset = 0x8c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x60000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; - - memory "apptable" - size = 0x2000; - offset = 0x85e000; - page_size = 0x200; - readsize = 0x100; - ; - - memory "boot" - size = 0x2000; - offset = 0x860000; - page_size = 0x200; - readsize = 0x100; + size = 4096; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x62000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; + size = 0x62000; + page_size = 512; + offset = 0x800000; + readsize = 256; + ; + + memory "application" + size = 0x60000; + page_size = 512; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 8192; + page_size = 512; + offset = 0x85e000; + readsize = 256; + ; + + memory "boot" + size = 8192; + page_size = 512; + offset = 0x860000; + readsize = 256; ; memory "usersig" - size = 0x200; - offset = 0x8e0400; - page_size = 0x200; - readsize = 0x100; + size = 512; + page_size = 512; + offset = 0x8e0400; + readsize = 256; ; ; @@ -16394,9 +12269,9 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x384c3" - id = "x384d3"; - desc = "ATxmega384D3"; - signature = 0x1e 0x98 0x47; + desc = "ATxmega384D3"; + id = "x384d3"; + signature = 0x1e 0x98 0x47; ; #------------------------------------------------------------ @@ -16404,50 +12279,50 @@ part parent "x384c3" #------------------------------------------------------------ part parent ".xmega" - id = "x8e5"; - desc = "ATxmega8E5"; - signature = 0x1e 0x93 0x41; + desc = "ATxmega8E5"; + id = "x8e5"; + signature = 0x1e 0x93 0x41; memory "eeprom" - size = 0x0200; - offset = 0x08c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x2000; - offset = 0x0800000; - page_size = 0x80; - readsize = 0x100; - ; - - memory "apptable" - size = 0x800; - offset = 0x00801800; - page_size = 0x80; - readsize = 0x100; - ; - - memory "boot" - size = 0x800; - offset = 0x00802000; - page_size = 0x80; - readsize = 0x100; + size = 512; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x2800; - offset = 0x0800000; - page_size = 0x80; - readsize = 0x100; + size = 0x2800; + page_size = 128; + offset = 0x800000; + readsize = 256; + ; + + memory "application" + size = 8192; + page_size = 128; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 2048; + page_size = 128; + offset = 0x801800; + readsize = 256; + ; + + memory "boot" + size = 2048; + page_size = 128; + offset = 0x802000; + readsize = 256; ; memory "usersig" - size = 0x80; + size = 128; + page_size = 128; offset = 0x8e0400; - page_size = 0x80; - readsize = 0x100; + readsize = 256; ; ; @@ -16456,50 +12331,50 @@ part parent ".xmega" #------------------------------------------------------------ part parent ".xmega" - id = "x16e5"; - desc = "ATxmega16E5"; - signature = 0x1e 0x94 0x45; + desc = "ATxmega16E5"; + id = "x16e5"; + signature = 0x1e 0x94 0x45; memory "eeprom" - size = 0x0200; - offset = 0x08c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x4000; - offset = 0x0800000; - page_size = 0x80; - readsize = 0x100; - ; - - memory "apptable" - size = 0x1000; - offset = 0x00803000; - page_size = 0x80; - readsize = 0x100; - ; - - memory "boot" - size = 0x1000; - offset = 0x00804000; - page_size = 0x80; - readsize = 0x100; + size = 512; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x5000; - offset = 0x0800000; - page_size = 0x80; - readsize = 0x100; + size = 0x5000; + page_size = 128; + offset = 0x800000; + readsize = 256; + ; + + memory "application" + size = 0x4000; + page_size = 128; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 4096; + page_size = 128; + offset = 0x803000; + readsize = 256; + ; + + memory "boot" + size = 4096; + page_size = 128; + offset = 0x804000; + readsize = 256; ; memory "usersig" - size = 0x80; + size = 128; + page_size = 128; offset = 0x8e0400; - page_size = 0x80; - readsize = 0x100; + readsize = 256; ; ; @@ -16508,50 +12383,50 @@ part parent ".xmega" #------------------------------------------------------------ part parent ".xmega" - id = "x32e5"; - desc = "ATxmega32E5"; - signature = 0x1e 0x95 0x4c; + desc = "ATxmega32E5"; + id = "x32e5"; + signature = 0x1e 0x95 0x4c; memory "eeprom" - size = 0x0400; - offset = 0x08c0000; - page_size = 0x20; - readsize = 0x100; - ; - - memory "application" - size = 0x8000; - offset = 0x0800000; - page_size = 0x80; - readsize = 0x100; - ; - - memory "apptable" - size = 0x1000; - offset = 0x00807000; - page_size = 0x80; - readsize = 0x100; - ; - - memory "boot" - size = 0x1000; - offset = 0x00808000; - page_size = 0x80; - readsize = 0x100; + size = 1024; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x9000; - offset = 0x0800000; - page_size = 0x80; - readsize = 0x100; + size = 0x9000; + page_size = 128; + offset = 0x800000; + readsize = 256; + ; + + memory "application" + size = 0x8000; + page_size = 128; + offset = 0x800000; + readsize = 256; + ; + + memory "apptable" + size = 4096; + page_size = 128; + offset = 0x807000; + readsize = 256; + ; + + memory "boot" + size = 4096; + page_size = 128; + offset = 0x808000; + readsize = 256; ; memory "usersig" - size = 0x80; + size = 128; + page_size = 128; offset = 0x8e0400; - page_size = 0x80; - readsize = 0x100; + readsize = 256; ; ; @@ -16560,25 +12435,29 @@ part parent ".xmega" #------------------------------------------------------------ part - id = "uc3a0512"; - desc = "AT32UC3A0512"; - signature = 0xED 0xC0 0x3F; - has_jtag = yes; - is_avr32 = yes; + desc = "AT32UC3A0512"; + id = "uc3a0512"; + signature = 0xed 0xc0 0x3f; + has_jtag = yes; + is_avr32 = yes; memory "flash" paged = yes; + size = 0x80000; # could be set dynamicly page_size = 512; # bytes - readsize = 512; # bytes num_pages = 1024; # could be set dynamicly - size = 0x00080000; # could be set dynamicly offset = 0x80000000; + readsize = 512; # bytes ; ; +#------------------------------------------------------------ +# deprecated, use 'uc3a0512' +#------------------------------------------------------------ + part parent "uc3a0512" - id = "ucr2"; - desc = "deprecated, use 'uc3a0512'"; + desc = "deprecated, use 'uc3a0512'"; + id = "ucr2"; ; #------------------------------------------------------------ @@ -16586,188 +12465,123 @@ part parent "uc3a0512" #------------------------------------------------------------ part - id = "t1634"; - desc = "ATtiny1634"; - has_debugwire = yes; - flash_instr = 0xB6, 0x01, 0x11; - eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, - 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF, - 0x99, 0xF9, 0xBB, 0xAF; - stk500_devcode = 0x86; + desc = "ATtiny1634"; + id = "t1634"; + stk500_devcode = 0x86; + chip_erase_delay = 9000; + pagel = 0xb3; + bs2 = 0xb1; # avr910_devcode = 0x; - signature = 0x1e 0x94 0x12; - pagel = 0xB3; - bs2 = 0xB1; - reset = io; - chip_erase_delay = 9000; - pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", - "x x x x x x x x x x x x x x x x"; - - chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", - "x x x x x x x x x x x x x x x x"; - - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - bytedelay = 0; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - + signature = 0x1e 0x94 0x12; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; pp_controlstack = - 0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E, - 0x4E, 0x5E, 0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E, - 0x26, 0x36, 0x66, 0x76, 0x2A, 0x3A, 0x6A, 0x7A, - 0x2E, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + 0x0e, 0x1e, 0x0e, 0x1e, 0x2e, 0x3e, 0x2e, 0x3e, + 0x4e, 0x5e, 0x4e, 0x5e, 0x6e, 0x7e, 0x6e, 0x7e, + 0x26, 0x36, 0x66, 0x76, 0x2a, 0x3a, 0x6a, 0x7a, + 0x2e, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = + 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, + 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, + 0x99, 0xf9, 0xbb, 0xaf; hventerstabdelay = 100; - progmodedelay = 0; - latchcycles = 0; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; - resetdelayus = 0; hvleavestabdelay = 15; resetdelay = 15; - chiperasepulsewidth = 0; chiperasepolltimeout = 10; - programfusepulsewidth = 0; programfusepolltimeout = 5; - programlockpulsewidth = 0; programlockpolltimeout = 5; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = no; - page_size = 4; size = 256; + page_size = 4; min_write_delay = 3600; max_write_delay = 3600; - readback_p1 = 0xff; - readback_p2 = 0xff; - read = " 1 0 1 0 0 0 0 0", - " 0 0 0 x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - write = " 1 1 0 0 0 0 0 0", - " 0 0 0 x x x x a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_lo = " 1 1 0 0 0 0 0 1", - " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 0 a1 a0", - " i i i i i i i i"; - - writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x a8", - " a7 a6 a5 a4 a3 a2 0 0", - " x x x x x x x x"; - - mode = 0x41; - delay = 5; - blocksize = 4; - readsize = 256; - ; + readback = 0xff 0xff; + mode = 65; + delay = 5; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + ; memory "flash" paged = yes; - size = 16384; + size = 0x4000; page_size = 32; num_pages = 512; min_write_delay = 4500; max_write_delay = 4500; - readback_p1 = 0xff; - readback_p2 = 0xff; - read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 a3 a2 a1 a0", - " o o o o o o o o"; - - loadpage_lo = " 0 1 0 0 0 0 0 0", - " 0 0 0 x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - - loadpage_hi = " 0 1 0 0 1 0 0 0", - " 0 0 0 x x x x x", - " x x x x a3 a2 a1 a0", - " i i i i i i i i"; - - writepage = " 0 1 0 0 1 1 0 0", - " 0 0 a13 a12 a11 a10 a9 a8", - " a7 a6 a5 a4 x x x x", - " x x x x x x x x"; - - mode = 0x41; - delay = 6; - blocksize = 128; - readsize = 256; - - ; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + writepage = "0100.1100--00aa.aaaa--aaaa.xxxx--xxxx.xxxx"; + ; memory "lfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + ; memory "hfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", - "x x x x x x x x i i i i i i i i"; - ; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + ; memory "efuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", - "x x x x x x x x x x x i i i i i"; - ; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxi.iiii"; + ; memory "lock" size = 1; min_write_delay = 4500; max_write_delay = 4500; - read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", - "x x x x x x x x o o o o o o o o"; - - write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", - "x x x x x x x x 1 1 1 1 1 1 i i"; - ; - - memory "calibration" - size = 1; - read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", - "0 0 0 0 0 0 0 0 o o o o o o o o"; - ; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--1111.11ii"; + ; memory "signature" size = 3; - read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", - "x x x x x x a1 a0 o o o o o o o o"; - ; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + ; + + memory "calibration" + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + ; ; #------------------------------------------------------------ @@ -16775,42 +12589,48 @@ part #------------------------------------------------------------ part parent "t1634" - id = "t1634r"; - desc = "ATtiny1634R"; - ; + desc = "ATtiny1634R"; + id = "t1634r"; +; #------------------------------------------------------------ # Common values for reduced core tinys (4/5/9/10/20/40) #------------------------------------------------------------ part - id = ".reduced_core_tiny"; - desc = "Common values for reduced core tinys"; - has_tpi = yes; - - memory "signature" - size = 3; - offset = 0x3fc0; - page_size = 16; - ; + desc = "Common values for reduced core tinys"; + id = ".reduced_core_tiny"; + has_tpi = yes; memory "fuse" - size = 1; - offset = 0x3f40; - page_size = 16; - blocksize = 4; - ; - - memory "calibration" - size = 1; - offset = 0x3f80; - page_size = 16; + size = 1; + page_size = 16; + offset = 0x3f40; + blocksize = 4; ; memory "lockbits" - size = 1; - offset = 0x3f00; - page_size = 16; + size = 1; + page_size = 16; + offset = 0x3f00; + ; + + memory "lockbits" + size = 1; + page_size = 16; + offset = 0x3f00; + ; + + memory "signature" + size = 3; + page_size = 16; + offset = 0x3fc0; + ; + + memory "calibration" + size = 1; + page_size = 16; + offset = 0x3f80; ; ; @@ -16819,15 +12639,15 @@ part #------------------------------------------------------------ part parent ".reduced_core_tiny" - id = "t4"; - desc = "ATtiny4"; - signature = 0x1e 0x8f 0x0a; + desc = "ATtiny4"; + id = "t4"; + signature = 0x1e 0x8f 0x0a; memory "flash" - size = 512; - offset = 0x4000; - page_size = 16; - blocksize = 128; + size = 512; + page_size = 16; + offset = 0x4000; + blocksize = 128; ; ; @@ -16836,9 +12656,9 @@ part parent ".reduced_core_tiny" #------------------------------------------------------------ part parent "t4" - id = "t5"; - desc = "ATtiny5"; - signature = 0x1e 0x8f 0x09; + desc = "ATtiny5"; + id = "t5"; + signature = 0x1e 0x8f 0x09; ; #------------------------------------------------------------ @@ -16846,15 +12666,15 @@ part parent "t4" #------------------------------------------------------------ part parent ".reduced_core_tiny" - id = "t9"; - desc = "ATtiny9"; - signature = 0x1e 0x90 0x08; + desc = "ATtiny9"; + id = "t9"; + signature = 0x1e 0x90 0x08; memory "flash" - size = 1024; - offset = 0x4000; - page_size = 16; - blocksize = 128; + size = 1024; + page_size = 16; + offset = 0x4000; + blocksize = 128; ; ; @@ -16863,9 +12683,9 @@ part parent ".reduced_core_tiny" #------------------------------------------------------------ part parent "t9" - id = "t10"; - desc = "ATtiny10"; - signature = 0x1e 0x90 0x03; + desc = "ATtiny10"; + id = "t10"; + signature = 0x1e 0x90 0x03; ; #------------------------------------------------------------ @@ -16873,14 +12693,14 @@ part parent "t9" #------------------------------------------------------------ part parent ".reduced_core_tiny" - id = "t20"; - desc = "ATtiny20"; - signature = 0x1e 0x91 0x0F; + desc = "ATtiny20"; + id = "t20"; + signature = 0x1e 0x91 0x0f; memory "flash" size = 2048; - offset = 0x4000; page_size = 16; + offset = 0x4000; blocksize = 128; ; ; @@ -16890,15 +12710,15 @@ part parent ".reduced_core_tiny" #------------------------------------------------------------ part parent ".reduced_core_tiny" - id = "t40"; - desc = "ATtiny40"; - signature = 0x1e 0x92 0x0E; + desc = "ATtiny40"; + id = "t40"; + signature = 0x1e 0x92 0x0e; memory "flash" - size = 4096; - offset = 0x4000; - page_size = 64; - blocksize = 128; + size = 4096; + page_size = 64; + offset = 0x4000; + blocksize = 128; ; ; @@ -16907,15 +12727,15 @@ part parent ".reduced_core_tiny" #------------------------------------------------------------ part parent ".reduced_core_tiny" - id = "t102"; - desc = "ATtiny102"; - signature = 0x1e 0x90 0x0C; + desc = "ATtiny102"; + id = "t102"; + signature = 0x1e 0x90 0x0c; memory "flash" - size = 1024; - offset = 0x4000; - page_size = 16; - blocksize = 128; + size = 1024; + page_size = 16; + offset = 0x4000; + blocksize = 128; ; ; @@ -16924,15 +12744,15 @@ part parent ".reduced_core_tiny" #------------------------------------------------------------ part parent ".reduced_core_tiny" - id = "t104"; - desc = "ATtiny104"; - signature = 0x1e 0x90 0x0B; + desc = "ATtiny104"; + id = "t104"; + signature = 0x1e 0x90 0x0b; memory "flash" - size = 1024; - offset = 0x4000; - page_size = 16; - blocksize = 128; + size = 1024; + page_size = 16; + offset = 0x4000; + blocksize = 128; ; ; @@ -16941,59 +12761,55 @@ part parent ".reduced_core_tiny" #------------------------------------------------------------ part - id = "m406"; - desc = "ATmega406"; - has_jtag = yes; - signature = 0x1e 0x95 0x07; - + desc = "ATmega406"; + id = "m406"; # STK500 parameters (parallel programming IO lines) - pagel = 0xa7; - bs2 = 0xa0; - serial = no; - parallel = yes; - + pagel = 0xa7; + bs2 = 0xa0; + signature = 0x1e 0x95 0x07; + has_jtag = yes; + serial = no; # STK500v2 HV programming parameters, from XML - pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, - 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, - 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, - 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - - # JTAG ICE mkII parameters, also from XML files - allowfullpagebitstream = no; - enablepageprogramming = yes; - idr = 0x51; - rampz = 0x00; - spmcr = 0x57; - eecr = 0x3f; + pp_controlstack = + 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, + 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, + 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, + 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; + idr = 0x51; + spmcr = 0x57; + eecr = 0x3f; memory "eeprom" - paged = no; - size = 512; - page_size = 4; - blocksize = 4; - readsize = 4; - num_pages = 128; + size = 512; + page_size = 4; + num_pages = 128; + blocksize = 4; + readsize = 4; ; memory "flash" - paged = yes; - size = 40960; - page_size = 128; - blocksize = 128; - readsize = 128; - num_pages = 320; - ; - - memory "hfuse" - size = 1; + paged = yes; + size = 0xa000; + page_size = 128; + num_pages = 320; + blocksize = 128; + readsize = 128; ; memory "lfuse" size = 1; ; + memory "hfuse" + size = 1; + ; + memory "lockbits" - size = 1; + size = 1; + ; + + memory "lockbits" + size = 1; ; memory "signature" @@ -17006,72 +12822,16 @@ part #------------------------------------------------------------ part - id = ".avr8x"; - desc = "AVR8X family common values"; - has_updi = yes; - nvm_base = 0x1000; - ocd_base = 0x0F80; - - memory "signature" - size = 3; - offset = 0x1100; - readsize = 0x3; - ; - - memory "prodsig" - size = 0x3D; - offset = 0x1103; - page_size = 0x3D; - readsize = 0x3D; - ; - - memory "sernum" - size = 10; - offset = 0x1104; - readsize = 1; - ; - - memory "osccal16" - size = 2; - offset = 0x1118; - readsize = 1; - ; - - memory "osccal20" - size = 2; - offset = 0x111A; - readsize = 1; - ; - - memory "tempsense" - size = 2; - offset = 0x1120; - readsize = 1; - ; - - memory "osc16err" - size = 2; - offset = 0x1122; - readsize = 1; - ; - - memory "osc20err" - size = 2; - offset = 0x1124; - readsize = 1; - ; - - memory "fuses" - size = 9; - offset = 0x1280; - page_size = 0x0A; - readsize = 0x0A; - ; + desc = "AVR8X family common values"; + id = ".avr8x"; + has_updi = yes; + nvm_base = 0x1000; + ocd_base = 0x0f80; memory "fuse0" - size = 1; - offset = 0x1280; - readsize = 1; + size = 1; + offset = 0x1280; + readsize = 1; ; memory "wdtcfg" @@ -17079,9 +12839,9 @@ part ; memory "fuse1" - size = 1; - offset = 0x1281; - readsize = 1; + size = 1; + offset = 0x1281; + readsize = 1; ; memory "bodcfg" @@ -17089,9 +12849,9 @@ part ; memory "fuse2" - size = 1; - offset = 0x1282; - readsize = 1; + size = 1; + offset = 0x1282; + readsize = 1; ; memory "osccfg" @@ -17099,9 +12859,9 @@ part ; memory "fuse4" - size = 1; - offset = 0x1284; - readsize = 1; + size = 1; + offset = 0x1284; + readsize = 1; ; memory "tcd0cfg" @@ -17109,9 +12869,9 @@ part ; memory "fuse5" - size = 1; - offset = 0x1285; - readsize = 1; + size = 1; + offset = 0x1285; + readsize = 1; ; memory "syscfg0" @@ -17119,9 +12879,9 @@ part ; memory "fuse6" - size = 1; - offset = 0x1286; - readsize = 1; + size = 1; + offset = 0x1286; + readsize = 1; ; memory "syscfg1" @@ -17129,9 +12889,9 @@ part ; memory "fuse7" - size = 1; - offset = 0x1287; - readsize = 1; + size = 1; + offset = 0x1287; + readsize = 1; ; memory "append" @@ -17143,9 +12903,9 @@ part ; memory "fuse8" - size = 1; - offset = 0x1288; - readsize = 1; + size = 1; + offset = 0x1288; + readsize = 1; ; memory "bootend" @@ -17156,15 +12916,71 @@ part alias "fuse8"; ; + memory "fuses" + size = 9; + page_size = 10; + offset = 0x1280; + readsize = 10; + ; + memory "lock" - size = 1; - offset = 0x128a; - readsize = 1; + size = 1; + offset = 0x128a; + readsize = 1; + ; + + memory "tempsense" + size = 2; + offset = 0x1120; + readsize = 1; + ; + + memory "signature" + size = 3; + offset = 0x1100; + readsize = 3; + ; + + memory "prodsig" + size = 61; + page_size = 61; + offset = 0x1103; + readsize = 61; + ; + + memory "sernum" + size = 10; + offset = 0x1104; + readsize = 1; + ; + + memory "osccal16" + size = 2; + offset = 0x1118; + readsize = 1; + ; + + memory "osccal20" + size = 2; + offset = 0x111a; + readsize = 1; + ; + + memory "osc16err" + size = 2; + offset = 0x1122; + readsize = 1; + ; + + memory "osc20err" + size = 2; + offset = 0x1124; + readsize = 1; ; memory "data" # SRAM, only used to supply the offset - offset = 0x1000000; + offset = 0x1000000; ; ; @@ -17173,17 +12989,17 @@ part #------------------------------------------------------------ part parent ".avr8x" - id = ".avr8x_tiny"; - desc = "AVR8X tiny family common values"; - family_id = "tinyAVR"; + desc = "AVR8X tiny family common values"; + id = ".avr8x_tiny"; + family_id = "tinyAVR"; # Shared UPDI pin, HV on UPDI pin - hvupdi_variant = 0; + hvupdi_variant = 0; memory "userrow" - size = 0x20; - offset = 0x1300; - page_size = 0x20; - readsize = 0x100; + size = 32; + page_size = 32; + offset = 0x1300; + readsize = 256; ; memory "usersig" @@ -17196,17 +13012,17 @@ part parent ".avr8x" #------------------------------------------------------------ part parent ".avr8x" - id = ".avr8x_mega"; - desc = "AVR8X mega family common values"; - family_id = "megaAVR"; + desc = "AVR8X mega family common values"; + id = ".avr8x_mega"; + family_id = "megaAVR"; # Dedicated UPDI pin, no HV - hvupdi_variant = 1; + hvupdi_variant = 1; memory "userrow" - size = 0x40; - offset = 0x1300; - page_size = 0x40; - readsize = 0x100; + size = 64; + page_size = 64; + offset = 0x1300; + readsize = 256; ; memory "usersig" @@ -17218,23 +13034,23 @@ part parent ".avr8x" # ATtiny202 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t202"; - desc = "ATtiny202"; - signature = 0x1E 0x91 0x23; - - memory "flash" - size = 0x800; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny202"; + id = "t202"; + signature = 0x1e 0x91 0x23; memory "eeprom" - size = 0x40; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 64; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 2048; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17242,23 +13058,23 @@ part parent ".avr8x_tiny" # ATtiny204 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t204"; - desc = "ATtiny204"; - signature = 0x1E 0x91 0x22; - - memory "flash" - size = 0x800; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny204"; + id = "t204"; + signature = 0x1e 0x91 0x22; memory "eeprom" - size = 0x40; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 64; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 2048; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17266,23 +13082,23 @@ part parent ".avr8x_tiny" # ATtiny402 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t402"; - desc = "ATtiny402"; - signature = 0x1E 0x92 0x27; - - memory "flash" - size = 0x1000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny402"; + id = "t402"; + signature = 0x1e 0x92 0x27; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17290,23 +13106,23 @@ part parent ".avr8x_tiny" # ATtiny404 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t404"; - desc = "ATtiny404"; - signature = 0x1E 0x92 0x26; - - memory "flash" - size = 0x1000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny404"; + id = "t404"; + signature = 0x1e 0x92 0x26; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17314,23 +13130,23 @@ part parent ".avr8x_tiny" # ATtiny406 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t406"; - desc = "ATtiny406"; - signature = 0x1E 0x92 0x25; - - memory "flash" - size = 0x1000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny406"; + id = "t406"; + signature = 0x1e 0x92 0x25; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17338,23 +13154,23 @@ part parent ".avr8x_tiny" # ATtiny804 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t804"; - desc = "ATtiny804"; - signature = 0x1E 0x93 0x25; - - memory "flash" - size = 0x2000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny804"; + id = "t804"; + signature = 0x1e 0x93 0x25; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17362,23 +13178,23 @@ part parent ".avr8x_tiny" # ATtiny806 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t806"; - desc = "ATtiny806"; - signature = 0x1E 0x93 0x24; - - memory "flash" - size = 0x2000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny806"; + id = "t806"; + signature = 0x1e 0x93 0x24; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17386,23 +13202,23 @@ part parent ".avr8x_tiny" # ATtiny807 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t807"; - desc = "ATtiny807"; - signature = 0x1E 0x93 0x23; - - memory "flash" - size = 0x2000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny807"; + id = "t807"; + signature = 0x1e 0x93 0x23; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17410,23 +13226,23 @@ part parent ".avr8x_tiny" # ATtiny1604 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t1604"; - desc = "ATtiny1604"; - signature = 0x1E 0x94 0x25; - - memory "flash" - size = 0x4000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny1604"; + id = "t1604"; + signature = 0x1e 0x94 0x25; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17434,23 +13250,23 @@ part parent ".avr8x_tiny" # ATtiny1606 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t1606"; - desc = "ATtiny1606"; - signature = 0x1E 0x94 0x24; - - memory "flash" - size = 0x4000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny1606"; + id = "t1606"; + signature = 0x1e 0x94 0x24; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17458,23 +13274,23 @@ part parent ".avr8x_tiny" # ATtiny1607 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t1607"; - desc = "ATtiny1607"; - signature = 0x1E 0x94 0x23; - - memory "flash" - size = 0x4000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny1607"; + id = "t1607"; + signature = 0x1e 0x94 0x23; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17482,23 +13298,23 @@ part parent ".avr8x_tiny" # ATtiny212 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t212"; - desc = "ATtiny212"; - signature = 0x1E 0x91 0x21; - - memory "flash" - size = 0x800; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny212"; + id = "t212"; + signature = 0x1e 0x91 0x21; memory "eeprom" - size = 0x40; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 64; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 2048; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17506,23 +13322,23 @@ part parent ".avr8x_tiny" # ATtiny214 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t214"; - desc = "ATtiny214"; - signature = 0x1E 0x91 0x20; - - memory "flash" - size = 0x800; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny214"; + id = "t214"; + signature = 0x1e 0x91 0x20; memory "eeprom" - size = 0x40; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 64; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 2048; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17530,48 +13346,47 @@ part parent ".avr8x_tiny" # ATtiny412 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t412"; - desc = "ATtiny412"; - signature = 0x1E 0x92 0x23; - - memory "flash" - size = 0x1000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny412"; + id = "t412"; + signature = 0x1e 0x92 0x23; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; - #------------------------------------------------------------ # ATtiny414 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t414"; - desc = "ATtiny414"; - signature = 0x1E 0x92 0x22; - - memory "flash" - size = 0x1000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny414"; + id = "t414"; + signature = 0x1e 0x92 0x22; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17579,98 +13394,95 @@ part parent ".avr8x_tiny" # ATtiny416 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t416"; - desc = "ATtiny416"; - signature = 0x1E 0x92 0x21; - - memory "flash" - size = 0x1000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny416"; + id = "t416"; + signature = 0x1e 0x92 0x21; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; - #------------------------------------------------------------ # ATtiny417 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t417"; - desc = "ATtiny417"; - signature = 0x1E 0x92 0x20; - - memory "flash" - size = 0x1000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny417"; + id = "t417"; + signature = 0x1e 0x92 0x20; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; - #------------------------------------------------------------ # ATtiny814 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t814"; - desc = "ATtiny814"; - signature = 0x1E 0x93 0x22; - - memory "flash" - size = 0x2000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny814"; + id = "t814"; + signature = 0x1e 0x93 0x22; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; - #------------------------------------------------------------ # ATtiny816 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t816"; - desc = "ATtiny816"; - signature = 0x1E 0x93 0x21; - - memory "flash" - size = 0x2000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny816"; + id = "t816"; + signature = 0x1e 0x93 0x21; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17678,23 +13490,23 @@ part parent ".avr8x_tiny" # ATtiny817 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t817"; - desc = "ATtiny817"; - signature = 0x1E 0x93 0x20; - - memory "flash" - size = 0x2000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny817"; + id = "t817"; + signature = 0x1e 0x93 0x20; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17702,23 +13514,23 @@ part parent ".avr8x_tiny" # ATtiny1614 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t1614"; - desc = "ATtiny1614"; - signature = 0x1E 0x94 0x22; - - memory "flash" - size = 0x4000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny1614"; + id = "t1614"; + signature = 0x1e 0x94 0x22; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17726,23 +13538,23 @@ part parent ".avr8x_tiny" # ATtiny1616 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t1616"; - desc = "ATtiny1616"; - signature = 0x1E 0x94 0x21; - - memory "flash" - size = 0x4000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny1616"; + id = "t1616"; + signature = 0x1e 0x94 0x21; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17750,23 +13562,23 @@ part parent ".avr8x_tiny" # ATtiny1617 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t1617"; - desc = "ATtiny1617"; - signature = 0x1E 0x94 0x20; - - memory "flash" - size = 0x4000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny1617"; + id = "t1617"; + signature = 0x1e 0x94 0x20; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17774,23 +13586,23 @@ part parent ".avr8x_tiny" # ATtiny3216 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t3216"; - desc = "ATtiny3216"; - signature = 0x1E 0x95 0x21; - - memory "flash" - size = 0x8000; - offset = 0x8000; - page_size = 0x80; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny3216"; + id = "t3216"; + signature = 0x1e 0x95 0x21; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x40; - readsize = 0x100; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 128; + offset = 0x8000; + readsize = 256; ; ; @@ -17798,23 +13610,23 @@ part parent ".avr8x_tiny" # ATtiny3217 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t3217"; - desc = "ATtiny3217"; - signature = 0x1E 0x95 0x22; - - memory "flash" - size = 0x8000; - offset = 0x8000; - page_size = 0x80; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny3217"; + id = "t3217"; + signature = 0x1e 0x95 0x22; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x40; - readsize = 0x100; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 128; + offset = 0x8000; + readsize = 256; ; ; @@ -17822,23 +13634,23 @@ part parent ".avr8x_tiny" # ATtiny424 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t424"; - desc = "ATtiny424"; - signature = 0x1E 0x92 0x2C; - - memory "flash" - size = 0x1000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny424"; + id = "t424"; + signature = 0x1e 0x92 0x2c; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17846,23 +13658,23 @@ part parent ".avr8x_tiny" # ATtiny426 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t426"; - desc = "ATtiny426"; - signature = 0x1E 0x92 0x2B; - - memory "flash" - size = 0x1000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny426"; + id = "t426"; + signature = 0x1e 0x92 0x2b; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17870,23 +13682,23 @@ part parent ".avr8x_tiny" # ATtiny427 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t427"; - desc = "ATtiny427"; - signature = 0x1E 0x92 0x2A; - - memory "flash" - size = 0x1000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny427"; + id = "t427"; + signature = 0x1e 0x92 0x2a; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17894,23 +13706,23 @@ part parent ".avr8x_tiny" # ATtiny824 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t824"; - desc = "ATtiny824"; - signature = 0x1E 0x93 0x29; - - memory "flash" - size = 0x2000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny824"; + id = "t824"; + signature = 0x1e 0x93 0x29; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17918,23 +13730,23 @@ part parent ".avr8x_tiny" # ATtiny826 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t826"; - desc = "ATtiny826"; - signature = 0x1E 0x93 0x28; - - memory "flash" - size = 0x2000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny826"; + id = "t826"; + signature = 0x1e 0x93 0x28; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17942,23 +13754,23 @@ part parent ".avr8x_tiny" # ATtiny827 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t827"; - desc = "ATtiny827"; - signature = 0x1E 0x93 0x27; - - memory "flash" - size = 0x2000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny827"; + id = "t827"; + signature = 0x1e 0x93 0x27; memory "eeprom" - size = 0x80; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -17966,46 +13778,47 @@ part parent ".avr8x_tiny" # ATtiny1624 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t1624"; - desc = "ATtiny1624"; - signature = 0x1E 0x94 0x2A; - - memory "flash" - size = 0x4000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny1624"; + id = "t1624"; + signature = 0x1e 0x94 0x2a; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; + #------------------------------------------------------------ # ATtiny1626 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t1626"; - desc = "ATtiny1626"; - signature = 0x1E 0x94 0x29; - - memory "flash" - size = 0x4000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny1626"; + id = "t1626"; + signature = 0x1e 0x94 0x29; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -18013,23 +13826,23 @@ part parent ".avr8x_tiny" # ATtiny1627 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t1627"; - desc = "ATtiny1627"; - signature = 0x1E 0x94 0x28; - - memory "flash" - size = 0x4000; - offset = 0x8000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny1627"; + id = "t1627"; + signature = 0x1e 0x94 0x28; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -18037,23 +13850,23 @@ part parent ".avr8x_tiny" # ATtiny3224 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t3224"; - desc = "ATtiny3224"; - signature = 0x1E 0x95 0x28; - - memory "flash" - size = 0x8000; - offset = 0x8000; - page_size = 0x80; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny3224"; + id = "t3224"; + signature = 0x1e 0x95 0x28; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x40; - readsize = 0x100; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 128; + offset = 0x8000; + readsize = 256; ; ; @@ -18061,23 +13874,23 @@ part parent ".avr8x_tiny" # ATtiny3226 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t3226"; - desc = "ATtiny3226"; - signature = 0x1E 0x95 0x27; - - memory "flash" - size = 0x8000; - offset = 0x8000; - page_size = 0x80; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny3226"; + id = "t3226"; + signature = 0x1e 0x95 0x27; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x40; - readsize = 0x100; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 128; + offset = 0x8000; + readsize = 256; ; ; @@ -18085,23 +13898,23 @@ part parent ".avr8x_tiny" # ATtiny3227 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "t3227"; - desc = "ATtiny3227"; - signature = 0x1E 0x95 0x26; - - memory "flash" - size = 0x8000; - offset = 0x8000; - page_size = 0x80; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATtiny3227"; + id = "t3227"; + signature = 0x1e 0x95 0x26; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x40; - readsize = 0x100; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 128; + offset = 0x8000; + readsize = 256; ; ; @@ -18109,23 +13922,23 @@ part parent ".avr8x_tiny" # ATmega808 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "m808"; - desc = "ATmega808"; - signature = 0x1E 0x93 0x26; - - memory "flash" - size = 0x2000; - offset = 0x4000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATmega808"; + id = "m808"; + signature = 0x1e 0x93 0x26; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x4000; + readsize = 256; ; ; @@ -18133,23 +13946,23 @@ part parent ".avr8x_tiny" # ATmega809 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "m809"; - desc = "ATmega809"; - signature = 0x1E 0x93 0x2A; - - memory "flash" - size = 0x2000; - offset = 0x4000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATmega809"; + id = "m809"; + signature = 0x1e 0x93 0x2a; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x4000; + readsize = 256; ; ; @@ -18157,23 +13970,23 @@ part parent ".avr8x_tiny" # ATmega1608 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "m1608"; - desc = "ATmega1608"; - signature = 0x1E 0x94 0x27; - - memory "flash" - size = 0x4000; - offset = 0x4000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATmega1608"; + id = "m1608"; + signature = 0x1e 0x94 0x27; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x4000; + readsize = 256; ; ; @@ -18181,23 +13994,23 @@ part parent ".avr8x_tiny" # ATmega1609 #------------------------------------------------------------ -part parent ".avr8x_tiny" - id = "m1609"; - desc = "ATmega1609"; - signature = 0x1E 0x94 0x26; - - memory "flash" - size = 0x4000; - offset = 0x4000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avr8x_tiny" + desc = "ATmega1609"; + id = "m1609"; + signature = 0x1e 0x94 0x26; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x20; - readsize = 0x100; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x4000; + readsize = 256; ; ; @@ -18205,23 +14018,23 @@ part parent ".avr8x_tiny" # ATmega3208 #------------------------------------------------------------ -part parent ".avr8x_mega" - id = "m3208"; - desc = "ATmega3208"; - signature = 0x1E 0x95 0x30; - - memory "flash" - size = 0x8000; - offset = 0x4000; - page_size = 0x80; - readsize = 0x100; - ; +part parent ".avr8x_mega" + desc = "ATmega3208"; + id = "m3208"; + signature = 0x1e 0x95 0x30; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x40; - readsize = 0x100; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 128; + offset = 0x4000; + readsize = 256; ; ; @@ -18229,23 +14042,23 @@ part parent ".avr8x_mega" # ATmega3209 #------------------------------------------------------------ -part parent ".avr8x_mega" - id = "m3209"; - desc = "ATmega3209"; - signature = 0x1E 0x95 0x31; - - memory "flash" - size = 0x8000; - offset = 0x4000; - page_size = 0x80; - readsize = 0x100; - ; +part parent ".avr8x_mega" + desc = "ATmega3209"; + id = "m3209"; + signature = 0x1e 0x95 0x31; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x40; - readsize = 0x100; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 128; + offset = 0x4000; + readsize = 256; ; ; @@ -18253,23 +14066,23 @@ part parent ".avr8x_mega" # ATmega4808 #------------------------------------------------------------ -part parent ".avr8x_mega" - id = "m4808"; - desc = "ATmega4808"; - signature = 0x1E 0x96 0x50; - - memory "flash" - size = 0xC000; - offset = 0x4000; - page_size = 0x80; - readsize = 0x100; - ; +part parent ".avr8x_mega" + desc = "ATmega4808"; + id = "m4808"; + signature = 0x1e 0x96 0x50; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x40; - readsize = 0x100; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0xc000; + page_size = 128; + offset = 0x4000; + readsize = 256; ; ; @@ -18277,23 +14090,23 @@ part parent ".avr8x_mega" # ATmega4809 #------------------------------------------------------------ -part parent ".avr8x_mega" - id = "m4809"; - desc = "ATmega4809"; - signature = 0x1E 0x96 0x51; - - memory "flash" - size = 0xC000; - offset = 0x4000; - page_size = 0x80; - readsize = 0x100; - ; +part parent ".avr8x_mega" + desc = "ATmega4809"; + id = "m4809"; + signature = 0x1e 0x96 0x51; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x40; - readsize = 0x100; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0xc000; + page_size = 128; + offset = 0x4000; + readsize = 256; ; ; @@ -18302,50 +14115,18 @@ part parent ".avr8x_mega" #------------------------------------------------------------ part - id = ".avrdx"; - desc = "AVR-Dx family common values"; - has_updi = yes; - nvm_base = 0x1000; - ocd_base = 0x0F80; + desc = "AVR-Dx family common values"; + id = ".avrdx"; # Dedicated UPDI pin, no HV - hvupdi_variant = 1; - - memory "signature" - size = 3; - offset = 0x1100; - readsize = 0x3; - ; - - memory "prodsig" - size = 0x7D; - offset = 0x1103; - page_size = 0x7D; - readsize = 0x7D; - ; - - memory "tempsense" - size = 2; - offset = 0x1104; - readsize = 1; - ; - - memory "sernum" - size = 16; - offset = 0x1110; - readsize = 1; - ; - - memory "fuses" - size = 9; - offset = 0x1050; - page_size = 0x10; - readsize = 0x10; - ; + hvupdi_variant = 1; + has_updi = yes; + nvm_base = 0x1000; + ocd_base = 0x0f80; memory "fuse0" - size = 1; - offset = 0x1050; - readsize = 1; + size = 1; + offset = 0x1050; + readsize = 1; ; memory "wdtcfg" @@ -18353,9 +14134,9 @@ part ; memory "fuse1" - size = 1; - offset = 0x1051; - readsize = 1; + size = 1; + offset = 0x1051; + readsize = 1; ; memory "bodcfg" @@ -18363,9 +14144,9 @@ part ; memory "fuse2" - size = 1; - offset = 0x1052; - readsize = 1; + size = 1; + offset = 0x1052; + readsize = 1; ; memory "osccfg" @@ -18373,9 +14154,9 @@ part ; memory "fuse4" - size = 1; - offset = 0x1054; - readsize = 1; + size = 1; + offset = 0x1054; + readsize = 1; ; memory "tcd0cfg" @@ -18383,9 +14164,9 @@ part ; memory "fuse5" - size = 1; - offset = 0x1055; - readsize = 1; + size = 1; + offset = 0x1055; + readsize = 1; ; memory "syscfg0" @@ -18393,9 +14174,9 @@ part ; memory "fuse6" - size = 1; - offset = 0x1056; - readsize = 1; + size = 1; + offset = 0x1056; + readsize = 1; ; memory "syscfg1" @@ -18403,9 +14184,9 @@ part ; memory "fuse7" - size = 1; - offset = 0x1057; - readsize = 1; + size = 1; + offset = 0x1057; + readsize = 1; ; memory "codesize" @@ -18417,9 +14198,9 @@ part ; memory "fuse8" - size = 1; - offset = 0x1058; - readsize = 1; + size = 1; + offset = 0x1058; + readsize = 1; ; memory "bootsize" @@ -18430,18 +14211,49 @@ part alias "fuse8"; ; + memory "fuses" + size = 9; + page_size = 16; + offset = 0x1050; + readsize = 16; + ; + memory "lock" - size = 4; - offset = 0x1040; - page_size = 0x1; - readsize = 0x4; + size = 4; + offset = 0x1040; + readsize = 4; + ; + + memory "tempsense" + size = 2; + offset = 0x1104; + readsize = 1; + ; + + memory "signature" + size = 3; + offset = 0x1100; + readsize = 3; + ; + + memory "prodsig" + size = 125; + page_size = 125; + offset = 0x1103; + readsize = 125; + ; + + memory "sernum" + size = 16; + offset = 0x1110; + readsize = 1; ; memory "userrow" - size = 0x20; - offset = 0x1080; - page_size = 0x20; - readsize = 0x20; + size = 32; + page_size = 32; + offset = 0x1080; + readsize = 32; ; memory "usersig" @@ -18450,7 +14262,7 @@ part memory "data" # SRAM, only used to supply the offset - offset = 0x1000000; + offset = 0x1000000; ; ; @@ -18458,23 +14270,22 @@ part # AVR32DA28 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr32da28"; - desc = "AVR32DA28"; - signature = 0x1E 0x95 0x34; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR32DA28"; + id = "avr32da28"; + signature = 0x1e 0x95 0x34; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18482,23 +14293,22 @@ part parent ".avrdx" # AVR32DA32 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr32da32"; - desc = "AVR32DA32"; - signature = 0x1E 0x95 0x33; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR32DA32"; + id = "avr32da32"; + signature = 0x1e 0x95 0x33; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18506,23 +14316,22 @@ part parent ".avrdx" # AVR32DA48 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr32da48"; - desc = "AVR32DA48"; - signature = 0x1E 0x95 0x32; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR32DA48"; + id = "avr32da48"; + signature = 0x1e 0x95 0x32; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18530,23 +14339,22 @@ part parent ".avrdx" # AVR64DA28 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr64da28"; - desc = "AVR64DA28"; - signature = 0x1E 0x96 0x15; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR64DA28"; + id = "avr64da28"; + signature = 0x1e 0x96 0x15; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18554,23 +14362,22 @@ part parent ".avrdx" # AVR64DA32 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr64da32"; - desc = "AVR64DA32"; - signature = 0x1E 0x96 0x14; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR64DA32"; + id = "avr64da32"; + signature = 0x1e 0x96 0x14; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18578,23 +14385,22 @@ part parent ".avrdx" # AVR64DA48 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr64da48"; - desc = "AVR64DA48"; - signature = 0x1E 0x96 0x13; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR64DA48"; + id = "avr64da48"; + signature = 0x1e 0x96 0x13; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18602,23 +14408,22 @@ part parent ".avrdx" # AVR64DA64 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr64da64"; - desc = "AVR64DA64"; - signature = 0x1E 0x96 0x12; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR64DA64"; + id = "avr64da64"; + signature = 0x1e 0x96 0x12; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18626,23 +14431,22 @@ part parent ".avrdx" # AVR128DA28 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr128da28"; - desc = "AVR128DA28"; - signature = 0x1E 0x97 0x0A; - - memory "flash" - size = 0x20000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR128DA28"; + id = "avr128da28"; + signature = 0x1e 0x97 0x0a; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18650,23 +14454,22 @@ part parent ".avrdx" # AVR128DA32 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr128da32"; - desc = "AVR128DA32"; - signature = 0x1E 0x97 0x09; - - memory "flash" - size = 0x20000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR128DA32"; + id = "avr128da32"; + signature = 0x1e 0x97 0x09; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18674,23 +14477,22 @@ part parent ".avrdx" # AVR128DA48 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr128da48"; - desc = "AVR128DA48"; - signature = 0x1E 0x97 0x08; - - memory "flash" - size = 0x20000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR128DA48"; + id = "avr128da48"; + signature = 0x1e 0x97 0x08; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18698,23 +14500,22 @@ part parent ".avrdx" # AVR128DA64 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr128da64"; - desc = "AVR128DA64"; - signature = 0x1E 0x97 0x07; - - memory "flash" - size = 0x20000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR128DA64"; + id = "avr128da64"; + signature = 0x1e 0x97 0x07; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18722,23 +14523,22 @@ part parent ".avrdx" # AVR32DB28 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr32db28"; - desc = "AVR32DB28"; - signature = 0x1E 0x95 0x37; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR32DB28"; + id = "avr32db28"; + signature = 0x1e 0x95 0x37; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18746,23 +14546,22 @@ part parent ".avrdx" # AVR32DB32 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr32db32"; - desc = "AVR32DB32"; - signature = 0x1E 0x95 0x36; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR32DB32"; + id = "avr32db32"; + signature = 0x1e 0x95 0x36; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18770,23 +14569,22 @@ part parent ".avrdx" # AVR32DB48 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr32db48"; - desc = "AVR32DB48"; - signature = 0x1E 0x95 0x35; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR32DB48"; + id = "avr32db48"; + signature = 0x1e 0x95 0x35; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18794,23 +14592,22 @@ part parent ".avrdx" # AVR64DB28 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr64db28"; - desc = "AVR64DB28"; - signature = 0x1E 0x96 0x19; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR64DB28"; + id = "avr64db28"; + signature = 0x1e 0x96 0x19; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18818,23 +14615,22 @@ part parent ".avrdx" # AVR64DB32 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr64db32"; - desc = "AVR64DB32"; - signature = 0x1E 0x96 0x18; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR64DB32"; + id = "avr64db32"; + signature = 0x1e 0x96 0x18; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18842,23 +14638,22 @@ part parent ".avrdx" # AVR64DB48 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr64db48"; - desc = "AVR64DB48"; - signature = 0x1E 0x96 0x17; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR64DB48"; + id = "avr64db48"; + signature = 0x1e 0x96 0x17; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18866,23 +14661,22 @@ part parent ".avrdx" # AVR64DB64 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr64db64"; - desc = "AVR64DB64"; - signature = 0x1E 0x96 0x16; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR64DB64"; + id = "avr64db64"; + signature = 0x1e 0x96 0x16; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18890,23 +14684,22 @@ part parent ".avrdx" # AVR128DB28 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr128db28"; - desc = "AVR128DB28"; - signature = 0x1E 0x97 0x0E; - - memory "flash" - size = 0x20000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR128DB28"; + id = "avr128db28"; + signature = 0x1e 0x97 0x0e; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18914,23 +14707,22 @@ part parent ".avrdx" # AVR128DB32 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr128db32"; - desc = "AVR128DB32"; - signature = 0x1E 0x97 0x0D; - - memory "flash" - size = 0x20000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR128DB32"; + id = "avr128db32"; + signature = 0x1e 0x97 0x0d; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18938,23 +14730,22 @@ part parent ".avrdx" # AVR128DB48 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr128db48"; - desc = "AVR128DB48"; - signature = 0x1E 0x97 0x0C; - - memory "flash" - size = 0x20000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR128DB48"; + id = "avr128db48"; + signature = 0x1e 0x97 0x0c; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18962,23 +14753,22 @@ part parent ".avrdx" # AVR128DB64 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr128db64"; - desc = "AVR128DB64"; - signature = 0x1E 0x97 0x0B; - - memory "flash" - size = 0x20000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR128DB64"; + id = "avr128db64"; + signature = 0x1e 0x97 0x0b; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 512; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -18986,24 +14776,23 @@ part parent ".avrdx" # AVR16DD14 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr16dd14"; - desc = "AVR16DD14"; - signature = 0x1E 0x94 0x34; - hvupdi_variant = 2; - - memory "flash" - size = 0x4000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR16DD14"; + id = "avr16dd14"; + hvupdi_variant = 2; + signature = 0x1e 0x94 0x34; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 256; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -19011,24 +14800,23 @@ part parent ".avrdx" # AVR16DD20 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr16dd20"; - desc = "AVR16DD20"; - signature = 0x1E 0x94 0x33; - hvupdi_variant = 2; - - memory "flash" - size = 0x4000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR16DD20"; + id = "avr16dd20"; + hvupdi_variant = 2; + signature = 0x1e 0x94 0x33; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 256; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -19036,24 +14824,23 @@ part parent ".avrdx" # AVR16DD28 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr16dd28"; - desc = "AVR16DD28"; - signature = 0x1E 0x94 0x32; - hvupdi_variant = 2; - - memory "flash" - size = 0x4000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR16DD28"; + id = "avr16dd28"; + hvupdi_variant = 2; + signature = 0x1e 0x94 0x32; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 256; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -19061,24 +14848,23 @@ part parent ".avrdx" # AVR16DD32 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr16dd32"; - desc = "AVR16DD32"; - signature = 0x1E 0x94 0x31; - hvupdi_variant = 2; - - memory "flash" - size = 0x4000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR16DD32"; + id = "avr16dd32"; + hvupdi_variant = 2; + signature = 0x1e 0x94 0x31; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 256; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -19086,24 +14872,23 @@ part parent ".avrdx" # AVR32DD14 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr32dd14"; - desc = "AVR32DD14"; - signature = 0x1E 0x95 0x3B; - hvupdi_variant = 2; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR32DD14"; + id = "avr32dd14"; + hvupdi_variant = 2; + signature = 0x1e 0x95 0x3b; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 256; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -19111,24 +14896,23 @@ part parent ".avrdx" # AVR32DD20 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr32dd20"; - desc = "AVR32DD20"; - signature = 0x1E 0x95 0x3A; - hvupdi_variant = 2; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR32DD20"; + id = "avr32dd20"; + hvupdi_variant = 2; + signature = 0x1e 0x95 0x3a; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 256; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -19136,24 +14920,23 @@ part parent ".avrdx" # AVR32DD28 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr32dd28"; - desc = "AVR32DD28"; - signature = 0x1E 0x95 0x39; - hvupdi_variant = 2; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR32DD28"; + id = "avr32dd28"; + hvupdi_variant = 2; + signature = 0x1e 0x95 0x39; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 256; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -19161,24 +14944,23 @@ part parent ".avrdx" # AVR32DD32 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr32dd32"; - desc = "AVR32DD32"; - signature = 0x1E 0x95 0x38; - hvupdi_variant = 2; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR32DD32"; + id = "avr32dd32"; + hvupdi_variant = 2; + signature = 0x1e 0x95 0x38; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 256; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -19186,24 +14968,23 @@ part parent ".avrdx" # AVR64DD14 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr64dd14"; - desc = "AVR64DD14"; - signature = 0x1E 0x96 0x1D; - hvupdi_variant = 2; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR64DD14"; + id = "avr64dd14"; + hvupdi_variant = 2; + signature = 0x1e 0x96 0x1d; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 256; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -19211,24 +14992,23 @@ part parent ".avrdx" # AVR64DD20 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr64dd20"; - desc = "AVR64DD20"; - signature = 0x1E 0x96 0x1C; - hvupdi_variant = 2; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR64DD20"; + id = "avr64dd20"; + hvupdi_variant = 2; + signature = 0x1e 0x96 0x1c; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 256; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -19236,24 +15016,23 @@ part parent ".avrdx" # AVR64DD28 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr64dd28"; - desc = "AVR64DD28"; - signature = 0x1E 0x96 0x1B; - hvupdi_variant = 2; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR64DD28"; + id = "avr64dd28"; + hvupdi_variant = 2; + signature = 0x1e 0x96 0x1b; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 256; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -19261,24 +15040,23 @@ part parent ".avrdx" # AVR64DD32 #------------------------------------------------------------ -part parent ".avrdx" - id = "avr64dd32"; - desc = "AVR64DD32"; - signature = 0x1E 0x96 0x1A; - hvupdi_variant = 2; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x200; - readsize = 0x100; - ; +part parent ".avrdx" + desc = "AVR64DD32"; + id = "avr64dd32"; + hvupdi_variant = 2; + signature = 0x1e 0x96 0x1a; memory "eeprom" - size = 0x100; - offset = 0x1400; - page_size = 0x1; - readsize = 0x100; + size = 256; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -19287,16 +15065,15 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - id = ".avrex"; - desc = "AVR-Ex family common values"; + desc = "AVR-Ex family common values"; + id = ".avrex"; # Shared UPDI pin, HV on _RESET - hvupdi_variant = 2; + hvupdi_variant = 2; memory "userrow" - size = 0x40; - offset = 0x1080; - page_size = 0x40; - readsize = 0x40; + size = 64; + page_size = 64; + readsize = 64; ; memory "usersig" @@ -19308,23 +15085,23 @@ part parent ".avrdx" # AVR8EA28 #------------------------------------------------------------ -part parent ".avrex" - id = "avr8ea28"; - desc = "AVR8EA28"; - signature = 0x1E 0x93 0x2C; - - memory "flash" - size = 0x2000; - offset = 0x800000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avrex" + desc = "AVR8EA28"; + id = "avr8ea28"; + signature = 0x1e 0x93 0x2c; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x8; - readsize = 0x100; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -19332,23 +15109,23 @@ part parent ".avrex" # AVR8EA32 #------------------------------------------------------------ -part parent ".avrex" - id = "avr8ea32"; - desc = "AVR8EA32"; - signature = 0x1E 0x93 0x2B; - - memory "flash" - size = 0x2000; - offset = 0x800000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avrex" + desc = "AVR8EA32"; + id = "avr8ea32"; + signature = 0x1e 0x93 0x2b; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x8; - readsize = 0x100; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 8192; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -19356,23 +15133,23 @@ part parent ".avrex" # AVR16EA28 #------------------------------------------------------------ -part parent ".avrex" - id = "avr16ea28"; - desc = "AVR16EA28"; - signature = 0x1E 0x94 0x37; - - memory "flash" - size = 0x4000; - offset = 0x800000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avrex" + desc = "AVR16EA28"; + id = "avr16ea28"; + signature = 0x1e 0x94 0x37; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x8; - readsize = 0x100; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -19380,23 +15157,23 @@ part parent ".avrex" # AVR16EA32 #------------------------------------------------------------ -part parent ".avrex" - id = "avr16ea32"; - desc = "AVR16EA32"; - signature = 0x1E 0x94 0x36; - - memory "flash" - size = 0x4000; - offset = 0x800000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avrex" + desc = "AVR16EA32"; + id = "avr16ea32"; + signature = 0x1e 0x94 0x36; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x8; - readsize = 0x100; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -19404,23 +15181,23 @@ part parent ".avrex" # AVR16EA48 #------------------------------------------------------------ -part parent ".avrex" - id = "avr16ea48"; - desc = "AVR16EA48"; - signature = 0x1E 0x94 0x35; - - memory "flash" - size = 0x4000; - offset = 0x800000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avrex" + desc = "AVR16EA48"; + id = "avr16ea48"; + signature = 0x1e 0x94 0x35; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x8; - readsize = 0x100; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x4000; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -19428,23 +15205,23 @@ part parent ".avrex" # AVR32EA28 #------------------------------------------------------------ -part parent ".avrex" - id = "avr32ea28"; - desc = "AVR32EA28"; - signature = 0x1E 0x95 0x3E; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avrex" + desc = "AVR32EA28"; + id = "avr32ea28"; + signature = 0x1e 0x95 0x3e; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x8; - readsize = 0x100; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -19452,23 +15229,23 @@ part parent ".avrex" # AVR32EA32 #------------------------------------------------------------ -part parent ".avrex" - id = "avr32ea32"; - desc = "AVR32EA32"; - signature = 0x1E 0x95 0x3D; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avrex" + desc = "AVR32EA32"; + id = "avr32ea32"; + signature = 0x1e 0x95 0x3d; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x8; - readsize = 0x100; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -19476,23 +15253,23 @@ part parent ".avrex" # AVR32EA48 #------------------------------------------------------------ -part parent ".avrex" - id = "avr32ea48"; - desc = "AVR32EA48"; - signature = 0x1E 0x95 0x3C; - - memory "flash" - size = 0x8000; - offset = 0x800000; - page_size = 0x40; - readsize = 0x100; - ; +part parent ".avrex" + desc = "AVR32EA48"; + id = "avr32ea48"; + signature = 0x1e 0x95 0x3c; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x8; - readsize = 0x100; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x8000; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -19500,23 +15277,23 @@ part parent ".avrex" # AVR64EA28 #------------------------------------------------------------ -part parent ".avrex" - id = "avr64ea28"; - desc = "AVR64EA28"; - signature = 0x1E 0x96 0x20; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x80; - readsize = 0x100; - ; +part parent ".avrex" + desc = "AVR64EA28"; + id = "avr64ea28"; + signature = 0x1e 0x96 0x20; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x8; - readsize = 0x100; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 128; + offset = 0x800000; + readsize = 256; ; ; @@ -19524,23 +15301,23 @@ part parent ".avrex" # AVR64EA32 #------------------------------------------------------------ -part parent ".avrex" - id = "avr64ea32"; - desc = "AVR64EA32"; - signature = 0x1E 0x96 0x1F; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x80; - readsize = 0x100; - ; +part parent ".avrex" + desc = "AVR64EA32"; + id = "avr64ea32"; + signature = 0x1e 0x96 0x1f; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x8; - readsize = 0x100; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 128; + offset = 0x800000; + readsize = 256; ; ; @@ -19548,23 +15325,23 @@ part parent ".avrex" # AVR64EA48 #------------------------------------------------------------ -part parent ".avrex" - id = "avr64ea48"; - desc = "AVR64EA48"; - signature = 0x1E 0x96 0x1E; - - memory "flash" - size = 0x10000; - offset = 0x800000; - page_size = 0x80; - readsize = 0x100; - ; +part parent ".avrex" + desc = "AVR64EA48"; + id = "avr64ea48"; + signature = 0x1e 0x96 0x1e; memory "eeprom" - size = 0x200; - offset = 0x1400; - page_size = 0x8; - readsize = 0x100; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; + ; + + memory "flash" + size = 0x10000; + page_size = 128; + offset = 0x800000; + readsize = 256; ; ; @@ -19573,25 +15350,27 @@ part parent ".avrex" #------------------------------------------------------------ part parent "m88" - id = "lgt8f88p"; - desc = "LGT8F88P"; - signature = 0x1e 0x93 0x0f; + desc = "LGT8F88P"; + id = "lgt8f88p"; + signature = 0x1e 0x93 0x0f; +; - ocdrev = 1; - ; +#------------------------------------------------------------ +# LGT8F168P +#------------------------------------------------------------ part parent "m168" - id = "lgt8f168p"; - desc = "LGT8F168P"; - signature = 0x1e 0x94 0x0b; - - ocdrev = 1; + desc = "LGT8F168P"; + id = "lgt8f168p"; + signature = 0x1e 0x94 0x0b; ; +#------------------------------------------------------------ +# LGT8F328P +#------------------------------------------------------------ + part parent "m328" - id = "lgt8f328p"; - desc = "LGT8F328P"; - signature = 0x1e 0x95 0x0F; - - ocdrev = 1; + desc = "LGT8F328P"; + id = "lgt8f328p"; + signature = 0x1e 0x95 0x0f; ; diff --git a/src/developer_opts.c b/src/developer_opts.c index b2255281..ae1a54bc 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -345,7 +345,7 @@ static void dev_stack_out(bool tsv, const AVRPART *p, const char *name, const un dev_info(tsv? "NULL\n": "NULL;"); else for(int i=0; i 8 && i%8 == 0? "\n ": "", stack[i], i+1 8 && i%8 == 0? "\n ": " ", stack[i], i+1comments, name, 1, 1); } From 716984dbb1d1f58af44652c03faf9da9f61e64dc Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 24 Aug 2022 10:57:25 +0100 Subject: [PATCH 215/511] Reformat conditional programmers in avrdude.conf.in using -c* --- src/avrdude.conf.in | 429 +++++++++++++++++++++++++------------------ src/developer_opts.c | 12 +- src/pindefs.c | 2 +- 3 files changed, 261 insertions(+), 182 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 2cca8a11..7749d9db 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -375,121 +375,158 @@ default_spi = "@DEFAULT_SPI_PORT@"; # default_bitclock = 2.5; @HAVE_PARPORT_BEGIN@ -# Parallel port programmers. +# Parallel port programmers + +#------------------------------------------------------------ +# bsd +#------------------------------------------------------------ programmer - id = "bsd"; - desc = "Brian Dean's Programmer, http://www.bsdhome.com/avrdude/"; - type = "par"; - connection_type = parallel; - vcc = 2, 3, 4, 5; - reset = 7; - sck = 8; - mosi = 9; - miso = 10; + id = "bsd"; + desc = "Brian Dean's Programmer, http://www.bsdhome.com/avrdude/"; + type = "par"; + vcc = 2, 3, 4, 5; + reset = 7; + sck = 8; + mosi = 9; + miso = 10; ; +#------------------------------------------------------------ +# stk200 +#------------------------------------------------------------ + programmer - id = "stk200"; - desc = "STK200"; - type = "par"; - connection_type = parallel; - buff = 4, 5; - sck = 6; - mosi = 7; - reset = 9; - miso = 10; + id = "stk200"; + desc = "STK200"; + type = "par"; + buff = 4, 5; + reset = 9; + sck = 6; + mosi = 7; + miso = 10; ; +#------------------------------------------------------------ +# pony-stk200 +#------------------------------------------------------------ + # The programming dongle used by the popular Ponyprog # utility. It is almost similar to the STK200 one, # except that there is a LED indicating that the # programming is currently in progress. programmer parent "stk200" - id = "pony-stk200"; - desc = "Pony Prog STK200"; - pgmled = 8; + id = "pony-stk200"; + desc = "Pony Prog STK200"; + type = "par"; + pgmled = 8; ; +#------------------------------------------------------------ +# dt006 +#------------------------------------------------------------ + programmer - id = "dt006"; - desc = "Dontronics DT006"; - type = "par"; - connection_type = parallel; - reset = 4; - sck = 5; - mosi = 2; - miso = 11; + id = "dt006"; + desc = "Dontronics DT006"; + type = "par"; + reset = 4; + sck = 5; + mosi = 2; + miso = 11; ; +#------------------------------------------------------------ +# bascom +#------------------------------------------------------------ + programmer parent "dt006" - id = "bascom"; - desc = "Bascom SAMPLE programming cable"; + id = "bascom"; + desc = "Bascom SAMPLE programming cable"; + type = "par"; ; +#------------------------------------------------------------ +# alf +#------------------------------------------------------------ + programmer - id = "alf"; - desc = "Nightshade ALF-PgmAVR, http://nightshade.homeip.net/"; - type = "par"; - connection_type = parallel; - vcc = 2, 3, 4, 5; - buff = 6; - reset = 7; - sck = 8; - mosi = 9; - miso = 10; - errled = 1; - rdyled = 14; - pgmled = 16; - vfyled = 17; + id = "alf"; + desc = "Nightshade ALF-PgmAVR, http://nightshade.homeip.net/"; + type = "par"; + vcc = 2, 3, 4, 5; + buff = 6; + reset = 7; + sck = 8; + mosi = 9; + miso = 10; + errled = 1; + rdyled = 14; + pgmled = 16; + vfyled = 17; ; +#------------------------------------------------------------ +# sp12 +#------------------------------------------------------------ + programmer - id = "sp12"; - desc = "Steve Bolt's Programmer"; - type = "par"; - connection_type = parallel; - vcc = 4,5,6,7,8; - reset = 3; - sck = 2; - mosi = 9; - miso = 11; + id = "sp12"; + desc = "Steve Bolt's Programmer"; + type = "par"; + vcc = 4, 5, 6, 7, 8; + reset = 3; + sck = 2; + mosi = 9; + miso = 11; ; +#------------------------------------------------------------ +# picoweb +#------------------------------------------------------------ + programmer - id = "picoweb"; - desc = "Picoweb Programming Cable, http://www.picoweb.net/"; - type = "par"; - connection_type = parallel; - reset = 2; - sck = 3; - mosi = 4; - miso = 13; + id = "picoweb"; + desc = "Picoweb Programming Cable, http://www.picoweb.net/"; + type = "par"; + reset = 2; + sck = 3; + mosi = 4; + miso = 13; ; +#------------------------------------------------------------ +# abcmini +#------------------------------------------------------------ + programmer - id = "abcmini"; - desc = "ABCmini Board, aka Dick Smith HOTCHIP"; - type = "par"; - connection_type = parallel; - reset = 4; - sck = 3; - mosi = 2; - miso = 10; + id = "abcmini"; + desc = "ABCmini Board, aka Dick Smith HOTCHIP"; + type = "par"; + reset = 4; + sck = 3; + mosi = 2; + miso = 10; ; +#------------------------------------------------------------ +# futurlec +#------------------------------------------------------------ + programmer - id = "futurlec"; - desc = "Futurlec.com programming cable."; - type = "par"; - connection_type = parallel; - reset = 3; - sck = 2; - mosi = 1; - miso = 10; + id = "futurlec"; + desc = "Futurlec.com programming cable."; + type = "par"; + reset = 3; + sck = 2; + mosi = 1; + miso = 10; ; +#------------------------------------------------------------ +# xil +#------------------------------------------------------------ # From the contributor of the "xil" jtag cable: # The "vcc" definition isn't really vcc (the cable gets its power from @@ -498,91 +535,115 @@ programmer # avrdude versions before 5.5j). # With this, TMS connects to RESET, TDI to MOSI, TDO to MISO and TCK # to SCK (plus vcc/gnd of course) -programmer - id = "xil"; - desc = "Xilinx JTAG cable"; - type = "par"; - connection_type = parallel; - mosi = 2; - sck = 3; - reset = 4; - buff = 5; - miso = 13; - vcc = 6; -; - programmer - id = "dapa"; - desc = "Direct AVR Parallel Access cable"; - type = "par"; - connection_type = parallel; - vcc = 3; - reset = 16; - sck = 1; - mosi = 2; - miso = 11; + id = "xil"; + desc = "Xilinx JTAG cable"; + type = "par"; + vcc = 6; + buff = 5; + reset = 4; + sck = 3; + mosi = 2; + miso = 13; ; -programmer - id = "atisp"; - desc = "AT-ISP V1.1 programming cable for AVR-SDK1 from micro-research.co.th"; - type = "par"; - connection_type = parallel; - reset = ~6; - sck = ~8; - mosi = ~7; - miso = ~10; -; +#------------------------------------------------------------ +# dapa +#------------------------------------------------------------ programmer - id = "ere-isp-avr"; - desc = "ERE ISP-AVR "; - type = "par"; - connection_type = parallel; - reset = ~4; - sck = 3; - mosi = 2; - miso = 10; + id = "dapa"; + desc = "Direct AVR Parallel Access cable"; + type = "par"; + vcc = 3; + reset = 16; + sck = 1; + mosi = 2; + miso = 11; ; +#------------------------------------------------------------ +# atisp +#------------------------------------------------------------ + programmer - id = "blaster"; - desc = "Altera ByteBlaster"; - type = "par"; - connection_type = parallel; - sck = 2; - miso = 11; - reset = 3; - mosi = 8; - buff = 14; + id = "atisp"; + desc = "AT-ISP V1.1 programming cable for AVR-SDK1 from micro-research.co.th"; + type = "par"; + reset = ~6; + sck = ~8; + mosi = ~7; + miso = ~10; ; +#------------------------------------------------------------ +# ere-isp-avr +#------------------------------------------------------------ + +programmer + id = "ere-isp-avr"; + desc = "ERE ISP-AVR "; + type = "par"; + reset = ~4; + sck = 3; + mosi = 2; + miso = 10; +; + +#------------------------------------------------------------ +# blaster +#------------------------------------------------------------ + +programmer + id = "blaster"; + desc = "Altera ByteBlaster"; + type = "par"; + buff = 14; + reset = 3; + sck = 2; + mosi = 8; + miso = 11; +; + +#------------------------------------------------------------ +# frank-stk200 +#------------------------------------------------------------ + # It is almost same as pony-stk200, except vcc on pin 5 to auto # disconnect port (download on http://electropol.free.fr/spip/spip.php?article27) + programmer parent "pony-stk200" - id = "frank-stk200"; - desc = "Frank STK200"; - buff = ; # delete buff pin assignment - vcc = 5; + id = "frank-stk200"; + desc = "Frank STK200"; + type = "par"; + vcc = 5; + buff = ; # delete buff pin assignment ; +#------------------------------------------------------------ +# 89isp +#------------------------------------------------------------ + # The AT98ISP Cable is a simple parallel dongle for AT89 family. # http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2877 -programmer - id = "89isp"; - desc = "Atmel at89isp cable"; - type = "par"; - connection_type = parallel; - reset = 17; - sck = 1; - mosi = 2; - miso = 10; -; +programmer + id = "89isp"; + desc = "Atmel at89isp cable"; + type = "par"; + reset = 17; + sck = 1; + mosi = 2; + miso = 10; +; @HAVE_PARPORT_END@ @HAVE_LINUXGPIO_BEGIN@ +#------------------------------------------------------------ +# linuxgpio +#------------------------------------------------------------ + #This programmer bitbangs GPIO lines using the Linux sysfs GPIO interface # #To enable it set the configuration below to match the GPIO lines connected to the @@ -606,19 +667,23 @@ programmer #; @HAVE_LINUXGPIO_END@ - @HAVE_LINUXSPI_BEGIN@ +#------------------------------------------------------------ +# linuxspi +#------------------------------------------------------------ + # This programmer uses the built in linux SPI bus devices to program an # attached AVR. The reset pin must be attached to a GPIO pin that # is otherwise unused (see gpioinfo(1)); the SPI bus CE pins are not # suitable since they would release /RESET too early. # + programmer - id = "linuxspi"; - desc = "Use Linux SPI device in /dev/spidev*"; - type = "linuxspi"; - connection_type = spi; - reset = 25; # Pi GPIO number - this is J8:22 + id = "linuxspi"; + desc = "Use Linux SPI device in /dev/spidev*"; + type = "linuxspi"; + connection_type = spi; + reset = 25; # Pi GPIO number - this is J8:22 ; @HAVE_LINUXSPI_END@ @@ -631,8 +696,8 @@ programmer #------------------------------------------------------------ # http://wiring.org.co/ -# Basically STK500v2 protocol, with some glue to trigger the -# bootloader. +# Basically STK500v2 protocol, with some glue to trigger the bootloader + programmer id = "wiring"; desc = "Wiring"; @@ -714,6 +779,7 @@ programmer # This is an implementation of the above with a buffer IC (74AC244) and # 4 LEDs directly attached, all active low. + programmer id = "2232HIO"; desc = "FT2232H based generic programmer"; @@ -744,15 +810,12 @@ programmer #The FT4232H can be treated as FT2232H, but it has a different USB #device ID of 0x6011. + programmer parent "avrftdi" id = "4232h"; desc = "FT4232H based generic programmer"; type = "avrftdi"; usbpid = 0x6011; - reset = 3; - sck = 0; - mosi = 1; - miso = 2; ; #------------------------------------------------------------ @@ -792,8 +855,8 @@ programmer usbvid = 0x0403; usbpid = 0x6014; usbdev = "A"; - reset = 3; # AD3 (TMS) #ISP-signals + reset = 3; # AD3 (TMS) sck = 0; # AD0 (TCK) mosi = 1; # AD1 (TDI) miso = 2; # AD2 (TDO) @@ -810,15 +873,12 @@ programmer # Pin J2-6 is GND # Use the -b flag to set the SPI clock rate eg -b 3750000 is the fastest I could get # a 16MHz Atmega1280 to program reliably. The 232H is conveniently 5V tolerant. + programmer parent "ft232h" id = "um232h"; desc = "UM232H module from FTDI"; type = "avrftdi"; usbpid = 0x6014; - reset = 3; - sck = 0; - mosi = 1; - miso = 2; ; #------------------------------------------------------------ @@ -832,15 +892,12 @@ programmer parent "ft232h" # Black (Pin 10) is GND # Use the -b flag to set the SPI clock rate eg -b 3750000 is the fastest I could get # a 16MHz Atmega1280 to program reliably. The 232H is conveniently 5V tolerant. + programmer parent "ft232h" id = "c232hm"; desc = "C232HM cable from FTDI"; type = "avrftdi"; usbpid = 0x6014; - reset = 3; - sck = 0; - mosi = 1; - miso = 2; ; #------------------------------------------------------------ @@ -860,6 +917,7 @@ programmer parent "ft232h" # http://armwerks.com/catalog/o-link-debugger-copy/ # or just have a look at ebay ... # It is basically the same entry as jtagkey with different usb ids. + programmer parent "jtagkey" id = "o-link"; desc = "O-Link, OpenJTAG from www.100ask.net"; @@ -868,11 +926,6 @@ programmer parent "jtagkey" usbpid = 0x5118; usbvendor = "www.100ask.net"; usbproduct = "USB<=>JTAG&RS232"; - buff = ~4; - reset = 3; - sck = 0; - mosi = 1; - miso = 2; ; #------------------------------------------------------------ @@ -880,6 +933,7 @@ programmer parent "jtagkey" #------------------------------------------------------------ # http://wiki.openmoko.org/wiki/Debug_Board_v3 + programmer id = "openmoko"; desc = "Openmoko debug board (v3)"; @@ -899,6 +953,7 @@ programmer # Only Rev. A boards. # Schematic and user manual: http://www.cs.put.poznan.pl/wswitala/download/pdf/811EVBK.pdf + programmer id = "lm3s811"; desc = "Luminary Micro LM3S811 Eval Board (Rev. A)"; @@ -923,6 +978,7 @@ programmer #------------------------------------------------------------ # submitted as bug #46020 + programmer id = "tumpa"; desc = "TIAO USB Multi-Protocol Adapter"; @@ -958,6 +1014,7 @@ programmer # * Connect JTAG connector pin 1 to 5V (i.e. EXT pin 13 or JTAG pin 19). # * For TPI connection use resistors: TDO --[470R]-- TPIDATA --[470R]-- TDI. # * Powering target from JTAG pin 19 allows KT-LINK current measurement. + programmer id = "ktlink"; desc = "KT-LINK FT2232H interface with IO switching and voltage buffers."; @@ -1065,6 +1122,7 @@ programmer # Attempts to select the correct firmware version # by probing for it. Better use one of the entries # below instead. + programmer id = "stk500"; desc = "Atmel STK500"; @@ -1206,6 +1264,7 @@ programmer #------------------------------------------------------------ # see http://www.bitwizard.nl/wiki/index.php/FTDI_ATmega + programmer id = "bwmega"; desc = "BitWizard ftdi_atmega builtin programmer"; @@ -1223,6 +1282,7 @@ programmer # see http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html # Note: pins are numbered from 1! + programmer id = "arduino-ft232r"; desc = "Arduino: FT232R connected to ISP"; @@ -1243,9 +1303,9 @@ programmer desc = "Tag-Connect TC2030"; type = "ftdi_syncbb"; connection_type = usb; + # FOR TPI devices: reset = 3; # CTS = D3 (wire to ~RESET) sck = 2; # RTS = D2 (wire to SCK) - # FOR TPI devices: mosi = 0; # TxD = D0 (wire to TPIDATA via 1k resistor) miso = 1; # RxD = D1 (wire to TPIDATA directly) ; @@ -1255,14 +1315,11 @@ programmer #------------------------------------------------------------ # website mentioned above uses this id + programmer parent "arduino-ft232r" id = "diecimila"; desc = "alias for arduino-ft232r"; type = "ftdi_syncbb"; - reset = 7; - sck = 5; - mosi = 6; - miso = 3; ; #------------------------------------------------------------ @@ -1275,6 +1332,7 @@ programmer parent "arduino-ft232r" # Its 4 pairs of pins are shorted to enable ftdi_syncbb. # http://akizukidenshi.com/catalog/g/gP-07487/ # http://akizukidenshi.com/download/ds/akizuki/k6096_manual_20130816.pdf + programmer id = "uncompatino"; desc = "uncompatino with all pairs of pins shorted"; @@ -1303,6 +1361,7 @@ programmer # TTL-232R RTS 6 Green -> ICPS MISO (pin 1) # Except for VCC and GND, you can connect arbitual pairs as long as # the following table is adjusted. + programmer id = "ttl232r"; desc = "FTDI TTL232R-5V with ICSP adapter"; @@ -1380,6 +1439,7 @@ programmer # In that case, a resistor of 1 kOhm is needed between MISO and MOSI # pins of the connector, and MISO (pin 1 of the 6-pin connector) # connects to TPIDATA. + programmer id = "usbtiny"; desc = "USBtiny simple USB programmer, https://learn.adafruit.com/usbtinyisp"; @@ -1420,6 +1480,7 @@ programmer #------------------------------------------------------------ # commercial version of USBtiny, using a separate VID/PID + programmer id = "ehajo-isp"; desc = "avr-isp-programmer from eHaJo, http://www.eHaJo.de"; @@ -1435,6 +1496,7 @@ programmer # commercial version of USBtiny, using a separate VID/PID # https://github.com/IowaScaledEngineering/ckt-avrprogrammer + programmer id = "iseavrprog"; desc = "USBtiny-based programmer, https://iascaled.com"; @@ -1508,6 +1570,7 @@ programmer #------------------------------------------------------------ # suggested in http://forum.mikrokopter.de/topic-post48317.html + programmer id = "mkbutterfly"; desc = "Mikrokopter.de Butterfly"; @@ -1541,6 +1604,7 @@ programmer #------------------------------------------------------------ # easier to type + programmer parent "jtagmkI" id = "jtag1"; type = "jtagmki"; @@ -1551,6 +1615,7 @@ programmer parent "jtagmkI" #------------------------------------------------------------ # easier to type + programmer parent "jtag1" id = "jtag1slow"; type = "jtagmki"; @@ -1579,6 +1644,7 @@ programmer #------------------------------------------------------------ # easier to type + programmer parent "jtagmkII" id = "jtag2slow"; type = "jtagmkii"; @@ -1589,6 +1655,7 @@ programmer parent "jtagmkII" #------------------------------------------------------------ # JTAG ICE mkII @ 115200 Bd + programmer parent "jtag2slow" id = "jtag2fast"; type = "jtagmkii"; @@ -1600,6 +1667,7 @@ programmer parent "jtag2slow" #------------------------------------------------------------ # make the fast one the default, people will love that + programmer parent "jtag2fast" id = "jtag2"; type = "jtagmkii"; @@ -1610,6 +1678,7 @@ programmer parent "jtag2fast" #------------------------------------------------------------ # JTAG ICE mkII in ISP mode + programmer id = "jtag2isp"; desc = "Atmel JTAG ICE mkII in ISP mode"; @@ -1623,6 +1692,7 @@ programmer #------------------------------------------------------------ # JTAG ICE mkII in debugWire mode + programmer id = "jtag2dw"; desc = "Atmel JTAG ICE mkII in debugWire mode"; @@ -1636,6 +1706,7 @@ programmer #------------------------------------------------------------ # JTAG ICE mkII in AVR32 mode + programmer id = "jtagmkII_avr32"; desc = "Atmel JTAG ICE mkII im AVR32 mode"; @@ -1649,6 +1720,7 @@ programmer #------------------------------------------------------------ # JTAG ICE mkII in AVR32 mode + programmer id = "jtag2avr32"; desc = "Atmel JTAG ICE mkII im AVR32 mode"; @@ -1662,6 +1734,7 @@ programmer #------------------------------------------------------------ # JTAG ICE mkII in PDI mode + programmer id = "jtag2pdi"; desc = "Atmel JTAG ICE mkII PDI mode"; @@ -1675,6 +1748,7 @@ programmer #------------------------------------------------------------ # AVR Dragon in JTAG mode + programmer id = "dragon_jtag"; desc = "Atmel AVR Dragon in JTAG mode"; @@ -1688,6 +1762,7 @@ programmer #------------------------------------------------------------ # AVR Dragon in ISP mode + programmer id = "dragon_isp"; desc = "Atmel AVR Dragon in ISP mode"; @@ -1701,6 +1776,7 @@ programmer #------------------------------------------------------------ # AVR Dragon in PP mode + programmer id = "dragon_pp"; desc = "Atmel AVR Dragon in PP mode"; @@ -1714,6 +1790,7 @@ programmer #------------------------------------------------------------ # AVR Dragon in HVSP mode + programmer id = "dragon_hvsp"; desc = "Atmel AVR Dragon in HVSP mode"; @@ -1727,6 +1804,7 @@ programmer #------------------------------------------------------------ # AVR Dragon in debugWire mode + programmer id = "dragon_dw"; desc = "Atmel AVR Dragon in debugWire mode"; @@ -1740,6 +1818,7 @@ programmer #------------------------------------------------------------ # AVR Dragon in PDI mode + programmer id = "dragon_pdi"; desc = "Atmel AVR Dragon in PDI mode"; @@ -2170,10 +2249,6 @@ programmer parent "ponyser" id = "siprog"; desc = "Lancos SI-Prog "; type = "serbb"; - reset = ~3; - sck = 7; - mosi = 4; - miso = 8; ; #------------------------------------------------------------ diff --git a/src/developer_opts.c b/src/developer_opts.c index ae1a54bc..2aee8b10 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -1147,7 +1147,8 @@ static void dev_pgm_strct(const PROGRAMMER *pgm, bool tsv, const PROGRAMMER *bas } _if_pgmout_str(strcmp, cfg_escape(pgm->desc), desc); - _pgmout_fmt("type", "\"%s\"", locate_programmer_type_id(pgm->initpgm)); + if(!base || base->initpgm != pgm->initpgm) + _pgmout_fmt("type", "\"%s\"", locate_programmer_type_id(pgm->initpgm)); if(!base || base->conntype != pgm->conntype) _pgmout_fmt("connection_type", "%s", connstr(pgm->conntype)); _if_pgmout(intcmp, "%d", baudrate); @@ -1182,10 +1183,13 @@ static void dev_pgm_strct(const PROGRAMMER *pgm, bool tsv, const PROGRAMMER *bas for(int i=0; ipin+i); - if(str && *str) + char *bstr = base? pins_to_strdup(base->pin+i): NULL; + if(!base || strcmp(bstr, str)) _pgmout_fmt(avr_pin_lcname(i), "%s", str); - if(str) - free(str); + + free(str); + if(bstr) + free(bstr); } if(pgm->hvupdi_support && lfirst(pgm->hvupdi_support)) { diff --git a/src/pindefs.c b/src/pindefs.c index 7127f539..47c54d2c 100644 --- a/src/pindefs.c +++ b/src/pindefs.c @@ -350,7 +350,7 @@ const char * pins_to_str(const struct pindef_t * const pindef) { * This function returns a string of defined pins, eg, ~1, 2, ~4, ~5, 7 or "" * * @param[in] pindef the pin definition for which we want the string representation - * @returns a pointer to a string, which was created by strdup + * @returns a pointer to a string, which was created by cfg_strdup() */ char *pins_to_strdup(const struct pindef_t * const pindef) { char buf[6*(PIN_MAX+1)], *p = buf; From 7fab75336eedbb70b3c821210e647fd26a16344f Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 24 Aug 2022 11:46:24 +0100 Subject: [PATCH 216/511] Replace tabs in avrdude.conf.in with spaces --- src/avrdude.conf.in | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 7749d9db..ab07d334 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -356,15 +356,15 @@ # in the Internet. These add the following codes (only devices that # actually exist are listed): -# ATmega8515 0x3A -# ATmega128 0x43 -# ATmega64 0x45 -# ATtiny26 0x5E -# ATmega8535 0x69 -# ATmega32 0x72 -# ATmega16 0x74 -# ATmega8 0x76 -# ATmega169 0x78 +# ATmega8515 0x3A +# ATmega128 0x43 +# ATmega64 0x45 +# ATtiny26 0x5E +# ATmega8535 0x69 +# ATmega32 0x72 +# ATmega16 0x74 +# ATmega8 0x76 +# ATmega169 0x78 # # Overall avrdude defaults; suitable for ~/.avrduderc @@ -7624,7 +7624,7 @@ part chip_erase_delay = 9000; pagel = 0xd7; bs2 = 0xc2; - # avr910_devcode = 0x; + # avr910_devcode = 0x; signature = 0x1e 0x95 0x14; has_debugwire = yes; timeout = 200; @@ -7771,8 +7771,8 @@ part parent "m328" desc = "ATmega32M1"; id = "m32m1"; bs2 = 0xe2; - # stk500_devcode = 0x; - # avr910_devcode = 0x; + # stk500_devcode = 0x; + # avr910_devcode = 0x; signature = 0x1e 0x95 0x84; memory "efuse" @@ -7788,8 +7788,8 @@ part parent "m328" desc = "ATmega64M1"; id = "m64m1"; bs2 = 0xe2; - # stk500_devcode = 0x; - # avr910_devcode = 0x; + # stk500_devcode = 0x; + # avr910_devcode = 0x; signature = 0x1e 0x96 0x84; memory "eeprom" @@ -12074,7 +12074,7 @@ part parent ".xmega" desc = "ATxmega192C3"; id = "x192c3"; signature = 0x1e 0x97 0x51; - # usbpid = 0x2f??; + # usbpid = 0x2f??; memory "eeprom" size = 2048; From c97eb85cd813aa5c686ce88323ee3fb46b395224 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 24 Aug 2022 12:55:00 +0100 Subject: [PATCH 217/511] Fix reset=dedicated|io; in avrdude.conf.in Done by adding code in developer_opts.c that allows to inject part or memory parameters into a semi-automated rewrite of avrdude.conf This is a generic method, whereby an external program can, eg., scrape atdf files for the right parameters and put them into a source table into developer_opts.c - Then write parts description with -p*/i - Use the output in a new avrdude.conf - Output again with -p* (no /i) and use that for final avrdude.conf - Remove table entries --- src/avrdude.conf.in | 34 ++++++++++++++++++++++++++++++++++ src/developer_opts.c | 44 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index ab07d334..a5d32538 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -3501,6 +3501,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x96 0x02; + reset = io; has_jtag = yes; allowfullpagebitstream = yes; timeout = 200; @@ -3626,6 +3627,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x97 0x02; + reset = io; has_jtag = yes; allowfullpagebitstream = yes; timeout = 200; @@ -3752,6 +3754,7 @@ part bs2 = 0xa0; # avr910_devcode = 0x43; signature = 0x1e 0x97 0x81; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -3872,6 +3875,7 @@ part bs2 = 0xa0; # avr910_devcode = 0x43; signature = 0x1e 0x96 0x81; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -3992,6 +3996,7 @@ part bs2 = 0xa0; # avr910_devcode = 0x43; signature = 0x1e 0x95 0x81; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -4112,6 +4117,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x94 0x03; + reset = io; has_jtag = yes; allowfullpagebitstream = yes; timeout = 200; @@ -4233,6 +4239,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x95 0x08; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -4421,6 +4428,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x96 0x09; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -4567,6 +4575,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x97 0x06; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -4698,6 +4707,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x94 0x04; + reset = io; has_jtag = yes; allowfullpagebitstream = yes; timeout = 200; @@ -5031,6 +5041,7 @@ part parent "m169" desc = "ATmega169A"; id = "m169a"; signature = 0x1e 0x94 0x11; + reset = io; ; #------------------------------------------------------------ @@ -5040,6 +5051,7 @@ part parent "m169" part parent "m169" desc = "ATmega169P"; id = "m169p"; + reset = io; ; #------------------------------------------------------------ @@ -5049,6 +5061,7 @@ part parent "m169" part parent "m169" desc = "ATmega169PA"; id = "m169pa"; + reset = io; ; #------------------------------------------------------------ @@ -5063,6 +5076,7 @@ part avr910_devcode = 0x75; chip_erase_delay = 9000; signature = 0x1e 0x95 0x03; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -5252,6 +5266,7 @@ part avr910_devcode = 0x75; chip_erase_delay = 9000; signature = 0x1e 0x96 0x03; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -5422,6 +5437,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x95 0x02; + reset = io; has_jtag = yes; allowfullpagebitstream = yes; timeout = 200; @@ -5629,6 +5645,7 @@ part pagel = 0xd7; bs2 = 0xc2; signature = 0x1e 0x93 0x07; + reset = io; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -6500,6 +6517,7 @@ part bs2 = 0xc2; # avr910_devcode = 0x; signature = 0x1e 0x92 0x05; + reset = io; has_debugwire = yes; timeout = 200; stabdelay = 100; @@ -6664,6 +6682,7 @@ part bs2 = 0xc2; # avr910_devcode = 0x; signature = 0x1e 0x93 0x0a; + reset = io; has_debugwire = yes; timeout = 200; stabdelay = 100; @@ -6829,6 +6848,7 @@ part bs2 = 0xc2; # avr910_devcode = 0x; signature = 0x1e 0x94 0x06; + reset = io; has_debugwire = yes; timeout = 200; stabdelay = 100; @@ -6994,6 +7014,7 @@ part bs2 = 0xc2; # avr910_devcode = 0x; signature = 0x1e 0x93 0x14; + reset = io; has_debugwire = yes; timeout = 200; stabdelay = 100; @@ -7376,6 +7397,7 @@ part bs2 = 0xc2; # avr910_devcode = 0x; signature = 0x1e 0x92 0x09; + reset = io; has_debugwire = yes; timeout = 200; stabdelay = 100; @@ -7501,6 +7523,7 @@ part bs2 = 0xc2; # avr910_devcode = 0x; signature = 0x1e 0x93 0x11; + reset = io; has_debugwire = yes; timeout = 200; stabdelay = 100; @@ -7626,6 +7649,7 @@ part bs2 = 0xc2; # avr910_devcode = 0x; signature = 0x1e 0x95 0x14; + reset = io; has_debugwire = yes; timeout = 200; stabdelay = 100; @@ -8671,6 +8695,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x96 0x08; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -8791,6 +8816,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x97 0x03; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -8922,6 +8948,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x98 0x01; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -9749,6 +9776,7 @@ part bs2 = 0xa0; signature = 0x1e 0x94 0x88; usbpid = 0x2ff4; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -9870,6 +9898,7 @@ part bs2 = 0xa0; signature = 0x1e 0x95 0x87; usbpid = 0x2ff4; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -9991,6 +10020,7 @@ part bs2 = 0xa0; signature = 0x1e 0x96 0x82; usbpid = 0x2ff9; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -10122,6 +10152,7 @@ part bs2 = 0xa0; signature = 0x1e 0x97 0x82; usbpid = 0x2ffb; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -11013,6 +11044,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x95 0x05; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -11164,6 +11196,7 @@ part pagel = 0xd7; bs2 = 0xa0; signature = 0x1e 0x96 0x05; + reset = io; has_jtag = yes; timeout = 200; stabdelay = 100; @@ -12842,6 +12875,7 @@ part pagel = 0xa7; bs2 = 0xa0; signature = 0x1e 0x95 0x07; + reset = io; has_jtag = yes; serial = no; # STK500v2 HV programming parameters, from XML diff --git a/src/developer_opts.c b/src/developer_opts.c index 2aee8b10..e88c9a21 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -53,6 +53,27 @@ #include "developer_opts.h" #include "developer_opts_private.h" + // Inject part parameters into a semi-automated rewrite of avrdude.conf + // - Add entries to the tables below; they get written on -p*/i + // - Use the output in a new avrdude.conf + // - Output again with -p* (no /i) and use that for final avrdude.conf + // - Remove entries from below tables + +static struct { + const char *mcu, *var, *value; +} ptinj[] = { + // Add triples here, eg, {"ATmega328P", "mcuid", "999"}, +}; + +static struct { + const char *mcu, *mem, *var, *value; +} meminj[] = { + // Add quadruples here, eg, {"ATmega328P", "flash", "page_size", "128"}, +}; + + + + // Return 0 if op code would encode (essentially) the same SPI command static int opcodecmp(const OPCODE *op1, const OPCODE *op2, int opnum) { char *opstr1, *opstr2, *p; @@ -525,7 +546,7 @@ static void dev_part_raw(const AVRPART *part) { } -static void dev_part_strct(const AVRPART *p, bool tsv, const AVRPART *base) { +static void dev_part_strct(const AVRPART *p, bool tsv, const AVRPART *base, bool injct) { char *descstr = cfg_escape(p->desc); COMMENT *cp; @@ -690,6 +711,12 @@ static void dev_part_strct(const AVRPART *p, bool tsv, const AVRPART *base) { if(!bm || opcodecmp(bm->op[i], m->op[i], i)) dev_part_strct_entry(tsv, ".ptmmop", p->desc, m->desc, opcodename(i), opcode2str(m->op[i], i, !tsv), m->comments); + if(injct) + for(size_t i=0; idesc) == 0 && strcmp(meminj[i].mem, m->desc) == 0) + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, + meminj[i].var, cfg_strdup("meminj", meminj[i].value), NULL); + if(!tsv) { dev_cout(m->comments, ";", 0, 0); dev_info(" ;\n"); @@ -706,6 +733,12 @@ static void dev_part_strct(const AVRPART *p, bool tsv, const AVRPART *base) { } } + if(injct) + for(size_t i=0; idesc) == 0) + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, + ptinj[i].var, cfg_strdup("ptinj", ptinj[i].value), NULL); + if(!tsv) { dev_cout(p->comments, ";", 0, 0); dev_info(";\n"); @@ -742,7 +775,7 @@ void dev_output_pgm_part(int dev_opt_c, char *programmer, int dev_opt_p, char *p // -p */[dASsrcow*t] void dev_output_part_defs(char *partdesc) { - bool cmdok, waits, opspi, descs, astrc, strct, cmpst, raw, all, tsv; + bool cmdok, waits, opspi, descs, astrc, strct, cmpst, injct, raw, all, tsv; char *flags; int nprinted; AVRPART *nullpart = avr_new_part(); @@ -753,7 +786,7 @@ void dev_output_part_defs(char *partdesc) { if(!flags && !strcmp(partdesc, "*")) // Treat -p * as if it was -p */s flags = "s"; - if(!*flags || !strchr("cdoASsrw*t", *flags)) { + if(!*flags || !strchr("cdoASsrw*ti", *flags)) { dev_info("%s: flags for developer option -p / not recognised\n", progname); dev_info( "Wildcard examples (these need protecting in the shell through quoting):\n" @@ -772,6 +805,7 @@ void dev_output_part_defs(char *partdesc) { " w wd_... constants for ISP parts\n" " * all of the above except s and S\n" " t use tab separated values as much as possible\n" + " i inject assignments from source code table\n" "Examples:\n" " $ avrdude -p ATmega328P/s\n" " $ avrdude -p m328*/st | grep chip_erase_delay\n" @@ -798,6 +832,7 @@ void dev_output_part_defs(char *partdesc) { strct = !!strchr(flags, 'S'); cmpst = !!strchr(flags, 's'); tsv = !!strchr(flags, 't'); + injct = !!strchr(flags, 'i'); // Go through all memories and add them to the memory order list @@ -834,7 +869,8 @@ void dev_output_part_defs(char *partdesc) { dev_part_strct(p, tsv, astrc? NULL: strct? nullpart: - p->parent_id && *p->parent_id? locate_part(part_list, p->parent_id): nullpart); + p->parent_id && *p->parent_id? locate_part(part_list, p->parent_id): nullpart, + injct); if(raw) dev_part_raw(p); From 0ccdd24d7e90dc172d1d24344428229fb6f312e6 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 24 Aug 2022 13:50:07 +0100 Subject: [PATCH 218/511] Ensure arrays in developer_opts.c have at least one element --- src/developer_opts.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index e88c9a21..872d48c1 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -63,12 +63,14 @@ static struct { const char *mcu, *var, *value; } ptinj[] = { // Add triples here, eg, {"ATmega328P", "mcuid", "999"}, + {NULL, NULL, NULL}, }; static struct { const char *mcu, *mem, *var, *value; } meminj[] = { // Add quadruples here, eg, {"ATmega328P", "flash", "page_size", "128"}, + {NULL, NULL, NULL, NULL}, }; @@ -713,9 +715,10 @@ static void dev_part_strct(const AVRPART *p, bool tsv, const AVRPART *base, bool if(injct) for(size_t i=0; idesc) == 0 && strcmp(meminj[i].mem, m->desc) == 0) - dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, - meminj[i].var, cfg_strdup("meminj", meminj[i].value), NULL); + if(meminj[i].mcu) + if(strcmp(meminj[i].mcu, p->desc) == 0 && strcmp(meminj[i].mem, m->desc) == 0) + dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, + meminj[i].var, cfg_strdup("meminj", meminj[i].value), NULL); if(!tsv) { dev_cout(m->comments, ";", 0, 0); @@ -735,9 +738,10 @@ static void dev_part_strct(const AVRPART *p, bool tsv, const AVRPART *base, bool if(injct) for(size_t i=0; idesc) == 0) - dev_part_strct_entry(tsv, ".pt", p->desc, NULL, - ptinj[i].var, cfg_strdup("ptinj", ptinj[i].value), NULL); + if(ptinj[i].mcu) + if(strcmp(ptinj[i].mcu, p->desc) == 0) + dev_part_strct_entry(tsv, ".pt", p->desc, NULL, + ptinj[i].var, cfg_strdup("ptinj", ptinj[i].value), NULL); if(!tsv) { dev_cout(p->comments, ";", 0, 0); From cddf2943ebffbabc95382d911cb97bd442e0ae8b Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 30 Aug 2022 01:10:45 +0100 Subject: [PATCH 219/511] Line up assignment operators in avrdude.conf.in --- src/avrdude.conf.in | 16814 ++++++++++++++++++++--------------------- src/developer_opts.c | 10 +- 2 files changed, 8394 insertions(+), 8430 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index a5d32538..5a68cff5 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -303,8 +303,8 @@ #define AT86RF401 0xD0 #define AT89START 0xE0 -#define AT89S51 0xE0 -#define AT89S52 0xE1 +#define AT89S51 0xE0 +#define AT89S52 0xE1 # The following table lists the devices in the original AVR910 # appnote: @@ -382,14 +382,14 @@ default_spi = "@DEFAULT_SPI_PORT@"; #------------------------------------------------------------ programmer - id = "bsd"; - desc = "Brian Dean's Programmer, http://www.bsdhome.com/avrdude/"; - type = "par"; - vcc = 2, 3, 4, 5; - reset = 7; - sck = 8; - mosi = 9; - miso = 10; + id = "bsd"; + desc = "Brian Dean's Programmer, http://www.bsdhome.com/avrdude/"; + type = "par"; + vcc = 2, 3, 4, 5; + reset = 7; + sck = 8; + mosi = 9; + miso = 10; ; #------------------------------------------------------------ @@ -397,14 +397,14 @@ programmer #------------------------------------------------------------ programmer - id = "stk200"; - desc = "STK200"; - type = "par"; - buff = 4, 5; - reset = 9; - sck = 6; - mosi = 7; - miso = 10; + id = "stk200"; + desc = "STK200"; + type = "par"; + buff = 4, 5; + reset = 9; + sck = 6; + mosi = 7; + miso = 10; ; #------------------------------------------------------------ @@ -417,10 +417,9 @@ programmer # programming is currently in progress. programmer parent "stk200" - id = "pony-stk200"; - desc = "Pony Prog STK200"; - type = "par"; - pgmled = 8; + id = "pony-stk200"; + desc = "Pony Prog STK200"; + pgmled = 8; ; #------------------------------------------------------------ @@ -428,13 +427,13 @@ programmer parent "stk200" #------------------------------------------------------------ programmer - id = "dt006"; - desc = "Dontronics DT006"; - type = "par"; - reset = 4; - sck = 5; - mosi = 2; - miso = 11; + id = "dt006"; + desc = "Dontronics DT006"; + type = "par"; + reset = 4; + sck = 5; + mosi = 2; + miso = 11; ; #------------------------------------------------------------ @@ -442,9 +441,8 @@ programmer #------------------------------------------------------------ programmer parent "dt006" - id = "bascom"; - desc = "Bascom SAMPLE programming cable"; - type = "par"; + id = "bascom"; + desc = "Bascom SAMPLE programming cable"; ; #------------------------------------------------------------ @@ -452,19 +450,19 @@ programmer parent "dt006" #------------------------------------------------------------ programmer - id = "alf"; - desc = "Nightshade ALF-PgmAVR, http://nightshade.homeip.net/"; - type = "par"; - vcc = 2, 3, 4, 5; - buff = 6; - reset = 7; - sck = 8; - mosi = 9; - miso = 10; - errled = 1; - rdyled = 14; - pgmled = 16; - vfyled = 17; + id = "alf"; + desc = "Nightshade ALF-PgmAVR, http://nightshade.homeip.net/"; + type = "par"; + vcc = 2, 3, 4, 5; + buff = 6; + reset = 7; + sck = 8; + mosi = 9; + miso = 10; + errled = 1; + rdyled = 14; + pgmled = 16; + vfyled = 17; ; #------------------------------------------------------------ @@ -472,14 +470,14 @@ programmer #------------------------------------------------------------ programmer - id = "sp12"; - desc = "Steve Bolt's Programmer"; - type = "par"; - vcc = 4, 5, 6, 7, 8; - reset = 3; - sck = 2; - mosi = 9; - miso = 11; + id = "sp12"; + desc = "Steve Bolt's Programmer"; + type = "par"; + vcc = 4, 5, 6, 7, 8; + reset = 3; + sck = 2; + mosi = 9; + miso = 11; ; #------------------------------------------------------------ @@ -487,13 +485,13 @@ programmer #------------------------------------------------------------ programmer - id = "picoweb"; - desc = "Picoweb Programming Cable, http://www.picoweb.net/"; - type = "par"; - reset = 2; - sck = 3; - mosi = 4; - miso = 13; + id = "picoweb"; + desc = "Picoweb Programming Cable, http://www.picoweb.net/"; + type = "par"; + reset = 2; + sck = 3; + mosi = 4; + miso = 13; ; #------------------------------------------------------------ @@ -501,13 +499,13 @@ programmer #------------------------------------------------------------ programmer - id = "abcmini"; - desc = "ABCmini Board, aka Dick Smith HOTCHIP"; - type = "par"; - reset = 4; - sck = 3; - mosi = 2; - miso = 10; + id = "abcmini"; + desc = "ABCmini Board, aka Dick Smith HOTCHIP"; + type = "par"; + reset = 4; + sck = 3; + mosi = 2; + miso = 10; ; #------------------------------------------------------------ @@ -515,13 +513,13 @@ programmer #------------------------------------------------------------ programmer - id = "futurlec"; - desc = "Futurlec.com programming cable."; - type = "par"; - reset = 3; - sck = 2; - mosi = 1; - miso = 10; + id = "futurlec"; + desc = "Futurlec.com programming cable."; + type = "par"; + reset = 3; + sck = 2; + mosi = 1; + miso = 10; ; #------------------------------------------------------------ @@ -537,15 +535,15 @@ programmer # to SCK (plus vcc/gnd of course) programmer - id = "xil"; - desc = "Xilinx JTAG cable"; - type = "par"; - vcc = 6; - buff = 5; - reset = 4; - sck = 3; - mosi = 2; - miso = 13; + id = "xil"; + desc = "Xilinx JTAG cable"; + type = "par"; + vcc = 6; + buff = 5; + reset = 4; + sck = 3; + mosi = 2; + miso = 13; ; #------------------------------------------------------------ @@ -553,14 +551,14 @@ programmer #------------------------------------------------------------ programmer - id = "dapa"; - desc = "Direct AVR Parallel Access cable"; - type = "par"; - vcc = 3; - reset = 16; - sck = 1; - mosi = 2; - miso = 11; + id = "dapa"; + desc = "Direct AVR Parallel Access cable"; + type = "par"; + vcc = 3; + reset = 16; + sck = 1; + mosi = 2; + miso = 11; ; #------------------------------------------------------------ @@ -568,13 +566,13 @@ programmer #------------------------------------------------------------ programmer - id = "atisp"; - desc = "AT-ISP V1.1 programming cable for AVR-SDK1 from micro-research.co.th"; - type = "par"; - reset = ~6; - sck = ~8; - mosi = ~7; - miso = ~10; + id = "atisp"; + desc = "AT-ISP V1.1 programming cable for AVR-SDK1 from micro-research.co.th"; + type = "par"; + reset = ~6; + sck = ~8; + mosi = ~7; + miso = ~10; ; #------------------------------------------------------------ @@ -582,13 +580,13 @@ programmer #------------------------------------------------------------ programmer - id = "ere-isp-avr"; - desc = "ERE ISP-AVR "; - type = "par"; - reset = ~4; - sck = 3; - mosi = 2; - miso = 10; + id = "ere-isp-avr"; + desc = "ERE ISP-AVR "; + type = "par"; + reset = ~4; + sck = 3; + mosi = 2; + miso = 10; ; #------------------------------------------------------------ @@ -596,14 +594,14 @@ programmer #------------------------------------------------------------ programmer - id = "blaster"; - desc = "Altera ByteBlaster"; - type = "par"; - buff = 14; - reset = 3; - sck = 2; - mosi = 8; - miso = 11; + id = "blaster"; + desc = "Altera ByteBlaster"; + type = "par"; + buff = 14; + reset = 3; + sck = 2; + mosi = 8; + miso = 11; ; #------------------------------------------------------------ @@ -614,11 +612,10 @@ programmer # disconnect port (download on http://electropol.free.fr/spip/spip.php?article27) programmer parent "pony-stk200" - id = "frank-stk200"; - desc = "Frank STK200"; - type = "par"; - vcc = 5; - buff = ; # delete buff pin assignment + id = "frank-stk200"; + desc = "Frank STK200"; + vcc = 5; + buff = ; # delete buff pin assignment ; #------------------------------------------------------------ @@ -629,42 +626,45 @@ programmer parent "pony-stk200" # http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2877 programmer - id = "89isp"; - desc = "Atmel at89isp cable"; - type = "par"; - reset = 17; - sck = 1; - mosi = 2; - miso = 10; + id = "89isp"; + desc = "Atmel at89isp cable"; + type = "par"; + reset = 17; + sck = 1; + mosi = 2; + miso = 10; ; @HAVE_PARPORT_END@ @HAVE_LINUXGPIO_BEGIN@ -#------------------------------------------------------------ -# linuxgpio -#------------------------------------------------------------ -#This programmer bitbangs GPIO lines using the Linux sysfs GPIO interface +# This programmer bitbangs GPIO lines using the Linux sysfs GPIO interface # -#To enable it set the configuration below to match the GPIO lines connected to the -#relevant ISP header pins and uncomment the entry definition. In case you don't -#have the required permissions to edit this system wide config file put the -#entry in a separate .conf file and use it with -C+.conf -#on the command line. +# To enable it set the configuration below to match the GPIO lines connected +# to the relevant ISP header pins and uncomment the entry definition. In case +# you don't have the required permissions to edit this system wide config +# file put the entry in a separate .conf file and use it with +# -C+.conf on the command line. # -#To check if your avrdude build has support for the linuxgpio programmer compiled in, -#use -c?type on the command line and look for linuxgpio in the list. If it's not available -#you need pass the --enable-linuxgpio=yes option to configure and recompile avrdude. +# To check if your avrdude build has support for the linuxgpio programmer +# compiled in, use -c?type on the command line and look for linuxgpio in the +# list. If it's not available you need pass the --enable-linuxgpio=yes option +# to configure and recompile avrdude. # -#programmer -# id = "linuxgpio"; -# desc = "Use the Linux sysfs interface to bitbang GPIO lines"; -# type = "linuxgpio"; -# reset = ?; -# sck = ?; -# mosi = ?; -# miso = ?; -#; +# +# #------------------------------------------------------------ +# # linuxgpio +# #------------------------------------------------------------ +# +# programmer +# id = "linuxgpio"; +# desc = "Use the Linux sysfs interface to bitbang GPIO lines"; +# type = "linuxgpio"; +# reset = ?; +# sck = ?; +# mosi = ?; +# miso = ?; +# ; @HAVE_LINUXGPIO_END@ @HAVE_LINUXSPI_BEGIN@ @@ -679,11 +679,11 @@ programmer # programmer - id = "linuxspi"; - desc = "Use Linux SPI device in /dev/spidev*"; - type = "linuxspi"; - connection_type = spi; - reset = 25; # Pi GPIO number - this is J8:22 + id = "linuxspi"; + desc = "Use Linux SPI device in /dev/spidev*"; + type = "linuxspi"; + connection_type = spi; + reset = 25; # Pi GPIO number - this is J8:22 ; @HAVE_LINUXSPI_END@ @@ -699,10 +699,10 @@ programmer # Basically STK500v2 protocol, with some glue to trigger the bootloader programmer - id = "wiring"; - desc = "Wiring"; - type = "wiring"; - connection_type = serial; + id = "wiring"; + desc = "Wiring"; + type = "wiring"; + connection_type = serial; ; #------------------------------------------------------------ @@ -710,10 +710,10 @@ programmer #------------------------------------------------------------ programmer - id = "arduino"; - desc = "Arduino"; - type = "arduino"; - connection_type = serial; + id = "arduino"; + desc = "Arduino"; + type = "arduino"; + connection_type = serial; ; #------------------------------------------------------------ @@ -721,10 +721,10 @@ programmer #------------------------------------------------------------ programmer - id = "xbee"; - desc = "XBee Series 2 Over-The-Air (XBeeBoot)"; - type = "xbee"; - connection_type = serial; + id = "xbee"; + desc = "XBee Series 2 Over-The-Air (XBeeBoot)"; + type = "xbee"; + connection_type = serial; ; #------------------------------------------------------------ @@ -752,25 +752,25 @@ programmer # these FTDI ICs has been designed. programmer - id = "avrftdi"; - desc = "FT2232D based generic programmer"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; - usbpid = 0x6010; - usbdev = "A"; -#ISP-signals - lower ADBUS-Nibble (default) - reset = 3; - sck = 0; - mosi = 1; - miso = 2; -#LED SIGNALs - higher ADBUS-Nibble -# errled = 4; -# rdyled = 5; -# pgmled = 6; -# vfyled = 7; -#Buffer Signal - ACBUS - Nibble -# buff = 8; + id = "avrftdi"; + desc = "FT2232D based generic programmer"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; + usbpid = 0x6010; + usbdev = "A"; +# ISP-signals - lower ADBUS-Nibble (default) + reset = 3; + sck = 0; + mosi = 1; + miso = 2; +# LED SIGNALs - higher ADBUS-Nibble +# errled = 4; +# rdyled = 5; +# pgmled = 6; +# vfyled = 7; +# Buffer Signal - ACBUS - Nibble +# buff = 8; ; #------------------------------------------------------------ @@ -781,27 +781,27 @@ programmer # 4 LEDs directly attached, all active low. programmer - id = "2232HIO"; - desc = "FT2232H based generic programmer"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; + id = "2232HIO"; + desc = "FT2232H based generic programmer"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; # Note: This PID is reserved for generic H devices and # should be programmed into the EEPROM -# usbpid = 0x8A48; - usbpid = 0x6010; - usbdev = "A"; - buff = ~4; +# usbpid = 0x8A48; + usbpid = 0x6010; + usbdev = "A"; + buff = ~4; #ISP-signals - reset = 3; - sck = 0; - mosi = 1; - miso = 2; + reset = 3; + sck = 0; + mosi = 1; + miso = 2; #LED SIGNALs - errled = ~11; - rdyled = ~14; - pgmled = ~13; - vfyled = ~12; + errled = ~11; + rdyled = ~14; + pgmled = ~13; + vfyled = ~12; ; #------------------------------------------------------------ @@ -812,10 +812,9 @@ programmer #device ID of 0x6011. programmer parent "avrftdi" - id = "4232h"; - desc = "FT4232H based generic programmer"; - type = "avrftdi"; - usbpid = 0x6011; + id = "4232h"; + desc = "FT4232H based generic programmer"; + usbpid = 0x6011; ; #------------------------------------------------------------ @@ -823,24 +822,23 @@ programmer parent "avrftdi" #------------------------------------------------------------ programmer - id = "jtagkey"; - desc = "Amontec JTAGKey, JTAGKey-Tiny and JTAGKey2"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; -# Note: This PID is used in all JTAGKey variants - usbpid = 0xcff8; - usbdev = "A"; - buff = ~4; -#ISP-signals => 20 - Pin connector on JTAGKey - reset = 3; # TMS 7 violet - sck = 0; # TCK 9 white - mosi = 1; # TDI 5 green - miso = 2; # TDO 13 orange -# VTG VREF 1 brown with red tip -# GND GND 20 black -# The colors are on the 20 pin breakout cable -# from Amontec + id = "jtagkey"; + desc = "Amontec JTAGKey, JTAGKey-Tiny and JTAGKey2"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; +# Note: This PID is used in all JTAGKey variants + usbpid = 0xcff8; + usbdev = "A"; + buff = ~4; +# ISP-signals => 20 - Pin connector on JTAGKey + reset = 3; # TMS 7 violet + sck = 0; # TCK 9 white + mosi = 1; # TDI 5 green + miso = 2; # TDO 13 orange +# VTG VREF 1 brown with red tip +# GND GND 20 black +# The colors are on the 20 pin breakout cable from Amontec ; #------------------------------------------------------------ @@ -848,18 +846,18 @@ programmer #------------------------------------------------------------ programmer - id = "ft232h"; - desc = "FT232H in MPSSE mode"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; - usbpid = 0x6014; - usbdev = "A"; + id = "ft232h"; + desc = "FT232H in MPSSE mode"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; + usbpid = 0x6014; + usbdev = "A"; #ISP-signals - reset = 3; # AD3 (TMS) - sck = 0; # AD0 (TCK) - mosi = 1; # AD1 (TDI) - miso = 2; # AD2 (TDO) + reset = 3; # AD3 (TMS) + sck = 0; # AD0 (TCK) + mosi = 1; # AD1 (TDI) + miso = 2; # AD2 (TDO) ; #------------------------------------------------------------ @@ -875,10 +873,9 @@ programmer # a 16MHz Atmega1280 to program reliably. The 232H is conveniently 5V tolerant. programmer parent "ft232h" - id = "um232h"; - desc = "UM232H module from FTDI"; - type = "avrftdi"; - usbpid = 0x6014; + id = "um232h"; + desc = "UM232H module from FTDI"; + usbpid = 0x6014; ; #------------------------------------------------------------ @@ -894,10 +891,9 @@ programmer parent "ft232h" # a 16MHz Atmega1280 to program reliably. The 232H is conveniently 5V tolerant. programmer parent "ft232h" - id = "c232hm"; - desc = "C232HM cable from FTDI"; - type = "avrftdi"; - usbpid = 0x6014; + id = "c232hm"; + desc = "C232HM cable from FTDI"; + usbpid = 0x6014; ; #------------------------------------------------------------ @@ -919,13 +915,12 @@ programmer parent "ft232h" # It is basically the same entry as jtagkey with different usb ids. programmer parent "jtagkey" - id = "o-link"; - desc = "O-Link, OpenJTAG from www.100ask.net"; - type = "avrftdi"; - usbvid = 0x1457; - usbpid = 0x5118; - usbvendor = "www.100ask.net"; - usbproduct = "USB<=>JTAG&RS232"; + id = "o-link"; + desc = "O-Link, OpenJTAG from www.100ask.net"; + usbvid = 0x1457; + usbpid = 0x5118; + usbvendor = "www.100ask.net"; + usbproduct = "USB<=>JTAG&RS232"; ; #------------------------------------------------------------ @@ -935,16 +930,16 @@ programmer parent "jtagkey" # http://wiki.openmoko.org/wiki/Debug_Board_v3 programmer - id = "openmoko"; - desc = "Openmoko debug board (v3)"; - type = "avrftdi"; - usbvid = 0x1457; - usbpid = 0x5118; - usbdev = "A"; - reset = 3; # TMS 7 - sck = 0; # TCK 9 - mosi = 1; # TDI 5 - miso = 2; # TDO 13 + id = "openmoko"; + desc = "Openmoko debug board (v3)"; + type = "avrftdi"; + usbvid = 0x1457; + usbpid = 0x5118; + usbdev = "A"; + reset = 3; # TMS 7 + sck = 0; # TCK 9 + mosi = 1; # TDI 5 + miso = 2; # TDO 13 ; #------------------------------------------------------------ @@ -955,22 +950,22 @@ programmer # Schematic and user manual: http://www.cs.put.poznan.pl/wswitala/download/pdf/811EVBK.pdf programmer - id = "lm3s811"; - desc = "Luminary Micro LM3S811 Eval Board (Rev. A)"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; - usbpid = 0xbcd9; - usbdev = "A"; - usbvendor = "LMI"; - usbproduct = "LM3S811 Evaluation Board"; + id = "lm3s811"; + desc = "Luminary Micro LM3S811 Eval Board (Rev. A)"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; + usbpid = 0xbcd9; + usbdev = "A"; + usbvendor = "LMI"; + usbproduct = "LM3S811 Evaluation Board"; # Enable correct buffers - buff = 7; + buff = 7; #ISP-signals - lower ACBUS-Nibble (default) - reset = 3; - sck = 0; - mosi = 1; - miso = 2; + reset = 3; + sck = 0; + mosi = 1; + miso = 2; ; #------------------------------------------------------------ @@ -980,18 +975,18 @@ programmer # submitted as bug #46020 programmer - id = "tumpa"; - desc = "TIAO USB Multi-Protocol Adapter"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; - usbpid = 0x8a98; - usbdev = "A"; - usbvendor = "TIAO"; - reset = 3; # TMS 7 - sck = 0; # TCK 9 - mosi = 1; # TDI 5 - miso = 2; # TDO 13 + id = "tumpa"; + desc = "TIAO USB Multi-Protocol Adapter"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; + usbpid = 0x8a98; + usbdev = "A"; + usbvendor = "TIAO"; + reset = 3; # TMS 7 + sck = 0; # TCK 9 + mosi = 1; # TDI 5 + miso = 2; # TDO 13 ; #------------------------------------------------------------ @@ -1016,19 +1011,19 @@ programmer # * Powering target from JTAG pin 19 allows KT-LINK current measurement. programmer - id = "ktlink"; - desc = "KT-LINK FT2232H interface with IO switching and voltage buffers."; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; - usbpid = 0xbbe2; - usbdev = "A"; - buff = 5, ~10, ~13, ~14; - reset = 8; - sck = 0; - mosi = 1; - miso = 2; - rdyled = ~15; + id = "ktlink"; + desc = "KT-LINK FT2232H interface with IO switching and voltage buffers."; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; + usbpid = 0xbbe2; + usbdev = "A"; + buff = 5, ~10, ~13, ~14; + reset = 8; + sck = 0; + mosi = 1; + miso = 2; + rdyled = ~15; ; #------------------------------------------------------------ @@ -1036,11 +1031,11 @@ programmer #------------------------------------------------------------ programmer - id = "serialupdi"; - desc = "SerialUPDI"; - type = "serialupdi"; - connection_type = serial; - hvupdi_support = 1; + id = "serialupdi"; + desc = "SerialUPDI"; + type = "serialupdi"; + connection_type = serial; + hvupdi_support = 1; ; #------------------------------------------------------------ @@ -1048,10 +1043,10 @@ programmer #------------------------------------------------------------ programmer - id = "avrisp"; - desc = "Atmel AVR ISP"; - type = "stk500"; - connection_type = serial; + id = "avrisp"; + desc = "Atmel AVR ISP"; + type = "stk500"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1059,10 +1054,10 @@ programmer #------------------------------------------------------------ programmer - id = "avrispv2"; - desc = "Atmel AVR ISP V2"; - type = "stk500v2"; - connection_type = serial; + id = "avrispv2"; + desc = "Atmel AVR ISP V2"; + type = "stk500v2"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1070,10 +1065,10 @@ programmer #------------------------------------------------------------ programmer - id = "avrispmkII"; - desc = "Atmel AVR ISP mkII"; - type = "stk500v2"; - connection_type = usb; + id = "avrispmkII"; + desc = "Atmel AVR ISP mkII"; + type = "stk500v2"; + connection_type = usb; ; #------------------------------------------------------------ @@ -1081,8 +1076,7 @@ programmer #------------------------------------------------------------ programmer parent "avrispmkII" - id = "avrisp2"; - type = "stk500v2"; + id = "avrisp2"; ; #------------------------------------------------------------ @@ -1090,10 +1084,10 @@ programmer parent "avrispmkII" #------------------------------------------------------------ programmer - id = "buspirate"; - desc = "The Bus Pirate"; - type = "buspirate"; - connection_type = serial; + id = "buspirate"; + desc = "The Bus Pirate"; + type = "buspirate"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1101,17 +1095,17 @@ programmer #------------------------------------------------------------ programmer - id = "buspirate_bb"; - desc = "The Bus Pirate (bitbang interface, supports TPI)"; - type = "buspirate_bb"; - connection_type = serial; + id = "buspirate_bb"; + desc = "The Bus Pirate (bitbang interface, supports TPI)"; + type = "buspirate_bb"; + connection_type = serial; # pins are bits in bitbang byte (numbers are 87654321) # 1|POWER|PULLUP|AUX|MOSI|CLK|MISO|CS - reset = 1; - sck = 3; - mosi = 4; - miso = 2; - #vcc = 7; This is internally set independent of this setting. + reset = 1; + sck = 3; + mosi = 4; + miso = 2; + # vcc = 7; # Internally set independent of this setting ; #------------------------------------------------------------ @@ -1124,10 +1118,10 @@ programmer # below instead. programmer - id = "stk500"; - desc = "Atmel STK500"; - type = "stk500generic"; - connection_type = serial; + id = "stk500"; + desc = "Atmel STK500"; + type = "stk500generic"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1135,10 +1129,10 @@ programmer #------------------------------------------------------------ programmer - id = "stk500v1"; - desc = "Atmel STK500 Version 1.x firmware"; - type = "stk500"; - connection_type = serial; + id = "stk500v1"; + desc = "Atmel STK500 Version 1.x firmware"; + type = "stk500"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1146,10 +1140,10 @@ programmer #------------------------------------------------------------ programmer - id = "mib510"; - desc = "Crossbow MIB510 programming board"; - type = "stk500"; - connection_type = serial; + id = "mib510"; + desc = "Crossbow MIB510 programming board"; + type = "stk500"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1157,10 +1151,10 @@ programmer #------------------------------------------------------------ programmer - id = "stk500v2"; - desc = "Atmel STK500 Version 2.x firmware"; - type = "stk500v2"; - connection_type = serial; + id = "stk500v2"; + desc = "Atmel STK500 Version 2.x firmware"; + type = "stk500v2"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1168,10 +1162,10 @@ programmer #------------------------------------------------------------ programmer - id = "stk500pp"; - desc = "Atmel STK500 V2 in parallel programming mode"; - type = "stk500pp"; - connection_type = serial; + id = "stk500pp"; + desc = "Atmel STK500 V2 in parallel programming mode"; + type = "stk500pp"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1179,10 +1173,10 @@ programmer #------------------------------------------------------------ programmer - id = "stk500hvsp"; - desc = "Atmel STK500 V2 in high-voltage serial programming mode"; - type = "stk500hvsp"; - connection_type = serial; + id = "stk500hvsp"; + desc = "Atmel STK500 V2 in high-voltage serial programming mode"; + type = "stk500hvsp"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1190,10 +1184,10 @@ programmer #------------------------------------------------------------ programmer - id = "stk600"; - desc = "Atmel STK600"; - type = "stk600"; - connection_type = usb; + id = "stk600"; + desc = "Atmel STK600"; + type = "stk600"; + connection_type = usb; ; #------------------------------------------------------------ @@ -1201,10 +1195,10 @@ programmer #------------------------------------------------------------ programmer - id = "stk600pp"; - desc = "Atmel STK600 in parallel programming mode"; - type = "stk600pp"; - connection_type = usb; + id = "stk600pp"; + desc = "Atmel STK600 in parallel programming mode"; + type = "stk600pp"; + connection_type = usb; ; #------------------------------------------------------------ @@ -1212,10 +1206,10 @@ programmer #------------------------------------------------------------ programmer - id = "stk600hvsp"; - desc = "Atmel STK600 in high-voltage serial programming mode"; - type = "stk600hvsp"; - connection_type = usb; + id = "stk600hvsp"; + desc = "Atmel STK600 in high-voltage serial programming mode"; + type = "stk600hvsp"; + connection_type = usb; ; #------------------------------------------------------------ @@ -1223,10 +1217,10 @@ programmer #------------------------------------------------------------ programmer - id = "avr910"; - desc = "Atmel Low Cost Serial Programmer"; - type = "avr910"; - connection_type = serial; + id = "avr910"; + desc = "Atmel Low Cost Serial Programmer"; + type = "avr910"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1234,14 +1228,14 @@ programmer #------------------------------------------------------------ programmer - id = "ft245r"; - desc = "FT245R Synchronous BitBang"; - type = "ftdi_syncbb"; - connection_type = usb; - reset = 4; # D4 - sck = 0; # D0 - mosi = 2; # D2 - miso = 1; # D1 + id = "ft245r"; + desc = "FT245R Synchronous BitBang"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 4; # D4 + sck = 0; # D0 + mosi = 2; # D2 + miso = 1; # D1 ; #------------------------------------------------------------ @@ -1249,14 +1243,14 @@ programmer #------------------------------------------------------------ programmer - id = "ft232r"; - desc = "FT232R Synchronous BitBang"; - type = "ftdi_syncbb"; - connection_type = usb; - reset = 4; # DTR - sck = 0; # TxD - mosi = 2; # RTS - miso = 1; # RxD + id = "ft232r"; + desc = "FT232R Synchronous BitBang"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 4; # DTR + sck = 0; # TxD + mosi = 2; # RTS + miso = 1; # RxD ; #------------------------------------------------------------ @@ -1266,14 +1260,14 @@ programmer # see http://www.bitwizard.nl/wiki/index.php/FTDI_ATmega programmer - id = "bwmega"; - desc = "BitWizard ftdi_atmega builtin programmer"; - type = "ftdi_syncbb"; - connection_type = usb; - reset = 7; # RI - sck = 6; # DCD - mosi = 3; # CTS - miso = 5; # DSR + id = "bwmega"; + desc = "BitWizard ftdi_atmega builtin programmer"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 7; # RI + sck = 6; # DCD + mosi = 3; # CTS + miso = 5; # DSR ; #------------------------------------------------------------ @@ -1284,14 +1278,14 @@ programmer # Note: pins are numbered from 1! programmer - id = "arduino-ft232r"; - desc = "Arduino: FT232R connected to ISP"; - type = "ftdi_syncbb"; - connection_type = usb; - reset = 7; # RI X3(4) - sck = 5; # DSR X3(2) - mosi = 6; # DCD X3(3) - miso = 3; # CTS X3(1) + id = "arduino-ft232r"; + desc = "Arduino: FT232R connected to ISP"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 7; # RI X3(4) + sck = 5; # DSR X3(2) + mosi = 6; # DCD X3(3) + miso = 3; # CTS X3(1) ; #------------------------------------------------------------ @@ -1299,15 +1293,15 @@ programmer #------------------------------------------------------------ programmer - id = "tc2030"; - desc = "Tag-Connect TC2030"; - type = "ftdi_syncbb"; - connection_type = usb; + id = "tc2030"; + desc = "Tag-Connect TC2030"; + type = "ftdi_syncbb"; + connection_type = usb; # FOR TPI devices: - reset = 3; # CTS = D3 (wire to ~RESET) - sck = 2; # RTS = D2 (wire to SCK) - mosi = 0; # TxD = D0 (wire to TPIDATA via 1k resistor) - miso = 1; # RxD = D1 (wire to TPIDATA directly) + reset = 3; # CTS = D3 (wire to ~RESET) + sck = 2; # RTS = D2 (wire to SCK) + mosi = 0; # TxD = D0 (wire to TPIDATA via 1k resistor) + miso = 1; # RxD = D1 (wire to TPIDATA directly) ; #------------------------------------------------------------ @@ -1317,9 +1311,8 @@ programmer # website mentioned above uses this id programmer parent "arduino-ft232r" - id = "diecimila"; - desc = "alias for arduino-ft232r"; - type = "ftdi_syncbb"; + id = "diecimila"; + desc = "alias for arduino-ft232r"; ; #------------------------------------------------------------ @@ -1334,14 +1327,14 @@ programmer parent "arduino-ft232r" # http://akizukidenshi.com/download/ds/akizuki/k6096_manual_20130816.pdf programmer - id = "uncompatino"; - desc = "uncompatino with all pairs of pins shorted"; - type = "ftdi_syncbb"; - connection_type = usb; - reset = 7; # ri - sck = 5; # dsr - mosi = 6; # dcd - miso = 3; # cts + id = "uncompatino"; + desc = "uncompatino with all pairs of pins shorted"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 7; # ri + sck = 5; # dsr + mosi = 6; # dcd + miso = 3; # cts ; #------------------------------------------------------------ @@ -1363,14 +1356,14 @@ programmer # the following table is adjusted. programmer - id = "ttl232r"; - desc = "FTDI TTL232R-5V with ICSP adapter"; - type = "ftdi_syncbb"; - connection_type = usb; - reset = 0; # txd - sck = 1; # rxd - mosi = 3; # cts - miso = 2; # rts + id = "ttl232r"; + desc = "FTDI TTL232R-5V with ICSP adapter"; + type = "ftdi_syncbb"; + connection_type = usb; + reset = 0; # txd + sck = 1; # rxd + mosi = 3; # cts + miso = 2; # rts ; #------------------------------------------------------------ @@ -1378,24 +1371,24 @@ programmer #------------------------------------------------------------ programmer - id = "usbasp"; - desc = "USBasp, http://www.fischl.de/usbasp/"; - type = "usbasp"; - connection_type = usb; - usbvid = 0x16c0; # VOTI - usbpid = 0x05dc; # Obdev's free shared PID - usbvendor = "www.fischl.de"; - usbproduct = "USBasp"; + id = "usbasp"; + desc = "USBasp, http://www.fischl.de/usbasp/"; + type = "usbasp"; + connection_type = usb; + usbvid = 0x16c0; # VOTI + usbpid = 0x05dc; # Obdev's free shared PID + usbvendor = "www.fischl.de"; + usbproduct = "USBasp"; # following variants are autodetected for id "usbasp" # original usbasp from fischl.de # see above "usbasp" # old usbasp from fischl.de - #usbvid = 0x03EB; # ATMEL - #usbpid = 0xC7B4; # (unoffical) USBasp - #usbvendor = "www.fischl.de"; - #usbproduct = "USBasp"; + # usbvid = 0x03EB; # ATMEL + # usbpid = 0xC7B4; # (unoffical) USBasp + # usbvendor = "www.fischl.de"; + # usbproduct = "USBasp"; # NIBObee (only if -P nibobee is given on command line) # see below "nibobee" @@ -1406,14 +1399,14 @@ programmer #------------------------------------------------------------ programmer - id = "nibobee"; - desc = "NIBObee"; - type = "usbasp"; - connection_type = usb; - usbvid = 0x16c0; # VOTI - usbpid = 0x092f; # NIBObee PID - usbvendor = "www.nicai-systems.com"; - usbproduct = "NIBObee"; + id = "nibobee"; + desc = "NIBObee"; + type = "usbasp"; + connection_type = usb; + usbvid = 0x16c0; # VOTI + usbpid = 0x092f; # NIBObee PID + usbvendor = "www.nicai-systems.com"; + usbproduct = "NIBObee"; ; #------------------------------------------------------------ @@ -1421,14 +1414,12 @@ programmer #------------------------------------------------------------ programmer - id = "usbasp-clone"; - desc = "Any usbasp clone with correct VID/PID"; - type = "usbasp"; - connection_type = usb; - usbvid = 0x16c0; # VOTI - usbpid = 0x05dc; # Obdev's free shared PID - #usbvendor = ""; - #usbproduct = ""; + id = "usbasp-clone"; + desc = "Any usbasp clone with correct VID/PID"; + type = "usbasp"; + connection_type = usb; + usbvid = 0x16c0; # VOTI + usbpid = 0x05dc; # Obdev's free shared PID ; #------------------------------------------------------------ @@ -1441,12 +1432,12 @@ programmer # connects to TPIDATA. programmer - id = "usbtiny"; - desc = "USBtiny simple USB programmer, https://learn.adafruit.com/usbtinyisp"; - type = "usbtiny"; - connection_type = usb; - usbvid = 0x1781; - usbpid = 0x0c9f; + id = "usbtiny"; + desc = "USBtiny simple USB programmer, https://learn.adafruit.com/usbtinyisp"; + type = "usbtiny"; + connection_type = usb; + usbvid = 0x1781; + usbpid = 0x0c9f; ; #------------------------------------------------------------ @@ -1454,12 +1445,12 @@ programmer #------------------------------------------------------------ programmer - id = "arduinoisp"; - desc = "Arduino ISP Programmer"; - type = "usbtiny"; - connection_type = usb; - usbvid = 0x2341; - usbpid = 0x0049; + id = "arduinoisp"; + desc = "Arduino ISP Programmer"; + type = "usbtiny"; + connection_type = usb; + usbvid = 0x2341; + usbpid = 0x0049; ; #------------------------------------------------------------ @@ -1467,12 +1458,12 @@ programmer #------------------------------------------------------------ programmer - id = "arduinoisporg"; - desc = "Arduino ISP Programmer"; - type = "usbtiny"; - connection_type = usb; - usbvid = 0x2a03; - usbpid = 0x0049; + id = "arduinoisporg"; + desc = "Arduino ISP Programmer"; + type = "usbtiny"; + connection_type = usb; + usbvid = 0x2a03; + usbpid = 0x0049; ; #------------------------------------------------------------ @@ -1482,12 +1473,12 @@ programmer # commercial version of USBtiny, using a separate VID/PID programmer - id = "ehajo-isp"; - desc = "avr-isp-programmer from eHaJo, http://www.eHaJo.de"; - type = "usbtiny"; - connection_type = usb; - usbvid = 0x16d0; - usbpid = 0x0ba5; + id = "ehajo-isp"; + desc = "avr-isp-programmer from eHaJo, http://www.eHaJo.de"; + type = "usbtiny"; + connection_type = usb; + usbvid = 0x16d0; + usbpid = 0x0ba5; ; #------------------------------------------------------------ @@ -1498,12 +1489,12 @@ programmer # https://github.com/IowaScaledEngineering/ckt-avrprogrammer programmer - id = "iseavrprog"; - desc = "USBtiny-based programmer, https://iascaled.com"; - type = "usbtiny"; - connection_type = usb; - usbvid = 0x1209; - usbpid = 0x6570; + id = "iseavrprog"; + desc = "USBtiny-based programmer, https://iascaled.com"; + type = "usbtiny"; + connection_type = usb; + usbvid = 0x1209; + usbpid = 0x6570; ; #------------------------------------------------------------ @@ -1511,12 +1502,12 @@ programmer #------------------------------------------------------------ programmer - id = "micronucleus"; - desc = "Micronucleus Bootloader"; - type = "micronucleus"; - connection_type = usb; - usbvid = 0x16d0; - usbpid = 0x0753; + id = "micronucleus"; + desc = "Micronucleus Bootloader"; + type = "micronucleus"; + connection_type = usb; + usbvid = 0x16d0; + usbpid = 0x0753; ; #------------------------------------------------------------ @@ -1524,12 +1515,12 @@ programmer #------------------------------------------------------------ programmer - id = "teensy"; - desc = "Teensy Bootloader"; - type = "teensy"; - connection_type = usb; - usbvid = 0x16c0; - usbpid = 0x0478; + id = "teensy"; + desc = "Teensy Bootloader"; + type = "teensy"; + connection_type = usb; + usbvid = 0x16c0; + usbpid = 0x0478; ; #------------------------------------------------------------ @@ -1537,10 +1528,10 @@ programmer #------------------------------------------------------------ programmer - id = "butterfly"; - desc = "Atmel Butterfly Development Board"; - type = "butterfly"; - connection_type = serial; + id = "butterfly"; + desc = "Atmel Butterfly Development Board"; + type = "butterfly"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1548,10 +1539,10 @@ programmer #------------------------------------------------------------ programmer - id = "avr109"; - desc = "Atmel AppNote AVR109 Boot Loader"; - type = "butterfly"; - connection_type = serial; + id = "avr109"; + desc = "Atmel AppNote AVR109 Boot Loader"; + type = "butterfly"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1559,10 +1550,10 @@ programmer #------------------------------------------------------------ programmer - id = "avr911"; - desc = "Atmel AppNote AVR911 AVROSP"; - type = "butterfly"; - connection_type = serial; + id = "avr911"; + desc = "Atmel AppNote AVR911 AVROSP"; + type = "butterfly"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1572,10 +1563,10 @@ programmer # suggested in http://forum.mikrokopter.de/topic-post48317.html programmer - id = "mkbutterfly"; - desc = "Mikrokopter.de Butterfly"; - type = "butterfly_mk"; - connection_type = serial; + id = "mkbutterfly"; + desc = "Mikrokopter.de Butterfly"; + type = "butterfly_mk"; + connection_type = serial; ; #------------------------------------------------------------ @@ -1583,8 +1574,7 @@ programmer #------------------------------------------------------------ programmer parent "mkbutterfly" - id = "butterfly_mk"; - type = "butterfly_mk"; + id = "butterfly_mk"; ; #------------------------------------------------------------ @@ -1592,11 +1582,11 @@ programmer parent "mkbutterfly" #------------------------------------------------------------ programmer - id = "jtagmkI"; - desc = "Atmel JTAG ICE (mkI)"; - type = "jtagmki"; - connection_type = serial; - baudrate = 115200; # default is 115200 + id = "jtagmkI"; + desc = "Atmel JTAG ICE (mkI)"; + type = "jtagmki"; + connection_type = serial; + baudrate = 115200; # default is 115200 ; #------------------------------------------------------------ @@ -1606,8 +1596,7 @@ programmer # easier to type programmer parent "jtagmkI" - id = "jtag1"; - type = "jtagmki"; + id = "jtag1"; ; #------------------------------------------------------------ @@ -1617,9 +1606,8 @@ programmer parent "jtagmkI" # easier to type programmer parent "jtag1" - id = "jtag1slow"; - type = "jtagmki"; - baudrate = 19200; + id = "jtag1slow"; + baudrate = 19200; ; #------------------------------------------------------------ @@ -1632,11 +1620,11 @@ programmer parent "jtag1" # still free to use a serial port with the -P option. programmer - id = "jtagmkII"; - desc = "Atmel JTAG ICE mkII"; - type = "jtagmkii"; - connection_type = usb; - baudrate = 19200; # default is 19200 + id = "jtagmkII"; + desc = "Atmel JTAG ICE mkII"; + type = "jtagmkii"; + connection_type = usb; + baudrate = 19200; # default is 19200 ; #------------------------------------------------------------ @@ -1646,8 +1634,7 @@ programmer # easier to type programmer parent "jtagmkII" - id = "jtag2slow"; - type = "jtagmkii"; + id = "jtag2slow"; ; #------------------------------------------------------------ @@ -1657,9 +1644,8 @@ programmer parent "jtagmkII" # JTAG ICE mkII @ 115200 Bd programmer parent "jtag2slow" - id = "jtag2fast"; - type = "jtagmkii"; - baudrate = 115200; + id = "jtag2fast"; + baudrate = 115200; ; #------------------------------------------------------------ @@ -1669,8 +1655,7 @@ programmer parent "jtag2slow" # make the fast one the default, people will love that programmer parent "jtag2fast" - id = "jtag2"; - type = "jtagmkii"; + id = "jtag2"; ; #------------------------------------------------------------ @@ -1680,11 +1665,11 @@ programmer parent "jtag2fast" # JTAG ICE mkII in ISP mode programmer - id = "jtag2isp"; - desc = "Atmel JTAG ICE mkII in ISP mode"; - type = "jtagmkii_isp"; - connection_type = usb; - baudrate = 115200; + id = "jtag2isp"; + desc = "Atmel JTAG ICE mkII in ISP mode"; + type = "jtagmkii_isp"; + connection_type = usb; + baudrate = 115200; ; #------------------------------------------------------------ @@ -1694,11 +1679,11 @@ programmer # JTAG ICE mkII in debugWire mode programmer - id = "jtag2dw"; - desc = "Atmel JTAG ICE mkII in debugWire mode"; - type = "jtagmkii_dw"; - connection_type = usb; - baudrate = 115200; + id = "jtag2dw"; + desc = "Atmel JTAG ICE mkII in debugWire mode"; + type = "jtagmkii_dw"; + connection_type = usb; + baudrate = 115200; ; #------------------------------------------------------------ @@ -1708,11 +1693,11 @@ programmer # JTAG ICE mkII in AVR32 mode programmer - id = "jtagmkII_avr32"; - desc = "Atmel JTAG ICE mkII im AVR32 mode"; - type = "jtagmkii_avr32"; - connection_type = usb; - baudrate = 115200; + id = "jtagmkII_avr32"; + desc = "Atmel JTAG ICE mkII im AVR32 mode"; + type = "jtagmkii_avr32"; + connection_type = usb; + baudrate = 115200; ; #------------------------------------------------------------ @@ -1722,11 +1707,11 @@ programmer # JTAG ICE mkII in AVR32 mode programmer - id = "jtag2avr32"; - desc = "Atmel JTAG ICE mkII im AVR32 mode"; - type = "jtagmkii_avr32"; - connection_type = usb; - baudrate = 115200; + id = "jtag2avr32"; + desc = "Atmel JTAG ICE mkII im AVR32 mode"; + type = "jtagmkii_avr32"; + connection_type = usb; + baudrate = 115200; ; #------------------------------------------------------------ @@ -1736,11 +1721,11 @@ programmer # JTAG ICE mkII in PDI mode programmer - id = "jtag2pdi"; - desc = "Atmel JTAG ICE mkII PDI mode"; - type = "jtagmkii_pdi"; - connection_type = usb; - baudrate = 115200; + id = "jtag2pdi"; + desc = "Atmel JTAG ICE mkII PDI mode"; + type = "jtagmkii_pdi"; + connection_type = usb; + baudrate = 115200; ; #------------------------------------------------------------ @@ -1750,11 +1735,11 @@ programmer # AVR Dragon in JTAG mode programmer - id = "dragon_jtag"; - desc = "Atmel AVR Dragon in JTAG mode"; - type = "dragon_jtag"; - connection_type = usb; - baudrate = 115200; + id = "dragon_jtag"; + desc = "Atmel AVR Dragon in JTAG mode"; + type = "dragon_jtag"; + connection_type = usb; + baudrate = 115200; ; #------------------------------------------------------------ @@ -1764,11 +1749,11 @@ programmer # AVR Dragon in ISP mode programmer - id = "dragon_isp"; - desc = "Atmel AVR Dragon in ISP mode"; - type = "dragon_isp"; - connection_type = usb; - baudrate = 115200; + id = "dragon_isp"; + desc = "Atmel AVR Dragon in ISP mode"; + type = "dragon_isp"; + connection_type = usb; + baudrate = 115200; ; #------------------------------------------------------------ @@ -1778,11 +1763,11 @@ programmer # AVR Dragon in PP mode programmer - id = "dragon_pp"; - desc = "Atmel AVR Dragon in PP mode"; - type = "dragon_pp"; - connection_type = usb; - baudrate = 115200; + id = "dragon_pp"; + desc = "Atmel AVR Dragon in PP mode"; + type = "dragon_pp"; + connection_type = usb; + baudrate = 115200; ; #------------------------------------------------------------ @@ -1792,11 +1777,11 @@ programmer # AVR Dragon in HVSP mode programmer - id = "dragon_hvsp"; - desc = "Atmel AVR Dragon in HVSP mode"; - type = "dragon_hvsp"; - connection_type = usb; - baudrate = 115200; + id = "dragon_hvsp"; + desc = "Atmel AVR Dragon in HVSP mode"; + type = "dragon_hvsp"; + connection_type = usb; + baudrate = 115200; ; #------------------------------------------------------------ @@ -1806,11 +1791,11 @@ programmer # AVR Dragon in debugWire mode programmer - id = "dragon_dw"; - desc = "Atmel AVR Dragon in debugWire mode"; - type = "dragon_dw"; - connection_type = usb; - baudrate = 115200; + id = "dragon_dw"; + desc = "Atmel AVR Dragon in debugWire mode"; + type = "dragon_dw"; + connection_type = usb; + baudrate = 115200; ; #------------------------------------------------------------ @@ -1820,11 +1805,11 @@ programmer # AVR Dragon in PDI mode programmer - id = "dragon_pdi"; - desc = "Atmel AVR Dragon in PDI mode"; - type = "dragon_pdi"; - connection_type = usb; - baudrate = 115200; + id = "dragon_pdi"; + desc = "Atmel AVR Dragon in PDI mode"; + type = "dragon_pdi"; + connection_type = usb; + baudrate = 115200; ; #------------------------------------------------------------ @@ -1832,11 +1817,11 @@ programmer #------------------------------------------------------------ programmer - id = "jtag3"; - desc = "Atmel AVR JTAGICE3 in JTAG mode"; - type = "jtagice3"; - connection_type = usb; - usbpid = 0x2110, 0x2140; + id = "jtag3"; + desc = "Atmel AVR JTAGICE3 in JTAG mode"; + type = "jtagice3"; + connection_type = usb; + usbpid = 0x2110, 0x2140; ; #------------------------------------------------------------ @@ -1844,11 +1829,11 @@ programmer #------------------------------------------------------------ programmer - id = "jtag3pdi"; - desc = "Atmel AVR JTAGICE3 in PDI mode"; - type = "jtagice3_pdi"; - connection_type = usb; - usbpid = 0x2110, 0x2140; + id = "jtag3pdi"; + desc = "Atmel AVR JTAGICE3 in PDI mode"; + type = "jtagice3_pdi"; + connection_type = usb; + usbpid = 0x2110, 0x2140; ; #------------------------------------------------------------ @@ -1856,12 +1841,12 @@ programmer #------------------------------------------------------------ programmer - id = "jtag3updi"; - desc = "Atmel AVR JTAGICE3 in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2110, 0x2140; - hvupdi_support = 1; + id = "jtag3updi"; + desc = "Atmel AVR JTAGICE3 in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2110, 0x2140; + hvupdi_support = 1; ; #------------------------------------------------------------ @@ -1869,11 +1854,11 @@ programmer #------------------------------------------------------------ programmer - id = "jtag3dw"; - desc = "Atmel AVR JTAGICE3 in debugWIRE mode"; - type = "jtagice3_dw"; - connection_type = usb; - usbpid = 0x2110, 0x2140; + id = "jtag3dw"; + desc = "Atmel AVR JTAGICE3 in debugWIRE mode"; + type = "jtagice3_dw"; + connection_type = usb; + usbpid = 0x2110, 0x2140; ; #------------------------------------------------------------ @@ -1881,11 +1866,11 @@ programmer #------------------------------------------------------------ programmer - id = "jtag3isp"; - desc = "Atmel AVR JTAGICE3 in ISP mode"; - type = "jtagice3_isp"; - connection_type = usb; - usbpid = 0x2110, 0x2140; + id = "jtag3isp"; + desc = "Atmel AVR JTAGICE3 in ISP mode"; + type = "jtagice3_isp"; + connection_type = usb; + usbpid = 0x2110, 0x2140; ; #------------------------------------------------------------ @@ -1893,11 +1878,11 @@ programmer #------------------------------------------------------------ programmer - id = "xplainedpro"; - desc = "Atmel AVR XplainedPro in JTAG mode"; - type = "jtagice3"; - connection_type = usb; - usbpid = 0x2111; + id = "xplainedpro"; + desc = "Atmel AVR XplainedPro in JTAG mode"; + type = "jtagice3"; + connection_type = usb; + usbpid = 0x2111; ; #------------------------------------------------------------ @@ -1905,12 +1890,12 @@ programmer #------------------------------------------------------------ programmer - id = "xplainedpro_updi"; - desc = "Atmel AVR XplainedPro in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2111; - hvupdi_support = 1; + id = "xplainedpro_updi"; + desc = "Atmel AVR XplainedPro in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2111; + hvupdi_support = 1; ; #------------------------------------------------------------ @@ -1918,11 +1903,11 @@ programmer #------------------------------------------------------------ programmer - id = "xplainedmini"; - desc = "Atmel AVR XplainedMini in ISP mode"; - type = "jtagice3_isp"; - connection_type = usb; - usbpid = 0x2145; + id = "xplainedmini"; + desc = "Atmel AVR XplainedMini in ISP mode"; + type = "jtagice3_isp"; + connection_type = usb; + usbpid = 0x2145; ; #------------------------------------------------------------ @@ -1930,11 +1915,11 @@ programmer #------------------------------------------------------------ programmer - id = "xplainedmini_dw"; - desc = "Atmel AVR XplainedMini in debugWIRE mode"; - type = "jtagice3_dw"; - connection_type = usb; - usbpid = 0x2145; + id = "xplainedmini_dw"; + desc = "Atmel AVR XplainedMini in debugWIRE mode"; + type = "jtagice3_dw"; + connection_type = usb; + usbpid = 0x2145; ; #------------------------------------------------------------ @@ -1942,12 +1927,12 @@ programmer #------------------------------------------------------------ programmer - id = "xplainedmini_updi"; - desc = "Atmel AVR XplainedMini in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2145; - hvupdi_support = 1; + id = "xplainedmini_updi"; + desc = "Atmel AVR XplainedMini in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2145; + hvupdi_support = 1; ; #------------------------------------------------------------ @@ -1955,11 +1940,11 @@ programmer #------------------------------------------------------------ programmer - id = "atmelice"; - desc = "Atmel-ICE (ARM/AVR) in JTAG mode"; - type = "jtagice3"; - connection_type = usb; - usbpid = 0x2141; + id = "atmelice"; + desc = "Atmel-ICE (ARM/AVR) in JTAG mode"; + type = "jtagice3"; + connection_type = usb; + usbpid = 0x2141; ; #------------------------------------------------------------ @@ -1967,11 +1952,11 @@ programmer #------------------------------------------------------------ programmer - id = "atmelice_pdi"; - desc = "Atmel-ICE (ARM/AVR) in PDI mode"; - type = "jtagice3_pdi"; - connection_type = usb; - usbpid = 0x2141; + id = "atmelice_pdi"; + desc = "Atmel-ICE (ARM/AVR) in PDI mode"; + type = "jtagice3_pdi"; + connection_type = usb; + usbpid = 0x2141; ; #------------------------------------------------------------ @@ -1979,12 +1964,12 @@ programmer #------------------------------------------------------------ programmer - id = "atmelice_updi"; - desc = "Atmel-ICE (ARM/AVR) in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2141; - hvupdi_support = 1; + id = "atmelice_updi"; + desc = "Atmel-ICE (ARM/AVR) in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2141; + hvupdi_support = 1; ; #------------------------------------------------------------ @@ -1992,11 +1977,11 @@ programmer #------------------------------------------------------------ programmer - id = "atmelice_dw"; - desc = "Atmel-ICE (ARM/AVR) in debugWIRE mode"; - type = "jtagice3_dw"; - connection_type = usb; - usbpid = 0x2141; + id = "atmelice_dw"; + desc = "Atmel-ICE (ARM/AVR) in debugWIRE mode"; + type = "jtagice3_dw"; + connection_type = usb; + usbpid = 0x2141; ; #------------------------------------------------------------ @@ -2004,11 +1989,11 @@ programmer #------------------------------------------------------------ programmer - id = "atmelice_isp"; - desc = "Atmel-ICE (ARM/AVR) in ISP mode"; - type = "jtagice3_isp"; - connection_type = usb; - usbpid = 0x2141; + id = "atmelice_isp"; + desc = "Atmel-ICE (ARM/AVR) in ISP mode"; + type = "jtagice3_isp"; + connection_type = usb; + usbpid = 0x2141; ; #------------------------------------------------------------ @@ -2016,11 +2001,11 @@ programmer #------------------------------------------------------------ programmer - id = "powerdebugger"; - desc = "Atmel PowerDebugger (ARM/AVR) in JTAG mode"; - type = "jtagice3"; - connection_type = usb; - usbpid = 0x2144; + id = "powerdebugger"; + desc = "Atmel PowerDebugger (ARM/AVR) in JTAG mode"; + type = "jtagice3"; + connection_type = usb; + usbpid = 0x2144; ; #------------------------------------------------------------ @@ -2028,11 +2013,11 @@ programmer #------------------------------------------------------------ programmer - id = "powerdebugger_pdi"; - desc = "Atmel PowerDebugger (ARM/AVR) in PDI mode"; - type = "jtagice3_pdi"; - connection_type = usb; - usbpid = 0x2144; + id = "powerdebugger_pdi"; + desc = "Atmel PowerDebugger (ARM/AVR) in PDI mode"; + type = "jtagice3_pdi"; + connection_type = usb; + usbpid = 0x2144; ; #------------------------------------------------------------ @@ -2040,12 +2025,12 @@ programmer #------------------------------------------------------------ programmer - id = "powerdebugger_updi"; - desc = "Atmel PowerDebugger (ARM/AVR) in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2144; - hvupdi_support = 0, 1; + id = "powerdebugger_updi"; + desc = "Atmel PowerDebugger (ARM/AVR) in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2144; + hvupdi_support = 0, 1; ; #------------------------------------------------------------ @@ -2053,11 +2038,11 @@ programmer #------------------------------------------------------------ programmer - id = "powerdebugger_dw"; - desc = "Atmel PowerDebugger (ARM/AVR) in debugWire mode"; - type = "jtagice3_dw"; - connection_type = usb; - usbpid = 0x2144; + id = "powerdebugger_dw"; + desc = "Atmel PowerDebugger (ARM/AVR) in debugWire mode"; + type = "jtagice3_dw"; + connection_type = usb; + usbpid = 0x2144; ; #------------------------------------------------------------ @@ -2065,11 +2050,11 @@ programmer #------------------------------------------------------------ programmer - id = "powerdebugger_isp"; - desc = "Atmel PowerDebugger (ARM/AVR) in ISP mode"; - type = "jtagice3_isp"; - connection_type = usb; - usbpid = 0x2144; + id = "powerdebugger_isp"; + desc = "Atmel PowerDebugger (ARM/AVR) in ISP mode"; + type = "jtagice3_isp"; + connection_type = usb; + usbpid = 0x2144; ; #------------------------------------------------------------ @@ -2077,12 +2062,12 @@ programmer #------------------------------------------------------------ programmer - id = "pickit4_updi"; - desc = "MPLAB(R) PICkit 4 in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2177, 0x2178, 0x2179; - hvupdi_support = 0, 1, 2; + id = "pickit4_updi"; + desc = "MPLAB(R) PICkit 4 in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2177, 0x2178, 0x2179; + hvupdi_support = 0, 1, 2; ; #------------------------------------------------------------ @@ -2090,11 +2075,11 @@ programmer #------------------------------------------------------------ programmer - id = "pickit4_pdi"; - desc = "MPLAB(R) PICkit 4 in PDI mode"; - type = "jtagice3_pdi"; - connection_type = usb; - usbpid = 0x2177, 0x2178, 0x2179; + id = "pickit4_pdi"; + desc = "MPLAB(R) PICkit 4 in PDI mode"; + type = "jtagice3_pdi"; + connection_type = usb; + usbpid = 0x2177, 0x2178, 0x2179; ; #------------------------------------------------------------ @@ -2102,11 +2087,11 @@ programmer #------------------------------------------------------------ programmer - id = "pickit4_isp"; - desc = "MPLAB(R) PICkit 4 in ISP mode"; - type = "jtagice3_isp"; - connection_type = usb; - usbpid = 0x2177, 0x2178, 0x2179; + id = "pickit4_isp"; + desc = "MPLAB(R) PICkit 4 in ISP mode"; + type = "jtagice3_isp"; + connection_type = usb; + usbpid = 0x2177, 0x2178, 0x2179; ; #------------------------------------------------------------ @@ -2114,12 +2099,12 @@ programmer #------------------------------------------------------------ programmer - id = "snap_updi"; - desc = "MPLAB(R) SNAP in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x217f, 0x2180, 0x2181; - hvupdi_support = 1; + id = "snap_updi"; + desc = "MPLAB(R) SNAP in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x217f, 0x2180, 0x2181; + hvupdi_support = 1; ; #------------------------------------------------------------ @@ -2127,11 +2112,11 @@ programmer #------------------------------------------------------------ programmer - id = "snap_pdi"; - desc = "MPLAB(R) SNAP in PDI mode"; - type = "jtagice3_pdi"; - connection_type = usb; - usbpid = 0x217f, 0x2180, 0x2181; + id = "snap_pdi"; + desc = "MPLAB(R) SNAP in PDI mode"; + type = "jtagice3_pdi"; + connection_type = usb; + usbpid = 0x217f, 0x2180, 0x2181; ; #------------------------------------------------------------ @@ -2139,11 +2124,11 @@ programmer #------------------------------------------------------------ programmer - id = "snap_isp"; - desc = "MPLAB(R) SNAP in ISP mode"; - type = "jtagice3_isp"; - connection_type = usb; - usbpid = 0x217f, 0x2180, 0x2181; + id = "snap_isp"; + desc = "MPLAB(R) SNAP in ISP mode"; + type = "jtagice3_isp"; + connection_type = usb; + usbpid = 0x217f, 0x2180, 0x2181; ; #------------------------------------------------------------ @@ -2151,12 +2136,12 @@ programmer #------------------------------------------------------------ programmer - id = "pkobn_updi"; - desc = "Curiosity nano (nEDBG) in UPDI mode"; - type = "jtagice3_updi"; - connection_type = usb; - usbpid = 0x2175; - hvupdi_support = 1; + id = "pkobn_updi"; + desc = "Curiosity nano (nEDBG) in UPDI mode"; + type = "jtagice3_updi"; + connection_type = usb; + usbpid = 0x2175; + hvupdi_support = 1; ; #------------------------------------------------------------ @@ -2164,10 +2149,10 @@ programmer #------------------------------------------------------------ programmer - id = "pavr"; - desc = "Jason Kyle's pAVR Serial Programmer"; - type = "avr910"; - connection_type = serial; + id = "pavr"; + desc = "Jason Kyle's pAVR Serial Programmer"; + type = "avr910"; + connection_type = serial; ; #------------------------------------------------------------ @@ -2175,10 +2160,10 @@ programmer #------------------------------------------------------------ programmer - id = "pickit2"; - desc = "MicroChip's PICkit2 Programmer"; - type = "pickit2"; - connection_type = usb; + id = "pickit2"; + desc = "MicroChip's PICkit2 Programmer"; + type = "pickit2"; + connection_type = usb; ; #------------------------------------------------------------ @@ -2186,10 +2171,10 @@ programmer #------------------------------------------------------------ programmer - id = "flip1"; - desc = "FLIP USB DFU protocol version 1 (doc7618)"; - type = "flip1"; - connection_type = usb; + id = "flip1"; + desc = "FLIP USB DFU protocol version 1 (doc7618)"; + type = "flip1"; + connection_type = usb; ; #------------------------------------------------------------ @@ -2197,10 +2182,10 @@ programmer #------------------------------------------------------------ programmer - id = "flip2"; - desc = "FLIP USB DFU protocol version 2 (AVR4023)"; - type = "flip2"; - connection_type = usb; + id = "flip2"; + desc = "FLIP USB DFU protocol version 2 (AVR4023)"; + type = "flip2"; + connection_type = usb; ; #------------------------------------------------------------ @@ -2228,14 +2213,14 @@ programmer # reset=!txd sck=rts mosi=dtr miso=cts programmer - id = "ponyser"; - desc = "design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts"; - type = "serbb"; - connection_type = serial; - reset = ~3; - sck = 7; - mosi = 4; - miso = 8; + id = "ponyser"; + desc = "design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts"; + type = "serbb"; + connection_type = serial; + reset = ~3; + sck = 7; + mosi = 4; + miso = 8; ; #------------------------------------------------------------ @@ -2246,9 +2231,8 @@ programmer # reset=!txd sck=rts mosi=dtr miso=cts programmer parent "ponyser" - id = "siprog"; - desc = "Lancos SI-Prog "; - type = "serbb"; + id = "siprog"; + desc = "Lancos SI-Prog "; ; #------------------------------------------------------------ @@ -2259,14 +2243,14 @@ programmer parent "ponyser" # reset=rts sck=dtr mosi=txd miso=cts programmer - id = "dasa"; - desc = "serial port banging, reset=rts sck=dtr mosi=txd miso=cts"; - type = "serbb"; - connection_type = serial; - reset = 7; - sck = 4; - mosi = 3; - miso = 8; + id = "dasa"; + desc = "serial port banging, reset=rts sck=dtr mosi=txd miso=cts"; + type = "serbb"; + connection_type = serial; + reset = 7; + sck = 4; + mosi = 3; + miso = 8; ; #------------------------------------------------------------ @@ -2277,32 +2261,32 @@ programmer # reset=!dtr sck=rts mosi=txd miso=cts programmer - id = "dasa3"; - desc = "serial port banging, reset=!dtr sck=rts mosi=txd miso=cts"; - type = "serbb"; - connection_type = serial; - reset = ~4; - sck = 7; - mosi = 3; - miso = 8; + id = "dasa3"; + desc = "serial port banging, reset=!dtr sck=rts mosi=txd miso=cts"; + type = "serbb"; + connection_type = serial; + reset = ~4; + sck = 7; + mosi = 3; + miso = 8; ; #------------------------------------------------------------ -# c2n232i +# C2N232i #------------------------------------------------------------ # C2N232i (jumper configuration "auto") # reset=dtr sck=!rts mosi=!txd miso=!cts programmer - id = "c2n232i"; - desc = "serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts"; - type = "serbb"; - connection_type = serial; - reset = 4; - sck = ~7; - mosi = ~3; - miso = ~8; + id = "c2n232i"; + desc = "serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts"; + type = "serbb"; + connection_type = serial; + reset = 4; + sck = ~7; + mosi = ~3; + miso = ~8; ; #------------------------------------------------------------ @@ -2313,14 +2297,15 @@ programmer # https://github.com/ElTangas/jtag2updi programmer - id = "jtag2updi"; - desc = "JTAGv2 to UPDI bridge"; - type = "jtagmkii_updi"; - connection_type = serial; - baudrate = 115200; - hvupdi_support = 1; + id = "jtag2updi"; + desc = "JTAGv2 to UPDI bridge"; + type = "jtagmkii_updi"; + connection_type = serial; + baudrate = 115200; + hvupdi_support = 1; ; + # # PART DEFINITIONS # @@ -2332,58 +2317,58 @@ programmer # This is an HVSP-only device. part - desc = "ATtiny11"; - id = "t11"; - stk500_devcode = 0x11; - chip_erase_delay = 20000; - signature = 0x1e 0x90 0x04; - serial = no; - timeout = 200; - hvsp_controlstack = + desc = "ATtiny11"; + id = "t11"; + stk500_devcode = 0x11; + chip_erase_delay = 20000; + signature = 0x1e 0x90 0x04; + serial = no; + timeout = 200; + hvsp_controlstack = 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x00, 0x68, 0x78, 0x68, 0x68, 0x00, 0x00, 0x68, 0x78, 0x78, 0x00, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; - hventerstabdelay = 100; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayus = 50; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayus = 50; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; programfusepolltimeout = 25; programlockpolltimeout = 25; - synchcycles = 6; + synchcycles = 6; memory "eeprom" - size = 64; - delay = 5; - blocksize = 64; - readsize = 256; + size = 64; + delay = 5; + blocksize = 64; + readsize = 256; ; memory "flash" - size = 1024; - delay = 3; - blocksize = 128; - readsize = 256; + size = 1024; + delay = 3; + blocksize = 128; + readsize = 256; ; memory "fuse" - size = 1; + size = 1; ; memory "lock" - size = 1; + size = 1; ; memory "signature" - size = 3; + size = 3; ; memory "calibration" - size = 1; + size = 1; ; ; @@ -2392,91 +2377,91 @@ part #------------------------------------------------------------ part - desc = "ATtiny12"; - id = "t12"; - stk500_devcode = 0x12; - avr910_devcode = 0x55; - chip_erase_delay = 20000; - signature = 0x1e 0x90 0x05; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - hvsp_controlstack = + desc = "ATtiny12"; + id = "t12"; + stk500_devcode = 0x12; + avr910_devcode = 0x55; + chip_erase_delay = 20000; + signature = 0x1e 0x90 0x05; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + hvsp_controlstack = 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x00, 0x68, 0x78, 0x68, 0x68, 0x00, 0x00, 0x68, 0x78, 0x78, 0x00, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; - hventerstabdelay = 100; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayus = 50; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayus = 50; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; programfusepolltimeout = 25; programlockpolltimeout = 25; - synchcycles = 6; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + synchcycles = 6; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 64; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0xff 0xff; - mode = 4; - delay = 8; - blocksize = 64; - readsize = 256; - read = "1010.0000--xxxx.xxxx--xxaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + size = 64; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0xff 0xff; + mode = 4; + delay = 8; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xxaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; ; memory "flash" - size = 1024; - min_write_delay = 4500; - max_write_delay = 20000; - readback = 0xff 0xff; - mode = 4; - delay = 5; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - write_lo = "0100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; - write_hi = "0100.1000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + size = 1024; + min_write_delay = 4500; + max_write_delay = 20000; + readback = 0xff 0xff; + mode = 4; + delay = 5; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--xxxx.xxxx--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--101x.xxxx--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--101x.xxxx--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; - write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -2485,113 +2470,113 @@ part #------------------------------------------------------------ part - desc = "ATtiny13"; - id = "t13"; - stk500_devcode = 0x14; - chip_erase_delay = 4000; - signature = 0x1e 0x90 0x07; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - hvsp_controlstack = + desc = "ATtiny13"; + id = "t13"; + stk500_devcode = 0x14; + chip_erase_delay = 4000; + signature = 0x1e 0x90 0x07; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + hvsp_controlstack = 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; - flash_instr = 0xb4, 0x0e, 0x1e; - eeprom_instr = + flash_instr = 0xb4, 0x0e, 0x1e; + eeprom_instr = 0xbb, 0xfe, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xbc, 0x0e, 0xb4, 0x0e, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayus = 90; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayus = 90; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; programfusepolltimeout = 25; programlockpolltimeout = 25; - synchcycles = 6; - ocdrev = 0; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + synchcycles = 6; + ocdrev = 0; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 64; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4000; - readback = 0xff 0xff; - mode = 65; - delay = 5; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxx--xxaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--xxaa.aa00--xxxx.xxxx"; + size = 64; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4000; + readback = 0xff 0xff; + mode = 65; + delay = 5; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--xxaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xxaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 1024; - page_size = 32; - num_pages = 32; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 32; - readsize = 256; - read_lo = "0010.0000--0000.000a--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.000a--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.000a--aaaa.xxxx--xxxx.xxxx"; + paged = yes; + size = 1024; + page_size = 32; + num_pages = 32; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.000a--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.000a--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.000a--aaaa.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 2; - read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + size = 2; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -2600,8 +2585,8 @@ part #------------------------------------------------------------ part parent "t13" - desc = "ATtiny13A"; - id = "t13a"; + desc = "ATtiny13A"; + id = "t13a"; ; #------------------------------------------------------------ @@ -2609,92 +2594,92 @@ part parent "t13" #------------------------------------------------------------ part - desc = "ATtiny15"; - id = "t15"; - stk500_devcode = 0x13; - avr910_devcode = 0x56; - chip_erase_delay = 8200; - signature = 0x1e 0x90 0x06; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - hvsp_controlstack = + desc = "ATtiny15"; + id = "t15"; + stk500_devcode = 0x13; + avr910_devcode = 0x56; + chip_erase_delay = 8200; + signature = 0x1e 0x90 0x06; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + hvsp_controlstack = 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x00, 0x68, 0x78, 0x68, 0x68, 0x00, 0x00, 0x68, 0x78, 0x78, 0x00, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; - hventerstabdelay = 100; - latchcycles = 16; - togglevtg = 1; - poweroffdelay = 25; - resetdelayus = 50; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; + hventerstabdelay = 100; + latchcycles = 16; + togglevtg = 1; + poweroffdelay = 25; + resetdelayus = 50; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; programfusepolltimeout = 25; programlockpolltimeout = 25; - synchcycles = 6; - hvspcmdexedelay = 5; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + synchcycles = 6; + hvspcmdexedelay = 5; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 64; - min_write_delay = 8200; - max_write_delay = 8200; - readback = 0xff 0xff; - mode = 4; - delay = 10; - blocksize = 64; - readsize = 256; - read = "1010.0000--xxxx.xxxx--xxaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + size = 64; + min_write_delay = 8200; + max_write_delay = 8200; + readback = 0xff 0xff; + mode = 4; + delay = 10; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xxaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; ; memory "flash" - size = 1024; - min_write_delay = 4100; - max_write_delay = 4100; - readback = 0xff 0xff; - mode = 4; - delay = 5; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - write_lo = "0100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; - write_hi = "0100.1000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + size = 1024; + min_write_delay = 4100; + max_write_delay = 4100; + readback = 0xff 0xff; + mode = 4; + delay = 5; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--xxxx.xxxx--xxxx.xxxx--oooo.xxoo"; - write = "1010.1100--101x.xxxx--xxxx.xxxx--iiii.11ii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--oooo.xxoo"; + write = "1010.1100--101x.xxxx--xxxx.xxxx--iiii.11ii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; - write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -2703,77 +2688,77 @@ part #------------------------------------------------------------ part - desc = "AT90S1200"; - id = "1200"; - stk500_devcode = 0x33; - avr910_devcode = 0x13; - chip_erase_delay = 20000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x90 0x01; - is_at90s1200 = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 1; - pollvalue = 0xff; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "AT90S1200"; + id = "1200"; + stk500_devcode = 0x33; + avr910_devcode = 0x13; + chip_erase_delay = 20000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x90 0x01; + is_at90s1200 = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 1; + pollvalue = 0xff; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - hvleavestabdelay = 15; - chiperasepulsewidth = 15; - programfusepulsewidth = 2; + hventerstabdelay = 100; + hvleavestabdelay = 15; + chiperasepulsewidth = 15; + programfusepulsewidth = 2; programlockpolltimeout = 1; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 64; - min_write_delay = 4000; - max_write_delay = 9000; - readback = 0x00 0xff; - mode = 4; - delay = 20; - blocksize = 32; - readsize = 256; - read = "1010.0000--xxxx.xxxx--xxaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + size = 64; + min_write_delay = 4000; + max_write_delay = 9000; + readback = 0x00 0xff; + mode = 4; + delay = 20; + blocksize = 32; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xxaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; ; memory "flash" - size = 1024; - min_write_delay = 4000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 2; - delay = 15; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - write_lo = "0100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; - write_hi = "0100.1000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + size = 1024; + min_write_delay = 4000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 2; + delay = 15; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" - size = 1; + size = 1; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 20000; - write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 20000; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; ; @@ -2782,75 +2767,75 @@ part #------------------------------------------------------------ part - desc = "AT90S4414"; - id = "4414"; - stk500_devcode = 0x50; - avr910_devcode = 0x28; - chip_erase_delay = 20000; - signature = 0x1e 0x92 0x01; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "AT90S4414"; + id = "4414"; + stk500_devcode = 0x50; + avr910_devcode = 0x28; + chip_erase_delay = 20000; + signature = 0x1e 0x92 0x01; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01; - hventerstabdelay = 100; - hvleavestabdelay = 15; - chiperasepulsewidth = 15; - programfusepulsewidth = 2; + hventerstabdelay = 100; + hvleavestabdelay = 15; + chiperasepulsewidth = 15; + programfusepulsewidth = 2; programlockpolltimeout = 1; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 256; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0x80 0x7f; - mode = 4; - delay = 12; - blocksize = 64; - readsize = 256; - read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + size = 256; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0x80 0x7f; + mode = 4; + delay = 12; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "flash" - size = 4096; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0x7f 0x7f; - mode = 4; - delay = 12; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - write_lo = "0100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; - write_hi = "0100.1000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + size = 4096; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0x7f 0x7f; + mode = 4; + delay = 12; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" - size = 1; + size = 1; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; ; @@ -2859,75 +2844,75 @@ part #------------------------------------------------------------ part - desc = "AT90S2313"; - id = "2313"; - stk500_devcode = 0x40; - avr910_devcode = 0x20; - chip_erase_delay = 20000; - signature = 0x1e 0x91 0x01; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "AT90S2313"; + id = "2313"; + stk500_devcode = 0x40; + avr910_devcode = 0x20; + chip_erase_delay = 20000; + signature = 0x1e 0x91 0x01; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - hvleavestabdelay = 15; - chiperasepulsewidth = 15; - programfusepulsewidth = 2; + hventerstabdelay = 100; + hvleavestabdelay = 15; + chiperasepulsewidth = 15; + programfusepulsewidth = 2; programlockpolltimeout = 1; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 128; - min_write_delay = 4000; - max_write_delay = 9000; - readback = 0x80 0x7f; - mode = 4; - delay = 12; - blocksize = 64; - readsize = 256; - read = "1010.0000--xxxx.xxxx--xaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + size = 128; + min_write_delay = 4000; + max_write_delay = 9000; + readback = 0x80 0x7f; + mode = 4; + delay = 12; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; ; memory "flash" - size = 2048; - min_write_delay = 4000; - max_write_delay = 9000; - readback = 0x7f 0x7f; - mode = 4; - delay = 12; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; - write_lo = "0100.0000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; - write_hi = "0100.1000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + size = 2048; + min_write_delay = 4000; + max_write_delay = 9000; + readback = 0x7f 0x7f; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" - size = 1; + size = 1; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - write = "1010.1100--111x.xiix--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + write = "1010.1100--111x.xiix--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; ; @@ -2937,81 +2922,81 @@ part part ##### WARNING: No XML file for device 'AT90S2333'! ##### - desc = "AT90S2333"; - id = "2333"; - stk500_devcode = 0x42; - avr910_devcode = 0x34; - chip_erase_delay = 20000; - signature = 0x1e 0x91 0x05; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "AT90S2333"; + id = "2333"; + stk500_devcode = 0x42; + avr910_devcode = 0x34; + chip_erase_delay = 20000; + signature = 0x1e 0x91 0x05; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - hvleavestabdelay = 15; - chiperasepulsewidth = 15; - programfusepulsewidth = 2; + hventerstabdelay = 100; + hvleavestabdelay = 15; + chiperasepulsewidth = 15; + programfusepulsewidth = 2; programlockpolltimeout = 1; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 128; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0x00 0xff; - mode = 4; - delay = 12; - blocksize = 128; - readsize = 256; - read = "1010.0000--xxxx.xxxx--xaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + size = 128; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0x00 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; ; memory "flash" - size = 2048; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0xff 0xff; - mode = 4; - delay = 12; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; - write_lo = "0100.0000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; - write_hi = "0100.1000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + size = 2048; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0xff 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 20000; + size = 1; + min_write_delay = 9000; + max_write_delay = 20000; pwroff_after_write = yes; - read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xxoo.oooo"; - write = "1010.1100--101i.iiii--xxxx.xxxx--xxxx.xxxx"; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xxoo.oooo"; + write = "1010.1100--101i.iiii--xxxx.xxxx--xxxx.xxxx"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 20000; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; - write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 20000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; ; @@ -3020,85 +3005,85 @@ part #------------------------------------------------------------ part - desc = "AT90S2343"; - id = "2343"; - stk500_devcode = 0x43; - avr910_devcode = 0x4c; - chip_erase_delay = 18000; - signature = 0x1e 0x91 0x03; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - hvsp_controlstack = + desc = "AT90S2343"; + id = "2343"; + stk500_devcode = 0x43; + avr910_devcode = 0x4c; + chip_erase_delay = 18000; + signature = 0x1e 0x91 0x03; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + hvsp_controlstack = 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x00, 0x68, 0x78, 0x68, 0x68, 0x00, 0x00, 0x68, 0x78, 0x78, 0x00, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; - hventerstabdelay = 100; - latchcycles = 1; - poweroffdelay = 25; - resetdelayus = 50; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; + hventerstabdelay = 100; + latchcycles = 1; + poweroffdelay = 25; + resetdelayus = 50; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; programfusepolltimeout = 25; programlockpolltimeout = 25; - synchcycles = 6; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + synchcycles = 6; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 128; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0x00 0xff; - mode = 4; - delay = 12; - blocksize = 64; - readsize = 256; - read = "1010.0000--0000.0000--xaaa.aaaa--oooo.oooo"; - write = "1100.0000--0000.0000--xaaa.aaaa--iiii.iiii"; + size = 128; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0x00 0xff; + mode = 4; + delay = 12; + blocksize = 64; + readsize = 256; + read = "1010.0000--0000.0000--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.0000--xaaa.aaaa--iiii.iiii"; ; memory "flash" - size = 2048; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0xff 0xff; - mode = 4; - delay = 12; - blocksize = 128; - readsize = 128; - read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; - write_lo = "0100.0000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; - write_hi = "0100.1000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + size = 2048; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0xff 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 128; + read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 20000; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--ooox.xxxo"; - write = "1010.1100--1011.111i--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 20000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--ooox.xxxo"; + write = "1010.1100--1011.111i--xxxx.xxxx--xxxx.xxxx"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 20000; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--ooox.xxxo"; - write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 20000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--ooox.xxxo"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; ; @@ -3107,81 +3092,81 @@ part #------------------------------------------------------------ part - desc = "AT90S4433"; - id = "4433"; - stk500_devcode = 0x51; - avr910_devcode = 0x30; - chip_erase_delay = 20000; - signature = 0x1e 0x92 0x03; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "AT90S4433"; + id = "4433"; + stk500_devcode = 0x51; + avr910_devcode = 0x30; + chip_erase_delay = 20000; + signature = 0x1e 0x92 0x03; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - hvleavestabdelay = 15; - chiperasepulsewidth = 15; - programfusepulsewidth = 2; + hventerstabdelay = 100; + hvleavestabdelay = 15; + chiperasepulsewidth = 15; + programfusepulsewidth = 2; programlockpolltimeout = 1; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 256; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0x00 0xff; - mode = 4; - delay = 12; - blocksize = 128; - readsize = 256; - read = "1010.0000--xxxx.xxxx--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxx--aaaa.aaaa--iiii.iiii"; + size = 256; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0x00 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read = "1010.0000--xxxx.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--aaaa.aaaa--iiii.iiii"; ; memory "flash" - size = 4096; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0xff 0xff; - mode = 4; - delay = 12; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; - write_lo = "0100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; - write_hi = "0100.1000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + size = 4096; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0xff 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 20000; + size = 1; + min_write_delay = 9000; + max_write_delay = 20000; pwroff_after_write = yes; - read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xxoo.oooo"; - write = "1010.1100--101i.iiii--xxxx.xxxx--xxxx.xxxx"; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xxoo.oooo"; + write = "1010.1100--101i.iiii--xxxx.xxxx--xxxx.xxxx"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 20000; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; - write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 20000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; ; @@ -3191,54 +3176,54 @@ part part ##### WARNING: No XML file for device 'AT90S4434'! ##### - desc = "AT90S4434"; - id = "4434"; - stk500_devcode = 0x52; - avr910_devcode = 0x6c; - chip_erase_delay = 20000; - signature = 0x1e 0x92 0x02; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + desc = "AT90S4434"; + id = "4434"; + stk500_devcode = 0x52; + avr910_devcode = 0x6c; + chip_erase_delay = 20000; + signature = 0x1e 0x92 0x02; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 256; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0x00 0xff; - read = "1010.0000--xxxx.xxxx--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxx--aaaa.aaaa--iiii.iiii"; + size = 256; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0x00 0xff; + read = "1010.0000--xxxx.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--aaaa.aaaa--iiii.iiii"; ; memory "flash" - size = 4096; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0xff 0xff; - read_lo = "0010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; - write_lo = "0100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; - write_hi = "0100.1000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + size = 4096; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0xff 0xff; + read_lo = "0010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 20000; - read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xxoo.oooo"; - write = "1010.1100--101i.iiii--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 20000; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xxoo.oooo"; + write = "1010.1100--101i.iiii--xxxx.xxxx--xxxx.xxxx"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 20000; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; - write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 20000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; ; @@ -3247,76 +3232,76 @@ part #------------------------------------------------------------ part - desc = "AT90S8515"; - id = "8515"; - stk500_devcode = 0x60; - avr910_devcode = 0x38; - chip_erase_delay = 20000; - signature = 0x1e 0x93 0x01; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "AT90S8515"; + id = "8515"; + stk500_devcode = 0x60; + avr910_devcode = 0x38; + chip_erase_delay = 20000; + signature = 0x1e 0x93 0x01; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepulsewidth = 15; - programfusepulsewidth = 2; + hventerstabdelay = 100; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepulsewidth = 15; + programfusepulsewidth = 2; programlockpolltimeout = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - min_write_delay = 4000; - max_write_delay = 9000; - readback = 0x80 0x7f; - mode = 4; - delay = 12; - blocksize = 128; - readsize = 256; - read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + size = 512; + min_write_delay = 4000; + max_write_delay = 9000; + readback = 0x80 0x7f; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "flash" - size = 8192; - min_write_delay = 4000; - max_write_delay = 9000; - readback = 0x7f 0x7f; - mode = 4; - delay = 12; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - write_lo = "0100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; - write_hi = "0100.1000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + size = 8192; + min_write_delay = 4000; + max_write_delay = 9000; + readback = 0x7f 0x7f; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" - size = 1; + size = 1; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; ; @@ -3325,80 +3310,80 @@ part #------------------------------------------------------------ part - desc = "AT90S8535"; - id = "8535"; - stk500_devcode = 0x61; - avr910_devcode = 0x68; - chip_erase_delay = 20000; - signature = 0x1e 0x93 0x03; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "AT90S8535"; + id = "8535"; + stk500_devcode = 0x61; + avr910_devcode = 0x68; + chip_erase_delay = 20000; + signature = 0x1e 0x93 0x03; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - hvleavestabdelay = 15; - chiperasepulsewidth = 15; - programfusepulsewidth = 2; + hventerstabdelay = 100; + hvleavestabdelay = 15; + chiperasepulsewidth = 15; + programfusepulsewidth = 2; programlockpolltimeout = 1; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0x00 0xff; - mode = 4; - delay = 12; - blocksize = 128; - readsize = 256; - read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + size = 512; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0x00 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "flash" - size = 8192; - min_write_delay = 9000; - max_write_delay = 20000; - readback = 0xff 0xff; - mode = 4; - delay = 12; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - write_lo = "0100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; - write_hi = "0100.1000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + size = 8192; + min_write_delay = 9000; + max_write_delay = 20000; + readback = 0xff 0xff; + mode = 4; + delay = 12; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write_lo = "0100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + write_hi = "0100.1000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; ; memory "fuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxxo"; - write = "1010.1100--1011.111i--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxxo"; + write = "1010.1100--1011.111i--xxxx.xxxx--xxxx.xxxx"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--ooxx.xxxx"; - write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--ooxx.xxxx"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; ; @@ -3407,84 +3392,84 @@ part #------------------------------------------------------------ part - desc = "ATmega103"; - id = "m103"; - stk500_devcode = 0xb1; - avr910_devcode = 0x41; - chip_erase_delay = 112000; - signature = 0x1e 0x97 0x01; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATmega103"; + id = "m103"; + stk500_devcode = 0xb1; + avr910_devcode = 0x41; + chip_erase_delay = 112000; + signature = 0x1e 0x97 0x01; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x8e, 0x9e, 0x2e, 0x3e, 0xae, 0xbe, 0x4e, 0x5e, 0xce, 0xde, 0x6e, 0x7e, 0xee, 0xde, 0x66, 0x76, 0xe6, 0xf6, 0x6a, 0x7a, 0xea, 0x7a, 0x7f, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - hvleavestabdelay = 15; - chiperasepulsewidth = 15; - programfusepulsewidth = 2; + hventerstabdelay = 100; + hvleavestabdelay = 15; + chiperasepulsewidth = 15; + programfusepulsewidth = 2; programlockpolltimeout = 10; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 4096; - min_write_delay = 4000; - max_write_delay = 9000; - readback = 0x80 0x7f; - mode = 4; - delay = 12; - blocksize = 64; - readsize = 256; - read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + size = 4096; + min_write_delay = 4000; + max_write_delay = 9000; + readback = 0x80 0x7f; + mode = 4; + delay = 12; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; ; memory "flash" - paged = yes; - size = 0x20000; - page_size = 256; - num_pages = 512; - min_write_delay = 22000; - max_write_delay = 56000; - readback = 0xff 0xff; - mode = 17; - delay = 70; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x20000; + page_size = 256; + num_pages = 512; + min_write_delay = 22000; + max_write_delay = 56000; + readback = 0xff 0xff; + mode = 17; + delay = 70; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "fuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xxox.o1oo"; - write = "1010.1100--1011.i1ii--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xxox.o1oo"; + write = "1010.1100--1011.i1ii--xxxx.xxxx--xxxx.xxxx"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; - write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xoox"; + write = "1010.1100--1111.1ii1--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; ; @@ -3493,115 +3478,115 @@ part #------------------------------------------------------------ part - desc = "ATmega64"; - id = "m64"; - stk500_devcode = 0xa0; - avr910_devcode = 0x45; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x96 0x02; - reset = io; - has_jtag = yes; + desc = "ATmega64"; + id = "m64"; + stk500_devcode = 0xa0; + avr910_devcode = 0x45; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x96 0x02; + reset = io; + has_jtag = yes; allowfullpagebitstream = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 6; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x22; - spmcr = 0x68; - ocdrev = 2; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x22; + spmcr = 0x68; + ocdrev = 2; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 2048; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 4; - delay = 20; - blocksize = 64; - readsize = 256; - read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + size = 2048; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 4; + delay = 20; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; ; memory "flash" - paged = yes; - size = 0x10000; - page_size = 256; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 33; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--xaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x10000; + page_size = 256; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--xaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 4; - read = "0011.1000--xxxx.xxxx--0000.00aa--oooo.oooo"; + size = 4; + read = "0011.1000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; ; @@ -3610,8 +3595,8 @@ part #------------------------------------------------------------ part parent "m64" - desc = "ATmega64A"; - id = "m64a"; + desc = "ATmega64A"; + id = "m64a"; ; #------------------------------------------------------------ @@ -3619,116 +3604,116 @@ part parent "m64" #------------------------------------------------------------ part - desc = "ATmega128"; - id = "m128"; - stk500_devcode = 0xb2; - avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x97 0x02; - reset = io; - has_jtag = yes; + desc = "ATmega128"; + id = "m128"; + stk500_devcode = 0xb2; + avr910_devcode = 0x43; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x97 0x02; + reset = io; + has_jtag = yes; allowfullpagebitstream = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 6; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x22; - rampz = 0x3b; - spmcr = 0x68; - ocdrev = 1; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x22; + rampz = 0x3b; + spmcr = 0x68; + ocdrev = 1; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 4096; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 4; - delay = 12; - blocksize = 64; - readsize = 256; - read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + size = 4096; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 4; + delay = 12; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; ; memory "flash" - paged = yes; - size = 0x20000; - page_size = 256; - num_pages = 512; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 33; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x20000; + page_size = 256; + num_pages = 512; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 4; - read = "0011.1000--xxxx.xxxx--0000.00aa--oooo.oooo"; + size = 4; + read = "0011.1000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; ; @@ -3737,8 +3722,8 @@ part #------------------------------------------------------------ part parent "m128" - desc = "ATmega128A"; - id = "m128a"; + desc = "ATmega128A"; + id = "m128a"; ; #------------------------------------------------------------ @@ -3746,119 +3731,119 @@ part parent "m128" #------------------------------------------------------------ part - desc = "AT90CAN128"; - id = "c128"; - stk500_devcode = 0xb3; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; -# avr910_devcode = 0x43; - signature = 0x1e 0x97 0x81; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "AT90CAN128"; + id = "c128"; + stk500_devcode = 0xb3; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; +# avr910_devcode = 0x43; + signature = 0x1e 0x97 0x81; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01; - hventerstabdelay = 100; - latchcycles = 6; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - rampz = 0x3b; - spmcr = 0x57; - eecr = 0x3f; - ocdrev = 3; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + eecr = 0x3f; + ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 4096; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 8; - readsize = 256; - read = "1010.0000--000x.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.aaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + size = 4096; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 8; + readsize = 256; + read = "1010.0000--000x.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x20000; - page_size = 256; - num_pages = 512; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x20000; + page_size = 256; + num_pages = 512; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -3867,119 +3852,119 @@ part #------------------------------------------------------------ part - desc = "AT90CAN64"; - id = "c64"; - stk500_devcode = 0xb3; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; -# avr910_devcode = 0x43; - signature = 0x1e 0x96 0x81; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "AT90CAN64"; + id = "c64"; + stk500_devcode = 0xb3; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; +# avr910_devcode = 0x43; + signature = 0x1e 0x96 0x81; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01; - hventerstabdelay = 100; - latchcycles = 6; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - rampz = 0x3b; - spmcr = 0x57; - eecr = 0x3f; - ocdrev = 3; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + eecr = 0x3f; + ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 2048; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 8; - readsize = 256; - read = "1010.0000--000x.xaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; + size = 2048; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 8; + readsize = 256; + read = "1010.0000--000x.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x10000; - page_size = 256; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x10000; + page_size = 256; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -3988,119 +3973,119 @@ part #------------------------------------------------------------ part - desc = "AT90CAN32"; - id = "c32"; - stk500_devcode = 0xb3; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; -# avr910_devcode = 0x43; - signature = 0x1e 0x95 0x81; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "AT90CAN32"; + id = "c32"; + stk500_devcode = 0xb3; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; +# avr910_devcode = 0x43; + signature = 0x1e 0x95 0x81; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01; - hventerstabdelay = 100; - latchcycles = 6; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - rampz = 0x3b; - spmcr = 0x57; - eecr = 0x3f; - ocdrev = 3; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + eecr = 0x3f; + ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 1024; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 8; - readsize = 256; - read = "1010.0000--000x.xxaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--00xx.xxaa--aaaa.a000--xxxx.xxxx"; + size = 1024; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 8; + readsize = 256; + read = "1010.0000--000x.xxaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.xxaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x8000; - page_size = 256; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x8000; + page_size = 256; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -4109,111 +4094,111 @@ part #------------------------------------------------------------ part - desc = "ATmega16"; - id = "m16"; - stk500_devcode = 0x82; - avr910_devcode = 0x74; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x94 0x03; - reset = io; - has_jtag = yes; + desc = "ATmega16"; + id = "m16"; + stk500_devcode = 0x82; + avr910_devcode = 0x74; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x94 0x03; + reset = io; + has_jtag = yes; allowfullpagebitstream = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - progmodedelay = 100; - latchcycles = 6; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + progmodedelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; - ocdrev = 2; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + spmcr = 0x57; + ocdrev = 2; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 4; - delay = 10; - blocksize = 128; - readsize = 256; - read = "1010.0000--00xx.xxaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--00xx.xxaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 4; + delay = 10; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.xxaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x4000; - page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 33; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 4; - read = "0011.1000--000x.xxxx--0000.00aa--oooo.oooo"; + size = 4; + read = "0011.1000--000x.xxxx--0000.00aa--oooo.oooo"; ; ; @@ -4222,8 +4207,8 @@ part #------------------------------------------------------------ part parent "m16" - desc = "ATmega16A"; - id = "m16a"; + desc = "ATmega16A"; + id = "m16a"; ; #------------------------------------------------------------ @@ -4231,119 +4216,119 @@ part parent "m16" #------------------------------------------------------------ part - desc = "ATmega324P"; - id = "m324p"; - stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one - avr910_devcode = 0x74; - chip_erase_delay = 55000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x95 0x08; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATmega324P"; + id = "m324p"; + stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one + avr910_devcode = 0x74; + chip_erase_delay = 55000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x95 0x08; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 1024; - page_size = 4; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 128; - readsize = 256; - read = "1010.0000--00xx.xaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--00xx.xaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xaaa--aaaa.aa00--xxxx.xxxx"; + size = 1024; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x8000; - page_size = 128; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 33; - delay = 6; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--0aaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x8000; + page_size = 128; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--0aaa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--1111.1iii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.1iii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -4352,17 +4337,17 @@ part #------------------------------------------------------------ part parent "m324p" - desc = "ATmega164P"; - id = "m164p"; - signature = 0x1e 0x94 0x0a; + desc = "ATmega164P"; + id = "m164p"; + signature = 0x1e 0x94 0x0a; memory "eeprom" - size = 512; + size = 512; ; memory "flash" - size = 0x4000; - num_pages = 128; + size = 0x4000; + num_pages = 128; ; ; @@ -4371,8 +4356,8 @@ part parent "m324p" #------------------------------------------------------------ part parent "m164p" - desc = "ATmega164PA"; - id = "m164pa"; + desc = "ATmega164PA"; + id = "m164pa"; ; #------------------------------------------------------------ @@ -4380,9 +4365,9 @@ part parent "m164p" #------------------------------------------------------------ part parent "m164p" - desc = "ATmega164A"; - id = "m164a"; - signature = 0x1e 0x94 0x0f; + desc = "ATmega164A"; + id = "m164a"; + signature = 0x1e 0x94 0x0f; ; #------------------------------------------------------------ @@ -4390,9 +4375,9 @@ part parent "m164p" #------------------------------------------------------------ part parent "m324p" - desc = "ATmega324PB"; - id = "m324pb"; - signature = 0x1e 0x95 0x17; + desc = "ATmega324PB"; + id = "m324pb"; + signature = 0x1e 0x95 0x17; ; #------------------------------------------------------------ @@ -4400,9 +4385,9 @@ part parent "m324p" #------------------------------------------------------------ part parent "m324p" - desc = "ATmega324PA"; - id = "m324pa"; - signature = 0x1e 0x95 0x11; + desc = "ATmega324PA"; + id = "m324pa"; + signature = 0x1e 0x95 0x11; ; #------------------------------------------------------------ @@ -4410,9 +4395,9 @@ part parent "m324p" #------------------------------------------------------------ part parent "m324p" - desc = "ATmega324A"; - id = "m324a"; - signature = 0x1e 0x95 0x15; + desc = "ATmega324A"; + id = "m324a"; + signature = 0x1e 0x95 0x15; ; #------------------------------------------------------------ @@ -4420,116 +4405,116 @@ part parent "m324p" #------------------------------------------------------------ part - desc = "ATmega644"; - id = "m644"; - stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one - avr910_devcode = 0x74; - chip_erase_delay = 55000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x96 0x09; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATmega644"; + id = "m644"; + stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one + avr910_devcode = 0x74; + chip_erase_delay = 55000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x96 0x09; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02; - hventerstabdelay = 100; - latchcycles = 6; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 2048; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 128; - readsize = 256; - read = "1010.0000--00xx.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--00xx.aaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + size = 2048; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x10000; - page_size = 256; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 33; - delay = 6; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--00xx.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--00xx.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x10000; + page_size = 256; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--1111.1iii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.1iii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -4538,8 +4523,8 @@ part #------------------------------------------------------------ part parent "m644" - desc = "ATmega644A"; - id = "m644a"; + desc = "ATmega644A"; + id = "m644a"; ; #------------------------------------------------------------ @@ -4547,9 +4532,9 @@ part parent "m644" #------------------------------------------------------------ part parent "m644" - desc = "ATmega644P"; - id = "m644p"; - signature = 0x1e 0x96 0x0a; + desc = "ATmega644P"; + id = "m644p"; + signature = 0x1e 0x96 0x0a; ; #------------------------------------------------------------ @@ -4557,9 +4542,9 @@ part parent "m644" #------------------------------------------------------------ part parent "m644" - desc = "ATmega644PA"; - id = "m644pa"; - signature = 0x1e 0x96 0x0a; + desc = "ATmega644PA"; + id = "m644pa"; + signature = 0x1e 0x96 0x0a; ; #------------------------------------------------------------ @@ -4567,120 +4552,120 @@ part parent "m644" #------------------------------------------------------------ part - desc = "ATmega1284"; - id = "m1284"; - stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one - avr910_devcode = 0x74; - chip_erase_delay = 55000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x97 0x06; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega1284"; + id = "m1284"; + stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one + avr910_devcode = 0x74; + chip_erase_delay = 55000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x97 0x06; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02; - hventerstabdelay = 100; - latchcycles = 6; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 6; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 4096; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 128; - readsize = 256; - read = "1010.0000--00xx.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--00xx.aaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + size = 4096; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x20000; - page_size = 256; - num_pages = 512; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--00xx.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--00xx.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x20000; + page_size = 256; + num_pages = 512; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--1111.1iii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.1iii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -4689,9 +4674,9 @@ part #------------------------------------------------------------ part parent "m1284" - desc = "ATmega1284P"; - id = "m1284p"; - signature = 0x1e 0x97 0x05; + desc = "ATmega1284P"; + id = "m1284p"; + signature = 0x1e 0x97 0x05; ; #------------------------------------------------------------ @@ -4699,117 +4684,117 @@ part parent "m1284" #------------------------------------------------------------ part - desc = "ATmega162"; - id = "m162"; - stk500_devcode = 0x83; - avr910_devcode = 0x63; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x94 0x04; - reset = io; - has_jtag = yes; + desc = "ATmega162"; + id = "m162"; + stk500_devcode = 0x83; + avr910_devcode = 0x63; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x94 0x04; + reset = io; + has_jtag = yes; allowfullpagebitstream = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 6; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x04; - spmcr = 0x57; - ocdrev = 2; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x04; + spmcr = 0x57; + ocdrev = 2; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--00xx.xxaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--00xx.xxaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--00xx.xxaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x4000; - page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 16000; - max_write_delay = 16000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 16000; + max_write_delay = 16000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 16000; - max_write_delay = 16000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 16000; + max_write_delay = 16000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 16000; - max_write_delay = 16000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--1111.1iii"; + size = 1; + min_write_delay = 16000; + max_write_delay = 16000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.1iii"; ; memory "lock" - size = 1; - min_write_delay = 16000; - max_write_delay = 16000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 16000; + max_write_delay = 16000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--00xx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--00xx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--00xx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--00xx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -4818,99 +4803,99 @@ part #------------------------------------------------------------ part - desc = "ATmega163"; - id = "m163"; - stk500_devcode = 0x81; - avr910_devcode = 0x64; - chip_erase_delay = 32000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x94 0x02; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATmega163"; + id = "m163"; + stk500_devcode = 0x81; + avr910_devcode = 0x64; + chip_erase_delay = 32000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x94 0x02; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - hvleavestabdelay = 15; - chiperasepolltimeout = 30; + hventerstabdelay = 100; + hvleavestabdelay = 15; + chiperasepolltimeout = 30; programfusepolltimeout = 2; programlockpolltimeout = 2; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - min_write_delay = 4000; - max_write_delay = 4000; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + size = 512; + min_write_delay = 4000; + max_write_delay = 4000; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "flash" - paged = yes; - size = 0x4000; - page_size = 128; - num_pages = 128; - min_write_delay = 16000; - max_write_delay = 16000; - readback = 0xff 0xff; - mode = 17; - delay = 20; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--xxxa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 16000; + max_write_delay = 16000; + readback = 0xff 0xff; + mode = 17; + delay = 20; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.0000--0000.0000--xxxx.xxxx--ooxx.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--ii11.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.0000--0000.0000--xxxx.xxxx--ooxx.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--ii11.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.1000--0000.1000--xxxx.xxxx--xxxx.1ooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--1111.1iii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.1000--xxxx.xxxx--xxxx.1ooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--1111.1iii"; ; memory "lock" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.1000--0000.0000--xxxx.0xxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.0000--xxxx.0xxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -4919,117 +4904,117 @@ part #------------------------------------------------------------ part - desc = "ATmega169"; - id = "m169"; - stk500_devcode = 0x85; - avr910_devcode = 0x78; - chip_erase_delay = 9000; - signature = 0x1e 0x94 0x05; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega169"; + id = "m169"; + stk500_devcode = 0x85; + avr910_devcode = 0x78; + chip_erase_delay = 9000; + signature = 0x1e 0x94 0x05; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; - ocdrev = 2; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + spmcr = 0x57; + ocdrev = 2; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x4000; - page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--xxxa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; ; memory "lock" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -5038,10 +5023,10 @@ part #------------------------------------------------------------ part parent "m169" - desc = "ATmega169A"; - id = "m169a"; - signature = 0x1e 0x94 0x11; - reset = io; + desc = "ATmega169A"; + id = "m169a"; + signature = 0x1e 0x94 0x11; + reset = io; ; #------------------------------------------------------------ @@ -5049,9 +5034,9 @@ part parent "m169" #------------------------------------------------------------ part parent "m169" - desc = "ATmega169P"; - id = "m169p"; - reset = io; + desc = "ATmega169P"; + id = "m169p"; + reset = io; ; #------------------------------------------------------------ @@ -5059,9 +5044,9 @@ part parent "m169" #------------------------------------------------------------ part parent "m169" - desc = "ATmega169PA"; - id = "m169pa"; - reset = io; + desc = "ATmega169PA"; + id = "m169pa"; + reset = io; ; #------------------------------------------------------------ @@ -5069,119 +5054,119 @@ part parent "m169" #------------------------------------------------------------ part - desc = "ATmega329"; - id = "m329"; -# stk500_devcode = 0x85; # no STK500 support, only STK500v2 -# avr910_devcode = 0x?; # try the ATmega169 one: - avr910_devcode = 0x75; - chip_erase_delay = 9000; - signature = 0x1e 0x95 0x03; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega329"; + id = "m329"; +# stk500_devcode = 0x85; # no STK500 support, only STK500v2 +# avr910_devcode = 0x?; # try the ATmega169 one: + avr910_devcode = 0x75; + chip_erase_delay = 9000; + signature = 0x1e 0x95 0x03; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 1024; - page_size = 4; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 8; - readsize = 256; - read = "1010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; + size = 1024; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x8000; - page_size = 128; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--xaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--xaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x8000; + page_size = 128; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--xaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--xaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -5190,8 +5175,8 @@ part #------------------------------------------------------------ part parent "m329" - desc = "ATmega329A"; - id = "m329a"; + desc = "ATmega329A"; + id = "m329a"; ; #------------------------------------------------------------ @@ -5199,9 +5184,9 @@ part parent "m329" #------------------------------------------------------------ part parent "m329" - desc = "ATmega329P"; - id = "m329p"; - signature = 0x1e 0x95 0x0b; + desc = "ATmega329P"; + id = "m329p"; + signature = 0x1e 0x95 0x0b; ; #------------------------------------------------------------ @@ -5209,9 +5194,9 @@ part parent "m329" #------------------------------------------------------------ part parent "m329" - desc = "ATmega329PA"; - id = "m329pa"; - signature = 0x1e 0x95 0x0b; + desc = "ATmega329PA"; + id = "m329pa"; + signature = 0x1e 0x95 0x0b; ; #------------------------------------------------------------ @@ -5219,9 +5204,9 @@ part parent "m329" #------------------------------------------------------------ part parent "m329" - desc = "ATmega3290"; - id = "m3290"; - signature = 0x1e 0x95 0x04; + desc = "ATmega3290"; + id = "m3290"; + signature = 0x1e 0x95 0x04; ; #------------------------------------------------------------ @@ -5229,9 +5214,9 @@ part parent "m329" #------------------------------------------------------------ part parent "m329" - desc = "ATmega3290A"; - id = "m3290a"; - signature = 0x1e 0x95 0x04; + desc = "ATmega3290A"; + id = "m3290a"; + signature = 0x1e 0x95 0x04; ; #------------------------------------------------------------ @@ -5239,9 +5224,9 @@ part parent "m329" #------------------------------------------------------------ part parent "m329" - desc = "ATmega3290P"; - id = "m3290p"; - signature = 0x1e 0x95 0x0c; + desc = "ATmega3290P"; + id = "m3290p"; + signature = 0x1e 0x95 0x0c; ; #------------------------------------------------------------ @@ -5249,9 +5234,9 @@ part parent "m329" #------------------------------------------------------------ part parent "m329" - desc = "ATmega3290PA"; - id = "m3290pa"; - signature = 0x1e 0x95 0x0c; + desc = "ATmega3290PA"; + id = "m3290pa"; + signature = 0x1e 0x95 0x0c; ; #------------------------------------------------------------ @@ -5259,119 +5244,119 @@ part parent "m329" #------------------------------------------------------------ part - desc = "ATmega649"; - id = "m649"; -# stk500_devcode = 0x85; # no STK500 support, only STK500v2 -# avr910_devcode = 0x?; # try the ATmega169 one: - avr910_devcode = 0x75; - chip_erase_delay = 9000; - signature = 0x1e 0x96 0x03; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega649"; + id = "m649"; +# stk500_devcode = 0x85; # no STK500 support, only STK500v2 +# avr910_devcode = 0x?; # try the ATmega169 one: + avr910_devcode = 0x75; + chip_erase_delay = 9000; + signature = 0x1e 0x96 0x03; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 2048; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 8; - readsize = 256; - read = "1010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; + size = 2048; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x10000; - page_size = 256; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x10000; + page_size = 256; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -5380,8 +5365,8 @@ part #------------------------------------------------------------ part parent "m649" - desc = "ATmega649A"; - id = "m649a"; + desc = "ATmega649A"; + id = "m649a"; ; #------------------------------------------------------------ @@ -5389,9 +5374,9 @@ part parent "m649" #------------------------------------------------------------ part parent "m649" - desc = "ATmega649P"; - id = "m649p"; - signature = 0x1e 0x96 0x0b; + desc = "ATmega649P"; + id = "m649p"; + signature = 0x1e 0x96 0x0b; ; #------------------------------------------------------------ @@ -5399,9 +5384,9 @@ part parent "m649" #------------------------------------------------------------ part parent "m649" - desc = "ATmega6490"; - id = "m6490"; - signature = 0x1e 0x96 0x04; + desc = "ATmega6490"; + id = "m6490"; + signature = 0x1e 0x96 0x04; ; #------------------------------------------------------------ @@ -5409,9 +5394,9 @@ part parent "m649" #------------------------------------------------------------ part parent "m649" - desc = "ATmega6490A"; - id = "m6490a"; - signature = 0x1e 0x96 0x04; + desc = "ATmega6490A"; + id = "m6490a"; + signature = 0x1e 0x96 0x04; ; #------------------------------------------------------------ @@ -5419,9 +5404,9 @@ part parent "m649" #------------------------------------------------------------ part parent "m649" - desc = "ATmega6490P"; - id = "m6490p"; - signature = 0x1e 0x96 0x0c; + desc = "ATmega6490P"; + id = "m6490p"; + signature = 0x1e 0x96 0x0c; ; #------------------------------------------------------------ @@ -5429,109 +5414,109 @@ part parent "m649" #------------------------------------------------------------ part - desc = "ATmega32"; - id = "m32"; - stk500_devcode = 0x91; - avr910_devcode = 0x72; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x95 0x02; - reset = io; - has_jtag = yes; + desc = "ATmega32"; + id = "m32"; + stk500_devcode = 0x91; + avr910_devcode = 0x72; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x95 0x02; + reset = io; + has_jtag = yes; allowfullpagebitstream = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 6; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; - ocdrev = 2; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + spmcr = 0x57; + ocdrev = 2; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 1024; - page_size = 4; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 4; - delay = 10; - blocksize = 64; - readsize = 256; - read = "1010.0000--00xx.xxaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--00xx.xxaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; + size = 1024; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 4; + delay = 10; + blocksize = 64; + readsize = 256; + read = "1010.0000--00xx.xxaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x8000; - page_size = 128; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 33; - delay = 6; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x8000; + page_size = 128; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 4; - read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; + size = 4; + read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; ; ; @@ -5540,86 +5525,86 @@ part #------------------------------------------------------------ part - desc = "ATmega161"; - id = "m161"; - stk500_devcode = 0x80; - avr910_devcode = 0x60; - chip_erase_delay = 28000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x94 0x01; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATmega161"; + id = "m161"; + stk500_devcode = 0x80; + avr910_devcode = 0x60; + chip_erase_delay = 28000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x94 0x01; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - hvleavestabdelay = 15; - chiperasepolltimeout = 30; + hventerstabdelay = 100; + hvleavestabdelay = 15; + chiperasepolltimeout = 30; programfusepolltimeout = 2; programlockpolltimeout = 2; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - min_write_delay = 3400; - max_write_delay = 3400; - readback = 0xff 0xff; - mode = 4; - delay = 5; - blocksize = 128; - readsize = 256; - read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + size = 512; + min_write_delay = 3400; + max_write_delay = 3400; + readback = 0xff 0xff; + mode = 4; + delay = 5; + blocksize = 128; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "flash" - paged = yes; - size = 0x4000; - page_size = 128; - num_pages = 128; - min_write_delay = 14000; - max_write_delay = 14000; - readback = 0xff 0xff; - mode = 33; - delay = 16; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--xxxa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 14000; + max_write_delay = 14000; + readback = 0xff 0xff; + mode = 33; + delay = 16; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "fuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xoxo.oooo"; - write = "1010.1100--101x.xxxx--xxxx.xxxx--1i1i.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.0000--xxxx.xxxx--xxxx.xxxx--xoxo.oooo"; + write = "1010.1100--101x.xxxx--xxxx.xxxx--1i1i.iiii"; ; memory "lock" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; ; @@ -5628,8 +5613,8 @@ part #------------------------------------------------------------ part parent "m32" - desc = "ATmega32A"; - id = "m32a"; + desc = "ATmega32A"; + id = "m32a"; ; #------------------------------------------------------------ @@ -5637,106 +5622,106 @@ part parent "m32" #------------------------------------------------------------ part - desc = "ATmega8"; - id = "m8"; - stk500_devcode = 0x70; - avr910_devcode = 0x76; - chip_erase_delay = 10000; - pagel = 0xd7; - bs2 = 0xc2; - signature = 0x1e 0x93 0x07; - reset = io; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATmega8"; + id = "m8"; + stk500_devcode = 0x70; + avr910_devcode = 0x76; + chip_erase_delay = 10000; + pagel = 0xd7; + bs2 = 0xc2; + signature = 0x1e 0x93 0x07; + reset = io; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 2; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 2; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 4; - delay = 20; - blocksize = 128; - readsize = 256; - read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; + size = 512; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 4; + delay = 20; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0x00; - mode = 33; - delay = 10; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--0000.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--0000.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0x00; + mode = 33; + delay = 10; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--0000.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--0000.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 4; - read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; + size = 4; + read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; ; ; @@ -5745,8 +5730,8 @@ part #------------------------------------------------------------ part parent "m8" - desc = "ATmega8A"; - id = "m8a"; + desc = "ATmega8A"; + id = "m8a"; ; #------------------------------------------------------------ @@ -5754,98 +5739,98 @@ part parent "m8" #------------------------------------------------------------ part - desc = "ATmega8515"; - id = "m8515"; - stk500_devcode = 0x63; - avr910_devcode = 0x3a; - chip_erase_delay = 9000; - signature = 0x1e 0x93 0x06; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATmega8515"; + id = "m8515"; + stk500_devcode = 0x63; + avr910_devcode = 0x3a; + chip_erase_delay = 9000; + signature = 0x1e 0x93 0x06; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 6; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 4; - delay = 20; - blocksize = 128; - readsize = 256; - read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; + size = 512; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 4; + delay = 20; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 33; - delay = 6; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--0000.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--0000.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--0000.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--0000.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 4; - read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; + size = 4; + read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; ; ; @@ -5854,100 +5839,100 @@ part #------------------------------------------------------------ part - desc = "ATmega8535"; - id = "m8535"; - stk500_devcode = 0x64; - avr910_devcode = 0x69; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x93 0x08; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATmega8535"; + id = "m8535"; + stk500_devcode = 0x64; + avr910_devcode = 0x69; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x93 0x08; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 6; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 4; - delay = 20; - blocksize = 128; - readsize = 256; - read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; + size = 512; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 4; + delay = 20; + blocksize = 128; + readsize = 256; + read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 33; - delay = 6; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--0000.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--0000.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--0000.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--0000.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 2000; - max_write_delay = 2000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 2000; + max_write_delay = 2000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 4; - read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; + size = 4; + read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; ; ; @@ -5956,103 +5941,103 @@ part #------------------------------------------------------------ part - desc = "ATtiny26"; - id = "t26"; - stk500_devcode = 0x21; - avr910_devcode = 0x5e; - chip_erase_delay = 9000; - pagel = 0xb3; - bs2 = 0xb2; - signature = 0x1e 0x91 0x09; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATtiny26"; + id = "t26"; + stk500_devcode = 0x21; + avr910_devcode = 0x5e; + chip_erase_delay = 9000; + pagel = 0xb3; + bs2 = 0xb2; + signature = 0x1e 0x91 0x09; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0xc4, 0xe4, 0xc4, 0xe4, 0xcc, 0xec, 0xcc, 0xec, 0xd4, 0xf4, 0xd4, 0xf4, 0xdc, 0xfc, 0xdc, 0xfc, 0xc8, 0xe8, 0xd8, 0xf8, 0x4c, 0x6c, 0x5c, 0x7c, 0xec, 0xbc, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 2; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 2; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 128; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 4; - delay = 10; - blocksize = 64; - readsize = 256; - read = "1010.0000--xxxx.xxxx--xaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + size = 128; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 4; + delay = 10; + blocksize = 64; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; ; memory "flash" - paged = yes; - size = 2048; - page_size = 32; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 33; - delay = 6; - blocksize = 16; - readsize = 256; - read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxxx.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxxx.aaaa--iiii.iiii"; - writepage = "0100.1100--xxxx.xxaa--aaaa.xxxx--xxxx.xxxx"; + paged = yes; + size = 2048; + page_size = 32; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 33; + delay = 6; + blocksize = 16; + readsize = 256; + read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxxx.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxx.xxaa--aaaa.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--xxxi.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--xxxi.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxoo"; - write = "1010.1100--1111.11ii--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxoo"; + write = "1010.1100--1111.11ii--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; memory "calibration" - size = 4; - read = "0011.1000--xxxx.xxxx--0000.00aa--oooo.oooo"; + size = 4; + read = "0011.1000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; ; @@ -6061,122 +6046,122 @@ part #------------------------------------------------------------ part - desc = "ATtiny261"; - id = "t261"; - chip_erase_delay = 4000; - pagel = 0xb3; - bs2 = 0xb2; -# stk500_devcode = 0x21; -# avr910_devcode = 0x5e; - signature = 0x1e 0x91 0x0c; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATtiny261"; + id = "t261"; + chip_erase_delay = 4000; + pagel = 0xb3; + bs2 = 0xb2; +# stk500_devcode = 0x21; +# avr910_devcode = 0x5e; + signature = 0x1e 0x91 0x0c; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0xc4, 0xe4, 0xc4, 0xe4, 0xcc, 0xec, 0xcc, 0xec, 0xd4, 0xf4, 0xd4, 0xf4, 0xdc, 0xfc, 0xdc, 0xfc, 0xc8, 0xe8, 0xd8, 0xf8, 0x4c, 0x6c, 0x5c, 0x7c, 0xec, 0xbc, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb4, 0x00, 0x10; - eeprom_instr = + flash_instr = 0xb4, 0x00, 0x10; + eeprom_instr = 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xbc, 0x00, 0xb4, 0x00, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 2; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 2; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 128; - page_size = 4; - num_pages = 32; - min_write_delay = 4000; - max_write_delay = 4000; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 4; - readsize = 256; - read = "1010.0000--xxxx.xxxx--xaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; + size = 128; + page_size = 4; + num_pages = 32; + min_write_delay = 4000; + max_write_delay = 4000; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 2048; - page_size = 32; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 32; - readsize = 256; - read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxxx.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxxx.aaaa--iiii.iiii"; - writepage = "0100.1100--xxxx.xxaa--aaaa.xxxx--xxxx.xxxx"; + paged = yes; + size = 2048; + page_size = 32; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xxaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxxx.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxx.xxaa--aaaa.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxoo"; - write = "1010.1100--1111.11ii--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxoo"; + write = "1010.1100--1111.11ii--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -6185,8 +6170,8 @@ part #------------------------------------------------------------ part parent "t261" - desc = "ATtiny261A"; - id = "t261a"; + desc = "ATtiny261A"; + id = "t261a"; ; #------------------------------------------------------------ @@ -6194,122 +6179,122 @@ part parent "t261" #------------------------------------------------------------ part - desc = "ATtiny461"; - id = "t461"; - chip_erase_delay = 4000; - pagel = 0xb3; - bs2 = 0xb2; -# stk500_devcode = 0x21; -# avr910_devcode = 0x5e; - signature = 0x1e 0x92 0x08; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATtiny461"; + id = "t461"; + chip_erase_delay = 4000; + pagel = 0xb3; + bs2 = 0xb2; +# stk500_devcode = 0x21; +# avr910_devcode = 0x5e; + signature = 0x1e 0x92 0x08; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0xc4, 0xe4, 0xc4, 0xe4, 0xcc, 0xec, 0xcc, 0xec, 0xd4, 0xf4, 0xd4, 0xf4, 0xdc, 0xfc, 0xdc, 0xfc, 0xc8, 0xe8, 0xd8, 0xf8, 0x4c, 0x6c, 0x5c, 0x7c, 0xec, 0xbc, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb4, 0x00, 0x10; - eeprom_instr = + flash_instr = 0xb4, 0x00, 0x10; + eeprom_instr = 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xbc, 0x00, 0xb4, 0x00, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 2; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 2; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 256; - page_size = 4; - num_pages = 64; - min_write_delay = 4000; - max_write_delay = 4000; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 4; - readsize = 256; - read = "1010.0000--xxxx.xxxx--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxx--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; + size = 256; + page_size = 4; + num_pages = 64; + min_write_delay = 4000; + max_write_delay = 4000; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxx--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 4096; - page_size = 64; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--xxxx.xaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 4096; + page_size = 64; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxx.xaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxoo"; - write = "1010.1100--1111.11ii--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxoo"; + write = "1010.1100--1111.11ii--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -6318,8 +6303,8 @@ part #------------------------------------------------------------ part parent "t461" - desc = "ATtiny461A"; - id = "t461a"; + desc = "ATtiny461A"; + id = "t461a"; ; #------------------------------------------------------------ @@ -6327,122 +6312,122 @@ part parent "t461" #------------------------------------------------------------ part - desc = "ATtiny861"; - id = "t861"; - chip_erase_delay = 4000; - pagel = 0xb3; - bs2 = 0xb2; -# stk500_devcode = 0x21; -# avr910_devcode = 0x5e; - signature = 0x1e 0x93 0x0d; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATtiny861"; + id = "t861"; + chip_erase_delay = 4000; + pagel = 0xb3; + bs2 = 0xb2; +# stk500_devcode = 0x21; +# avr910_devcode = 0x5e; + signature = 0x1e 0x93 0x0d; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0xc4, 0xe4, 0xc4, 0xe4, 0xcc, 0xec, 0xcc, 0xec, 0xd4, 0xf4, 0xd4, 0xf4, 0xdc, 0xfc, 0xdc, 0xfc, 0xc8, 0xe8, 0xd8, 0xf8, 0x4c, 0x6c, 0x5c, 0x7c, 0xec, 0xbc, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb4, 0x00, 0x10; - eeprom_instr = + flash_instr = 0xb4, 0x00, 0x10; + eeprom_instr = 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xbc, 0x00, 0xb4, 0x00, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 2; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 2; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - num_pages = 128; - min_write_delay = 4000; - max_write_delay = 4000; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 4; - readsize = 256; - read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + num_pages = 128; + min_write_delay = 4000; + max_write_delay = 4000; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--xxxx.aaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxx.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxoo"; - write = "1010.1100--1111.11ii--xxxx.xxxx--xxxx.xxxx"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxxx.xxoo"; + write = "1010.1100--1111.11ii--xxxx.xxxx--xxxx.xxxx"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -6451,8 +6436,8 @@ part #------------------------------------------------------------ part parent "t861" - desc = "ATtiny861A"; - id = "t861a"; + desc = "ATtiny861A"; + id = "t861a"; ; #------------------------------------------------------------ @@ -6462,45 +6447,45 @@ part parent "t861" # This is an HVPP-only device. part - desc = "ATtiny28"; - id = "t28"; - stk500_devcode = 0x22; - avr910_devcode = 0x5c; - signature = 0x1e 0x91 0x07; - serial = no; - pp_controlstack = + desc = "ATtiny28"; + id = "t28"; + stk500_devcode = 0x22; + avr910_devcode = 0x5c; + signature = 0x1e 0x91 0x07; + serial = no; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; memory "flash" - size = 2048; - page_size = 2; - delay = 5; - readsize = 256; + size = 2048; + page_size = 2; + delay = 5; + readsize = 256; ; memory "fuse" - size = 1; + size = 1; ; memory "lock" - size = 1; + size = 1; ; memory "signature" - size = 3; + size = 3; ; memory "calibration" - size = 1; + size = 1; ; ; @@ -6509,123 +6494,123 @@ part #------------------------------------------------------------ part - desc = "ATmega48"; - id = "m48"; - stk500_devcode = 0x59; - chip_erase_delay = 45000; - pagel = 0xd7; - bs2 = 0xc2; -# avr910_devcode = 0x; - signature = 0x1e 0x92 0x05; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega48"; + id = "m48"; + stk500_devcode = 0x59; + chip_erase_delay = 45000; + pagel = 0xd7; + bs2 = 0xc2; +# avr910_devcode = 0x??; + signature = 0x1e 0x92 0x05; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb6, 0x01, 0x11; - eeprom_instr = + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, 0x99, 0xf9, 0xbb, 0xaf; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 256; - page_size = 4; - min_write_delay = 3600; - max_write_delay = 3600; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxx--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxx--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; + size = 256; + page_size = 4; + min_write_delay = 3600; + max_write_delay = 3600; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 4096; - page_size = 64; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 6; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 4096; + page_size = 64; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -6634,8 +6619,8 @@ part #------------------------------------------------------------ part parent "m48" - desc = "ATmega48A"; - id = "m48a"; + desc = "ATmega48A"; + id = "m48a"; ; #------------------------------------------------------------ @@ -6643,9 +6628,9 @@ part parent "m48" #------------------------------------------------------------ part parent "m48" - desc = "ATmega48P"; - id = "m48p"; - signature = 0x1e 0x92 0x0a; + desc = "ATmega48P"; + id = "m48p"; + signature = 0x1e 0x92 0x0a; ; #------------------------------------------------------------ @@ -6653,9 +6638,9 @@ part parent "m48" #------------------------------------------------------------ part parent "m48" - desc = "ATmega48PA"; - id = "m48pa"; - signature = 0x1e 0x92 0x0a; + desc = "ATmega48PA"; + id = "m48pa"; + signature = 0x1e 0x92 0x0a; ; #------------------------------------------------------------ @@ -6663,10 +6648,10 @@ part parent "m48" #------------------------------------------------------------ part parent "m48" - desc = "ATmega48PB"; - id = "m48pb"; - chip_erase_delay = 10500; - signature = 0x1e 0x92 0x10; + desc = "ATmega48PB"; + id = "m48pb"; + chip_erase_delay = 10500; + signature = 0x1e 0x92 0x10; ; #------------------------------------------------------------ @@ -6674,124 +6659,124 @@ part parent "m48" #------------------------------------------------------------ part - desc = "ATmega88"; - id = "m88"; - stk500_devcode = 0x73; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xc2; -# avr910_devcode = 0x; - signature = 0x1e 0x93 0x0a; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega88"; + id = "m88"; + stk500_devcode = 0x73; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc2; +# avr910_devcode = 0x??; + signature = 0x1e 0x93 0x0a; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb6, 0x01, 0x11; - eeprom_instr = + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, 0x99, 0xf9, 0xbb, 0xaf; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - min_write_delay = 3600; - max_write_delay = 3600; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + min_write_delay = 3600; + max_write_delay = 3600; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -6800,8 +6785,8 @@ part #------------------------------------------------------------ part parent "m88" - desc = "ATmega88A"; - id = "m88a"; + desc = "ATmega88A"; + id = "m88a"; ; #------------------------------------------------------------ @@ -6809,9 +6794,9 @@ part parent "m88" #------------------------------------------------------------ part parent "m88" - desc = "ATmega88P"; - id = "m88p"; - signature = 0x1e 0x93 0x0f; + desc = "ATmega88P"; + id = "m88p"; + signature = 0x1e 0x93 0x0f; ; #------------------------------------------------------------ @@ -6819,9 +6804,9 @@ part parent "m88" #------------------------------------------------------------ part parent "m88" - desc = "ATmega88PA"; - id = "m88pa"; - signature = 0x1e 0x93 0x0f; + desc = "ATmega88PA"; + id = "m88pa"; + signature = 0x1e 0x93 0x0f; ; #------------------------------------------------------------ @@ -6829,10 +6814,10 @@ part parent "m88" #------------------------------------------------------------ part parent "m88" - desc = "ATmega88PB"; - id = "m88pb"; - chip_erase_delay = 10500; - signature = 0x1e 0x93 0x16; + desc = "ATmega88PB"; + id = "m88pb"; + chip_erase_delay = 10500; + signature = 0x1e 0x93 0x16; ; #------------------------------------------------------------ @@ -6840,124 +6825,124 @@ part parent "m88" #------------------------------------------------------------ part - desc = "ATmega168"; - id = "m168"; - stk500_devcode = 0x86; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xc2; - # avr910_devcode = 0x; - signature = 0x1e 0x94 0x06; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega168"; + id = "m168"; + stk500_devcode = 0x86; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc2; +# avr910_devcode = 0x??; + signature = 0x1e 0x94 0x06; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb6, 0x01, 0x11; - eeprom_instr = + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, 0x99, 0xf9, 0xbb, 0xaf; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - min_write_delay = 3600; - max_write_delay = 3600; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + min_write_delay = 3600; + max_write_delay = 3600; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x4000; - page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--000a.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--000a.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--000a.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--000a.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--000a.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--000a.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -6966,8 +6951,8 @@ part #------------------------------------------------------------ part parent "m168" - desc = "ATmega168A"; - id = "m168a"; + desc = "ATmega168A"; + id = "m168a"; ; #------------------------------------------------------------ @@ -6975,9 +6960,9 @@ part parent "m168" #------------------------------------------------------------ part parent "m168" - desc = "ATmega168P"; - id = "m168p"; - signature = 0x1e 0x94 0x0b; + desc = "ATmega168P"; + id = "m168p"; + signature = 0x1e 0x94 0x0b; ; #------------------------------------------------------------ @@ -6985,9 +6970,9 @@ part parent "m168" #------------------------------------------------------------ part parent "m168" - desc = "ATmega168PA"; - id = "m168pa"; - signature = 0x1e 0x94 0x0b; + desc = "ATmega168PA"; + id = "m168pa"; + signature = 0x1e 0x94 0x0b; ; #------------------------------------------------------------ @@ -6995,10 +6980,10 @@ part parent "m168" #------------------------------------------------------------ part parent "m168" - desc = "ATmega168PB"; - id = "m168pb"; - chip_erase_delay = 10500; - signature = 0x1e 0x94 0x15; + desc = "ATmega168PB"; + id = "m168pb"; + chip_erase_delay = 10500; + signature = 0x1e 0x94 0x15; ; #------------------------------------------------------------ @@ -7006,123 +6991,123 @@ part parent "m168" #------------------------------------------------------------ part - desc = "ATtiny828"; - id = "t828"; - stk500_devcode = 0x86; - chip_erase_delay = 15000; - pagel = 0xd7; - bs2 = 0xc2; - # avr910_devcode = 0x; - signature = 0x1e 0x93 0x14; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATtiny828"; + id = "t828"; + stk500_devcode = 0x86; + chip_erase_delay = 15000; + pagel = 0xd7; + bs2 = 0xc2; +# avr910_devcode = 0x??; + signature = 0x1e 0x93 0x14; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb6, 0x01, 0x11; - eeprom_instr = + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, 0x99, 0xf9, 0xbb, 0xaf; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 256; - page_size = 4; - min_write_delay = 3600; - max_write_delay = 3600; - readback = 0xff 0xff; - mode = 65; - delay = 5; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + size = 256; + page_size = 4; + min_write_delay = 3600; + max_write_delay = 3600; + readback = 0xff 0xff; + mode = 65; + delay = 5; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--111i.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--111i.iiii"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -7131,8 +7116,8 @@ part #------------------------------------------------------------ part parent "t828" - desc = "ATtiny828R"; - id = "t828r"; + desc = "ATtiny828R"; + id = "t828r"; ; #------------------------------------------------------------ @@ -7140,122 +7125,122 @@ part parent "t828" #------------------------------------------------------------ part - desc = "ATtiny87"; - id = "t87"; -## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - chip_erase_delay = 15000; - signature = 0x1e 0x93 0x87; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATtiny87"; + id = "t87"; +# no STK500 devcode in XML file, use the ATtiny45 one + stk500_devcode = 0x14; +# Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 15000; + signature = 0x1e 0x93 0x87; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0e, 0x1e, 0x2e, 0x3e, 0x2e, 0x3e, 0x4e, 0x5e, 0x4e, 0x5e, 0x6e, 0x7e, 0x6e, 0x7e, 0x06, 0x16, 0x46, 0x56, 0x0a, 0x1a, 0x4a, 0x5a, 0x1e, 0x7c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb6, 0x01, 0x11; - eeprom_instr = + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, 0x99, 0xf9, 0xbb, 0xaf; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 20; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 20; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - spmcr = 0x57; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + spmcr = 0x57; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 4; - readsize = 256; - read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 4; + readsize = 256; + read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 128; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--000a.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--000a.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 128; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--000a.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--000a.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; ; # ATtiny87 has Signature Bytes: 0x1E 0x93 0x87. memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -7264,123 +7249,123 @@ part #------------------------------------------------------------ part - desc = "ATtiny167"; - id = "t167"; -## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - chip_erase_delay = 15000; - signature = 0x1e 0x94 0x87; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pp_controlstack = + desc = "ATtiny167"; + id = "t167"; +# no STK500 devcode in XML file, use the ATtiny45 one + stk500_devcode = 0x14; +# avr910_devcode = 0x??; +# Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 15000; + signature = 0x1e 0x94 0x87; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pp_controlstack = 0x0e, 0x1e, 0x0e, 0x1e, 0x2e, 0x3e, 0x2e, 0x3e, 0x4e, 0x5e, 0x4e, 0x5e, 0x6e, 0x7e, 0x6e, 0x7e, 0x06, 0x16, 0x46, 0x56, 0x0a, 0x1a, 0x4a, 0x5a, 0x1e, 0x7c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb6, 0x01, 0x11; - eeprom_instr = + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, 0x99, 0xf9, 0xbb, 0xaf; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 20; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 20; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - spmcr = 0x57; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + spmcr = 0x57; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 4; - readsize = 256; - read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 4; + readsize = 256; + read = "1010.0000--00xx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--00xx.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x4000; - page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--000a.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--000a.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--000a.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--000a.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--000a.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--000a.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; ; # ATtiny167 has Signature Bytes: 0x1E 0x94 0x87. memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -7389,124 +7374,124 @@ part #------------------------------------------------------------ part - desc = "ATtiny48"; - id = "t48"; - stk500_devcode = 0x73; - chip_erase_delay = 15000; - pagel = 0xd7; - bs2 = 0xc2; -# avr910_devcode = 0x; - signature = 0x1e 0x92 0x09; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATtiny48"; + id = "t48"; + stk500_devcode = 0x73; + chip_erase_delay = 15000; + pagel = 0xd7; + bs2 = 0xc2; +# avr910_devcode = 0x??; + signature = 0x1e 0x92 0x09; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb6, 0x01, 0x11; - eeprom_instr = + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, 0x99, 0xf9, 0xbb, 0xaf; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 64; - page_size = 4; - min_write_delay = 3600; - max_write_delay = 3600; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 64; - read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; + size = 64; + page_size = 4; + min_write_delay = 3600; + max_write_delay = 3600; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 64; + read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 4096; - page_size = 64; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 4096; + page_size = 64; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--1111.111i"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.111i"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -7515,124 +7500,124 @@ part #------------------------------------------------------------ part - desc = "ATtiny88"; - id = "t88"; - stk500_devcode = 0x73; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xc2; -# avr910_devcode = 0x; - signature = 0x1e 0x93 0x11; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATtiny88"; + id = "t88"; + stk500_devcode = 0x73; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc2; +# avr910_devcode = 0x??; + signature = 0x1e 0x93 0x11; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb6, 0x01, 0x11; - eeprom_instr = + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, 0x99, 0xf9, 0xbb, 0xaf; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 64; - page_size = 4; - min_write_delay = 3600; - max_write_delay = 3600; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 64; - read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; + size = 64; + page_size = 4; + min_write_delay = 3600; + max_write_delay = 3600; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 64; + read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -7641,124 +7626,124 @@ part #------------------------------------------------------------ part - desc = "ATmega328"; - id = "m328"; - stk500_devcode = 0x86; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xc2; - # avr910_devcode = 0x; - signature = 0x1e 0x95 0x14; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega328"; + id = "m328"; + stk500_devcode = 0x86; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc2; +# avr910_devcode = 0x??; + signature = 0x1e 0x95 0x14; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb6, 0x01, 0x11; - eeprom_instr = + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, 0x99, 0xf9, 0xbb, 0xaf; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 1024; - page_size = 4; - min_write_delay = 3600; - max_write_delay = 3600; - readback = 0xff 0xff; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; + size = 1024; + page_size = 4; + min_write_delay = 3600; + max_write_delay = 3600; + readback = 0xff 0xff; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x8000; - page_size = 128; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x8000; + page_size = 128; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -7767,9 +7752,9 @@ part #------------------------------------------------------------ part parent "m328" - desc = "ATmega328P"; - id = "m328p"; - signature = 0x1e 0x95 0x0f; + desc = "ATmega328P"; + id = "m328p"; + signature = 0x1e 0x95 0x0f; ; #------------------------------------------------------------ @@ -7777,13 +7762,13 @@ part parent "m328" #------------------------------------------------------------ part parent "m328" - desc = "ATmega328PB"; - id = "m328pb"; - chip_erase_delay = 10500; - signature = 0x1e 0x95 0x16; + desc = "ATmega328PB"; + id = "m328pb"; + chip_erase_delay = 10500; + signature = 0x1e 0x95 0x16; memory "efuse" - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; ; ; @@ -7792,15 +7777,15 @@ part parent "m328" #------------------------------------------------------------ part parent "m328" - desc = "ATmega32M1"; - id = "m32m1"; - bs2 = 0xe2; - # stk500_devcode = 0x; - # avr910_devcode = 0x; - signature = 0x1e 0x95 0x84; + desc = "ATmega32M1"; + id = "m32m1"; + bs2 = 0xe2; +# stk500_devcode = 0x??; +# avr910_devcode = 0x??; + signature = 0x1e 0x95 0x84; memory "efuse" - write = "1010.1100--1010.0100--xxxx.xxxx--xxii.iiii"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxii.iiii"; ; ; @@ -7809,34 +7794,34 @@ part parent "m328" #------------------------------------------------------------ part parent "m328" - desc = "ATmega64M1"; - id = "m64m1"; - bs2 = 0xe2; - # stk500_devcode = 0x; - # avr910_devcode = 0x; - signature = 0x1e 0x96 0x84; + desc = "ATmega64M1"; + id = "m64m1"; + bs2 = 0xe2; +# stk500_devcode = 0x??; +# avr910_devcode = 0x??; + signature = 0x1e 0x96 0x84; memory "eeprom" - size = 2048; - page_size = 8; - read = "1010.0000--000x.xaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; + size = 2048; + page_size = 8; + read = "1010.0000--000x.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - size = 0x10000; - page_size = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + size = 0x10000; + page_size = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "efuse" - write = "1010.1100--1010.0100--xxxx.xxxx--xxii.iiii"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxii.iiii"; ; ; @@ -7845,129 +7830,129 @@ part parent "m328" #------------------------------------------------------------ part - desc = "ATtiny2313"; - id = "t2313"; - stk500_devcode = 0x23; -## Use the ATtiny26 devcode: - avr910_devcode = 0x5e; - chip_erase_delay = 9000; - pagel = 0xd4; - bs2 = 0xd6; - signature = 0x1e 0x91 0x0a; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATtiny2313"; + id = "t2313"; + stk500_devcode = 0x23; +# Use the ATtiny26 devcode: + avr910_devcode = 0x5e; + chip_erase_delay = 9000; + pagel = 0xd4; + bs2 = 0xd6; + signature = 0x1e 0x91 0x0a; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0e, 0x1e, 0x2e, 0x3e, 0x2e, 0x3e, 0x4e, 0x5e, 0x4e, 0x5e, 0x6e, 0x7e, 0x6e, 0x7e, 0x26, 0x36, 0x66, 0x76, 0x2a, 0x3a, 0x6a, 0x7a, 0x2e, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb2, 0x0f, 0x1f; - eeprom_instr = + flash_instr = 0xb2, 0x0f, 0x1f; + eeprom_instr = 0xbb, 0xfe, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xba, 0x0f, 0xb2, 0x0f, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 0; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 0; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 128; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; + size = 128; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 2048; - page_size = 32; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 32; - readsize = 256; - read_lo = "0010.0000--0000.00aa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.00aa--aaaa.aaaa--oooo.oooo"; + paged = yes; + size = 2048; + page_size = 32; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.00aa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.00aa--aaaa.aaaa--oooo.oooo"; # The information in the data sheet of April/2004 is wrong, this works: - loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; # The information in the data sheet of April/2004 is wrong, this works: - loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; # The information in the data sheet of April/2004 is wrong, this works: - writepage = "0100.1100--0000.00aa--aaaa.xxxx--xxxx.xxxx"; + writepage = "0100.1100--0000.00aa--aaaa.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; # ATtiny2313 has Signature Bytes: 0x1E 0x91 0x0A. memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; # The Tiny2313 has calibration data for both 4 MHz and 8 MHz. # The information in the data sheet of April/2004 is wrong, this works: memory "calibration" - size = 2; - read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + size = 2; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -7976,8 +7961,8 @@ part #------------------------------------------------------------ part parent "t2313" - desc = "ATtiny2313A"; - id = "t2313a"; + desc = "ATtiny2313A"; + id = "t2313a"; ; #------------------------------------------------------------ @@ -7985,124 +7970,124 @@ part parent "t2313" #------------------------------------------------------------ part - desc = "ATtiny4313"; - id = "t4313"; - stk500_devcode = 0x23; -## Use the ATtiny26 devcode: - avr910_devcode = 0x5e; - chip_erase_delay = 9000; - pagel = 0xd4; - bs2 = 0xd6; - signature = 0x1e 0x92 0x0d; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATtiny4313"; + id = "t4313"; + stk500_devcode = 0x23; +# Use the ATtiny26 devcode: + avr910_devcode = 0x5e; + chip_erase_delay = 9000; + pagel = 0xd4; + bs2 = 0xd6; + signature = 0x1e 0x92 0x0d; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0e, 0x1e, 0x2e, 0x3e, 0x2e, 0x3e, 0x4e, 0x5e, 0x4e, 0x5e, 0x6e, 0x7e, 0x6e, 0x7e, 0x26, 0x36, 0x66, 0x76, 0x2a, 0x3a, 0x6a, 0x7a, 0x2e, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb2, 0x0f, 0x1f; - eeprom_instr = + flash_instr = 0xb2, 0x0f, 0x1f; + eeprom_instr = 0xbb, 0xfe, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xba, 0x0f, 0xb2, 0x0f, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 0; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 0; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 256; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxx--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxx--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; + size = 256; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 4096; - page_size = 64; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 32; - readsize = 256; - read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 4096; + page_size = 64; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; # ATtiny4313 has Signature Bytes: 0x1E 0x92 0x0D. memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 2; - read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + size = 2; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -8111,122 +8096,122 @@ part #------------------------------------------------------------ part - desc = "AT90PWM2"; - id = "pwm2"; - stk500_devcode = 0x65; - chip_erase_delay = 9000; - pagel = 0xd8; - bs2 = 0xe2; -## avr910_devcode = ?; - signature = 0x1e 0x93 0x81; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "AT90PWM2"; + id = "pwm2"; + stk500_devcode = 0x65; + chip_erase_delay = 9000; + pagel = 0xd8; + bs2 = 0xe2; +# avr910_devcode = ?; + signature = 0x1e 0x93 0x81; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb6, 0x01, 0x11; - eeprom_instr = + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, 0x99, 0xf9, 0xbb, 0xaf; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; # AT90PWM2 has Signature Bytes: 0x1E 0x93 0x81. memory "signature" - size = 3; - read = "0011.0000--00xx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--00xx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -8237,8 +8222,8 @@ part # Completely identical to AT90PWM2 (including the signature!) part parent "pwm2" - desc = "AT90PWM3"; - id = "pwm3"; + desc = "AT90PWM3"; + id = "pwm3"; ; #------------------------------------------------------------ @@ -8247,10 +8232,10 @@ part parent "pwm2" # Same as AT90PWM2 but different signature. part parent "pwm2" - desc = "AT90PWM2B"; - id = "pwm2b"; - signature = 0x1e 0x93 0x83; - ocdrev = 1; + desc = "AT90PWM2B"; + id = "pwm2b"; + signature = 0x1e 0x93 0x83; + ocdrev = 1; ; #------------------------------------------------------------ @@ -8260,8 +8245,8 @@ part parent "pwm2" # Completely identical to AT90PWM2B (including the signature!) part parent "pwm2b" - desc = "AT90PWM3B"; - id = "pwm3b"; + desc = "AT90PWM3B"; + id = "pwm3b"; ; #------------------------------------------------------------ @@ -8271,20 +8256,20 @@ part parent "pwm2b" # Similar to AT90PWM3B, but with 16 kiB flash, 512 B EEPROM, and 1024 B SRAM. part parent "pwm3b" - desc = "AT90PWM316"; - id = "pwm316"; - signature = 0x1e 0x94 0x83; + desc = "AT90PWM316"; + id = "pwm316"; + signature = 0x1e 0x94 0x83; memory "flash" - size = 0x4000; - page_size = 128; - mode = 33; - blocksize = 128; - read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; + size = 0x4000; + page_size = 128; + mode = 33; + blocksize = 128; + read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--00xx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; ; @@ -8294,8 +8279,8 @@ part parent "pwm3b" # Completely identical to AT90PWM316 (including the signature!) part parent "pwm316" - desc = "AT90PWM216"; - id = "pwm216"; + desc = "AT90PWM216"; + id = "pwm216"; ; #------------------------------------------------------------ @@ -8303,126 +8288,126 @@ part parent "pwm316" #------------------------------------------------------------ part - desc = "ATtiny25"; - id = "t25"; -## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - chip_erase_delay = 4500; - signature = 0x1e 0x91 0x08; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - hvsp_controlstack = + desc = "ATtiny25"; + id = "t25"; +# no STK500 devcode in XML file, use the ATtiny45 one + stk500_devcode = 0x14; +# avr910_devcode = ?; +# Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 4500; + signature = 0x1e 0x91 0x08; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + hvsp_controlstack = 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; - flash_instr = 0xb4, 0x02, 0x12; - eeprom_instr = + flash_instr = 0xb4, 0x02, 0x12; + eeprom_instr = 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xbc, 0x02, 0xb4, 0x02, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayms = 1; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayms = 1; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; programfusepolltimeout = 25; programlockpolltimeout = 25; - synchcycles = 6; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + synchcycles = 6; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 128; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; + size = 128; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 2048; - page_size = 32; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 32; - readsize = 256; - read_lo = "0010.0000--0000.00aa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.00aa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.00aa--aaaa.xxxx--xxxx.xxxx"; + paged = yes; + size = 2048; + page_size = 32; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.00aa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.00aa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.00aa--aaaa.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; # ATtiny25 has Signature Bytes: 0x1E 0x91 0x08. memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -8431,125 +8416,125 @@ part #------------------------------------------------------------ part - desc = "ATtiny45"; - id = "t45"; - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - chip_erase_delay = 4500; - signature = 0x1e 0x92 0x06; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - hvsp_controlstack = + desc = "ATtiny45"; + id = "t45"; + stk500_devcode = 0x14; +# avr910_devcode = ?; +# Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 4500; + signature = 0x1e 0x92 0x06; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + hvsp_controlstack = 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; - flash_instr = 0xb4, 0x02, 0x12; - eeprom_instr = + flash_instr = 0xb4, 0x02, 0x12; + eeprom_instr = 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xbc, 0x02, 0xb4, 0x02, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayms = 1; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayms = 1; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; programfusepolltimeout = 25; programlockpolltimeout = 25; - synchcycles = 6; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + synchcycles = 6; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 256; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxx--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxx--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; + size = 256; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 4096; - page_size = 64; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 32; - readsize = 256; - read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 4096; + page_size = 64; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; # ATtiny45 has Signature Bytes: 0x1E 0x92 0x08. (Data sheet 2586C-AVR-06/05 (doc2586.pdf) indicates otherwise!) memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -8558,126 +8543,126 @@ part #------------------------------------------------------------ part - desc = "ATtiny85"; - id = "t85"; -## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - chip_erase_delay = 4500; - signature = 0x1e 0x93 0x0b; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - hvsp_controlstack = + desc = "ATtiny85"; + id = "t85"; +# no STK500 devcode in XML file, use the ATtiny45 one + stk500_devcode = 0x14; +# avr910_devcode = ?; +# Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 4500; + signature = 0x1e 0x93 0x0b; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + hvsp_controlstack = 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00; - flash_instr = 0xb4, 0x02, 0x12; - eeprom_instr = + flash_instr = 0xb4, 0x02, 0x12; + eeprom_instr = 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xbc, 0x02, 0xb4, 0x02, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayms = 1; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayms = 1; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; programfusepolltimeout = 25; programlockpolltimeout = 25; - synchcycles = 6; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + synchcycles = 6; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 32; - readsize = 256; - read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; # ATtiny85 has Signature Bytes: 0x1E 0x93 0x08. memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -8687,119 +8672,119 @@ part # Almost same as ATmega1280, except for different memory sizes part - desc = "ATmega640"; - id = "m640"; -# stk500_devcode = 0xB2; -# avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x96 0x08; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega640"; + id = "m640"; +# stk500_devcode = 0xB2; +# avr910_devcode = 0x43; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x96 0x08; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - rampz = 0x3b; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 4096; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - mode = 65; - delay = 10; - blocksize = 8; - readsize = 256; - read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + size = 4096; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 10; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x10000; - page_size = 256; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 10; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--0aaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x10000; + page_size = 256; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 10; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--0aaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -8808,119 +8793,119 @@ part #------------------------------------------------------------ part - desc = "ATmega1280"; - id = "m1280"; -# stk500_devcode = 0xB2; -# avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x97 0x03; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega1280"; + id = "m1280"; +# stk500_devcode = 0xB2; +# avr910_devcode = 0x43; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x97 0x03; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - rampz = 0x3b; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 4096; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - mode = 65; - delay = 10; - blocksize = 8; - readsize = 256; - read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + size = 4096; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 10; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x20000; - page_size = 256; - num_pages = 512; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 10; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x20000; + page_size = 256; + num_pages = 512; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 10; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -8930,9 +8915,9 @@ part # Identical to ATmega1280 part parent "m1280" - desc = "ATmega1281"; - id = "m1281"; - signature = 0x1e 0x97 0x04; + desc = "ATmega1281"; + id = "m1281"; + signature = 0x1e 0x97 0x04; ; #------------------------------------------------------------ @@ -8940,120 +8925,120 @@ part parent "m1280" #------------------------------------------------------------ part - desc = "ATmega2560"; - id = "m2560"; - stk500_devcode = 0xb2; -# avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x98 0x01; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega2560"; + id = "m2560"; + stk500_devcode = 0xb2; +# avr910_devcode = 0x43; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x98 0x01; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - rampz = 0x3b; - spmcr = 0x57; - ocdrev = 4; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + ocdrev = 4; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 4096; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - mode = 65; - delay = 10; - blocksize = 8; - readsize = 256; - read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + size = 4096; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 10; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x40000; - page_size = 256; - num_pages = 1024; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 10; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - load_ext_addr = "0100.1101--0000.0000--0000.000a--0000.0000"; - writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x40000; + page_size = 256; + num_pages = 1024; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 10; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + load_ext_addr = "0100.1101--0000.0000--0000.000a--0000.0000"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -9062,9 +9047,9 @@ part #------------------------------------------------------------ part parent "m2560" - desc = "ATmega2561"; - id = "m2561"; - signature = 0x1e 0x98 0x02; + desc = "ATmega2561"; + id = "m2561"; + signature = 0x1e 0x98 0x02; ; #------------------------------------------------------------ @@ -9073,20 +9058,20 @@ part parent "m2560" # Identical to ATmega2561 but half the ROM part parent "m2561" - desc = "ATmega128RFA1"; - id = "m128rfa1"; - chip_erase_delay = 55000; - bs2 = 0xe2; - signature = 0x1e 0xa7 0x01; - ocdrev = 3; + desc = "ATmega128RFA1"; + id = "m128rfa1"; + chip_erase_delay = 55000; + bs2 = 0xe2; + signature = 0x1e 0xa7 0x01; + ocdrev = 3; memory "flash" - size = 0x20000; - num_pages = 512; - min_write_delay = 50000; - max_write_delay = 50000; - delay = 20; - load_ext_addr = NULL; + size = 0x20000; + num_pages = 512; + min_write_delay = 50000; + max_write_delay = 50000; + delay = 20; + load_ext_addr = NULL; ; ; @@ -9095,19 +9080,19 @@ part parent "m2561" #------------------------------------------------------------ part parent "m2561" - desc = "ATmega256RFR2"; - id = "m256rfr2"; - chip_erase_delay = 18500; - bs2 = 0xe2; - signature = 0x1e 0xa8 0x02; + desc = "ATmega256RFR2"; + id = "m256rfr2"; + chip_erase_delay = 18500; + bs2 = 0xe2; + signature = 0x1e 0xa8 0x02; memory "eeprom" - size = 8192; - min_write_delay = 13000; - max_write_delay = 13000; - read = "1010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxa.aaaa--aaaa.aaaa--iiii.iiii"; - writepage = "1100.0010--00xa.aaaa--aaaa.a000--xxxx.xxxx"; + size = 8192; + min_write_delay = 13000; + max_write_delay = 13000; + read = "1010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxa.aaaa--aaaa.aaaa--iiii.iiii"; + writepage = "1100.0010--00xa.aaaa--aaaa.a000--xxxx.xxxx"; ; ; @@ -9116,9 +9101,9 @@ part parent "m2561" #------------------------------------------------------------ part parent "m128rfa1" - desc = "ATmega128RFR2"; - id = "m128rfr2"; - signature = 0x1e 0xa7 0x02; + desc = "ATmega128RFR2"; + id = "m128rfr2"; + signature = 0x1e 0xa7 0x02; ; #------------------------------------------------------------ @@ -9126,25 +9111,25 @@ part parent "m128rfa1" #------------------------------------------------------------ part parent "m128rfa1" - desc = "ATmega64RFR2"; - id = "m64rfr2"; - signature = 0x1e 0xa6 0x02; + desc = "ATmega64RFR2"; + id = "m64rfr2"; + signature = 0x1e 0xa6 0x02; memory "eeprom" - size = 2048; - min_write_delay = 13000; - max_write_delay = 13000; - read = "1010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; - writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; + size = 2048; + min_write_delay = 13000; + max_write_delay = 13000; + read = "1010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - size = 0x10000; - num_pages = 256; - read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - writepage = "0100.1100--0aaa.aaaa--axxx.xxxx--xxxx.xxxx"; + size = 0x10000; + num_pages = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + writepage = "0100.1100--0aaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; ; @@ -9153,9 +9138,9 @@ part parent "m128rfa1" #------------------------------------------------------------ part parent "m256rfr2" - desc = "ATmega2564RFR2"; - id = "m2564rfr2"; - signature = 0x1e 0xa8 0x03; + desc = "ATmega2564RFR2"; + id = "m2564rfr2"; + signature = 0x1e 0xa8 0x03; ; #------------------------------------------------------------ @@ -9163,9 +9148,9 @@ part parent "m256rfr2" #------------------------------------------------------------ part parent "m128rfr2" - desc = "ATmega1284RFR2"; - id = "m1284rfr2"; - signature = 0x1e 0xa7 0x03; + desc = "ATmega1284RFR2"; + id = "m1284rfr2"; + signature = 0x1e 0xa7 0x03; ; #------------------------------------------------------------ @@ -9173,9 +9158,9 @@ part parent "m128rfr2" #------------------------------------------------------------ part parent "m64rfr2" - desc = "ATmega644RFR2"; - id = "m644rfr2"; - signature = 0x1e 0xa6 0x03; + desc = "ATmega644RFR2"; + id = "m644rfr2"; + signature = 0x1e 0xa6 0x03; ; #------------------------------------------------------------ @@ -9183,126 +9168,126 @@ part parent "m64rfr2" #------------------------------------------------------------ part - desc = "ATtiny24"; - id = "t24"; -## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - chip_erase_delay = 4500; - signature = 0x1e 0x91 0x0b; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - hvsp_controlstack = + desc = "ATtiny24"; + id = "t24"; +# no STK500 devcode in XML file, use the ATtiny45 one + stk500_devcode = 0x14; +# avr910_devcode = ?; +# Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 4500; + signature = 0x1e 0x91 0x0b; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + hvsp_controlstack = 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0f; - flash_instr = 0xb4, 0x07, 0x17; - eeprom_instr = + flash_instr = 0xb4, 0x07, 0x17; + eeprom_instr = 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xbc, 0x07, 0xb4, 0x07, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayus = 70; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayus = 70; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; programfusepolltimeout = 25; programlockpolltimeout = 25; - synchcycles = 6; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + synchcycles = 6; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 128; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; + size = 128; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--xaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--xaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 2048; - page_size = 32; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 32; - readsize = 256; - read_lo = "0010.0000--0000.00aa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.00aa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.00aa--aaaa.xxxx--xxxx.xxxx"; + paged = yes; + size = 2048; + page_size = 32; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.00aa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.00aa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.00aa--aaaa.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; ; # ATtiny24 has Signature Bytes: 0x1E 0x91 0x0B. memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -9311,8 +9296,8 @@ part #------------------------------------------------------------ part parent "t24" - desc = "ATtiny24A"; - id = "t24a"; + desc = "ATtiny24A"; + id = "t24a"; ; #------------------------------------------------------------ @@ -9320,126 +9305,126 @@ part parent "t24" #------------------------------------------------------------ part - desc = "ATtiny44"; - id = "t44"; -## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - chip_erase_delay = 4500; - signature = 0x1e 0x92 0x07; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - hvsp_controlstack = + desc = "ATtiny44"; + id = "t44"; +# no STK500 devcode in XML file, use the ATtiny45 one + stk500_devcode = 0x14; +# avr910_devcode = ?; +# Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 4500; + signature = 0x1e 0x92 0x07; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + hvsp_controlstack = 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0f; - flash_instr = 0xb4, 0x07, 0x17; - eeprom_instr = + flash_instr = 0xb4, 0x07, 0x17; + eeprom_instr = 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xbc, 0x07, 0xb4, 0x07, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayus = 70; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayus = 70; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; programfusepolltimeout = 25; programlockpolltimeout = 25; - synchcycles = 6; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + synchcycles = 6; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 256; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxx--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxx--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; + size = 256; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 4096; - page_size = 64; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 32; - readsize = 256; - read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 4096; + page_size = 64; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; ; # ATtiny44 has Signature Bytes: 0x1E 0x92 0x07. memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -9448,8 +9433,8 @@ part #------------------------------------------------------------ part parent "t44" - desc = "ATtiny44A"; - id = "t44a"; + desc = "ATtiny44A"; + id = "t44a"; ; #------------------------------------------------------------ @@ -9457,126 +9442,126 @@ part parent "t44" #------------------------------------------------------------ part - desc = "ATtiny84"; - id = "t84"; -## no STK500 devcode in XML file, use the ATtiny45 one - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - chip_erase_delay = 4500; - signature = 0x1e 0x93 0x0c; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - hvsp_controlstack = + desc = "ATtiny84"; + id = "t84"; +# no STK500 devcode in XML file, use the ATtiny45 one + stk500_devcode = 0x14; +# avr910_devcode = ?; +# Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 4500; + signature = 0x1e 0x93 0x0c; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + hvsp_controlstack = 0x4c, 0x0c, 0x1c, 0x2c, 0x3c, 0x64, 0x74, 0x66, 0x68, 0x78, 0x68, 0x68, 0x7a, 0x6a, 0x68, 0x78, 0x78, 0x7d, 0x6d, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0f; - flash_instr = 0xb4, 0x07, 0x17; - eeprom_instr = + flash_instr = 0xb4, 0x07, 0x17; + eeprom_instr = 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xbc, 0x07, 0xb4, 0x07, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 1; - togglevtg = 1; - poweroffdelay = 25; - resetdelayus = 70; - hvleavestabdelay = 100; - resetdelay = 25; - chiperasepolltimeout = 40; + hventerstabdelay = 100; + latchcycles = 1; + togglevtg = 1; + poweroffdelay = 25; + resetdelayus = 70; + hvleavestabdelay = 100; + resetdelay = 25; + chiperasepolltimeout = 40; programfusepolltimeout = 25; programlockpolltimeout = 25; - synchcycles = 6; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + synchcycles = 6; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - min_write_delay = 4000; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 64; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 32; - readsize = 256; - read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 64; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 32; + readsize = 256; + read_lo = "0010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--xxxx.xxii"; ; # ATtiny84 has Signature Bytes: 0x1E 0x93 0x0C. memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -9585,8 +9570,8 @@ part #------------------------------------------------------------ part parent "t84" - desc = "ATtiny84A"; - id = "t84a"; + desc = "ATtiny84A"; + id = "t84a"; ; #------------------------------------------------------------ @@ -9594,21 +9579,21 @@ part parent "t84" #------------------------------------------------------------ part parent "t44" - desc = "ATtiny441"; - id = "t441"; - signature = 0x1e 0x92 0x15; + desc = "ATtiny441"; + id = "t441"; + signature = 0x1e 0x92 0x15; memory "flash" - page_size = 16; - num_pages = 256; - blocksize = 16; - loadpage_lo = "0100.0000--000x.xxxx--xxxx.xaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxx.xaaa--iiii.iiii"; - writepage = "0100.1100--0000.0aaa--aaaa.axxx--xxxx.xxxx"; + page_size = 16; + num_pages = 256; + blocksize = 16; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.xaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.xaaa--iiii.iiii"; + writepage = "0100.1100--0000.0aaa--aaaa.axxx--xxxx.xxxx"; ; memory "efuse" - write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; ; ; @@ -9617,21 +9602,21 @@ part parent "t44" #------------------------------------------------------------ part parent "t84" - desc = "ATtiny841"; - id = "t841"; - signature = 0x1e 0x93 0x15; + desc = "ATtiny841"; + id = "t841"; + signature = 0x1e 0x93 0x15; memory "flash" - page_size = 16; - num_pages = 512; - blocksize = 16; - loadpage_lo = "0100.0000--000x.xxxx--xxxx.xaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxx.xaaa--iiii.iiii"; - writepage = "0100.1100--0000.aaaa--aaaa.axxx--xxxx.xxxx"; + page_size = 16; + num_pages = 512; + blocksize = 16; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.xaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.xaaa--iiii.iiii"; + writepage = "0100.1100--0000.aaaa--aaaa.axxx--xxxx.xxxx"; ; memory "efuse" - write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; ; ; @@ -9640,125 +9625,125 @@ part parent "t84" #------------------------------------------------------------ part - desc = "ATtiny43U"; - id = "t43u"; - stk500_devcode = 0x14; -## avr910_devcode = ?; -## Try the AT90S2313 devcode: - avr910_devcode = 0x20; - chip_erase_delay = 1000; - signature = 0x1e 0x92 0x0c; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATtiny43U"; + id = "t43u"; + stk500_devcode = 0x14; +# avr910_devcode = ?; +# Try the AT90S2313 devcode: + avr910_devcode = 0x20; + chip_erase_delay = 1000; + signature = 0x1e 0x92 0x0c; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0e, 0x1e, 0x2e, 0x3e, 0x2e, 0x3e, 0x4e, 0x5e, 0x4e, 0x5e, 0x6e, 0x7e, 0x6e, 0x7e, 0x06, 0x16, 0x46, 0x56, 0x0a, 0x1a, 0x4a, 0x5a, 0x1e, 0x7c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb4, 0x07, 0x17; - eeprom_instr = + flash_instr = 0xb4, 0x07, 0x17; + eeprom_instr = 0xbb, 0xff, 0xbb, 0xee, 0xbb, 0xcc, 0xb2, 0x0d, 0xbc, 0x07, 0xb4, 0x07, 0xba, 0x0d, 0xbb, 0xbc, 0x99, 0xe1, 0xbb, 0xac; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 20; - resetdelayms = 1; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 20; + resetdelayms = 1; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - paged = yes; - size = 64; - page_size = 4; - num_pages = 16; - min_write_delay = 4000; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 5; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxx--00aa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxx--00aa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxx--00aa.aa00--xxxx.xxxx"; + paged = yes; + size = 64; + page_size = 4; + num_pages = 16; + min_write_delay = 4000; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 5; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxx--00aa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxx--00aa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxx--00aa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 4096; - page_size = 64; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 64; - readsize = 256; - read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; - writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; + paged = yes; + size = 4096; + page_size = 64; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 64; + readsize = 256; + read_lo = "0010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxa.aaaa--iiii.iiii"; + writepage = "0100.1100--0000.0aaa--aaax.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xxxi"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; ; @@ -9767,120 +9752,120 @@ part #------------------------------------------------------------ part - desc = "ATmega16U4"; - id = "m16u4"; -# stk500_devcode = 0xB2; -# avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x94 0x88; - usbpid = 0x2ff4; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega16U4"; + id = "m16u4"; +# stk500_devcode = 0xB2; +# avr910_devcode = 0x43; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x94 0x88; + usbpid = 0x2ff4; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - rampz = 0x3b; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - min_write_delay = 9000; - max_write_delay = 9000; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x4000; - page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--1111.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--00oo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--00oo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -9889,120 +9874,120 @@ part #------------------------------------------------------------ part - desc = "ATmega32U4"; - id = "m32u4"; -# stk500_devcode = 0xB2; -# avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x95 0x87; - usbpid = 0x2ff4; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega32U4"; + id = "m32u4"; +# stk500_devcode = 0xB2; +# avr910_devcode = 0x43; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x95 0x87; + usbpid = 0x2ff4; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - rampz = 0x3b; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 1024; - page_size = 4; - min_write_delay = 9000; - max_write_delay = 9000; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xaaa--aaaa.aa00--xxxx.xxxx"; + size = 1024; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x8000; - page_size = 128; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x8000; + page_size = 128; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--1111.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--1111.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -10011,120 +9996,120 @@ part #------------------------------------------------------------ part - desc = "AT90USB646"; - id = "usb646"; -# stk500_devcode = 0xB2; -# avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x96 0x82; - usbpid = 0x2ff9; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "AT90USB646"; + id = "usb646"; +# stk500_devcode = 0xB2; +# avr910_devcode = 0x43; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x96 0x82; + usbpid = 0x2ff9; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - rampz = 0x3b; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 2048; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - mode = 65; - delay = 10; - blocksize = 8; - readsize = 256; - read = "1010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; + size = 2048; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 10; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.xaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.xaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.xaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x10000; - page_size = 256; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 6; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--0aaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x10000; + page_size = 256; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--0aaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -10134,8 +10119,8 @@ part # identical to AT90USB646 part parent "usb646" - desc = "AT90USB647"; - id = "usb647"; + desc = "AT90USB647"; + id = "usb647"; ; #------------------------------------------------------------ @@ -10143,120 +10128,120 @@ part parent "usb646" #------------------------------------------------------------ part - desc = "AT90USB1286"; - id = "usb1286"; -# stk500_devcode = 0xB2; -# avr910_devcode = 0x43; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x97 0x82; - usbpid = 0x2ffb; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "AT90USB1286"; + id = "usb1286"; +# stk500_devcode = 0xB2; +# avr910_devcode = 0x43; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x97 0x82; + usbpid = 0x2ffb; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - rampz = 0x3b; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + rampz = 0x3b; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 4096; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - mode = 65; - delay = 10; - blocksize = 8; - readsize = 256; - read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; + size = 4096; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 10; + blocksize = 8; + readsize = 256; + read = "1010.0000--xxxx.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--xxxx.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--00xx.aaaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x20000; - page_size = 256; - num_pages = 512; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 6; - blocksize = 256; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x20000; + page_size = 256; + num_pages = 512; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 6; + blocksize = 256; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--axxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--xxxx.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; ; @@ -10266,8 +10251,8 @@ part # identical to AT90USB1286 part parent "usb1286" - desc = "AT90USB1287"; - id = "usb1287"; + desc = "AT90USB1287"; + id = "usb1287"; ; #------------------------------------------------------------ @@ -10275,609 +10260,588 @@ part parent "usb1286" #------------------------------------------------------------ part - desc = "AT90USB162"; - id = "usb162"; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xc6; - signature = 0x1e 0x94 0x82; - usbpid = 0x2ffa; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "AT90USB162"; + id = "usb162"; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc6; + signature = 0x1e 0x94 0x82; + usbpid = 0x2ffa; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - num_pages = 128; - min_write_delay = 9000; - max_write_delay = 9000; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + num_pages = 128; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x4000; - page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; #------------------------------------------------------------ # AT90USB82 #------------------------------------------------------------ -# Changes against AT90USB162 (beside IDs) -# memory "flash" -# size = 8192; -# num_pages = 64; part - desc = "AT90USB82"; - id = "usb82"; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xc6; - signature = 0x1e 0x93 0x82; - usbpid = 0x2ff7; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "AT90USB82"; + id = "usb82"; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc6; + signature = 0x1e 0x93 0x82; + usbpid = 0x2ff7; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - num_pages = 128; - min_write_delay = 9000; - max_write_delay = 9000; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + num_pages = 128; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 128; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 128; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; #------------------------------------------------------------ # ATmega32U2 #------------------------------------------------------------ -# Changes against AT90USB162 (beside IDs) -# memory "flash" -# size = 32768; -# num_pages = 256; -# memory "eeprom" -# size = 1024; -# num_pages = 256; + part - desc = "ATmega32U2"; - id = "m32u2"; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xc6; - signature = 0x1e 0x95 0x8a; - usbpid = 0x2ff0; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega32U2"; + id = "m32u2"; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc6; + signature = 0x1e 0x95 0x8a; + usbpid = 0x2ff0; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 1024; - page_size = 4; - num_pages = 256; - min_write_delay = 9000; - max_write_delay = 9000; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; + size = 1024; + page_size = 4; + num_pages = 256; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x8000; - page_size = 128; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x8000; + page_size = 128; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; #------------------------------------------------------------ # ATmega16U2 #------------------------------------------------------------ -# Changes against ATmega32U2 (beside IDs) -# memory "flash" -# size = 16384; -# num_pages = 128; -# memory "eeprom" -# size = 512; -# num_pages = 128; + part - desc = "ATmega16U2"; - id = "m16u2"; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xc6; - signature = 0x1e 0x94 0x89; - usbpid = 0x2fef; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega16U2"; + id = "m16u2"; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc6; + signature = 0x1e 0x94 0x89; + usbpid = 0x2fef; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - num_pages = 128; - min_write_delay = 9000; - max_write_delay = 9000; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + num_pages = 128; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x4000; - page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; #------------------------------------------------------------ # ATmega8U2 #------------------------------------------------------------ -# Changes against ATmega16U2 (beside IDs) -# memory "flash" -# size = 8192; -# page_size = 64; -# blocksize = 64; part - desc = "ATmega8U2"; - id = "m8u2"; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xc6; - signature = 0x1e 0x93 0x89; - usbpid = 0x2fee; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega8U2"; + id = "m8u2"; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xc6; + signature = 0x1e 0x93 0x89; + usbpid = 0x2fee; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - ocdrev = 1; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + ocdrev = 1; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - num_pages = 128; - min_write_delay = 9000; - max_write_delay = 9000; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + num_pages = 128; + min_write_delay = 9000; + max_write_delay = 9000; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--0000.aaaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.aaaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.aaaa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 8192; - page_size = 128; - num_pages = 64; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 8192; + page_size = 128; + num_pages = 64; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--xxxx.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -10886,118 +10850,118 @@ part #------------------------------------------------------------ part - desc = "ATmega165"; - id = "m165"; -# stk500_devcode = 0x??; -# avr910_devcode = 0x??; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x94 0x10; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega165"; + id = "m165"; +# stk500_devcode = 0x??; +# avr910_devcode = 0x??; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x94 0x10; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 6; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 6; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; - eecr = 0x3f; - ocdrev = 3; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + idr = 0x31; + spmcr = 0x57; + eecr = 0x3f; + ocdrev = 3; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 512; - page_size = 4; - num_pages = 128; - min_write_delay = 3600; - max_write_delay = 3600; - mode = 65; - delay = 20; - blocksize = 4; - readsize = 256; - read = "1010.0000--0000.00xa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--0000.00xa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--0000.00xa--aaaa.aa00--xxxx.xxxx"; + size = 512; + page_size = 4; + num_pages = 128; + min_write_delay = 3600; + max_write_delay = 3600; + mode = 65; + delay = 20; + blocksize = 4; + readsize = 256; + read = "1010.0000--0000.00xa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.00xa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.00xa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x4000; - page_size = 128; - num_pages = 128; - min_write_delay = 4500; - max_write_delay = 4500; - mode = 65; - delay = 10; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--0000.xxxx--xxaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--0000.xxxx--xxaa.aaaa--iiii.iiii"; - writepage = "0100.1100--xxxa.aaaa--aaxx.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x4000; + page_size = 128; + num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + mode = 65; + delay = 10; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--xxxa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--0000.xxxx--xxaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--0000.xxxx--xxaa.aaaa--iiii.iiii"; + writepage = "0100.1100--xxxa.aaaa--aaxx.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--0000.0000--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--0000.0000--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + size = 1; + read = "0011.1000--0000.0000--xxxx.xxxx--oooo.oooo"; ; ; @@ -11006,8 +10970,8 @@ part #------------------------------------------------------------ part parent "m165" - desc = "ATmega165A"; - id = "m165a"; + desc = "ATmega165A"; + id = "m165a"; ; #------------------------------------------------------------ @@ -11015,9 +10979,9 @@ part parent "m165" #------------------------------------------------------------ part parent "m165" - desc = "ATmega165P"; - id = "m165p"; - signature = 0x1e 0x94 0x07; + desc = "ATmega165P"; + id = "m165p"; + signature = 0x1e 0x94 0x07; ; #------------------------------------------------------------ @@ -11025,9 +10989,9 @@ part parent "m165" #------------------------------------------------------------ part parent "m165" - desc = "ATmega165PA"; - id = "m165pa"; - signature = 0x1e 0x94 0x07; + desc = "ATmega165PA"; + id = "m165pa"; + signature = 0x1e 0x94 0x07; ; #------------------------------------------------------------ @@ -11035,121 +10999,121 @@ part parent "m165" #------------------------------------------------------------ part - desc = "ATmega325"; - id = "m325"; -# stk500_devcode = 0x??; # No STK500v1 support? -# avr910_devcode = 0x??; # Try the ATmega16 one - avr910_devcode = 0x74; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x95 0x05; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega325"; + id = "m325"; +# stk500_devcode = 0x??; # No STK500v1 support? +# avr910_devcode = 0x??; # Try the ATmega16 one + avr910_devcode = 0x74; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x95 0x05; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--1000.0000--0000.0000--0000.0000"; - pgm_enable = "1010.1100--0101.0011--0000.0000--0000.0000"; + idr = 0x31; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--0000.0000--0000.0000"; + pgm_enable = "1010.1100--0101.0011--0000.0000--0000.0000"; memory "eeprom" - size = 1024; - page_size = 4; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 4; - readsize = 256; - read = "1010.0000--0000.00aa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--0000.00aa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--0000.00aa--aaaa.aa00--xxxx.xxxx"; + size = 1024; + page_size = 4; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 4; + readsize = 256; + read = "1010.0000--0000.00aa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.00aa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--0000.00aa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x8000; - page_size = 128; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--0000.0000--aaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--0000.0000--aaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--0aaa.aaaa--aaaa.aaaa--xxxx.xxxx"; + paged = yes; + size = 0x8000; + page_size = 128; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--0aaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--0000.0000--aaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--0000.0000--aaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--0aaa.aaaa--aaaa.aaaa--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--0000.0000--oooo.oooo"; - write = "1010.1100--1010.0000--0000.0000--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--1010.0000--0000.0000--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--0000.0000--oooo.oooo"; - write = "1010.1100--1010.1000--0000.0000--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--0000.0000--oooo.oooo"; + write = "1010.1100--1010.1000--0000.0000--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--0000.0000--oooo.oooo"; - write = "1010.1100--1010.0100--0000.0000--1111.1iii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--0000.0000--oooo.oooo"; + write = "1010.1100--1010.0100--0000.0000--1111.1iii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1110.0000--0000.0000--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1110.0000--0000.0000--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--0000.0000--0000.00aa--oooo.oooo"; + size = 3; + read = "0011.0000--0000.0000--0000.00aa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--0000.0000--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--0000.0000--0000.0000--oooo.oooo"; ; ; @@ -11158,8 +11122,8 @@ part #------------------------------------------------------------ part parent "m325" - desc = "ATmega325A"; - id = "m325a"; + desc = "ATmega325A"; + id = "m325a"; ; #------------------------------------------------------------ @@ -11167,9 +11131,9 @@ part parent "m325" #------------------------------------------------------------ part parent "m325" - desc = "ATmega325P"; - id = "m325p"; - signature = 0x1e 0x95 0x0d; + desc = "ATmega325P"; + id = "m325p"; + signature = 0x1e 0x95 0x0d; ; #------------------------------------------------------------ @@ -11177,9 +11141,9 @@ part parent "m325" #------------------------------------------------------------ part parent "m325" - desc = "ATmega325PA"; - id = "m325pa"; - signature = 0x1e 0x95 0x0d; + desc = "ATmega325PA"; + id = "m325pa"; + signature = 0x1e 0x95 0x0d; ; #------------------------------------------------------------ @@ -11187,121 +11151,121 @@ part parent "m325" #------------------------------------------------------------ part - desc = "ATmega645"; - id = "m645"; -# stk500_devcode = 0x??; # No STK500v1 support? -# avr910_devcode = 0x??; # Try the ATmega16 one - avr910_devcode = 0x74; - chip_erase_delay = 9000; - pagel = 0xd7; - bs2 = 0xa0; - signature = 0x1e 0x96 0x05; - reset = io; - has_jtag = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATmega645"; + id = "m645"; +# stk500_devcode = 0x??; # No STK500v1 support? +# avr910_devcode = 0x??; # Try the ATmega16 one + avr910_devcode = 0x74; + chip_erase_delay = 9000; + pagel = 0xd7; + bs2 = 0xa0; + signature = 0x1e 0x96 0x05; + reset = io; + has_jtag = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - hventerstabdelay = 100; - latchcycles = 5; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + latchcycles = 5; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - idr = 0x31; - spmcr = 0x57; - ocdrev = 3; - chip_erase = "1010.1100--1000.0000--0000.0000--0000.0000"; - pgm_enable = "1010.1100--0101.0011--0000.0000--0000.0000"; + idr = 0x31; + spmcr = 0x57; + ocdrev = 3; + chip_erase = "1010.1100--1000.0000--0000.0000--0000.0000"; + pgm_enable = "1010.1100--0101.0011--0000.0000--0000.0000"; memory "eeprom" - size = 2048; - page_size = 8; - min_write_delay = 9000; - max_write_delay = 9000; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 8; - readsize = 256; - read = "1010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--0000.0aaa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; - writepage = "1100.0010--0000.0aaa--aaaa.a000--xxxx.xxxx"; + size = 2048; + page_size = 8; + min_write_delay = 9000; + max_write_delay = 9000; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 8; + readsize = 256; + read = "1010.0000--0000.0aaa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--0000.0aaa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.0aaa--iiii.iiii"; + writepage = "1100.0010--0000.0aaa--aaaa.a000--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x10000; - page_size = 256; - num_pages = 256; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 10; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--0000.0000--aaaa.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--0000.0000--aaaa.aaaa--iiii.iiii"; - writepage = "0100.1100--aaaa.aaaa--aaaa.aaaa--0000.0000"; + paged = yes; + size = 0x10000; + page_size = 256; + num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 10; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--aaaa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--0000.0000--aaaa.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--0000.0000--aaaa.aaaa--iiii.iiii"; + writepage = "0100.1100--aaaa.aaaa--aaaa.aaaa--0000.0000"; ; memory "lfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.0000--0000.0000--oooo.oooo"; - write = "1010.1100--1010.0000--0000.0000--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.0000--0000.0000--oooo.oooo"; + write = "1010.1100--1010.0000--0000.0000--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.1000--0000.0000--oooo.oooo"; - write = "1010.1100--1010.1000--0000.0000--iiii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.1000--0000.0000--oooo.oooo"; + write = "1010.1100--1010.1000--0000.0000--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.0000--0000.1000--0000.0000--oooo.oooo"; - write = "1010.1100--1010.0100--0000.0000--1111.1iii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.0000--0000.1000--0000.0000--oooo.oooo"; + write = "1010.1100--1010.0100--0000.0000--1111.1iii"; ; memory "lock" - size = 1; - min_write_delay = 9000; - max_write_delay = 9000; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1110.0000--0000.0000--11ii.iiii"; + size = 1; + min_write_delay = 9000; + max_write_delay = 9000; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1110.0000--0000.0000--11ii.iiii"; ; memory "signature" - size = 3; - read = "0011.0000--0000.0000--0000.00aa--oooo.oooo"; + size = 3; + read = "0011.0000--0000.0000--0000.00aa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--0000.0000--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--0000.0000--0000.0000--oooo.oooo"; ; ; @@ -11310,8 +11274,8 @@ part #------------------------------------------------------------ part parent "m645" - desc = "ATmega645A"; - id = "m645a"; + desc = "ATmega645A"; + id = "m645a"; ; #------------------------------------------------------------ @@ -11319,9 +11283,9 @@ part parent "m645" #------------------------------------------------------------ part parent "m645" - desc = "ATmega645P"; - id = "m645p"; - signature = 0x1e 0x96 0x0d; + desc = "ATmega645P"; + id = "m645p"; + signature = 0x1e 0x96 0x0d; ; #------------------------------------------------------------ @@ -11329,9 +11293,9 @@ part parent "m645" #------------------------------------------------------------ part parent "m325" - desc = "ATmega3250"; - id = "m3250"; - signature = 0x1e 0x95 0x06; + desc = "ATmega3250"; + id = "m3250"; + signature = 0x1e 0x95 0x06; ; #------------------------------------------------------------ @@ -11339,9 +11303,9 @@ part parent "m325" #------------------------------------------------------------ part parent "m325" - desc = "ATmega3250A"; - id = "m3250a"; - signature = 0x1e 0x95 0x06; + desc = "ATmega3250A"; + id = "m3250a"; + signature = 0x1e 0x95 0x06; ; #------------------------------------------------------------ @@ -11349,9 +11313,9 @@ part parent "m325" #------------------------------------------------------------ part parent "m325" - desc = "ATmega3250P"; - id = "m3250p"; - signature = 0x1e 0x95 0x0e; + desc = "ATmega3250P"; + id = "m3250p"; + signature = 0x1e 0x95 0x0e; ; #------------------------------------------------------------ @@ -11359,9 +11323,9 @@ part parent "m325" #------------------------------------------------------------ part parent "m325" - desc = "ATmega3250PA"; - id = "m3250pa"; - signature = 0x1e 0x95 0x0e; + desc = "ATmega3250PA"; + id = "m3250pa"; + signature = 0x1e 0x95 0x0e; ; #------------------------------------------------------------ @@ -11369,9 +11333,9 @@ part parent "m325" #------------------------------------------------------------ part parent "m645" - desc = "ATmega6450"; - id = "m6450"; - signature = 0x1e 0x96 0x06; + desc = "ATmega6450"; + id = "m6450"; + signature = 0x1e 0x96 0x06; ; #------------------------------------------------------------ @@ -11379,9 +11343,9 @@ part parent "m645" #------------------------------------------------------------ part parent "m645" - desc = "ATmega6450A"; - id = "m6450a"; - signature = 0x1e 0x96 0x06; + desc = "ATmega6450A"; + id = "m6450a"; + signature = 0x1e 0x96 0x06; ; #------------------------------------------------------------ @@ -11389,9 +11353,9 @@ part parent "m645" #------------------------------------------------------------ part parent "m645" - desc = "ATmega6450P"; - id = "m6450p"; - signature = 0x1e 0x96 0x0e; + desc = "ATmega6450P"; + id = "m6450p"; + signature = 0x1e 0x96 0x0e; ; #------------------------------------------------------------ @@ -11399,52 +11363,52 @@ part parent "m645" #------------------------------------------------------------ part - desc = "AVR XMEGA family common values"; - id = ".xmega"; - has_pdi = yes; - mcu_base = 0x0090; - nvm_base = 0x01c0; + desc = "AVR XMEGA family common values"; + id = ".xmega"; + has_pdi = yes; + mcu_base = 0x0090; + nvm_base = 0x01c0; memory "fuse1" - size = 1; - offset = 0x8f0021; + size = 1; + offset = 0x8f0021; ; memory "fuse2" - size = 1; - offset = 0x8f0022; + size = 1; + offset = 0x8f0022; ; memory "fuse4" - size = 1; - offset = 0x8f0024; + size = 1; + offset = 0x8f0024; ; memory "fuse5" - size = 1; - offset = 0x8f0025; + size = 1; + offset = 0x8f0025; ; memory "lock" - size = 1; - offset = 0x8f0027; + size = 1; + offset = 0x8f0027; ; memory "signature" - size = 3; - offset = 0x1000090; + size = 3; + offset = 0x1000090; ; memory "prodsig" - size = 50; - page_size = 50; - offset = 0x8e0200; - readsize = 50; + size = 50; + page_size = 50; + offset = 0x8e0200; + readsize = 50; ; memory "data" # SRAM, only used to supply the offset - offset = 0x1000000; + offset = 0x1000000; ; ; @@ -11453,51 +11417,51 @@ part #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega16A4U"; - id = "x16a4u"; - signature = 0x1e 0x94 0x41; - usbpid = 0x2fe3; + desc = "ATxmega16A4U"; + id = "x16a4u"; + signature = 0x1e 0x94 0x41; + usbpid = 0x2fe3; memory "eeprom" - size = 1024; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 1024; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x5000; - page_size = 256; - offset = 0x800000; - readsize = 256; + size = 0x5000; + page_size = 256; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 0x4000; - page_size = 256; - offset = 0x800000; - readsize = 256; + size = 0x4000; + page_size = 256; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 4096; - page_size = 256; - offset = 0x803000; - readsize = 256; + size = 4096; + page_size = 256; + offset = 0x803000; + readsize = 256; ; memory "boot" - size = 4096; - page_size = 256; - offset = 0x804000; - readsize = 256; + size = 4096; + page_size = 256; + offset = 0x804000; + readsize = 256; ; memory "usersig" - size = 256; - page_size = 256; - offset = 0x8e0400; - readsize = 256; + size = 256; + page_size = 256; + offset = 0x8e0400; + readsize = 256; ; ; @@ -11506,9 +11470,9 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x16a4u" - desc = "ATxmega16C4"; - id = "x16c4"; - signature = 0x1e 0x94 0x43; + desc = "ATxmega16C4"; + id = "x16c4"; + signature = 0x1e 0x94 0x43; ; #------------------------------------------------------------ @@ -11516,9 +11480,9 @@ part parent "x16a4u" #------------------------------------------------------------ part parent "x16a4u" - desc = "ATxmega16D4"; - id = "x16d4"; - signature = 0x1e 0x94 0x42; + desc = "ATxmega16D4"; + id = "x16d4"; + signature = 0x1e 0x94 0x42; ; #------------------------------------------------------------ @@ -11526,12 +11490,12 @@ part parent "x16a4u" #------------------------------------------------------------ part parent "x16a4u" - desc = "ATxmega16A4"; - id = "x16a4"; + desc = "ATxmega16A4"; + id = "x16a4"; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; ; @@ -11540,51 +11504,51 @@ part parent "x16a4u" #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega32A4U"; - id = "x32a4u"; - signature = 0x1e 0x95 0x41; - usbpid = 0x2fe4; + desc = "ATxmega32A4U"; + id = "x32a4u"; + signature = 0x1e 0x95 0x41; + usbpid = 0x2fe4; memory "eeprom" - size = 1024; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 1024; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x9000; - page_size = 256; - offset = 0x800000; - readsize = 256; + size = 0x9000; + page_size = 256; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 0x8000; - page_size = 256; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 256; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 4096; - page_size = 256; - offset = 0x807000; - readsize = 256; + size = 4096; + page_size = 256; + offset = 0x807000; + readsize = 256; ; memory "boot" - size = 4096; - page_size = 256; - offset = 0x808000; - readsize = 256; + size = 4096; + page_size = 256; + offset = 0x808000; + readsize = 256; ; memory "usersig" - size = 256; - page_size = 256; - offset = 0x8e0400; - readsize = 256; + size = 256; + page_size = 256; + offset = 0x8e0400; + readsize = 256; ; ; @@ -11593,9 +11557,9 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x32a4u" - desc = "ATxmega32C4"; - id = "x32c4"; - signature = 0x1e 0x95 0x44; + desc = "ATxmega32C4"; + id = "x32c4"; + signature = 0x1e 0x95 0x44; ; #------------------------------------------------------------ @@ -11603,9 +11567,9 @@ part parent "x32a4u" #------------------------------------------------------------ part parent "x32a4u" - desc = "ATxmega32D4"; - id = "x32d4"; - signature = 0x1e 0x95 0x42; + desc = "ATxmega32D4"; + id = "x32d4"; + signature = 0x1e 0x95 0x42; ; #------------------------------------------------------------ @@ -11613,12 +11577,12 @@ part parent "x32a4u" #------------------------------------------------------------ part parent "x32a4u" - desc = "ATxmega32A4"; - id = "x32a4"; + desc = "ATxmega32A4"; + id = "x32a4"; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; ; @@ -11627,51 +11591,51 @@ part parent "x32a4u" #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega64A4U"; - id = "x64a4u"; - signature = 0x1e 0x96 0x46; - usbpid = 0x2fe5; + desc = "ATxmega64A4U"; + id = "x64a4u"; + signature = 0x1e 0x96 0x46; + usbpid = 0x2fe5; memory "eeprom" - size = 2048; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 2048; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x11000; - page_size = 256; - offset = 0x800000; - readsize = 256; + size = 0x11000; + page_size = 256; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 0x10000; - page_size = 256; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 256; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 4096; - page_size = 256; - offset = 0x80f000; - readsize = 256; + size = 4096; + page_size = 256; + offset = 0x80f000; + readsize = 256; ; memory "boot" - size = 4096; - page_size = 256; - offset = 0x810000; - readsize = 256; + size = 4096; + page_size = 256; + offset = 0x810000; + readsize = 256; ; memory "usersig" - size = 256; - page_size = 256; - offset = 0x8e0400; - readsize = 256; + size = 256; + page_size = 256; + offset = 0x8e0400; + readsize = 256; ; ; @@ -11680,10 +11644,10 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x64a4u" - desc = "ATxmega64C3"; - id = "x64c3"; - signature = 0x1e 0x96 0x49; - usbpid = 0x2fd6; + desc = "ATxmega64C3"; + id = "x64c3"; + signature = 0x1e 0x96 0x49; + usbpid = 0x2fd6; ; #------------------------------------------------------------ @@ -11691,9 +11655,9 @@ part parent "x64a4u" #------------------------------------------------------------ part parent "x64a4u" - desc = "ATxmega64D3"; - id = "x64d3"; - signature = 0x1e 0x96 0x4a; + desc = "ATxmega64D3"; + id = "x64d3"; + signature = 0x1e 0x96 0x4a; ; #------------------------------------------------------------ @@ -11701,9 +11665,9 @@ part parent "x64a4u" #------------------------------------------------------------ part parent "x64a4u" - desc = "ATxmega64D4"; - id = "x64d4"; - signature = 0x1e 0x96 0x47; + desc = "ATxmega64D4"; + id = "x64d4"; + signature = 0x1e 0x96 0x47; ; #------------------------------------------------------------ @@ -11711,14 +11675,14 @@ part parent "x64a4u" #------------------------------------------------------------ part parent "x64a4u" - desc = "ATxmega64A1"; - id = "x64a1"; - signature = 0x1e 0x96 0x4e; - has_jtag = yes; + desc = "ATxmega64A1"; + id = "x64a1"; + signature = 0x1e 0x96 0x4e; + has_jtag = yes; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; ; @@ -11727,9 +11691,9 @@ part parent "x64a4u" #------------------------------------------------------------ part parent "x64a1" - desc = "ATxmega64A1U"; - id = "x64a1u"; - usbpid = 0x2fe8; + desc = "ATxmega64A1U"; + id = "x64a1u"; + usbpid = 0x2fe8; ; #------------------------------------------------------------ @@ -11737,9 +11701,9 @@ part parent "x64a1" #------------------------------------------------------------ part parent "x64a1" - desc = "ATxmega64A3"; - id = "x64a3"; - signature = 0x1e 0x96 0x42; + desc = "ATxmega64A3"; + id = "x64a3"; + signature = 0x1e 0x96 0x42; ; #------------------------------------------------------------ @@ -11747,9 +11711,9 @@ part parent "x64a1" #------------------------------------------------------------ part parent "x64a1" - desc = "ATxmega64A3U"; - id = "x64a3u"; - signature = 0x1e 0x96 0x42; + desc = "ATxmega64A3U"; + id = "x64a3u"; + signature = 0x1e 0x96 0x42; ; #------------------------------------------------------------ @@ -11757,9 +11721,9 @@ part parent "x64a1" #------------------------------------------------------------ part parent "x64a1" - desc = "ATxmega64A4"; - id = "x64a4"; - signature = 0x1e 0x96 0x46; + desc = "ATxmega64A4"; + id = "x64a4"; + signature = 0x1e 0x96 0x46; ; #------------------------------------------------------------ @@ -11767,10 +11731,10 @@ part parent "x64a1" #------------------------------------------------------------ part parent "x64a1" - desc = "ATxmega64B1"; - id = "x64b1"; - signature = 0x1e 0x96 0x52; - usbpid = 0x2fe1; + desc = "ATxmega64B1"; + id = "x64b1"; + signature = 0x1e 0x96 0x52; + usbpid = 0x2fe1; ; #------------------------------------------------------------ @@ -11778,10 +11742,10 @@ part parent "x64a1" #------------------------------------------------------------ part parent "x64a1" - desc = "ATxmega64B3"; - id = "x64b3"; - signature = 0x1e 0x96 0x51; - usbpid = 0x2fdf; + desc = "ATxmega64B3"; + id = "x64b3"; + signature = 0x1e 0x96 0x51; + usbpid = 0x2fdf; ; #------------------------------------------------------------ @@ -11789,51 +11753,51 @@ part parent "x64a1" #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega128C3"; - id = "x128c3"; - signature = 0x1e 0x97 0x52; - usbpid = 0x2fd7; + desc = "ATxmega128C3"; + id = "x128c3"; + signature = 0x1e 0x97 0x52; + usbpid = 0x2fd7; memory "eeprom" - size = 2048; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 2048; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x22000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x22000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 0x20000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 8192; - page_size = 512; - offset = 0x81e000; - readsize = 256; + size = 8192; + page_size = 512; + offset = 0x81e000; + readsize = 256; ; memory "boot" - size = 8192; - page_size = 512; - offset = 0x820000; - readsize = 256; + size = 8192; + page_size = 512; + offset = 0x820000; + readsize = 256; ; memory "usersig" - size = 512; - page_size = 512; - offset = 0x8e0400; - readsize = 256; + size = 512; + page_size = 512; + offset = 0x8e0400; + readsize = 256; ; ; @@ -11842,9 +11806,9 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x128c3" - desc = "ATxmega128D3"; - id = "x128d3"; - signature = 0x1e 0x97 0x48; + desc = "ATxmega128D3"; + id = "x128d3"; + signature = 0x1e 0x97 0x48; ; #------------------------------------------------------------ @@ -11852,12 +11816,12 @@ part parent "x128c3" #------------------------------------------------------------ part parent "x128c3" - desc = "ATxmega128D4"; - id = "x128d4"; - signature = 0x1e 0x97 0x47; + desc = "ATxmega128D4"; + id = "x128d4"; + signature = 0x1e 0x97 0x47; memory "flash" - page_size = 256; + page_size = 256; ; ; @@ -11866,14 +11830,14 @@ part parent "x128c3" #------------------------------------------------------------ part parent "x128c3" - desc = "ATxmega128A1"; - id = "x128a1"; - signature = 0x1e 0x97 0x4c; - has_jtag = yes; + desc = "ATxmega128A1"; + id = "x128a1"; + signature = 0x1e 0x97 0x4c; + has_jtag = yes; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; ; @@ -11882,9 +11846,9 @@ part parent "x128c3" #------------------------------------------------------------ part parent "x128a1" - desc = "ATxmega128A1revD"; - id = "x128a1d"; - signature = 0x1e 0x97 0x41; + desc = "ATxmega128A1revD"; + id = "x128a1d"; + signature = 0x1e 0x97 0x41; ; #------------------------------------------------------------ @@ -11892,9 +11856,9 @@ part parent "x128a1" #------------------------------------------------------------ part parent "x128a1" - desc = "ATxmega128A1U"; - id = "x128a1u"; - usbpid = 0x2fed; + desc = "ATxmega128A1U"; + id = "x128a1u"; + usbpid = 0x2fed; ; #------------------------------------------------------------ @@ -11902,9 +11866,9 @@ part parent "x128a1" #------------------------------------------------------------ part parent "x128a1" - desc = "ATxmega128A3"; - id = "x128a3"; - signature = 0x1e 0x97 0x42; + desc = "ATxmega128A3"; + id = "x128a3"; + signature = 0x1e 0x97 0x42; ; #------------------------------------------------------------ @@ -11912,10 +11876,10 @@ part parent "x128a1" #------------------------------------------------------------ part parent "x128a1" - desc = "ATxmega128A3U"; - id = "x128a3u"; - signature = 0x1e 0x97 0x42; - usbpid = 0x2fe6; + desc = "ATxmega128A3U"; + id = "x128a3u"; + signature = 0x1e 0x97 0x42; + usbpid = 0x2fe6; ; #------------------------------------------------------------ @@ -11923,56 +11887,56 @@ part parent "x128a1" #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega128A4"; - id = "x128a4"; - signature = 0x1e 0x97 0x46; - has_jtag = yes; + desc = "ATxmega128A4"; + id = "x128a4"; + signature = 0x1e 0x97 0x46; + has_jtag = yes; memory "eeprom" - size = 2048; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 2048; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x22000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x22000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 0x20000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 4096; - page_size = 512; - offset = 0x81f000; - readsize = 256; + size = 4096; + page_size = 512; + offset = 0x81f000; + readsize = 256; ; memory "boot" - size = 8192; - page_size = 512; - offset = 0x820000; - readsize = 256; + size = 8192; + page_size = 512; + offset = 0x820000; + readsize = 256; ; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; memory "usersig" - size = 512; - page_size = 512; - offset = 0x8e0400; - readsize = 256; + size = 512; + page_size = 512; + offset = 0x8e0400; + readsize = 256; ; ; @@ -11981,51 +11945,51 @@ part parent ".xmega" #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega128A4U"; - id = "x128a4u"; - signature = 0x1e 0x97 0x46; - usbpid = 0x2fde; + desc = "ATxmega128A4U"; + id = "x128a4u"; + signature = 0x1e 0x97 0x46; + usbpid = 0x2fde; memory "eeprom" - size = 2048; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 2048; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x22000; - page_size = 256; - offset = 0x800000; - readsize = 256; + size = 0x22000; + page_size = 256; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 0x20000; - page_size = 256; - offset = 0x800000; - readsize = 256; + size = 0x20000; + page_size = 256; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 4096; - page_size = 256; - offset = 0x81f000; - readsize = 256; + size = 4096; + page_size = 256; + offset = 0x81f000; + readsize = 256; ; memory "boot" - size = 8192; - page_size = 256; - offset = 0x820000; - readsize = 256; + size = 8192; + page_size = 256; + offset = 0x820000; + readsize = 256; ; memory "usersig" - size = 256; - page_size = 256; - offset = 0x8e0400; - readsize = 256; + size = 256; + page_size = 256; + offset = 0x8e0400; + readsize = 256; ; ; @@ -12034,57 +11998,57 @@ part parent ".xmega" #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega128B1"; - id = "x128b1"; - signature = 0x1e 0x97 0x4d; - usbpid = 0x2fea; - has_jtag = yes; + desc = "ATxmega128B1"; + id = "x128b1"; + signature = 0x1e 0x97 0x4d; + usbpid = 0x2fea; + has_jtag = yes; memory "eeprom" - size = 2048; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 2048; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x22000; - page_size = 256; - offset = 0x800000; - readsize = 256; + size = 0x22000; + page_size = 256; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 0x20000; - page_size = 256; - offset = 0x800000; - readsize = 256; + size = 0x20000; + page_size = 256; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 8192; - page_size = 256; - offset = 0x81e000; - readsize = 256; + size = 8192; + page_size = 256; + offset = 0x81e000; + readsize = 256; ; memory "boot" - size = 8192; - page_size = 256; - offset = 0x820000; - readsize = 256; + size = 8192; + page_size = 256; + offset = 0x820000; + readsize = 256; ; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; memory "usersig" - size = 256; - page_size = 256; - offset = 0x8e0400; - readsize = 256; + size = 256; + page_size = 256; + offset = 0x8e0400; + readsize = 256; ; ; @@ -12093,10 +12057,10 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x128b1" - desc = "ATxmega128B3"; - id = "x128b3"; - signature = 0x1e 0x97 0x4b; - usbpid = 0x2fe0; + desc = "ATxmega128B3"; + id = "x128b3"; + signature = 0x1e 0x97 0x4b; + usbpid = 0x2fe0; ; #------------------------------------------------------------ @@ -12104,51 +12068,51 @@ part parent "x128b1" #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega192C3"; - id = "x192c3"; - signature = 0x1e 0x97 0x51; - # usbpid = 0x2f??; + desc = "ATxmega192C3"; + id = "x192c3"; + signature = 0x1e 0x97 0x51; +# usbpid = 0x2f??; memory "eeprom" - size = 2048; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 2048; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x32000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x32000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 0x30000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x30000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 8192; - page_size = 512; - offset = 0x82e000; - readsize = 256; + size = 8192; + page_size = 512; + offset = 0x82e000; + readsize = 256; ; memory "boot" - size = 8192; - page_size = 512; - offset = 0x830000; - readsize = 256; + size = 8192; + page_size = 512; + offset = 0x830000; + readsize = 256; ; memory "usersig" - size = 512; - page_size = 512; - offset = 0x8e0400; - readsize = 256; + size = 512; + page_size = 512; + offset = 0x8e0400; + readsize = 256; ; ; @@ -12157,9 +12121,9 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x192c3" - desc = "ATxmega192D3"; - id = "x192d3"; - signature = 0x1e 0x97 0x49; + desc = "ATxmega192D3"; + id = "x192d3"; + signature = 0x1e 0x97 0x49; ; #------------------------------------------------------------ @@ -12167,14 +12131,14 @@ part parent "x192c3" #------------------------------------------------------------ part parent "x192c3" - desc = "ATxmega192A1"; - id = "x192a1"; - signature = 0x1e 0x97 0x4e; - has_jtag = yes; + desc = "ATxmega192A1"; + id = "x192a1"; + signature = 0x1e 0x97 0x4e; + has_jtag = yes; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; ; @@ -12183,9 +12147,9 @@ part parent "x192c3" #------------------------------------------------------------ part parent "x192a1" - desc = "ATxmega192A3"; - id = "x192a3"; - signature = 0x1e 0x97 0x44; + desc = "ATxmega192A3"; + id = "x192a3"; + signature = 0x1e 0x97 0x44; ; #------------------------------------------------------------ @@ -12193,10 +12157,10 @@ part parent "x192a1" #------------------------------------------------------------ part parent "x192a1" - desc = "ATxmega192A3U"; - id = "x192a3u"; - signature = 0x1e 0x97 0x44; - usbpid = 0x2fe7; + desc = "ATxmega192A3U"; + id = "x192a3u"; + signature = 0x1e 0x97 0x44; + usbpid = 0x2fe7; ; #------------------------------------------------------------ @@ -12204,51 +12168,51 @@ part parent "x192a1" #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega256C3"; - id = "x256c3"; - signature = 0x1e 0x98 0x46; - usbpid = 0x2fda; + desc = "ATxmega256C3"; + id = "x256c3"; + signature = 0x1e 0x98 0x46; + usbpid = 0x2fda; memory "eeprom" - size = 4096; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 4096; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x42000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x42000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 0x40000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x40000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 8192; - page_size = 512; - offset = 0x83e000; - readsize = 256; + size = 8192; + page_size = 512; + offset = 0x83e000; + readsize = 256; ; memory "boot" - size = 8192; - page_size = 512; - offset = 0x840000; - readsize = 256; + size = 8192; + page_size = 512; + offset = 0x840000; + readsize = 256; ; memory "usersig" - size = 512; - page_size = 512; - offset = 0x8e0400; - readsize = 256; + size = 512; + page_size = 512; + offset = 0x8e0400; + readsize = 256; ; ; @@ -12257,9 +12221,9 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x256c3" - desc = "ATxmega256D3"; - id = "x256d3"; - signature = 0x1e 0x98 0x44; + desc = "ATxmega256D3"; + id = "x256d3"; + signature = 0x1e 0x98 0x44; ; #------------------------------------------------------------ @@ -12267,13 +12231,13 @@ part parent "x256c3" #------------------------------------------------------------ part parent "x256c3" - desc = "ATxmega256A1"; - id = "x256a1"; - has_jtag = yes; + desc = "ATxmega256A1"; + id = "x256a1"; + has_jtag = yes; memory "fuse0" - size = 1; - offset = 0x8f0020; + size = 1; + offset = 0x8f0020; ; ; @@ -12282,9 +12246,9 @@ part parent "x256c3" #------------------------------------------------------------ part parent "x256a1" - desc = "ATxmega256A3"; - id = "x256a3"; - signature = 0x1e 0x98 0x42; + desc = "ATxmega256A3"; + id = "x256a3"; + signature = 0x1e 0x98 0x42; ; #------------------------------------------------------------ @@ -12292,10 +12256,10 @@ part parent "x256a1" #------------------------------------------------------------ part parent "x256a1" - desc = "ATxmega256A3U"; - id = "x256a3u"; - signature = 0x1e 0x98 0x42; - usbpid = 0x2fec; + desc = "ATxmega256A3U"; + id = "x256a3u"; + signature = 0x1e 0x98 0x42; + usbpid = 0x2fec; ; #------------------------------------------------------------ @@ -12303,9 +12267,9 @@ part parent "x256a1" #------------------------------------------------------------ part parent "x256a1" - desc = "ATxmega256A3B"; - id = "x256a3b"; - signature = 0x1e 0x98 0x43; + desc = "ATxmega256A3B"; + id = "x256a3b"; + signature = 0x1e 0x98 0x43; ; #------------------------------------------------------------ @@ -12313,10 +12277,10 @@ part parent "x256a1" #------------------------------------------------------------ part parent "x256a1" - desc = "ATxmega256A3BU"; - id = "x256a3bu"; - signature = 0x1e 0x98 0x43; - usbpid = 0x2fe2; + desc = "ATxmega256A3BU"; + id = "x256a3bu"; + signature = 0x1e 0x98 0x43; + usbpid = 0x2fe2; ; #------------------------------------------------------------ @@ -12324,51 +12288,51 @@ part parent "x256a1" #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega384C3"; - id = "x384c3"; - signature = 0x1e 0x98 0x45; - usbpid = 0x2fdb; + desc = "ATxmega384C3"; + id = "x384c3"; + signature = 0x1e 0x98 0x45; + usbpid = 0x2fdb; memory "eeprom" - size = 4096; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 4096; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x62000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x62000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 0x60000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x60000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 8192; - page_size = 512; - offset = 0x85e000; - readsize = 256; + size = 8192; + page_size = 512; + offset = 0x85e000; + readsize = 256; ; memory "boot" - size = 8192; - page_size = 512; - offset = 0x860000; - readsize = 256; + size = 8192; + page_size = 512; + offset = 0x860000; + readsize = 256; ; memory "usersig" - size = 512; - page_size = 512; - offset = 0x8e0400; - readsize = 256; + size = 512; + page_size = 512; + offset = 0x8e0400; + readsize = 256; ; ; @@ -12377,9 +12341,9 @@ part parent ".xmega" #------------------------------------------------------------ part parent "x384c3" - desc = "ATxmega384D3"; - id = "x384d3"; - signature = 0x1e 0x98 0x47; + desc = "ATxmega384D3"; + id = "x384d3"; + signature = 0x1e 0x98 0x47; ; #------------------------------------------------------------ @@ -12387,50 +12351,50 @@ part parent "x384c3" #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega8E5"; - id = "x8e5"; - signature = 0x1e 0x93 0x41; + desc = "ATxmega8E5"; + id = "x8e5"; + signature = 0x1e 0x93 0x41; memory "eeprom" - size = 512; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 512; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x2800; - page_size = 128; - offset = 0x800000; - readsize = 256; + size = 0x2800; + page_size = 128; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 8192; - page_size = 128; - offset = 0x800000; - readsize = 256; + size = 8192; + page_size = 128; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 2048; - page_size = 128; - offset = 0x801800; - readsize = 256; + size = 2048; + page_size = 128; + offset = 0x801800; + readsize = 256; ; memory "boot" - size = 2048; - page_size = 128; - offset = 0x802000; - readsize = 256; + size = 2048; + page_size = 128; + offset = 0x802000; + readsize = 256; ; memory "usersig" - size = 128; - page_size = 128; - offset = 0x8e0400; - readsize = 256; + size = 128; + page_size = 128; + offset = 0x8e0400; + readsize = 256; ; ; @@ -12439,50 +12403,50 @@ part parent ".xmega" #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega16E5"; - id = "x16e5"; - signature = 0x1e 0x94 0x45; + desc = "ATxmega16E5"; + id = "x16e5"; + signature = 0x1e 0x94 0x45; memory "eeprom" - size = 512; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 512; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x5000; - page_size = 128; - offset = 0x800000; - readsize = 256; + size = 0x5000; + page_size = 128; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 0x4000; - page_size = 128; - offset = 0x800000; - readsize = 256; + size = 0x4000; + page_size = 128; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 4096; - page_size = 128; - offset = 0x803000; - readsize = 256; + size = 4096; + page_size = 128; + offset = 0x803000; + readsize = 256; ; memory "boot" - size = 4096; - page_size = 128; - offset = 0x804000; - readsize = 256; + size = 4096; + page_size = 128; + offset = 0x804000; + readsize = 256; ; memory "usersig" - size = 128; - page_size = 128; - offset = 0x8e0400; - readsize = 256; + size = 128; + page_size = 128; + offset = 0x8e0400; + readsize = 256; ; ; @@ -12491,50 +12455,50 @@ part parent ".xmega" #------------------------------------------------------------ part parent ".xmega" - desc = "ATxmega32E5"; - id = "x32e5"; - signature = 0x1e 0x95 0x4c; + desc = "ATxmega32E5"; + id = "x32e5"; + signature = 0x1e 0x95 0x4c; memory "eeprom" - size = 1024; - page_size = 32; - offset = 0x8c0000; - readsize = 256; + size = 1024; + page_size = 32; + offset = 0x8c0000; + readsize = 256; ; memory "flash" - size = 0x9000; - page_size = 128; - offset = 0x800000; - readsize = 256; + size = 0x9000; + page_size = 128; + offset = 0x800000; + readsize = 256; ; memory "application" - size = 0x8000; - page_size = 128; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 128; + offset = 0x800000; + readsize = 256; ; memory "apptable" - size = 4096; - page_size = 128; - offset = 0x807000; - readsize = 256; + size = 4096; + page_size = 128; + offset = 0x807000; + readsize = 256; ; memory "boot" - size = 4096; - page_size = 128; - offset = 0x808000; - readsize = 256; + size = 4096; + page_size = 128; + offset = 0x808000; + readsize = 256; ; memory "usersig" - size = 128; - page_size = 128; - offset = 0x8e0400; - readsize = 256; + size = 128; + page_size = 128; + offset = 0x8e0400; + readsize = 256; ; ; @@ -12543,19 +12507,19 @@ part parent ".xmega" #------------------------------------------------------------ part - desc = "AT32UC3A0512"; - id = "uc3a0512"; - signature = 0xed 0xc0 0x3f; - has_jtag = yes; - is_avr32 = yes; + desc = "AT32UC3A0512"; + id = "uc3a0512"; + signature = 0xed 0xc0 0x3f; + has_jtag = yes; + is_avr32 = yes; memory "flash" - paged = yes; - size = 0x80000; # could be set dynamicly - page_size = 512; # bytes - num_pages = 1024; # could be set dynamicly - offset = 0x80000000; - readsize = 512; # bytes + paged = yes; + size = 0x80000; # could be set dynamicly + page_size = 512; # bytes + num_pages = 1024; # could be set dynamicly + offset = 0x80000000; + readsize = 512; # bytes ; ; @@ -12564,8 +12528,8 @@ part #------------------------------------------------------------ part parent "uc3a0512" - desc = "deprecated, use 'uc3a0512'"; - id = "ucr2"; + desc = "deprecated, use 'uc3a0512'"; + id = "ucr2"; ; #------------------------------------------------------------ @@ -12573,122 +12537,122 @@ part parent "uc3a0512" #------------------------------------------------------------ part - desc = "ATtiny1634"; - id = "t1634"; - stk500_devcode = 0x86; - chip_erase_delay = 9000; - pagel = 0xb3; - bs2 = 0xb1; - # avr910_devcode = 0x; - signature = 0x1e 0x94 0x12; - reset = io; - has_debugwire = yes; - timeout = 200; - stabdelay = 100; - cmdexedelay = 25; - synchloops = 32; - pollindex = 3; - pollvalue = 0x53; - predelay = 1; - postdelay = 1; - pollmethod = 1; - pp_controlstack = + desc = "ATtiny1634"; + id = "t1634"; + stk500_devcode = 0x86; + chip_erase_delay = 9000; + pagel = 0xb3; + bs2 = 0xb1; +# avr910_devcode = 0x??; + signature = 0x1e 0x94 0x12; + reset = io; + has_debugwire = yes; + timeout = 200; + stabdelay = 100; + cmdexedelay = 25; + synchloops = 32; + pollindex = 3; + pollvalue = 0x53; + predelay = 1; + postdelay = 1; + pollmethod = 1; + pp_controlstack = 0x0e, 0x1e, 0x0e, 0x1e, 0x2e, 0x3e, 0x2e, 0x3e, 0x4e, 0x5e, 0x4e, 0x5e, 0x6e, 0x7e, 0x6e, 0x7e, 0x26, 0x36, 0x66, 0x76, 0x2a, 0x3a, 0x6a, 0x7a, 0x2e, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - flash_instr = 0xb6, 0x01, 0x11; - eeprom_instr = + flash_instr = 0xb6, 0x01, 0x11; + eeprom_instr = 0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00, 0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf, 0x99, 0xf9, 0xbb, 0xaf; - hventerstabdelay = 100; - togglevtg = 1; - poweroffdelay = 15; - resetdelayms = 1; - hvleavestabdelay = 15; - resetdelay = 15; - chiperasepolltimeout = 10; + hventerstabdelay = 100; + togglevtg = 1; + poweroffdelay = 15; + resetdelayms = 1; + hvleavestabdelay = 15; + resetdelay = 15; + chiperasepolltimeout = 10; programfusepolltimeout = 5; programlockpolltimeout = 5; - chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; - pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; + chip_erase = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx"; + pgm_enable = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx"; memory "eeprom" - size = 256; - page_size = 4; - min_write_delay = 3600; - max_write_delay = 3600; - readback = 0xff 0xff; - mode = 65; - delay = 5; - blocksize = 4; - readsize = 256; - read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; - write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; - loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; - writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; + size = 256; + page_size = 4; + min_write_delay = 3600; + max_write_delay = 3600; + readback = 0xff 0xff; + mode = 65; + delay = 5; + blocksize = 4; + readsize = 256; + read = "1010.0000--000x.xxxa--aaaa.aaaa--oooo.oooo"; + write = "1100.0000--000x.xxxa--aaaa.aaaa--iiii.iiii"; + loadpage_lo = "1100.0001--0000.0000--0000.00aa--iiii.iiii"; + writepage = "1100.0010--00xx.xxxa--aaaa.aa00--xxxx.xxxx"; ; memory "flash" - paged = yes; - size = 0x4000; - page_size = 32; - num_pages = 512; - min_write_delay = 4500; - max_write_delay = 4500; - readback = 0xff 0xff; - mode = 65; - delay = 6; - blocksize = 128; - readsize = 256; - read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; - read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; - loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; - loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; - writepage = "0100.1100--00aa.aaaa--aaaa.xxxx--xxxx.xxxx"; + paged = yes; + size = 0x4000; + page_size = 32; + num_pages = 512; + min_write_delay = 4500; + max_write_delay = 4500; + readback = 0xff 0xff; + mode = 65; + delay = 6; + blocksize = 128; + readsize = 256; + read_lo = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + read_hi = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo"; + loadpage_lo = "0100.0000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + loadpage_hi = "0100.1000--000x.xxxx--xxxx.aaaa--iiii.iiii"; + writepage = "0100.1100--00aa.aaaa--aaaa.xxxx--xxxx.xxxx"; ; memory "lfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii"; ; memory "hfuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii"; ; memory "efuse" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--1010.0100--xxxx.xxxx--xxxi.iiii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--1010.0100--xxxx.xxxx--xxxi.iiii"; ; memory "lock" - size = 1; - min_write_delay = 4500; - max_write_delay = 4500; - read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; - write = "1010.1100--111x.xxxx--xxxx.xxxx--1111.11ii"; + size = 1; + min_write_delay = 4500; + max_write_delay = 4500; + read = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo"; + write = "1010.1100--111x.xxxx--xxxx.xxxx--1111.11ii"; ; memory "signature" - size = 3; - read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; + size = 3; + read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; memory "calibration" - size = 1; - read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; + size = 1; + read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; ; @@ -12697,8 +12661,8 @@ part #------------------------------------------------------------ part parent "t1634" - desc = "ATtiny1634R"; - id = "t1634r"; + desc = "ATtiny1634R"; + id = "t1634r"; ; #------------------------------------------------------------ @@ -12706,39 +12670,39 @@ part parent "t1634" #------------------------------------------------------------ part - desc = "Common values for reduced core tinys"; - id = ".reduced_core_tiny"; - has_tpi = yes; + desc = "Common values for reduced core tinys"; + id = ".reduced_core_tiny"; + has_tpi = yes; memory "fuse" - size = 1; - page_size = 16; - offset = 0x3f40; - blocksize = 4; + size = 1; + page_size = 16; + offset = 0x3f40; + blocksize = 4; ; memory "lockbits" - size = 1; - page_size = 16; - offset = 0x3f00; + size = 1; + page_size = 16; + offset = 0x3f00; ; memory "lockbits" - size = 1; - page_size = 16; - offset = 0x3f00; + size = 1; + page_size = 16; + offset = 0x3f00; ; memory "signature" - size = 3; - page_size = 16; - offset = 0x3fc0; + size = 3; + page_size = 16; + offset = 0x3fc0; ; memory "calibration" - size = 1; - page_size = 16; - offset = 0x3f80; + size = 1; + page_size = 16; + offset = 0x3f80; ; ; @@ -12747,15 +12711,15 @@ part #------------------------------------------------------------ part parent ".reduced_core_tiny" - desc = "ATtiny4"; - id = "t4"; - signature = 0x1e 0x8f 0x0a; + desc = "ATtiny4"; + id = "t4"; + signature = 0x1e 0x8f 0x0a; memory "flash" - size = 512; - page_size = 16; - offset = 0x4000; - blocksize = 128; + size = 512; + page_size = 16; + offset = 0x4000; + blocksize = 128; ; ; @@ -12764,9 +12728,9 @@ part parent ".reduced_core_tiny" #------------------------------------------------------------ part parent "t4" - desc = "ATtiny5"; - id = "t5"; - signature = 0x1e 0x8f 0x09; + desc = "ATtiny5"; + id = "t5"; + signature = 0x1e 0x8f 0x09; ; #------------------------------------------------------------ @@ -12774,15 +12738,15 @@ part parent "t4" #------------------------------------------------------------ part parent ".reduced_core_tiny" - desc = "ATtiny9"; - id = "t9"; - signature = 0x1e 0x90 0x08; + desc = "ATtiny9"; + id = "t9"; + signature = 0x1e 0x90 0x08; memory "flash" - size = 1024; - page_size = 16; - offset = 0x4000; - blocksize = 128; + size = 1024; + page_size = 16; + offset = 0x4000; + blocksize = 128; ; ; @@ -12791,9 +12755,9 @@ part parent ".reduced_core_tiny" #------------------------------------------------------------ part parent "t9" - desc = "ATtiny10"; - id = "t10"; - signature = 0x1e 0x90 0x03; + desc = "ATtiny10"; + id = "t10"; + signature = 0x1e 0x90 0x03; ; #------------------------------------------------------------ @@ -12801,15 +12765,15 @@ part parent "t9" #------------------------------------------------------------ part parent ".reduced_core_tiny" - desc = "ATtiny20"; - id = "t20"; - signature = 0x1e 0x91 0x0f; + desc = "ATtiny20"; + id = "t20"; + signature = 0x1e 0x91 0x0f; memory "flash" - size = 2048; - page_size = 16; - offset = 0x4000; - blocksize = 128; + size = 2048; + page_size = 16; + offset = 0x4000; + blocksize = 128; ; ; @@ -12818,15 +12782,15 @@ part parent ".reduced_core_tiny" #------------------------------------------------------------ part parent ".reduced_core_tiny" - desc = "ATtiny40"; - id = "t40"; - signature = 0x1e 0x92 0x0e; + desc = "ATtiny40"; + id = "t40"; + signature = 0x1e 0x92 0x0e; memory "flash" - size = 4096; - page_size = 64; - offset = 0x4000; - blocksize = 128; + size = 4096; + page_size = 64; + offset = 0x4000; + blocksize = 128; ; ; @@ -12835,15 +12799,15 @@ part parent ".reduced_core_tiny" #------------------------------------------------------------ part parent ".reduced_core_tiny" - desc = "ATtiny102"; - id = "t102"; - signature = 0x1e 0x90 0x0c; + desc = "ATtiny102"; + id = "t102"; + signature = 0x1e 0x90 0x0c; memory "flash" - size = 1024; - page_size = 16; - offset = 0x4000; - blocksize = 128; + size = 1024; + page_size = 16; + offset = 0x4000; + blocksize = 128; ; ; @@ -12852,15 +12816,15 @@ part parent ".reduced_core_tiny" #------------------------------------------------------------ part parent ".reduced_core_tiny" - desc = "ATtiny104"; - id = "t104"; - signature = 0x1e 0x90 0x0b; + desc = "ATtiny104"; + id = "t104"; + signature = 0x1e 0x90 0x0b; memory "flash" - size = 1024; - page_size = 16; - offset = 0x4000; - blocksize = 128; + size = 1024; + page_size = 16; + offset = 0x4000; + blocksize = 128; ; ; @@ -12869,60 +12833,60 @@ part parent ".reduced_core_tiny" #------------------------------------------------------------ part - desc = "ATmega406"; - id = "m406"; + desc = "ATmega406"; + id = "m406"; # STK500 parameters (parallel programming IO lines) - pagel = 0xa7; - bs2 = 0xa0; - signature = 0x1e 0x95 0x07; - reset = io; - has_jtag = yes; - serial = no; + pagel = 0xa7; + bs2 = 0xa0; + signature = 0x1e 0x95 0x07; + reset = io; + has_jtag = yes; + serial = no; # STK500v2 HV programming parameters, from XML - pp_controlstack = + pp_controlstack = 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b, 0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; - idr = 0x51; - spmcr = 0x57; - eecr = 0x3f; + idr = 0x51; + spmcr = 0x57; + eecr = 0x3f; memory "eeprom" - size = 512; - page_size = 4; - num_pages = 128; - blocksize = 4; - readsize = 4; + size = 512; + page_size = 4; + num_pages = 128; + blocksize = 4; + readsize = 4; ; memory "flash" - paged = yes; - size = 0xa000; - page_size = 128; - num_pages = 320; - blocksize = 128; - readsize = 128; + paged = yes; + size = 0xa000; + page_size = 128; + num_pages = 320; + blocksize = 128; + readsize = 128; ; memory "lfuse" - size = 1; + size = 1; ; memory "hfuse" - size = 1; + size = 1; ; memory "lockbits" - size = 1; + size = 1; ; memory "lockbits" - size = 1; + size = 1; ; memory "signature" - size = 3; + size = 3; ; ; @@ -12931,16 +12895,16 @@ part #------------------------------------------------------------ part - desc = "AVR8X family common values"; - id = ".avr8x"; - has_updi = yes; - nvm_base = 0x1000; - ocd_base = 0x0f80; + desc = "AVR8X family common values"; + id = ".avr8x"; + has_updi = yes; + nvm_base = 0x1000; + ocd_base = 0x0f80; memory "fuse0" - size = 1; - offset = 0x1280; - readsize = 1; + size = 1; + offset = 0x1280; + readsize = 1; ; memory "wdtcfg" @@ -12948,9 +12912,9 @@ part ; memory "fuse1" - size = 1; - offset = 0x1281; - readsize = 1; + size = 1; + offset = 0x1281; + readsize = 1; ; memory "bodcfg" @@ -12958,9 +12922,9 @@ part ; memory "fuse2" - size = 1; - offset = 0x1282; - readsize = 1; + size = 1; + offset = 0x1282; + readsize = 1; ; memory "osccfg" @@ -12968,9 +12932,9 @@ part ; memory "fuse4" - size = 1; - offset = 0x1284; - readsize = 1; + size = 1; + offset = 0x1284; + readsize = 1; ; memory "tcd0cfg" @@ -12978,9 +12942,9 @@ part ; memory "fuse5" - size = 1; - offset = 0x1285; - readsize = 1; + size = 1; + offset = 0x1285; + readsize = 1; ; memory "syscfg0" @@ -12988,9 +12952,9 @@ part ; memory "fuse6" - size = 1; - offset = 0x1286; - readsize = 1; + size = 1; + offset = 0x1286; + readsize = 1; ; memory "syscfg1" @@ -12998,9 +12962,9 @@ part ; memory "fuse7" - size = 1; - offset = 0x1287; - readsize = 1; + size = 1; + offset = 0x1287; + readsize = 1; ; memory "append" @@ -13012,9 +12976,9 @@ part ; memory "fuse8" - size = 1; - offset = 0x1288; - readsize = 1; + size = 1; + offset = 0x1288; + readsize = 1; ; memory "bootend" @@ -13026,70 +12990,70 @@ part ; memory "fuses" - size = 9; - page_size = 10; - offset = 0x1280; - readsize = 10; + size = 9; + page_size = 10; + offset = 0x1280; + readsize = 10; ; memory "lock" - size = 1; - offset = 0x128a; - readsize = 1; + size = 1; + offset = 0x128a; + readsize = 1; ; memory "tempsense" - size = 2; - offset = 0x1120; - readsize = 1; + size = 2; + offset = 0x1120; + readsize = 1; ; memory "signature" - size = 3; - offset = 0x1100; - readsize = 3; + size = 3; + offset = 0x1100; + readsize = 3; ; memory "prodsig" - size = 61; - page_size = 61; - offset = 0x1103; - readsize = 61; + size = 61; + page_size = 61; + offset = 0x1103; + readsize = 61; ; memory "sernum" - size = 10; - offset = 0x1104; - readsize = 1; + size = 10; + offset = 0x1104; + readsize = 1; ; memory "osccal16" - size = 2; - offset = 0x1118; - readsize = 1; + size = 2; + offset = 0x1118; + readsize = 1; ; memory "osccal20" - size = 2; - offset = 0x111a; - readsize = 1; + size = 2; + offset = 0x111a; + readsize = 1; ; memory "osc16err" - size = 2; - offset = 0x1122; - readsize = 1; + size = 2; + offset = 0x1122; + readsize = 1; ; memory "osc20err" - size = 2; - offset = 0x1124; - readsize = 1; + size = 2; + offset = 0x1124; + readsize = 1; ; memory "data" # SRAM, only used to supply the offset - offset = 0x1000000; + offset = 0x1000000; ; ; @@ -13098,17 +13062,17 @@ part #------------------------------------------------------------ part parent ".avr8x" - desc = "AVR8X tiny family common values"; - id = ".avr8x_tiny"; - family_id = "tinyAVR"; + desc = "AVR8X tiny family common values"; + id = ".avr8x_tiny"; + family_id = "tinyAVR"; # Shared UPDI pin, HV on UPDI pin - hvupdi_variant = 0; + hvupdi_variant = 0; memory "userrow" - size = 32; - page_size = 32; - offset = 0x1300; - readsize = 256; + size = 32; + page_size = 32; + offset = 0x1300; + readsize = 256; ; memory "usersig" @@ -13121,17 +13085,17 @@ part parent ".avr8x" #------------------------------------------------------------ part parent ".avr8x" - desc = "AVR8X mega family common values"; - id = ".avr8x_mega"; - family_id = "megaAVR"; + desc = "AVR8X mega family common values"; + id = ".avr8x_mega"; + family_id = "megaAVR"; # Dedicated UPDI pin, no HV - hvupdi_variant = 1; + hvupdi_variant = 1; memory "userrow" - size = 64; - page_size = 64; - offset = 0x1300; - readsize = 256; + size = 64; + page_size = 64; + offset = 0x1300; + readsize = 256; ; memory "usersig" @@ -13144,22 +13108,22 @@ part parent ".avr8x" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny202"; - id = "t202"; - signature = 0x1e 0x91 0x23; + desc = "ATtiny202"; + id = "t202"; + signature = 0x1e 0x91 0x23; memory "eeprom" - size = 64; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 64; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 2048; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 2048; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13168,22 +13132,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny204"; - id = "t204"; - signature = 0x1e 0x91 0x22; + desc = "ATtiny204"; + id = "t204"; + signature = 0x1e 0x91 0x22; memory "eeprom" - size = 64; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 64; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 2048; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 2048; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13192,22 +13156,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny402"; - id = "t402"; - signature = 0x1e 0x92 0x27; + desc = "ATtiny402"; + id = "t402"; + signature = 0x1e 0x92 0x27; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 4096; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13216,22 +13180,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny404"; - id = "t404"; - signature = 0x1e 0x92 0x26; + desc = "ATtiny404"; + id = "t404"; + signature = 0x1e 0x92 0x26; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 4096; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13240,22 +13204,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny406"; - id = "t406"; - signature = 0x1e 0x92 0x25; + desc = "ATtiny406"; + id = "t406"; + signature = 0x1e 0x92 0x25; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 4096; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13264,22 +13228,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny804"; - id = "t804"; - signature = 0x1e 0x93 0x25; + desc = "ATtiny804"; + id = "t804"; + signature = 0x1e 0x93 0x25; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13288,22 +13252,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny806"; - id = "t806"; - signature = 0x1e 0x93 0x24; + desc = "ATtiny806"; + id = "t806"; + signature = 0x1e 0x93 0x24; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13312,22 +13276,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny807"; - id = "t807"; - signature = 0x1e 0x93 0x23; + desc = "ATtiny807"; + id = "t807"; + signature = 0x1e 0x93 0x23; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13336,22 +13300,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny1604"; - id = "t1604"; - signature = 0x1e 0x94 0x25; + desc = "ATtiny1604"; + id = "t1604"; + signature = 0x1e 0x94 0x25; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13360,22 +13324,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny1606"; - id = "t1606"; - signature = 0x1e 0x94 0x24; + desc = "ATtiny1606"; + id = "t1606"; + signature = 0x1e 0x94 0x24; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13384,22 +13348,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny1607"; - id = "t1607"; - signature = 0x1e 0x94 0x23; + desc = "ATtiny1607"; + id = "t1607"; + signature = 0x1e 0x94 0x23; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13408,22 +13372,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny212"; - id = "t212"; - signature = 0x1e 0x91 0x21; + desc = "ATtiny212"; + id = "t212"; + signature = 0x1e 0x91 0x21; memory "eeprom" - size = 64; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 64; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 2048; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 2048; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13432,22 +13396,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny214"; - id = "t214"; - signature = 0x1e 0x91 0x20; + desc = "ATtiny214"; + id = "t214"; + signature = 0x1e 0x91 0x20; memory "eeprom" - size = 64; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 64; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 2048; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 2048; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13456,22 +13420,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny412"; - id = "t412"; - signature = 0x1e 0x92 0x23; + desc = "ATtiny412"; + id = "t412"; + signature = 0x1e 0x92 0x23; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 4096; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13480,22 +13444,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny414"; - id = "t414"; - signature = 0x1e 0x92 0x22; + desc = "ATtiny414"; + id = "t414"; + signature = 0x1e 0x92 0x22; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 4096; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13504,22 +13468,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny416"; - id = "t416"; - signature = 0x1e 0x92 0x21; + desc = "ATtiny416"; + id = "t416"; + signature = 0x1e 0x92 0x21; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 4096; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13528,22 +13492,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny417"; - id = "t417"; - signature = 0x1e 0x92 0x20; + desc = "ATtiny417"; + id = "t417"; + signature = 0x1e 0x92 0x20; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 4096; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13552,22 +13516,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny814"; - id = "t814"; - signature = 0x1e 0x93 0x22; + desc = "ATtiny814"; + id = "t814"; + signature = 0x1e 0x93 0x22; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13576,22 +13540,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny816"; - id = "t816"; - signature = 0x1e 0x93 0x21; + desc = "ATtiny816"; + id = "t816"; + signature = 0x1e 0x93 0x21; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13600,22 +13564,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny817"; - id = "t817"; - signature = 0x1e 0x93 0x20; + desc = "ATtiny817"; + id = "t817"; + signature = 0x1e 0x93 0x20; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13624,22 +13588,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny1614"; - id = "t1614"; - signature = 0x1e 0x94 0x22; + desc = "ATtiny1614"; + id = "t1614"; + signature = 0x1e 0x94 0x22; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13648,22 +13612,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny1616"; - id = "t1616"; - signature = 0x1e 0x94 0x21; + desc = "ATtiny1616"; + id = "t1616"; + signature = 0x1e 0x94 0x21; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13672,22 +13636,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny1617"; - id = "t1617"; - signature = 0x1e 0x94 0x20; + desc = "ATtiny1617"; + id = "t1617"; + signature = 0x1e 0x94 0x20; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13696,22 +13660,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny3216"; - id = "t3216"; - signature = 0x1e 0x95 0x21; + desc = "ATtiny3216"; + id = "t3216"; + signature = 0x1e 0x95 0x21; memory "eeprom" - size = 256; - page_size = 64; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 128; - offset = 0x8000; - readsize = 256; + size = 0x8000; + page_size = 128; + offset = 0x8000; + readsize = 256; ; ; @@ -13720,22 +13684,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny3217"; - id = "t3217"; - signature = 0x1e 0x95 0x22; + desc = "ATtiny3217"; + id = "t3217"; + signature = 0x1e 0x95 0x22; memory "eeprom" - size = 256; - page_size = 64; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 128; - offset = 0x8000; - readsize = 256; + size = 0x8000; + page_size = 128; + offset = 0x8000; + readsize = 256; ; ; @@ -13744,22 +13708,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny424"; - id = "t424"; - signature = 0x1e 0x92 0x2c; + desc = "ATtiny424"; + id = "t424"; + signature = 0x1e 0x92 0x2c; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 4096; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13768,22 +13732,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny426"; - id = "t426"; - signature = 0x1e 0x92 0x2b; + desc = "ATtiny426"; + id = "t426"; + signature = 0x1e 0x92 0x2b; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 4096; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13792,22 +13756,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny427"; - id = "t427"; - signature = 0x1e 0x92 0x2a; + desc = "ATtiny427"; + id = "t427"; + signature = 0x1e 0x92 0x2a; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 4096; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 4096; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13816,22 +13780,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny824"; - id = "t824"; - signature = 0x1e 0x93 0x29; + desc = "ATtiny824"; + id = "t824"; + signature = 0x1e 0x93 0x29; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13840,22 +13804,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny826"; - id = "t826"; - signature = 0x1e 0x93 0x28; + desc = "ATtiny826"; + id = "t826"; + signature = 0x1e 0x93 0x28; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13864,22 +13828,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny827"; - id = "t827"; - signature = 0x1e 0x93 0x27; + desc = "ATtiny827"; + id = "t827"; + signature = 0x1e 0x93 0x27; memory "eeprom" - size = 128; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 128; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13888,22 +13852,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny1624"; - id = "t1624"; - signature = 0x1e 0x94 0x2a; + desc = "ATtiny1624"; + id = "t1624"; + signature = 0x1e 0x94 0x2a; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13912,22 +13876,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny1626"; - id = "t1626"; - signature = 0x1e 0x94 0x29; + desc = "ATtiny1626"; + id = "t1626"; + signature = 0x1e 0x94 0x29; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13936,22 +13900,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny1627"; - id = "t1627"; - signature = 0x1e 0x94 0x28; + desc = "ATtiny1627"; + id = "t1627"; + signature = 0x1e 0x94 0x28; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x8000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x8000; + readsize = 256; ; ; @@ -13960,22 +13924,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny3224"; - id = "t3224"; - signature = 0x1e 0x95 0x28; + desc = "ATtiny3224"; + id = "t3224"; + signature = 0x1e 0x95 0x28; memory "eeprom" - size = 256; - page_size = 64; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 128; - offset = 0x8000; - readsize = 256; + size = 0x8000; + page_size = 128; + offset = 0x8000; + readsize = 256; ; ; @@ -13984,22 +13948,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny3226"; - id = "t3226"; - signature = 0x1e 0x95 0x27; + desc = "ATtiny3226"; + id = "t3226"; + signature = 0x1e 0x95 0x27; memory "eeprom" - size = 256; - page_size = 64; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 128; - offset = 0x8000; - readsize = 256; + size = 0x8000; + page_size = 128; + offset = 0x8000; + readsize = 256; ; ; @@ -14008,22 +13972,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATtiny3227"; - id = "t3227"; - signature = 0x1e 0x95 0x26; + desc = "ATtiny3227"; + id = "t3227"; + signature = 0x1e 0x95 0x26; memory "eeprom" - size = 256; - page_size = 64; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 128; - offset = 0x8000; - readsize = 256; + size = 0x8000; + page_size = 128; + offset = 0x8000; + readsize = 256; ; ; @@ -14032,22 +13996,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATmega808"; - id = "m808"; - signature = 0x1e 0x93 0x26; + desc = "ATmega808"; + id = "m808"; + signature = 0x1e 0x93 0x26; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x4000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x4000; + readsize = 256; ; ; @@ -14056,22 +14020,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATmega809"; - id = "m809"; - signature = 0x1e 0x93 0x2a; + desc = "ATmega809"; + id = "m809"; + signature = 0x1e 0x93 0x2a; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x4000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x4000; + readsize = 256; ; ; @@ -14080,22 +14044,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATmega1608"; - id = "m1608"; - signature = 0x1e 0x94 0x27; + desc = "ATmega1608"; + id = "m1608"; + signature = 0x1e 0x94 0x27; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x4000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x4000; + readsize = 256; ; ; @@ -14104,22 +14068,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_tiny" - desc = "ATmega1609"; - id = "m1609"; - signature = 0x1e 0x94 0x26; + desc = "ATmega1609"; + id = "m1609"; + signature = 0x1e 0x94 0x26; memory "eeprom" - size = 256; - page_size = 32; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 32; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x4000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x4000; + readsize = 256; ; ; @@ -14128,22 +14092,22 @@ part parent ".avr8x_tiny" #------------------------------------------------------------ part parent ".avr8x_mega" - desc = "ATmega3208"; - id = "m3208"; - signature = 0x1e 0x95 0x30; + desc = "ATmega3208"; + id = "m3208"; + signature = 0x1e 0x95 0x30; memory "eeprom" - size = 256; - page_size = 64; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 128; - offset = 0x4000; - readsize = 256; + size = 0x8000; + page_size = 128; + offset = 0x4000; + readsize = 256; ; ; @@ -14152,22 +14116,22 @@ part parent ".avr8x_mega" #------------------------------------------------------------ part parent ".avr8x_mega" - desc = "ATmega3209"; - id = "m3209"; - signature = 0x1e 0x95 0x31; + desc = "ATmega3209"; + id = "m3209"; + signature = 0x1e 0x95 0x31; memory "eeprom" - size = 256; - page_size = 64; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 128; - offset = 0x4000; - readsize = 256; + size = 0x8000; + page_size = 128; + offset = 0x4000; + readsize = 256; ; ; @@ -14176,22 +14140,22 @@ part parent ".avr8x_mega" #------------------------------------------------------------ part parent ".avr8x_mega" - desc = "ATmega4808"; - id = "m4808"; - signature = 0x1e 0x96 0x50; + desc = "ATmega4808"; + id = "m4808"; + signature = 0x1e 0x96 0x50; memory "eeprom" - size = 256; - page_size = 64; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0xc000; - page_size = 128; - offset = 0x4000; - readsize = 256; + size = 0xc000; + page_size = 128; + offset = 0x4000; + readsize = 256; ; ; @@ -14200,22 +14164,22 @@ part parent ".avr8x_mega" #------------------------------------------------------------ part parent ".avr8x_mega" - desc = "ATmega4809"; - id = "m4809"; - signature = 0x1e 0x96 0x51; + desc = "ATmega4809"; + id = "m4809"; + signature = 0x1e 0x96 0x51; memory "eeprom" - size = 256; - page_size = 64; - offset = 0x1400; - readsize = 256; + size = 256; + page_size = 64; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0xc000; - page_size = 128; - offset = 0x4000; - readsize = 256; + size = 0xc000; + page_size = 128; + offset = 0x4000; + readsize = 256; ; ; @@ -14224,18 +14188,18 @@ part parent ".avr8x_mega" #------------------------------------------------------------ part - desc = "AVR-Dx family common values"; - id = ".avrdx"; + desc = "AVR-Dx family common values"; + id = ".avrdx"; # Dedicated UPDI pin, no HV - hvupdi_variant = 1; - has_updi = yes; - nvm_base = 0x1000; - ocd_base = 0x0f80; + hvupdi_variant = 1; + has_updi = yes; + nvm_base = 0x1000; + ocd_base = 0x0f80; memory "fuse0" - size = 1; - offset = 0x1050; - readsize = 1; + size = 1; + offset = 0x1050; + readsize = 1; ; memory "wdtcfg" @@ -14243,9 +14207,9 @@ part ; memory "fuse1" - size = 1; - offset = 0x1051; - readsize = 1; + size = 1; + offset = 0x1051; + readsize = 1; ; memory "bodcfg" @@ -14253,9 +14217,9 @@ part ; memory "fuse2" - size = 1; - offset = 0x1052; - readsize = 1; + size = 1; + offset = 0x1052; + readsize = 1; ; memory "osccfg" @@ -14263,9 +14227,9 @@ part ; memory "fuse4" - size = 1; - offset = 0x1054; - readsize = 1; + size = 1; + offset = 0x1054; + readsize = 1; ; memory "tcd0cfg" @@ -14273,9 +14237,9 @@ part ; memory "fuse5" - size = 1; - offset = 0x1055; - readsize = 1; + size = 1; + offset = 0x1055; + readsize = 1; ; memory "syscfg0" @@ -14283,9 +14247,9 @@ part ; memory "fuse6" - size = 1; - offset = 0x1056; - readsize = 1; + size = 1; + offset = 0x1056; + readsize = 1; ; memory "syscfg1" @@ -14293,9 +14257,9 @@ part ; memory "fuse7" - size = 1; - offset = 0x1057; - readsize = 1; + size = 1; + offset = 0x1057; + readsize = 1; ; memory "codesize" @@ -14307,9 +14271,9 @@ part ; memory "fuse8" - size = 1; - offset = 0x1058; - readsize = 1; + size = 1; + offset = 0x1058; + readsize = 1; ; memory "bootsize" @@ -14321,48 +14285,48 @@ part ; memory "fuses" - size = 9; - page_size = 16; - offset = 0x1050; - readsize = 16; + size = 9; + page_size = 16; + offset = 0x1050; + readsize = 16; ; memory "lock" - size = 4; - offset = 0x1040; - readsize = 4; + size = 4; + offset = 0x1040; + readsize = 4; ; memory "tempsense" - size = 2; - offset = 0x1104; - readsize = 1; + size = 2; + offset = 0x1104; + readsize = 1; ; memory "signature" - size = 3; - offset = 0x1100; - readsize = 3; + size = 3; + offset = 0x1100; + readsize = 3; ; memory "prodsig" - size = 125; - page_size = 125; - offset = 0x1103; - readsize = 125; + size = 125; + page_size = 125; + offset = 0x1103; + readsize = 125; ; memory "sernum" - size = 16; - offset = 0x1110; - readsize = 1; + size = 16; + offset = 0x1110; + readsize = 1; ; memory "userrow" - size = 32; - page_size = 32; - offset = 0x1080; - readsize = 32; + size = 32; + page_size = 32; + offset = 0x1080; + readsize = 32; ; memory "usersig" @@ -14371,7 +14335,7 @@ part memory "data" # SRAM, only used to supply the offset - offset = 0x1000000; + offset = 0x1000000; ; ; @@ -14380,21 +14344,21 @@ part #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR32DA28"; - id = "avr32da28"; - signature = 0x1e 0x95 0x34; + desc = "AVR32DA28"; + id = "avr32da28"; + signature = 0x1e 0x95 0x34; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14403,21 +14367,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR32DA32"; - id = "avr32da32"; - signature = 0x1e 0x95 0x33; + desc = "AVR32DA32"; + id = "avr32da32"; + signature = 0x1e 0x95 0x33; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14426,21 +14390,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR32DA48"; - id = "avr32da48"; - signature = 0x1e 0x95 0x32; + desc = "AVR32DA48"; + id = "avr32da48"; + signature = 0x1e 0x95 0x32; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14449,21 +14413,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR64DA28"; - id = "avr64da28"; - signature = 0x1e 0x96 0x15; + desc = "AVR64DA28"; + id = "avr64da28"; + signature = 0x1e 0x96 0x15; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14472,21 +14436,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR64DA32"; - id = "avr64da32"; - signature = 0x1e 0x96 0x14; + desc = "AVR64DA32"; + id = "avr64da32"; + signature = 0x1e 0x96 0x14; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14495,21 +14459,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR64DA48"; - id = "avr64da48"; - signature = 0x1e 0x96 0x13; + desc = "AVR64DA48"; + id = "avr64da48"; + signature = 0x1e 0x96 0x13; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14518,21 +14482,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR64DA64"; - id = "avr64da64"; - signature = 0x1e 0x96 0x12; + desc = "AVR64DA64"; + id = "avr64da64"; + signature = 0x1e 0x96 0x12; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14541,21 +14505,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR128DA28"; - id = "avr128da28"; - signature = 0x1e 0x97 0x0a; + desc = "AVR128DA28"; + id = "avr128da28"; + signature = 0x1e 0x97 0x0a; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x20000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14564,21 +14528,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR128DA32"; - id = "avr128da32"; - signature = 0x1e 0x97 0x09; + desc = "AVR128DA32"; + id = "avr128da32"; + signature = 0x1e 0x97 0x09; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x20000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14587,21 +14551,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR128DA48"; - id = "avr128da48"; - signature = 0x1e 0x97 0x08; + desc = "AVR128DA48"; + id = "avr128da48"; + signature = 0x1e 0x97 0x08; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x20000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14610,21 +14574,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR128DA64"; - id = "avr128da64"; - signature = 0x1e 0x97 0x07; + desc = "AVR128DA64"; + id = "avr128da64"; + signature = 0x1e 0x97 0x07; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x20000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14633,21 +14597,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR32DB28"; - id = "avr32db28"; - signature = 0x1e 0x95 0x37; + desc = "AVR32DB28"; + id = "avr32db28"; + signature = 0x1e 0x95 0x37; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14656,21 +14620,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR32DB32"; - id = "avr32db32"; - signature = 0x1e 0x95 0x36; + desc = "AVR32DB32"; + id = "avr32db32"; + signature = 0x1e 0x95 0x36; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14679,21 +14643,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR32DB48"; - id = "avr32db48"; - signature = 0x1e 0x95 0x35; + desc = "AVR32DB48"; + id = "avr32db48"; + signature = 0x1e 0x95 0x35; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14702,21 +14666,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR64DB28"; - id = "avr64db28"; - signature = 0x1e 0x96 0x19; + desc = "AVR64DB28"; + id = "avr64db28"; + signature = 0x1e 0x96 0x19; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14725,21 +14689,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR64DB32"; - id = "avr64db32"; - signature = 0x1e 0x96 0x18; + desc = "AVR64DB32"; + id = "avr64db32"; + signature = 0x1e 0x96 0x18; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14748,21 +14712,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR64DB48"; - id = "avr64db48"; - signature = 0x1e 0x96 0x17; + desc = "AVR64DB48"; + id = "avr64db48"; + signature = 0x1e 0x96 0x17; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14771,21 +14735,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR64DB64"; - id = "avr64db64"; - signature = 0x1e 0x96 0x16; + desc = "AVR64DB64"; + id = "avr64db64"; + signature = 0x1e 0x96 0x16; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14794,21 +14758,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR128DB28"; - id = "avr128db28"; - signature = 0x1e 0x97 0x0e; + desc = "AVR128DB28"; + id = "avr128db28"; + signature = 0x1e 0x97 0x0e; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x20000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14817,21 +14781,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR128DB32"; - id = "avr128db32"; - signature = 0x1e 0x97 0x0d; + desc = "AVR128DB32"; + id = "avr128db32"; + signature = 0x1e 0x97 0x0d; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x20000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14840,21 +14804,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR128DB48"; - id = "avr128db48"; - signature = 0x1e 0x97 0x0c; + desc = "AVR128DB48"; + id = "avr128db48"; + signature = 0x1e 0x97 0x0c; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x20000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14863,21 +14827,21 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR128DB64"; - id = "avr128db64"; - signature = 0x1e 0x97 0x0b; + desc = "AVR128DB64"; + id = "avr128db64"; + signature = 0x1e 0x97 0x0b; memory "eeprom" - size = 512; - offset = 0x1400; - readsize = 256; + size = 512; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x20000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x20000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14886,22 +14850,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR16DD14"; - id = "avr16dd14"; - hvupdi_variant = 2; - signature = 0x1e 0x94 0x34; + desc = "AVR16DD14"; + id = "avr16dd14"; + hvupdi_variant = 2; + signature = 0x1e 0x94 0x34; memory "eeprom" - size = 256; - offset = 0x1400; - readsize = 256; + size = 256; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x4000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14910,22 +14874,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR16DD20"; - id = "avr16dd20"; - hvupdi_variant = 2; - signature = 0x1e 0x94 0x33; + desc = "AVR16DD20"; + id = "avr16dd20"; + hvupdi_variant = 2; + signature = 0x1e 0x94 0x33; memory "eeprom" - size = 256; - offset = 0x1400; - readsize = 256; + size = 256; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x4000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14934,22 +14898,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR16DD28"; - id = "avr16dd28"; - hvupdi_variant = 2; - signature = 0x1e 0x94 0x32; + desc = "AVR16DD28"; + id = "avr16dd28"; + hvupdi_variant = 2; + signature = 0x1e 0x94 0x32; memory "eeprom" - size = 256; - offset = 0x1400; - readsize = 256; + size = 256; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x4000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14958,22 +14922,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR16DD32"; - id = "avr16dd32"; - hvupdi_variant = 2; - signature = 0x1e 0x94 0x31; + desc = "AVR16DD32"; + id = "avr16dd32"; + hvupdi_variant = 2; + signature = 0x1e 0x94 0x31; memory "eeprom" - size = 256; - offset = 0x1400; - readsize = 256; + size = 256; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x4000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -14982,22 +14946,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR32DD14"; - id = "avr32dd14"; - hvupdi_variant = 2; - signature = 0x1e 0x95 0x3b; + desc = "AVR32DD14"; + id = "avr32dd14"; + hvupdi_variant = 2; + signature = 0x1e 0x95 0x3b; memory "eeprom" - size = 256; - offset = 0x1400; - readsize = 256; + size = 256; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -15006,22 +14970,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR32DD20"; - id = "avr32dd20"; - hvupdi_variant = 2; - signature = 0x1e 0x95 0x3a; + desc = "AVR32DD20"; + id = "avr32dd20"; + hvupdi_variant = 2; + signature = 0x1e 0x95 0x3a; memory "eeprom" - size = 256; - offset = 0x1400; - readsize = 256; + size = 256; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -15030,22 +14994,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR32DD28"; - id = "avr32dd28"; - hvupdi_variant = 2; - signature = 0x1e 0x95 0x39; + desc = "AVR32DD28"; + id = "avr32dd28"; + hvupdi_variant = 2; + signature = 0x1e 0x95 0x39; memory "eeprom" - size = 256; - offset = 0x1400; - readsize = 256; + size = 256; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -15054,22 +15018,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR32DD32"; - id = "avr32dd32"; - hvupdi_variant = 2; - signature = 0x1e 0x95 0x38; + desc = "AVR32DD32"; + id = "avr32dd32"; + hvupdi_variant = 2; + signature = 0x1e 0x95 0x38; memory "eeprom" - size = 256; - offset = 0x1400; - readsize = 256; + size = 256; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -15078,22 +15042,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR64DD14"; - id = "avr64dd14"; - hvupdi_variant = 2; - signature = 0x1e 0x96 0x1d; + desc = "AVR64DD14"; + id = "avr64dd14"; + hvupdi_variant = 2; + signature = 0x1e 0x96 0x1d; memory "eeprom" - size = 256; - offset = 0x1400; - readsize = 256; + size = 256; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -15102,22 +15066,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR64DD20"; - id = "avr64dd20"; - hvupdi_variant = 2; - signature = 0x1e 0x96 0x1c; + desc = "AVR64DD20"; + id = "avr64dd20"; + hvupdi_variant = 2; + signature = 0x1e 0x96 0x1c; memory "eeprom" - size = 256; - offset = 0x1400; - readsize = 256; + size = 256; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -15126,22 +15090,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR64DD28"; - id = "avr64dd28"; - hvupdi_variant = 2; - signature = 0x1e 0x96 0x1b; + desc = "AVR64DD28"; + id = "avr64dd28"; + hvupdi_variant = 2; + signature = 0x1e 0x96 0x1b; memory "eeprom" - size = 256; - offset = 0x1400; - readsize = 256; + size = 256; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -15150,22 +15114,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR64DD32"; - id = "avr64dd32"; - hvupdi_variant = 2; - signature = 0x1e 0x96 0x1a; + desc = "AVR64DD32"; + id = "avr64dd32"; + hvupdi_variant = 2; + signature = 0x1e 0x96 0x1a; memory "eeprom" - size = 256; - offset = 0x1400; - readsize = 256; + size = 256; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 512; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 512; + offset = 0x800000; + readsize = 256; ; ; @@ -15174,15 +15138,15 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrdx" - desc = "AVR-Ex family common values"; - id = ".avrex"; + desc = "AVR-Ex family common values"; + id = ".avrex"; # Shared UPDI pin, HV on _RESET - hvupdi_variant = 2; + hvupdi_variant = 2; memory "userrow" - size = 64; - page_size = 64; - readsize = 64; + size = 64; + page_size = 64; + readsize = 64; ; memory "usersig" @@ -15195,22 +15159,22 @@ part parent ".avrdx" #------------------------------------------------------------ part parent ".avrex" - desc = "AVR8EA28"; - id = "avr8ea28"; - signature = 0x1e 0x93 0x2c; + desc = "AVR8EA28"; + id = "avr8ea28"; + signature = 0x1e 0x93 0x2c; memory "eeprom" - size = 512; - page_size = 8; - offset = 0x1400; - readsize = 256; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x800000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -15219,22 +15183,22 @@ part parent ".avrex" #------------------------------------------------------------ part parent ".avrex" - desc = "AVR8EA32"; - id = "avr8ea32"; - signature = 0x1e 0x93 0x2b; + desc = "AVR8EA32"; + id = "avr8ea32"; + signature = 0x1e 0x93 0x2b; memory "eeprom" - size = 512; - page_size = 8; - offset = 0x1400; - readsize = 256; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 8192; - page_size = 64; - offset = 0x800000; - readsize = 256; + size = 8192; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -15243,22 +15207,22 @@ part parent ".avrex" #------------------------------------------------------------ part parent ".avrex" - desc = "AVR16EA28"; - id = "avr16ea28"; - signature = 0x1e 0x94 0x37; + desc = "AVR16EA28"; + id = "avr16ea28"; + signature = 0x1e 0x94 0x37; memory "eeprom" - size = 512; - page_size = 8; - offset = 0x1400; - readsize = 256; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x800000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -15267,22 +15231,22 @@ part parent ".avrex" #------------------------------------------------------------ part parent ".avrex" - desc = "AVR16EA32"; - id = "avr16ea32"; - signature = 0x1e 0x94 0x36; + desc = "AVR16EA32"; + id = "avr16ea32"; + signature = 0x1e 0x94 0x36; memory "eeprom" - size = 512; - page_size = 8; - offset = 0x1400; - readsize = 256; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x800000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -15291,22 +15255,22 @@ part parent ".avrex" #------------------------------------------------------------ part parent ".avrex" - desc = "AVR16EA48"; - id = "avr16ea48"; - signature = 0x1e 0x94 0x35; + desc = "AVR16EA48"; + id = "avr16ea48"; + signature = 0x1e 0x94 0x35; memory "eeprom" - size = 512; - page_size = 8; - offset = 0x1400; - readsize = 256; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x4000; - page_size = 64; - offset = 0x800000; - readsize = 256; + size = 0x4000; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -15315,22 +15279,22 @@ part parent ".avrex" #------------------------------------------------------------ part parent ".avrex" - desc = "AVR32EA28"; - id = "avr32ea28"; - signature = 0x1e 0x95 0x3e; + desc = "AVR32EA28"; + id = "avr32ea28"; + signature = 0x1e 0x95 0x3e; memory "eeprom" - size = 512; - page_size = 8; - offset = 0x1400; - readsize = 256; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 64; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -15339,22 +15303,22 @@ part parent ".avrex" #------------------------------------------------------------ part parent ".avrex" - desc = "AVR32EA32"; - id = "avr32ea32"; - signature = 0x1e 0x95 0x3d; + desc = "AVR32EA32"; + id = "avr32ea32"; + signature = 0x1e 0x95 0x3d; memory "eeprom" - size = 512; - page_size = 8; - offset = 0x1400; - readsize = 256; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 64; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -15363,22 +15327,22 @@ part parent ".avrex" #------------------------------------------------------------ part parent ".avrex" - desc = "AVR32EA48"; - id = "avr32ea48"; - signature = 0x1e 0x95 0x3c; + desc = "AVR32EA48"; + id = "avr32ea48"; + signature = 0x1e 0x95 0x3c; memory "eeprom" - size = 512; - page_size = 8; - offset = 0x1400; - readsize = 256; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x8000; - page_size = 64; - offset = 0x800000; - readsize = 256; + size = 0x8000; + page_size = 64; + offset = 0x800000; + readsize = 256; ; ; @@ -15387,22 +15351,22 @@ part parent ".avrex" #------------------------------------------------------------ part parent ".avrex" - desc = "AVR64EA28"; - id = "avr64ea28"; - signature = 0x1e 0x96 0x20; + desc = "AVR64EA28"; + id = "avr64ea28"; + signature = 0x1e 0x96 0x20; memory "eeprom" - size = 512; - page_size = 8; - offset = 0x1400; - readsize = 256; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 128; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 128; + offset = 0x800000; + readsize = 256; ; ; @@ -15411,22 +15375,22 @@ part parent ".avrex" #------------------------------------------------------------ part parent ".avrex" - desc = "AVR64EA32"; - id = "avr64ea32"; - signature = 0x1e 0x96 0x1f; + desc = "AVR64EA32"; + id = "avr64ea32"; + signature = 0x1e 0x96 0x1f; memory "eeprom" - size = 512; - page_size = 8; - offset = 0x1400; - readsize = 256; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 128; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 128; + offset = 0x800000; + readsize = 256; ; ; @@ -15435,22 +15399,22 @@ part parent ".avrex" #------------------------------------------------------------ part parent ".avrex" - desc = "AVR64EA48"; - id = "avr64ea48"; - signature = 0x1e 0x96 0x1e; + desc = "AVR64EA48"; + id = "avr64ea48"; + signature = 0x1e 0x96 0x1e; memory "eeprom" - size = 512; - page_size = 8; - offset = 0x1400; - readsize = 256; + size = 512; + page_size = 8; + offset = 0x1400; + readsize = 256; ; memory "flash" - size = 0x10000; - page_size = 128; - offset = 0x800000; - readsize = 256; + size = 0x10000; + page_size = 128; + offset = 0x800000; + readsize = 256; ; ; @@ -15459,9 +15423,9 @@ part parent ".avrex" #------------------------------------------------------------ part parent "m88" - desc = "LGT8F88P"; - id = "lgt8f88p"; - signature = 0x1e 0x93 0x0f; + desc = "LGT8F88P"; + id = "lgt8f88p"; + signature = 0x1e 0x93 0x0f; ; #------------------------------------------------------------ @@ -15469,9 +15433,9 @@ part parent "m88" #------------------------------------------------------------ part parent "m168" - desc = "LGT8F168P"; - id = "lgt8f168p"; - signature = 0x1e 0x94 0x0b; + desc = "LGT8F168P"; + id = "lgt8f168p"; + signature = 0x1e 0x94 0x0b; ; #------------------------------------------------------------ @@ -15479,7 +15443,7 @@ part parent "m168" #------------------------------------------------------------ part parent "m328" - desc = "LGT8F328P"; - id = "lgt8f328p"; - signature = 0x1e 0x95 0x0f; + desc = "LGT8F328P"; + id = "lgt8f328p"; + signature = 0x1e 0x95 0x0f; ; diff --git a/src/developer_opts.c b/src/developer_opts.c index 872d48c1..c8aa903c 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -331,7 +331,7 @@ static int dev_part_strct_entry(bool tsv, // Print as spreadsheet? } else { // Grammar conform int indent = col2 && strcmp(col2, "part"); dev_cout(comms, n, 0, 0); // Print comments before the line - dev_info("%*s%-*s = %s;", indent? 8: 4, "", indent? 15: 19, n, c); + dev_info("%*s%-*s = %s;", indent? 8: 4, "", indent? 18: 22, n, c); dev_cout(comms, n, 1, 1); // Print comments on rhs } @@ -361,7 +361,7 @@ static void dev_stack_out(bool tsv, const AVRPART *p, const char *name, const un dev_info(".pt\t%s\t%s\t", p->desc, name); else { dev_cout(p->comments, name, 0, 0); - dev_info(" %-19s =%s", name, ns <=8? " ": ""); + dev_info(" %-22s =%s", name, ns <=8? " ": ""); } if(ns <= 0) @@ -1169,7 +1169,7 @@ static void dev_pgm_strct(const PROGRAMMER *pgm, bool tsv, const PROGRAMMER *bas dev_info(".prog\t%s\tid\t", id); else { dev_cout(pgm->comments, "id", 0, 0); - dev_info(" %-19s = ", "id"); + dev_info(" %-22s = ", "id"); } for(firstid=1, ln=lfirst(pgm->id); ln; ln=lnext(ln)) { if(!firstid) @@ -1200,7 +1200,7 @@ static void dev_pgm_strct(const PROGRAMMER *pgm, bool tsv, const PROGRAMMER *bas dev_info(".prog\t%s\tusbpid\t", id); else { dev_cout(pgm->comments, "usbpid", 0, 0); - dev_info(" %-19s = ", "usbpid"); + dev_info(" %-22s = ", "usbpid"); } for(firstid=1, ln=lfirst(pgm->usbpid); ln; ln=lnext(ln)) { if(!firstid) @@ -1237,7 +1237,7 @@ static void dev_pgm_strct(const PROGRAMMER *pgm, bool tsv, const PROGRAMMER *bas dev_info(".prog\t%s\thvupdu_support\t", id); else { dev_cout(pgm->comments, "hvupdi_support", 0, 0); - dev_info(" %-19s = ", "hvupdi_support"); + dev_info(" %-22s = ", "hvupdi_support"); } for(firstid=1, ln=lfirst(pgm->hvupdi_support); ln; ln=lnext(ln)) { if(!firstid) From ed2b8342df46c1bbd3919fe3734cdde234d2d132 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 30 Aug 2022 02:08:15 +0100 Subject: [PATCH 220/511] Prepare for new components in avrdude.conf incl prog_modes - Add prog_modes to part and programmer definitions; prog_mode is a bitwise or of programming modes + PM_SPM: Bootloaders, self-programming with SPM/NVM Controllers + PM_TPI: t4, t5, t9, t10, t20, t40, t102, t104 + PM_ISP: SPI programming for In-System Programming (typ classic parts) + PM_PDI: Program and Debug Interface (xmega parts) + PM_UPDI: Unified Program and Debug Interface + PM_HVSP: High Voltage Serial Programming (some classic parts) + PM_HVPP: High Voltage Parallel Programming (most non-HVSP classic parts) + PM_debugWIRE: Simpler alternative to JTAG (a subset of HVPP/HVSP parts) + PM_JTAG: some classic parts, some xmega + PM_aWire: AVR32 parts - Add mcuid, a unique id in 0..2039, to part definition for urclock programmer - Add n_interrupts, the number of interrupts, to part definition - Add n_page_erase to part definition (# of pages erased during NVM erase) - Implement a simple calculator in config_gram.y so numeric values can be expressed as simple expressions such as PM_SPM | PM_UPDI - Introduce a new method of assigning simple components to the grammar without touching config_gram.y via an eligible-component list in config.c; numeric expressions on the rhs of an assignment resolve to integer values - Update documentation in avrdude.conf.in and avrdude.texi --- src/avrdude.conf.in | 60 +++++++++----- src/config.c | 154 ++++++++++++++++++++++++++++++++++-- src/config.h | 59 ++++++++++++-- src/config_gram.y | 112 +++++++++++++++++++------- src/developer_opts.c | 39 +++++++++- src/doc/avrdude.texi | 181 +++++++++++++++++++++++++++---------------- src/lexer.l | 39 ++++++++-- src/libavrdude.h | 40 +++++++++- 8 files changed, 542 insertions(+), 142 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 5a68cff5..e2a330ff 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -21,39 +21,56 @@ # id = [, [, ] ...] ; # are quoted strings # desc = ; # quoted string # type = ; # programmer type, quoted string -# # supported programmer types can be listed by "-c ?type" +# # supported types can be listed by "-c ?type" +# prog_modes = PM_ {| PM_} # interfaces, eg, PM_SPM|PM_PDI (1) # connection_type = parallel | serial | usb | spi # baudrate = ; # baudrate for avr910-programmer -# vcc = [, ... ] ; # pin number(s) -# buff = [, ... ] ; # pin number(s) -# reset = ; # pin number -# sck = ; # pin number -# mosi = ; # pin number -# miso = ; # pin number -# errled = ; # pin number -# rdyled = ; # pin number -# pgmled = ; # pin number -# vfyled = ; # pin number +# vcc = [, ... ] ; # pin number(s) +# buff = [, ... ] ; # pin number(s) +# reset = ; # pin number +# sck = ; # pin number +# mosi = ; # pin number +# miso = ; # pin number +# errled = ; # pin number +# rdyled = ; # pin number +# pgmled = ; # pin number +# vfyled = ; # pin number # usbvid = ; # USB VID (Vendor ID) -# usbpid = [, ...] ; # USB PID (Product ID) (1) +# usbpid = [, ...] ; # USB PID (Product ID) (2) # usbdev = ; # USB interface or other device info # usbvendor = ; # USB Vendor Name # usbproduct = ; # USB Product Name # usbsn = ; # USB Serial Number # hvupdi_support = [, , ... ] ; # UPDI HV Variants Support -# -# To invert a bit, use = ~ , the spaces are important. -# For a pin list all pins must be inverted. -# A single pin can be specified as usual = ~ , for lists -# specify it as follows = ~ ( [, ... ] ) . -# -# (1) Not all programmer types can process a list of PIDs. # ; # +# # To invert a bit, use = ~ , the spaces are important. +# # For a pin list all pins must be inverted. +# # A single pin can be specified as usual = ~ , for lists +# # specify it as follows = ~ ( [, ... ] ). +# # +# # (1) The following program modes are known: +# # - PM_SPM: Bootloaders, self-programming with SPM opcodes or NVM Controllers +# # - PM_TPI: Tiny Programming Interface (t4, t5, t9, t10, t20, t40, t102, t104) +# # - PM_ISP: SPI programming for In-System Programming (almost all classic parts) +# # - PM_PDI: Program and Debug Interface (xmega parts) +# # - PM_UPDI: Unified Program and Debug Interface +# # - PM_HVSP: High Voltage Serial Programming (some classic parts) +# # - PM_HVPP: High Voltage Parallel Programming (most non-HVSP classic parts) +# # - PM_debugWIRE: Simpler alternative to JTAG (a subset of HVPP/HVSP parts) +# # - PM_JTAG: Joint Test Action Group standard (some classic parts, some xmega) +# # - PM_aWire: AVR32 parts +# # +# # (2) Not all programmer types can process a list of PIDs +# # part # desc = ; # quoted string # id = ; # quoted string # family_id = ; # quoted string, eg, "megaAVR" or "tinyAVR" +# prog_modes = PM_ {| PM_} # interfaces, eg, PM_SPM|PM_ISP|PM_HVPP|PM_debugWIRE +# mcuid = ; # unique id in 0..2039 for urclock programmer +# n_interrupts = ; # number of interrupts, used for vector bootloaders +# n_page_erase = ; # if set, number of pages erased during NVM erase # hvupdi_variant = ; # numeric -1 (n/a) or 0..2 # devicecode = ; # deprecated, use stk500_devcode # stk500_devcode = ; # numeric @@ -63,8 +80,9 @@ # has_pdi = ; # part has PDI i/f # has_updi = ; # part has UPDI i/f # has_tpi = ; # part has TPI i/f -# is_at90s1200 = ; # AT90S1200 part # is_avr32 = ; # AVR32 part +# +# is_at90s1200 = ; # AT90S1200 part # signature = ; # signature bytes # usbpid = ; # DFU USB PID # chip_erase_delay = ; # micro-seconds @@ -247,7 +265,7 @@ # section avr061.zip which accompanies the application note # AVR061 available from: # -# http://www.atmel.com/dyn/resources/prod_documents/doc2525.pdf +# https://ww1.microchip.com/downloads/en/Appnotes/doc2525.pdf # #define ATTINY10 0x10 /* the _old_ one that never existed! */ diff --git a/src/config.c b/src/config.c index d36e0814..531dac83 100644 --- a/src/config.c +++ b/src/config.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -44,6 +45,7 @@ LISTID number_list; PROGRAMMER * current_prog; AVRPART * current_part; AVRMEM * current_mem; +int current_strct; LISTID part_list; LISTID programmers; bool is_alias; @@ -53,6 +55,22 @@ char * cfg_infile; extern char * yytext; +#define pgm_comp_desc(x, type) { #x, COMP_PROGRAMMER, offsetof(PROGRAMMER, x), sizeof(((PROGRAMMER *) NULL)->x), type } +#define part_comp_desc(x, type) { #x, COMP_AVRPART, offsetof(AVRPART, x), sizeof(((AVRPART *) NULL)->x), type } +#define mem_comp_desc(x, type) { #x, COMP_AVRMEM, offsetof(AVRMEM, x), sizeof(((AVRMEM *) NULL)->x), type } + +// Component description for config_gram.y, will be sorted appropriately on first use +Component_t avr_comp[] = { + // PROGRAMMER + pgm_comp_desc(prog_modes, COMP_INT), + + // AVRPART + part_comp_desc(prog_modes, COMP_INT), + part_comp_desc(mcuid, COMP_INT), + part_comp_desc(n_interrupts, COMP_INT), + part_comp_desc(n_page_erase, COMP_INT), +}; + #define DEBUG 0 void cleanup_config(void) @@ -190,7 +208,7 @@ void free_tokens(int n, ...) -TOKEN *number(const char *text) { +TOKEN *new_number(const char *text) { struct token_t *tkn = new_token(TKN_NUMBER); tkn->value.type = V_NUM; tkn->value.number = atoi(text); @@ -202,7 +220,7 @@ TOKEN *number(const char *text) { return tkn; } -TOKEN *number_real(const char *text) { +TOKEN *new_number_real(const char *text) { struct token_t * tkn = new_token(TKN_NUMBER); tkn->value.type = V_NUM_REAL; tkn->value.number_real = atof(text); @@ -214,7 +232,7 @@ TOKEN *number_real(const char *text) { return tkn; } -TOKEN *hexnumber(const char *text) { +TOKEN *new_hexnumber(const char *text) { struct token_t *tkn = new_token(TKN_NUMBER); char * e; @@ -233,11 +251,41 @@ TOKEN *hexnumber(const char *text) { return tkn; } +TOKEN *new_constant(const char *con) { + struct token_t *tkn = new_token(TKN_NUMBER); + int assigned = 1; -TOKEN *string(const char *text) { + tkn->value.type = V_NUM; + tkn->value.number = + !strcmp("PM_SPM", con)? PM_SPM: + !strcmp("PM_TPI", con)? PM_TPI: + !strcmp("PM_ISP", con)? PM_ISP: + !strcmp("PM_PDI", con)? PM_PDI: + !strcmp("PM_UPDI", con)? PM_UPDI: + !strcmp("PM_HVSP", con)? PM_HVSP: + !strcmp("PM_HVPP", con)? PM_HVPP: + !strcmp("PM_debugWIRE", con)? PM_debugWIRE: + !strcmp("PM_JTAG", con)? PM_JTAG: + !strcmp("PM_aWire", con)? PM_aWire: + (assigned = 0); + + if(!assigned) { + yyerror("can't identify constant %s", con); + free_token(tkn); + return NULL; + } + +#if DEBUG + avrdude_message(MSG_INFO, "CONSTANT(%s=%d)\n", con, tkn->value.number); +#endif + + return tkn; +} + +TOKEN *new_string(const char *text) { struct token_t *tkn = new_token(TKN_STRING); tkn->value.type = V_STR; - tkn->value.string = cfg_strdup("string()", text); + tkn->value.string = cfg_strdup("new_string()", text); #if DEBUG avrdude_message(MSG_INFO, "STRING(%s)\n", tkn->value.string); @@ -247,7 +295,7 @@ TOKEN *string(const char *text) { } -TOKEN * keyword(int primary) { +TOKEN *new_keyword(int primary) { return new_token(primary); } @@ -692,3 +740,97 @@ char *cfg_escape(const char *s) { return cfg_strdup("cfg_escape()", buf); } + + +static int cmp_comp(const void *v1, const void *v2) { + const Component_t *c1 = v1, *c2 = v2; + int ret = strcmp(c1->name, c2->name); + + return ret? ret: c1->strct - c2->strct; +} + +Component_t *cfg_comp_search(const char *name, int strct) { + static int init; + Component_t key; + + if(!init++) + qsort(avr_comp, sizeof avr_comp/sizeof*avr_comp, sizeof(Component_t), cmp_comp); + + + key.name = name; + key.strct = strct; + return bsearch(&key, avr_comp, sizeof avr_comp/sizeof*avr_comp, sizeof(Component_t), cmp_comp); +} + + +const char *cfg_strct_name(int strct) { + switch(strct) { + case COMP_CONFIG_MAIN: return "avrdude.conf main"; + case COMP_AVRPART: return "AVRPART"; + case COMP_AVRMEM: return "AVRMEM"; + case COMP_PROGRAMMER: return "PROGRAMMER"; + } + return "unknown struct"; +} + +const char *cfg_v_type(int type) { + switch(type) { + case V_NONE: return "void"; + case V_NUM: return "number"; + case V_NUM_REAL: return "real"; + case V_STR: return "string"; + case V_COMPONENT: return "component"; + } + return "unknown v type"; +} + +const char *cfg_comp_type(int type) { + switch(type) { + case COMP_INT: return "number"; + case COMP_SHORT: return "short"; + case COMP_CHAR: return "char"; + case COMP_STRING: return "string"; + case COMP_CHAR_ARRAY: return "byte array"; + case COMP_INT_LISTID: return "number list"; + case COMP_STRING_LISTID: return "string list"; + case COMP_OPCODE: return "opcode"; + case COMP_PIN: return "pin"; + case COMP_PIN_LIST: return "pin list"; + } + return "unknown comp type"; +} + + +// Used by config_gram.y to assign a component in one of the relevant structures with a value +void cfg_assign(char *sp, int strct, Component_t *cp, VALUE *v) { + const char *str; + int num; + + switch(cp->type) { + case COMP_CHAR: + case COMP_SHORT: + case COMP_INT: + if(v->type != V_NUM) { + yywarning("%s in %s expects a %s but is assigned a %s", + cp->name, cfg_strct_name(strct), cfg_comp_type(cp->type), cfg_v_type(v->type)); + return; + } + // TODO: consider endianess (code currently assumes little endian) + num = v->number; + memcpy(sp+cp->offset, &num, cp->size); + break; + case COMP_STRING: + if(v->type != V_STR) { + yywarning("%s in %s expects a string but is assigned a %s", + cp->name, cfg_strct_name(strct), cfg_v_type(v->type)); + return; + } + str = cache_string(v->string); + memcpy(sp+cp->offset, &str, cp->size); + break; + // TODO: implement COMP_CHAR_ARRAY, COMP_INT_LISTID, COMP_STRING_LISTID, ... + default: + yywarning("%s in %s expects a %s but that is not implemented", + cp->name, cfg_strct_name(strct), cfg_comp_type(cp->type)); + } +} diff --git a/src/config.h b/src/config.h index b8bd2031..42b6219b 100644 --- a/src/config.h +++ b/src/config.h @@ -37,13 +37,48 @@ typedef struct { } COMMENT; -enum { V_NONE, V_NUM, V_NUM_REAL, V_STR }; +enum { // Which structures a component can occur in + COMP_CONFIG_MAIN, + COMP_PROGRAMMER, + COMP_AVRPART, + COMP_AVRMEM, +}; + +enum { // Component types in structure + COMP_INT, + COMP_SHORT, + COMP_CHAR, + COMP_STRING, + COMP_CHAR_ARRAY, // This and below are not yet implemented + COMP_INT_LISTID, + COMP_STRING_LISTID, + COMP_OPCODE, + COMP_PIN, // Pins may never be implemented + COMP_PIN_LIST +}; + +typedef struct { // Description of a component in a structure + const char *name; // Component name + int strct; // Structure, eg, COMP_AVRPART + int offset, size, type; // Location, size and type within structure +} Component_t; + + +enum { // Value types for VALUE struct + V_NONE, + V_NUM, + V_NUM_REAL, + V_STR, + V_COMPONENT, +}; + typedef struct value_t { int type; union { int number; double number_real; char * string; + Component_t *comp; }; } VALUE; @@ -59,6 +94,7 @@ extern FILE * yyin; extern PROGRAMMER * current_prog; extern AVRPART * current_part; extern AVRMEM * current_mem; +int current_strct; extern int cfg_lineno; extern char * cfg_infile; extern LISTID string_list; @@ -87,15 +123,17 @@ void free_token(TOKEN *tkn); void free_tokens(int n, ...); -TOKEN *number(const char *text); +TOKEN *new_number(const char *text); -TOKEN *number_real(const char *text); +TOKEN *new_number_real(const char *text); -TOKEN *hexnumber(const char *text); +TOKEN *new_hexnumber(const char *text); -TOKEN *string(const char *text); +TOKEN *new_constant(const char *text); -TOKEN *keyword(int primary); +TOKEN *new_string(const char *text); + +TOKEN *new_keyword(int primary); void print_token(TOKEN *tkn); @@ -115,6 +153,15 @@ LISTID cfg_move_comments(void); void cfg_pop_comms(void); +Component_t *cfg_comp_search(const char *name, int strct); + +const char *cfg_v_type(int type); + +const char *cfg_strct_name(int strct); + +void cfg_assign(char *sp, int strct, Component_t *cp, VALUE *v); + + #ifdef __cplusplus } #endif diff --git a/src/config_gram.y b/src/config_gram.y index dfdf50b5..bc48d098 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -208,12 +208,19 @@ static int pin_name; %token TKN_COMMA %token TKN_EQUAL %token TKN_SEMI -%token TKN_TILDE %token TKN_LEFT_PAREN %token TKN_RIGHT_PAREN %token TKN_NUMBER %token TKN_NUMBER_REAL %token TKN_STRING +%token TKN_COMPONENT + +%left OP_OR /* calculator operations */ +%left OP_XOR +%left OP_AND +%left OP_PLUS OP_MINUS +%left OP_TIMES OP_DIVIDE OP_MODULO +%right OP_TILDE UNARY %start configuration @@ -229,6 +236,27 @@ number_real : TKN_NUMBER_REAL { $$ = $1; } +; + + +expr: numexpr | TKN_STRING; + +numexpr: + TKN_NUMBER | + numexpr OP_OR numexpr { $$ = $1; $$->value.number |= $3->value.number; } | + numexpr OP_XOR numexpr { $$ = $1; $$->value.number ^= $3->value.number; } | + numexpr OP_AND numexpr { $$ = $1; $$->value.number &= $3->value.number; } | + numexpr OP_PLUS numexpr { $$ = $1; $$->value.number += $3->value.number; } | + numexpr OP_MINUS numexpr { $$ = $1; $$->value.number -= $3->value.number; } | + numexpr OP_TIMES numexpr { $$ = $1; $$->value.number *= $3->value.number; } | + numexpr OP_DIVIDE numexpr { $$ = $1; $$->value.number /= $3->value.number; } | + numexpr OP_MODULO numexpr { $$ = $1; $$->value.number %= $3->value.number; } | + OP_PLUS numexpr %prec UNARY { $$ = $2; } | + OP_MINUS numexpr %prec UNARY { $$ = $2; $$->value.number = -$$->value.number; } | + OP_TILDE numexpr %prec UNARY { $$ = $2; $$->value.number = ~$$->value.number; } | + TKN_LEFT_PAREN numexpr TKN_RIGHT_PAREN { $$ = $2; } +; + configuration : /* empty */ | config @@ -302,6 +330,7 @@ prog_def : // pgm_fill_old_pins(current_prog); // TODO to be removed if old pin data no longer needed // pgm_display_generic(current_prog, id); current_prog = NULL; + current_strct = COMP_CONFIG_MAIN; } ; @@ -309,6 +338,7 @@ prog_def : prog_decl : K_PROGRAMMER { current_prog = pgm_new(); + current_strct = COMP_PROGRAMMER; current_prog->config_file = cache_string(cfg_infile); current_prog->lineno = cfg_lineno; } @@ -322,6 +352,7 @@ prog_decl : YYABORT; } current_prog = pgm_dup(pgm); + current_strct = COMP_PROGRAMMER; current_prog->parent_id = cache_string($3->value.string); current_prog->comments = NULL; current_prog->config_file = cache_string(cfg_infile); @@ -389,6 +420,7 @@ part_def : current_part->comments = cfg_move_comments(); LISTADD(part_list, current_part); current_part = NULL; + current_strct = COMP_CONFIG_MAIN; } ; @@ -396,6 +428,7 @@ part_decl : K_PART { current_part = avr_new_part(); + current_strct = COMP_AVRPART; current_part->config_file = cache_string(cfg_infile); current_part->lineno = cfg_lineno; } | @@ -409,6 +442,7 @@ part_decl : } current_part = avr_dup_part(parent_part); + current_strct = COMP_AVRPART; current_part->parent_id = cache_string($3->value.string); current_part->comments = NULL; current_part->config_file = cache_string(cfg_infile); @@ -435,6 +469,10 @@ prog_parms : ; prog_parm : + TKN_COMPONENT TKN_EQUAL expr { + cfg_assign((char *) current_prog, COMP_PROGRAMMER, $1->value.comp, &$3->value); + free_token($1); + } | K_ID TKN_EQUAL string_list { { while (lsize(string_list)) { @@ -589,7 +627,7 @@ hvupdi_support_list: pin_number_non_empty: TKN_NUMBER { if(0 != assign_pin(pin_name, $1, 0)) YYABORT; } | - TKN_TILDE TKN_NUMBER { if(0 != assign_pin(pin_name, $2, 1)) YYABORT; } + OP_TILDE TKN_NUMBER { if(0 != assign_pin(pin_name, $2, 1)) YYABORT; } ; pin_number: @@ -601,7 +639,7 @@ pin_number: pin_list_element: pin_number_non_empty | - TKN_TILDE TKN_LEFT_PAREN num_list TKN_RIGHT_PAREN { if(0 != assign_pin_list(1)) YYABORT; } + OP_TILDE TKN_LEFT_PAREN num_list TKN_RIGHT_PAREN { if(0 != assign_pin_list(1)) YYABORT; } ; pin_list_non_empty: @@ -665,6 +703,10 @@ retry_lines : ; part_parm : + TKN_COMPONENT TKN_EQUAL expr { + cfg_assign((char *) current_part, COMP_AVRPART, $1->value.comp, &$3->value); + free_token($1); + } | K_ID TKN_EQUAL TKN_STRING { current_part->id = cache_string($3->value.string); @@ -1075,51 +1117,61 @@ part_parm : K_HAS_JTAG TKN_EQUAL yesno { - if ($3->primary == K_YES) + if ($3->primary == K_YES) { current_part->flags |= AVRPART_HAS_JTAG; - else if ($3->primary == K_NO) + current_part->prog_modes |= PM_JTAG; + } else if ($3->primary == K_NO) { current_part->flags &= ~AVRPART_HAS_JTAG; - + current_part->prog_modes &= ~PM_JTAG; + } free_token($3); } | K_HAS_DW TKN_EQUAL yesno { - if ($3->primary == K_YES) + if ($3->primary == K_YES) { current_part->flags |= AVRPART_HAS_DW; - else if ($3->primary == K_NO) + current_part->prog_modes |= PM_debugWIRE; + } else if ($3->primary == K_NO) { current_part->flags &= ~AVRPART_HAS_DW; - + current_part->prog_modes &= ~PM_debugWIRE; + } free_token($3); } | K_HAS_PDI TKN_EQUAL yesno { - if ($3->primary == K_YES) + if ($3->primary == K_YES) { current_part->flags |= AVRPART_HAS_PDI; - else if ($3->primary == K_NO) + current_part->prog_modes |= PM_PDI; + } else if ($3->primary == K_NO) { current_part->flags &= ~AVRPART_HAS_PDI; - + current_part->prog_modes &= ~PM_PDI; + } free_token($3); } | K_HAS_UPDI TKN_EQUAL yesno { - if ($3->primary == K_YES) + if ($3->primary == K_YES) { current_part->flags |= AVRPART_HAS_UPDI; - else if ($3->primary == K_NO) + current_part->prog_modes |= PM_UPDI; + } else if ($3->primary == K_NO) { current_part->flags &= ~AVRPART_HAS_UPDI; - + current_part->prog_modes &= ~PM_UPDI; + } free_token($3); } | K_HAS_TPI TKN_EQUAL yesno { - if ($3->primary == K_YES) + if ($3->primary == K_YES) { current_part->flags |= AVRPART_HAS_TPI; - else if ($3->primary == K_NO) + current_part->prog_modes |= PM_TPI; + } else if ($3->primary == K_NO) { current_part->flags &= ~AVRPART_HAS_TPI; - + current_part->prog_modes &= ~PM_TPI; + } free_token($3); } | @@ -1135,11 +1187,13 @@ part_parm : K_IS_AVR32 TKN_EQUAL yesno { - if ($3->primary == K_YES) + if ($3->primary == K_YES) { current_part->flags |= AVRPART_AVR32; - else if ($3->primary == K_NO) + current_part->prog_modes |= PM_aWire; + } else if ($3->primary == K_NO) { current_part->flags &= ~AVRPART_AVR32; - + current_part->prog_modes &= ~PM_aWire; + } free_token($3); } | @@ -1255,14 +1309,6 @@ part_parm : } | -/* - K_EEPROM { current_mem = AVR_M_EEPROM; } - mem_specs | - - K_FLASH { current_mem = AVR_M_FLASH; } - mem_specs | -*/ - K_MEMORY TKN_STRING { /* select memory for extension or create if not there */ AVRMEM *mem = avr_locate_mem_noalias(current_part, $2->value.string); @@ -1273,6 +1319,7 @@ part_parm : } avr_add_mem_order($2->value.string); current_mem = mem; + current_strct = COMP_AVRMEM; free_token($2); } mem_specs @@ -1295,6 +1342,7 @@ part_parm : } cfg_pop_comms(); current_mem = NULL; + current_strct = COMP_AVRPART; } | K_MEMORY TKN_STRING TKN_EQUAL K_NULL { @@ -1306,6 +1354,7 @@ part_parm : free_token($2); cfg_pop_comms(); current_mem = NULL; + current_strct = COMP_AVRPART; } | opcode TKN_EQUAL string_list { { @@ -1355,6 +1404,11 @@ mem_specs : mem_spec : + TKN_COMPONENT TKN_EQUAL expr { + cfg_assign((char *) current_mem, COMP_AVRMEM, $1->value.comp, &$3->value); + free_token($1); + } | + K_PAGED TKN_EQUAL yesno { current_mem->paged = $3->primary == K_YES ? 1 : 0; diff --git a/src/developer_opts.c b/src/developer_opts.c index c8aa903c..8f716f03 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -63,7 +63,7 @@ static struct { const char *mcu, *var, *value; } ptinj[] = { // Add triples here, eg, {"ATmega328P", "mcuid", "999"}, - {NULL, NULL, NULL}, + {NULL, NULL, NULL}, }; static struct { @@ -134,7 +134,7 @@ static void printallopcodes(const AVRPART *p, const char *d, OPCODE * const *opa // Programming modes -static char *prog_modes(const AVRPART *p) { +static char *prog_modes_str_flags(const AVRPART *p) { static char type[1024]; *type = 0; @@ -194,6 +194,34 @@ static char *prog_modes(const AVRPART *p) { return type + (*type == '|'); } +static char *prog_modes_str(int pm) { + static char type[1024]; + + strcpy(type, "0"); + if(pm & PM_SPM) + strcat(type, " | PM_SPM"); + if(pm & PM_TPI) + strcat(type, " | PM_TPI"); + if(pm & PM_ISP) + strcat(type, " | PM_ISP"); + if(pm & PM_PDI) + strcat(type, " | PM_PDI"); + if(pm & PM_UPDI) + strcat(type, " | PM_UPDI"); + if(pm & PM_HVSP) + strcat(type, " | PM_HVSP"); + if(pm & PM_HVPP) + strcat(type, " | PM_HVPP"); + if(pm & PM_debugWIRE) + strcat(type, " | PM_debugWIRE"); + if(pm & PM_JTAG) + strcat(type, " | PM_JTAG"); + if(pm & PM_aWire) + strcat(type, " | PM_aWire"); + + return type + (type[1] == 0? 0: 4); +} + // Check whether address bits are where they should be in ISP commands static void checkaddr(int memsize, int pagesize, int opnum, const OPCODE *op, const AVRPART *p, const AVRMEM *m) { @@ -573,6 +601,10 @@ static void dev_part_strct(const AVRPART *p, bool tsv, const AVRPART *base, bool _if_partout_str(strcmp, descstr, desc); _if_partout_str(strcmp, cfg_escape(p->id), id); _if_partout_str(strcmp, cfg_escape(p->family_id), family_id); + _if_partout_str(intcmp, cfg_strdup("dev_part_strct()", prog_modes_str(p->prog_modes)), prog_modes); + _if_partout(intcmp, "%d", mcuid); + _if_partout(intcmp, "%d", n_interrupts); + _if_partout(intcmp, "%d", n_page_erase); _if_partout(intcmp, "%d", hvupdi_variant); _if_partout(intcmp, "0x%02x", stk500_devcode); _if_partout(intcmp, "0x%02x", avr910_devcode); @@ -1032,7 +1064,7 @@ void dev_output_part_defs(char *partdesc) { nfuses, ok, p->flags, - prog_modes(p), + prog_modes_str_flags(p), p->config_file, p->lineno ); } @@ -1189,6 +1221,7 @@ static void dev_pgm_strct(const PROGRAMMER *pgm, bool tsv, const PROGRAMMER *bas _if_pgmout_str(strcmp, cfg_escape(pgm->desc), desc); if(!base || base->initpgm != pgm->initpgm) _pgmout_fmt("type", "\"%s\"", locate_programmer_type_id(pgm->initpgm)); + _if_pgmout_str(intcmp, cfg_strdup("dev_pgm_strct()", prog_modes_str(pgm->prog_modes)), prog_modes); if(!base || base->conntype != pgm->conntype) _pgmout_fmt("connection_type", "%s", connstr(pgm->conntype)); _if_pgmout(intcmp, "%d", baudrate); diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index cdc7602b..19d019c5 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -1694,34 +1694,53 @@ The format of the programmer definition is as follows: @smallexample programmer - parent # is a quoted string + parent # optional parent id = [, [, ] ...] ; # are quoted strings desc = ; # quoted string - type = "par" | "stk500" | ... ; # programmer type (see below for a list) - baudrate = ; # baudrate for serial ports - vcc = [, ... ] ; # pin number(s) - buff = [, ... ] ; # pin number(s) - reset = ; # pin number - sck = ; # pin number - mosi = ; # pin number - miso = ; # pin number - errled = ; # pin number - rdyled = ; # pin number - pgmled = ; # pin number - vfyled = ; # pin number - usbvid = ; # USB VID (Vendor ID) - usbpid = [, ...]; # USB PID (Product ID) - usbdev = ; # USB interface or other device info - usbvendor = ; # USB Vendor Name - usbproduct = ; # USB Product Name - usbsn = ; # USB Serial Number - ; + type = ; # programmer type, quoted string + # supported types can be listed by "-c ?type" + prog_modes = PM_ @{ | PM_ @} # interfaces, eg, PM_SPM|PM_PDI + connection_type = parallel | serial | usb | spi + baudrate = ; # baudrate for avr910-programmer + vcc = [, ... ] ; # pin number(s) + buff = [, ... ] ; # pin number(s) + reset = ; # pin number + sck = ; # pin number + mosi = ; # pin number + miso = ; # pin number + errled = ; # pin number + rdyled = ; # pin number + pgmled = ; # pin number + vfyled = ; # pin number + usbvid = ; # USB VID (Vendor ID) + usbpid = [, ...] ; # USB PID (Product ID) + usbdev = ; # USB interface or other device info + usbvendor = ; # USB Vendor Name + usbproduct = ; # USB Product Name + usbsn = ; # USB Serial Number + hvupdi_support = [, , ... ] ; # UPDI HV Variants Support +; @end smallexample @noindent If a parent is specified, all settings of it (except its ids) are used for the new programmer. These values can be changed by new setting them for the new programmer. +@noindent +Known programming modes are +@itemize @bullet +@item @code{PM_SPM}: Bootloaders, self-programming with SPM opcodes or NVM Controllers +@item @code{PM_TPI}: Tiny Programming Interface (t4, t5, t9, t10, t20, t40, t102, t104) +@item @code{PM_ISP}: SPI programming for In-System Programming (almost all classic parts) +@item @code{PM_PDI}: Program and Debug Interface (xmega parts) +@item @code{PM_UPDI}: Unified Program and Debug Interface +@item @code{PM_HVSP}: High Voltage Serial Programming (some classic parts) +@item @code{PM_HVPP}: High Voltage Parallel Programming (most non-HVSP classic parts) +@item @code{PM_debugWIRE}: Simpler alternative to JTAG (a subset of HVPP/HVSP parts) +@item @code{PM_JTAG}: Joint Test Action Group standard (some classic parts, some xmega) +@item @code{PM_aWire}: AVR32 parts +@end itemize + @noindent To invert a bit in the pin definitions, use @code{= ~ }. @@ -1729,7 +1748,7 @@ To invert a bit in the pin definitions, use @code{= ~ }. Not all programmer types can handle a list of USB PIDs. @noindent -Following programmer types are currently implemented: +The following programmer types are currently implemented: @multitable @columnfractions .25 .6 @include programmer_types.texi @@ -1743,29 +1762,35 @@ Following programmer types are currently implemented: @smallexample part - id = ; # quoted string desc = ; # quoted string - family_id = ; # quoted string + id = ; # quoted string + family_id = ; # quoted string, eg, "megaAVR" or "tinyAVR" + prog_modes = PM_ @{ | PM_ @} # interfaces, eg, PM_SPM|PM_ISP|PM_HVPP|PM_debugWIRE + mcuid = ; # unique id in 0..2039 for urclock programmer + n_interrupts = ; # number of interrupts, used for vector bootloaders + n_page_erase = ; # if set, number of pages erased during NVM erase + hvupdi_variant = ; # numeric -1 (n/a) or 0..2 + devicecode = ; # deprecated, use stk500_devcode + stk500_devcode = ; # numeric + avr910_devcode = ; # numeric has_jtag = ; # part has JTAG i/f has_debugwire = ; # part has debugWire i/f has_pdi = ; # part has PDI i/f has_updi = ; # part has UPDI i/f has_tpi = ; # part has TPI i/f - devicecode = ; # numeric - stk500_devcode = ; # numeric - avr910_devcode = ; # numeric + is_avr32 = ; # AVR32 part + is_at90s1200 = ; # AT90S1200 part signature = ; # signature bytes usbpid = ; # DFU USB PID - reset = dedicated | io; - retry_pulse = reset | sck; - pgm_enable = ; - chip_erase = ; chip_erase_delay = ; # micro-seconds + reset = dedicated | io ; + retry_pulse = reset | sck ; + chip_erase_delay = ; # chip erase delay (us) # STK500 parameters (parallel programming IO lines) pagel = ; # pin name in hex, i.e., 0xD7 bs2 = ; # pin name in hex, i.e., 0xA0 serial = ; # can use serial downloading - parallel = ; # can use par. programming + parallel = ; # can use par. programming # STK500v2 parameters, to be taken from Atmel's XML files timeout = ; stabdelay = ; @@ -1777,52 +1802,59 @@ part predelay = ; postdelay = ; pollmethod = ; - mode = ; - delay = ; - blocksize = ; - readsize = ; hvspcmdexedelay = ; # STK500v2 HV programming parameters, from XML - pp_controlstack = , , ...; # PP only - hvsp_controlstack = , , ...; # HVSP only - hventerstabdelay = ; - progmodedelay = ; # PP only - latchcycles = ; - togglevtg = ; - poweroffdelay = ; - resetdelayms = ; - resetdelayus = ; - hvleavestabdelay = ; - resetdelay = ; - synchcycles = ; # HVSP only - chiperasepulsewidth = ; # PP only - chiperasepolltimeout = ; - chiperasetime = ; # HVSP only - programfusepulsewidth = ; # PP only - programfusepolltimeout = ; - programlockpulsewidth = ; # PP only - programlockpolltimeout = ; + pp_controlstack = , , ... ; # PP only + hvsp_controlstack = , , ... ; # HVSP only + flash_instr = , , ; + eeprom_instr = , , ... ; + hventerstabdelay = ; + progmodedelay = ; # PP only + latchcycles = ; + togglevtg = ; + poweroffdelay = ; + resetdelayms = ; + resetdelayus = ; + hvleavestabdelay = ; + resetdelay = ; + synchcycles = ; # HVSP only + chiperasepulsewidth = ; # PP only + chiperasepolltimeout = ; + chiperasetime = ; # HVSP only + programfusepulsewidth = ; # PP only + programfusepolltimeout = ; + programlockpulsewidth = ; # PP only + programlockpolltimeout = ; # JTAG ICE mkII parameters, also from XML files allowfullpagebitstream = ; enablepageprogramming = ; - idr = ; # IO addr of IDR (OCD) reg. - rampz = ; # IO addr of RAMPZ reg. - spmcr = ; # mem addr of SPMC[S]R reg. - eecr = ; # mem addr of EECR reg. - # (only when != 0x3F) - is_at90s1200 = ; # AT90S1200 part - is_avr32 = ; # AVR32 part + idr = ; # IO addr of IDR (OCD) reg + rampz = ; # IO addr of RAMPZ reg + spmcr = ; # mem addr of SPMC[S]R reg + eecr = ; # mem addr of EECR reg only when != 0x3f + mcu_base = ; + nvm_base = ; + ocd_base = ; + ocdrev = ; + pgm_enable = ; + chip_erase = ; memory - paged = ; # yes / no + paged = ; # yes/no (flash only, do not use for EEPROM) + offset = ; # memory offset size = ; # bytes page_size = ; # bytes num_pages = ; # numeric min_write_delay = ; # micro-seconds max_write_delay = ; # micro-seconds - readback_p1 = ; # byte value - readback_p2 = ; # byte value - pwroff_after_write = ; # yes / no + readback = ; # pair of byte values + readback_p1 = ; # byte value (first component) + readback_p2 = ; # byte value (second component) + pwroff_after_write = ; # yes/no + mode = ; # STK500 v2 file parameter from Atmel's XML files + delay = ; # " + blocksize = ; # " + readsize = ; # " read = ; write = ; read_lo = ; @@ -1832,8 +1864,8 @@ part loadpage_lo = ; loadpage_hi = ; writepage = ; - ; - ; + ; +; @end smallexample @menu @@ -1914,7 +1946,22 @@ write = "1 1 0 0 0 0 0 0 x x x x x x x x", @end smallexample +As the address bit numbers in the SPI opcodes are highly systematic, they +don't really need to be specified. A compact version of the format +specification neither uses bit-numbers for address lines nor spaces. If such +a string is longer than 7 characters, then the characters @code{0}, @code{1}, +@code{x}, @code{a}, @code{i} and @code{o} will be recognised as the +corresponding bit, whilst any of the characters @code{.}, @code{-}, @code{_} +or @code{/} can act as arbitrary visual separators, which are ignored. +Examples: +@smallexample + + loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii"; + + loadpage_lo = "0100.0000", "000x.xxxx", "xxaa.aaaa", "iiii.iiii"; + +@end smallexample @c @c Node diff --git a/src/lexer.l b/src/lexer.l index a69130d3..65b7a451 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -63,9 +63,9 @@ SIGN [+-] %% -{SIGN}?{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; } -{SIGN}?{DIGIT}+"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; } -{SIGN}?"."{DIGIT}+ { yylval = number_real(yytext); return TKN_NUMBER_REAL; } +{SIGN}?{DIGIT}+ { yylval = new_number(yytext); return TKN_NUMBER; } +{SIGN}?{DIGIT}+"."{DIGIT}* { yylval = new_number_real(yytext); return TKN_NUMBER_REAL; } +{SIGN}?"."{DIGIT}+ { yylval = new_number_real(yytext); return TKN_NUMBER_REAL; } ["]([^"\\\n]|\\.|\\\n)*["] { char *str= cfg_strdup("lexer.l", yytext); @@ -73,12 +73,12 @@ SIGN [+-] size_t len = strlen(str); if(len) str[len-1] = 0; - yylval = string(str); + yylval = new_string(str); free(str); return TKN_STRING; } -0x{HEXDIGIT}+ { yylval = hexnumber(yytext); return TKN_NUMBER; } +0x{HEXDIGIT}+ { yylval = new_hexnumber(yytext); return TKN_NUMBER; } #\n#\ PROGRAMMER\ DEFINITIONS\n#\n+ { /* Record comments so far as prologue and skip */ cfg_capture_prologue(); @@ -121,6 +121,23 @@ SIGN [+-] } +prog_modes|mcuid|n_interrupts|n_page_erase { /* Components for assignment */ + Component_t *cp = cfg_comp_search(yytext, current_strct); + if(!cp) { + yyerror("Unknown component %s in %s", yytext, cfg_strct_name(current_strct)); + return YYERRCODE; + } + yylval = new_token(TKN_COMPONENT); + yylval->value.comp = cp; + ccap(); + return TKN_COMPONENT; +} + +PM_SPM|PM_TPI|PM_ISP|PM_PDI|PM_UPDI|PM_HVSP|PM_HVPP|PM_debugWIRE|PM_JTAG|PM_aWire { /* Constants */ + yylval = new_constant(yytext); + return TKN_NUMBER; +} + alias { yylval=NULL; return K_ALIAS; } allowfullpagebitstream { yylval=NULL; ccap(); return K_ALLOWFULLPAGEBITSTREAM; } avr910_devcode { yylval=NULL; ccap(); return K_AVR910_DEVCODE; } @@ -258,7 +275,17 @@ yes { yylval=new_token(K_YES); return K_YES; } "," { yylval = NULL; pyytext(); return TKN_COMMA; } "=" { yylval = NULL; pyytext(); return TKN_EQUAL; } ";" { yylval = NULL; pyytext(); return TKN_SEMI; } -"~" { yylval = NULL; pyytext(); return TKN_TILDE; } + +"|" { yylval = NULL; pyytext(); return OP_OR; } +"^" { yylval = NULL; pyytext(); return OP_XOR; } +"&" { yylval = NULL; pyytext(); return OP_AND; } +"+" { yylval = NULL; pyytext(); return OP_PLUS; } +"-" { yylval = NULL; pyytext(); return OP_MINUS; } +"*" { yylval = NULL; pyytext(); return OP_TIMES; } +"/" { yylval = NULL; pyytext(); return OP_DIVIDE; } +"%" { yylval = NULL; pyytext(); return OP_MODULO; } +"~" { yylval = NULL; pyytext(); return OP_TILDE; } + "(" { yylval = NULL; pyytext(); return TKN_LEFT_PAREN; } ")" { yylval = NULL; pyytext(); return TKN_RIGHT_PAREN; } diff --git a/src/libavrdude.h b/src/libavrdude.h index 9288b43b..c99117f4 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -169,6 +169,7 @@ enum ctl_stack_t { CTL_STACK_HVSP /* high voltage serial programming control stack */ }; + /* * serial programming instruction bit specifications */ @@ -197,6 +198,18 @@ typedef struct opcode { #define AVRPART_IS_AT90S1200 0x1000 /* part is an AT90S1200 (needs special treatment) */ #define AVRPART_HAS_UPDI 0x2000 /* part has UPDI i/f (AVR8X) */ +// Programming modes for parts and programmers: reflect changes in lexer.l, developer_opts.c and config.c +#define PM_SPM 1 // Bootloaders, self-programming with SPM opcodes or NVM Controllers +#define PM_TPI 2 // Tiny Programming Interface (t4, t5, t9, t10, t20, t40, t102, t104) +#define PM_ISP 4 // SPI programming for In-System Programming (almost all classic parts) +#define PM_PDI 8 // Program and Debug Interface (xmega parts) +#define PM_UPDI 16 // Unified Program and Debug Interface +#define PM_HVSP 32 // High Voltage Serial Programming (some classic parts) +#define PM_HVPP 64 // High Voltage Parallel Programming (most non-HVSP classic parts) +#define PM_debugWIRE 128 // Simpler alternative to JTAG (a subset of HVPP/HVSP parts) +#define PM_JTAG 256 // Joint Test Action Group standard (some classic parts, some xmega) +#define PM_aWire 512 // AVR32 parts + #define HV_UPDI_VARIANT_0 0 /* Shared UPDI/GPIO/RESET pin, HV on UPDI pin (tinyAVR0/1/2)*/ #define HV_UPDI_VARIANT_1 1 /* Dedicated UPDI pin, no HV (megaAVR0/AVR-Dx) */ #define HV_UPDI_VARIANT_2 2 /* Shared UPDI pin, HV on _RESET (AVR-Ex) */ @@ -209,13 +222,24 @@ typedef struct opcode { #define TAG_ALLOCATED 1 /* memory byte is allocated */ -/* Any changes here, please also reflect in dev_part_strct() of developer_opts.c */ +/* + * Any changes in AVRPART or AVRMEM, please also ensure changes are made in + * - lexer.l + * - Either Component_t avr_comp[] of config.c or in config_gram.y + * - dev_part_strct() in developer_opts.c + * - avr_new_part() and/or avr_new_memtype() in avrpart.c for + * initialisation; note that all const char * must be initialised with "" + */ typedef struct avrpart { const char * desc; /* long part name */ const char * id; /* short part name */ LISTID comments; // Used by developer options -p*/[ASsr...] const char * parent_id; /* Used by developer options */ const char * family_id; /* family id in the SIB (avr8x) */ + int prog_modes; /* Programming interfaces, see #define PM_... */ + int mcuid; /* Unique id in 0..2039 for urclock programmer */ + int n_interrupts; /* Number of interrupts, used for vector bootloaders */ + int n_page_erase; /* If set, number of pages erased during NVM erase */ int hvupdi_variant; /* HV pulse on UPDI pin, no pin or RESET pin */ int stk500_devcode; /* stk500 device code */ int avr910_devcode; /* avr910 device code */ @@ -262,7 +286,7 @@ typedef struct avrpart { int programlockpulsewidth; /* stk500 v2 hv mode parameter */ int programlockpolltimeout; /* stk500 v2 hv mode parameter */ int synchcycles; /* stk500 v2 hv mode parameter */ - int hvspcmdexedelay; /* stk500 v2 xml file parameter */ + int hvspcmdexedelay; /* stk500 v2 hv mode file parameter */ unsigned char idr; /* JTAG ICE mkII XML file parameter */ unsigned char rampz; /* JTAG ICE mkII XML file parameter */ @@ -677,13 +701,21 @@ typedef enum { CONNTYPE_SPI } conntype_t; -/* Any changes here, please also reflect in dev_pgm_strct() of developer_opts.c */ +/* + * Any changes in PROGRAMMER, please also ensure changes are made in + * - lexer.l + * - Either Component_t avr_comp[] of config.c or config_gram.y + * - dev_pgm_strct() in developer_opts.c + * - pgm_new() in pgm.c for initialisation; note that all const char * must + * be initialised with "" + */ typedef struct programmer_t { LISTID id; const char *desc; void (*initpgm)(struct programmer_t *pgm); // Sets up the AVRDUDE programmer LISTID comments; // Used by developer options -c*/[ASsr...] const char *parent_id; // Used by developer options + int prog_modes; // Programming interfaces, see #define PM_... struct pindef_t pin[N_PINS]; conntype_t conntype; int baudrate; @@ -695,7 +727,7 @@ typedef struct programmer_t { const char *usbproduct; LISTID hvupdi_support; // List of UPDI HV variants the tool supports, see HV_UPDI_VARIANT_x - // Values below are not set by config_gram.y; make sure fd is first for dev_pgm_raw() + // Values below are not set by config_gram.y; ensure fd is first for dev_pgm_raw() union filedescriptor fd; char type[PGM_TYPELEN]; char port[PGM_PORTLEN]; From 0df8b87eda02e089cf88fd775e492d2b894b20d2 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 30 Aug 2022 02:31:57 +0100 Subject: [PATCH 221/511] Set part prog_modes, mcuid, n_interrupts and n_page_erase in avrdude.conf.in --- src/avrdude.conf.in | 582 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 582 insertions(+) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index e2a330ff..018850d3 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -2337,6 +2337,9 @@ programmer part desc = "ATtiny11"; id = "t11"; + prog_modes = PM_HVSP; + mcuid = 8; + n_interrupts = 5; stk500_devcode = 0x11; chip_erase_delay = 20000; signature = 0x1e 0x90 0x04; @@ -2397,6 +2400,9 @@ part part desc = "ATtiny12"; id = "t12"; + prog_modes = PM_ISP | PM_HVSP; + mcuid = 9; + n_interrupts = 6; stk500_devcode = 0x12; avr910_devcode = 0x55; chip_erase_delay = 20000; @@ -2490,6 +2496,9 @@ part part desc = "ATtiny13"; id = "t13"; + prog_modes = PM_SPM | PM_ISP | PM_HVSP | PM_debugWIRE; + mcuid = 10; + n_interrupts = 10; stk500_devcode = 0x14; chip_erase_delay = 4000; signature = 0x1e 0x90 0x07; @@ -2605,6 +2614,7 @@ part part parent "t13" desc = "ATtiny13A"; id = "t13a"; + mcuid = 11; ; #------------------------------------------------------------ @@ -2614,6 +2624,9 @@ part parent "t13" part desc = "ATtiny15"; id = "t15"; + prog_modes = PM_ISP | PM_HVSP; + mcuid = 12; + n_interrupts = 9; stk500_devcode = 0x13; avr910_devcode = 0x56; chip_erase_delay = 8200; @@ -2708,6 +2721,9 @@ part part desc = "AT90S1200"; id = "1200"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 183; + n_interrupts = 4; stk500_devcode = 0x33; avr910_devcode = 0x13; chip_erase_delay = 20000; @@ -2787,6 +2803,9 @@ part part desc = "AT90S4414"; id = "4414"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 190; + n_interrupts = 13; stk500_devcode = 0x50; avr910_devcode = 0x28; chip_erase_delay = 20000; @@ -2864,6 +2883,9 @@ part part desc = "AT90S2313"; id = "2313"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 186; + n_interrupts = 11; stk500_devcode = 0x40; avr910_devcode = 0x20; chip_erase_delay = 20000; @@ -2942,6 +2964,9 @@ part ##### WARNING: No XML file for device 'AT90S2333'! ##### desc = "AT90S2333"; id = "2333"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 188; + n_interrupts = 14; stk500_devcode = 0x42; avr910_devcode = 0x34; chip_erase_delay = 20000; @@ -3025,6 +3050,9 @@ part part desc = "AT90S2343"; id = "2343"; + prog_modes = PM_SPM | PM_ISP | PM_HVSP; + mcuid = 189; + n_interrupts = 3; stk500_devcode = 0x43; avr910_devcode = 0x4c; chip_erase_delay = 18000; @@ -3112,6 +3140,9 @@ part part desc = "AT90S4433"; id = "4433"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 191; + n_interrupts = 14; stk500_devcode = 0x51; avr910_devcode = 0x30; chip_erase_delay = 20000; @@ -3196,6 +3227,9 @@ part ##### WARNING: No XML file for device 'AT90S4434'! ##### desc = "AT90S4434"; id = "4434"; + prog_modes = PM_SPM | PM_ISP; + mcuid = 192; + n_interrupts = 17; stk500_devcode = 0x52; avr910_devcode = 0x6c; chip_erase_delay = 20000; @@ -3252,6 +3286,9 @@ part part desc = "AT90S8515"; id = "8515"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 193; + n_interrupts = 13; stk500_devcode = 0x60; avr910_devcode = 0x38; chip_erase_delay = 20000; @@ -3330,6 +3367,9 @@ part part desc = "AT90S8535"; id = "8535"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 195; + n_interrupts = 17; stk500_devcode = 0x61; avr910_devcode = 0x68; chip_erase_delay = 20000; @@ -3412,6 +3452,9 @@ part part desc = "ATmega103"; id = "m103"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 84; + n_interrupts = 24; stk500_devcode = 0xb1; avr910_devcode = 0x41; chip_erase_delay = 112000; @@ -3498,6 +3541,9 @@ part part desc = "ATmega64"; id = "m64"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 72; + n_interrupts = 35; stk500_devcode = 0xa0; avr910_devcode = 0x45; chip_erase_delay = 9000; @@ -3615,6 +3661,7 @@ part part parent "m64" desc = "ATmega64A"; id = "m64a"; + mcuid = 73; ; #------------------------------------------------------------ @@ -3624,6 +3671,9 @@ part parent "m64" part desc = "ATmega128"; id = "m128"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 85; + n_interrupts = 35; stk500_devcode = 0xb2; avr910_devcode = 0x43; chip_erase_delay = 9000; @@ -3742,6 +3792,7 @@ part part parent "m128" desc = "ATmega128A"; id = "m128a"; + mcuid = 86; ; #------------------------------------------------------------ @@ -3751,6 +3802,9 @@ part parent "m128" part desc = "AT90CAN128"; id = "c128"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 176; + n_interrupts = 37; stk500_devcode = 0xb3; chip_erase_delay = 9000; pagel = 0xd7; @@ -3872,6 +3926,9 @@ part part desc = "AT90CAN64"; id = "c64"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 172; + n_interrupts = 37; stk500_devcode = 0xb3; chip_erase_delay = 9000; pagel = 0xd7; @@ -3993,6 +4050,9 @@ part part desc = "AT90CAN32"; id = "c32"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 171; + n_interrupts = 37; stk500_devcode = 0xb3; chip_erase_delay = 9000; pagel = 0xd7; @@ -4114,6 +4174,9 @@ part part desc = "ATmega16"; id = "m16"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 49; + n_interrupts = 21; stk500_devcode = 0x82; avr910_devcode = 0x74; chip_erase_delay = 9000; @@ -4227,6 +4290,7 @@ part part parent "m16" desc = "ATmega16A"; id = "m16a"; + mcuid = 50; ; #------------------------------------------------------------ @@ -4236,6 +4300,9 @@ part parent "m16" part desc = "ATmega324P"; id = "m324p"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 111; + n_interrupts = 31; stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one avr910_devcode = 0x74; chip_erase_delay = 55000; @@ -4357,6 +4424,7 @@ part part parent "m324p" desc = "ATmega164P"; id = "m164p"; + mcuid = 93; signature = 0x1e 0x94 0x0a; memory "eeprom" @@ -4376,6 +4444,7 @@ part parent "m324p" part parent "m164p" desc = "ATmega164PA"; id = "m164pa"; + mcuid = 94; ; #------------------------------------------------------------ @@ -4385,6 +4454,7 @@ part parent "m164p" part parent "m164p" desc = "ATmega164A"; id = "m164a"; + mcuid = 92; signature = 0x1e 0x94 0x0f; ; @@ -4395,6 +4465,7 @@ part parent "m164p" part parent "m324p" desc = "ATmega324PB"; id = "m324pb"; + mcuid = 113; signature = 0x1e 0x95 0x17; ; @@ -4405,6 +4476,7 @@ part parent "m324p" part parent "m324p" desc = "ATmega324PA"; id = "m324pa"; + mcuid = 112; signature = 0x1e 0x95 0x11; ; @@ -4415,6 +4487,7 @@ part parent "m324p" part parent "m324p" desc = "ATmega324A"; id = "m324a"; + mcuid = 110; signature = 0x1e 0x95 0x15; ; @@ -4425,6 +4498,9 @@ part parent "m324p" part desc = "ATmega644"; id = "m644"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 127; + n_interrupts = 28; stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one avr910_devcode = 0x74; chip_erase_delay = 55000; @@ -4543,6 +4619,8 @@ part part parent "m644" desc = "ATmega644A"; id = "m644a"; + mcuid = 128; + n_interrupts = 31; ; #------------------------------------------------------------ @@ -4552,6 +4630,8 @@ part parent "m644" part parent "m644" desc = "ATmega644P"; id = "m644p"; + mcuid = 129; + n_interrupts = 31; signature = 0x1e 0x96 0x0a; ; @@ -4562,6 +4642,8 @@ part parent "m644" part parent "m644" desc = "ATmega644PA"; id = "m644pa"; + mcuid = 130; + n_interrupts = 31; signature = 0x1e 0x96 0x0a; ; @@ -4572,6 +4654,9 @@ part parent "m644" part desc = "ATmega1284"; id = "m1284"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 140; + n_interrupts = 35; stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one avr910_devcode = 0x74; chip_erase_delay = 55000; @@ -4694,6 +4779,7 @@ part part parent "m1284" desc = "ATmega1284P"; id = "m1284p"; + mcuid = 141; signature = 0x1e 0x97 0x05; ; @@ -4704,6 +4790,9 @@ part parent "m1284" part desc = "ATmega162"; id = "m162"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 90; + n_interrupts = 28; stk500_devcode = 0x83; avr910_devcode = 0x63; chip_erase_delay = 9000; @@ -4823,6 +4912,9 @@ part part desc = "ATmega163"; id = "m163"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 91; + n_interrupts = 18; stk500_devcode = 0x81; avr910_devcode = 0x64; chip_erase_delay = 32000; @@ -4924,6 +5016,9 @@ part part desc = "ATmega169"; id = "m169"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 104; + n_interrupts = 23; stk500_devcode = 0x85; avr910_devcode = 0x78; chip_erase_delay = 9000; @@ -5043,6 +5138,7 @@ part part parent "m169" desc = "ATmega169A"; id = "m169a"; + mcuid = 105; signature = 0x1e 0x94 0x11; reset = io; ; @@ -5054,6 +5150,7 @@ part parent "m169" part parent "m169" desc = "ATmega169P"; id = "m169p"; + mcuid = 106; reset = io; ; @@ -5064,6 +5161,7 @@ part parent "m169" part parent "m169" desc = "ATmega169PA"; id = "m169pa"; + mcuid = 107; reset = io; ; @@ -5074,6 +5172,9 @@ part parent "m169" part desc = "ATmega329"; id = "m329"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 121; + n_interrupts = 23; # stk500_devcode = 0x85; # no STK500 support, only STK500v2 # avr910_devcode = 0x?; # try the ATmega169 one: avr910_devcode = 0x75; @@ -5195,6 +5296,7 @@ part part parent "m329" desc = "ATmega329A"; id = "m329a"; + mcuid = 122; ; #------------------------------------------------------------ @@ -5204,6 +5306,7 @@ part parent "m329" part parent "m329" desc = "ATmega329P"; id = "m329p"; + mcuid = 123; signature = 0x1e 0x95 0x0b; ; @@ -5214,6 +5317,7 @@ part parent "m329" part parent "m329" desc = "ATmega329PA"; id = "m329pa"; + mcuid = 124; signature = 0x1e 0x95 0x0b; ; @@ -5224,6 +5328,8 @@ part parent "m329" part parent "m329" desc = "ATmega3290"; id = "m3290"; + mcuid = 150; + n_interrupts = 25; signature = 0x1e 0x95 0x04; ; @@ -5234,6 +5340,8 @@ part parent "m329" part parent "m329" desc = "ATmega3290A"; id = "m3290a"; + mcuid = 151; + n_interrupts = 25; signature = 0x1e 0x95 0x04; ; @@ -5244,6 +5352,8 @@ part parent "m329" part parent "m329" desc = "ATmega3290P"; id = "m3290p"; + mcuid = 152; + n_interrupts = 25; signature = 0x1e 0x95 0x0c; ; @@ -5254,6 +5364,8 @@ part parent "m329" part parent "m329" desc = "ATmega3290PA"; id = "m3290pa"; + mcuid = 153; + n_interrupts = 25; signature = 0x1e 0x95 0x0c; ; @@ -5264,6 +5376,9 @@ part parent "m329" part desc = "ATmega649"; id = "m649"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 135; + n_interrupts = 23; # stk500_devcode = 0x85; # no STK500 support, only STK500v2 # avr910_devcode = 0x?; # try the ATmega169 one: avr910_devcode = 0x75; @@ -5385,6 +5500,7 @@ part part parent "m649" desc = "ATmega649A"; id = "m649a"; + mcuid = 136; ; #------------------------------------------------------------ @@ -5394,6 +5510,7 @@ part parent "m649" part parent "m649" desc = "ATmega649P"; id = "m649p"; + mcuid = 137; signature = 0x1e 0x96 0x0b; ; @@ -5404,6 +5521,8 @@ part parent "m649" part parent "m649" desc = "ATmega6490"; id = "m6490"; + mcuid = 157; + n_interrupts = 25; signature = 0x1e 0x96 0x04; ; @@ -5414,6 +5533,8 @@ part parent "m649" part parent "m649" desc = "ATmega6490A"; id = "m6490a"; + mcuid = 158; + n_interrupts = 25; signature = 0x1e 0x96 0x04; ; @@ -5424,6 +5545,8 @@ part parent "m649" part parent "m649" desc = "ATmega6490P"; id = "m6490p"; + mcuid = 159; + n_interrupts = 25; signature = 0x1e 0x96 0x0c; ; @@ -5434,6 +5557,9 @@ part parent "m649" part desc = "ATmega32"; id = "m32"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 58; + n_interrupts = 21; stk500_devcode = 0x91; avr910_devcode = 0x72; chip_erase_delay = 9000; @@ -5545,6 +5671,9 @@ part part desc = "ATmega161"; id = "m161"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 89; + n_interrupts = 21; stk500_devcode = 0x80; avr910_devcode = 0x60; chip_erase_delay = 28000; @@ -5633,6 +5762,7 @@ part part parent "m32" desc = "ATmega32A"; id = "m32a"; + mcuid = 59; ; #------------------------------------------------------------ @@ -5642,6 +5772,9 @@ part parent "m32" part desc = "ATmega8"; id = "m8"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 45; + n_interrupts = 19; stk500_devcode = 0x70; avr910_devcode = 0x76; chip_erase_delay = 10000; @@ -5750,6 +5883,7 @@ part part parent "m8" desc = "ATmega8A"; id = "m8a"; + mcuid = 46; ; #------------------------------------------------------------ @@ -5759,6 +5893,9 @@ part parent "m8" part desc = "ATmega8515"; id = "m8515"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 160; + n_interrupts = 17; stk500_devcode = 0x63; avr910_devcode = 0x3a; chip_erase_delay = 9000; @@ -5859,6 +5996,9 @@ part part desc = "ATmega8535"; id = "m8535"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP; + mcuid = 161; + n_interrupts = 21; stk500_devcode = 0x64; avr910_devcode = 0x69; chip_erase_delay = 9000; @@ -5961,6 +6101,9 @@ part part desc = "ATtiny26"; id = "t26"; + prog_modes = PM_ISP | PM_HVPP; + mcuid = 17; + n_interrupts = 12; stk500_devcode = 0x21; avr910_devcode = 0x5e; chip_erase_delay = 9000; @@ -6066,6 +6209,9 @@ part part desc = "ATtiny261"; id = "t261"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 30; + n_interrupts = 19; chip_erase_delay = 4000; pagel = 0xb3; bs2 = 0xb2; @@ -6190,6 +6336,7 @@ part part parent "t261" desc = "ATtiny261A"; id = "t261a"; + mcuid = 31; ; #------------------------------------------------------------ @@ -6199,6 +6346,9 @@ part parent "t261" part desc = "ATtiny461"; id = "t461"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 33; + n_interrupts = 19; chip_erase_delay = 4000; pagel = 0xb3; bs2 = 0xb2; @@ -6323,6 +6473,7 @@ part part parent "t461" desc = "ATtiny461A"; id = "t461a"; + mcuid = 34; ; #------------------------------------------------------------ @@ -6332,6 +6483,9 @@ part parent "t461" part desc = "ATtiny861"; id = "t861"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 38; + n_interrupts = 19; chip_erase_delay = 4000; pagel = 0xb3; bs2 = 0xb2; @@ -6456,6 +6610,7 @@ part part parent "t861" desc = "ATtiny861A"; id = "t861a"; + mcuid = 39; ; #------------------------------------------------------------ @@ -6467,6 +6622,9 @@ part parent "t861" part desc = "ATtiny28"; id = "t28"; + prog_modes = PM_HVPP; + mcuid = 18; + n_interrupts = 6; stk500_devcode = 0x22; avr910_devcode = 0x5c; signature = 0x1e 0x91 0x07; @@ -6514,6 +6672,9 @@ part part desc = "ATmega48"; id = "m48"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 67; + n_interrupts = 26; stk500_devcode = 0x59; chip_erase_delay = 45000; pagel = 0xd7; @@ -6639,6 +6800,7 @@ part part parent "m48" desc = "ATmega48A"; id = "m48a"; + mcuid = 68; ; #------------------------------------------------------------ @@ -6648,6 +6810,7 @@ part parent "m48" part parent "m48" desc = "ATmega48P"; id = "m48p"; + mcuid = 69; signature = 0x1e 0x92 0x0a; ; @@ -6658,6 +6821,7 @@ part parent "m48" part parent "m48" desc = "ATmega48PA"; id = "m48pa"; + mcuid = 70; signature = 0x1e 0x92 0x0a; ; @@ -6668,6 +6832,8 @@ part parent "m48" part parent "m48" desc = "ATmega48PB"; id = "m48pb"; + mcuid = 71; + n_interrupts = 27; chip_erase_delay = 10500; signature = 0x1e 0x92 0x10; ; @@ -6679,6 +6845,9 @@ part parent "m48" part desc = "ATmega88"; id = "m88"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 79; + n_interrupts = 26; stk500_devcode = 0x73; chip_erase_delay = 9000; pagel = 0xd7; @@ -6805,6 +6974,7 @@ part part parent "m88" desc = "ATmega88A"; id = "m88a"; + mcuid = 80; ; #------------------------------------------------------------ @@ -6814,6 +6984,7 @@ part parent "m88" part parent "m88" desc = "ATmega88P"; id = "m88p"; + mcuid = 81; signature = 0x1e 0x93 0x0f; ; @@ -6824,6 +6995,7 @@ part parent "m88" part parent "m88" desc = "ATmega88PA"; id = "m88pa"; + mcuid = 82; signature = 0x1e 0x93 0x0f; ; @@ -6834,6 +7006,8 @@ part parent "m88" part parent "m88" desc = "ATmega88PB"; id = "m88pb"; + mcuid = 83; + n_interrupts = 27; chip_erase_delay = 10500; signature = 0x1e 0x93 0x16; ; @@ -6845,6 +7019,9 @@ part parent "m88" part desc = "ATmega168"; id = "m168"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 99; + n_interrupts = 26; stk500_devcode = 0x86; chip_erase_delay = 9000; pagel = 0xd7; @@ -6971,6 +7148,7 @@ part part parent "m168" desc = "ATmega168A"; id = "m168a"; + mcuid = 100; ; #------------------------------------------------------------ @@ -6980,6 +7158,7 @@ part parent "m168" part parent "m168" desc = "ATmega168P"; id = "m168p"; + mcuid = 101; signature = 0x1e 0x94 0x0b; ; @@ -6990,6 +7169,7 @@ part parent "m168" part parent "m168" desc = "ATmega168PA"; id = "m168pa"; + mcuid = 102; signature = 0x1e 0x94 0x0b; ; @@ -7000,6 +7180,8 @@ part parent "m168" part parent "m168" desc = "ATmega168PB"; id = "m168pb"; + mcuid = 103; + n_interrupts = 27; chip_erase_delay = 10500; signature = 0x1e 0x94 0x15; ; @@ -7011,6 +7193,9 @@ part parent "m168" part desc = "ATtiny828"; id = "t828"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 35; + n_interrupts = 26; stk500_devcode = 0x86; chip_erase_delay = 15000; pagel = 0xd7; @@ -7136,6 +7321,7 @@ part part parent "t828" desc = "ATtiny828R"; id = "t828r"; + mcuid = 36; ; #------------------------------------------------------------ @@ -7145,6 +7331,9 @@ part parent "t828" part desc = "ATtiny87"; id = "t87"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 27; + n_interrupts = 20; # no STK500 devcode in XML file, use the ATtiny45 one stk500_devcode = 0x14; # Try the AT90S2313 devcode: @@ -7269,6 +7458,9 @@ part part desc = "ATtiny167"; id = "t167"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 29; + n_interrupts = 20; # no STK500 devcode in XML file, use the ATtiny45 one stk500_devcode = 0x14; # avr910_devcode = 0x??; @@ -7394,6 +7586,9 @@ part part desc = "ATtiny48"; id = "t48"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 23; + n_interrupts = 20; stk500_devcode = 0x73; chip_erase_delay = 15000; pagel = 0xd7; @@ -7520,6 +7715,9 @@ part part desc = "ATtiny88"; id = "t88"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 28; + n_interrupts = 20; stk500_devcode = 0x73; chip_erase_delay = 9000; pagel = 0xd7; @@ -7646,6 +7844,9 @@ part part desc = "ATmega328"; id = "m328"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 118; + n_interrupts = 26; stk500_devcode = 0x86; chip_erase_delay = 9000; pagel = 0xd7; @@ -7772,6 +7973,7 @@ part part parent "m328" desc = "ATmega328P"; id = "m328p"; + mcuid = 119; signature = 0x1e 0x95 0x0f; ; @@ -7782,6 +7984,8 @@ part parent "m328" part parent "m328" desc = "ATmega328PB"; id = "m328pb"; + mcuid = 120; + n_interrupts = 45; chip_erase_delay = 10500; signature = 0x1e 0x95 0x16; @@ -7797,6 +8001,8 @@ part parent "m328" part parent "m328" desc = "ATmega32M1"; id = "m32m1"; + mcuid = 63; + n_interrupts = 31; bs2 = 0xe2; # stk500_devcode = 0x??; # avr910_devcode = 0x??; @@ -7814,6 +8020,8 @@ part parent "m328" part parent "m328" desc = "ATmega64M1"; id = "m64m1"; + mcuid = 76; + n_interrupts = 31; bs2 = 0xe2; # stk500_devcode = 0x??; # avr910_devcode = 0x??; @@ -7850,6 +8058,9 @@ part parent "m328" part desc = "ATtiny2313"; id = "t2313"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 42; + n_interrupts = 19; stk500_devcode = 0x23; # Use the ATtiny26 devcode: avr910_devcode = 0x5e; @@ -7981,6 +8192,8 @@ part part parent "t2313" desc = "ATtiny2313A"; id = "t2313a"; + mcuid = 43; + n_interrupts = 21; ; #------------------------------------------------------------ @@ -7990,6 +8203,9 @@ part parent "t2313" part desc = "ATtiny4313"; id = "t4313"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 44; + n_interrupts = 21; stk500_devcode = 0x23; # Use the ATtiny26 devcode: avr910_devcode = 0x5e; @@ -8116,6 +8332,9 @@ part part desc = "AT90PWM2"; id = "pwm2"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 167; + n_interrupts = 32; stk500_devcode = 0x65; chip_erase_delay = 9000; pagel = 0xd8; @@ -8242,6 +8461,7 @@ part part parent "pwm2" desc = "AT90PWM3"; id = "pwm3"; + mcuid = 169; ; #------------------------------------------------------------ @@ -8252,6 +8472,7 @@ part parent "pwm2" part parent "pwm2" desc = "AT90PWM2B"; id = "pwm2b"; + mcuid = 168; signature = 0x1e 0x93 0x83; ocdrev = 1; ; @@ -8265,6 +8486,7 @@ part parent "pwm2" part parent "pwm2b" desc = "AT90PWM3B"; id = "pwm3b"; + mcuid = 170; ; #------------------------------------------------------------ @@ -8276,6 +8498,7 @@ part parent "pwm2b" part parent "pwm3b" desc = "AT90PWM316"; id = "pwm316"; + mcuid = 180; signature = 0x1e 0x94 0x83; memory "flash" @@ -8299,6 +8522,7 @@ part parent "pwm3b" part parent "pwm316" desc = "AT90PWM216"; id = "pwm216"; + mcuid = 179; ; #------------------------------------------------------------ @@ -8308,6 +8532,9 @@ part parent "pwm316" part desc = "ATtiny25"; id = "t25"; + prog_modes = PM_SPM | PM_ISP | PM_HVSP | PM_debugWIRE; + mcuid = 16; + n_interrupts = 15; # no STK500 devcode in XML file, use the ATtiny45 one stk500_devcode = 0x14; # avr910_devcode = ?; @@ -8436,6 +8663,9 @@ part part desc = "ATtiny45"; id = "t45"; + prog_modes = PM_SPM | PM_ISP | PM_HVSP | PM_debugWIRE; + mcuid = 22; + n_interrupts = 15; stk500_devcode = 0x14; # avr910_devcode = ?; # Try the AT90S2313 devcode: @@ -8563,6 +8793,9 @@ part part desc = "ATtiny85"; id = "t85"; + prog_modes = PM_SPM | PM_ISP | PM_HVSP | PM_debugWIRE; + mcuid = 26; + n_interrupts = 15; # no STK500 devcode in XML file, use the ATtiny45 one stk500_devcode = 0x14; # avr910_devcode = ?; @@ -8692,6 +8925,9 @@ part part desc = "ATmega640"; id = "m640"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 126; + n_interrupts = 57; # stk500_devcode = 0xB2; # avr910_devcode = 0x43; chip_erase_delay = 9000; @@ -8813,6 +9049,9 @@ part part desc = "ATmega1280"; id = "m1280"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 138; + n_interrupts = 57; # stk500_devcode = 0xB2; # avr910_devcode = 0x43; chip_erase_delay = 9000; @@ -8935,6 +9174,8 @@ part part parent "m1280" desc = "ATmega1281"; id = "m1281"; + mcuid = 139; + n_interrupts = 51; signature = 0x1e 0x97 0x04; ; @@ -8945,6 +9186,9 @@ part parent "m1280" part desc = "ATmega2560"; id = "m2560"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 143; + n_interrupts = 57; stk500_devcode = 0xb2; # avr910_devcode = 0x43; chip_erase_delay = 9000; @@ -9067,6 +9311,8 @@ part part parent "m2560" desc = "ATmega2561"; id = "m2561"; + mcuid = 144; + n_interrupts = 51; signature = 0x1e 0x98 0x02; ; @@ -9078,6 +9324,8 @@ part parent "m2560" part parent "m2561" desc = "ATmega128RFA1"; id = "m128rfa1"; + mcuid = 87; + n_interrupts = 72; chip_erase_delay = 55000; bs2 = 0xe2; signature = 0x1e 0xa7 0x01; @@ -9100,6 +9348,8 @@ part parent "m2561" part parent "m2561" desc = "ATmega256RFR2"; id = "m256rfr2"; + mcuid = 108; + n_interrupts = 77; chip_erase_delay = 18500; bs2 = 0xe2; signature = 0x1e 0xa8 0x02; @@ -9121,6 +9371,8 @@ part parent "m2561" part parent "m128rfa1" desc = "ATmega128RFR2"; id = "m128rfr2"; + mcuid = 88; + n_interrupts = 77; signature = 0x1e 0xa7 0x02; ; @@ -9131,6 +9383,8 @@ part parent "m128rfa1" part parent "m128rfa1" desc = "ATmega64RFR2"; id = "m64rfr2"; + mcuid = 78; + n_interrupts = 77; signature = 0x1e 0xa6 0x02; memory "eeprom" @@ -9158,6 +9412,7 @@ part parent "m128rfa1" part parent "m256rfr2" desc = "ATmega2564RFR2"; id = "m2564rfr2"; + mcuid = 145; signature = 0x1e 0xa8 0x03; ; @@ -9168,6 +9423,7 @@ part parent "m256rfr2" part parent "m128rfr2" desc = "ATmega1284RFR2"; id = "m1284rfr2"; + mcuid = 142; signature = 0x1e 0xa7 0x03; ; @@ -9178,6 +9434,7 @@ part parent "m128rfr2" part parent "m64rfr2" desc = "ATmega644RFR2"; id = "m644rfr2"; + mcuid = 131; signature = 0x1e 0xa6 0x03; ; @@ -9188,6 +9445,9 @@ part parent "m64rfr2" part desc = "ATtiny24"; id = "t24"; + prog_modes = PM_SPM | PM_ISP | PM_HVSP | PM_debugWIRE; + mcuid = 14; + n_interrupts = 17; # no STK500 devcode in XML file, use the ATtiny45 one stk500_devcode = 0x14; # avr910_devcode = ?; @@ -9316,6 +9576,7 @@ part part parent "t24" desc = "ATtiny24A"; id = "t24a"; + mcuid = 15; ; #------------------------------------------------------------ @@ -9325,6 +9586,9 @@ part parent "t24" part desc = "ATtiny44"; id = "t44"; + prog_modes = PM_SPM | PM_ISP | PM_HVSP | PM_debugWIRE; + mcuid = 20; + n_interrupts = 17; # no STK500 devcode in XML file, use the ATtiny45 one stk500_devcode = 0x14; # avr910_devcode = ?; @@ -9453,6 +9717,7 @@ part part parent "t44" desc = "ATtiny44A"; id = "t44a"; + mcuid = 21; ; #------------------------------------------------------------ @@ -9462,6 +9727,9 @@ part parent "t44" part desc = "ATtiny84"; id = "t84"; + prog_modes = PM_SPM | PM_ISP | PM_HVSP | PM_debugWIRE; + mcuid = 24; + n_interrupts = 17; # no STK500 devcode in XML file, use the ATtiny45 one stk500_devcode = 0x14; # avr910_devcode = ?; @@ -9590,6 +9858,7 @@ part part parent "t84" desc = "ATtiny84A"; id = "t84a"; + mcuid = 25; ; #------------------------------------------------------------ @@ -9599,6 +9868,9 @@ part parent "t84" part parent "t44" desc = "ATtiny441"; id = "t441"; + mcuid = 32; + n_interrupts = 30; + n_page_erase = 4; signature = 0x1e 0x92 0x15; memory "flash" @@ -9622,6 +9894,9 @@ part parent "t44" part parent "t84" desc = "ATtiny841"; id = "t841"; + mcuid = 37; + n_interrupts = 30; + n_page_erase = 4; signature = 0x1e 0x93 0x15; memory "flash" @@ -9645,6 +9920,9 @@ part parent "t84" part desc = "ATtiny43U"; id = "t43u"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 19; + n_interrupts = 16; stk500_devcode = 0x14; # avr910_devcode = ?; # Try the AT90S2313 devcode: @@ -9772,6 +10050,9 @@ part part desc = "ATmega16U4"; id = "m16u4"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 57; + n_interrupts = 43; # stk500_devcode = 0xB2; # avr910_devcode = 0x43; chip_erase_delay = 9000; @@ -9894,6 +10175,9 @@ part part desc = "ATmega32U4"; id = "m32u4"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 65; + n_interrupts = 43; # stk500_devcode = 0xB2; # avr910_devcode = 0x43; chip_erase_delay = 9000; @@ -10016,6 +10300,9 @@ part part desc = "AT90USB646"; id = "usb646"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 181; + n_interrupts = 38; # stk500_devcode = 0xB2; # avr910_devcode = 0x43; chip_erase_delay = 9000; @@ -10139,6 +10426,7 @@ part part parent "usb646" desc = "AT90USB647"; id = "usb647"; + mcuid = 182; ; #------------------------------------------------------------ @@ -10148,6 +10436,9 @@ part parent "usb646" part desc = "AT90USB1286"; id = "usb1286"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 184; + n_interrupts = 38; # stk500_devcode = 0xB2; # avr910_devcode = 0x43; chip_erase_delay = 9000; @@ -10271,6 +10562,7 @@ part part parent "usb1286" desc = "AT90USB1287"; id = "usb1287"; + mcuid = 185; ; #------------------------------------------------------------ @@ -10280,6 +10572,9 @@ part parent "usb1286" part desc = "AT90USB162"; id = "usb162"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 178; + n_interrupts = 29; chip_erase_delay = 9000; pagel = 0xd7; bs2 = 0xc6; @@ -10398,6 +10693,9 @@ part part desc = "AT90USB82"; id = "usb82"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 174; + n_interrupts = 58; chip_erase_delay = 9000; pagel = 0xd7; bs2 = 0xc6; @@ -10516,6 +10814,9 @@ part part desc = "ATmega32U2"; id = "m32u2"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 64; + n_interrupts = 29; chip_erase_delay = 9000; pagel = 0xd7; bs2 = 0xc6; @@ -10634,6 +10935,9 @@ part part desc = "ATmega16U2"; id = "m16u2"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 56; + n_interrupts = 29; chip_erase_delay = 9000; pagel = 0xd7; bs2 = 0xc6; @@ -10752,6 +11056,9 @@ part part desc = "ATmega8U2"; id = "m8u2"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 48; + n_interrupts = 58; chip_erase_delay = 9000; pagel = 0xd7; bs2 = 0xc6; @@ -10870,6 +11177,9 @@ part part desc = "ATmega165"; id = "m165"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 95; + n_interrupts = 22; # stk500_devcode = 0x??; # avr910_devcode = 0x??; chip_erase_delay = 9000; @@ -10990,6 +11300,7 @@ part part parent "m165" desc = "ATmega165A"; id = "m165a"; + mcuid = 96; ; #------------------------------------------------------------ @@ -10999,6 +11310,7 @@ part parent "m165" part parent "m165" desc = "ATmega165P"; id = "m165p"; + mcuid = 97; signature = 0x1e 0x94 0x07; ; @@ -11009,6 +11321,7 @@ part parent "m165" part parent "m165" desc = "ATmega165PA"; id = "m165pa"; + mcuid = 98; signature = 0x1e 0x94 0x07; ; @@ -11019,6 +11332,9 @@ part parent "m165" part desc = "ATmega325"; id = "m325"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 114; + n_interrupts = 23; # stk500_devcode = 0x??; # No STK500v1 support? # avr910_devcode = 0x??; # Try the ATmega16 one avr910_devcode = 0x74; @@ -11142,6 +11458,7 @@ part part parent "m325" desc = "ATmega325A"; id = "m325a"; + mcuid = 115; ; #------------------------------------------------------------ @@ -11151,6 +11468,7 @@ part parent "m325" part parent "m325" desc = "ATmega325P"; id = "m325p"; + mcuid = 116; signature = 0x1e 0x95 0x0d; ; @@ -11161,6 +11479,8 @@ part parent "m325" part parent "m325" desc = "ATmega325PA"; id = "m325pa"; + mcuid = 117; + n_interrupts = 22; signature = 0x1e 0x95 0x0d; ; @@ -11171,6 +11491,9 @@ part parent "m325" part desc = "ATmega645"; id = "m645"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_JTAG; + mcuid = 132; + n_interrupts = 23; # stk500_devcode = 0x??; # No STK500v1 support? # avr910_devcode = 0x??; # Try the ATmega16 one avr910_devcode = 0x74; @@ -11294,6 +11617,7 @@ part part parent "m645" desc = "ATmega645A"; id = "m645a"; + mcuid = 133; ; #------------------------------------------------------------ @@ -11303,6 +11627,7 @@ part parent "m645" part parent "m645" desc = "ATmega645P"; id = "m645p"; + mcuid = 134; signature = 0x1e 0x96 0x0d; ; @@ -11313,6 +11638,8 @@ part parent "m645" part parent "m325" desc = "ATmega3250"; id = "m3250"; + mcuid = 146; + n_interrupts = 25; signature = 0x1e 0x95 0x06; ; @@ -11323,6 +11650,8 @@ part parent "m325" part parent "m325" desc = "ATmega3250A"; id = "m3250a"; + mcuid = 147; + n_interrupts = 25; signature = 0x1e 0x95 0x06; ; @@ -11333,6 +11662,8 @@ part parent "m325" part parent "m325" desc = "ATmega3250P"; id = "m3250p"; + mcuid = 148; + n_interrupts = 25; signature = 0x1e 0x95 0x0e; ; @@ -11343,6 +11674,8 @@ part parent "m325" part parent "m325" desc = "ATmega3250PA"; id = "m3250pa"; + mcuid = 149; + n_interrupts = 25; signature = 0x1e 0x95 0x0e; ; @@ -11353,6 +11686,8 @@ part parent "m325" part parent "m645" desc = "ATmega6450"; id = "m6450"; + mcuid = 154; + n_interrupts = 25; signature = 0x1e 0x96 0x06; ; @@ -11363,6 +11698,8 @@ part parent "m645" part parent "m645" desc = "ATmega6450A"; id = "m6450a"; + mcuid = 155; + n_interrupts = 25; signature = 0x1e 0x96 0x06; ; @@ -11373,6 +11710,8 @@ part parent "m645" part parent "m645" desc = "ATmega6450P"; id = "m6450p"; + mcuid = 156; + n_interrupts = 25; signature = 0x1e 0x96 0x0e; ; @@ -11383,6 +11722,7 @@ part parent "m645" part desc = "AVR XMEGA family common values"; id = ".xmega"; + prog_modes = PM_SPM | PM_PDI; has_pdi = yes; mcu_base = 0x0090; nvm_base = 0x01c0; @@ -11437,6 +11777,8 @@ part part parent ".xmega" desc = "ATxmega16A4U"; id = "x16a4u"; + mcuid = 232; + n_interrupts = 127; signature = 0x1e 0x94 0x41; usbpid = 0x2fe3; @@ -11490,6 +11832,7 @@ part parent ".xmega" part parent "x16a4u" desc = "ATxmega16C4"; id = "x16c4"; + mcuid = 233; signature = 0x1e 0x94 0x43; ; @@ -11500,6 +11843,8 @@ part parent "x16a4u" part parent "x16a4u" desc = "ATxmega16D4"; id = "x16d4"; + mcuid = 234; + n_interrupts = 91; signature = 0x1e 0x94 0x42; ; @@ -11510,6 +11855,8 @@ part parent "x16a4u" part parent "x16a4u" desc = "ATxmega16A4"; id = "x16a4"; + mcuid = 231; + n_interrupts = 94; memory "fuse0" size = 1; @@ -11524,6 +11871,8 @@ part parent "x16a4u" part parent ".xmega" desc = "ATxmega32A4U"; id = "x32a4u"; + mcuid = 239; + n_interrupts = 127; signature = 0x1e 0x95 0x41; usbpid = 0x2fe4; @@ -11577,6 +11926,7 @@ part parent ".xmega" part parent "x32a4u" desc = "ATxmega32C4"; id = "x32c4"; + mcuid = 240; signature = 0x1e 0x95 0x44; ; @@ -11587,6 +11937,8 @@ part parent "x32a4u" part parent "x32a4u" desc = "ATxmega32D4"; id = "x32d4"; + mcuid = 241; + n_interrupts = 91; signature = 0x1e 0x95 0x42; ; @@ -11597,6 +11949,8 @@ part parent "x32a4u" part parent "x32a4u" desc = "ATxmega32A4"; id = "x32a4"; + mcuid = 238; + n_interrupts = 94; memory "fuse0" size = 1; @@ -11611,6 +11965,8 @@ part parent "x32a4u" part parent ".xmega" desc = "ATxmega64A4U"; id = "x64a4u"; + mcuid = 252; + n_interrupts = 127; signature = 0x1e 0x96 0x46; usbpid = 0x2fe5; @@ -11664,6 +12020,7 @@ part parent ".xmega" part parent "x64a4u" desc = "ATxmega64C3"; id = "x64c3"; + mcuid = 249; signature = 0x1e 0x96 0x49; usbpid = 0x2fd6; ; @@ -11675,6 +12032,8 @@ part parent "x64a4u" part parent "x64a4u" desc = "ATxmega64D3"; id = "x64d3"; + mcuid = 250; + n_interrupts = 114; signature = 0x1e 0x96 0x4a; ; @@ -11685,6 +12044,8 @@ part parent "x64a4u" part parent "x64a4u" desc = "ATxmega64D4"; id = "x64d4"; + mcuid = 253; + n_interrupts = 91; signature = 0x1e 0x96 0x47; ; @@ -11695,6 +12056,9 @@ part parent "x64a4u" part parent "x64a4u" desc = "ATxmega64A1"; id = "x64a1"; + prog_modes = PM_SPM | PM_PDI | PM_JTAG; + mcuid = 243; + n_interrupts = 125; signature = 0x1e 0x96 0x4e; has_jtag = yes; @@ -11711,6 +12075,8 @@ part parent "x64a4u" part parent "x64a1" desc = "ATxmega64A1U"; id = "x64a1u"; + mcuid = 244; + n_interrupts = 127; usbpid = 0x2fe8; ; @@ -11721,6 +12087,8 @@ part parent "x64a1" part parent "x64a1" desc = "ATxmega64A3"; id = "x64a3"; + mcuid = 246; + n_interrupts = 122; signature = 0x1e 0x96 0x42; ; @@ -11731,6 +12099,8 @@ part parent "x64a1" part parent "x64a1" desc = "ATxmega64A3U"; id = "x64a3u"; + mcuid = 247; + n_interrupts = 127; signature = 0x1e 0x96 0x42; ; @@ -11741,6 +12111,7 @@ part parent "x64a1" part parent "x64a1" desc = "ATxmega64A4"; id = "x64a4"; + mcuid = 251; signature = 0x1e 0x96 0x46; ; @@ -11751,6 +12122,8 @@ part parent "x64a1" part parent "x64a1" desc = "ATxmega64B1"; id = "x64b1"; + mcuid = 245; + n_interrupts = 81; signature = 0x1e 0x96 0x52; usbpid = 0x2fe1; ; @@ -11762,6 +12135,8 @@ part parent "x64a1" part parent "x64a1" desc = "ATxmega64B3"; id = "x64b3"; + mcuid = 248; + n_interrupts = 54; signature = 0x1e 0x96 0x51; usbpid = 0x2fdf; ; @@ -11773,6 +12148,8 @@ part parent "x64a1" part parent ".xmega" desc = "ATxmega128C3"; id = "x128c3"; + mcuid = 261; + n_interrupts = 127; signature = 0x1e 0x97 0x52; usbpid = 0x2fd7; @@ -11826,6 +12203,8 @@ part parent ".xmega" part parent "x128c3" desc = "ATxmega128D3"; id = "x128d3"; + mcuid = 262; + n_interrupts = 114; signature = 0x1e 0x97 0x48; ; @@ -11836,6 +12215,8 @@ part parent "x128c3" part parent "x128c3" desc = "ATxmega128D4"; id = "x128d4"; + mcuid = 265; + n_interrupts = 91; signature = 0x1e 0x97 0x47; memory "flash" @@ -11850,6 +12231,9 @@ part parent "x128c3" part parent "x128c3" desc = "ATxmega128A1"; id = "x128a1"; + prog_modes = PM_SPM | PM_PDI | PM_JTAG; + mcuid = 254; + n_interrupts = 125; signature = 0x1e 0x97 0x4c; has_jtag = yes; @@ -11866,6 +12250,7 @@ part parent "x128c3" part parent "x128a1" desc = "ATxmega128A1revD"; id = "x128a1d"; + mcuid = 255; signature = 0x1e 0x97 0x41; ; @@ -11876,6 +12261,8 @@ part parent "x128a1" part parent "x128a1" desc = "ATxmega128A1U"; id = "x128a1u"; + mcuid = 256; + n_interrupts = 127; usbpid = 0x2fed; ; @@ -11886,6 +12273,8 @@ part parent "x128a1" part parent "x128a1" desc = "ATxmega128A3"; id = "x128a3"; + mcuid = 258; + n_interrupts = 122; signature = 0x1e 0x97 0x42; ; @@ -11896,6 +12285,8 @@ part parent "x128a1" part parent "x128a1" desc = "ATxmega128A3U"; id = "x128a3u"; + mcuid = 259; + n_interrupts = 127; signature = 0x1e 0x97 0x42; usbpid = 0x2fe6; ; @@ -11907,6 +12298,8 @@ part parent "x128a1" part parent ".xmega" desc = "ATxmega128A4"; id = "x128a4"; + prog_modes = PM_SPM | PM_PDI | PM_JTAG; + mcuid = 263; signature = 0x1e 0x97 0x46; has_jtag = yes; @@ -11965,6 +12358,8 @@ part parent ".xmega" part parent ".xmega" desc = "ATxmega128A4U"; id = "x128a4u"; + mcuid = 264; + n_interrupts = 127; signature = 0x1e 0x97 0x46; usbpid = 0x2fde; @@ -12018,6 +12413,9 @@ part parent ".xmega" part parent ".xmega" desc = "ATxmega128B1"; id = "x128b1"; + prog_modes = PM_SPM | PM_PDI | PM_JTAG; + mcuid = 257; + n_interrupts = 81; signature = 0x1e 0x97 0x4d; usbpid = 0x2fea; has_jtag = yes; @@ -12077,6 +12475,8 @@ part parent ".xmega" part parent "x128b1" desc = "ATxmega128B3"; id = "x128b3"; + mcuid = 260; + n_interrupts = 54; signature = 0x1e 0x97 0x4b; usbpid = 0x2fe0; ; @@ -12088,6 +12488,8 @@ part parent "x128b1" part parent ".xmega" desc = "ATxmega192C3"; id = "x192c3"; + mcuid = 269; + n_interrupts = 127; signature = 0x1e 0x97 0x51; # usbpid = 0x2f??; @@ -12141,6 +12543,8 @@ part parent ".xmega" part parent "x192c3" desc = "ATxmega192D3"; id = "x192d3"; + mcuid = 270; + n_interrupts = 114; signature = 0x1e 0x97 0x49; ; @@ -12151,6 +12555,8 @@ part parent "x192c3" part parent "x192c3" desc = "ATxmega192A1"; id = "x192a1"; + prog_modes = PM_SPM | PM_PDI | PM_JTAG; + mcuid = 266; signature = 0x1e 0x97 0x4e; has_jtag = yes; @@ -12167,6 +12573,8 @@ part parent "x192c3" part parent "x192a1" desc = "ATxmega192A3"; id = "x192a3"; + mcuid = 267; + n_interrupts = 122; signature = 0x1e 0x97 0x44; ; @@ -12177,6 +12585,7 @@ part parent "x192a1" part parent "x192a1" desc = "ATxmega192A3U"; id = "x192a3u"; + mcuid = 268; signature = 0x1e 0x97 0x44; usbpid = 0x2fe7; ; @@ -12188,6 +12597,8 @@ part parent "x192a1" part parent ".xmega" desc = "ATxmega256C3"; id = "x256c3"; + mcuid = 276; + n_interrupts = 127; signature = 0x1e 0x98 0x46; usbpid = 0x2fda; @@ -12241,6 +12652,8 @@ part parent ".xmega" part parent "x256c3" desc = "ATxmega256D3"; id = "x256d3"; + mcuid = 277; + n_interrupts = 114; signature = 0x1e 0x98 0x44; ; @@ -12251,6 +12664,8 @@ part parent "x256c3" part parent "x256c3" desc = "ATxmega256A1"; id = "x256a1"; + prog_modes = PM_SPM | PM_PDI | PM_JTAG; + mcuid = 271; has_jtag = yes; memory "fuse0" @@ -12266,6 +12681,8 @@ part parent "x256c3" part parent "x256a1" desc = "ATxmega256A3"; id = "x256a3"; + mcuid = 272; + n_interrupts = 122; signature = 0x1e 0x98 0x42; ; @@ -12276,6 +12693,7 @@ part parent "x256a1" part parent "x256a1" desc = "ATxmega256A3U"; id = "x256a3u"; + mcuid = 275; signature = 0x1e 0x98 0x42; usbpid = 0x2fec; ; @@ -12287,6 +12705,8 @@ part parent "x256a1" part parent "x256a1" desc = "ATxmega256A3B"; id = "x256a3b"; + mcuid = 273; + n_interrupts = 122; signature = 0x1e 0x98 0x43; ; @@ -12297,6 +12717,7 @@ part parent "x256a1" part parent "x256a1" desc = "ATxmega256A3BU"; id = "x256a3bu"; + mcuid = 274; signature = 0x1e 0x98 0x43; usbpid = 0x2fe2; ; @@ -12308,6 +12729,8 @@ part parent "x256a1" part parent ".xmega" desc = "ATxmega384C3"; id = "x384c3"; + mcuid = 278; + n_interrupts = 127; signature = 0x1e 0x98 0x45; usbpid = 0x2fdb; @@ -12361,6 +12784,8 @@ part parent ".xmega" part parent "x384c3" desc = "ATxmega384D3"; id = "x384d3"; + mcuid = 279; + n_interrupts = 114; signature = 0x1e 0x98 0x47; ; @@ -12371,6 +12796,8 @@ part parent "x384c3" part parent ".xmega" desc = "ATxmega8E5"; id = "x8e5"; + mcuid = 230; + n_interrupts = 43; signature = 0x1e 0x93 0x41; memory "eeprom" @@ -12423,6 +12850,8 @@ part parent ".xmega" part parent ".xmega" desc = "ATxmega16E5"; id = "x16e5"; + mcuid = 235; + n_interrupts = 43; signature = 0x1e 0x94 0x45; memory "eeprom" @@ -12475,6 +12904,8 @@ part parent ".xmega" part parent ".xmega" desc = "ATxmega32E5"; id = "x32e5"; + mcuid = 242; + n_interrupts = 43; signature = 0x1e 0x95 0x4c; memory "eeprom" @@ -12527,6 +12958,7 @@ part parent ".xmega" part desc = "AT32UC3A0512"; id = "uc3a0512"; + prog_modes = PM_JTAG | PM_aWire; signature = 0xed 0xc0 0x3f; has_jtag = yes; is_avr32 = yes; @@ -12557,6 +12989,10 @@ part parent "uc3a0512" part desc = "ATtiny1634"; id = "t1634"; + prog_modes = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE; + mcuid = 40; + n_interrupts = 28; + n_page_erase = 4; stk500_devcode = 0x86; chip_erase_delay = 9000; pagel = 0xb3; @@ -12681,6 +13117,7 @@ part part parent "t1634" desc = "ATtiny1634R"; id = "t1634r"; + mcuid = 41; ; #------------------------------------------------------------ @@ -12690,6 +13127,7 @@ part parent "t1634" part desc = "Common values for reduced core tinys"; id = ".reduced_core_tiny"; + prog_modes = PM_TPI; has_tpi = yes; memory "fuse" @@ -12731,6 +13169,7 @@ part part parent ".reduced_core_tiny" desc = "ATtiny4"; id = "t4"; + n_interrupts = 10; signature = 0x1e 0x8f 0x0a; memory "flash" @@ -12748,6 +13187,8 @@ part parent ".reduced_core_tiny" part parent "t4" desc = "ATtiny5"; id = "t5"; + mcuid = 1; + n_interrupts = 11; signature = 0x1e 0x8f 0x09; ; @@ -12758,6 +13199,8 @@ part parent "t4" part parent ".reduced_core_tiny" desc = "ATtiny9"; id = "t9"; + mcuid = 2; + n_interrupts = 10; signature = 0x1e 0x90 0x08; memory "flash" @@ -12775,6 +13218,8 @@ part parent ".reduced_core_tiny" part parent "t9" desc = "ATtiny10"; id = "t10"; + mcuid = 3; + n_interrupts = 11; signature = 0x1e 0x90 0x03; ; @@ -12785,6 +13230,8 @@ part parent "t9" part parent ".reduced_core_tiny" desc = "ATtiny20"; id = "t20"; + mcuid = 4; + n_interrupts = 17; signature = 0x1e 0x91 0x0f; memory "flash" @@ -12802,6 +13249,8 @@ part parent ".reduced_core_tiny" part parent ".reduced_core_tiny" desc = "ATtiny40"; id = "t40"; + mcuid = 5; + n_interrupts = 18; signature = 0x1e 0x92 0x0e; memory "flash" @@ -12819,6 +13268,7 @@ part parent ".reduced_core_tiny" part parent ".reduced_core_tiny" desc = "ATtiny102"; id = "t102"; + mcuid = 6; signature = 0x1e 0x90 0x0c; memory "flash" @@ -12836,6 +13286,7 @@ part parent ".reduced_core_tiny" part parent ".reduced_core_tiny" desc = "ATtiny104"; id = "t104"; + mcuid = 7; signature = 0x1e 0x90 0x0b; memory "flash" @@ -12853,6 +13304,9 @@ part parent ".reduced_core_tiny" part desc = "ATmega406"; id = "m406"; + prog_modes = PM_SPM | PM_HVPP | PM_JTAG; + mcuid = 125; + n_interrupts = 23; # STK500 parameters (parallel programming IO lines) pagel = 0xa7; bs2 = 0xa0; @@ -12915,6 +13369,7 @@ part part desc = "AVR8X family common values"; id = ".avr8x"; + prog_modes = PM_SPM | PM_UPDI; has_updi = yes; nvm_base = 0x1000; ocd_base = 0x0f80; @@ -13128,6 +13583,8 @@ part parent ".avr8x" part parent ".avr8x_tiny" desc = "ATtiny202"; id = "t202"; + mcuid = 280; + n_interrupts = 26; signature = 0x1e 0x91 0x23; memory "eeprom" @@ -13152,6 +13609,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny204"; id = "t204"; + mcuid = 281; + n_interrupts = 26; signature = 0x1e 0x91 0x22; memory "eeprom" @@ -13176,6 +13635,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny402"; id = "t402"; + mcuid = 284; + n_interrupts = 26; signature = 0x1e 0x92 0x27; memory "eeprom" @@ -13200,6 +13661,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny404"; id = "t404"; + mcuid = 285; + n_interrupts = 26; signature = 0x1e 0x92 0x26; memory "eeprom" @@ -13224,6 +13687,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny406"; id = "t406"; + mcuid = 286; + n_interrupts = 26; signature = 0x1e 0x92 0x25; memory "eeprom" @@ -13248,6 +13713,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny804"; id = "t804"; + mcuid = 295; + n_interrupts = 31; signature = 0x1e 0x93 0x25; memory "eeprom" @@ -13272,6 +13739,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny806"; id = "t806"; + mcuid = 296; + n_interrupts = 31; signature = 0x1e 0x93 0x24; memory "eeprom" @@ -13296,6 +13765,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny807"; id = "t807"; + mcuid = 297; + n_interrupts = 31; signature = 0x1e 0x93 0x23; memory "eeprom" @@ -13320,6 +13791,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny1604"; id = "t1604"; + mcuid = 304; + n_interrupts = 31; signature = 0x1e 0x94 0x25; memory "eeprom" @@ -13344,6 +13817,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny1606"; id = "t1606"; + mcuid = 305; + n_interrupts = 31; signature = 0x1e 0x94 0x24; memory "eeprom" @@ -13368,6 +13843,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny1607"; id = "t1607"; + mcuid = 306; + n_interrupts = 31; signature = 0x1e 0x94 0x23; memory "eeprom" @@ -13392,6 +13869,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny212"; id = "t212"; + mcuid = 282; + n_interrupts = 26; signature = 0x1e 0x91 0x21; memory "eeprom" @@ -13416,6 +13895,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny214"; id = "t214"; + mcuid = 283; + n_interrupts = 26; signature = 0x1e 0x91 0x20; memory "eeprom" @@ -13440,6 +13921,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny412"; id = "t412"; + mcuid = 287; + n_interrupts = 26; signature = 0x1e 0x92 0x23; memory "eeprom" @@ -13464,6 +13947,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny414"; id = "t414"; + mcuid = 288; + n_interrupts = 26; signature = 0x1e 0x92 0x22; memory "eeprom" @@ -13488,6 +13973,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny416"; id = "t416"; + mcuid = 289; + n_interrupts = 26; signature = 0x1e 0x92 0x21; memory "eeprom" @@ -13512,6 +13999,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny417"; id = "t417"; + mcuid = 291; + n_interrupts = 26; signature = 0x1e 0x92 0x20; memory "eeprom" @@ -13536,6 +14025,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny814"; id = "t814"; + mcuid = 298; + n_interrupts = 26; signature = 0x1e 0x93 0x22; memory "eeprom" @@ -13560,6 +14051,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny816"; id = "t816"; + mcuid = 299; + n_interrupts = 26; signature = 0x1e 0x93 0x21; memory "eeprom" @@ -13584,6 +14077,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny817"; id = "t817"; + mcuid = 300; + n_interrupts = 26; signature = 0x1e 0x93 0x20; memory "eeprom" @@ -13608,6 +14103,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny1614"; id = "t1614"; + mcuid = 307; + n_interrupts = 31; signature = 0x1e 0x94 0x22; memory "eeprom" @@ -13632,6 +14129,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny1616"; id = "t1616"; + mcuid = 308; + n_interrupts = 31; signature = 0x1e 0x94 0x21; memory "eeprom" @@ -13656,6 +14155,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny1617"; id = "t1617"; + mcuid = 309; + n_interrupts = 31; signature = 0x1e 0x94 0x20; memory "eeprom" @@ -13680,6 +14181,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny3216"; id = "t3216"; + mcuid = 314; + n_interrupts = 31; signature = 0x1e 0x95 0x21; memory "eeprom" @@ -13704,6 +14207,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny3217"; id = "t3217"; + mcuid = 315; + n_interrupts = 31; signature = 0x1e 0x95 0x22; memory "eeprom" @@ -13728,6 +14233,7 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny424"; id = "t424"; + mcuid = 292; signature = 0x1e 0x92 0x2c; memory "eeprom" @@ -13752,6 +14258,7 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny426"; id = "t426"; + mcuid = 293; signature = 0x1e 0x92 0x2b; memory "eeprom" @@ -13776,6 +14283,7 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny427"; id = "t427"; + mcuid = 294; signature = 0x1e 0x92 0x2a; memory "eeprom" @@ -13800,6 +14308,7 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny824"; id = "t824"; + mcuid = 301; signature = 0x1e 0x93 0x29; memory "eeprom" @@ -13824,6 +14333,7 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny826"; id = "t826"; + mcuid = 302; signature = 0x1e 0x93 0x28; memory "eeprom" @@ -13848,6 +14358,7 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny827"; id = "t827"; + mcuid = 303; signature = 0x1e 0x93 0x27; memory "eeprom" @@ -13872,6 +14383,7 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny1624"; id = "t1624"; + mcuid = 310; signature = 0x1e 0x94 0x2a; memory "eeprom" @@ -13896,6 +14408,7 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny1626"; id = "t1626"; + mcuid = 311; signature = 0x1e 0x94 0x29; memory "eeprom" @@ -13920,6 +14433,7 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny1627"; id = "t1627"; + mcuid = 312; signature = 0x1e 0x94 0x28; memory "eeprom" @@ -13944,6 +14458,7 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny3224"; id = "t3224"; + mcuid = 316; signature = 0x1e 0x95 0x28; memory "eeprom" @@ -13968,6 +14483,7 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny3226"; id = "t3226"; + mcuid = 317; signature = 0x1e 0x95 0x27; memory "eeprom" @@ -13992,6 +14508,7 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATtiny3227"; id = "t3227"; + mcuid = 318; signature = 0x1e 0x95 0x26; memory "eeprom" @@ -14016,6 +14533,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATmega808"; id = "m808"; + mcuid = 319; + n_interrupts = 36; signature = 0x1e 0x93 0x26; memory "eeprom" @@ -14040,6 +14559,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATmega809"; id = "m809"; + mcuid = 320; + n_interrupts = 40; signature = 0x1e 0x93 0x2a; memory "eeprom" @@ -14064,6 +14585,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATmega1608"; id = "m1608"; + mcuid = 321; + n_interrupts = 36; signature = 0x1e 0x94 0x27; memory "eeprom" @@ -14088,6 +14611,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_tiny" desc = "ATmega1609"; id = "m1609"; + mcuid = 322; + n_interrupts = 40; signature = 0x1e 0x94 0x26; memory "eeprom" @@ -14112,6 +14637,8 @@ part parent ".avr8x_tiny" part parent ".avr8x_mega" desc = "ATmega3208"; id = "m3208"; + mcuid = 323; + n_interrupts = 36; signature = 0x1e 0x95 0x30; memory "eeprom" @@ -14136,6 +14663,8 @@ part parent ".avr8x_mega" part parent ".avr8x_mega" desc = "ATmega3209"; id = "m3209"; + mcuid = 324; + n_interrupts = 40; signature = 0x1e 0x95 0x31; memory "eeprom" @@ -14160,6 +14689,8 @@ part parent ".avr8x_mega" part parent ".avr8x_mega" desc = "ATmega4808"; id = "m4808"; + mcuid = 325; + n_interrupts = 36; signature = 0x1e 0x96 0x50; memory "eeprom" @@ -14184,6 +14715,8 @@ part parent ".avr8x_mega" part parent ".avr8x_mega" desc = "ATmega4809"; id = "m4809"; + mcuid = 326; + n_interrupts = 40; signature = 0x1e 0x96 0x51; memory "eeprom" @@ -14208,6 +14741,7 @@ part parent ".avr8x_mega" part desc = "AVR-Dx family common values"; id = ".avrdx"; + prog_modes = PM_SPM | PM_UPDI; # Dedicated UPDI pin, no HV hvupdi_variant = 1; has_updi = yes; @@ -14364,6 +14898,7 @@ part part parent ".avrdx" desc = "AVR32DA28"; id = "avr32da28"; + mcuid = 338; signature = 0x1e 0x95 0x34; memory "eeprom" @@ -14387,6 +14922,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR32DA32"; id = "avr32da32"; + mcuid = 342; signature = 0x1e 0x95 0x33; memory "eeprom" @@ -14410,6 +14946,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR32DA48"; id = "avr32da48"; + mcuid = 346; signature = 0x1e 0x95 0x32; memory "eeprom" @@ -14433,6 +14970,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR64DA28"; id = "avr64da28"; + mcuid = 351; signature = 0x1e 0x96 0x15; memory "eeprom" @@ -14456,6 +14994,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR64DA32"; id = "avr64da32"; + mcuid = 355; signature = 0x1e 0x96 0x14; memory "eeprom" @@ -14479,6 +15018,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR64DA48"; id = "avr64da48"; + mcuid = 359; signature = 0x1e 0x96 0x13; memory "eeprom" @@ -14502,6 +15042,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR64DA64"; id = "avr64da64"; + mcuid = 362; signature = 0x1e 0x96 0x12; memory "eeprom" @@ -14525,6 +15066,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR128DA28"; id = "avr128da28"; + mcuid = 364; signature = 0x1e 0x97 0x0a; memory "eeprom" @@ -14548,6 +15090,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR128DA32"; id = "avr128da32"; + mcuid = 366; signature = 0x1e 0x97 0x09; memory "eeprom" @@ -14571,6 +15114,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR128DA48"; id = "avr128da48"; + mcuid = 368; signature = 0x1e 0x97 0x08; memory "eeprom" @@ -14594,6 +15138,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR128DA64"; id = "avr128da64"; + mcuid = 370; signature = 0x1e 0x97 0x07; memory "eeprom" @@ -14617,6 +15162,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR32DB28"; id = "avr32db28"; + mcuid = 339; signature = 0x1e 0x95 0x37; memory "eeprom" @@ -14640,6 +15186,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR32DB32"; id = "avr32db32"; + mcuid = 343; signature = 0x1e 0x95 0x36; memory "eeprom" @@ -14663,6 +15210,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR32DB48"; id = "avr32db48"; + mcuid = 347; signature = 0x1e 0x95 0x35; memory "eeprom" @@ -14686,6 +15234,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR64DB28"; id = "avr64db28"; + mcuid = 352; signature = 0x1e 0x96 0x19; memory "eeprom" @@ -14709,6 +15258,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR64DB32"; id = "avr64db32"; + mcuid = 356; signature = 0x1e 0x96 0x18; memory "eeprom" @@ -14732,6 +15282,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR64DB48"; id = "avr64db48"; + mcuid = 360; signature = 0x1e 0x96 0x17; memory "eeprom" @@ -14755,6 +15306,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR64DB64"; id = "avr64db64"; + mcuid = 363; signature = 0x1e 0x96 0x16; memory "eeprom" @@ -14778,6 +15330,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR128DB28"; id = "avr128db28"; + mcuid = 365; signature = 0x1e 0x97 0x0e; memory "eeprom" @@ -14801,6 +15354,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR128DB32"; id = "avr128db32"; + mcuid = 367; signature = 0x1e 0x97 0x0d; memory "eeprom" @@ -14824,6 +15378,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR128DB48"; id = "avr128db48"; + mcuid = 369; signature = 0x1e 0x97 0x0c; memory "eeprom" @@ -14847,6 +15402,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR128DB64"; id = "avr128db64"; + mcuid = 371; signature = 0x1e 0x97 0x0b; memory "eeprom" @@ -14870,6 +15426,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR16DD14"; id = "avr16dd14"; + mcuid = 329; hvupdi_variant = 2; signature = 0x1e 0x94 0x34; @@ -14894,6 +15451,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR16DD20"; id = "avr16dd20"; + mcuid = 330; hvupdi_variant = 2; signature = 0x1e 0x94 0x33; @@ -14918,6 +15476,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR16DD28"; id = "avr16dd28"; + mcuid = 331; hvupdi_variant = 2; signature = 0x1e 0x94 0x32; @@ -14942,6 +15501,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR16DD32"; id = "avr16dd32"; + mcuid = 333; hvupdi_variant = 2; signature = 0x1e 0x94 0x31; @@ -14966,6 +15526,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR32DD14"; id = "avr32dd14"; + mcuid = 336; hvupdi_variant = 2; signature = 0x1e 0x95 0x3b; @@ -14990,6 +15551,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR32DD20"; id = "avr32dd20"; + mcuid = 337; hvupdi_variant = 2; signature = 0x1e 0x95 0x3a; @@ -15014,6 +15576,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR32DD28"; id = "avr32dd28"; + mcuid = 340; hvupdi_variant = 2; signature = 0x1e 0x95 0x39; @@ -15038,6 +15601,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR32DD32"; id = "avr32dd32"; + mcuid = 344; hvupdi_variant = 2; signature = 0x1e 0x95 0x38; @@ -15062,6 +15626,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR64DD14"; id = "avr64dd14"; + mcuid = 349; hvupdi_variant = 2; signature = 0x1e 0x96 0x1d; @@ -15086,6 +15651,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR64DD20"; id = "avr64dd20"; + mcuid = 350; hvupdi_variant = 2; signature = 0x1e 0x96 0x1c; @@ -15110,6 +15676,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR64DD28"; id = "avr64dd28"; + mcuid = 353; hvupdi_variant = 2; signature = 0x1e 0x96 0x1b; @@ -15134,6 +15701,7 @@ part parent ".avrdx" part parent ".avrdx" desc = "AVR64DD32"; id = "avr64dd32"; + mcuid = 357; hvupdi_variant = 2; signature = 0x1e 0x96 0x1a; @@ -15179,6 +15747,7 @@ part parent ".avrdx" part parent ".avrex" desc = "AVR8EA28"; id = "avr8ea28"; + mcuid = 327; signature = 0x1e 0x93 0x2c; memory "eeprom" @@ -15203,6 +15772,7 @@ part parent ".avrex" part parent ".avrex" desc = "AVR8EA32"; id = "avr8ea32"; + mcuid = 328; signature = 0x1e 0x93 0x2b; memory "eeprom" @@ -15227,6 +15797,7 @@ part parent ".avrex" part parent ".avrex" desc = "AVR16EA28"; id = "avr16ea28"; + mcuid = 332; signature = 0x1e 0x94 0x37; memory "eeprom" @@ -15251,6 +15822,7 @@ part parent ".avrex" part parent ".avrex" desc = "AVR16EA32"; id = "avr16ea32"; + mcuid = 334; signature = 0x1e 0x94 0x36; memory "eeprom" @@ -15275,6 +15847,7 @@ part parent ".avrex" part parent ".avrex" desc = "AVR16EA48"; id = "avr16ea48"; + mcuid = 335; signature = 0x1e 0x94 0x35; memory "eeprom" @@ -15299,6 +15872,7 @@ part parent ".avrex" part parent ".avrex" desc = "AVR32EA28"; id = "avr32ea28"; + mcuid = 341; signature = 0x1e 0x95 0x3e; memory "eeprom" @@ -15323,6 +15897,7 @@ part parent ".avrex" part parent ".avrex" desc = "AVR32EA32"; id = "avr32ea32"; + mcuid = 345; signature = 0x1e 0x95 0x3d; memory "eeprom" @@ -15347,6 +15922,7 @@ part parent ".avrex" part parent ".avrex" desc = "AVR32EA48"; id = "avr32ea48"; + mcuid = 348; signature = 0x1e 0x95 0x3c; memory "eeprom" @@ -15371,6 +15947,7 @@ part parent ".avrex" part parent ".avrex" desc = "AVR64EA28"; id = "avr64ea28"; + mcuid = 354; signature = 0x1e 0x96 0x20; memory "eeprom" @@ -15395,6 +15972,7 @@ part parent ".avrex" part parent ".avrex" desc = "AVR64EA32"; id = "avr64ea32"; + mcuid = 358; signature = 0x1e 0x96 0x1f; memory "eeprom" @@ -15419,6 +15997,7 @@ part parent ".avrex" part parent ".avrex" desc = "AVR64EA48"; id = "avr64ea48"; + mcuid = 361; signature = 0x1e 0x96 0x1e; memory "eeprom" @@ -15443,6 +16022,7 @@ part parent ".avrex" part parent "m88" desc = "LGT8F88P"; id = "lgt8f88p"; + mcuid = 227; signature = 0x1e 0x93 0x0f; ; @@ -15453,6 +16033,7 @@ part parent "m88" part parent "m168" desc = "LGT8F168P"; id = "lgt8f168p"; + mcuid = 228; signature = 0x1e 0x94 0x0b; ; @@ -15463,5 +16044,6 @@ part parent "m168" part parent "m328" desc = "LGT8F328P"; id = "lgt8f328p"; + mcuid = 229; signature = 0x1e 0x95 0x0f; ; From 0756b8e3adf26fb97ef7f81ca2ce4162127c5e5c Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 30 Aug 2022 02:49:37 +0100 Subject: [PATCH 222/511] Declare rather than define current_strct in header config.h --- src/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.h b/src/config.h index 42b6219b..e92400b6 100644 --- a/src/config.h +++ b/src/config.h @@ -94,7 +94,7 @@ extern FILE * yyin; extern PROGRAMMER * current_prog; extern AVRPART * current_part; extern AVRMEM * current_mem; -int current_strct; +extern int current_strct; extern int cfg_lineno; extern char * cfg_infile; extern LISTID string_list; From b0198a319f13a8ce6f3e354562acd5189cd9e659 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 30 Aug 2022 16:33:42 +0100 Subject: [PATCH 223/511] Offload the programming interface info from part->flags to part->prog_modes flags now just hold parameters of the JTAG interface and some secondary serial, parallel, pseudo parallel info. This separation brings clarity. It used to be hard to augur whether a part has an ISP interface: (part->flags & (AVRPART_HAS_PDI | AVRPART_AVR32 | AVRPART_HAS_TPI | AVRPART_HAS_UPDI)) == 0 && (part->flags & AVRPART_SERIALOK) != 0 or had HVSP or HVPP capability, for that matter. Now it is just, eg, part->prog_modes & PM_ISP part->prog_modes & PM_HVPP --- src/avr.c | 17 +++++------ src/avrftdi.c | 4 +-- src/bitbang.c | 8 ++--- src/config_gram.y | 42 ++++++++------------------ src/developer_opts.c | 25 ++++++++------- src/fileio.c | 17 +++-------- src/flip1.c | 2 +- src/flip2.c | 2 +- src/ft245r.c | 6 ++-- src/jtag3.c | 72 +++++++++++++++++++++----------------------- src/jtagmkI.c | 2 +- src/jtagmkII.c | 63 ++++++++++++++++++-------------------- src/libavrdude.h | 20 +++++------- src/linuxspi.c | 4 +-- src/main.c | 11 +++---- src/stk500v2.c | 28 ++++++++--------- src/usbasp.c | 2 +- src/usbtiny.c | 6 ++-- 18 files changed, 144 insertions(+), 187 deletions(-) diff --git a/src/avr.c b/src/avr.c index 7a1f34a6..7bfa1496 100644 --- a/src/avr.c +++ b/src/avr.c @@ -52,7 +52,7 @@ int avr_tpi_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { int err; AVRMEM *mem; - if (p->flags & AVRPART_HAS_TPI) { + if (p->prog_modes & PM_TPI) { pgm->pgm_led(pgm, ON); /* Set Pointer Register */ @@ -102,7 +102,7 @@ int avr_tpi_program_enable(const PROGRAMMER *pgm, const AVRPART *p, unsigned cha unsigned char cmd[2]; unsigned char response; - if(p->flags & AVRPART_HAS_TPI) { + if(p->prog_modes & PM_TPI) { /* set guard time */ cmd[0] = (TPI_CMD_SSTCS | TPI_REG_TPIPCR); cmd[1] = guard_time; @@ -194,7 +194,7 @@ int avr_read_byte_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM pgm->pgm_led(pgm, ON); pgm->err_led(pgm, OFF); - if (p->flags & AVRPART_HAS_TPI) { + if (p->prog_modes & PM_TPI) { if (pgm->cmd_tpi == NULL) { avrdude_message(MSG_INFO, "%s: Error: %s programmer does not support TPI\n", progname, pgm->type); @@ -342,7 +342,7 @@ int avr_read(const PROGRAMMER *pgm, const AVRPART *p, const char *memtype, memset(mem->buf, 0xff, mem->size); /* supports "paged load" thru post-increment */ - if ((p->flags & AVRPART_HAS_TPI) && mem->page_size > 1 && + if ((p->prog_modes & PM_TPI) && mem->page_size > 1 && mem->size % mem->page_size == 0 && pgm->cmd_tpi != NULL) { while (avr_tpi_poll_nvmbsy(pgm)); @@ -550,7 +550,7 @@ int avr_write_byte_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM return -1; } - if (p->flags & AVRPART_HAS_TPI) { + if (p->prog_modes & PM_TPI) { if (pgm->cmd_tpi == NULL) { avrdude_message(MSG_INFO, "%s: Error: %s programmer does not support TPI\n", progname, pgm->type); @@ -596,8 +596,7 @@ int avr_write_byte_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM return 0; } - if (!mem->paged && - (p->flags & AVRPART_IS_AT90S1200) == 0) { + if (!mem->paged && (p->flags & AVRPART_IS_AT90S1200) == 0) { /* * check to see if the write is necessary by reading the existing * value and only write if we are changing the value; we can't @@ -839,9 +838,7 @@ int avr_write(const PROGRAMMER *pgm, const AVRPART *p, const char *memtype, } - if ((p->flags & AVRPART_HAS_TPI) && m->page_size > 1 && - pgm->cmd_tpi != NULL) { - + if ((p->prog_modes & PM_TPI) && m->page_size > 1 && pgm->cmd_tpi) { if (wsize == 1) { /* fuse (configuration) memory: only single byte to write */ return avr_write_byte(pgm, p, m, 0, m->buf[0]) == 0? 1: -1; diff --git a/src/avrftdi.c b/src/avrftdi.c index e80df3c0..febc4005 100644 --- a/src/avrftdi.c +++ b/src/avrftdi.c @@ -267,7 +267,7 @@ static void avrftdi_enable(PROGRAMMER *pgm, const AVRPART *p) { set_pin(pgm, PPI_AVR_BUFF, ON); // Switch to TPI initialisation in avrftdi_tpi.c - if(p->flags & AVRPART_HAS_TPI) + if(p->prog_modes & PM_TPI) avrftdi_tpi_initpgm(pgm); } @@ -808,7 +808,7 @@ static void avrftdi_close(PROGRAMMER * pgm) static int avrftdi_initialize(const PROGRAMMER *pgm, const AVRPART *p) { avrftdi_powerup(pgm); - if(p->flags & AVRPART_HAS_TPI) + if(p->prog_modes & PM_TPI) { /* see avrftdi_tpi.c */ avrftdi_tpi_initialize(pgm, p); diff --git a/src/bitbang.c b/src/bitbang.c index c043d740..af468926 100644 --- a/src/bitbang.c +++ b/src/bitbang.c @@ -422,7 +422,7 @@ int bitbang_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char res[4]; AVRMEM *mem; - if (p->flags & AVRPART_HAS_TPI) { + if (p->prog_modes & PM_TPI) { pgm->pgm_led(pgm, ON); while (avr_tpi_poll_nvmbsy(pgm)); @@ -482,7 +482,7 @@ int bitbang_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char res[4]; int i; - if (p->flags & AVRPART_HAS_TPI) { + if (p->prog_modes & PM_TPI) { /* enable NVM programming */ bitbang_tpi_tx(pgm, TPI_CMD_SKEY); for (i = sizeof(tpi_skey) - 1; i >= 0; i--) @@ -524,7 +524,7 @@ int bitbang_initialize(const PROGRAMMER *pgm, const AVRPART *p) { usleep(20000); /* TPIDATA is a single line, so MISO & MOSI should be connected */ - if (p->flags & AVRPART_HAS_TPI) { + if (p->prog_modes & PM_TPI) { /* make sure cmd_tpi() is defined */ if (pgm->cmd_tpi == NULL) { avrdude_message(MSG_INFO, "%s: Error: %s programmer does not support TPI\n", @@ -559,7 +559,7 @@ int bitbang_initialize(const PROGRAMMER *pgm, const AVRPART *p) { pgm->setpin(pgm, PIN_AVR_RESET, 0); usleep(20000); - if (p->flags & AVRPART_HAS_TPI) { + if (p->prog_modes & PM_TPI) { /* keep TPIDATA high for 16 clock cycles */ pgm->setpin(pgm, PIN_AVR_MOSI, 1); for (i = 0; i < 16; i++) diff --git a/src/config_gram.y b/src/config_gram.y index bc48d098..f8a20629 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -1117,61 +1117,46 @@ part_parm : K_HAS_JTAG TKN_EQUAL yesno { - if ($3->primary == K_YES) { - current_part->flags |= AVRPART_HAS_JTAG; + if ($3->primary == K_YES) current_part->prog_modes |= PM_JTAG; - } else if ($3->primary == K_NO) { - current_part->flags &= ~AVRPART_HAS_JTAG; + else if ($3->primary == K_NO) current_part->prog_modes &= ~PM_JTAG; - } free_token($3); } | K_HAS_DW TKN_EQUAL yesno { - if ($3->primary == K_YES) { - current_part->flags |= AVRPART_HAS_DW; + if ($3->primary == K_YES) current_part->prog_modes |= PM_debugWIRE; - } else if ($3->primary == K_NO) { - current_part->flags &= ~AVRPART_HAS_DW; + else if ($3->primary == K_NO) current_part->prog_modes &= ~PM_debugWIRE; - } free_token($3); } | K_HAS_PDI TKN_EQUAL yesno { - if ($3->primary == K_YES) { - current_part->flags |= AVRPART_HAS_PDI; + if ($3->primary == K_YES) current_part->prog_modes |= PM_PDI; - } else if ($3->primary == K_NO) { - current_part->flags &= ~AVRPART_HAS_PDI; + else if ($3->primary == K_NO) current_part->prog_modes &= ~PM_PDI; - } free_token($3); } | K_HAS_UPDI TKN_EQUAL yesno { - if ($3->primary == K_YES) { - current_part->flags |= AVRPART_HAS_UPDI; + if ($3->primary == K_YES) current_part->prog_modes |= PM_UPDI; - } else if ($3->primary == K_NO) { - current_part->flags &= ~AVRPART_HAS_UPDI; + else if ($3->primary == K_NO) current_part->prog_modes &= ~PM_UPDI; - } free_token($3); } | K_HAS_TPI TKN_EQUAL yesno { - if ($3->primary == K_YES) { - current_part->flags |= AVRPART_HAS_TPI; + if ($3->primary == K_YES) current_part->prog_modes |= PM_TPI; - } else if ($3->primary == K_NO) { - current_part->flags &= ~AVRPART_HAS_TPI; + else if ($3->primary == K_NO) current_part->prog_modes &= ~PM_TPI; - } free_token($3); } | @@ -1187,13 +1172,10 @@ part_parm : K_IS_AVR32 TKN_EQUAL yesno { - if ($3->primary == K_YES) { - current_part->flags |= AVRPART_AVR32; + if ($3->primary == K_YES) current_part->prog_modes |= PM_aWire; - } else if ($3->primary == K_NO) { - current_part->flags &= ~AVRPART_AVR32; + else if ($3->primary == K_NO) current_part->prog_modes &= ~PM_aWire; - } free_token($3); } | diff --git a/src/developer_opts.c b/src/developer_opts.c index 8f716f03..c9efc7cf 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -74,8 +74,6 @@ static struct { }; - - // Return 0 if op code would encode (essentially) the same SPI command static int opcodecmp(const OPCODE *op1, const OPCODE *op2, int opnum) { char *opstr1, *opstr2, *p; @@ -134,6 +132,13 @@ static void printallopcodes(const AVRPART *p, const char *d, OPCODE * const *opa // Programming modes + +/* + * p->flags no longer used for programming modes, use p->prog_modes + * + + remove this comment in 2023 + static char *prog_modes_str_flags(const AVRPART *p) { static char type[1024]; @@ -194,6 +199,10 @@ static char *prog_modes_str_flags(const AVRPART *p) { return type + (*type == '|'); } + * + */ + + static char *prog_modes_str(int pm) { static char type[1024]; @@ -627,13 +636,7 @@ static void dev_part_strct(const AVRPART *p, bool tsv, const AVRPART *base, bool if(tsv) { _partout("0x%04x", flags); } else { - _if_flagout(AVRPART_HAS_JTAG, has_jtag); - _if_flagout(AVRPART_HAS_DW, has_debugwire); - _if_flagout(AVRPART_HAS_PDI, has_pdi); - _if_flagout(AVRPART_HAS_UPDI, has_updi); - _if_flagout(AVRPART_HAS_TPI, has_tpi); _if_flagout(AVRPART_IS_AT90S1200, is_at90s1200); - _if_flagout(AVRPART_AVR32, is_avr32); _if_flagout(AVRPART_ALLOWFULLPAGEBITSTREAM, allowfullpagebitstream); _if_flagout(AVRPART_ENABLEPAGEPROGRAMMING, enablepageprogramming); _if_flagout(AVRPART_SERIALOK, serial); @@ -1064,7 +1067,7 @@ void dev_output_part_defs(char *partdesc) { nfuses, ok, p->flags, - prog_modes_str_flags(p), + prog_modes_str(p->prog_modes), p->config_file, p->lineno ); } @@ -1083,14 +1086,14 @@ void dev_output_part_defs(char *partdesc) { // Print wait delays for AVR family parts if(waits) { - if(!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI | AVRPART_HAS_TPI | AVRPART_AVR32))) + if(p->prog_modes & PM_ISP) dev_info(".wd_chip_erase %.3f ms %s\n", p->chip_erase_delay/1000.0, p->desc); if(p->mem) { for(LNODEID lnm=lfirst(p->mem); lnm; lnm=lnext(lnm)) { AVRMEM *m = ldata(lnm); // Write delays not needed for read-only calibration and signature memories if(strcmp(m->desc, "calibration") && strcmp(m->desc, "signature")) { - if(!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI | AVRPART_HAS_TPI | AVRPART_AVR32))) { + if(p->prog_modes & PM_ISP) { if(m->min_write_delay == m->max_write_delay) dev_info(".wd_%s %.3f ms %s\n", m->desc, m->min_write_delay/1000.0, p->desc); else { diff --git a/src/fileio.c b/src/fileio.c index 52e9afef..d28a4bfd 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -778,7 +778,7 @@ static int elf_mem_limits(AVRMEM *mem, struct avrpart * p, { int rv = 0; - if (p->flags & AVRPART_AVR32) { + if (p->prog_modes & PM_aWire) { // AVR32 if (strcmp(mem->desc, "flash") == 0) { *lowbound = 0x80000000; *highbound = 0xffffffff; @@ -850,7 +850,7 @@ static int elf2b(char * infile, FILE * inf, * sections out of an ELF file that contains section data for more * than one sub-segment. */ - if ((p->flags & AVRPART_HAS_PDI) != 0 && + if ((p->prog_modes & PM_PDI) != 0 && (strcmp(mem->desc, "boot") == 0 || strcmp(mem->desc, "application") == 0 || strcmp(mem->desc, "apptable") == 0)) { @@ -893,7 +893,7 @@ static int elf2b(char * infile, FILE * inf, const char *endianname; unsigned char endianess; - if (p->flags & AVRPART_AVR32) { + if (p->prog_modes & PM_aWire) { // AVR32 endianess = ELFDATA2MSB; endianname = "little"; } else { @@ -923,7 +923,7 @@ static int elf2b(char * infile, FILE * inf, const char *mname; uint16_t machine; - if (p->flags & AVRPART_AVR32) { + if (p->prog_modes & PM_aWire) { machine = EM_AVR32; mname = "AVR32"; } else { @@ -1383,14 +1383,7 @@ int fileio_setparms(int op, struct fioparms * fp, * AVR32 devices maintain their load offset within the file itself, * but AVRDUDE maintains all memory images 0-based. */ - if ((p->flags & AVRPART_AVR32) != 0) - { - fp->fileoffset = m->offset; - } - else - { - fp->fileoffset = 0; - } + fp->fileoffset = p->prog_modes & PM_aWire? m->offset: 0; return 0; } diff --git a/src/flip1.c b/src/flip1.c index dbddfaf0..a57f7259 100644 --- a/src/flip1.c +++ b/src/flip1.c @@ -239,7 +239,7 @@ int flip1_initialize(const PROGRAMMER *pgm, const AVRPART *part) { } else { pid = part->usbpid; } - if (!ovsigck && (part->flags & AVRPART_HAS_PDI)) { + if (!ovsigck && (part->prog_modes & PM_PDI)) { avrdude_message(MSG_INFO, "%s: \"flip1\" (FLIP protocol version 1) is for AT90USB* and ATmega*U* devices.\n" "%s For Xmega devices, use \"flip2\".\n" "%s (Use -F to bypass this check.)\n", diff --git a/src/flip2.c b/src/flip2.c index a26da242..2925030c 100644 --- a/src/flip2.c +++ b/src/flip2.c @@ -234,7 +234,7 @@ int flip2_initialize(const PROGRAMMER *pgm, const AVRPART *part) { pid = part->usbpid; } - if (!ovsigck && !(part->flags & AVRPART_HAS_PDI)) { + if (!ovsigck && !(part->prog_modes & PM_PDI)) { avrdude_message(MSG_INFO, "%s: \"flip2\" (FLIP protocol version 2) is for Xmega devices.\n" "%s For AT90USB* or ATmega*U* devices, use \"flip1\".\n" "%s (Use -F to bypass this check.)\n", diff --git a/src/ft245r.c b/src/ft245r.c index 9048cc2f..a44e19b8 100644 --- a/src/ft245r.c +++ b/src/ft245r.c @@ -343,7 +343,7 @@ static int ft245r_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[4] = {0,0,0,0}; unsigned char res[4]; - if (p->flags & AVRPART_HAS_TPI) + if (p->prog_modes & PM_TPI) return avr_tpi_chip_erase(pgm, p); if (p->op[AVR_OP_CHIP_ERASE] == NULL) { @@ -502,7 +502,7 @@ static int ft245r_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char res[4]; int i; - if (p->flags & AVRPART_HAS_TPI) + if (p->prog_modes & PM_TPI) return avr_tpi_program_enable(pgm, p, TPIPCR_GT_0b); if (p->op[AVR_OP_PGM_ENABLE] == NULL) { @@ -565,7 +565,7 @@ static int ft245r_initialize(const PROGRAMMER *pgm, const AVRPART *p) { */ ft245r_usleep(pgm, 20000); // 20ms - if (p->flags & AVRPART_HAS_TPI) { + if (p->prog_modes & PM_TPI) { bool io_link_ok = true; uint8_t byte; int i; diff --git a/src/jtag3.c b/src/jtag3.c index 94b2b695..52cbac40 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1064,19 +1064,19 @@ static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { if (pgm->flag & PGM_FL_IS_DW) { ifname = "debugWire"; - if (p->flags & AVRPART_HAS_DW) + if (p->prog_modes & PM_debugWIRE) conn = PARM3_CONN_DW; } else if (pgm->flag & PGM_FL_IS_PDI) { ifname = "PDI"; - if (p->flags & AVRPART_HAS_PDI) + if (p->prog_modes & PM_PDI) conn = PARM3_CONN_PDI; } else if (pgm->flag & PGM_FL_IS_UPDI) { ifname = "UPDI"; - if (p->flags & AVRPART_HAS_UPDI) + if (p->prog_modes & PM_UPDI) conn = PARM3_CONN_UPDI; } else { ifname = "JTAG"; - if (p->flags & AVRPART_HAS_JTAG) + if (p->prog_modes & PM_JTAG) conn = PARM3_CONN_JTAG; } @@ -1086,11 +1086,11 @@ static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { return -1; } - if (p->flags & AVRPART_HAS_PDI) + if (p->prog_modes & PM_PDI) parm[0] = PARM3_ARCH_XMEGA; - else if (p->flags & AVRPART_HAS_UPDI) + else if (p->prog_modes & PM_UPDI) parm[0] = PARM3_ARCH_UPDI; - else if (p->flags & AVRPART_HAS_DW) + else if (p->prog_modes & PM_debugWIRE) parm[0] = PARM3_ARCH_TINY; else parm[0] = PARM3_ARCH_MEGA; @@ -1108,7 +1108,7 @@ static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { if (conn == PARM3_CONN_PDI || conn == PARM3_CONN_UPDI) PDATA(pgm)->set_sck = jtag3_set_sck_xmega_pdi; else if (conn == PARM3_CONN_JTAG) { - if (p->flags & AVRPART_HAS_PDI) + if (p->prog_modes & PM_PDI) PDATA(pgm)->set_sck = jtag3_set_sck_xmega_jtag; else PDATA(pgm)->set_sck = jtag3_set_sck_mega_jtag; @@ -1137,7 +1137,7 @@ static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { } /* set device descriptor data */ - if ((p->flags & AVRPART_HAS_PDI)) + if ((p->prog_modes & PM_PDI)) { struct xmega_device_desc xd; LNODEID ln; @@ -1182,7 +1182,7 @@ static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { if (jtag3_setparm(pgm, SCOPE_AVR, 2, PARM3_DEVICEDESC, (unsigned char *)&xd, sizeof xd) < 0) return -1; } - else if ((p->flags & AVRPART_HAS_UPDI)) + else if ((p->prog_modes & PM_UPDI)) { struct updi_device_desc xd; LNODEID ln; @@ -1247,7 +1247,7 @@ static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { // Generate UPDI high-voltage pulse if user asks for it and hardware supports it LNODEID support; - if (p->flags & AVRPART_HAS_UPDI && + if (p->prog_modes & PM_UPDI && PDATA(pgm)->use_hvupdi == true && p->hvupdi_variant != HV_UPDI_VARIANT_1) { parm[0] = PARM3_UPDI_HV_NONE; @@ -1332,7 +1332,7 @@ static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { int ocdrev; /* lacking a proper definition, guess the OCD revision */ - if (p->flags & AVRPART_HAS_DW) + if (p->prog_modes & PM_debugWIRE) ocdrev = 1; /* exception: ATtiny13, 2313, 4313 */ else if (flashsize > 128 * 1024) ocdrev = 4; @@ -1376,7 +1376,7 @@ static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { } if (use_ext_reset > 1) { - if(strcmp(pgm->type, "JTAGICE3") == 0 && p->flags & AVRPART_HAS_JTAG) + if(strcmp(pgm->type, "JTAGICE3") == 0 && (p->prog_modes & PM_JTAG)) avrdude_message(MSG_INFO, "%s: JTAGEN fuse disabled?\n", progname); return -1; } @@ -1394,7 +1394,7 @@ static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { * doesn't apply here anyway), the response is just RSP_OK. */ if (resp[1] == RSP3_DATA && status >= 7) { - if (p->flags & AVRPART_HAS_UPDI) { + if (p->prog_modes & PM_UPDI) { /* Partial Family_ID has been returned */ avrdude_message(MSG_NOTICE, "%s: Partial Family_ID returned: \"%c%c%c%c\"\n", progname, resp[3], resp[4], resp[5], resp[6]); @@ -1408,11 +1408,8 @@ static int jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { free(resp); PDATA(pgm)->boot_start = ULONG_MAX; - if ((p->flags & AVRPART_HAS_PDI)) { - /* - * Find out where the border between application and boot area - * is. - */ + if (p->prog_modes & PM_PDI) { + // Find the border between application and boot area AVRMEM *bootmem = avr_locate_mem(p, "boot"); AVRMEM *flashmem = avr_locate_mem(p, "flash"); if (bootmem == NULL || flashmem == NULL) { @@ -1690,7 +1687,7 @@ static int jtag3_page_erase(const PROGRAMMER *pgm, const AVRPART *p, const AVRME avrdude_message(MSG_NOTICE2, "%s: jtag3_page_erase(.., %s, 0x%x)\n", progname, m->desc, addr); - if (!(p->flags & AVRPART_HAS_PDI)) { + if (!(p->prog_modes & PM_PDI)) { avrdude_message(MSG_INFO, "%s: jtag3_page_erase: not an Xmega device\n", progname); return -1; @@ -1764,7 +1761,7 @@ static int jtag3_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRM if (strcmp(m->desc, "flash") == 0) { PDATA(pgm)->flash_pageaddr = (unsigned long)-1L; cmd[3] = jtag3_memtype(pgm, p, addr); - if (p->flags & AVRPART_HAS_PDI) + if (p->prog_modes & PM_PDI) /* dynamically decide between flash/boot memtype */ dynamic_memtype = 1; } else if (strcmp(m->desc, "eeprom") == 0) { @@ -1783,14 +1780,14 @@ static int jtag3_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRM free(cmd); return n_bytes; } - cmd[3] = ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) ? MTYPE_EEPROM_XMEGA : MTYPE_EEPROM_PAGE; + cmd[3] = p->prog_modes & (PM_PDI | PM_UPDI)? MTYPE_EEPROM_XMEGA: MTYPE_EEPROM_PAGE; PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L; } else if (strcmp(m->desc, "usersig") == 0 || strcmp(m->desc, "userrow") == 0) { cmd[3] = MTYPE_USERSIG; } else if (strcmp(m->desc, "boot") == 0) { cmd[3] = MTYPE_BOOT_FLASH; - } else if ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) { + } else if (p->prog_modes & (PM_PDI | PM_UPDI)) { cmd[3] = MTYPE_FLASH; } else { cmd[3] = MTYPE_SPM; @@ -1868,11 +1865,11 @@ static int jtag3_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRME if (strcmp(m->desc, "flash") == 0) { cmd[3] = jtag3_memtype(pgm, p, addr); - if (p->flags & AVRPART_HAS_PDI) + if (p->prog_modes & PM_PDI) /* dynamically decide between flash/boot memtype */ dynamic_memtype = 1; } else if (strcmp(m->desc, "eeprom") == 0) { - cmd[3] = ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) ? MTYPE_EEPROM : MTYPE_EEPROM_PAGE; + cmd[3] = p->prog_modes & (PM_PDI | PM_UPDI)? MTYPE_EEPROM: MTYPE_EEPROM_PAGE; if (pgm->flag & PGM_FL_IS_DW) return -1; } else if (strcmp(m->desc, "prodsig") == 0) { @@ -1882,9 +1879,9 @@ static int jtag3_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRME cmd[3] = MTYPE_USERSIG; } else if (strcmp(m->desc, "boot") == 0) { cmd[3] = MTYPE_BOOT_FLASH; - } else if ( p->flags & AVRPART_HAS_PDI ) { + } else if (p->prog_modes & PM_PDI) { cmd[3] = MTYPE_FLASH; - } else if ( p->flags & AVRPART_HAS_UPDI ) { + } else if (p->prog_modes & PM_UPDI) { cmd[3] = MTYPE_SRAM; } else { cmd[3] = MTYPE_SPM; @@ -1949,7 +1946,7 @@ static int jtag3_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM cmd[1] = CMD3_READ_MEMORY; cmd[2] = 0; - cmd[3] = ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) ? MTYPE_FLASH : MTYPE_FLASH_PAGE; + cmd[3] = p->prog_modes & (PM_PDI | PM_UPDI)? MTYPE_FLASH: MTYPE_FLASH_PAGE; if (avr_mem_is_flash_type(mem)) { addr += mem->offset & (512 * 1024 - 1); /* max 512 KiB flash */ pagesize = PDATA(pgm)->flash_pagesize; @@ -1957,7 +1954,7 @@ static int jtag3_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM paddr_ptr = &PDATA(pgm)->flash_pageaddr; cache_ptr = PDATA(pgm)->flash_pagecache; } else if (avr_mem_is_eeprom_type(mem)) { - if ( (pgm->flag & PGM_FL_IS_DW) || ( p->flags & AVRPART_HAS_PDI ) || ( p->flags & AVRPART_HAS_UPDI ) ) { + if ( (pgm->flag & PGM_FL_IS_DW) || (p->prog_modes & PM_PDI) || (p->prog_modes & PM_UPDI) ) { cmd[3] = MTYPE_EEPROM; } else { cmd[3] = MTYPE_EEPROM_PAGE; @@ -1987,7 +1984,7 @@ static int jtag3_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM unsupp = 1; } else if (matches(mem->desc, "fuse")) { cmd[3] = MTYPE_FUSE_BITS; - if (!(p->flags & AVRPART_HAS_UPDI)) + if (!(p->prog_modes & PM_UPDI)) addr = mem->offset & 7; } else if (strcmp(mem->desc, "usersig") == 0 || strcmp(mem->desc, "userrow") == 0) { @@ -2117,7 +2114,7 @@ static int jtag3_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRME cmd[0] = SCOPE_AVR; cmd[1] = CMD3_WRITE_MEMORY; cmd[2] = 0; - cmd[3] = ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) ? MTYPE_FLASH : MTYPE_SPM; + cmd[3] = p->prog_modes & (PM_PDI | PM_UPDI)? MTYPE_FLASH: MTYPE_SPM; if (strcmp(mem->desc, "flash") == 0) { cache_ptr = PDATA(pgm)->flash_pagecache; pagesize = PDATA(pgm)->flash_pagesize; @@ -2149,7 +2146,7 @@ static int jtag3_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRME unsupp = 1; } else if (matches(mem->desc, "fuse")) { cmd[3] = MTYPE_FUSE_BITS; - if (!(p->flags & AVRPART_HAS_UPDI)) + if (!(p->prog_modes & PM_UPDI)) addr = mem->offset & 7; } else if (strcmp(mem->desc, "usersig") == 0 || strcmp(mem->desc, "userrow") == 0) { @@ -2457,7 +2454,7 @@ static void jtag3_print_parms(const PROGRAMMER *pgm) { } static unsigned char jtag3_memtype(const PROGRAMMER *pgm, const AVRPART *p, unsigned long addr) { - if ( p->flags & AVRPART_HAS_PDI ) { + if (p->prog_modes & PM_PDI) { if (addr >= PDATA(pgm)->boot_start) return MTYPE_BOOT_FLASH; else @@ -2468,7 +2465,7 @@ static unsigned char jtag3_memtype(const PROGRAMMER *pgm, const AVRPART *p, unsi } static unsigned int jtag3_memaddr(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr) { - if ((p->flags & AVRPART_HAS_PDI) != 0) { + if (p->prog_modes & PM_PDI) { if (addr >= PDATA(pgm)->boot_start) /* * all memories but "flash" are smaller than boot_start anyway, so @@ -2479,10 +2476,9 @@ static unsigned int jtag3_memaddr(const PROGRAMMER *pgm, const AVRPART *p, const /* normal flash, or anything else */ return addr; } - /* - * Non-Xmega device. - */ - if (p->flags & AVRPART_HAS_UPDI) { + + // Non-Xmega device + if (p->prog_modes & PM_UPDI) { if (strcmp(m->desc, "flash") == 0) { return addr; } diff --git a/src/jtagmkI.c b/src/jtagmkI.c index a9b2dda8..73c58086 100644 --- a/src/jtagmkI.c +++ b/src/jtagmkI.c @@ -523,7 +523,7 @@ static int jtagmkI_initialize(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char cmd[1], resp[5]; unsigned char b; - if (!(p->flags & AVRPART_HAS_JTAG)) { + if (!(p->prog_modes & PM_JTAG)) { avrdude_message(MSG_INFO, "%s: jtagmkI_initialize(): part %s has no JTAG interface\n", progname, p->desc); return -1; diff --git a/src/jtagmkII.c b/src/jtagmkII.c index f4323799..e3f7d3d7 100644 --- a/src/jtagmkII.c +++ b/src/jtagmkII.c @@ -882,7 +882,7 @@ static int jtagmkII_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { int status, len; unsigned char buf[6], *resp, c; - if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) { + if (p->prog_modes & (PM_PDI | PM_UPDI)) { buf[0] = CMND_XMEGA_ERASE; buf[1] = XMEGA_ERASE_CHIP; memset(buf + 2, 0, 4); /* address of area to be erased */ @@ -893,7 +893,7 @@ static int jtagmkII_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { } avrdude_message(MSG_NOTICE2, "%s: jtagmkII_chip_erase(): Sending %schip erase command: ", progname, - (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))? "Xmega ": ""); + p->prog_modes & (PM_PDI | PM_UPDI)? "Xmega ": ""); jtagmkII_send(pgm, buf, len); status = jtagmkII_recv(pgm, &resp); @@ -919,7 +919,7 @@ static int jtagmkII_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { return -1; } - if (!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))) + if (!(p->prog_modes & (PM_PDI | PM_UPDI))) pgm->initialize(pgm, p); return 0; @@ -966,7 +966,7 @@ static void jtagmkII_set_devdescr(const PROGRAMMER *pgm, const AVRPART *p) { u32_to_b4(sendbuf.dd.ulFlashSize, m->size); u16_to_b2(sendbuf.dd.uiFlashPageSize, m->page_size); u16_to_b2(sendbuf.dd.uiFlashpages, m->size / m->page_size); - if (p->flags & AVRPART_HAS_DW) { + if (p->prog_modes & PM_debugWIRE) { memcpy(sendbuf.dd.ucFlashInst, p->flash_instr, FLASH_INSTR_SIZE); memcpy(sendbuf.dd.ucEepromInst, p->eeprom_instr, EEPROM_INSTR_SIZE); } @@ -975,7 +975,7 @@ static void jtagmkII_set_devdescr(const PROGRAMMER *pgm, const AVRPART *p) { } } sendbuf.dd.ucCacheType = - (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))? 0x02 /* ATxmega */: 0x00; + p->prog_modes & (PM_PDI | PM_UPDI)? 0x02 /* ATxmega */: 0x00; avrdude_message(MSG_NOTICE2, "%s: jtagmkII_set_devdescr(): " "Sending set device descriptor command: ", @@ -1290,8 +1290,8 @@ static int jtagmkII_initialize(const PROGRAMMER *pgm, const AVRPART *p) { const char *ifname; /* Abort and print error if programmer does not support the target microcontroller */ - if ((strncmp(pgm->type, "JTAGMKII_UPDI", strlen("JTAGMKII_UPDI")) == 0 && !(p->flags & AVRPART_HAS_UPDI)) || - (strncmp(ldata(lfirst(pgm->id)), "jtagmkII", strlen("jtagmkII")) == 0 && p->flags & AVRPART_HAS_UPDI)) { + if ((strncmp(pgm->type, "JTAGMKII_UPDI", strlen("JTAGMKII_UPDI")) == 0 && !(p->prog_modes & PM_UPDI)) || + (strncmp(ldata(lfirst(pgm->id)), "jtagmkII", strlen("jtagmkII")) == 0 && (p->prog_modes & PM_UPDI))) { avrdude_message(MSG_INFO, "ERROR: programmer %s does not support target %s\n\n", ldata(lfirst(pgm->id)), p->desc); return -1; @@ -1300,15 +1300,15 @@ static int jtagmkII_initialize(const PROGRAMMER *pgm, const AVRPART *p) { ok = 0; if (pgm->flag & PGM_FL_IS_DW) { ifname = "debugWire"; - if (p->flags & AVRPART_HAS_DW) + if (p->prog_modes & PM_debugWIRE) ok = 1; } else if (pgm->flag & PGM_FL_IS_PDI) { ifname = "PDI"; - if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) + if (p->prog_modes & (PM_PDI | PM_UPDI)) ok = 1; } else { ifname = "JTAG"; - if (p->flags & AVRPART_HAS_JTAG) + if (p->prog_modes & PM_JTAG) ok = 1; } @@ -1350,24 +1350,21 @@ static int jtagmkII_initialize(const PROGRAMMER *pgm, const AVRPART *p) { * mode from JTAG to JTAG_XMEGA. */ if ((pgm->flag & PGM_FL_IS_JTAG) && - (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))) { + (p->prog_modes & (PM_PDI | PM_UPDI))) { if (jtagmkII_getsync(pgm, EMULATOR_MODE_JTAG_XMEGA) < 0) return -1; } /* * Must set the device descriptor before entering programming mode. */ - if (PDATA(pgm)->fwver >= 0x700 && (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) != 0) + if (PDATA(pgm)->fwver >= 0x700 && (p->prog_modes & (PM_PDI | PM_UPDI)) != 0) jtagmkII_set_xmega_params(pgm, p); else jtagmkII_set_devdescr(pgm, p); PDATA(pgm)->boot_start = ULONG_MAX; - if ((p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))) { - /* - * Find out where the border between application and boot area - * is. - */ + if ((p->prog_modes & (PM_PDI | PM_UPDI))) { + // Find the border between application and boot area AVRMEM *bootmem = avr_locate_mem(p, "boot"); AVRMEM *flashmem = avr_locate_mem(p, "flash"); if (bootmem == NULL || flashmem == NULL) { @@ -1405,7 +1402,7 @@ static int jtagmkII_initialize(const PROGRAMMER *pgm, const AVRPART *p) { } PDATA(pgm)->flash_pageaddr = PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L; - if (PDATA(pgm)->fwver >= 0x700 && (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))) { + if (PDATA(pgm)->fwver >= 0x700 && (p->prog_modes & (PM_PDI | PM_UPDI))) { /* * Work around for * https://savannah.nongnu.org/bugs/index.php?37942 @@ -1422,7 +1419,7 @@ static int jtagmkII_initialize(const PROGRAMMER *pgm, const AVRPART *p) { return -1; } - if ((pgm->flag & PGM_FL_IS_JTAG) && !(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))) { + if ((pgm->flag & PGM_FL_IS_JTAG) && !(p->prog_modes & (PM_PDI | PM_UPDI))) { hfuse.desc = cache_string("hfuse"); if (jtagmkII_read_byte(pgm, p, &hfuse, 1, &b) < 0) return -1; @@ -1887,7 +1884,7 @@ static int jtagmkII_page_erase(const PROGRAMMER *pgm, const AVRPART *p, const AV avrdude_message(MSG_NOTICE2, "%s: jtagmkII_page_erase(.., %s, 0x%x)\n", progname, m->desc, addr); - if (!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))) { + if (!(p->prog_modes & (PM_PDI | PM_UPDI))) { avrdude_message(MSG_INFO, "%s: jtagmkII_page_erase: not an Xmega device\n", progname); return -1; @@ -2002,7 +1999,7 @@ static int jtagmkII_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const A if (strcmp(m->desc, "flash") == 0) { PDATA(pgm)->flash_pageaddr = (unsigned long)-1L; cmd[1] = jtagmkII_memtype(pgm, p, addr); - if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) + if (p->prog_modes & (PM_PDI | PM_UPDI)) /* dynamically decide between flash/boot memtype */ dynamic_memtype = 1; } else if (strcmp(m->desc, "eeprom") == 0) { @@ -2021,14 +2018,14 @@ static int jtagmkII_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const A free(cmd); return n_bytes; } - cmd[1] = (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) ? MTYPE_EEPROM : MTYPE_EEPROM_PAGE; + cmd[1] = p->prog_modes & (PM_PDI | PM_UPDI)? MTYPE_EEPROM: MTYPE_EEPROM_PAGE; PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L; } else if (strcmp(m->desc, "usersig") == 0 || strcmp(m->desc, "userrow") == 0) { cmd[1] = MTYPE_USERSIG; } else if (strcmp(m->desc, "boot") == 0) { cmd[1] = MTYPE_BOOT_FLASH; - } else if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) { + } else if (p->prog_modes & (PM_PDI | PM_UPDI)) { cmd[1] = MTYPE_FLASH; } else { cmd[1] = MTYPE_SPM; @@ -2130,11 +2127,11 @@ static int jtagmkII_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AV cmd[0] = CMND_READ_MEMORY; if (strcmp(m->desc, "flash") == 0) { cmd[1] = jtagmkII_memtype(pgm, p, addr); - if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) + if (p->prog_modes & (PM_PDI | PM_UPDI)) /* dynamically decide between flash/boot memtype */ dynamic_memtype = 1; } else if (strcmp(m->desc, "eeprom") == 0) { - cmd[1] = (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) ? MTYPE_EEPROM : MTYPE_EEPROM_PAGE; + cmd[1] = p->prog_modes & (PM_PDI | PM_UPDI)? MTYPE_EEPROM: MTYPE_EEPROM_PAGE; if (pgm->flag & PGM_FL_IS_DW) return -1; } else if (strcmp(m->desc, "prodsig") == 0) { @@ -2144,7 +2141,7 @@ static int jtagmkII_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AV cmd[1] = MTYPE_USERSIG; } else if (strcmp(m->desc, "boot") == 0) { cmd[1] = MTYPE_BOOT_FLASH; - } else if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) { + } else if (p->prog_modes & (PM_PDI | PM_UPDI)) { cmd[1] = MTYPE_FLASH; } else { cmd[1] = MTYPE_SPM; @@ -2230,14 +2227,14 @@ static int jtagmkII_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVR unsupp = 0; addr += mem->offset; - cmd[1] = ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) ? MTYPE_FLASH : MTYPE_FLASH_PAGE; + cmd[1] = p->prog_modes & (PM_PDI | PM_UPDI)? MTYPE_FLASH: MTYPE_FLASH_PAGE; if (avr_mem_is_flash_type(mem)) { pagesize = PDATA(pgm)->flash_pagesize; paddr = addr & ~(pagesize - 1); paddr_ptr = &PDATA(pgm)->flash_pageaddr; cache_ptr = PDATA(pgm)->flash_pagecache; } else if (avr_mem_is_eeprom_type(mem)) { - if ( (pgm->flag & PGM_FL_IS_DW) || ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) ) { + if ( (pgm->flag & PGM_FL_IS_DW) || (p->prog_modes & (PM_PDI | PM_UPDI)) ) { /* debugWire cannot use page access for EEPROM */ cmd[1] = MTYPE_EEPROM; } else { @@ -2404,7 +2401,7 @@ static int jtagmkII_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AV writedata = data; cmd[0] = CMND_WRITE_MEMORY; - cmd[1] = ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) ? MTYPE_FLASH : MTYPE_SPM; + cmd[1] = p->prog_modes & (PM_PDI | PM_UPDI)? MTYPE_FLASH: MTYPE_SPM; if (strcmp(mem->desc, "flash") == 0) { if ((addr & 1) == 1) { /* odd address = high byte */ @@ -2418,7 +2415,7 @@ static int jtagmkII_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AV if (pgm->flag & PGM_FL_IS_DW) unsupp = 1; } else if (strcmp(mem->desc, "eeprom") == 0) { - cmd[1] = ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) ? MTYPE_EEPROM_XMEGA: MTYPE_EEPROM; + cmd[1] = p->prog_modes & (PM_PDI | PM_UPDI)? MTYPE_EEPROM_XMEGA: MTYPE_EEPROM; need_progmode = 0; PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L; } else if (strcmp(mem->desc, "lfuse") == 0) { @@ -2719,7 +2716,7 @@ static void jtagmkII_print_parms(const PROGRAMMER *pgm) { } static unsigned char jtagmkII_memtype(const PROGRAMMER *pgm, const AVRPART *p, unsigned long addr) { - if ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) { + if (p->prog_modes & (PM_PDI | PM_UPDI)) { if (addr >= PDATA(pgm)->boot_start) return MTYPE_BOOT_FLASH; else @@ -2734,7 +2731,7 @@ static unsigned int jtagmkII_memaddr(const PROGRAMMER *pgm, const AVRPART *p, co * Xmega devices handled by V7+ firmware don't want to be told their * m->offset within the write memory command. */ - if (PDATA(pgm)->fwver >= 0x700 && (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) != 0) { + if (PDATA(pgm)->fwver >= 0x700 && (p->prog_modes & (PM_PDI | PM_UPDI))) { if (addr >= PDATA(pgm)->boot_start) /* * all memories but "flash" are smaller than boot_start anyway, so @@ -3572,7 +3569,7 @@ static int jtagmkII_paged_write32(const PROGRAMMER *pgm, const AVRPART *p, const } // Init SMC and set clocks - if(!(p->flags & FLAGS32_INIT_SMC)) { + if(!(PDATA(pgm)->flags32 & FLAGS32_INIT_SMC)) { status = jtagmkII_smc_init32(pgm); if(status != 0) {lineno = __LINE__; goto eRR;} // PLL 0 PDATA(pgm)->flags32 |= FLAGS32_INIT_SMC; diff --git a/src/libavrdude.h b/src/libavrdude.h index c99117f4..3c7a6aec 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -184,19 +184,13 @@ typedef struct opcode { } OPCODE; -/* Any changes here, please also reflect in dev_part_strct() of developer_opts.c */ -#define AVRPART_SERIALOK 0x0001 /* part supports serial programming */ -#define AVRPART_PARALLELOK 0x0002 /* part supports parallel programming */ -#define AVRPART_PSEUDOPARALLEL 0x0004 /* part has pseudo parallel support */ -#define AVRPART_HAS_JTAG 0x0008 /* part has a JTAG i/f */ -#define AVRPART_ALLOWFULLPAGEBITSTREAM 0x0010 /* JTAG ICE mkII param. */ -#define AVRPART_ENABLEPAGEPROGRAMMING 0x0020 /* JTAG ICE mkII param. */ -#define AVRPART_HAS_DW 0x0040 /* part has a debugWire i/f */ -#define AVRPART_HAS_PDI 0x0080 /* part has PDI i/f rather than ISP (ATxmega) */ -#define AVRPART_AVR32 0x0100 /* part is in AVR32 family */ -#define AVRPART_HAS_TPI 0x0800 /* part has TPI i/f rather than ISP (ATtiny4/5/9/10) */ -#define AVRPART_IS_AT90S1200 0x1000 /* part is an AT90S1200 (needs special treatment) */ -#define AVRPART_HAS_UPDI 0x2000 /* part has UPDI i/f (AVR8X) */ +// Any changes here, please also reflect in dev_part_strct() of developer_opts.c +#define AVRPART_SERIALOK 1 // Part supports serial programming +#define AVRPART_PARALLELOK 2 // Part supports parallel programming +#define AVRPART_PSEUDOPARALLEL 4 // Part has pseudo parallel support +#define AVRPART_ALLOWFULLPAGEBITSTREAM 8 // JTAG ICE mkII param +#define AVRPART_ENABLEPAGEPROGRAMMING 16 // JTAG ICE mkII param +#define AVRPART_IS_AT90S1200 32 // Part is an AT90S1200, needs special treatment // Programming modes for parts and programmers: reflect changes in lexer.l, developer_opts.c and config.c #define PM_SPM 1 // Bootloaders, self-programming with SPM opcodes or NVM Controllers diff --git a/src/linuxspi.c b/src/linuxspi.c index df57c7e6..512755e3 100644 --- a/src/linuxspi.c +++ b/src/linuxspi.c @@ -270,8 +270,8 @@ static void linuxspi_display(const PROGRAMMER* pgm, const char* p) { static int linuxspi_initialize(const PROGRAMMER *pgm, const AVRPART *p) { int tries, ret; - if (p->flags & AVRPART_HAS_TPI) { - /* We do not support tpi. This is a dedicated SPI thing */ + if (p->prog_modes & PM_TPI) { + /* We do not support TPI. This is a dedicated SPI thing */ avrdude_message(MSG_INFO, "%s: error: Programmer " LINUXSPI " does not support TPI\n", progname); return -1; } diff --git a/src/main.c b/src/main.c index 51dbc879..1e39fdbf 100644 --- a/src/main.c +++ b/src/main.c @@ -924,7 +924,7 @@ int main(int argc, char * argv []) for (ln=lfirst(updates); ln; ln=lnext(ln)) { upd = ldata(ln); if (upd->memtype == NULL) { - const char *mtype = (p->flags & AVRPART_HAS_PDI)? "application": "flash"; + const char *mtype = p->prog_modes & PM_PDI? "application": "flash"; avrdude_message(MSG_NOTICE2, "%s: defaulting memtype in -U %c:%s option to \"%s\"\n", progname, (upd->op == DEVICE_READ)? 'r': (upd->op == DEVICE_WRITE)? 'w': 'v', @@ -1062,7 +1062,7 @@ int main(int argc, char * argv []) * against 0xffffff / 0x000000 should ensure that the signature bytes * are valid. */ - if(!(p->flags & AVRPART_AVR32)) { + if(!(p->prog_modes & PM_aWire)) { // not AVR32 int attempt = 0; int waittime = 10000; /* 10 ms */ @@ -1071,7 +1071,7 @@ int main(int argc, char * argv []) if (init_ok) { rc = avr_signature(pgm, p); if (rc != LIBAVRDUDE_SUCCESS) { - if ((rc == LIBAVRDUDE_SOFTFAIL) && (p->flags & AVRPART_HAS_UPDI) && (attempt < 1)) { + if (rc == LIBAVRDUDE_SOFTFAIL && (p->prog_modes & PM_UPDI) && attempt < 1) { attempt++; if (pgm->read_sib) { // Read SIB and compare FamilyID @@ -1193,8 +1193,7 @@ int main(int argc, char * argv []) } if (uflags & UF_AUTO_ERASE) { - if ((p->flags & AVRPART_HAS_PDI) && pgm->page_erase != NULL && - lsize(updates) > 0) { + if ((p->prog_modes & PM_PDI) && pgm->page_erase && lsize(updates) > 0) { if (quell_progress < 2) { avrdude_message(MSG_INFO, "%s: NOTE: Programmer supports page erase for Xmega devices.\n" "%sEach page will be erased before programming it, but no chip erase is performed.\n" @@ -1203,7 +1202,7 @@ int main(int argc, char * argv []) } } else { AVRMEM * m; - const char *memname = (p->flags & AVRPART_HAS_PDI)? "application": "flash"; + const char *memname = p->prog_modes & PM_PDI? "application": "flash"; uflags &= ~UF_AUTO_ERASE; for (ln=lfirst(updates); ln; ln=lnext(ln)) { diff --git a/src/stk500v2.c b/src/stk500v2.c index bdff4612..37fe2314 100644 --- a/src/stk500v2.c +++ b/src/stk500v2.c @@ -1130,8 +1130,7 @@ retry: break; case PGMTYPE_JTAGICE3: - if (buf[1] == STATUS_CMD_FAILED && - (p->flags & AVRPART_HAS_DW) != 0) { + if (buf[1] == STATUS_CMD_FAILED && (p->prog_modes & PM_debugWIRE)) { unsigned char cmd[4], *resp; /* Try debugWIRE, and MONCON_DISABLE */ @@ -1239,16 +1238,13 @@ static int stk500v2_initialize(const PROGRAMMER *pgm, const AVRPART *p) { if ((PDATA(pgm)->pgmtype == PGMTYPE_STK600 || PDATA(pgm)->pgmtype == PGMTYPE_AVRISP_MKII || PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE_MKII) != 0 - && (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_TPI)) != 0) { + && (p->prog_modes & (PM_PDI | PM_TPI)) != 0) { /* * This is an ATxmega device, must use XPROG protocol for the * remaining actions. */ - if ((p->flags & AVRPART_HAS_PDI) != 0) { - /* - * Find out where the border between application and boot area - * is. - */ + if (p->prog_modes & PM_PDI) { + // Find the border between application and boot area AVRMEM *bootmem = avr_locate_mem(p, "boot"); AVRMEM *flashmem = avr_locate_mem(p, "flash"); if (bootmem == NULL || flashmem == NULL) { @@ -1320,8 +1316,8 @@ static int stk500v2_jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { LNODEID ln; AVRMEM * m; - if ((p->flags & AVRPART_HAS_PDI) || - (p->flags & AVRPART_HAS_TPI)) { + // FIXME: condition below looks fishy, suspect the code wants !(p->prog_modes & (PM_debugWIRE | PM_JTAG)) + if (p->prog_modes & (PM_PDI | PM_TPI)) { avrdude_message(MSG_INFO, "%s: jtag3_initialize(): part %s has no ISP interface\n", progname, p->desc); return -1; @@ -1330,7 +1326,7 @@ static int stk500v2_jtag3_initialize(const PROGRAMMER *pgm, const AVRPART *p) { PROGRAMMER *pgmcp = pgm_dup(pgm); pgmcp->cookie = PDATA(pgm)->chained_pdata; - if (p->flags & AVRPART_HAS_DW) + if (p->prog_modes & PM_debugWIRE) parm[0] = PARM3_ARCH_TINY; else parm[0] = PARM3_ARCH_MEGA; @@ -1574,7 +1570,7 @@ static void stk500v2_enable(PROGRAMMER *pgm, const AVRPART *p) { if((PDATA(pgm)->pgmtype == PGMTYPE_STK600 || PDATA(pgm)->pgmtype == PGMTYPE_AVRISP_MKII || PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE_MKII) != 0 - && (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_TPI)) != 0) { + && (p->prog_modes & (PM_PDI | PM_TPI)) != 0) { stk600_setup_xprog(pgm); } else { stk600_setup_isp(pgm); @@ -3689,7 +3685,7 @@ static int stk600_xprog_program_enable(const PROGRAMMER *pgm, const AVRPART *p) AVRMEM *mem = NULL; int use_tpi; - use_tpi = (p->flags & AVRPART_HAS_TPI) != 0; + use_tpi = (p->prog_modes & PM_TPI) != 0; if (!use_tpi) { if (p->nvm_base == 0) { @@ -3825,7 +3821,7 @@ static int stk600_xprog_write_byte(const PROGRAMMER *pgm, const AVRPART *p, cons memcode = XPRG_MEM_TYPE_LOCKBITS; } else if (strncmp(mem->desc, "fuse", strlen("fuse")) == 0) { memcode = XPRG_MEM_TYPE_FUSE; - if (p->flags & AVRPART_HAS_TPI) + if (p->prog_modes & PM_TPI) /* * TPI devices need a mystic erase prior to writing their * fuses. @@ -3855,7 +3851,7 @@ static int stk600_xprog_write_byte(const PROGRAMMER *pgm, const AVRPART *p, cons } } - if (p->flags & AVRPART_HAS_TPI) { + if (p->prog_modes & PM_TPI) { /* * Some TPI memories (configuration aka. fuse) require a * larger write block size. We record that as a blocksize in @@ -4217,7 +4213,7 @@ static int stk600_xprog_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { AVRMEM *mem; unsigned int addr = 0; - if (p->flags & AVRPART_HAS_TPI) { + if (p->prog_modes & PM_TPI) { if ((mem = avr_locate_mem(p, "flash")) == NULL) { avrdude_message(MSG_INFO, "%s: stk600_xprog_chip_erase(): no FLASH definition found for TPI device\n", progname); diff --git a/src/usbasp.c b/src/usbasp.c index 6a0e00f0..65750dda 100644 --- a/src/usbasp.c +++ b/src/usbasp.c @@ -674,7 +674,7 @@ static int usbasp_initialize(const PROGRAMMER *pgm, const AVRPART *p) { else pdata->capabilities = 0; - pdata->use_tpi = (pdata->capabilities & USBASP_CAP_TPI) && (p->flags & AVRPART_HAS_TPI); + pdata->use_tpi = (pdata->capabilities & USBASP_CAP_TPI) && (p->prog_modes & PM_TPI); // query support for 3 MHz SCK in UsbAsp-flash firmware // https://github.com/nofeletru/UsbAsp-flash pdata->sck_3mhz = ((pdata->capabilities & USBASP_CAP_3MHZ) != 0) ? 1 :0; diff --git a/src/usbtiny.c b/src/usbtiny.c index 5cdaad4a..2e319318 100644 --- a/src/usbtiny.c +++ b/src/usbtiny.c @@ -454,7 +454,7 @@ static int usbtiny_initialize (const PROGRAMMER *pgm, const AVRPART *p ) { // Let the device wake up. usleep(50000); - if (p->flags & AVRPART_HAS_TPI) { + if (p->prog_modes & PM_TPI) { /* Since there is a single TPIDATA line, MOSI and MISO must be linked together through a 1kOhm resistor. Verify that everything we send on MOSI gets mirrored back on MISO. */ @@ -605,7 +605,7 @@ static int usbtiny_spi(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned static int usbtiny_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char res[4]; - if (p->flags & AVRPART_HAS_TPI) + if (p->prog_modes & PM_TPI) return avr_tpi_chip_erase(pgm, p); if (p->op[AVR_OP_CHIP_ERASE] == NULL) { @@ -773,7 +773,7 @@ static int usbtiny_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AV static int usbtiny_program_enable(const PROGRAMMER *pgm, const AVRPART *p) { unsigned char buf[4]; - if (p->flags & AVRPART_HAS_TPI) + if (p->prog_modes & PM_TPI) return avr_tpi_program_enable(pgm, p, TPIPCR_GT_0b); else return usbtiny_avr_op(pgm, p, AVR_OP_PGM_ENABLE, buf); From 626a43b139b570aa030fabfd3d07b9eeed7df2ea Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 30 Aug 2022 19:48:17 +0100 Subject: [PATCH 224/511] Add avrintel.[ch] to the project and warn if mcuid incompatible with avrintel.c --- src/CMakeLists.txt | 2 + src/avrdude.conf.in | 3 +- src/avrintel.c | 5447 ++++++++++++++++++++++++++++++++++++++++++ src/avrintel.h | 1477 ++++++++++++ src/avrpart.c | 1 + src/config.c | 40 + src/config.h | 1 + src/config_gram.y | 2 + src/doc/avrdude.texi | 2 +- 9 files changed, 6973 insertions(+), 2 deletions(-) create mode 100644 src/avrintel.c create mode 100644 src/avrintel.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 804468c1..2cb8f5f1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -252,6 +252,8 @@ add_executable(avrdude main.c term.c term.h + avrintel.c + avrintel.h developer_opts.c developer_opts.h developer_opts_private.h diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 018850d3..197663ef 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -68,7 +68,7 @@ # id = ; # quoted string # family_id = ; # quoted string, eg, "megaAVR" or "tinyAVR" # prog_modes = PM_ {| PM_} # interfaces, eg, PM_SPM|PM_ISP|PM_HVPP|PM_debugWIRE -# mcuid = ; # unique id in 0..2039 for urclock programmer +# mcuid = ; # unique id in 0..2039 for 8-bit AVRs # n_interrupts = ; # number of interrupts, used for vector bootloaders # n_page_erase = ; # if set, number of pages erased during NVM erase # hvupdi_variant = ; # numeric -1 (n/a) or 0..2 @@ -13169,6 +13169,7 @@ part part parent ".reduced_core_tiny" desc = "ATtiny4"; id = "t4"; + mcuid = 0; n_interrupts = 10; signature = 0x1e 0x8f 0x0a; diff --git a/src/avrintel.c b/src/avrintel.c new file mode 100644 index 00000000..c31b01eb --- /dev/null +++ b/src/avrintel.c @@ -0,0 +1,5447 @@ +/* + * Do not edit: automatically generated by mkavrintel.pl + * + * avrintel.c + * + * Atmel AVR8L, AVR8, XMEGA and AVR8X family description of interrupts and more + * + * published under GNU General Public License, version 3 (GPL-3.0) + * meta-author Stefan Rueger + * + * v 1.1 + * 30.08.2022 + * + */ + +#include "avrintel.h" + +const uPcore_t uP_table[] = { // Value of -1 typically means unknown + //{mcu_name, mcuid, family, {sig, na, ture}, flstart, flsize, pgsiz, nb, bootsz, eestart, eesize, ep, rambeg, ramsiz, nf, nl, ni, isr_names}, // Source + {"ATtiny4", 0, F_AVR8L, {0x1E, 0x8F, 0x0A}, 0, 0x00200, 0x010, 0, 0, 0, 0, 0, 0x0040, 0x0020, 1, 1, 10, vtab_attiny9}, // atdf, avr-gcc 12.2.0, avrdude, boot size (manual) + {"ATtiny5", 1, F_AVR8L, {0x1E, 0x8F, 0x09}, 0, 0x00200, 0x010, 0, 0, 0, 0, 0, 0x0040, 0x0020, 1, 1, 11, vtab_attiny10}, // atdf, avr-gcc 12.2.0, avrdude, boot size (manual) + {"ATtiny9", 2, F_AVR8L, {0x1E, 0x90, 0x08}, 0, 0x00400, 0x010, 0, 0, 0, 0, 0, 0x0040, 0x0020, 1, 1, 10, vtab_attiny9}, // atdf, avr-gcc 12.2.0, avrdude, boot size (manual) + {"ATtiny10", 3, F_AVR8L, {0x1E, 0x90, 0x03}, 0, 0x00400, 0x010, 0, 0, 0, 0, 0, 0x0040, 0x0020, 1, 1, 11, vtab_attiny10}, // atdf, avr-gcc 12.2.0, avrdude, boot size (manual) + {"ATtiny20", 4, F_AVR8L, {0x1E, 0x91, 0x0F}, 0, 0x00800, 0x020, 0, 0, 0, 0, 0, 0x0040, 0x0080, 1, 1, 17, vtab_attiny20}, // atdf, avr-gcc 12.2.0, avrdude, boot size (manual) + {"ATtiny40", 5, F_AVR8L, {0x1E, 0x92, 0x0E}, 0, 0x01000, 0x040, 0, 0, 0, 0, 0, 0x0040, 0x0100, 1, 1, 18, vtab_attiny40}, // atdf, avr-gcc 12.2.0, avrdude, boot size (manual) + {"ATtiny102", 6, F_AVR8L, {0x1E, 0x90, 0x0C}, 0, 0x00400, 0x010, 0, 0, 0, 0, 0, 0x0040, 0x0020, 1, 1, 16, vtab_attiny104}, // atdf, avrdude, boot size (manual) + {"ATtiny104", 7, F_AVR8L, {0x1E, 0x90, 0x0B}, 0, 0x00400, 0x010, 0, 0, 0, 0, 0, 0x0040, 0x0020, 1, 1, 16, vtab_attiny104}, // atdf, avrdude, boot size (manual) + + {"ATtiny11", 8, F_AVR8, {0x1E, 0x90, 0x04}, 0, 0x00400, 0x001, 0, 0, 0, 0x0040, 1, 0x0060, 0x0020, 1, 1, 5, vtab_attiny11}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny12", 9, F_AVR8, {0x1E, 0x90, 0x05}, 0, 0x00400, 0x001, 0, 0, 0, 0x0040, 2, 0x0060, 0x0020, 1, 1, 6, vtab_attiny12}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny13", 10, F_AVR8, {0x1E, 0x90, 0x07}, 0, 0x00400, 0x020, 0, 0, 0, 0x0040, 4, 0x0060, 0x0040, 2, 1, 10, vtab_attiny13a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny13A", 11, F_AVR8, {0x1E, 0x90, 0x07}, 0, 0x00400, 0x020, 0, 0, 0, 0x0040, 4, 0x0060, 0x0040, 2, 1, 10, vtab_attiny13a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny15", 12, F_AVR8, {0x1E, 0x90, 0x06}, 0, 0x00400, 0x001, 0, 0, 0, 0x0040, 2, 0x0060, 0x0020, 1, 1, 9, vtab_attiny15}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny22", 13, F_AVR8, {0x1E, 0x91, 0x06}, 0, 0x00800, -1, -1, -1, -1, -1, -1, 0x0060, 0x0080, 1, 1, 3, vtab_attiny22}, // avr-gcc 12.2.0 + {"ATtiny24", 14, F_AVR8, {0x1E, 0x91, 0x0B}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 17, vtab_attiny84a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny24A", 15, F_AVR8, {0x1E, 0x91, 0x0B}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 17, vtab_attiny84a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny25", 16, F_AVR8, {0x1E, 0x91, 0x08}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 15, vtab_attiny85}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny26", 17, F_AVR8, {0x1E, 0x91, 0x09}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 2, 1, 12, vtab_attiny26}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny28", 18, F_AVR8, {0x1E, 0x91, 0x07}, 0, 0x00800, 0x002, 0, 0, 0, 0, 0, 0x0060, 0x0020, 1, 1, 6, vtab_attiny28}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny43U", 19, F_AVR8, {0x1E, 0x92, 0x0C}, 0, 0x01000, 0x040, 0, 0, 0, 0x0040, 4, 0x0060, 0x0100, 3, 1, 16, vtab_attiny43u}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny44", 20, F_AVR8, {0x1E, 0x92, 0x07}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0060, 0x0100, 3, 1, 17, vtab_attiny84a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny44A", 21, F_AVR8, {0x1E, 0x92, 0x07}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0060, 0x0100, 3, 1, 17, vtab_attiny84a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny45", 22, F_AVR8, {0x1E, 0x92, 0x06}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0060, 0x0100, 3, 1, 15, vtab_attiny85}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny48", 23, F_AVR8, {0x1E, 0x92, 0x09}, 0, 0x01000, 0x040, 0, 0, 0, 0x0040, 4, 0x0100, 0x0100, 3, 1, 20, vtab_attiny88}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny84", 24, F_AVR8, {0x1E, 0x93, 0x0C}, 0, 0x02000, 0x040, 0, 0, 0, 0x0200, 4, 0x0060, 0x0200, 3, 1, 17, vtab_attiny84a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny84A", 25, F_AVR8, {0x1E, 0x93, 0x0C}, 0, 0x02000, 0x040, 0, 0, 0, 0x0200, 4, 0x0060, 0x0200, 3, 1, 17, vtab_attiny84a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny85", 26, F_AVR8, {0x1E, 0x93, 0x0B}, 0, 0x02000, 0x040, 0, 0, 0, 0x0200, 4, 0x0060, 0x0200, 3, 1, 15, vtab_attiny85}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny87", 27, F_AVR8, {0x1E, 0x93, 0x87}, 0, 0x02000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 20, vtab_attiny167}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny88", 28, F_AVR8, {0x1E, 0x93, 0x11}, 0, 0x02000, 0x040, 0, 0, 0, 0x0040, 4, 0x0100, 0x0200, 3, 1, 20, vtab_attiny88}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny167", 29, F_AVR8, {0x1E, 0x94, 0x87}, 0, 0x04000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 20, vtab_attiny167}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny261", 30, F_AVR8, {0x1E, 0x91, 0x0C}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 19, vtab_attiny861a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny261A", 31, F_AVR8, {0x1E, 0x91, 0x0C}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 19, vtab_attiny861a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny441", 32, F_AVR8, {0x1E, 0x92, 0x15}, 0, 0x01000, 0x010, 0, 0, 0, 0x0100, 4, 0x0100, 0x0100, 3, 1, 30, vtab_attiny841}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny461", 33, F_AVR8, {0x1E, 0x92, 0x08}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0060, 0x0100, 3, 1, 19, vtab_attiny861a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny461A", 34, F_AVR8, {0x1E, 0x92, 0x08}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0060, 0x0100, 3, 1, 19, vtab_attiny861a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny828", 35, F_AVR8, {0x1E, 0x93, 0x14}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 26, vtab_attiny828}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny828R", 36, F_AVR8, {0x1E, 0x93, 0x14}, 0, 0x02000, 0x040, -1, -1, 0, 0x0100, 4, -1, -1, -1, -1, 0, NULL}, // avrdude + {"ATtiny841", 37, F_AVR8, {0x1E, 0x93, 0x15}, 0, 0x02000, 0x010, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 30, vtab_attiny841}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny861", 38, F_AVR8, {0x1E, 0x93, 0x0D}, 0, 0x02000, 0x040, 0, 0, 0, 0x0200, 4, 0x0060, 0x0200, 3, 1, 19, vtab_attiny861a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny861A", 39, F_AVR8, {0x1E, 0x93, 0x0D}, 0, 0x02000, 0x040, 0, 0, 0, 0x0200, 4, 0x0060, 0x0200, 3, 1, 19, vtab_attiny861a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny1634", 40, F_AVR8, {0x1E, 0x94, 0x12}, 0, 0x04000, 0x020, 0, 0, 0, 0x0100, 4, 0x0100, 0x0400, 3, 1, 28, vtab_attiny1634}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny1634R", 41, F_AVR8, {0x1E, 0x94, 0x12}, 0, 0x04000, 0x020, -1, -1, 0, 0x0100, 4, -1, -1, -1, -1, 0, NULL}, // avrdude + {"ATtiny2313", 42, F_AVR8, {0x1E, 0x91, 0x0A}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 19, vtab_attiny2313}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny2313A", 43, F_AVR8, {0x1E, 0x91, 0x0A}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 21, vtab_attiny4313}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny4313", 44, F_AVR8, {0x1E, 0x92, 0x0D}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0060, 0x0100, 3, 1, 21, vtab_attiny4313}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega8", 45, F_AVR8, {0x1E, 0x93, 0x07}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0060, 0x0400, 2, 1, 19, vtab_atmega8a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega8A", 46, F_AVR8, {0x1E, 0x93, 0x07}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0060, 0x0400, 2, 1, 19, vtab_atmega8a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega8HVA", 47, F_AVR8, {0x1E, 0x93, 0x10}, 0, 0x02000, 0x080, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 1, 1, 21, vtab_atmega16hva}, // atdf, avr-gcc 12.2.0 + {"ATmega8U2", 48, F_AVR8, {0x1E, 0x93, 0x89}, 0, 0x02000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 29, vtab_atmega32u2}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega16", 49, F_AVR8, {0x1E, 0x94, 0x03}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0060, 0x0400, 2, 1, 21, vtab_atmega16a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega16A", 50, F_AVR8, {0x1E, 0x94, 0x03}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0060, 0x0400, 2, 1, 21, vtab_atmega16a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega16HVA", 51, F_AVR8, {0x1E, 0x94, 0x0C}, 0, 0x04000, 0x080, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 1, 1, 21, vtab_atmega16hva}, // atdf, avr-gcc 12.2.0 + {"ATmega16HVB", 52, F_AVR8, {0x1E, 0x94, 0x0D}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0400, 2, 1, 29, vtab_atmega32hvbrevb}, // atdf, avr-gcc 12.2.0 + {"ATmega16HVBrevB", 53, F_AVR8, {0x1E, 0x94, 0x0D}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0400, 2, 1, 29, vtab_atmega32hvbrevb}, // atdf, avr-gcc 12.2.0 + {"ATmega16M1", 54, F_AVR8, {0x1E, 0x94, 0x84}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 31, vtab_atmega64m1}, // atdf, avr-gcc 12.2.0 + {"ATmega16HVA2", 55, F_AVR8, {0x1E, 0x94, 0x0E}, 0, 0x04000, 0x080, -1, -1, -1, -1, -1, 0x0100, 0x0400, 2, 1, 22, vtab_atmega16hva2}, // avr-gcc 12.2.0 + {"ATmega16U2", 56, F_AVR8, {0x1E, 0x94, 0x89}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 29, vtab_atmega32u2}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega16U4", 57, F_AVR8, {0x1E, 0x94, 0x88}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0500, 3, 1, 43, vtab_atmega32u4}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega32", 58, F_AVR8, {0x1E, 0x95, 0x02}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0060, 0x0800, 2, 1, 21, vtab_atmega323}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega32A", 59, F_AVR8, {0x1E, 0x95, 0x02}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0060, 0x0800, 2, 1, 21, vtab_atmega323}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega32HVB", 60, F_AVR8, {0x1E, 0x95, 0x10}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 2, 1, 29, vtab_atmega32hvbrevb}, // atdf, avr-gcc 12.2.0 + {"ATmega32HVBrevB", 61, F_AVR8, {0x1E, 0x95, 0x10}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 2, 1, 29, vtab_atmega32hvbrevb}, // atdf, avr-gcc 12.2.0 + {"ATmega32C1", 62, F_AVR8, {0x1E, 0x95, 0x86}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 31, vtab_atmega64m1}, // atdf, avr-gcc 12.2.0 + {"ATmega32M1", 63, F_AVR8, {0x1E, 0x95, 0x84}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 31, vtab_atmega64m1}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega32U2", 64, F_AVR8, {0x1E, 0x95, 0x8A}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0400, 3, 1, 29, vtab_atmega32u2}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega32U4", 65, F_AVR8, {0x1E, 0x95, 0x87}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0a00, 3, 1, 43, vtab_atmega32u4}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega32U6", 66, F_AVR8, {0x1E, 0x95, 0x88}, 0, 0x08000, 0x080, 4, 0x0200, -1, -1, -1, 0x0100, 0x0a00, 3, 1, 38, vtab_atmega32u6}, // avr-gcc 12.2.0, boot size (manual) + {"ATmega48", 67, F_AVR8, {0x1E, 0x92, 0x05}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega48A", 68, F_AVR8, {0x1E, 0x92, 0x05}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega48P", 69, F_AVR8, {0x1E, 0x92, 0x0A}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega48PA", 70, F_AVR8, {0x1E, 0x92, 0x0A}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega48PB", 71, F_AVR8, {0x1E, 0x92, 0x10}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 27, vtab_atmega168pb}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega64", 72, F_AVR8, {0x1E, 0x96, 0x02}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 35, vtab_atmega128a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega64A", 73, F_AVR8, {0x1E, 0x96, 0x02}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 35, vtab_atmega128a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega64HVE", 74, F_AVR8, {0x1E, 0x96, 0x10}, 0, 0x10000, 0x080, 4, 0x0400, -1, -1, -1, 0x0100, 0x1000, 2, 1, 25, vtab_atmega64hve2}, // avr-gcc 12.2.0, boot size (manual) + {"ATmega64C1", 75, F_AVR8, {0x1E, 0x96, 0x86}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 31, vtab_atmega64m1}, // atdf, avr-gcc 12.2.0 + {"ATmega64M1", 76, F_AVR8, {0x1E, 0x96, 0x84}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 31, vtab_atmega64m1}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega64HVE2", 77, F_AVR8, {0x1E, 0x96, 0x10}, 0, 0x10000, 0x080, 4, 0x0400, 0, 0x0400, 4, 0x0100, 0x1000, 2, 1, 25, vtab_atmega64hve2}, // atdf, avr-gcc 12.2.0 + {"ATmega64RFR2", 78, F_AVR8, {0x1E, 0xA6, 0x02}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0200, 0x2000, 3, 1, 77, vtab_atmega2564rfr2}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega88", 79, F_AVR8, {0x1E, 0x93, 0x0A}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega88A", 80, F_AVR8, {0x1E, 0x93, 0x0A}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega88P", 81, F_AVR8, {0x1E, 0x93, 0x0F}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega88PA", 82, F_AVR8, {0x1E, 0x93, 0x0F}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega88PB", 83, F_AVR8, {0x1E, 0x93, 0x16}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 27, vtab_atmega168pb}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega103", 84, F_AVR8, {0x1E, 0x97, 0x01}, 0, 0x20000, 0x100, -1, -1, 0, 0x1000, 1, 0x0060, 0x0fa0, 1, 1, 24, vtab_atmega103}, // avr-gcc 12.2.0, avrdude + {"ATmega128", 85, F_AVR8, {0x1E, 0x97, 0x02}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x1000, 3, 1, 35, vtab_atmega128a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega128A", 86, F_AVR8, {0x1E, 0x97, 0x02}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x1000, 3, 1, 35, vtab_atmega128a}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega128RFA1", 87, F_AVR8, {0x1E, 0xA7, 0x01}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x4000, 3, 1, 72, vtab_atmega128rfa1}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega128RFR2", 88, F_AVR8, {0x1E, 0xA7, 0x02}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x4000, 3, 1, 77, vtab_atmega2564rfr2}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega161", 89, F_AVR8, {0x1E, 0x94, 0x01}, 0, 0x04000, 0x080, 1, 0x0400, 0, 0x0200, 1, 0x0060, 0x0400, 1, 1, 21, vtab_atmega161}, // avr-gcc 12.2.0, avrdude, boot size (manual) + {"ATmega162", 90, F_AVR8, {0x1E, 0x94, 0x04}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 28, vtab_atmega162}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega163", 91, F_AVR8, {0x1E, 0x94, 0x02}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 1, 0x0060, 0x0400, 2, 1, 18, vtab_atmega163}, // avr-gcc 12.2.0, avrdude, boot size (manual) + {"ATmega164A", 92, F_AVR8, {0x1E, 0x94, 0x0F}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 31, vtab_atmega644pa}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega164P", 93, F_AVR8, {0x1E, 0x94, 0x0A}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 31, vtab_atmega644pa}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega164PA", 94, F_AVR8, {0x1E, 0x94, 0x0A}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 31, vtab_atmega644pa}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega165", 95, F_AVR8, {0x1E, 0x94, 0x10}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 22, vtab_atmega645p}, // avr-gcc 12.2.0, avrdude, boot size (manual) + {"ATmega165A", 96, F_AVR8, {0x1E, 0x94, 0x10}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 22, vtab_atmega645p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega165P", 97, F_AVR8, {0x1E, 0x94, 0x07}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 22, vtab_atmega645p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega165PA", 98, F_AVR8, {0x1E, 0x94, 0x07}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 22, vtab_atmega645p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega168", 99, F_AVR8, {0x1E, 0x94, 0x06}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26, vtab_atmega328}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega168A", 100, F_AVR8, {0x1E, 0x94, 0x06}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega168P", 101, F_AVR8, {0x1E, 0x94, 0x0B}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega168PA", 102, F_AVR8, {0x1E, 0x94, 0x0B}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega168PB", 103, F_AVR8, {0x1E, 0x94, 0x15}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 27, vtab_atmega168pb}, // atdf, avr-gcc 7.3.0, avrdude + {"ATmega169", 104, F_AVR8, {0x1E, 0x94, 0x05}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 23, vtab_atmega649p}, // avr-gcc 12.2.0, avrdude, boot size (manual) + {"ATmega169A", 105, F_AVR8, {0x1E, 0x94, 0x11}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 23, vtab_atmega649p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega169P", 106, F_AVR8, {0x1E, 0x94, 0x05}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 23, vtab_atmega649p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega169PA", 107, F_AVR8, {0x1E, 0x94, 0x05}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 23, vtab_atmega649p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega256RFR2", 108, F_AVR8, {0x1E, 0xA8, 0x02}, 0, 0x40000, 0x100, 4, 0x0400, 0, 0x2000, 8, 0x0200, 0x8000, 3, 1, 77, vtab_atmega2564rfr2}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega323", 109, F_AVR8, {0x1E, 0x95, 0x01}, 0, 0x08000, 0x080, 4, 0x0200, -1, -1, -1, 0x0060, 0x0800, 2, 1, 21, vtab_atmega323}, // avr-gcc 12.2.0, boot size (manual) + {"ATmega324A", 110, F_AVR8, {0x1E, 0x95, 0x15}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 31, vtab_atmega644pa}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega324P", 111, F_AVR8, {0x1E, 0x95, 0x08}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 31, vtab_atmega644pa}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega324PA", 112, F_AVR8, {0x1E, 0x95, 0x11}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 31, vtab_atmega644pa}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega324PB", 113, F_AVR8, {0x1E, 0x95, 0x17}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 51, vtab_atmega324pb}, // atdf, avrdude + {"ATmega325", 114, F_AVR8, {0x1E, 0x95, 0x05}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 22, vtab_atmega645p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega325A", 115, F_AVR8, {0x1E, 0x95, 0x05}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 22, vtab_atmega645p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega325P", 116, F_AVR8, {0x1E, 0x95, 0x0D}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 22, vtab_atmega645p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega325PA", 117, F_AVR8, {0x1E, 0x95, 0x0D}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 22, vtab_atmega645p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega328", 118, F_AVR8, {0x1E, 0x95, 0x14}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 26, vtab_atmega328}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega328P", 119, F_AVR8, {0x1E, 0x95, 0x0F}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega328PB", 120, F_AVR8, {0x1E, 0x95, 0x16}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 45, vtab_atmega328pb}, // atdf, avr-gcc 7.3.0, avrdude + {"ATmega329", 121, F_AVR8, {0x1E, 0x95, 0x03}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 23, vtab_atmega649p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega329A", 122, F_AVR8, {0x1E, 0x95, 0x03}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 23, vtab_atmega649p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega329P", 123, F_AVR8, {0x1E, 0x95, 0x0B}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 23, vtab_atmega649p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega329PA", 124, F_AVR8, {0x1E, 0x95, 0x0B}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 23, vtab_atmega649p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega406", 125, F_AVR8, {0x1E, 0x95, 0x07}, 0, 0x0a000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0800, 2, 1, 23, vtab_atmega406}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega640", 126, F_AVR8, {0x1E, 0x96, 0x08}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x2000, 3, 1, 57, vtab_atmega2561}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega644", 127, F_AVR8, {0x1E, 0x96, 0x09}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 28, vtab_atmega644}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega644A", 128, F_AVR8, {0x1E, 0x96, 0x09}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 31, vtab_atmega644pa}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega644P", 129, F_AVR8, {0x1E, 0x96, 0x0A}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 31, vtab_atmega644pa}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega644PA", 130, F_AVR8, {0x1E, 0x96, 0x0A}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 31, vtab_atmega644pa}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega644RFR2", 131, F_AVR8, {0x1E, 0xA6, 0x03}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0200, 0x2000, 3, 1, 77, vtab_atmega2564rfr2}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega645", 132, F_AVR8, {0x1E, 0x96, 0x05}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 22, vtab_atmega645p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega645A", 133, F_AVR8, {0x1E, 0x96, 0x05}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 22, vtab_atmega645p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega645P", 134, F_AVR8, {0x1E, 0x96, 0x0D}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 22, vtab_atmega645p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega649", 135, F_AVR8, {0x1E, 0x96, 0x03}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 23, vtab_atmega649p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega649A", 136, F_AVR8, {0x1E, 0x96, 0x03}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 23, vtab_atmega649p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega649P", 137, F_AVR8, {0x1E, 0x96, 0x0B}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 23, vtab_atmega649p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega1280", 138, F_AVR8, {0x1E, 0x97, 0x03}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x2000, 3, 1, 57, vtab_atmega2561}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega1281", 139, F_AVR8, {0x1E, 0x97, 0x04}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x2000, 3, 1, 57, vtab_atmega2561}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega1284", 140, F_AVR8, {0x1E, 0x97, 0x06}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x4000, 3, 1, 35, vtab_atmega1284p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega1284P", 141, F_AVR8, {0x1E, 0x97, 0x05}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x4000, 3, 1, 35, vtab_atmega1284p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega1284RFR2", 142, F_AVR8, {0x1E, 0xA7, 0x03}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x4000, 3, 1, 77, vtab_atmega2564rfr2}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega2560", 143, F_AVR8, {0x1E, 0x98, 0x01}, 0, 0x40000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x2000, 3, 1, 57, vtab_atmega2561}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega2561", 144, F_AVR8, {0x1E, 0x98, 0x02}, 0, 0x40000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x2000, 3, 1, 57, vtab_atmega2561}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega2564RFR2", 145, F_AVR8, {0x1E, 0xA8, 0x03}, 0, 0x40000, 0x100, 4, 0x0400, 0, 0x2000, 8, 0x0200, 0x8000, 3, 1, 77, vtab_atmega2564rfr2}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega3250", 146, F_AVR8, {0x1E, 0x95, 0x06}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25, vtab_atmega6450p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega3250A", 147, F_AVR8, {0x1E, 0x95, 0x06}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25, vtab_atmega6450p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega3250P", 148, F_AVR8, {0x1E, 0x95, 0x0E}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25, vtab_atmega6450p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega3250PA", 149, F_AVR8, {0x1E, 0x95, 0x0E}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25, vtab_atmega6450p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega3290", 150, F_AVR8, {0x1E, 0x95, 0x04}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25, vtab_atmega6490p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega3290A", 151, F_AVR8, {0x1E, 0x95, 0x04}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25, vtab_atmega6490p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega3290P", 152, F_AVR8, {0x1E, 0x95, 0x0C}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25, vtab_atmega6490p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega3290PA", 153, F_AVR8, {0x1E, 0x95, 0x0C}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25, vtab_atmega6490p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega6450", 154, F_AVR8, {0x1E, 0x96, 0x06}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 25, vtab_atmega6450p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega6450A", 155, F_AVR8, {0x1E, 0x96, 0x06}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 25, vtab_atmega6450p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega6450P", 156, F_AVR8, {0x1E, 0x96, 0x0E}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 25, vtab_atmega6450p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega6490", 157, F_AVR8, {0x1E, 0x96, 0x04}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 25, vtab_atmega6490p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega6490A", 158, F_AVR8, {0x1E, 0x96, 0x04}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 25, vtab_atmega6490p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega6490P", 159, F_AVR8, {0x1E, 0x96, 0x0C}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 25, vtab_atmega6490p}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega8515", 160, F_AVR8, {0x1E, 0x93, 0x06}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0060, 0x0200, 2, 1, 17, vtab_atmega8515}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega8535", 161, F_AVR8, {0x1E, 0x93, 0x08}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0060, 0x0200, 2, 1, 21, vtab_atmega8535}, // atdf, avr-gcc 12.2.0, avrdude + {"AT43USB320", 162, F_AVR8, {0xff, -1, -1}, 0, 0x10000, -1, -1, -1, -1, -1, -1, 0x0060, 0x0200, -1, -1, 0, NULL}, // avr-gcc 12.2.0 + {"AT43USB355", 163, F_AVR8, {0xff, -1, -1}, 0, 0x06000, -1, -1, -1, -1, -1, -1, 0x0060, 0x0400, -1, -1, 0, NULL}, // avr-gcc 12.2.0 + {"AT76C711", 164, F_AVR8, {0xff, -1, -1}, 0, 0x04000, -1, -1, -1, -1, -1, -1, 0x0060, 0x07a0, -1, -1, 0, NULL}, // avr-gcc 12.2.0 + {"AT86RF401", 165, F_AVR8, {0x1E, 0x91, 0x81}, 0, 0x00800, -1, -1, -1, -1, -1, -1, 0x0060, 0x0080, 0, 1, 3, vtab_at86rf401}, // avr-gcc 12.2.0 + {"AT90PWM1", 166, F_AVR8, {0x1E, 0x93, 0x83}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 32, vtab_at90pwm316}, // atdf, avr-gcc 12.2.0 + {"AT90PWM2", 167, F_AVR8, {0x1E, 0x93, 0x81}, 0, 0x02000, 0x040, 4, -1, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 32, vtab_at90pwm2}, // avr-gcc 12.2.0, avrdude + {"AT90PWM2B", 168, F_AVR8, {0x1E, 0x93, 0x83}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 32, vtab_at90pwm3b}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90PWM3", 169, F_AVR8, {0x1E, 0x93, 0x81}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 32, vtab_at90pwm3b}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90PWM3B", 170, F_AVR8, {0x1E, 0x93, 0x83}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 32, vtab_at90pwm3b}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90CAN32", 171, F_AVR8, {0x1E, 0x95, 0x81}, 0, 0x08000, 0x100, 4, 0x0400, 0, 0x0400, 8, 0x0100, 0x0800, 3, 1, 37, vtab_at90can128}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90CAN64", 172, F_AVR8, {0x1E, 0x96, 0x81}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 37, vtab_at90can128}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90PWM81", 173, F_AVR8, {0x1E, 0x93, 0x88}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0100, 3, 1, 20, vtab_at90pwm161}, // atdf, avr-gcc 12.2.0 + {"AT90USB82", 174, F_AVR8, {0x1E, 0x93, 0x82}, 0, 0x02000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 29, vtab_atmega32u2}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90SCR100", 175, F_AVR8, {0x1E, 0x96, 0xC1}, 0, 0x10000, 0x100, 4, 0x0200, -1, -1, -1, 0x0100, 0x1000, 3, 1, 38, vtab_at90scr100}, // avr-gcc 12.2.0, boot size (manual) + {"AT90CAN128", 176, F_AVR8, {0x1E, 0x97, 0x81}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x1000, 3, 1, 37, vtab_at90can128}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90PWM161", 177, F_AVR8, {0x1E, 0x94, 0x8B}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 20, vtab_at90pwm161}, // atdf, avr-gcc 12.2.0 + {"AT90USB162", 178, F_AVR8, {0x1E, 0x94, 0x82}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 29, vtab_atmega32u2}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90PWM216", 179, F_AVR8, {0x1E, 0x94, 0x83}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 32, vtab_at90pwm316}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90PWM316", 180, F_AVR8, {0x1E, 0x94, 0x83}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 32, vtab_at90pwm316}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90USB646", 181, F_AVR8, {0x1E, 0x96, 0x82}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 38, vtab_atmega32u6}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90USB647", 182, F_AVR8, {0x1E, 0x96, 0x82}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 38, vtab_atmega32u6}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90S1200", 183, F_AVR8, {0x1E, 0x90, 0x01}, 0, 0x00400, 0x001, -1, -1, 0, 0x0040, 1, 0x0060, 0x0020, 1, 1, 4, vtab_at90s1200}, // avr-gcc 12.2.0, avrdude + {"AT90USB1286", 184, F_AVR8, {0x1E, 0x97, 0x82}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x2000, 3, 1, 38, vtab_atmega32u6}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90USB1287", 185, F_AVR8, {0x1E, 0x97, 0x82}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x2000, 3, 1, 38, vtab_atmega32u6}, // atdf, avr-gcc 12.2.0, avrdude + {"AT90S2313", 186, F_AVR8, {0x1E, 0x91, 0x01}, 0, 0x00800, 0x001, -1, -1, 0, 0x0080, 1, 0x0060, 0x0080, 1, 1, 11, vtab_at90s2313}, // avr-gcc 12.2.0, avrdude + {"AT90S2323", 187, F_AVR8, {0x1E, 0x91, 0x02}, 0, 0x00800, -1, -1, -1, -1, -1, -1, 0x0060, 0x0080, 1, 1, 3, vtab_attiny22}, // avr-gcc 12.2.0 + {"AT90S2333", 188, F_AVR8, {0x1E, 0x91, 0x05}, 0, 0x00800, 0x001, -1, -1, 0, 0x0080, 1, 0x0060, 0x0080, -1, -1, 14, vtab_at90s4433}, // avr-gcc 12.2.0, avrdude + {"AT90S2343", 189, F_AVR8, {0x1E, 0x91, 0x03}, 0, 0x00800, 0x001, -1, -1, 0, 0x0080, 1, 0x0060, 0x0080, 1, 1, 3, vtab_attiny22}, // avr-gcc 12.2.0, avrdude + {"AT90S4414", 190, F_AVR8, {0x1E, 0x92, 0x01}, 0, 0x01000, 0x001, -1, -1, 0, 0x0100, 1, 0x0060, 0x0100, 1, 1, 13, vtab_at90s8515}, // avr-gcc 12.2.0, avrdude + {"AT90S4433", 191, F_AVR8, {0x1E, 0x92, 0x03}, 0, 0x01000, 0x001, -1, -1, 0, 0x0100, 1, 0x0060, 0x0080, 1, 1, 14, vtab_at90s4433}, // avr-gcc 12.2.0, avrdude + {"AT90S4434", 192, F_AVR8, {0x1E, 0x92, 0x02}, 0, 0x01000, 0x001, -1, -1, 0, 0x0100, 1, 0x0060, 0x0100, 1, 1, 17, vtab_at90s8535}, // avr-gcc 12.2.0, avrdude + {"AT90S8515", 193, F_AVR8, {0x1E, 0x93, 0x01}, 0, 0x02000, 0x001, -1, -1, 0, 0x0200, 1, 0x0060, 0x0200, 1, 1, 13, vtab_at90s8515}, // avr-gcc 12.2.0, avrdude + {"AT90C8534", 194, F_AVR8, {0xff, -1, -1}, 0, 0x02000, -1, -1, -1, -1, -1, -1, 0x0060, 0x0100, -1, -1, 0, NULL}, // avr-gcc 12.2.0 + {"AT90S8535", 195, F_AVR8, {0x1E, 0x93, 0x03}, 0, 0x02000, 0x001, -1, -1, 0, 0x0200, 1, 0x0060, 0x0200, 1, 1, 17, vtab_at90s8535}, // avr-gcc 12.2.0, avrdude + {"AT94K", 196, F_AVR8, {0xff, -1, -1}, 0, 0x08000, -1, -1, -1, -1, -1, -1, 0x0060, 0x0fa0, -1, -1, 0, NULL}, // avr-gcc 12.2.0 + {"ATA5272", 197, F_AVR8, {0x1E, 0x93, 0x87}, 0, 0x02000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 37, vtab_ata5272}, // atdf, avr-gcc 12.2.0 + {"ATA5505", 198, F_AVR8, {0x1E, 0x94, 0x87}, 0, 0x04000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 20, vtab_attiny167}, // atdf, avr-gcc 12.2.0 + {"ATA5700M322", 199, F_AVR8, {0x1E, 0x95, 0x67}, 0x08000, 0x08000, 0x040, 0, 0, 0, 0x0880, 16, 0x0200, 0x0400, 1, 1, 51, vtab_ata5702m322}, // atdf + {"ATA5702M322", 200, F_AVR8, {0x1E, 0x95, 0x69}, 0x08000, 0x08000, 0x040, 0, 0, 0, 0x0880, 16, 0x0200, 0x0400, 1, 1, 51, vtab_ata5702m322}, // atdf, avr-gcc 12.2.0 + {"ATA5781", 201, F_AVR8, {0x1E, 0x95, 0x64}, -1, -1, -1, 0, 0, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42, vtab_ata8515}, // atdf + {"ATA5782", 202, F_AVR8, {0x1E, 0x95, 0x65}, 0x08000, 0x05000, 0x040, 1, 0x5000, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42, vtab_ata8515}, // atdf, avr-gcc 12.2.0 + {"ATA5783", 203, F_AVR8, {0x1E, 0x95, 0x66}, -1, -1, -1, 0, 0, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42, vtab_ata8515}, // atdf + {"ATA5787", 204, F_AVR8, {0x1E, 0x94, 0x6C}, 0x08000, 0x05200, 0x040, 0, 0, 0, 0x0400, 16, 0x0200, 0x0800, 1, 1, 44, vtab_ata5835}, // atdf + {"ATA5790", 205, F_AVR8, {0x1E, 0x94, 0x61}, 0, 0x04000, 0x080, 1, 0x0800, 0, 0x0800, 16, 0x0100, 0x0200, 1, 1, 30, vtab_ata5790}, // atdf, avr-gcc 12.2.0 + {"ATA5790N", 206, F_AVR8, {0x1E, 0x94, 0x62}, 0, 0x04000, 0x080, 1, 0x0800, 0, 0x0800, 16, 0x0100, 0x0200, 1, 1, 31, vtab_ata5791}, // atdf, avr-gcc 12.2.0 + {"ATA5791", 207, F_AVR8, {0x1E, 0x94, 0x62}, 0, 0x04000, 0x080, 1, 0x0800, 0, 0x0800, 16, 0x0100, 0x0200, 1, 1, 31, vtab_ata5791}, // atdf, avr-gcc 7.3.0 + {"ATA5795", 208, F_AVR8, {0x1E, 0x93, 0x61}, 0, 0x02000, 0x040, 1, 0x0800, 0, 0x0800, 16, 0x0100, 0x0200, 1, 1, 23, vtab_ata5795}, // atdf, avr-gcc 12.2.0 + {"ATA5831", 209, F_AVR8, {0x1E, 0x95, 0x61}, 0x08000, 0x05000, 0x040, 1, 0x5000, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42, vtab_ata8515}, // atdf, avr-gcc 12.2.0 + {"ATA5832", 210, F_AVR8, {0x1E, 0x95, 0x62}, -1, -1, -1, 0, 0, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42, vtab_ata8515}, // atdf + {"ATA5833", 211, F_AVR8, {0x1E, 0x95, 0x63}, -1, -1, -1, 0, 0, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42, vtab_ata8515}, // atdf + {"ATA5835", 212, F_AVR8, {0x1E, 0x94, 0x6B}, 0x08000, 0x05200, 0x040, 0, 0, 0, 0x0400, 16, 0x0200, 0x0800, 1, 1, 44, vtab_ata5835}, // atdf + {"ATA6285", 213, F_AVR8, {0x1E, 0x93, 0x82}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0140, 4, 0x0100, 0x0200, 2, 1, 27, vtab_ata6289}, // atdf, avr-gcc 12.2.0 + {"ATA6286", 214, F_AVR8, {0x1E, 0x93, 0x82}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0140, 4, 0x0100, 0x0200, 2, 1, 27, vtab_ata6289}, // atdf, avr-gcc 12.2.0 + {"ATA6289", 215, F_AVR8, {0x1E, 0x93, 0x82}, 0, 0x02000, 0x040, 4, 0x0100, -1, -1, -1, 0x0100, 0x0200, 2, 1, 27, vtab_ata6289}, // avr-gcc 12.2.0, boot size (manual) + {"ATA6612C", 216, F_AVR8, {0x1E, 0x93, 0x0A}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0 + {"ATA6613C", 217, F_AVR8, {0x1E, 0x94, 0x06}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0 + {"ATA6614Q", 218, F_AVR8, {0x1E, 0x95, 0x0F}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 26, vtab_atmega328p}, // atdf, avr-gcc 12.2.0 + {"ATA6616C", 219, F_AVR8, {0x1E, 0x93, 0x87}, 0, 0x02000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 20, vtab_attiny167}, // atdf, avr-gcc 12.2.0 + {"ATA6617C", 220, F_AVR8, {0x1E, 0x94, 0x87}, 0, 0x04000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 20, vtab_attiny167}, // atdf, avr-gcc 12.2.0 + {"ATA8210", 221, F_AVR8, {0x1E, 0x95, 0x65}, 0x08000, 0x05000, 0x040, 1, 0x5000, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42, vtab_ata8515}, // atdf, avr-gcc 7.3.0 + {"ATA8215", 222, F_AVR8, {0x1E, 0x95, 0x64}, -1, -1, -1, 0, 0, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42, vtab_ata8515}, // atdf + {"ATA8510", 223, F_AVR8, {0x1E, 0x95, 0x61}, 0x08000, 0x05000, 0x040, 1, 0x5000, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42, vtab_ata8515}, // atdf, avr-gcc 7.3.0 + {"ATA8515", 224, F_AVR8, {0x1E, 0x95, 0x63}, -1, -1, -1, 0, 0, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42, vtab_ata8515}, // atdf + {"ATA664251", 225, F_AVR8, {0x1E, 0x94, 0x87}, 0, 0x04000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 20, vtab_attiny167}, // atdf, avr-gcc 12.2.0 + {"M3000", 226, F_AVR8, {0xff, -1, -1}, 0, 0x10000, -1, -1, -1, -1, -1, -1, 0x1000, 0x1000, -1, -1, 0, NULL}, // avr-gcc 12.2.0 + {"LGT8F88P", 227, F_AVR8, {0x1E, 0x93, 0x0F}, 0, 0x02000, 0x040, -1, -1, 0, 0x0200, 4, -1, -1, -1, -1, 0, NULL}, // avrdude + {"LGT8F168P", 228, F_AVR8, {0x1E, 0x94, 0x0B}, 0, 0x04000, 0x080, -1, -1, 0, 0x0200, 4, -1, -1, -1, -1, 0, NULL}, // avrdude + {"LGT8F328P", 229, F_AVR8, {0x1E, 0x95, 0x0F}, 0, 0x08000, 0x080, -1, -1, 0, 0x0400, 4, -1, -1, -1, -1, 0, NULL}, // avrdude + + {"ATxmega8E5", 230, F_XMEGA, {0x1E, 0x93, 0x41}, 0, 0x02800, 0x080, 1, 0x0800, 0, 0x0200, 32, 0x2000, 0x0400, 7, 1, 43, vtab_atxmega32e5}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega16A4", 231, F_XMEGA, {0x1E, 0x94, 0x41}, 0, 0x05000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x0800, 6, 1, 94, vtab_atxmega32a4}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega16A4U", 232, F_XMEGA, {0x1E, 0x94, 0x41}, 0, 0x05000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x0800, 6, 1, 127, vtab_atxmega128a4u}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega16C4", 233, F_XMEGA, {0x1E, 0x94, 0x43}, 0, 0x05000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x0800, 6, 1, 127, vtab_atxmega32c4}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega16D4", 234, F_XMEGA, {0x1E, 0x94, 0x42}, 0, 0x05000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x0800, 6, 1, 91, vtab_atxmega32d4}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega16E5", 235, F_XMEGA, {0x1E, 0x94, 0x45}, 0, 0x05000, 0x080, 1, 0x1000, 0, 0x0200, 32, 0x2000, 0x0800, 7, 1, 43, vtab_atxmega32e5}, // atdf, avr-gcc 7.3.0, avrdude + {"ATxmega32C3", 236, F_XMEGA, {0x1E, 0x95, 0x49}, 0, 0x09000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 6, 1, 127, vtab_atxmega256c3}, // atdf, avr-gcc 12.2.0 + {"ATxmega32D3", 237, F_XMEGA, {0x1E, 0x95, 0x4A}, 0, 0x09000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 6, 1, 114, vtab_atxmega384d3}, // atdf, avr-gcc 12.2.0 + {"ATxmega32A4", 238, F_XMEGA, {0x1E, 0x95, 0x41}, 0, 0x09000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 6, 1, 94, vtab_atxmega32a4}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega32A4U", 239, F_XMEGA, {0x1E, 0x95, 0x41}, 0, 0x09000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 6, 1, 127, vtab_atxmega128a4u}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega32C4", 240, F_XMEGA, {0x1E, 0x95, 0x44}, 0, 0x09000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 6, 1, 127, vtab_atxmega32c4}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega32D4", 241, F_XMEGA, {0x1E, 0x95, 0x42}, 0, 0x09000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 6, 1, 91, vtab_atxmega32d4}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega32E5", 242, F_XMEGA, {0x1E, 0x95, 0x4C}, 0, 0x09000, 0x080, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 7, 1, 43, vtab_atxmega32e5}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega64A1", 243, F_XMEGA, {0x1E, 0x96, 0x4E}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 125, vtab_atxmega128a1}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega64A1U", 244, F_XMEGA, {0x1E, 0x96, 0x4E}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 127, vtab_atxmega128a1u}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega64B1", 245, F_XMEGA, {0x1E, 0x96, 0x52}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 81, vtab_atxmega128b1}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega64A3", 246, F_XMEGA, {0x1E, 0x96, 0x42}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 122, vtab_atxmega256a3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega64A3U", 247, F_XMEGA, {0x1E, 0x96, 0x42}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 127, vtab_atxmega256a3u}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega64B3", 248, F_XMEGA, {0x1E, 0x96, 0x51}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 54, vtab_atxmega128b3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega64C3", 249, F_XMEGA, {0x1E, 0x96, 0x49}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 127, vtab_atxmega256c3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega64D3", 250, F_XMEGA, {0x1E, 0x96, 0x4A}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 114, vtab_atxmega384d3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega64A4", 251, F_XMEGA, {0x1E, 0x96, 0x46}, 0, 0x11000, 0x100, -1, -1, 0, 0x0800, 32, -1, -1, -1, -1, 0, NULL}, // avrdude + {"ATxmega64A4U", 252, F_XMEGA, {0x1E, 0x96, 0x46}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 127, vtab_atxmega128a4u}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega64D4", 253, F_XMEGA, {0x1E, 0x96, 0x47}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 91, vtab_atxmega128d4}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega128A1", 254, F_XMEGA, {0x1E, 0x97, 0x4C}, 0, 0x22000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 125, vtab_atxmega128a1}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega128A1revD", 255, F_XMEGA, {0x1E, 0x97, 0x41}, 0, 0x22000, 0x200, -1, -1, 0, 0x0800, 32, -1, -1, -1, -1, 0, NULL}, // avrdude + {"ATxmega128A1U", 256, F_XMEGA, {0x1E, 0x97, 0x4C}, 0, 0x22000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 127, vtab_atxmega128a1u}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega128B1", 257, F_XMEGA, {0x1E, 0x97, 0x4D}, 0, 0x22000, 0x100, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 81, vtab_atxmega128b1}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega128A3", 258, F_XMEGA, {0x1E, 0x97, 0x42}, 0, 0x22000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 122, vtab_atxmega256a3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega128A3U", 259, F_XMEGA, {0x1E, 0x97, 0x42}, 0, 0x22000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 127, vtab_atxmega256a3u}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega128B3", 260, F_XMEGA, {0x1E, 0x97, 0x4B}, 0, 0x22000, 0x100, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 54, vtab_atxmega128b3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega128C3", 261, F_XMEGA, {0x1E, 0x97, 0x52}, 0, 0x22000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 127, vtab_atxmega256c3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega128D3", 262, F_XMEGA, {0x1E, 0x97, 0x48}, 0, 0x22000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 114, vtab_atxmega384d3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega128A4", 263, F_XMEGA, {0x1E, 0x97, 0x46}, 0, 0x22000, 0x200, -1, -1, 0, 0x0800, 32, -1, -1, -1, -1, 0, NULL}, // avrdude + {"ATxmega128A4U", 264, F_XMEGA, {0x1E, 0x97, 0x46}, 0, 0x22000, 0x100, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 127, vtab_atxmega128a4u}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega128D4", 265, F_XMEGA, {0x1E, 0x97, 0x47}, 0, 0x22000, 0x100, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 91, vtab_atxmega128d4}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega192A1", 266, F_XMEGA, {0x1E, 0x97, 0x4E}, 0, 0x32000, 0x200, -1, -1, 0, 0x0800, 32, -1, -1, -1, -1, 0, NULL}, // avrdude + {"ATxmega192A3", 267, F_XMEGA, {0x1E, 0x97, 0x44}, 0, 0x32000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x4000, 6, 1, 122, vtab_atxmega256a3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega192A3U", 268, F_XMEGA, {0x1E, 0x97, 0x44}, 0, 0x32000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x4000, 6, 1, 127, vtab_atxmega256a3u}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega192C3", 269, F_XMEGA, {0x1E, 0x97, 0x51}, 0, 0x32000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x4000, 6, 1, 127, vtab_atxmega256c3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega192D3", 270, F_XMEGA, {0x1E, 0x97, 0x49}, 0, 0x32000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x4000, 6, 1, 114, vtab_atxmega384d3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega256A1", 271, F_XMEGA, {0x1E, 0x98, 0x46}, 0, 0x42000, 0x200, -1, -1, 0, 0x1000, 32, -1, -1, -1, -1, 0, NULL}, // avrdude + {"ATxmega256A3", 272, F_XMEGA, {0x1E, 0x98, 0x42}, 0, 0x42000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x4000, 6, 1, 122, vtab_atxmega256a3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega256A3B", 273, F_XMEGA, {0x1E, 0x98, 0x43}, 0, 0x42000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x4000, 6, 1, 122, vtab_atxmega256a3b}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega256A3BU", 274, F_XMEGA, {0x1E, 0x98, 0x43}, 0, 0x42000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x4000, 6, 1, 127, vtab_atxmega256a3bu}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega256A3U", 275, F_XMEGA, {0x1E, 0x98, 0x42}, 0, 0x42000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x4000, 6, 1, 127, vtab_atxmega256a3u}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega256C3", 276, F_XMEGA, {0x1E, 0x98, 0x46}, 0, 0x42000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x4000, 6, 1, 127, vtab_atxmega256c3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega256D3", 277, F_XMEGA, {0x1E, 0x98, 0x44}, 0, 0x42000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x4000, 6, 1, 114, vtab_atxmega384d3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega384C3", 278, F_XMEGA, {0x1E, 0x98, 0x45}, 0, 0x62000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x8000, 6, 1, 127, vtab_atxmega384c3}, // atdf, avr-gcc 12.2.0, avrdude + {"ATxmega384D3", 279, F_XMEGA, {0x1E, 0x98, 0x47}, 0, 0x62000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x8000, 6, 1, 114, vtab_atxmega384d3}, // atdf, avr-gcc 12.2.0, avrdude + + {"ATtiny202", 280, F_AVR8X, {0x1E, 0x91, 0x23}, 0, 0x00800, 0x040, 1, 0, 0x01400, 0x0040, 32, 0x3f80, 0x0080, 10, 1, 26, vtab_attiny402}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny204", 281, F_AVR8X, {0x1E, 0x91, 0x22}, 0, 0x00800, 0x040, 1, 0, 0x01400, 0x0040, 32, 0x3f80, 0x0080, 10, 1, 26, vtab_attiny404}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny212", 282, F_AVR8X, {0x1E, 0x91, 0x21}, 0, 0x00800, 0x040, 1, 0, 0x01400, 0x0040, 32, 0x3f80, 0x0080, 10, 1, 26, vtab_attiny412}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny214", 283, F_AVR8X, {0x1E, 0x91, 0x20}, 0, 0x00800, 0x040, 1, 0, 0x01400, 0x0040, 32, 0x3f80, 0x0080, 10, 1, 26, vtab_attiny814}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny402", 284, F_AVR8X, {0x1E, 0x92, 0x27}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26, vtab_attiny402}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny404", 285, F_AVR8X, {0x1E, 0x92, 0x26}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26, vtab_attiny404}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny406", 286, F_AVR8X, {0x1E, 0x92, 0x25}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26, vtab_attiny406}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny412", 287, F_AVR8X, {0x1E, 0x92, 0x23}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26, vtab_attiny412}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny414", 288, F_AVR8X, {0x1E, 0x92, 0x22}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26, vtab_attiny814}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny416", 289, F_AVR8X, {0x1E, 0x92, 0x21}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26, vtab_attiny817}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny416auto", 290, F_AVR8X, {0x1E, 0x92, 0x28}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26, vtab_attiny817}, // atdf + {"ATtiny417", 291, F_AVR8X, {0x1E, 0x92, 0x20}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26, vtab_attiny817}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny424", 292, F_AVR8X, {0x1E, 0x92, 0x2C}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 30, vtab_attiny3227}, // atdf, avrdude + {"ATtiny426", 293, F_AVR8X, {0x1E, 0x92, 0x2B}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 30, vtab_attiny3227}, // atdf, avrdude + {"ATtiny427", 294, F_AVR8X, {0x1E, 0x92, 0x2A}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 30, vtab_attiny3227}, // atdf, avrdude + {"ATtiny804", 295, F_AVR8X, {0x1E, 0x93, 0x25}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 31, vtab_attiny1607}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny806", 296, F_AVR8X, {0x1E, 0x93, 0x24}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 31, vtab_attiny1607}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny807", 297, F_AVR8X, {0x1E, 0x93, 0x23}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 31, vtab_attiny1607}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny814", 298, F_AVR8X, {0x1E, 0x93, 0x22}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 26, vtab_attiny814}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny816", 299, F_AVR8X, {0x1E, 0x93, 0x21}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 26, vtab_attiny817}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny817", 300, F_AVR8X, {0x1E, 0x93, 0x20}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 26, vtab_attiny817}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny824", 301, F_AVR8X, {0x1E, 0x93, 0x29}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3c00, 0x0400, 10, 1, 30, vtab_attiny3227}, // atdf, avrdude + {"ATtiny826", 302, F_AVR8X, {0x1E, 0x93, 0x28}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3c00, 0x0400, 10, 1, 30, vtab_attiny3227}, // atdf, avrdude + {"ATtiny827", 303, F_AVR8X, {0x1E, 0x93, 0x27}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3c00, 0x0400, 10, 1, 30, vtab_attiny3227}, // atdf, avrdude + {"ATtiny1604", 304, F_AVR8X, {0x1E, 0x94, 0x25}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3c00, 0x0400, 10, 1, 31, vtab_attiny1607}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny1606", 305, F_AVR8X, {0x1E, 0x94, 0x24}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3c00, 0x0400, 10, 1, 31, vtab_attiny1607}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny1607", 306, F_AVR8X, {0x1E, 0x94, 0x23}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3c00, 0x0400, 10, 1, 31, vtab_attiny1607}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny1614", 307, F_AVR8X, {0x1E, 0x94, 0x22}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 31, vtab_attiny1614}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny1616", 308, F_AVR8X, {0x1E, 0x94, 0x21}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 31, vtab_attiny3217}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny1617", 309, F_AVR8X, {0x1E, 0x94, 0x20}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 31, vtab_attiny3217}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny1624", 310, F_AVR8X, {0x1E, 0x94, 0x2A}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 30, vtab_attiny3227}, // atdf, avrdude + {"ATtiny1626", 311, F_AVR8X, {0x1E, 0x94, 0x29}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 30, vtab_attiny3227}, // atdf, avrdude + {"ATtiny1627", 312, F_AVR8X, {0x1E, 0x94, 0x28}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 30, vtab_attiny3227}, // atdf, avrdude + {"ATtiny3214", 313, F_AVR8X, {0x1E, 0x95, 0x20}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3800, 0x0800, 10, 1, 31, vtab_attiny3214}, // avr-gcc 12.2.0 + {"ATtiny3216", 314, F_AVR8X, {0x1E, 0x95, 0x21}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3800, 0x0800, 10, 1, 31, vtab_attiny3217}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny3217", 315, F_AVR8X, {0x1E, 0x95, 0x22}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3800, 0x0800, 10, 1, 31, vtab_attiny3217}, // atdf, avr-gcc 12.2.0, avrdude + {"ATtiny3224", 316, F_AVR8X, {0x1E, 0x95, 0x28}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3400, 0x0c00, 10, 1, 30, vtab_attiny3227}, // atdf, avrdude + {"ATtiny3226", 317, F_AVR8X, {0x1E, 0x95, 0x27}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3400, 0x0c00, 10, 1, 30, vtab_attiny3227}, // atdf, avrdude + {"ATtiny3227", 318, F_AVR8X, {0x1E, 0x95, 0x26}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3400, 0x0c00, 10, 1, 30, vtab_attiny3227}, // atdf, avrdude + {"ATmega808", 319, F_AVR8X, {0x1E, 0x93, 0x26}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3c00, 0x0400, 10, 1, 36, vtab_atmega4808}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega809", 320, F_AVR8X, {0x1E, 0x93, 0x2A}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3c00, 0x0400, 10, 1, 40, vtab_atmega4809}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega1608", 321, F_AVR8X, {0x1E, 0x94, 0x27}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 36, vtab_atmega4808}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega1609", 322, F_AVR8X, {0x1E, 0x94, 0x26}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 40, vtab_atmega4809}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega3208", 323, F_AVR8X, {0x1E, 0x95, 0x30}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3000, 0x1000, 10, 1, 36, vtab_atmega4808}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega3209", 324, F_AVR8X, {0x1E, 0x95, 0x31}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3000, 0x1000, 10, 1, 40, vtab_atmega4809}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega4808", 325, F_AVR8X, {0x1E, 0x96, 0x50}, 0, 0x0c000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x2800, 0x1800, 10, 1, 36, vtab_atmega4808}, // atdf, avr-gcc 12.2.0, avrdude + {"ATmega4809", 326, F_AVR8X, {0x1E, 0x96, 0x51}, 0, 0x0c000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x2800, 0x1800, 10, 1, 40, vtab_atmega4809}, // atdf, avr-gcc 12.2.0, avrdude + {"AVR8EA28", 327, F_AVR8X, {0x1E, 0x93, 0x2C}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0, NULL}, // avrdude + {"AVR8EA32", 328, F_AVR8X, {0x1E, 0x93, 0x2B}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0, NULL}, // avrdude + {"AVR16DD14", 329, F_AVR8X, {0x1E, 0x94, 0x34}, 0, 0x04000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7800, 0x0800, 16, 4, 36, vtab_avr64dd32}, // atdf, avrdude + {"AVR16DD20", 330, F_AVR8X, {0x1E, 0x94, 0x33}, 0, 0x04000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7800, 0x0800, 16, 4, 36, vtab_avr64dd32}, // atdf, avrdude + {"AVR16DD28", 331, F_AVR8X, {0x1E, 0x94, 0x32}, 0, 0x04000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7800, 0x0800, 16, 4, 36, vtab_avr64dd32}, // atdf, avrdude + {"AVR16EA28", 332, F_AVR8X, {0x1E, 0x94, 0x37}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0, NULL}, // avrdude + {"AVR16DD32", 333, F_AVR8X, {0x1E, 0x94, 0x31}, 0, 0x04000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7800, 0x0800, 16, 4, 36, vtab_avr64dd32}, // atdf, avrdude + {"AVR16EA32", 334, F_AVR8X, {0x1E, 0x94, 0x36}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0, NULL}, // avrdude + {"AVR16EA48", 335, F_AVR8X, {0x1E, 0x94, 0x35}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0, NULL}, // avrdude + {"AVR32DD14", 336, F_AVR8X, {0x1E, 0x95, 0x3B}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7000, 0x1000, 16, 4, 36, vtab_avr64dd32}, // atdf, avrdude + {"AVR32DD20", 337, F_AVR8X, {0x1E, 0x95, 0x3A}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7000, 0x1000, 16, 4, 36, vtab_avr64dd32}, // atdf, avrdude + {"AVR32DA28", 338, F_AVR8X, {0x1E, 0x95, 0x34}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x7000, 0x1000, 16, 4, 41, vtab_avr128da28}, // atdf, avrdude + {"AVR32DB28", 339, F_AVR8X, {0x1E, 0x95, 0x37}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x7000, 0x1000, 16, 4, 42, vtab_avr128db28}, // atdf, avrdude + {"AVR32DD28", 340, F_AVR8X, {0x1E, 0x95, 0x39}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7000, 0x1000, 16, 4, 36, vtab_avr64dd32}, // atdf, avrdude + {"AVR32EA28", 341, F_AVR8X, {0x1E, 0x95, 0x3E}, 0, 0x08000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0, NULL}, // avrdude + {"AVR32DA32", 342, F_AVR8X, {0x1E, 0x95, 0x33}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x7000, 0x1000, 16, 4, 44, vtab_avr128da32}, // atdf, avrdude + {"AVR32DB32", 343, F_AVR8X, {0x1E, 0x95, 0x36}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x7000, 0x1000, 16, 4, 44, vtab_avr128db32}, // atdf, avrdude + {"AVR32DD32", 344, F_AVR8X, {0x1E, 0x95, 0x38}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7000, 0x1000, 16, 4, 36, vtab_avr64dd32}, // atdf, avrdude + {"AVR32EA32", 345, F_AVR8X, {0x1E, 0x95, 0x3D}, 0, 0x08000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0, NULL}, // avrdude + {"AVR32DA48", 346, F_AVR8X, {0x1E, 0x95, 0x32}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x7000, 0x1000, 16, 4, 58, vtab_avr128da48}, // atdf, avrdude + {"AVR32DB48", 347, F_AVR8X, {0x1E, 0x95, 0x35}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x7000, 0x1000, 16, 4, 61, vtab_avr128db48}, // atdf, avrdude + {"AVR32EA48", 348, F_AVR8X, {0x1E, 0x95, 0x3C}, 0, 0x08000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0, NULL}, // avrdude + {"AVR64DD14", 349, F_AVR8X, {0x1E, 0x96, 0x1D}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x6000, 0x2000, 16, 4, 36, vtab_avr64dd32}, // atdf, avrdude + {"AVR64DD20", 350, F_AVR8X, {0x1E, 0x96, 0x1C}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x6000, 0x2000, 16, 4, 36, vtab_avr64dd32}, // atdf, avrdude + {"AVR64DA28", 351, F_AVR8X, {0x1E, 0x96, 0x15}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 41, vtab_avr128da28}, // atdf, avrdude + {"AVR64DB28", 352, F_AVR8X, {0x1E, 0x96, 0x19}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 42, vtab_avr128db28}, // atdf, avrdude + {"AVR64DD28", 353, F_AVR8X, {0x1E, 0x96, 0x1B}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x6000, 0x2000, 16, 4, 36, vtab_avr64dd32}, // atdf, avrdude + {"AVR64EA28", 354, F_AVR8X, {0x1E, 0x96, 0x20}, 0, 0x10000, 0x080, 1, 0, 0x01400, 0x0200, 8, 0x6800, 0x1800, 16, 4, 37, vtab_avr64ea32}, // atdf, avrdude + {"AVR64DA32", 355, F_AVR8X, {0x1E, 0x96, 0x14}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 44, vtab_avr128da32}, // atdf, avrdude + {"AVR64DB32", 356, F_AVR8X, {0x1E, 0x96, 0x18}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 44, vtab_avr128db32}, // atdf, avrdude + {"AVR64DD32", 357, F_AVR8X, {0x1E, 0x96, 0x1A}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x6000, 0x2000, 16, 4, 36, vtab_avr64dd32}, // atdf, avrdude + {"AVR64EA32", 358, F_AVR8X, {0x1E, 0x96, 0x1F}, 0, 0x10000, 0x080, 1, 0, 0x01400, 0x0200, 8, 0x6800, 0x1800, 16, 4, 37, vtab_avr64ea32}, // atdf, avrdude + {"AVR64DA48", 359, F_AVR8X, {0x1E, 0x96, 0x13}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 58, vtab_avr128da48}, // atdf, avrdude + {"AVR64DB48", 360, F_AVR8X, {0x1E, 0x96, 0x17}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 61, vtab_avr128db48}, // atdf, avrdude + {"AVR64EA48", 361, F_AVR8X, {0x1E, 0x96, 0x1E}, 0, 0x10000, 0x080, 1, 0, 0x01400, 0x0200, 8, 0x6800, 0x1800, 16, 4, 45, vtab_avr64ea48}, // atdf, avrdude + {"AVR64DA64", 362, F_AVR8X, {0x1E, 0x96, 0x12}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 64, vtab_avr128da64}, // atdf, avrdude + {"AVR64DB64", 363, F_AVR8X, {0x1E, 0x96, 0x16}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 65, vtab_avr128db64}, // atdf, avrdude + {"AVR128DA28", 364, F_AVR8X, {0x1E, 0x97, 0x0A}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 41, vtab_avr128da28}, // atdf, avrdude + {"AVR128DB28", 365, F_AVR8X, {0x1E, 0x97, 0x0E}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 42, vtab_avr128db28}, // atdf, avrdude + {"AVR128DA32", 366, F_AVR8X, {0x1E, 0x97, 0x09}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 44, vtab_avr128da32}, // atdf, avrdude + {"AVR128DB32", 367, F_AVR8X, {0x1E, 0x97, 0x0D}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 44, vtab_avr128db32}, // atdf, avrdude + {"AVR128DA48", 368, F_AVR8X, {0x1E, 0x97, 0x08}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 58, vtab_avr128da48}, // atdf, avrdude + {"AVR128DB48", 369, F_AVR8X, {0x1E, 0x97, 0x0C}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 61, vtab_avr128db48}, // atdf, avrdude + {"AVR128DA64", 370, F_AVR8X, {0x1E, 0x97, 0x07}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 64, vtab_avr128da64}, // atdf, avrdude + {"AVR128DB64", 371, F_AVR8X, {0x1E, 0x97, 0x0B}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 65, vtab_avr128db64}, // atdf, avrdude +}; + +const char * const vtab_attiny9[vts_attiny9] = { // ATtiny9, ATtiny4 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "TIM0_CAPT", // 3: Timer 0 Capture Event + "TIM0_OVF", // 4: Timer 0 Overflow + "TIM0_COMPA", // 5: Timer 0 Compare Match A + "TIM0_COMPB", // 6: Timer 0 Compare Match B + "ANA_COMP", // 7: Analog Comparator + "WDT", // 8: Watchdog Time-out + "VLM", // 9: Vcc Voltage Level Monitor +}; + +const char * const vtab_attiny10[vts_attiny10] = { // ATtiny10, ATtiny5 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "TIM0_CAPT", // 3: Timer 0 Capture Event + "TIM0_OVF", // 4: Timer 0 Overflow + "TIM0_COMPA", // 5: Timer 0 Compare Match A + "TIM0_COMPB", // 6: Timer 0 Compare Match B + "ANA_COMP", // 7: Analog Comparator + "WDT", // 8: Watchdog Time-out + "VLM", // 9: Vcc Voltage Level Monitor + "ADC", // 10: ADC Conversion Complete +}; + +const char * const vtab_attiny20[vts_attiny20] = { // ATtiny20 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "PCINT1", // 3: Pin Change Interrupt 1 + "WDT", // 4: Watchdog Time-out + "TIM1_CAPT", // 5: Timer 1 Capture Event + "TIM1_COMPA", // 6: Timer 1 Compare Match A + "TIM1_COMPB", // 7: Timer 1 Compare Match B + "TIM1_OVF", // 8: Timer 1 Overflow + "TIM0_COMPA", // 9: Timer 0 Compare Match A + "TIM0_COMPB", // 10: Timer 0 Compare Match B + "TIM0_OVF", // 11: Timer 0 Overflow + "ANA_COMP", // 12: Analog Comparator + "ADC_ADC", // 13: Conversion Complete + "TWI_SLAVE", // 14: 2-Wire Interface Periphery + "SPI", // 15: SPI Serial Peripheral Interface + "QTRIP", // 16: Touch Sensing +}; + +const char * const vtab_attiny40[vts_attiny40] = { // ATtiny40 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "PCINT1", // 3: Pin Change Interrupt 1 + "PCINT2", // 4: Pin Change Interrupt 2 + "WDT", // 5: Watchdog Time-out + "TIM1_CAPT", // 6: Timer 1 Capture Event + "TIM1_COMPA", // 7: Timer 1 Compare Match A + "TIM1_COMPB", // 8: Timer 1 Compare Match B + "TIM1_OVF", // 9: Timer 1 Overflow + "TIM0_COMPA", // 10: Timer 0 Compare Match A + "TIM0_COMPB", // 11: Timer 0 Compare Match B + "TIM0_OVF", // 12: Timer 0 Overflow + "ANA_COMP", // 13: Analog Comparator + "ADC", // 14: ADC Conversion Complete + "TWI_SLAVE", // 15: 2-Wire Interface Periphery + "SPI", // 16: SPI Serial Peripheral Interface + "QTRIP", // 17: Touch Sensing +}; + +const char * const vtab_attiny104[vts_attiny104] = { // ATtiny104, ATtiny102 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "PCINT1", // 3: Pin Change Interrupt 1 + "TIM0_CAPT", // 4: Timer 0 Capture Event + "TIM0_OVF", // 5: Timer 0 Overflow + "TIM0_COMPA", // 6: Timer 0 Compare Match A + "TIM0_COMPB", // 7: Timer 0 Compare Match B + "ANA_COMP", // 8: Analog Comparator + "WDT", // 9: Watchdog Time-out + "VLM", // 10: Vcc Voltage Level Monitor + "ADC", // 11: ADC Conversion Complete + "USART_RXS", // 12: USART Receive Start + "USART_RXC", // 13: USART Receive Complete + "USART_DRE", // 14: USART Data Register Empty + "USART_TXC", // 15: USART Transmit Complete +}; + +const char * const vtab_attiny11[vts_attiny11] = { // ATtiny11 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "IO_PINS", // 2: External Interrupt + "TIMER0_OVF", // 3: Timer 0 Overflow + "ANA_COMP", // 4: Analog Comparator +}; + +const char * const vtab_attiny12[vts_attiny12] = { // ATtiny12 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "IO_PINS", // 2: External Interrupt + "TIMER0_OVF", // 3: Timer 0 Overflow + "EE_RDY", // 4: EEPROM Ready + "ANA_COMP", // 5: Analog Comparator +}; + +const char * const vtab_attiny13a[vts_attiny13a] = { // ATtiny13A, ATtiny13 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "TIM0_OVF", // 3: Timer 0 Overflow + "EE_RDY", // 4: EEPROM Ready + "ANA_COMP", // 5: Analog Comparator + "TIM0_COMPA", // 6: Timer 0 Compare Match A + "TIM0_COMPB", // 7: Timer 0 Compare Match B + "WDT", // 8: Watchdog Time-out + "ADC", // 9: ADC Conversion Complete +}; + +const char * const vtab_attiny15[vts_attiny15] = { // ATtiny15 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "IO_PINS", // 2: External Interrupt + "TIMER1_COMP", // 3: Timer 1 Compare + "TIMER1_OVF", // 4: Timer 1 Overflow + "TIMER0_OVF", // 5: Timer 0 Overflow + "EE_RDY", // 6: EEPROM Ready + "ANA_COMP", // 7: Analog Comparator + "ADC", // 8: ADC Conversion Complete +}; + +const char * const vtab_attiny22[vts_attiny22] = { // ATtiny22, AT90S2343, AT90S2323 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "TIMER0_OVF0", // 2: Timer 0 Overflow +}; + +const char * const vtab_attiny26[vts_attiny26] = { // ATtiny26 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "IO_PINS", // 2: External Interrupt + "TIMER1_CMPA", // 3: Timer 1 Compare Match A + "TIMER1_CMPB", // 4: Timer 1 Compare Match B + "TIMER1_OVF1", // 5: Timer 1 Overflow + "TIMER0_OVF0", // 6: Timer 0 Overflow + "USI_STRT", // 7: USI Start Condition + "USI_OVF", // 8: USI Overflow + "EE_RDY", // 9: EEPROM Ready + "ANA_COMP", // 10: Analog Comparator + "ADC", // 11: ADC Conversion Complete +}; + +const char * const vtab_attiny28[vts_attiny28] = { // ATtiny28 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "LOW_LEVEL_IO_PINS", // 3: Low-level Input + "TIMER0_OVF", // 4: Timer 0 Overflow + "ANA_COMP", // 5: Analog Comparator +}; + +const char * const vtab_attiny43u[vts_attiny43u] = { // ATtiny43U + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "PCINT1", // 3: Pin Change Interrupt 1 + "WDT", // 4: Watchdog Time-out + "TIM1_COMPA", // 5: Timer 1 Compare Match A + "TIM1_COMPB", // 6: Timer 1 Compare Match B + "TIM1_OVF", // 7: Timer 1 Overflow + "TIM0_COMPA", // 8: Timer 0 Compare Match A + "TIM0_COMPB", // 9: Timer 0 Compare Match B + "TIM0_OVF", // 10: Timer 0 Overflow + "ANA_COMP", // 11: Analog Comparator + "ADC", // 12: ADC Conversion Complete + "EE_RDY", // 13: EEPROM Ready + "USI_START", // 14: USI Start Condition + "USI_OVF", // 15: USI Overflow +}; + +const char * const vtab_attiny84a[vts_attiny84a] = { // ATtiny84A, ATtiny84, ATtiny44A, ATtiny44, ATtiny24A, ATtiny24 + "RESET", // 0: Reset (various reasons) + "EXT_INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "PCINT1", // 3: Pin Change Interrupt 1 + "WDT", // 4: Watchdog Time-out + "TIM1_CAPT", // 5: Timer 1 Capture Event + "TIM1_COMPA", // 6: Timer 1 Compare Match A + "TIM1_COMPB", // 7: Timer 1 Compare Match B + "TIM1_OVF", // 8: Timer 1 Overflow + "TIM0_COMPA", // 9: Timer 0 Compare Match A + "TIM0_COMPB", // 10: Timer 0 Compare Match B + "TIM0_OVF", // 11: Timer 0 Overflow + "ANA_COMP", // 12: Analog Comparator + "ADC", // 13: ADC Conversion Complete + "EE_RDY", // 14: EEPROM Ready + "USI_STR", // 15: USI Start Condition + "USI_OVF", // 16: USI Overflow +}; + +const char * const vtab_attiny85[vts_attiny85] = { // ATtiny85, ATtiny45, ATtiny25 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "TIMER1_COMPA", // 3: Timer 1 Compare Match A + "TIMER1_OVF", // 4: Timer 1 Overflow + "TIMER0_OVF", // 5: Timer 0 Overflow + "EE_RDY", // 6: EEPROM Ready + "ANA_COMP", // 7: Analog Comparator + "ADC", // 8: ADC Conversion Complete + "TIMER1_COMPB", // 9: Timer 1 Compare Match B + "TIMER0_COMPA", // 10: Timer 0 Compare Match A + "TIMER0_COMPB", // 11: Timer 0 Compare Match B + "WDT", // 12: Watchdog Time-out + "USI_START", // 13: USI Start Condition + "USI_OVF", // 14: USI Overflow +}; + +const char * const vtab_attiny88[vts_attiny88] = { // ATtiny88, ATtiny48 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "PCINT0", // 3: Pin Change Interrupt 0 + "PCINT1", // 4: Pin Change Interrupt 1 + "PCINT2", // 5: Pin Change Interrupt 2 + "PCINT3", // 6: Pin Change Interrupt 3 + "WDT", // 7: Watchdog Time-out + "TIMER1_CAPT", // 8: Timer 1 Capture Event + "TIMER1_COMPA", // 9: Timer 1 Compare Match A + "TIMER1_COMPB", // 10: Timer 1 Compare Match B + "TIMER1_OVF", // 11: Timer 1 Overflow + "TIMER0_COMPA", // 12: Timer 0 Compare Match A + "TIMER0_COMPB", // 13: Timer 0 Compare Match B + "TIMER0_OVF", // 14: Timer 0 Overflow + "SPI_STC", // 15: SPI Serial Transfer Complete + "ADC", // 16: ADC Conversion Complete + "EE_RDY", // 17: EEPROM Ready + "ANALOG_COMP", // 18: Analog Comparator + "TWI", // 19: 2-Wire Interface +}; + +const char * const vtab_attiny167[vts_attiny167] = { // ATtiny167, ATtiny87, ATA664251, ATA6617C, ATA6616C, ATA5505 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "PCINT0", // 3: Pin Change Interrupt 0 + "PCINT1", // 4: Pin Change Interrupt 1 + "WDT", // 5: Watchdog Time-out + "TIMER1_CAPT", // 6: Timer 1 Capture Event + "TIMER1_COMPA", // 7: Timer 1 Compare Match A + "TIMER1_COMPB", // 8: Timer 1 Compare Match B + "TIMER1_OVF", // 9: Timer 1 Overflow + "TIMER0_COMPA", // 10: Timer 0 Compare Match A + "TIMER0_OVF", // 11: Timer 0 Overflow + "LIN_TC", // 12: LIN Transfer Complete + "LIN_ERR", // 13: LIN Error + "SPI_STC", // 14: SPI Serial Transfer Complete + "ADC", // 15: ADC Conversion Complete + "EE_RDY", // 16: EEPROM Ready + "ANA_COMP", // 17: Analog Comparator + "USI_START", // 18: USI Start Condition + "USI_OVF", // 19: USI Overflow +}; + +const char * const vtab_attiny828[vts_attiny828] = { // ATtiny828 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "PCINT0", // 3: Pin Change Interrupt 0 + "PCINT1", // 4: Pin Change Interrupt 1 + "PCINT2", // 5: Pin Change Interrupt 2 + "PCINT3", // 6: Pin Change Interrupt 3 + "WDT", // 7: Watchdog Time-out + "TIMER1_CAPT", // 8: Timer 1 Capture Event + "TIMER1_COMPA", // 9: Timer 1 Compare Match A + "TIMER1_COMPB", // 10: Timer 1 Compare Match B + "TIMER1_OVF", // 11: Timer 1 Overflow + "TIMER0_COMPA", // 12: Timer 0 Compare Match A + "TIMER0_COMPB", // 13: Timer 0 Compare Match B + "TIMER0_OVF", // 14: Timer 0 Overflow + "SPI_STC", // 15: SPI Serial Transfer Complete + "USART_START", // 16: USART Start + "USART_RX", // 17: USART Receive Complete + "USART_UDRE", // 18: USART Data Register Empty + "USART_TX", // 19: USART Transmit Complete + "ADC", // 20: ADC Conversion Complete + "EE_READY", // 21: EEPROM Ready + "ANALOG_COMP", // 22: Analog Comparator + "TWI_SLAVE", // 23: 2-Wire Interface Periphery + "SPM_Ready", // 24: Store Program Memory Ready + "QTRIP", // 25: Touch Sensing +}; + +const char * const vtab_attiny841[vts_attiny841] = { // ATtiny841, ATtiny441 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "PCINT1", // 3: Pin Change Interrupt 1 + "WDT", // 4: Watchdog Time-out + "TIMER1_CAPT", // 5: Timer 1 Capture Event + "TIMER1_COMPA", // 6: Timer 1 Compare Match A + "TIMER1_COMPB", // 7: Timer 1 Compare Match B + "TIMER1_OVF", // 8: Timer 1 Overflow + "TIMER0_COMPA", // 9: Timer 0 Compare Match A + "TIMER0_COMPB", // 10: Timer 0 Compare Match B + "TIMER0_OVF", // 11: Timer 0 Overflow + "ANA_COMP0", // 12: Analog Comparator 0 + "ADC", // 13: ADC Conversion Complete + "EE_RDY", // 14: EEPROM Ready + "ANA_COMP1", // 15: Analog Comparator 1 + "TIMER2_CAPT", // 16: Timer 2 Capture Event + "TIMER2_COMPA", // 17: Timer 2 Compare Match A + "TIMER2_COMPB", // 18: Timer 2 Compare Match B + "TIMER2_OVF", // 19: Timer 2 Overflow + "SPI", // 20: SPI Serial Peripheral Interface + "USART0_START", // 21: USART 0 Receive Start + "USART0_RX", // 22: USART 0 Receive Complete + "USART0_UDRE", // 23: USART 0 Data Register Empty + "USART0_TX", // 24: USART 0 Transmit Complete + "USART1_START", // 25: USART 1 Receive Start + "USART1_RX", // 26: USART 1 Receive Complete + "USART1_UDRE", // 27: USART 1 Data Register Empty + "USART1_TX", // 28: USART 1 Transmit Complete + "TWI_SLAVE", // 29: 2-Wire Interface Periphery +}; + +const char * const vtab_attiny861a[vts_attiny861a] = { // ATtiny861A, ATtiny861, ATtiny461A, ATtiny461, ATtiny261A, ATtiny261 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT", // 2: Pin Change Interrupt + "TIMER1_COMPA", // 3: Timer 1 Compare Match A + "TIMER1_COMPB", // 4: Timer 1 Compare Match B + "TIMER1_OVF", // 5: Timer 1 Overflow + "TIMER0_OVF", // 6: Timer 0 Overflow + "USI_START", // 7: USI Start Condition + "USI_OVF", // 8: USI Overflow + "EE_RDY", // 9: EEPROM Ready + "ANA_COMP", // 10: Analog Comparator + "ADC", // 11: ADC Conversion Complete + "WDT", // 12: Watchdog Time-out + "INT1", // 13: External Interrupt 1 + "TIMER0_COMPA", // 14: Timer 0 Compare Match A + "TIMER0_COMPB", // 15: Timer 0 Compare Match B + "TIMER0_CAPT", // 16: Timer 0 Capture Event + "TIMER1_COMPD", // 17: Timer 1 Compare Match D + "FAULT_PROTECTION", // 18: Timer 1 Fault Protection +}; + +const char * const vtab_attiny1634[vts_attiny1634] = { // ATtiny1634 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "PCINT1", // 3: Pin Change Interrupt 1 + "PCINT2", // 4: Pin Change Interrupt 2 + "WDT", // 5: Watchdog Time-out + "TIMER1_CAPT", // 6: Timer 1 Capture Event + "TIMER1_COMPA", // 7: Timer 1 Compare Match A + "TIMER1_COMPB", // 8: Timer 1 Compare Match B + "TIMER1_OVF", // 9: Timer 1 Overflow + "TIMER0_COMPA", // 10: Timer 0 Compare Match A + "TIMER0_COMPB", // 11: Timer 0 Compare Match B + "TIMER0_OVF", // 12: Timer 0 Overflow + "ANA_COMP", // 13: Analog Comparator + "ADC_READY", // 14: ADC Conversion Complete + "USART0_START", // 15: USART 0 Receive Start + "USART0_RXC", // 16: USART 0 Receive Complete + "USART0_UDRE", // 17: USART 0 Data Register Empty + "USART0_TXC", // 18: USART 0 Transmit Complete + "USART1_START", // 19: USART 1 Receive Start + "USART1_RXC", // 20: USART 1 Receive Complete + "USART1_UDRE", // 21: USART 1 Data Register Empty + "USART1_TXC", // 22: USART 1 Transmit Complete + "USI_START", // 23: USI Start Condition + "USI_OVERFLOW", // 24: USI Overflow + "TWI/TWI_SLAVE", // 25: 2-Wire Interface/2-Wire Interface Periphery + "EE_RDY", // 26: EEPROM Ready + "QTRIP", // 27: Touch Sensing +}; + +const char * const vtab_attiny2313[vts_attiny2313] = { // ATtiny2313 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "TIMER1_CAPT", // 3: Timer 1 Capture Event + "TIMER1_COMPA", // 4: Timer 1 Compare Match A + "TIMER1_OVF", // 5: Timer 1 Overflow + "TIMER0_OVF", // 6: Timer 0 Overflow + "USART_RX", // 7: USART Receive Complete + "USART_UDRE", // 8: USART Data Register Empty + "USART_TX", // 9: USART Transmit Complete + "ANA_COMP", // 10: Analog Comparator + "PCINT", // 11: Pin Change Interrupt + "TIMER1_COMPB", // 12: Timer 1 Compare Match B + "TIMER0_COMPA", // 13: Timer 0 Compare Match A + "TIMER0_COMPB", // 14: Timer 0 Compare Match B + "USI_START", // 15: USI Start Condition + "USI_OVERFLOW", // 16: USI Overflow + "EEPROM_Ready", // 17: EEPROM Ready + "WDT_OVERFLOW", // 18: Watchdog Timer Overflow +}; + +const char * const vtab_attiny4313[vts_attiny4313] = { // ATtiny4313, ATtiny2313A + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "TIMER1_CAPT", // 3: Timer 1 Capture Event + "TIMER1_COMPA", // 4: Timer 1 Compare Match A + "TIMER1_OVF", // 5: Timer 1 Overflow + "TIMER0_OVF", // 6: Timer 0 Overflow + "USART_RX", // 7: USART Receive Complete + "USART_UDRE", // 8: USART Data Register Empty + "USART_TX", // 9: USART Transmit Complete + "ANA_COMP", // 10: Analog Comparator + "PCINT_B", // 11: Pin Change Interrupt B + "TIMER1_COMPB", // 12: Timer 1 Compare Match B + "TIMER0_COMPA", // 13: Timer 0 Compare Match A + "TIMER0_COMPB", // 14: Timer 0 Compare Match B + "USI_START", // 15: USI Start Condition + "USI_OVERFLOW", // 16: USI Overflow + "EEPROM_Ready", // 17: EEPROM Ready + "WDT_OVERFLOW", // 18: Watchdog Timer Overflow + "PCINT_A", // 19: Pin Change Interrupt A + "PCINT_D", // 20: Pin Change Interrupt D +}; + +const char * const vtab_atmega8a[vts_atmega8a] = { // ATmega8A, ATmega8 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "TIMER2_COMP", // 3: Timer 2 Compare Match + "TIMER2_OVF", // 4: Timer 2 Overflow + "TIMER1_CAPT", // 5: Timer 1 Capture Event + "TIMER1_COMPA", // 6: Timer 1 Compare Match A + "TIMER1_COMPB", // 7: Timer 1 Compare Match B + "TIMER1_OVF", // 8: Timer 1 Overflow + "TIMER0_OVF", // 9: Timer 0 Overflow + "SPI_STC", // 10: SPI Serial Transfer Complete + "USART_RXC", // 11: USART Receive Complete + "USART_UDRE", // 12: USART Data Register Empty + "USART_TXC", // 13: USART Transmit Complete + "ADC", // 14: ADC Conversion Complete + "EE_RDY", // 15: EEPROM Ready + "ANA_COMP", // 16: Analog Comparator + "TWI", // 17: 2-Wire Interface + "SPM_RDY", // 18: Store Program Memory Ready +}; + +const char * const vtab_atmega16a[vts_atmega16a] = { // ATmega16A, ATmega16 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "TIMER2_COMP", // 3: Timer 2 Compare Match + "TIMER2_OVF", // 4: Timer 2 Overflow + "TIMER1_CAPT", // 5: Timer 1 Capture Event + "TIMER1_COMPA", // 6: Timer 1 Compare Match A + "TIMER1_COMPB", // 7: Timer 1 Compare Match B + "TIMER1_OVF", // 8: Timer 1 Overflow + "TIMER0_OVF", // 9: Timer 0 Overflow + "SPI_STC", // 10: SPI Serial Transfer Complete + "USART_RXC", // 11: USART Receive Complete + "USART_UDRE", // 12: USART Data Register Empty + "USART_TXC", // 13: USART Transmit Complete + "ADC", // 14: ADC Conversion Complete + "EE_RDY", // 15: EEPROM Ready + "ANA_COMP", // 16: Analog Comparator + "TWI", // 17: 2-Wire Interface + "INT2", // 18: External Interrupt 2 + "TIMER0_COMP", // 19: Timer 0 Compare Match + "SPM_RDY", // 20: Store Program Memory Ready +}; + +const char * const vtab_atmega16hva[vts_atmega16hva] = { // ATmega16HVA, ATmega8HVA + "RESET", // 0: Reset (various reasons) + "BPINT", // 1: Battery Protection Interrupt + "VREGMON", // 2: Voltage Regulator Monitor + "INT0", // 3: External Interrupt 0 + "INT1", // 4: External Interrupt 1 + "INT2", // 5: External Interrupt 2 + "WDT", // 6: Watchdog Time-out + "TIMER1_IC", // 7: Timer 1 Input Capture + "TIMER1_COMPA", // 8: Timer 1 Compare Match A + "TIMER1_COMPB", // 9: Timer 1 Compare Match B + "TIMER1_OVF", // 10: Timer 1 Overflow + "TIMER0_IC", // 11: Timer 0 Capture Event + "TIMER0_COMPA", // 12: Timer 0 Compare Match A + "TIMER0_COMPB", // 13: Timer 0 Compare Match B + "TIMER0_OVF", // 14: Timer 0 Overflow + "SPI_STC", // 15: SPI Serial Transfer Complete + "VADC", // 16: Voltage ADC Conversion Complete + "CCADC_CONV", // 17: Coulomb Counter ADC Conversion Complete + "CCADC_REG_CUR", // 18: Coloumb Counter ADC Regular Current + "CCADC_ACC", // 19: Coloumb Counter ADC Accumulator + "EE_READY", // 20: EEPROM Ready +}; + +const char * const vtab_atmega16hva2[vts_atmega16hva2] = { // ATmega16HVA2 + "RESET", // 0: Reset (various reasons) + "BPINT", // 1: Battery Protection Interrupt + "VREGMON", // 2: Voltage Regulator Monitor + "INT0", // 3: External Interrupt 0 + "INT1", // 4: External Interrupt 1 + "INT2", // 5: External Interrupt 2 + "PCINT0", // 6: Pin Change Interrupt 0 + "WDT", // 7: Watchdog Time-out + "TIMER1_IC", // 8: Timer 1 Input Capture + "TIMER1_COMPA", // 9: Timer 1 Compare Match A + "TIMER1_COMPB", // 10: Timer 1 Compare Match B + "TIMER1_OVF", // 11: Timer 1 Overflow + "TIMER0_IC", // 12: Timer 0 Capture Event + "TIMER0_COMPA", // 13: Timer 0 Compare Match A + "TIMER0_COMPB", // 14: Timer 0 Compare Match B + "TIMER0_OVF", // 15: Timer 0 Overflow + "SPI_STC", // 16: SPI Serial Transfer Complete + "VADC", // 17: Voltage ADC Conversion Complete + "CCADC_CONV", // 18: Coulomb Counter ADC Conversion Complete + "CCADC_REG_CUR", // 19: Coloumb Counter ADC Regular Current + "CCADC_ACC", // 20: Coloumb Counter ADC Accumulator + "EE_READY", // 21: EEPROM Ready +}; + +const char * const vtab_atmega32hvbrevb[vts_atmega32hvbrevb] = { // ATmega32HVBrevB, ATmega32HVB, ATmega16HVBrevB, ATmega16HVB + "RESET", // 0: Reset (various reasons) + "BPINT", // 1: Battery Protection Interrupt + "VREGMON", // 2: Voltage Regulator Monitor + "INT0", // 3: External Interrupt 0 + "INT1", // 4: External Interrupt 1 + "INT2", // 5: External Interrupt 2 + "INT3", // 6: External Interrupt 3 + "PCINT0", // 7: Pin Change Interrupt 0 + "PCINT1", // 8: Pin Change Interrupt 1 + "WDT", // 9: Watchdog Time-out + "BGSCD", // 10: Bandgap Buffer Short Circuit Detected + "CHDET", // 11: Charger Detect + "TIMER1_IC", // 12: Timer 1 Input Capture + "TIMER1_COMPA", // 13: Timer 1 Compare Match A + "TIMER1_COMPB", // 14: Timer 1 Compare Match B + "TIMER1_OVF", // 15: Timer 1 Overflow + "TIMER0_IC", // 16: Timer 0 Capture Event + "TIMER0_COMPA", // 17: Timer 0 Compare Match A + "TIMER0_COMPB", // 18: Timer 0 Compare Match B + "TIMER0_OVF", // 19: Timer 0 Overflow + "TWIBUSCD", // 20: 2-Wire Interface Bus Connect/Disconnect + "TWI", // 21: 2-Wire Interface + "SPI_STC", // 22: SPI Serial Transfer Complete + "VADC", // 23: Voltage ADC Conversion Complete + "CCADC_CONV", // 24: Coulomb Counter ADC Conversion Complete + "CCADC_REG_CUR", // 25: Coloumb Counter ADC Regular Current + "CCADC_ACC", // 26: Coloumb Counter ADC Accumulator + "EE_READY", // 27: EEPROM Ready + "SPM", // 28: SPM Ready +}; + +const char * const vtab_atmega32u2[vts_atmega32u2] = { // ATmega32U2, ATmega16U2, ATmega8U2, AT90USB162, AT90USB82 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "INT3", // 4: External Interrupt 3 + "INT4", // 5: External Interrupt 4 + "INT5", // 6: External Interrupt 5 + "INT6", // 7: External Interrupt 6 + "INT7", // 8: External Interrupt 7 + "PCINT0", // 9: Pin Change Interrupt 0 + "PCINT1", // 10: Pin Change Interrupt 1 + "USB_GEN", // 11: USB General + "USB_COM", // 12: USB Endpoint/Pipe Interrupt Communication Request + "WDT", // 13: Watchdog Time-out + "TIMER1_CAPT", // 14: Timer 1 Capture Event + "TIMER1_COMPA", // 15: Timer 1 Compare Match A + "TIMER1_COMPB", // 16: Timer 1 Compare Match B + "TIMER1_COMPC", // 17: Timer 1 Compare Match C + "TIMER1_OVF", // 18: Timer 1 Overflow + "TIMER0_COMPA", // 19: Timer 0 Compare Match A + "TIMER0_COMPB", // 20: Timer 0 Compare Match B + "TIMER0_OVF", // 21: Timer 0 Overflow + "SPI_STC", // 22: SPI Serial Transfer Complete + "USART1_RX", // 23: USART 1 Receive Complete + "USART1_UDRE", // 24: USART 1 Data Register Empty + "USART1_TX", // 25: USART 1 Transmit Complete + "ANALOG_COMP", // 26: Analog Comparator + "EE_READY", // 27: EEPROM Ready + "SPM_READY", // 28: Store Program Memory Ready +}; + +const char * const vtab_atmega32u4[vts_atmega32u4] = { // ATmega32U4, ATmega16U4 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "INT3", // 4: External Interrupt 3 + "Reserved1", // 5: Reserved 1 + "Reserved2", // 6: Reserved 2 + "INT6", // 7: External Interrupt 6 + "Reserved3", // 8: Reserved 3 + "PCINT0", // 9: Pin Change Interrupt 0 + "USB_GEN", // 10: USB General + "USB_COM", // 11: USB Endpoint/Pipe Interrupt Communication Request + "WDT", // 12: Watchdog Time-out + "Reserved4", // 13: Reserved 4 + "Reserved5", // 14: Reserved 5 + "Reserved6", // 15: Reserved 6 + "TIMER1_CAPT", // 16: Timer 1 Capture Event + "TIMER1_COMPA", // 17: Timer 1 Compare Match A + "TIMER1_COMPB", // 18: Timer 1 Compare Match B + "TIMER1_COMPC", // 19: Timer 1 Compare Match C + "TIMER1_OVF", // 20: Timer 1 Overflow + "TIMER0_COMPA", // 21: Timer 0 Compare Match A + "TIMER0_COMPB", // 22: Timer 0 Compare Match B + "TIMER0_OVF", // 23: Timer 0 Overflow + "SPI_STC", // 24: SPI Serial Transfer Complete + "USART1_RX", // 25: USART 1 Receive Complete + "USART1_UDRE", // 26: USART 1 Data Register Empty + "USART1_TX", // 27: USART 1 Transmit Complete + "ANALOG_COMP", // 28: Analog Comparator + "ADC", // 29: ADC Conversion Complete + "EE_READY", // 30: EEPROM Ready + "TIMER3_CAPT", // 31: Timer 3 Capture Event + "TIMER3_COMPA", // 32: Timer 3 Compare Match A + "TIMER3_COMPB", // 33: Timer 3 Compare Match B + "TIMER3_COMPC", // 34: Timer 3 Compare Match C + "TIMER3_OVF", // 35: Timer 3 Overflow + "TWI", // 36: 2-Wire Interface + "SPM_READY", // 37: Store Program Memory Ready + "TIMER4_COMPA", // 38: Timer 4 Compare Match A + "TIMER4_COMPB", // 39: Timer 4 Compare Match B + "TIMER4_COMPD", // 40: Timer 4 Compare Match D + "TIMER4_OVF", // 41: Timer 4 Overflow + "TIMER4_FPF", // 42: Timer 4 Fault Protection +}; + +const char * const vtab_atmega32u6[vts_atmega32u6] = { // ATmega32U6, AT90USB1287, AT90USB1286, AT90USB647, AT90USB646 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "INT3", // 4: External Interrupt 3 + "INT4", // 5: External Interrupt 4 + "INT5", // 6: External Interrupt 5 + "INT6", // 7: External Interrupt 6 + "INT7", // 8: External Interrupt 7 + "PCINT0", // 9: Pin Change Interrupt 0 + "USB_GEN", // 10: USB General + "USB_COM", // 11: USB Endpoint/Pipe Interrupt Communication Request + "WDT", // 12: Watchdog Time-out + "TIMER2_COMPA", // 13: Timer 2 Compare Match A + "TIMER2_COMPB", // 14: Timer 2 Compare Match B + "TIMER2_OVF", // 15: Timer 2 Overflow + "TIMER1_CAPT", // 16: Timer 1 Capture Event + "TIMER1_COMPA", // 17: Timer 1 Compare Match A + "TIMER1_COMPB", // 18: Timer 1 Compare Match B + "TIMER1_COMPC", // 19: Timer 1 Compare Match C + "TIMER1_OVF", // 20: Timer 1 Overflow + "TIMER0_COMPA", // 21: Timer 0 Compare Match A + "TIMER0_COMPB", // 22: Timer 0 Compare Match B + "TIMER0_OVF", // 23: Timer 0 Overflow + "SPI_STC", // 24: SPI Serial Transfer Complete + "USART1_RX", // 25: USART 1 Receive Complete + "USART1_UDRE", // 26: USART 1 Data Register Empty + "USART1_TX", // 27: USART 1 Transmit Complete + "ANALOG_COMP", // 28: Analog Comparator + "ADC", // 29: ADC Conversion Complete + "EE_READY", // 30: EEPROM Ready + "TIMER3_CAPT", // 31: Timer 3 Capture Event + "TIMER3_COMPA", // 32: Timer 3 Compare Match A + "TIMER3_COMPB", // 33: Timer 3 Compare Match B + "TIMER3_COMPC", // 34: Timer 3 Compare Match C + "TIMER3_OVF", // 35: Timer 3 Overflow + "TWI", // 36: 2-Wire Interface + "SPM_READY", // 37: Store Program Memory Ready +}; + +const char * const vtab_atmega64m1[vts_atmega64m1] = { // ATmega64M1, ATmega64C1, ATmega32M1, ATmega32C1, ATmega16M1 + "RESET", // 0: Reset (various reasons) + "ANACOMP0", // 1: Analog Comparator 0 + "ANACOMP1", // 2: Analog Comparator 1 + "ANACOMP2", // 3: Analog Comparator 2 + "ANACOMP3", // 4: Analog Comparator 3 + "PSC_FAULT", // 5: PSC Fault + "PSC_EC", // 6: PSC End of Cycle + "INT0", // 7: External Interrupt 0 + "INT1", // 8: External Interrupt 1 + "INT2", // 9: External Interrupt 2 + "INT3", // 10: External Interrupt 3 + "TIMER1_CAPT", // 11: Timer 1 Capture Event + "TIMER1_COMPA", // 12: Timer 1 Compare Match A + "TIMER1_COMPB", // 13: Timer 1 Compare Match B + "TIMER1_OVF", // 14: Timer 1 Overflow + "TIMER0_COMPA", // 15: Timer 0 Compare Match A + "TIMER0_COMPB", // 16: Timer 0 Compare Match B + "TIMER0_OVF", // 17: Timer 0 Overflow + "CAN_INT", // 18: CAN MOB, Burst, General Errors + "CAN_TOVF", // 19: CAN Timer Overflow + "LIN_TC", // 20: LIN Transfer Complete + "LIN_ERR", // 21: LIN Error + "PCINT0", // 22: Pin Change Interrupt 0 + "PCINT1", // 23: Pin Change Interrupt 1 + "PCINT2", // 24: Pin Change Interrupt 2 + "PCINT3", // 25: Pin Change Interrupt 3 + "SPI_STC", // 26: SPI Serial Transfer Complete + "ADC", // 27: ADC Conversion Complete + "WDT", // 28: Watchdog Time-out + "EE_READY", // 29: EEPROM Ready + "SPM_READY", // 30: Store Program Memory Ready +}; + +const char * const vtab_atmega64hve2[vts_atmega64hve2] = { // ATmega64HVE2, ATmega64HVE + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "PCINT1", // 3: Pin Change Interrupt 1 + "WDT", // 4: Watchdog Time-out + "WAKEUP", // 5: Wake Up + "TIMER1_IC", // 6: Timer 1 Input Capture + "TIMER1_COMPA", // 7: Timer 1 Compare Match A + "TIMER1_COMPB", // 8: Timer 1 Compare Match B + "TIMER1_OVF", // 9: Timer 1 Overflow + "TIMER0_IC", // 10: Timer 0 Capture Event + "TIMER0_COMPA", // 11: Timer 0 Compare Match A + "TIMER0_COMPB", // 12: Timer 0 Compare Match B + "TIMER0_OVF", // 13: Timer 0 Overflow + "LIN_STATUS", // 14: Local Interconnect Network Status + "LIN_ERROR", // 15: Local Interconnect Network Error + "SPI_STC", // 16: SPI Serial Transfer Complete + "VADC_CONV", // 17: Versatile Analog to Digital Conversion + "VADC_ACC", // 18: Versatile Analog to Digital Compare or Capture + "CADC_CONV", // 19: C-ADC Instantaneous Conversion Complete + "CADC_REG_CUR", // 20: C-ADC Regular Current + "CADC_ACC", // 21: C-ADC Accumulated Conversion Complete + "EE_READY", // 22: EEPROM Ready + "SPM", // 23: SPM Ready + "PLL", // 24: PLL +}; + +const char * const vtab_atmega103[vts_atmega103] = { // ATmega103 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "INT3", // 4: External Interrupt 3 + "INT4", // 5: External Interrupt 4 + "INT5", // 6: External Interrupt 5 + "INT6", // 7: External Interrupt 6 + "INT7", // 8: External Interrupt 7 + "TIMER2_COMP", // 9: Timer 2 Compare Match + "TIMER2_OVF", // 10: Timer 2 Overflow + "TIMER1_CAPT", // 11: Timer 1 Capture Event + "TIMER1_COMPA", // 12: Timer 1 Compare Match A + "TIMER1_COMPB", // 13: Timer 1 Compare Match B + "TIMER1_OVF", // 14: Timer 1 Overflow + "TIMER0_COMP", // 15: Timer 0 Compare Match + "TIMER0_OVF", // 16: Timer 0 Overflow + "SPI_STC", // 17: SPI Serial Transfer Complete + "UART_RX", // 18: UART Receive Complete + "UART_UDRE", // 19: UART Data Register Empty + "UART_TX", // 20: UART Transmit Complete + "ADC", // 21: ADC Conversion Complete + "EE_READY", // 22: EEPROM Ready + "ANALOG_COMP", // 23: Analog Comparator +}; + +const char * const vtab_atmega128a[vts_atmega128a] = { // ATmega128A, ATmega128, ATmega64A, ATmega64 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "INT3", // 4: External Interrupt 3 + "INT4", // 5: External Interrupt 4 + "INT5", // 6: External Interrupt 5 + "INT6", // 7: External Interrupt 6 + "INT7", // 8: External Interrupt 7 + "TIMER2_COMP", // 9: Timer 2 Compare Match + "TIMER2_OVF", // 10: Timer 2 Overflow + "TIMER1_CAPT", // 11: Timer 1 Capture Event + "TIMER1_COMPA", // 12: Timer 1 Compare Match A + "TIMER1_COMPB", // 13: Timer 1 Compare Match B + "TIMER1_OVF", // 14: Timer 1 Overflow + "TIMER0_COMP", // 15: Timer 0 Compare Match + "TIMER0_OVF", // 16: Timer 0 Overflow + "SPI_STC", // 17: SPI Serial Transfer Complete + "USART0_RX", // 18: USART 0 Receive Complete + "USART0_UDRE", // 19: USART 0 Data Register Empty + "USART0_TX", // 20: USART 0 Transmit Complete + "ADC", // 21: ADC Conversion Complete + "EE_READY", // 22: EEPROM Ready + "ANALOG_COMP", // 23: Analog Comparator + "TIMER1_COMPC", // 24: Timer 1 Compare Match C + "TIMER3_CAPT", // 25: Timer 3 Capture Event + "TIMER3_COMPA", // 26: Timer 3 Compare Match A + "TIMER3_COMPB", // 27: Timer 3 Compare Match B + "TIMER3_COMPC", // 28: Timer 3 Compare Match C + "TIMER3_OVF", // 29: Timer 3 Overflow + "USART1_RX", // 30: USART 1 Receive Complete + "USART1_UDRE", // 31: USART 1 Data Register Empty + "USART1_TX", // 32: USART 1 Transmit Complete + "TWI", // 33: 2-Wire Interface + "SPM_READY", // 34: Store Program Memory Ready +}; + +const char * const vtab_atmega128rfa1[vts_atmega128rfa1] = { // ATmega128RFA1 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "INT3", // 4: External Interrupt 3 + "INT4", // 5: External Interrupt 4 + "INT5", // 6: External Interrupt 5 + "INT6", // 7: External Interrupt 6 + "INT7", // 8: External Interrupt 7 + "PCINT0", // 9: Pin Change Interrupt 0 + "PCINT1", // 10: Pin Change Interrupt 1 + "PCINT2", // 11: Pin Change Interrupt 2 + "WDT", // 12: Watchdog Time-out + "TIMER2_COMPA", // 13: Timer 2 Compare Match A + "TIMER2_COMPB", // 14: Timer 2 Compare Match B + "TIMER2_OVF", // 15: Timer 2 Overflow + "TIMER1_CAPT", // 16: Timer 1 Capture Event + "TIMER1_COMPA", // 17: Timer 1 Compare Match A + "TIMER1_COMPB", // 18: Timer 1 Compare Match B + "TIMER1_COMPC", // 19: Timer 1 Compare Match C + "TIMER1_OVF", // 20: Timer 1 Overflow + "TIMER0_COMPA", // 21: Timer 0 Compare Match A + "TIMER0_COMPB", // 22: Timer 0 Compare Match B + "TIMER0_OVF", // 23: Timer 0 Overflow + "SPI_STC", // 24: SPI Serial Transfer Complete + "USART0_RX", // 25: USART 0 Receive Complete + "USART0_UDRE", // 26: USART 0 Data Register Empty + "USART0_TX", // 27: USART 0 Transmit Complete + "ANALOG_COMP", // 28: Analog Comparator + "ADC", // 29: ADC Conversion Complete + "EE_READY", // 30: EEPROM Ready + "TIMER3_CAPT", // 31: Timer 3 Capture Event + "TIMER3_COMPA", // 32: Timer 3 Compare Match A + "TIMER3_COMPB", // 33: Timer 3 Compare Match B + "TIMER3_COMPC", // 34: Timer 3 Compare Match C + "TIMER3_OVF", // 35: Timer 3 Overflow + "USART1_RX", // 36: USART 1 Receive Complete + "USART1_UDRE", // 37: USART 1 Data Register Empty + "USART1_TX", // 38: USART 1 Transmit Complete + "TWI", // 39: 2-Wire Interface + "SPM_READY", // 40: Store Program Memory Ready + "TIMER4_CAPT", // 41: Timer 4 Capture Event + "TIMER4_COMPA", // 42: Timer 4 Compare Match A + "TIMER4_COMPB", // 43: Timer 4 Compare Match B + "TIMER4_COMPC", // 44: Timer 4 Compare Match C + "TIMER4_OVF", // 45: Timer 4 Overflow + "TIMER5_CAPT", // 46: Timer 5 Capture Event + "TIMER5_COMPA", // 47: Timer 5 Compare Match A + "TIMER5_COMPB", // 48: Timer 5 Compare Match B + "TIMER5_COMPC", // 49: Timer 5 Compare Match C + "TIMER5_OVF", // 50: Timer 5 Overflow + "USART2_RX", // 51: USART 2 Receive Complete + "USART2_UDRE", // 52: USART 2 Data Register Empty + "USART2_TX", // 53: USART 2 Transmit Complete + "USART3_RX", // 54: USART 3 Receive Complete + "USART3_UDRE", // 55: USART 3 Data Register Empty + "USART3_TX", // 56: USART 3 Transmit Complete + "TRX24_PLL_LOCK", // 57: TRX24 PLL Lock + "TRX24_PLL_UNLOCK", // 58: TRX24 PLL Unlock + "TRX24_RX_START", // 59: TRX24 Receive Start + "TRX24_RX_END", // 60: TRX24 Receive End + "TRX24_CCA_ED_DONE", // 61: TRX24 CCA/ED Done + "TRX24_XAH_AMI", // 62: TRX24 XAH/AMI + "TRX24_TX_END", // 63: TRX24 Transmit End + "TRX24_AWAKE", // 64: TRX24 AWAKE - Transceiver is Reaching State TRX_OFF + "SCNT_CMP1", // 65: Symbol Counter - Compare Match 1 Interrupt + "SCNT_CMP2", // 66: Symbol Counter - Compare Match 2 Interrupt + "SCNT_CMP3", // 67: Symbol Counter - Compare Match 3 Interrupt + "SCNT_OVFL", // 68: Symbol Counter - Overflow Interrupt + "SCNT_BACKOFF", // 69: Symbol Counter - Backoff Interrupt + "AES_READY", // 70: AES Engine Ready + "BAT_LOW", // 71: Battery Voltage Below Threshold +}; + +const char * const vtab_atmega161[vts_atmega161] = { // ATmega161 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "TIMER2_COMP", // 4: Timer 2 Compare Match + "TIMER2_OVF", // 5: Timer 2 Overflow + "TIMER1_CAPT", // 6: Timer 1 Capture Event + "TIMER1_COMPA", // 7: Timer 1 Compare Match A + "TIMER1_COMPB", // 8: Timer 1 Compare Match B + "TIMER1_OVF", // 9: Timer 1 Overflow + "TIMER0_COMP", // 10: Timer 0 Compare Match + "TIMER0_OVF", // 11: Timer 0 Overflow + "SPI_STC", // 12: SPI Serial Transfer Complete + "UART0_RX", // 13: UART 0 Receive Complete + "UART1_RX", // 14: UART 1 Receive Complete + "UART0_UDRE", // 15: UART 0 Data Register Empty + "UART1_UDRE", // 16: UART 1 Data Register Empty + "UART0_TX", // 17: UART 0 Transmit Complete + "UART1_TX", // 18: UART 1 Transmit Complete + "EE_RDY", // 19: EEPROM Ready + "ANA_COMP", // 20: Analog Comparator +}; + +const char * const vtab_atmega162[vts_atmega162] = { // ATmega162 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "PCINT0", // 4: Pin Change Interrupt 0 + "PCINT1", // 5: Pin Change Interrupt 1 + "TIMER3_CAPT", // 6: Timer 3 Capture Event + "TIMER3_COMPA", // 7: Timer 3 Compare Match A + "TIMER3_COMPB", // 8: Timer 3 Compare Match B + "TIMER3_OVF", // 9: Timer 3 Overflow + "TIMER2_COMP", // 10: Timer 2 Compare Match + "TIMER2_OVF", // 11: Timer 2 Overflow + "TIMER1_CAPT", // 12: Timer 1 Capture Event + "TIMER1_COMPA", // 13: Timer 1 Compare Match A + "TIMER1_COMPB", // 14: Timer 1 Compare Match B + "TIMER1_OVF", // 15: Timer 1 Overflow + "TIMER0_COMP", // 16: Timer 0 Compare Match + "TIMER0_OVF", // 17: Timer 0 Overflow + "SPI_STC", // 18: SPI Serial Transfer Complete + "USART0_RXC", // 19: USART 0 Receive Complete + "USART1_RXC", // 20: USART 1 Receive Complete + "USART0_UDRE", // 21: USART 0 Data Register Empty + "USART1_UDRE", // 22: USART 1 Data Register Empty + "USART0_TXC", // 23: USART 0 Transmit Complete + "USART1_TXC", // 24: USART 1 Transmit Complete + "EE_RDY", // 25: EEPROM Ready + "ANA_COMP", // 26: Analog Comparator + "SPM_RDY", // 27: Store Program Memory Ready +}; + +const char * const vtab_atmega163[vts_atmega163] = { // ATmega163 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "TIMER2_COMP", // 3: Timer 2 Compare Match + "TIMER2_OVF", // 4: Timer 2 Overflow + "TIMER1_CAPT", // 5: Timer 1 Capture Event + "TIMER1_COMPA", // 6: Timer 1 Compare Match A + "TIMER1_COMPB", // 7: Timer 1 Compare Match B + "TIMER1_OVF", // 8: Timer 1 Overflow + "TIMER0_OVF", // 9: Timer 0 Overflow + "SPI_STC", // 10: SPI Serial Transfer Complete + "UART_RX", // 11: UART Receive Complete + "UART_UDRE", // 12: UART Data Register Empty + "UART_TX", // 13: UART Transmit Complete + "ADC", // 14: ADC Conversion Complete + "EE_RDY", // 15: EEPROM Ready + "ANA_COMP", // 16: Analog Comparator + "TWI", // 17: 2-Wire Interface +}; + +const char * const vtab_atmega168pb[vts_atmega168pb] = { // ATmega168PB, ATmega88PB, ATmega48PB + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "PCINT0", // 3: Pin Change Interrupt 0 + "PCINT1", // 4: Pin Change Interrupt 1 + "PCINT2", // 5: Pin Change Interrupt 2 + "WDT", // 6: Watchdog Time-out + "TIMER2_COMPA", // 7: Timer 2 Compare Match A + "TIMER2_COMPB", // 8: Timer 2 Compare Match B + "TIMER2_OVF", // 9: Timer 2 Overflow + "TIMER1_CAPT", // 10: Timer 1 Capture Event + "TIMER1_COMPA", // 11: Timer 1 Compare Match A + "TIMER1_COMPB", // 12: Timer 1 Compare Match B + "TIMER1_OVF", // 13: Timer 1 Overflow + "TIMER0_COMPA", // 14: Timer 0 Compare Match A + "TIMER0_COMPB", // 15: Timer 0 Compare Match B + "TIMER0_OVF", // 16: Timer 0 Overflow + "SPI_STC", // 17: SPI Serial Transfer Complete + "USART_RX", // 18: USART Receive Complete + "USART_UDRE", // 19: USART Data Register Empty + "USART_TX", // 20: USART Transmit Complete + "ADC", // 21: ADC Conversion Complete + "EE_READY", // 22: EEPROM Ready + "ANALOG_COMP", // 23: Analog Comparator + "TWI", // 24: 2-Wire Interface + "SPM_Ready", // 25: Store Program Memory Ready + "USART_START", // 26: USART Start +}; + +const char * const vtab_atmega323[vts_atmega323] = { // ATmega323, ATmega32A, ATmega32 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "TIMER2_COMP", // 4: Timer 2 Compare Match + "TIMER2_OVF", // 5: Timer 2 Overflow + "TIMER1_CAPT", // 6: Timer 1 Capture Event + "TIMER1_COMPA", // 7: Timer 1 Compare Match A + "TIMER1_COMPB", // 8: Timer 1 Compare Match B + "TIMER1_OVF", // 9: Timer 1 Overflow + "TIMER0_COMP", // 10: Timer 0 Compare Match + "TIMER0_OVF", // 11: Timer 0 Overflow + "SPI_STC", // 12: SPI Serial Transfer Complete + "USART_RXC", // 13: USART Receive Complete + "USART_UDRE", // 14: USART Data Register Empty + "USART_TXC", // 15: USART Transmit Complete + "ADC", // 16: ADC Conversion Complete + "EE_RDY", // 17: EEPROM Ready + "ANA_COMP", // 18: Analog Comparator + "TWI", // 19: 2-Wire Interface + "SPM_RDY", // 20: Store Program Memory Ready +}; + +const char * const vtab_atmega324pb[vts_atmega324pb] = { // ATmega324PB + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "PCINT0", // 4: Pin Change Interrupt 0 + "PCINT1", // 5: Pin Change Interrupt 1 + "PCINT2", // 6: Pin Change Interrupt 2 + "PCINT3", // 7: Pin Change Interrupt 3 + "WDT", // 8: Watchdog Time-out + "TIMER2_COMPA", // 9: Timer 2 Compare Match A + "TIMER2_COMPB", // 10: Timer 2 Compare Match B + "TIMER2_OVF", // 11: Timer 2 Overflow + "TIMER1_CAPT", // 12: Timer 1 Capture Event + "TIMER1_COMPA", // 13: Timer 1 Compare Match A + "TIMER1_COMPB", // 14: Timer 1 Compare Match B + "TIMER1_OVF", // 15: Timer 1 Overflow + "TIMER0_COMPA", // 16: Timer 0 Compare Match A + "TIMER0_COMPB", // 17: Timer 0 Compare Match B + "TIMER0_OVF", // 18: Timer 0 Overflow + "SPI0_STC", // 19: SPI 0 Serial Transfer Complete + "USART0_RX", // 20: USART 0 Receive Complete + "USART0_UDRE", // 21: USART 0 Data Register Empty + "USART0_TX", // 22: USART 0 Transmit Complete + "ANALOG_COMP", // 23: Analog Comparator + "ADC", // 24: ADC Conversion Complete + "EE_READY", // 25: EEPROM Ready + "TWI0", // 26: 2-Wire Interface 0 + "SPM_READY", // 27: Store Program Memory Ready + "USART1_RX", // 28: USART 1 Receive Complete + "USART1_UDRE", // 29: USART 1 Data Register Empty + "USART1_TX", // 30: USART 1 Transmit Complete + "TIMER3_CAPT", // 31: Timer 3 Capture Event + "TIMER3_COMPA", // 32: Timer 3 Compare Match A + "TIMER3_COMPB", // 33: Timer 3 Compare Match B + "TIMER3_OVF", // 34: Timer 3 Overflow + "USART0_START", // 35: USART 0 Receive Start + "USART1_START", // 36: USART 1 Receive Start + "PCINT4", // 37: Pin Change Interrupt 4 + "XOSCFD", // 38: Crystal Failure Detect + "PTC_EOC", // 39: PTC End of Conversion + "PTC_WCOMP", // 40: PTC Window Comparator Mode + "SPI1_STC", // 41: SPI 1 Serial Transfer Complete + "TWI1", // 42: 2-Wire Interface 1 + "TIMER4_CAPT", // 43: Timer 4 Capture Event + "TIMER4_COMPA", // 44: Timer 4 Compare Match A + "TIMER4_COMPB", // 45: Timer 4 Compare Match B + "TIMER4_OVF", // 46: Timer 4 Overflow + "USART2_RX", // 47: USART 2 Receive Complete + "USART2_UDRE", // 48: USART 2 Data Register Empty + "USART2_TX", // 49: USART 2 Transmit Complete + "USART2_START", // 50: USART 2 Receive Start +}; + +const char * const vtab_atmega328[vts_atmega328] = { // ATmega328, ATmega168 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "PCINT0", // 3: Pin Change Interrupt 0 + "PCINT1", // 4: Pin Change Interrupt 1 + "PCINT2", // 5: Pin Change Interrupt 2 + "WDT", // 6: Watchdog Time-out + "TIMER2_COMPA", // 7: Timer 2 Compare Match A + "TIMER2_COMPB", // 8: Timer 2 Compare Match B + "TIMER2_OVF", // 9: Timer 2 Overflow + "TIMER1_CAPT", // 10: Timer 1 Capture Event + "TIMER1_COMPA", // 11: Timer 1 Compare Match A + "TIMER1_COMPB", // 12: Timer 1 Compare Match B + "TIMER1_OVF", // 13: Timer 1 Overflow + "TIMER0_COMPA", // 14: Timer 0 Compare Match A + "TIMER0_COMPB", // 15: Timer 0 Compare Match B + "TIMER0_OVF", // 16: Timer 0 Overflow + "SPI_STC", // 17: SPI Serial Transfer Complete + "USART_RX", // 18: USART Receive Complete + "USART_UDRE", // 19: USART Data Register Empty + "USART_TX", // 20: USART Transmit Complete + "ADC", // 21: ADC Conversion Complete + "EE_READY", // 22: EEPROM Ready + "ANALOG_COMP", // 23: Analog Comparator + "TWI", // 24: 2-Wire Interface + "SPM_READY", // 25: Store Program Memory Ready +}; + +const char * const vtab_atmega328p[vts_atmega328p] = { // ATmega328P, ATmega168PA, ATmega168P, ATmega168A, ATmega88PA, ATmega88P, ATmega88A, ATmega88, ATmega48PA, ATmega48P, ATmega48A, ATmega48, ATA6614Q, ATA6613C, ATA6612C + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "PCINT0", // 3: Pin Change Interrupt 0 + "PCINT1", // 4: Pin Change Interrupt 1 + "PCINT2", // 5: Pin Change Interrupt 2 + "WDT", // 6: Watchdog Time-out + "TIMER2_COMPA", // 7: Timer 2 Compare Match A + "TIMER2_COMPB", // 8: Timer 2 Compare Match B + "TIMER2_OVF", // 9: Timer 2 Overflow + "TIMER1_CAPT", // 10: Timer 1 Capture Event + "TIMER1_COMPA", // 11: Timer 1 Compare Match A + "TIMER1_COMPB", // 12: Timer 1 Compare Match B + "TIMER1_OVF", // 13: Timer 1 Overflow + "TIMER0_COMPA", // 14: Timer 0 Compare Match A + "TIMER0_COMPB", // 15: Timer 0 Compare Match B + "TIMER0_OVF", // 16: Timer 0 Overflow + "SPI_STC", // 17: SPI Serial Transfer Complete + "USART_RX", // 18: USART Receive Complete + "USART_UDRE", // 19: USART Data Register Empty + "USART_TX", // 20: USART Transmit Complete + "ADC", // 21: ADC Conversion Complete + "EE_READY", // 22: EEPROM Ready + "ANALOG_COMP", // 23: Analog Comparator + "TWI", // 24: 2-Wire Interface + "SPM_Ready", // 25: Store Program Memory Ready +}; + +const char * const vtab_atmega328pb[vts_atmega328pb] = { // ATmega328PB + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "PCINT0", // 3: Pin Change Interrupt 0 + "PCINT1", // 4: Pin Change Interrupt 1 + "PCINT2", // 5: Pin Change Interrupt 2 + "WDT", // 6: Watchdog Time-out + "TIMER2_COMPA", // 7: Timer 2 Compare Match A + "TIMER2_COMPB", // 8: Timer 2 Compare Match B + "TIMER2_OVF", // 9: Timer 2 Overflow + "TIMER1_CAPT", // 10: Timer 1 Capture Event + "TIMER1_COMPA", // 11: Timer 1 Compare Match A + "TIMER1_COMPB", // 12: Timer 1 Compare Match B + "TIMER1_OVF", // 13: Timer 1 Overflow + "TIMER0_COMPA", // 14: Timer 0 Compare Match A + "TIMER0_COMPB", // 15: Timer 0 Compare Match B + "TIMER0_OVF", // 16: Timer 0 Overflow + "SPI0_STC", // 17: SPI 0 Serial Transfer Complete + "USART0_RX", // 18: USART 0 Receive Complete + "USART0_UDRE", // 19: USART 0 Data Register Empty + "USART0_TX", // 20: USART 0 Transmit Complete + "ADC", // 21: ADC Conversion Complete + "EE_READY", // 22: EEPROM Ready + "ANALOG_COMP", // 23: Analog Comparator + "TWI0", // 24: 2-Wire Interface 0 + "SPM_Ready", // 25: Store Program Memory Ready + "USART0_START", // 26: USART 0 Receive Start + "PCINT3", // 27: Pin Change Interrupt 3 + "USART1_RX", // 28: USART 1 Receive Complete + "USART1_UDRE", // 29: USART 1 Data Register Empty + "USART1_TX", // 30: USART 1 Transmit Complete + "USART1_START", // 31: USART 1 Receive Start + "TIMER3_CAPT", // 32: Timer 3 Capture Event + "TIMER3_COMPA", // 33: Timer 3 Compare Match A + "TIMER3_COMPB", // 34: Timer 3 Compare Match B + "TIMER3_OVF", // 35: Timer 3 Overflow + "CFD", // 36: Clock Failure Detection + "PTC_EOC", // 37: PTC End of Conversion + "PTC_WCOMP", // 38: PTC Window Comparator Mode + "SPI1_STC", // 39: SPI 1 Serial Transfer Complete + "TWI1", // 40: 2-Wire Interface 1 + "TIMER4_CAPT", // 41: Timer 4 Capture Event + "TIMER4_COMPA", // 42: Timer 4 Compare Match A + "TIMER4_COMPB", // 43: Timer 4 Compare Match B + "TIMER4_OVF", // 44: Timer 4 Overflow +}; + +const char * const vtab_atmega406[vts_atmega406] = { // ATmega406 + "RESET", // 0: Reset (various reasons) + "BPINT", // 1: Battery Protection Interrupt + "INT0", // 2: External Interrupt 0 + "INT1", // 3: External Interrupt 1 + "INT2", // 4: External Interrupt 2 + "INT3", // 5: External Interrupt 3 + "PCINT0", // 6: Pin Change Interrupt 0 + "PCINT1", // 7: Pin Change Interrupt 1 + "WDT", // 8: Watchdog Time-out + "WAKE_UP", // 9: Wake Up + "TIM1_COMP", // 10: Timer 1 Compare and Match + "TIM1_OVF", // 11: Timer 1 Overflow + "TIM0_COMPA", // 12: Timer 0 Compare Match A + "TIM0_COMPB", // 13: Timer 0 Compare Match B + "TIM0_OVF", // 14: Timer 0 Overflow + "TWI_BUS_CD", // 15: 2-Wire Interface Bus Connect/Disconnect + "TWI", // 16: 2-Wire Interface + "VADC", // 17: Voltage ADC Conversion Complete + "CCADC_CONV", // 18: Coulomb Counter ADC Conversion Complete + "CCADC_REG_CUR", // 19: Coloumb Counter ADC Regular Current + "CCADC_ACC", // 20: Coloumb Counter ADC Accumulator + "EE_READY", // 21: EEPROM Ready + "SPM_READY", // 22: Store Program Memory Ready +}; + +const char * const vtab_atmega644[vts_atmega644] = { // ATmega644 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "PCINT0", // 4: Pin Change Interrupt 0 + "PCINT1", // 5: Pin Change Interrupt 1 + "PCINT2", // 6: Pin Change Interrupt 2 + "PCINT3", // 7: Pin Change Interrupt 3 + "WDT", // 8: Watchdog Time-out + "TIMER2_COMPA", // 9: Timer 2 Compare Match A + "TIMER2_COMPB", // 10: Timer 2 Compare Match B + "TIMER2_OVF", // 11: Timer 2 Overflow + "TIMER1_CAPT", // 12: Timer 1 Capture Event + "TIMER1_COMPA", // 13: Timer 1 Compare Match A + "TIMER1_COMPB", // 14: Timer 1 Compare Match B + "TIMER1_OVF", // 15: Timer 1 Overflow + "TIMER0_COMPA", // 16: Timer 0 Compare Match A + "TIMER0_COMPB", // 17: Timer 0 Compare Match B + "TIMER0_OVF", // 18: Timer 0 Overflow + "SPI_STC", // 19: SPI Serial Transfer Complete + "USART0_RX", // 20: USART 0 Receive Complete + "USART0_UDRE", // 21: USART 0 Data Register Empty + "USART0_TX", // 22: USART 0 Transmit Complete + "ANALOG_COMP", // 23: Analog Comparator + "ADC", // 24: ADC Conversion Complete + "EE_READY", // 25: EEPROM Ready + "TWI", // 26: 2-Wire Interface + "SPM_READY", // 27: Store Program Memory Ready +}; + +const char * const vtab_atmega644pa[vts_atmega644pa] = { // ATmega644PA, ATmega644P, ATmega644A, ATmega324PA, ATmega324P, ATmega324A, ATmega164PA, ATmega164P, ATmega164A + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "PCINT0", // 4: Pin Change Interrupt 0 + "PCINT1", // 5: Pin Change Interrupt 1 + "PCINT2", // 6: Pin Change Interrupt 2 + "PCINT3", // 7: Pin Change Interrupt 3 + "WDT", // 8: Watchdog Time-out + "TIMER2_COMPA", // 9: Timer 2 Compare Match A + "TIMER2_COMPB", // 10: Timer 2 Compare Match B + "TIMER2_OVF", // 11: Timer 2 Overflow + "TIMER1_CAPT", // 12: Timer 1 Capture Event + "TIMER1_COMPA", // 13: Timer 1 Compare Match A + "TIMER1_COMPB", // 14: Timer 1 Compare Match B + "TIMER1_OVF", // 15: Timer 1 Overflow + "TIMER0_COMPA", // 16: Timer 0 Compare Match A + "TIMER0_COMPB", // 17: Timer 0 Compare Match B + "TIMER0_OVF", // 18: Timer 0 Overflow + "SPI_STC", // 19: SPI Serial Transfer Complete + "USART0_RX", // 20: USART 0 Receive Complete + "USART0_UDRE", // 21: USART 0 Data Register Empty + "USART0_TX", // 22: USART 0 Transmit Complete + "ANALOG_COMP", // 23: Analog Comparator + "ADC", // 24: ADC Conversion Complete + "EE_READY", // 25: EEPROM Ready + "TWI", // 26: 2-Wire Interface + "SPM_READY", // 27: Store Program Memory Ready + "USART1_RX", // 28: USART 1 Receive Complete + "USART1_UDRE", // 29: USART 1 Data Register Empty + "USART1_TX", // 30: USART 1 Transmit Complete +}; + +const char * const vtab_atmega645p[vts_atmega645p] = { // ATmega645P, ATmega645A, ATmega645, ATmega325PA, ATmega325P, ATmega325A, ATmega325, ATmega165PA, ATmega165P, ATmega165A, ATmega165 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "PCINT1", // 3: Pin Change Interrupt 1 + "TIMER2_COMP", // 4: Timer 2 Compare Match + "TIMER2_OVF", // 5: Timer 2 Overflow + "TIMER1_CAPT", // 6: Timer 1 Capture Event + "TIMER1_COMPA", // 7: Timer 1 Compare Match A + "TIMER1_COMPB", // 8: Timer 1 Compare Match B + "TIMER1_OVF", // 9: Timer 1 Overflow + "TIMER0_COMP", // 10: Timer 0 Compare Match + "TIMER0_OVF", // 11: Timer 0 Overflow + "SPI_STC", // 12: SPI Serial Transfer Complete + "USART0_RX", // 13: USART 0 Receive Complete + "USART0_UDRE", // 14: USART 0 Data Register Empty + "USART0_TX", // 15: USART 0 Transmit Complete + "USI_START", // 16: USI Start Condition + "USI_OVERFLOW", // 17: USI Overflow + "ANALOG_COMP", // 18: Analog Comparator + "ADC", // 19: ADC Conversion Complete + "EE_READY", // 20: EEPROM Ready + "SPM_READY", // 21: Store Program Memory Ready +}; + +const char * const vtab_atmega649p[vts_atmega649p] = { // ATmega649P, ATmega649A, ATmega649, ATmega329PA, ATmega329P, ATmega329A, ATmega329, ATmega169PA, ATmega169P, ATmega169A, ATmega169 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "PCINT1", // 3: Pin Change Interrupt 1 + "TIMER2_COMP", // 4: Timer 2 Compare Match + "TIMER2_OVF", // 5: Timer 2 Overflow + "TIMER1_CAPT", // 6: Timer 1 Capture Event + "TIMER1_COMPA", // 7: Timer 1 Compare Match A + "TIMER1_COMPB", // 8: Timer 1 Compare Match B + "TIMER1_OVF", // 9: Timer 1 Overflow + "TIMER0_COMP", // 10: Timer 0 Compare Match + "TIMER0_OVF", // 11: Timer 0 Overflow + "SPI_STC", // 12: SPI Serial Transfer Complete + "USART0_RX", // 13: USART 0 Receive Complete + "USART0_UDRE", // 14: USART 0 Data Register Empty + "USART0_TX", // 15: USART 0 Transmit Complete + "USI_START", // 16: USI Start Condition + "USI_OVERFLOW", // 17: USI Overflow + "ANALOG_COMP", // 18: Analog Comparator + "ADC", // 19: ADC Conversion Complete + "EE_READY", // 20: EEPROM Ready + "SPM_READY", // 21: Store Program Memory Ready + "LCD", // 22: LCD Start of Frame +}; + +const char * const vtab_atmega1284p[vts_atmega1284p] = { // ATmega1284P, ATmega1284 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "PCINT0", // 4: Pin Change Interrupt 0 + "PCINT1", // 5: Pin Change Interrupt 1 + "PCINT2", // 6: Pin Change Interrupt 2 + "PCINT3", // 7: Pin Change Interrupt 3 + "WDT", // 8: Watchdog Time-out + "TIMER2_COMPA", // 9: Timer 2 Compare Match A + "TIMER2_COMPB", // 10: Timer 2 Compare Match B + "TIMER2_OVF", // 11: Timer 2 Overflow + "TIMER1_CAPT", // 12: Timer 1 Capture Event + "TIMER1_COMPA", // 13: Timer 1 Compare Match A + "TIMER1_COMPB", // 14: Timer 1 Compare Match B + "TIMER1_OVF", // 15: Timer 1 Overflow + "TIMER0_COMPA", // 16: Timer 0 Compare Match A + "TIMER0_COMPB", // 17: Timer 0 Compare Match B + "TIMER0_OVF", // 18: Timer 0 Overflow + "SPI_STC", // 19: SPI Serial Transfer Complete + "USART0_RX", // 20: USART 0 Receive Complete + "USART0_UDRE", // 21: USART 0 Data Register Empty + "USART0_TX", // 22: USART 0 Transmit Complete + "ANALOG_COMP", // 23: Analog Comparator + "ADC", // 24: ADC Conversion Complete + "EE_READY", // 25: EEPROM Ready + "TWI", // 26: 2-Wire Interface + "SPM_READY", // 27: Store Program Memory Ready + "USART1_RX", // 28: USART 1 Receive Complete + "USART1_UDRE", // 29: USART 1 Data Register Empty + "USART1_TX", // 30: USART 1 Transmit Complete + "TIMER3_CAPT", // 31: Timer 3 Capture Event + "TIMER3_COMPA", // 32: Timer 3 Compare Match A + "TIMER3_COMPB", // 33: Timer 3 Compare Match B + "TIMER3_OVF", // 34: Timer 3 Overflow +}; + +const char * const vtab_atmega2561[vts_atmega2561] = { // ATmega2561, ATmega2560, ATmega1281, ATmega1280, ATmega640 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "INT3", // 4: External Interrupt 3 + "INT4", // 5: External Interrupt 4 + "INT5", // 6: External Interrupt 5 + "INT6", // 7: External Interrupt 6 + "INT7", // 8: External Interrupt 7 + "PCINT0", // 9: Pin Change Interrupt 0 + "PCINT1", // 10: Pin Change Interrupt 1 + "PCINT2", // 11: Pin Change Interrupt 2 + "WDT", // 12: Watchdog Time-out + "TIMER2_COMPA", // 13: Timer 2 Compare Match A + "TIMER2_COMPB", // 14: Timer 2 Compare Match B + "TIMER2_OVF", // 15: Timer 2 Overflow + "TIMER1_CAPT", // 16: Timer 1 Capture Event + "TIMER1_COMPA", // 17: Timer 1 Compare Match A + "TIMER1_COMPB", // 18: Timer 1 Compare Match B + "TIMER1_COMPC", // 19: Timer 1 Compare Match C + "TIMER1_OVF", // 20: Timer 1 Overflow + "TIMER0_COMPA", // 21: Timer 0 Compare Match A + "TIMER0_COMPB", // 22: Timer 0 Compare Match B + "TIMER0_OVF", // 23: Timer 0 Overflow + "SPI_STC", // 24: SPI Serial Transfer Complete + "USART0_RX", // 25: USART 0 Receive Complete + "USART0_UDRE", // 26: USART 0 Data Register Empty + "USART0_TX", // 27: USART 0 Transmit Complete + "ANALOG_COMP", // 28: Analog Comparator + "ADC", // 29: ADC Conversion Complete + "EE_READY", // 30: EEPROM Ready + "TIMER3_CAPT", // 31: Timer 3 Capture Event + "TIMER3_COMPA", // 32: Timer 3 Compare Match A + "TIMER3_COMPB", // 33: Timer 3 Compare Match B + "TIMER3_COMPC", // 34: Timer 3 Compare Match C + "TIMER3_OVF", // 35: Timer 3 Overflow + "USART1_RX", // 36: USART 1 Receive Complete + "USART1_UDRE", // 37: USART 1 Data Register Empty + "USART1_TX", // 38: USART 1 Transmit Complete + "TWI", // 39: 2-Wire Interface + "SPM_READY", // 40: Store Program Memory Ready + "TIMER4_CAPT", // 41: Timer 4 Capture Event + "TIMER4_COMPA", // 42: Timer 4 Compare Match A + "TIMER4_COMPB", // 43: Timer 4 Compare Match B + "TIMER4_COMPC", // 44: Timer 4 Compare Match C + "TIMER4_OVF", // 45: Timer 4 Overflow + "TIMER5_CAPT", // 46: Timer 5 Capture Event + "TIMER5_COMPA", // 47: Timer 5 Compare Match A + "TIMER5_COMPB", // 48: Timer 5 Compare Match B + "TIMER5_COMPC", // 49: Timer 5 Compare Match C + "TIMER5_OVF", // 50: Timer 5 Overflow + "USART2_RX", // 51: USART 2 Receive Complete + "USART2_UDRE", // 52: USART 2 Data Register Empty + "USART2_TX", // 53: USART 2 Transmit Complete + "USART3_RX", // 54: USART 3 Receive Complete + "USART3_UDRE", // 55: USART 3 Data Register Empty + "USART3_TX", // 56: USART 3 Transmit Complete +}; + +const char * const vtab_atmega2564rfr2[vts_atmega2564rfr2] = { // ATmega2564RFR2, ATmega1284RFR2, ATmega644RFR2, ATmega256RFR2, ATmega128RFR2, ATmega64RFR2 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "INT3", // 4: External Interrupt 3 + "INT4", // 5: External Interrupt 4 + "INT5", // 6: External Interrupt 5 + "INT6", // 7: External Interrupt 6 + "INT7", // 8: External Interrupt 7 + "PCINT0", // 9: Pin Change Interrupt 0 + "PCINT1", // 10: Pin Change Interrupt 1 + "PCINT2", // 11: Pin Change Interrupt 2 + "WDT", // 12: Watchdog Time-out + "TIMER2_COMPA", // 13: Timer 2 Compare Match A + "TIMER2_COMPB", // 14: Timer 2 Compare Match B + "TIMER2_OVF", // 15: Timer 2 Overflow + "TIMER1_CAPT", // 16: Timer 1 Capture Event + "TIMER1_COMPA", // 17: Timer 1 Compare Match A + "TIMER1_COMPB", // 18: Timer 1 Compare Match B + "TIMER1_COMPC", // 19: Timer 1 Compare Match C + "TIMER1_OVF", // 20: Timer 1 Overflow + "TIMER0_COMPA", // 21: Timer 0 Compare Match A + "TIMER0_COMPB", // 22: Timer 0 Compare Match B + "TIMER0_OVF", // 23: Timer 0 Overflow + "SPI_STC", // 24: SPI Serial Transfer Complete + "USART0_RX", // 25: USART 0 Receive Complete + "USART0_UDRE", // 26: USART 0 Data Register Empty + "USART0_TX", // 27: USART 0 Transmit Complete + "ANALOG_COMP", // 28: Analog Comparator + "ADC", // 29: ADC Conversion Complete + "EE_READY", // 30: EEPROM Ready + "TIMER3_CAPT", // 31: Timer 3 Capture Event + "TIMER3_COMPA", // 32: Timer 3 Compare Match A + "TIMER3_COMPB", // 33: Timer 3 Compare Match B + "TIMER3_COMPC", // 34: Timer 3 Compare Match C + "TIMER3_OVF", // 35: Timer 3 Overflow + "USART1_RX", // 36: USART 1 Receive Complete + "USART1_UDRE", // 37: USART 1 Data Register Empty + "USART1_TX", // 38: USART 1 Transmit Complete + "TWI", // 39: 2-Wire Interface + "SPM_READY", // 40: Store Program Memory Ready + "TIMER4_CAPT", // 41: Timer 4 Capture Event + "TIMER4_COMPA", // 42: Timer 4 Compare Match A + "TIMER4_COMPB", // 43: Timer 4 Compare Match B + "TIMER4_COMPC", // 44: Timer 4 Compare Match C + "TIMER4_OVF", // 45: Timer 4 Overflow + "TIMER5_CAPT", // 46: Timer 5 Capture Event + "TIMER5_COMPA", // 47: Timer 5 Compare Match A + "TIMER5_COMPB", // 48: Timer 5 Compare Match B + "TIMER5_COMPC", // 49: Timer 5 Compare Match C + "TIMER5_OVF", // 50: Timer 5 Overflow + "RESERVED_51", // 51: Reserved 51 + "RESERVED_52", // 52: Reserved 52 + "RESERVED_53", // 53: Reserved 53 + "RESERVED_54", // 54: Reserved 54 + "RESERVED_55", // 55: Reserved 55 + "RESERVED_56", // 56: Reserved 56 + "TRX24_PLL_LOCK", // 57: TRX24 PLL Lock + "TRX24_PLL_UNLOCK", // 58: TRX24 PLL Unlock + "TRX24_RX_START", // 59: TRX24 Receive Start + "TRX24_RX_END", // 60: TRX24 Receive End + "TRX24_CCA_ED_DONE", // 61: TRX24 CCA/ED Done + "TRX24_XAH_AMI", // 62: TRX24 XAH/AMI + "TRX24_TX_END", // 63: TRX24 Transmit End + "TRX24_AWAKE", // 64: TRX24 AWAKE - Transceiver is Reaching State TRX_OFF + "SCNT_CMP1", // 65: Symbol Counter - Compare Match 1 Interrupt + "SCNT_CMP2", // 66: Symbol Counter - Compare Match 2 Interrupt + "SCNT_CMP3", // 67: Symbol Counter - Compare Match 3 Interrupt + "SCNT_OVFL", // 68: Symbol Counter - Overflow Interrupt + "SCNT_BACKOFF", // 69: Symbol Counter - Backoff Interrupt + "AES_READY", // 70: AES Engine Ready + "BAT_LOW", // 71: Battery Voltage Below Threshold + "TRX24_TX_START", // 72: TRX24 Transmit Start + "TRX24_AMI0", // 73: TRX24 Address Match 0 + "TRX24_AMI1", // 74: TRX24 Address Match 1 + "TRX24_AMI2", // 75: TRX24 Address Match 2 + "TRX24_AMI3", // 76: TRX24 Address Match 3 +}; + +const char * const vtab_atmega6450p[vts_atmega6450p] = { // ATmega6450P, ATmega6450A, ATmega6450, ATmega3250PA, ATmega3250P, ATmega3250A, ATmega3250 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "PCINT1", // 3: Pin Change Interrupt 1 + "TIMER2_COMP", // 4: Timer 2 Compare Match + "TIMER2_OVF", // 5: Timer 2 Overflow + "TIMER1_CAPT", // 6: Timer 1 Capture Event + "TIMER1_COMPA", // 7: Timer 1 Compare Match A + "TIMER1_COMPB", // 8: Timer 1 Compare Match B + "TIMER1_OVF", // 9: Timer 1 Overflow + "TIMER0_COMP", // 10: Timer 0 Compare Match + "TIMER0_OVF", // 11: Timer 0 Overflow + "SPI_STC", // 12: SPI Serial Transfer Complete + "USART_RX", // 13: USART Receive Complete + "USART_UDRE", // 14: USART Data Register Empty + "USART0_TX", // 15: USART 0 Transmit Complete + "USI_START", // 16: USI Start Condition + "USI_OVERFLOW", // 17: USI Overflow + "ANALOG_COMP", // 18: Analog Comparator + "ADC", // 19: ADC Conversion Complete + "EE_READY", // 20: EEPROM Ready + "SPM_READY", // 21: Store Program Memory Ready + "NOT_USED", // 22: Reserved + "PCINT2", // 23: Pin Change Interrupt 2 + "PCINT3", // 24: Pin Change Interrupt 3 +}; + +const char * const vtab_atmega6490p[vts_atmega6490p] = { // ATmega6490P, ATmega6490A, ATmega6490, ATmega3290PA, ATmega3290P, ATmega3290A, ATmega3290 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "PCINT0", // 2: Pin Change Interrupt 0 + "PCINT1", // 3: Pin Change Interrupt 1 + "TIMER2_COMP", // 4: Timer 2 Compare Match + "TIMER2_OVF", // 5: Timer 2 Overflow + "TIMER1_CAPT", // 6: Timer 1 Capture Event + "TIMER1_COMPA", // 7: Timer 1 Compare Match A + "TIMER1_COMPB", // 8: Timer 1 Compare Match B + "TIMER1_OVF", // 9: Timer 1 Overflow + "TIMER0_COMP", // 10: Timer 0 Compare Match + "TIMER0_OVF", // 11: Timer 0 Overflow + "SPI_STC", // 12: SPI Serial Transfer Complete + "USART_RX", // 13: USART Receive Complete + "USART_UDRE", // 14: USART Data Register Empty + "USART0_TX", // 15: USART 0 Transmit Complete + "USI_START", // 16: USI Start Condition + "USI_OVERFLOW", // 17: USI Overflow + "ANALOG_COMP", // 18: Analog Comparator + "ADC", // 19: ADC Conversion Complete + "EE_READY", // 20: EEPROM Ready + "SPM_READY", // 21: Store Program Memory Ready + "LCD", // 22: LCD Start of Frame + "PCINT2", // 23: Pin Change Interrupt 2 + "PCINT3", // 24: Pin Change Interrupt 3 +}; + +const char * const vtab_atmega8515[vts_atmega8515] = { // ATmega8515 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "TIMER1_CAPT", // 3: Timer 1 Capture Event + "TIMER1_COMPA", // 4: Timer 1 Compare Match A + "TIMER1_COMPB", // 5: Timer 1 Compare Match B + "TIMER1_OVF", // 6: Timer 1 Overflow + "TIMER0_OVF", // 7: Timer 0 Overflow + "SPI_STC", // 8: SPI Serial Transfer Complete + "USART_RX", // 9: USART Receive Complete + "USART_UDRE", // 10: USART Data Register Empty + "USART_TX", // 11: USART Transmit Complete + "ANA_COMP", // 12: Analog Comparator + "INT2", // 13: External Interrupt 2 + "TIMER0_COMP", // 14: Timer 0 Compare Match + "EE_RDY", // 15: EEPROM Ready + "SPM_RDY", // 16: Store Program Memory Ready +}; + +const char * const vtab_atmega8535[vts_atmega8535] = { // ATmega8535 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "TIMER2_COMP", // 3: Timer 2 Compare Match + "TIMER2_OVF", // 4: Timer 2 Overflow + "TIMER1_CAPT", // 5: Timer 1 Capture Event + "TIMER1_COMPA", // 6: Timer 1 Compare Match A + "TIMER1_COMPB", // 7: Timer 1 Compare Match B + "TIMER1_OVF", // 8: Timer 1 Overflow + "TIMER0_OVF", // 9: Timer 0 Overflow + "SPI_STC", // 10: SPI Serial Transfer Complete + "USART_RX", // 11: USART Receive Complete + "USART_UDRE", // 12: USART Data Register Empty + "USART_TX", // 13: USART Transmit Complete + "ADC", // 14: ADC Conversion Complete + "EE_RDY", // 15: EEPROM Ready + "ANA_COMP", // 16: Analog Comparator + "TWI", // 17: 2-Wire Interface + "INT2", // 18: External Interrupt 2 + "TIMER0_COMP", // 19: Timer 0 Compare Match + "SPM_RDY", // 20: Store Program Memory Ready +}; + +const char * const vtab_at86rf401[vts_at86rf401] = { // AT86RF401 + "RESET", // 0: Reset (various reasons) + "TXDONE", // 1: Transmit Complete + "TXEMPTY", // 2: Transmit Register Empty +}; + +const char * const vtab_at90pwm2[vts_at90pwm2] = { // AT90PWM2 + "RESET", // 0: Reset (various reasons) + "PSC2_CAPT", // 1: PSC 2 Capture Event + "PSC2_EC", // 2: PSC 2 End Cycle + "PSC1_CAPT", // 3: PSC 1 Capture Event + "PSC1_EC", // 4: PSC 1 End Cycle + "PSC0_CAPT", // 5: PSC 0 Capture Event + "PSC0_EC", // 6: PSC 0 End Cycle + "ANALOG_COMP_0", // 7: Analog Comparator 0 + "ANALOG_COMP_1", // 8: Analog Comparator 1 + "ANALOG_COMP_2", // 9: Analog Comparator 2 + "INT0", // 10: External Interrupt 0 + "TIMER1_CAPT", // 11: Timer 1 Capture Event + "TIMER1_COMPA", // 12: Timer 1 Compare Match A + "TIMER1_COMPB", // 13: Timer 1 Compare Match B + "UNUSED", // 14: not implemented on this device + "TIMER1_OVF", // 15: Timer 1 Overflow + "TIMER0_COMP_A", // 16: Timer 0 Compare Match A + "TIMER0_OVF", // 17: Timer 0 Overflow + "ADC", // 18: ADC Conversion Complete + "INT1", // 19: External Interrupt 1 + "SPI_STC", // 20: SPI Serial Transfer Complete + "USART_RX", // 21: USART Receive Complete + "USART_UDRE", // 22: USART Data Register Empty + "USART_TX", // 23: USART Transmit Complete + "INT2", // 24: External Interrupt 2 + "WDT", // 25: Watchdog Time-out + "EE_READY", // 26: EEPROM Ready + "TIMER0_COMPB", // 27: Timer 0 Compare Match B + "INT3", // 28: External Interrupt 3 + "UNUSED", // 29: not implemented on this device + "UNUSED", // 30: not implemented on this device + "SPM_READY", // 31: Store Program Memory Ready +}; + +const char * const vtab_at90pwm3b[vts_at90pwm3b] = { // AT90PWM3B, AT90PWM3, AT90PWM2B + "RESET", // 0: Reset (various reasons) + "PSC2_CAPT", // 1: PSC 2 Capture Event + "PSC2_EC", // 2: PSC 2 End Cycle + "PSC1_CAPT", // 3: PSC 1 Capture Event + "PSC1_EC", // 4: PSC 1 End Cycle + "PSC0_CAPT", // 5: PSC 0 Capture Event + "PSC0_EC", // 6: PSC 0 End Cycle + "ANALOG_COMP_0", // 7: Analog Comparator 0 + "ANALOG_COMP_1", // 8: Analog Comparator 1 + "ANALOG_COMP_2", // 9: Analog Comparator 2 + "INT0", // 10: External Interrupt 0 + "TIMER1_CAPT", // 11: Timer 1 Capture Event + "TIMER1_COMPA", // 12: Timer 1 Compare Match A + "TIMER1_COMPB", // 13: Timer 1 Compare Match B + "RESERVED15", // 14: Reserved 15 + "TIMER1_OVF", // 15: Timer 1 Overflow + "TIMER0_COMPA", // 16: Timer 0 Compare Match A + "TIMER0_OVF", // 17: Timer 0 Overflow + "ADC", // 18: ADC Conversion Complete + "INT1", // 19: External Interrupt 1 + "SPI_STC", // 20: SPI Serial Transfer Complete + "USART_RX", // 21: USART Receive Complete + "USART_UDRE", // 22: USART Data Register Empty + "USART_TX", // 23: USART Transmit Complete + "INT2", // 24: External Interrupt 2 + "WDT", // 25: Watchdog Time-out + "EE_READY", // 26: EEPROM Ready + "TIMER0_COMPB", // 27: Timer 0 Compare Match B + "INT3", // 28: External Interrupt 3 + "RESERVED30", // 29: Reserved 30 + "RESERVED31", // 30: Reserved 31 + "SPM_READY", // 31: Store Program Memory Ready +}; + +const char * const vtab_at90scr100[vts_at90scr100] = { // AT90SCR100 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "INT3", // 4: External Interrupt 3 + "PCINT0", // 5: Pin Change Interrupt 0 + "PCINT1", // 6: Pin Change Interrupt 1 + "PCINT2", // 7: Pin Change Interrupt 2 + "WDT", // 8: Watchdog Time-out + "TIMER2_COMPA", // 9: Timer 2 Compare Match A + "TIMER2_COMPB", // 10: Timer 2 Compare Match B + "TIMER2_OVF", // 11: Timer 2 Overflow + "TIMER1_CAPT", // 12: Timer 1 Capture Event + "TIMER1_COMPA", // 13: Timer 1 Compare Match A + "TIMER1_COMPB", // 14: Timer 1 Compare Match B + "TIMER1_OVF", // 15: Timer 1 Overflow + "TIMER0_COMPA", // 16: Timer 0 Compare Match A + "TIMER0_COMPB", // 17: Timer 0 Compare Match B + "TIMER0_OVF", // 18: Timer 0 Overflow + "SPI_STC", // 19: SPI Serial Transfer Complete + "USART0_RX", // 20: USART 0 Receive Complete + "USART0_UDRE", // 21: USART 0 Data Register Empty + "USART0_TX", // 22: USART 0 Transmit Complete + "SUPPLY_MON", // 23: Supply Monitor + "RFU", // 24: Reserved for Future Use + "EE_READY", // 25: EEPROM Ready + "TWI", // 26: 2-Wire Interface + "SPM_READY", // 27: Store Program Memory Ready + "KEYBOARD", // 28: Keyboard Input Change + "AES_Operation", // 29: AES Operation + "HSSPI", // 30: High-Speed SPI + "USB_Endpoint", // 31: USB Endpoint + "USB_Protocol", // 32: USB Protocol + "SCIB", // 33: Smart Card Reader Interface + "USBHost_Control", // 34: USB Host Controller + "USBHost_Pipe", // 35: USB Host Pipe + "CPRES", // 36: Card Presence Detection + "PCINT3", // 37: Pin Change Interrupt 3 +}; + +const char * const vtab_at90can128[vts_at90can128] = { // AT90CAN128, AT90CAN64, AT90CAN32 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "INT2", // 3: External Interrupt 2 + "INT3", // 4: External Interrupt 3 + "INT4", // 5: External Interrupt 4 + "INT5", // 6: External Interrupt 5 + "INT6", // 7: External Interrupt 6 + "INT7", // 8: External Interrupt 7 + "TIMER2_COMP", // 9: Timer 2 Compare Match + "TIMER2_OVF", // 10: Timer 2 Overflow + "TIMER1_CAPT", // 11: Timer 1 Capture Event + "TIMER1_COMPA", // 12: Timer 1 Compare Match A + "TIMER1_COMPB", // 13: Timer 1 Compare Match B + "TIMER1_COMPC", // 14: Timer 1 Compare Match C + "TIMER1_OVF", // 15: Timer 1 Overflow + "TIMER0_COMP", // 16: Timer 0 Compare Match + "TIMER0_OVF", // 17: Timer 0 Overflow + "CANIT", // 18: CAN Transfer Complete or Error + "OVRIT", // 19: CAN Timer Overrun + "SPI_STC", // 20: SPI Serial Transfer Complete + "USART0_RX", // 21: USART 0 Receive Complete + "USART0_UDRE", // 22: USART 0 Data Register Empty + "USART0_TX", // 23: USART 0 Transmit Complete + "ANALOG_COMP", // 24: Analog Comparator + "ADC", // 25: ADC Conversion Complete + "EE_READY", // 26: EEPROM Ready + "TIMER3_CAPT", // 27: Timer 3 Capture Event + "TIMER3_COMPA", // 28: Timer 3 Compare Match A + "TIMER3_COMPB", // 29: Timer 3 Compare Match B + "TIMER3_COMPC", // 30: Timer 3 Compare Match C + "TIMER3_OVF", // 31: Timer 3 Overflow + "USART1_RX", // 32: USART 1 Receive Complete + "USART1_UDRE", // 33: USART 1 Data Register Empty + "USART1_TX", // 34: USART 1 Transmit Complete + "TWI", // 35: 2-Wire Interface + "SPM_READY", // 36: Store Program Memory Ready +}; + +const char * const vtab_at90pwm161[vts_at90pwm161] = { // AT90PWM161, AT90PWM81 + "RESET", // 0: Reset (various reasons) + "PSC2_CAPT", // 1: PSC 2 Capture Event + "PSC2_EC", // 2: PSC 2 End Cycle + "PSC2_EEC", // 3: PSC 2 End Of Enhanced Cycle + "PSC0_CAPT", // 4: PSC 0 Capture Event + "PSC0_EC", // 5: PSC 0 End Cycle + "PSC0_EEC", // 6: PSC 0 End Of Enhanced Cycle + "ANALOG_COMP_1", // 7: Analog Comparator 1 + "ANALOG_COMP_2", // 8: Analog Comparator 2 + "ANALOG_COMP_3", // 9: Analog Comparator 3 + "INT0", // 10: External Interrupt 0 + "TIMER1_CAPT", // 11: Timer 1 Capture Event + "TIMER1_OVF", // 12: Timer 1 Overflow + "ADC", // 13: ADC Conversion Complete + "INT1", // 14: External Interrupt 1 + "SPI_STC", // 15: SPI Serial Transfer Complete + "INT2", // 16: External Interrupt 2 + "WDT", // 17: Watchdog Time-out + "EE_READY", // 18: EEPROM Ready + "SPM_READY", // 19: Store Program Memory Ready +}; + +const char * const vtab_at90pwm316[vts_at90pwm316] = { // AT90PWM316, AT90PWM216, AT90PWM1 + "RESET", // 0: Reset (various reasons) + "PSC2_CAPT", // 1: PSC 2 Capture Event + "PSC2_EC", // 2: PSC 2 End Cycle + "PSC1_CAPT", // 3: PSC 1 Capture Event + "PSC1_EC", // 4: PSC 1 End Cycle + "PSC0_CAPT", // 5: PSC 0 Capture Event + "PSC0_EC", // 6: PSC 0 End Cycle + "ANALOG_COMP_0", // 7: Analog Comparator 0 + "ANALOG_COMP_1", // 8: Analog Comparator 1 + "ANALOG_COMP_2", // 9: Analog Comparator 2 + "INT0", // 10: External Interrupt 0 + "TIMER1_CAPT", // 11: Timer 1 Capture Event + "TIMER1_COMPA", // 12: Timer 1 Compare Match A + "TIMER1_COMPB", // 13: Timer 1 Compare Match B + "RESERVED15", // 14: Reserved 15 + "TIMER1_OVF", // 15: Timer 1 Overflow + "TIMER0_COMP_A", // 16: Timer 0 Compare Match A + "TIMER0_OVF", // 17: Timer 0 Overflow + "ADC", // 18: ADC Conversion Complete + "INT1", // 19: External Interrupt 1 + "SPI_STC", // 20: SPI Serial Transfer Complete + "USART_RX", // 21: USART Receive Complete + "USART_UDRE", // 22: USART Data Register Empty + "USART_TX", // 23: USART Transmit Complete + "INT2", // 24: External Interrupt 2 + "WDT", // 25: Watchdog Time-out + "EE_READY", // 26: EEPROM Ready + "TIMER0_COMPB", // 27: Timer 0 Compare Match B + "INT3", // 28: External Interrupt 3 + "RESERVED30", // 29: Reserved 30 + "RESERVED31", // 30: Reserved 31 + "SPM_READY", // 31: Store Program Memory Ready +}; + +const char * const vtab_at90s1200[vts_at90s1200] = { // AT90S1200 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "TIMER0_OVF", // 2: Timer 0 Overflow + "ANA_COMP", // 3: Analog Comparator +}; + +const char * const vtab_at90s2313[vts_at90s2313] = { // AT90S2313 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "TIMER1_CAPT1", // 3: Timer 1 Capture Event + "TIMER1_COMP1", // 4: Timer 1 Compare + "TIMER1_OVF1", // 5: Timer 1 Overflow + "TIMER0_OVF0", // 6: Timer 0 Overflow + "UART_RX", // 7: UART Receive Complete + "UART_UDRE", // 8: UART Data Register Empty + "UART_TX", // 9: UART Transmit Complete + "ANA_COMP", // 10: Analog Comparator +}; + +const char * const vtab_at90s4433[vts_at90s4433] = { // AT90S4433, AT90S2333 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "TIMER1_CAPT", // 3: Timer 1 Capture Event + "TIMER1_COMP", // 4: Timer 1 Compare + "TIMER1_OVF", // 5: Timer 1 Overflow + "TIMER0_OVF", // 6: Timer 0 Overflow + "SPI_STC", // 7: SPI Serial Transfer Complete + "UART_RX", // 8: UART Receive Complete + "UART_UDRE", // 9: UART Data Register Empty + "UART_TX", // 10: UART Transmit Complete + "ADC", // 11: ADC Conversion Complete + "EE_RDY", // 12: EEPROM Ready + "ANA_COMP", // 13: Analog Comparator +}; + +const char * const vtab_at90s8515[vts_at90s8515] = { // AT90S8515, AT90S4414 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "TIMER1_CAPT", // 3: Timer 1 Capture Event + "TIMER1_COMPA", // 4: Timer 1 Compare Match A + "TIMER1_COMPB", // 5: Timer 1 Compare Match B + "TIMER1_OVF", // 6: Timer 1 Overflow + "TIMER0_OVF", // 7: Timer 0 Overflow + "SPI_STC", // 8: SPI Serial Transfer Complete + "UART_RX", // 9: UART Receive Complete + "UART_UDRE", // 10: UART Data Register Empty + "UART_TX", // 11: UART Transmit Complete + "ANA_COMP", // 12: Analog Comparator +}; + +const char * const vtab_at90s8535[vts_at90s8535] = { // AT90S8535, AT90S4434 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "TIMER2_COMP", // 3: Timer 2 Compare Match + "TIMER2_OVF", // 4: Timer 2 Overflow + "TIMER1_CAPT", // 5: Timer 1 Capture Event + "TIMER1_COMPA", // 6: Timer 1 Compare Match A + "TIMER1_COMPB", // 7: Timer 1 Compare Match B + "TIMER1_OVF", // 8: Timer 1 Overflow + "TIMER0_OVF", // 9: Timer 0 Overflow + "SPI_STC", // 10: SPI Serial Transfer Complete + "UART_RX", // 11: UART Receive Complete + "UART_UDRE", // 12: UART Data Register Empty + "UART_TX", // 13: UART Transmit Complete + "ADC", // 14: ADC Conversion Complete + "EE_RDY", // 15: EEPROM Ready + "ANA_COMP", // 16: Analog Comparator +}; + +const char * const vtab_ata5272[vts_ata5272] = { // ATA5272 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "PCINT0", // 3: Pin Change Interrupt 0 + "PCINT1", // 4: Pin Change Interrupt 1 + "WDT", // 5: Watchdog Time-out + "TIMER1_CAPT", // 6: Timer 1 Capture Event + "TIMER1_COMPA", // 7: Timer 1 Compare Match A + "TIMER1_COMPB", // 8: Timer 1 Compare Match B + "TIMER1_OVF", // 9: Timer 1 Overflow + "TIMER0_COMPA", // 10: Timer 0 Compare Match A + "TIMER0_OVF", // 11: Timer 0 Overflow + "LIN_TC", // 12: LIN Transfer Complete + "LIN_ERR", // 13: LIN Error + "SPI_STC", // 14: SPI Serial Transfer Complete + "ADC", // 15: ADC Conversion Complete + "EE_RDY", // 16: EEPROM Ready + "UNUSED", // 17: not implemented on this device + "UNUSED", // 18: not implemented on this device + "USI_OVF", // 19: USI Overflow + "UNUSED", // 20: not implemented on this device + "UNUSED", // 21: not implemented on this device + "UNUSED", // 22: not implemented on this device + "UNUSED", // 23: not implemented on this device + "UNUSED", // 24: not implemented on this device + "UNUSED", // 25: not implemented on this device + "UNUSED", // 26: not implemented on this device + "UNUSED", // 27: not implemented on this device + "UNUSED", // 28: not implemented on this device + "UNUSED", // 29: not implemented on this device + "UNUSED", // 30: not implemented on this device + "UNUSED", // 31: not implemented on this device + "UNUSED", // 32: not implemented on this device + "UNUSED", // 33: not implemented on this device + "ANA_COMP", // 34: Analog Comparator + "UNUSED", // 35: not implemented on this device + "USI_START", // 36: USI Start Condition +}; + +const char * const vtab_ata5702m322[vts_ata5702m322] = { // ATA5702M322, ATA5700M322 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "PCI0", // 3: Pin Change Interrupt Request 0 + "PCI1", // 4: Pin Change Interrupt Request 1 + "VMON", // 5: Voltage Monitoring + "AVCCR", // 6: AVCC Reset + "AVCCL", // 7: AVCC Low + "T0INT", // 8: Timer 0 Interrupt + "T1COMP", // 9: Timer 1 Compare and Match + "T1OVF", // 10: Timer 1 Overflow + "T2COMP", // 11: Timer 2 Compare and Match + "T2OVF", // 12: Timer 2 Overflow + "T3CAP", // 13: Timer 3 Capture Event + "T3COMP", // 14: Timer 3 Compare and Match + "T3OVF", // 15: Timer 3 Overflow + "T4CAP", // 16: Timer 4 Capture Event + "T4COMP", // 17: Timer 4 Compare and Match + "T4OVF", // 18: Timer 4 Overflow + "T5COMP", // 19: Timer 5 Compare and Match + "T5OVF", // 20: Timer 5 Overflow + "SPI", // 21: SPI Serial Peripheral Interface + "SRX_FIFO", // 22: SPI Receive Buffer + "STX_FIFO", // 23: SPI Transmit Buffer + "SSM", // 24: Sequencer State Machine + "DFFLR", // 25: Data FIFO Fill Level Reached + "DFOUE", // 26: Data FIFO Overflow or Underflow Error + "SFFLR", // 27: RSSI/Preamble FIFO Fill Level Reached + "SFOUE", // 28: RSSI/Preamble FIFO Overflow or Underflow Error + "TMTCF", // 29: Transmit Modulator Telegram Finished + "AES", // 30: AES Crypto Unit + "TPINT", // 31: Transponder Mode Interrupt + "TPTOERR", // 32: Transponder Timeout Error + "LFID0INT", // 33: LF Receiver Identifier 0 Interrupt + "LFID1INT", // 34: LF Receiver Identifier 1 Interrupt + "LFFEINT", // 35: LF Receiver Frame End Interrupt + "LFBCR", // 36: LF Receiver Bit Count Reached + "LFPBD", // 37: LF Receiver PreBurst Detected + "LFDE", // 38: LF Receiver Decoder Error + "LFEOT", // 39: LF Receiver End of Telegram + "LFTCOR", // 40: LF Receiver Timer Compare + "LFRSCO", // 41: LF Receiver RSSI Measurement + "LDFFLR", // 42: Data FIFO Fill Level Reached + "LDFOUE", // 43: Data FIFO Overflow or Underflow Error + "EXCM", // 44: External Input Clock Break Down + "E2CINT", // 45: EEPROM Error Correction Interrupt + "ERDY", // 46: EEPROM Ready + "SPMR", // 47: Store Program Memory Ready + "TWI1", // 48: 2-Wire Interface 1 + "SPI2", // 49: SPI 2 Serial Peripheral Interface + "TWI2", // 50: 2-Wire Interface 2 +}; + +const char * const vtab_ata5790[vts_ata5790] = { // ATA5790 + "RESET", // 0: Reset (various reasons) + "TPINT", // 1: Transponder Mode Interrupt + "INT0", // 2: External Interrupt 0 + "PCINT0", // 3: Pin Change Interrupt 0 + "PCINT1", // 4: Pin Change Interrupt 1 + "VMINT", // 5: Voltage Monitoring Interrupt + "T0INT", // 6: Timer 0 Interrupt + "LFID0INT", // 7: LF Receiver Identifier 0 Interrupt + "LFID1INT", // 8: LF Receiver Identifier 1 Interrupt + "LFFEINT", // 9: LF Receiver Frame End Interrupt + "LFDBINT", // 10: LF Receiver Data Buffer Full Interrupt + "T3CAPINT", // 11: Timer 3 Capture Event Interrupt + "T3COMINT", // 12: Timer 3 Compare and Match Interrupt + "T3OVFINT", // 13: Timer 3 Overflow Interrupt + "T2COMINT", // 14: Timer 2 Compare and Match Interrupt + "T2OVFINT", // 15: Timer 2 Overflow Interrupt + "T1INT", // 16: Timer 1 Interrupt + "SPISTC", // 17: SPI Serial Transfer Complete + "TMRXBINT", // 18: Timer Modulator Receive Buffer Interrupt + "TMTXBINT", // 19: Timer Modulator Transmit Buffer Interrupt + "TMTXCINT", // 20: Timer Modulator Transmit Complete Interrupt + "AESINT", // 21: AES Crypto Unit Interrupt + "LFRSSINT", // 22: LF Receiver RSSI Interrupt + "LFSDINT", // 23: LF Receiver Signal Detect Interrupt + "LFMDINT", // 24: LF Receiver Manchester Decoder Error Interrupt + "EXCMINT", // 25: External Input Clock Monitoring Interrupt + "EXXMINT", // 26: External XTAL Oscillator Break Down Interrupt + "RTCINT", // 27: Real Time Clock Interrupt + "EEREADY", // 28: EEPROM Ready + "SPMREADY", // 29: Store Program Memory Ready +}; + +const char * const vtab_ata5791[vts_ata5791] = { // ATA5791, ATA5790N + "RESET", // 0: Reset (various reasons) + "TPINT", // 1: Transponder Mode Interrupt + "INT0", // 2: External Interrupt 0 + "PCINT0", // 3: Pin Change Interrupt 0 + "PCINT1", // 4: Pin Change Interrupt 1 + "VMINT", // 5: Voltage Monitoring Interrupt + "T0INT", // 6: Timer 0 Interrupt + "LFID0INT", // 7: LF Receiver Identifier 0 Interrupt + "LFID1INT", // 8: LF Receiver Identifier 1 Interrupt + "LFFEINT", // 9: LF Receiver Frame End Interrupt + "LFDBINT", // 10: LF Receiver Data Buffer Full Interrupt + "T3CAPINT", // 11: Timer 3 Capture Event Interrupt + "T3COMINT", // 12: Timer 3 Compare and Match Interrupt + "T3OVFINT", // 13: Timer 3 Overflow Interrupt + "T3COM2INT", // 14: Timer 3 Compare and Match 2 Interrupt + "T2COMINT", // 15: Timer 2 Compare and Match Interrupt + "T2OVFINT", // 16: Timer 2 Overflow Interrupt + "T1INT", // 17: Timer 1 Interrupt + "SPISTC", // 18: SPI Serial Transfer Complete + "TMRXBINT", // 19: Timer Modulator Receive Buffer Interrupt + "TMTXBINT", // 20: Timer Modulator Transmit Buffer Interrupt + "TMTXCINT", // 21: Timer Modulator Transmit Complete Interrupt + "AESINT", // 22: AES Crypto Unit Interrupt + "LFRSSINT", // 23: LF Receiver RSSI Interrupt + "LFSDINT", // 24: LF Receiver Signal Detect Interrupt + "LFMDINT", // 25: LF Receiver Manchester Decoder Error Interrupt + "EXCMINT", // 26: External Input Clock Monitoring Interrupt + "EXXMINT", // 27: External XTAL Oscillator Break Down Interrupt + "RTCINT", // 28: Real Time Clock Interrupt + "EEREADY", // 29: EEPROM Ready + "SPMREADY", // 30: Store Program Memory Ready +}; + +const char * const vtab_ata5795[vts_ata5795] = { // ATA5795 + "RESET", // 0: Reset (various reasons) + "TPINT", // 1: Transponder Mode Interrupt + "INT0", // 2: External Interrupt 0 + "PCINT0", // 3: Pin Change Interrupt 0 + "PCINT1", // 4: Pin Change Interrupt 1 + "VMINT", // 5: Voltage Monitoring Interrupt + "T0INT", // 6: Timer 0 Interrupt + "T3CAPINT", // 7: Timer 3 Capture Event Interrupt + "T3COMINT", // 8: Timer 3 Compare and Match Interrupt + "T3OVFINT", // 9: Timer 3 Overflow Interrupt + "T2COMINT", // 10: Timer 2 Compare and Match Interrupt + "T2OVFINT", // 11: Timer 2 Overflow Interrupt + "T1INT", // 12: Timer 1 Interrupt + "SPISTC", // 13: SPI Serial Transfer Complete + "TMRXBINT", // 14: Timer Modulator Receive Buffer Interrupt + "TMTXBINT", // 15: Timer Modulator Transmit Buffer Interrupt + "TMTXCINT", // 16: Timer Modulator Transmit Complete Interrupt + "AESINT", // 17: AES Crypto Unit Interrupt + "EXCMINT", // 18: External Input Clock Monitoring Interrupt + "EXXMINT", // 19: External XTAL Oscillator Break Down Interrupt + "RTCINT", // 20: Real Time Clock Interrupt + "EEREADY", // 21: EEPROM Ready + "SPMREADY", // 22: Store Program Memory Ready +}; + +const char * const vtab_ata5835[vts_ata5835] = { // ATA5835, ATA5787 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "PCI0", // 3: Pin Change Interrupt Request 0 + "PCI1", // 4: Pin Change Interrupt Request 1 + "VMON", // 5: Voltage Monitoring + "AVCCR", // 6: AVCC Reset + "AVCCL", // 7: AVCC Low + "T0INT", // 8: Timer 0 Interrupt + "T1COMP", // 9: Timer 1 Compare and Match + "T1OVF", // 10: Timer 1 Overflow + "T2COMP", // 11: Timer 2 Compare and Match + "T2OVF", // 12: Timer 2 Overflow + "T3CAP", // 13: Timer 3 Capture Event + "T3COMP", // 14: Timer 3 Compare and Match + "T3OVF", // 15: Timer 3 Overflow + "T4CAP", // 16: Timer 4 Capture Event + "T4COMP", // 17: Timer 4 Compare and Match + "T4OVF", // 18: Timer 4 Overflow + "T5COMP", // 19: Timer 5 Compare and Match + "T5OVF", // 20: Timer 5 Overflow + "SPI", // 21: SPI Serial Peripheral Interface + "SRX_FIFO", // 22: SPI Receive Buffer + "STX_FIFO", // 23: SPI Transmit Buffer + "LINTC", // 24: LIN Transfer Complete + "LINERR", // 25: LIN Error + "SSM", // 26: Sequencer State Machine + "DFFLR", // 27: Data FIFO Fill Level Reached + "DFOUE", // 28: Data FIFO Overflow or Underflow Error + "SFFLR", // 29: RSSI/Preamble FIFO Fill Level Reached + "SFOUE", // 30: RSSI/Preamble FIFO Overflow or Underflow Error + "TMTCF", // 31: Transmit Modulator Telegram Finished + "UHF_WCOA", // 32: UHF Receiver Wake Up OK on Receive Path A + "UHF_WCOB", // 33: UHF Receiver Wake Up OK on Receive Path B + "UHF_SOTA", // 34: UHF Receiver Start of Telegram OK on Receive Path A + "UHF_SOTB", // 35: UHF Receiver Start of Telegram OK on Receive Path B + "UHF_EOTA", // 36: UHF Receiver End of Telegram on Receive Path A + "UHF_EOTB", // 37: UHF Receiver End of Telegram on Receive Path B + "UHF_NBITA", // 38: UHF Receiver New Bit on Receive Path A + "UHF_NBITB", // 39: UHF Receiver New Bit on Receive Path B + "EXCM", // 40: External Input Clock Break Down + "ERDY", // 41: EEPROM Ready + "SPMR", // 42: Store Program Memory Ready + "IDFULL", // 43: IDSCAN Full +}; + +const char * const vtab_ata6289[vts_ata6289] = { // ATA6289, ATA6286, ATA6285 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "PCINT0", // 3: Pin Change Interrupt 0 + "PCINT1", // 4: Pin Change Interrupt 1 + "PCINT2", // 5: Pin Change Interrupt 2 + "INTVM", // 6: Voltage Monitor Interrupt + "SENINT", // 7: Sensor Interface Interrupt + "INTT0", // 8: Timer 0 Interval Interrupt + "LFWP", // 9: LF-Receiver Wake-up + "T3CAP", // 10: Timer 3 Capture Event + "T3COMA", // 11: Timer 3 Compare Match A + "T3COMB", // 12: Timer 3 Compare Match B + "T3OVF", // 13: Timer 3 Overflow + "T2CAP", // 14: Timer 2 Capture Event + "T2COM", // 15: Timer 2 Compare Match + "T2OVF", // 16: Timer 2 Overflow + "SPISTC", // 17: SPI Serial Transfer Complete + "LFRXB", // 18: LF Receive Buffer + "INTT1", // 19: Timer 1 Interval Interrupt + "T2RXB", // 20: Timer 2 SSI Receive Buffer + "T2TXB", // 21: Timer 2 SSI Transmit Buffer + "T2TXC", // 22: Timer 2 SSI Transmit Complete + "LFREOB", // 23: LF-Receiver End of Burst + "EXCM", // 24: External Input Clock Break Down + "EEREADY", // 25: EEPROM Ready + "SPM_RDY", // 26: Store Program Memory Ready +}; + +const char * const vtab_ata8515[vts_ata8515] = { // ATA8515, ATA8510, ATA8215, ATA8210, ATA5833, ATA5832, ATA5831, ATA5783, ATA5782, ATA5781 + "RESET", // 0: Reset (various reasons) + "INT0", // 1: External Interrupt 0 + "INT1", // 2: External Interrupt 1 + "PCI0", // 3: Pin Change Interrupt Request 0 + "PCI1", // 4: Pin Change Interrupt Request 1 + "VMON", // 5: Voltage Monitoring + "AVCCR", // 6: AVCC Reset + "AVCCL", // 7: AVCC Low + "T0INT", // 8: Timer 0 Interrupt + "T1COMP", // 9: Timer 1 Compare and Match + "T1OVF", // 10: Timer 1 Overflow + "T2COMP", // 11: Timer 2 Compare and Match + "T2OVF", // 12: Timer 2 Overflow + "T3CAP", // 13: Timer 3 Capture Event + "T3COMP", // 14: Timer 3 Compare and Match + "T3OVF", // 15: Timer 3 Overflow + "T4CAP", // 16: Timer 4 Capture Event + "T4COMP", // 17: Timer 4 Compare and Match + "T4OVF", // 18: Timer 4 Overflow + "T5COMP", // 19: Timer 5 Compare and Match + "T5OVF", // 20: Timer 5 Overflow + "SPI", // 21: SPI Serial Peripheral Interface + "SRX_FIFO", // 22: SPI Receive Buffer + "STX_FIFO", // 23: SPI Transmit Buffer + "SSM", // 24: Sequencer State Machine + "DFFLR", // 25: Data FIFO Fill Level Reached + "DFOUE", // 26: Data FIFO Overflow or Underflow Error + "SFFLR", // 27: RSSI/Preamble FIFO Fill Level Reached + "SFOUE", // 28: RSSI/Preamble FIFO Overflow or Underflow Error + "TMTCF", // 29: Transmit Modulator Telegram Finished + "UHF_WCOB", // 30: UHF Receiver Wake Up OK on Receive Path B + "UHF_WCOA", // 31: UHF Receiver Wake Up OK on Receive Path A + "UHF_SOTB", // 32: UHF Receiver Start of Telegram OK on Receive Path B + "UHF_SOTA", // 33: UHF Receiver Start of Telegram OK on Receive Path A + "UHF_EOTB", // 34: UHF Receiver End of Telegram on Receive Path B + "UHF_EOTA", // 35: UHF Receiver End of Telegram on Receive Path A + "UHF_NBITB", // 36: UHF Receiver New Bit on Receive Path B + "UHF_NBITA", // 37: UHF Receiver New Bit on Receive Path A + "EXCM", // 38: External Input Clock Break Down + "ERDY", // 39: EEPROM Ready + "SPMR", // 40: Store Program Memory Ready + "IDFULL", // 41: IDSCAN Full +}; + +const char * const vtab_atxmega32a4[vts_atxmega32a4] = { // ATxmega32A4, ATxmega16A4 + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "DMA_CH0", // 6: DMA Channel 0 + "DMA_CH1", // 7: DMA Channel 1 + "DMA_CH2", // 8: DMA Channel 2 + "DMA_CH3", // 9: DMA Channel 3 + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF", // 14: TC C0 Overflow + "TCC0_ERR", // 15: TC C0 Error + "TCC0_CCA", // 16: TC C0 Compare or Capture A + "TCC0_CCB", // 17: TC C0 Compare or Capture B + "TCC0_CCC", // 18: TC C0 Compare or Capture C + "TCC0_CCD", // 19: TC C0 Compare or Capture D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "USARTC1_RXC", // 28: USARTC 1 Reception Complete + "USARTC1_DRE", // 29: USARTC 1 Data Register Empty + "USARTC1_TXC", // 30: USARTC 1 Transmission Complete + "AES_INT", // 31: AES Interrupt + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "UNUSED", // 36: not implemented on this device + "UNUSED", // 37: not implemented on this device + "UNUSED", // 38: not implemented on this device + "UNUSED", // 39: not implemented on this device + "UNUSED", // 40: not implemented on this device + "UNUSED", // 41: not implemented on this device + "UNUSED", // 42: not implemented on this device + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF", // 47: TC E0 Overflow + "TCE0_ERR", // 48: TC E0 Error + "TCE0_CCA", // 49: TC E0 Compare or Capture A + "TCE0_CCB", // 50: TC E0 Compare or Capture B + "TCE0_CCC", // 51: TC E0 Compare or Capture C + "TCE0_CCD", // 52: TC E0 Compare or Capture D + "HIRESE_OVF", // 53: High-resolution Extension Overflow + "HIRESE_ERR", // 54: High-resolution Extension Error + "HIRESE_CCA", // 55: High-resolution Extension Compare and Capture A + "HIRESE_CCB", // 56: High-resolution Extension Compare and Capture B + "UNUSED", // 57: not implemented on this device + "USARTE0_RXC", // 58: USARTE 0 Reception Complete + "USARTE0_DRE", // 59: USARTE 0 Data Register Empty + "USARTE0_TXC", // 60: USARTE 0 Transmission Complete + "UNUSED", // 61: not implemented on this device + "UNUSED", // 62: not implemented on this device + "UNUSED", // 63: not implemented on this device + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "ADCA_CH1", // 72: ADCA Interrupt 1 + "ADCA_CH2", // 73: ADCA Interrupt 2 + "ADCA_CH3", // 74: ADCA Interrupt 3 + "UNUSED", // 75: not implemented on this device + "UNUSED", // 76: not implemented on this device + "TCD0_OVF", // 77: TC D0 Overflow + "TCD0_ERR", // 78: TC D0 Error + "TCD0_CCA", // 79: TC D0 Compare or Capture A + "TCD0_CCB", // 80: TC D0 Compare or Capture B + "TCD0_CCC", // 81: TC D0 Compare or Capture C + "TCD0_CCD", // 82: TC D0 Compare or Capture D + "TCD1_OVF", // 83: TC D1 Overflow + "TCD1_ERR", // 84: TC D1 Error + "TCD1_CCA", // 85: TC D1 Compare or Capture A + "TCD1_CCB", // 86: TC D1 Compare or Capture B + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete + "USARTD1_RXC", // 91: USARTD 1 Reception Complete + "USARTD1_DRE", // 92: USARTD 1 Data Register Empty + "USARTD1_TXC", // 93: USARTD 1 Transmission Complete +}; + +const char * const vtab_atxmega32c4[vts_atxmega32c4] = { // ATxmega32C4, ATxmega16C4 + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "UNUSED", // 6: not implemented on this device + "UNUSED", // 7: not implemented on this device + "UNUSED", // 8: not implemented on this device + "UNUSED", // 9: not implemented on this device + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF/TCC2_LUNF", // 14: TC C0 Overflow/TC C2 Low Byte Underflow + "TCC0_ERR/TCC2_HUNF", // 15: TC C0 Error/TC C2 High Byte Underflow + "TCC0_CCA/TCC2_LCMPA", // 16: TC C0 Compare or Capture A/TC C2 Low Byte Compare A + "TCC0_CCB/TCC2_LCMPB", // 17: TC C0 Compare or Capture B/TC C2 Low Byte Compare B + "TCC0_CCC/TCC2_LCMPC", // 18: TC C0 Compare or Capture C/TC C2 Low Byte Compare C + "TCC0_CCD/TCC2_LCMPD", // 19: TC C0 Compare or Capture D/TC C2 Low Byte Compare D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "USARTC1_RXC", // 28: USARTC 1 Reception Complete + "USARTC1_DRE", // 29: USARTC 1 Data Register Empty + "USARTC1_TXC", // 30: USARTC 1 Transmission Complete + "UNUSED", // 31: not implemented on this device + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "UNUSED", // 36: not implemented on this device + "UNUSED", // 37: not implemented on this device + "UNUSED", // 38: not implemented on this device + "UNUSED", // 39: not implemented on this device + "UNUSED", // 40: not implemented on this device + "UNUSED", // 41: not implemented on this device + "UNUSED", // 42: not implemented on this device + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF", // 47: TC E0 Overflow + "TCE0_ERR", // 48: TC E0 Error + "TCE0_CCA", // 49: TC E0 Compare or Capture A + "TCE0_CCB", // 50: TC E0 Compare or Capture B + "TCE0_CCC", // 51: TC E0 Compare or Capture C + "TCE0_CCD", // 52: TC E0 Compare or Capture D + "UNUSED", // 53: not implemented on this device + "UNUSED", // 54: not implemented on this device + "UNUSED", // 55: not implemented on this device + "UNUSED", // 56: not implemented on this device + "UNUSED", // 57: not implemented on this device + "UNUSED", // 58: not implemented on this device + "UNUSED", // 59: not implemented on this device + "UNUSED", // 60: not implemented on this device + "UNUSED", // 61: not implemented on this device + "UNUSED", // 62: not implemented on this device + "UNUSED", // 63: not implemented on this device + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "UNUSED", // 72: not implemented on this device + "UNUSED", // 73: not implemented on this device + "UNUSED", // 74: not implemented on this device + "UNUSED", // 75: not implemented on this device + "UNUSED", // 76: not implemented on this device + "TCD0_OVF/TCD2_LUNF", // 77: TC D0 Overflow/TC D2 Low Byte Underflow + "TCD0_ERR/TCD2_HUNF", // 78: TC D0 Error/TC D2 High Byte Underflow + "TCD0_CCA/TCD2_LCMPA", // 79: TC D0 Compare or Capture A/TC D2 Low Byte Compare A + "TCD0_CCB/TCD2_LCMPB", // 80: TC D0 Compare or Capture B/TC D2 Low Byte Compare B + "TCD0_CCC/TCD2_LCMPC", // 81: TC D0 Compare or Capture C/TC D2 Low Byte Compare C + "TCD0_CCD/TCD2_LCMPD", // 82: TC D0 Compare or Capture D/TC D2 Low Byte Compare D + "UNUSED", // 83: not implemented on this device + "UNUSED", // 84: not implemented on this device + "UNUSED", // 85: not implemented on this device + "UNUSED", // 86: not implemented on this device + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete + "UNUSED", // 91: not implemented on this device + "UNUSED", // 92: not implemented on this device + "UNUSED", // 93: not implemented on this device + "UNUSED", // 94: not implemented on this device + "UNUSED", // 95: not implemented on this device + "UNUSED", // 96: not implemented on this device + "UNUSED", // 97: not implemented on this device + "UNUSED", // 98: not implemented on this device + "UNUSED", // 99: not implemented on this device + "UNUSED", // 100: not implemented on this device + "UNUSED", // 101: not implemented on this device + "UNUSED", // 102: not implemented on this device + "UNUSED", // 103: not implemented on this device + "UNUSED", // 104: not implemented on this device + "UNUSED", // 105: not implemented on this device + "UNUSED", // 106: not implemented on this device + "UNUSED", // 107: not implemented on this device + "UNUSED", // 108: not implemented on this device + "UNUSED", // 109: not implemented on this device + "UNUSED", // 110: not implemented on this device + "UNUSED", // 111: not implemented on this device + "UNUSED", // 112: not implemented on this device + "UNUSED", // 113: not implemented on this device + "UNUSED", // 114: not implemented on this device + "UNUSED", // 115: not implemented on this device + "UNUSED", // 116: not implemented on this device + "UNUSED", // 117: not implemented on this device + "UNUSED", // 118: not implemented on this device + "UNUSED", // 119: not implemented on this device + "UNUSED", // 120: not implemented on this device + "UNUSED", // 121: not implemented on this device + "UNUSED", // 122: not implemented on this device + "UNUSED", // 123: not implemented on this device + "UNUSED", // 124: not implemented on this device + "USB_BUSEVENT", // 125: SOF, Suspend, Resume, Reset Bus Event Interrupts, CRC, Underflow, Overflow or Stall Error + "USB_TRNCOMPL", // 126: USB Transaction Complete +}; + +const char * const vtab_atxmega32d4[vts_atxmega32d4] = { // ATxmega32D4, ATxmega16D4 + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "UNUSED", // 6: not implemented on this device + "UNUSED", // 7: not implemented on this device + "UNUSED", // 8: not implemented on this device + "UNUSED", // 9: not implemented on this device + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF/TCC2_LUNF", // 14: TC C0 Overflow/TC C2 Low Byte Underflow + "TCC0_ERR/TCC2_HUNF", // 15: TC C0 Error/TC C2 High Byte Underflow + "TCC0_CCA/TCC2_LCMPA", // 16: TC C0 Compare or Capture A/TC C2 Low Byte Compare A + "TCC0_CCB/TCC2_LCMPB", // 17: TC C0 Compare or Capture B/TC C2 Low Byte Compare B + "TCC0_CCC/TCC2_LCMPC", // 18: TC C0 Compare or Capture C/TC C2 Low Byte Compare C + "TCC0_CCD/TCC2_LCMPD", // 19: TC C0 Compare or Capture D/TC C2 Low Byte Compare D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "UNUSED", // 28: not implemented on this device + "UNUSED", // 29: not implemented on this device + "UNUSED", // 30: not implemented on this device + "UNUSED", // 31: not implemented on this device + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "UNUSED", // 36: not implemented on this device + "UNUSED", // 37: not implemented on this device + "UNUSED", // 38: not implemented on this device + "UNUSED", // 39: not implemented on this device + "UNUSED", // 40: not implemented on this device + "UNUSED", // 41: not implemented on this device + "UNUSED", // 42: not implemented on this device + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF", // 47: TC E0 Overflow + "TCE0_ERR", // 48: TC E0 Error + "TCE0_CCA", // 49: TC E0 Compare or Capture A + "TCE0_CCB", // 50: TC E0 Compare or Capture B + "TCE0_CCC", // 51: TC E0 Compare or Capture C + "TCE0_CCD", // 52: TC E0 Compare or Capture D + "UNUSED", // 53: not implemented on this device + "UNUSED", // 54: not implemented on this device + "UNUSED", // 55: not implemented on this device + "UNUSED", // 56: not implemented on this device + "UNUSED", // 57: not implemented on this device + "UNUSED", // 58: not implemented on this device + "UNUSED", // 59: not implemented on this device + "UNUSED", // 60: not implemented on this device + "UNUSED", // 61: not implemented on this device + "UNUSED", // 62: not implemented on this device + "UNUSED", // 63: not implemented on this device + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "ADCA_CH1", // 72: ADCA Interrupt 1 + "ADCA_CH2", // 73: ADCA Interrupt 2 + "ADCA_CH3", // 74: ADCA Interrupt 3 + "UNUSED", // 75: not implemented on this device + "UNUSED", // 76: not implemented on this device + "TCD0_OVF", // 77: TC D0 Overflow + "TCD0_ERR", // 78: TC D0 Error + "TCD0_CCA", // 79: TC D0 Compare or Capture A + "TCD0_CCB", // 80: TC D0 Compare or Capture B + "TCD0_CCC", // 81: TC D0 Compare or Capture C + "TCD0_CCD", // 82: TC D0 Compare or Capture D + "UNUSED", // 83: not implemented on this device + "UNUSED", // 84: not implemented on this device + "UNUSED", // 85: not implemented on this device + "UNUSED", // 86: not implemented on this device + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete +}; + +const char * const vtab_atxmega32e5[vts_atxmega32e5] = { // ATxmega32E5, ATxmega16E5, ATxmega8E5 + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTR_INT", // 2: External Interrupt PORT R + "EDMA_CH0", // 3: External DMA Channel 0 + "EDMA_CH1", // 4: External DMA Channel 1 + "EDMA_CH2", // 5: External DMA Channel 2 + "EDMA_CH3", // 6: External DMA Channel 3 + "RTC_OVF", // 7: RTC Overflow + "RTC_COMP", // 8: RTC Compare + "PORTC_INT", // 9: External Interrupt PORT C + "TWIC_TWIS", // 10: 2-Wire Interface C Periphery + "TWIC_TWIM", // 11: 2-Wire Interface C Controller + "TCC4_OVF", // 12: TC C4 Overflow + "TCC4_ERR", // 13: TC C4 Error + "TCC4_CCA", // 14: TC C4 Compare or Capture A + "TCC4_CCB", // 15: TC C4 Compare or Capture B + "TCC4_CCC", // 16: TC C4 Compare or Capture C + "TCC4_CCD", // 17: TC C4 Compare or Capture D + "TCC5_OVF", // 18: TC C5 Overflow + "TCC5_ERR", // 19: TC C5 Error + "TCC5_CCA", // 20: TC C5 Compare or Capture A + "TCC5_CCB", // 21: TC C5 Compare or Capture B + "SPIC_INT", // 22: SPI C Interrupt + "USARTC0_RXC", // 23: USARTC 0 Reception Complete + "USARTC0_DRE", // 24: USARTC 0 Data Register Empty + "USARTC0_TXC", // 25: USARTC 0 Transmission Complete + "NVM_EE", // 26: NVM EEPROM + "NVM_SPM", // 27: NVM SPM + "XCL_UNF", // 28: XMEGA Custom Logic Underflow + "XCL_CC", // 29: XMEGA Custom Logic Compare or Capture + "PORTA_INT", // 30: External Interrupt PORT A + "ACA_AC0", // 31: ACA AC 0 Interrupt + "ACA_AC1", // 32: ACA AC 1 Interrupt + "ACA_ACW", // 33: ACA AC Window Mode + "ADCA_CH0", // 34: ADCA Interrupt 0 + "PORTD_INT", // 35: External Interrupt PORT D + "TCD5_OVF", // 36: TC D5 Overflow + "TCD5_ERR", // 37: TC D5 Error + "TCD5_CCA", // 38: TC D5 Compare or Capture A + "TCD5_CCB", // 39: TC D5 Compare or Capture B + "USARTD0_RXC", // 40: USARTD 0 Reception Complete + "USARTD0_DRE", // 41: USARTD 0 Data Register Empty + "USARTD0_TXC", // 42: USARTD 0 Transmission Complete +}; + +const char * const vtab_atxmega128a1[vts_atxmega128a1] = { // ATxmega128A1, ATxmega64A1 + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "DMA_CH0", // 6: DMA Channel 0 + "DMA_CH1", // 7: DMA Channel 1 + "DMA_CH2", // 8: DMA Channel 2 + "DMA_CH3", // 9: DMA Channel 3 + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF", // 14: TC C0 Overflow + "TCC0_ERR", // 15: TC C0 Error + "TCC0_CCA", // 16: TC C0 Compare or Capture A + "TCC0_CCB", // 17: TC C0 Compare or Capture B + "TCC0_CCC", // 18: TC C0 Compare or Capture C + "TCC0_CCD", // 19: TC C0 Compare or Capture D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "USARTC1_RXC", // 28: USARTC 1 Reception Complete + "USARTC1_DRE", // 29: USARTC 1 Data Register Empty + "USARTC1_TXC", // 30: USARTC 1 Transmission Complete + "AES_INT", // 31: AES Interrupt + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "ACB_AC0", // 36: ACB AC 0 Interrupt + "ACB_AC1", // 37: ACB AC 1 Interrupt + "ACB_ACW", // 38: ACB AC Window Mode + "ADCB_CH0", // 39: ADCB Interrupt 0 + "ADCB_CH1", // 40: ADCB Interrupt 1 + "ADCB_CH2", // 41: ADCB Interrupt 2 + "ADCB_CH3", // 42: ADCB Interrupt 3 + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF", // 47: TC E0 Overflow + "TCE0_ERR", // 48: TC E0 Error + "TCE0_CCA", // 49: TC E0 Compare or Capture A + "TCE0_CCB", // 50: TC E0 Compare or Capture B + "TCE0_CCC", // 51: TC E0 Compare or Capture C + "TCE0_CCD", // 52: TC E0 Compare or Capture D + "TCE1_OVF", // 53: TC E1 Overflow + "TCE1_ERR", // 54: TC E1 Error + "TCE1_CCA", // 55: TC E1 Compare or Capture A + "TCE1_CCB", // 56: TC E1 Compare or Capture B + "SPIE_INT", // 57: SPI E Interrupt + "USARTE0_RXC", // 58: USARTE 0 Reception Complete + "USARTE0_DRE", // 59: USARTE 0 Data Register Empty + "USARTE0_TXC", // 60: USARTE 0 Transmission Complete + "USARTE1_RXC", // 61: USARTE 1 Reception Complete + "USARTE1_DRE", // 62: USARTE 1 Data Register Empty + "USARTE1_TXC", // 63: USARTE 1 Transmission Complete + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "ADCA_CH1", // 72: ADCA Interrupt 1 + "ADCA_CH2", // 73: ADCA Interrupt 2 + "ADCA_CH3", // 74: ADCA Interrupt 3 + "TWID_TWIS", // 75: 2-Wire Interface D Periphery + "TWID_TWIM", // 76: 2-Wire Interface D Controller + "TCD0_OVF", // 77: TC D0 Overflow + "TCD0_ERR", // 78: TC D0 Error + "TCD0_CCA", // 79: TC D0 Compare or Capture A + "TCD0_CCB", // 80: TC D0 Compare or Capture B + "TCD0_CCC", // 81: TC D0 Compare or Capture C + "TCD0_CCD", // 82: TC D0 Compare or Capture D + "TCD1_OVF", // 83: TC D1 Overflow + "TCD1_ERR", // 84: TC D1 Error + "TCD1_CCA", // 85: TC D1 Compare or Capture A + "TCD1_CCB", // 86: TC D1 Compare or Capture B + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete + "USARTD1_RXC", // 91: USARTD 1 Reception Complete + "USARTD1_DRE", // 92: USARTD 1 Data Register Empty + "USARTD1_TXC", // 93: USARTD 1 Transmission Complete + "PORTQ_INT0", // 94: External Interrupt 0 PORT Q + "PORTQ_INT1", // 95: External Interrupt 1 PORT Q + "PORTH_INT0", // 96: External Interrupt 0 PORT H + "PORTH_INT1", // 97: External Interrupt 1 PORT H + "PORTJ_INT0", // 98: External Interrupt 0 PORT J + "PORTJ_INT1", // 99: External Interrupt 1 PORT J + "PORTK_INT0", // 100: External Interrupt 0 PORT K + "PORTK_INT1", // 101: External Interrupt 1 PORT K + "UNUSED", // 102: not implemented on this device + "UNUSED", // 103: not implemented on this device + "PORTF_INT0", // 104: External Interrupt 0 PORT F + "PORTF_INT1", // 105: External Interrupt 1 PORT F + "TWIF_TWIS", // 106: 2-Wire Interface F Periphery + "TWIF_TWIM", // 107: 2-Wire Interface F Controller + "TCF0_OVF", // 108: TC F0 Overflow + "TCF0_ERR", // 109: TC F0 Error + "TCF0_CCA", // 110: TC F0 Compare or Capture A + "TCF0_CCB", // 111: TC F0 Compare or Capture B + "TCF0_CCC", // 112: TC F0 Compare or Capture C + "TCF0_CCD", // 113: TC F0 Compare or Capture D + "TCF1_OVF", // 114: TC F1 Overflow + "TCF1_ERR", // 115: TC F1 Error + "TCF1_CCA", // 116: TC F1 Compare or Capture A + "TCF1_CCB", // 117: TC F1 Compare or Capture B + "SPIF_INT", // 118: SPI F Interrupt + "USARTF0_RXC", // 119: USARTF 0 Reception Complete + "USARTF0_DRE", // 120: USARTF 0 Data Register Empty + "USARTF0_TXC", // 121: USARTF 0 Transmission Complete + "USARTF1_RXC", // 122: USARTF 1 Reception Complete + "USARTF1_DRE", // 123: USARTF 1 Data Register Empty + "USARTF1_TXC", // 124: USARTF 1 Transmission Complete +}; + +const char * const vtab_atxmega128a1u[vts_atxmega128a1u] = { // ATxmega128A1U, ATxmega64A1U + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "DMA_CH0", // 6: DMA Channel 0 + "DMA_CH1", // 7: DMA Channel 1 + "DMA_CH2", // 8: DMA Channel 2 + "DMA_CH3", // 9: DMA Channel 3 + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF/TCC2_LUNF", // 14: TC C0 Overflow/TC C2 Low Byte Underflow + "TCC0_ERR/TCC2_HUNF", // 15: TC C0 Error/TC C2 High Byte Underflow + "TCC0_CCA/TCC2_LCMPA", // 16: TC C0 Compare or Capture A/TC C2 Low Byte Compare A + "TCC0_CCB/TCC2_LCMPB", // 17: TC C0 Compare or Capture B/TC C2 Low Byte Compare B + "TCC0_CCC/TCC2_LCMPC", // 18: TC C0 Compare or Capture C/TC C2 Low Byte Compare C + "TCC0_CCD/TCC2_LCMPD", // 19: TC C0 Compare or Capture D/TC C2 Low Byte Compare D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "USARTC1_RXC", // 28: USARTC 1 Reception Complete + "USARTC1_DRE", // 29: USARTC 1 Data Register Empty + "USARTC1_TXC", // 30: USARTC 1 Transmission Complete + "AES_INT", // 31: AES Interrupt + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "ACB_AC0", // 36: ACB AC 0 Interrupt + "ACB_AC1", // 37: ACB AC 1 Interrupt + "ACB_ACW", // 38: ACB AC Window Mode + "ADCB_CH0", // 39: ADCB Interrupt 0 + "ADCB_CH1", // 40: ADCB Interrupt 1 + "ADCB_CH2", // 41: ADCB Interrupt 2 + "ADCB_CH3", // 42: ADCB Interrupt 3 + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF/TCE2_LUNF", // 47: TC E0 Overflow/TC E2 Low Byte Underflow + "TCE0_ERR/TCE2_HUNF", // 48: TC E0 Error/TC E2 High Byte Underflow + "TCE0_CCA/TCE2_LCMPA", // 49: TC E0 Compare or Capture A/TC E2 Low Byte Compare A + "TCE0_CCB/TCE2_LCMPB", // 50: TC E0 Compare or Capture B/TC E2 Low Byte Compare B + "TCE0_CCC/TCE2_LCMPC", // 51: TC E0 Compare or Capture C/TC E2 Low Byte Compare C + "TCE0_CCD/TCE2_LCMPD", // 52: TC E0 Compare or Capture D/TC E2 Low Byte Compare D + "TCE1_OVF", // 53: TC E1 Overflow + "TCE1_ERR", // 54: TC E1 Error + "TCE1_CCA", // 55: TC E1 Compare or Capture A + "TCE1_CCB", // 56: TC E1 Compare or Capture B + "SPIE_INT", // 57: SPI E Interrupt + "USARTE0_RXC", // 58: USARTE 0 Reception Complete + "USARTE0_DRE", // 59: USARTE 0 Data Register Empty + "USARTE0_TXC", // 60: USARTE 0 Transmission Complete + "USARTE1_RXC", // 61: USARTE 1 Reception Complete + "USARTE1_DRE", // 62: USARTE 1 Data Register Empty + "USARTE1_TXC", // 63: USARTE 1 Transmission Complete + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "ADCA_CH1", // 72: ADCA Interrupt 1 + "ADCA_CH2", // 73: ADCA Interrupt 2 + "ADCA_CH3", // 74: ADCA Interrupt 3 + "TWID_TWIS", // 75: 2-Wire Interface D Periphery + "TWID_TWIM", // 76: 2-Wire Interface D Controller + "TCD0_OVF/TCD2_LUNF", // 77: TC D0 Overflow/TC D2 Low Byte Underflow + "TCD0_ERR/TCD2_HUNF", // 78: TC D0 Error/TC D2 High Byte Underflow + "TCD0_CCA/TCD2_LCMPA", // 79: TC D0 Compare or Capture A/TC D2 Low Byte Compare A + "TCD0_CCB/TCD2_LCMPB", // 80: TC D0 Compare or Capture B/TC D2 Low Byte Compare B + "TCD0_CCC/TCD2_LCMPC", // 81: TC D0 Compare or Capture C/TC D2 Low Byte Compare C + "TCD0_CCD/TCD2_LCMPD", // 82: TC D0 Compare or Capture D/TC D2 Low Byte Compare D + "TCD1_OVF", // 83: TC D1 Overflow + "TCD1_ERR", // 84: TC D1 Error + "TCD1_CCA", // 85: TC D1 Compare or Capture A + "TCD1_CCB", // 86: TC D1 Compare or Capture B + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete + "USARTD1_RXC", // 91: USARTD 1 Reception Complete + "USARTD1_DRE", // 92: USARTD 1 Data Register Empty + "USARTD1_TXC", // 93: USARTD 1 Transmission Complete + "PORTQ_INT0", // 94: External Interrupt 0 PORT Q + "PORTQ_INT1", // 95: External Interrupt 1 PORT Q + "PORTH_INT0", // 96: External Interrupt 0 PORT H + "PORTH_INT1", // 97: External Interrupt 1 PORT H + "PORTJ_INT0", // 98: External Interrupt 0 PORT J + "PORTJ_INT1", // 99: External Interrupt 1 PORT J + "PORTK_INT0", // 100: External Interrupt 0 PORT K + "PORTK_INT1", // 101: External Interrupt 1 PORT K + "UNUSED", // 102: not implemented on this device + "UNUSED", // 103: not implemented on this device + "PORTF_INT0", // 104: External Interrupt 0 PORT F + "PORTF_INT1", // 105: External Interrupt 1 PORT F + "TWIF_TWIS", // 106: 2-Wire Interface F Periphery + "TWIF_TWIM", // 107: 2-Wire Interface F Controller + "TCF0_OVF/TCF2_LUNF", // 108: TC F0 Overflow/TC F2 Low Byte Underflow + "TCF0_ERR/TCF2_HUNF", // 109: TC F0 Error/TC F2 High Byte Underflow + "TCF0_CCA/TCF2_LCMPA", // 110: TC F0 Compare or Capture A/TC F2 Low Byte Compare A + "TCF0_CCB/TCF2_LCMPB", // 111: TC F0 Compare or Capture B/TC F2 Low Byte Compare B + "TCF0_CCC/TCF2_LCMPC", // 112: TC F0 Compare or Capture C/TC F2 Low Byte Compare C + "TCF0_CCD/TCF2_LCMPD", // 113: TC F0 Compare or Capture D/TC F2 Low Byte Compare D + "TCF1_OVF", // 114: TC F1 Overflow + "TCF1_ERR", // 115: TC F1 Error + "TCF1_CCA", // 116: TC F1 Compare or Capture A + "TCF1_CCB", // 117: TC F1 Compare or Capture B + "SPIF_INT", // 118: SPI F Interrupt + "USARTF0_RXC", // 119: USARTF 0 Reception Complete + "USARTF0_DRE", // 120: USARTF 0 Data Register Empty + "USARTF0_TXC", // 121: USARTF 0 Transmission Complete + "USARTF1_RXC", // 122: USARTF 1 Reception Complete + "USARTF1_DRE", // 123: USARTF 1 Data Register Empty + "USARTF1_TXC", // 124: USARTF 1 Transmission Complete + "USB_BUSEVENT", // 125: SOF, Suspend, Resume, Reset Bus Event Interrupts, CRC, Underflow, Overflow or Stall Error + "USB_TRNCOMPL", // 126: USB Transaction Complete +}; + +const char * const vtab_atxmega128b1[vts_atxmega128b1] = { // ATxmega128B1, ATxmega64B1 + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "DMA_CH0", // 6: DMA Channel 0 + "DMA_CH1", // 7: DMA Channel 1 + "UNUSED", // 8: not implemented on this device + "UNUSED", // 9: not implemented on this device + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF/TCC2_LUNF", // 14: TC C0 Overflow/TC C2 Low Byte Underflow + "TCC0_ERR/TCC2_HUNF", // 15: TC C0 Error/TC C2 High Byte Underflow + "TCC0_CCA/TCC2_LCMPA", // 16: TC C0 Compare or Capture A/TC C2 Low Byte Compare A + "TCC0_CCB/TCC2_LCMPB", // 17: TC C0 Compare or Capture B/TC C2 Low Byte Compare B + "TCC0_CCC/TCC2_LCMPC", // 18: TC C0 Compare or Capture C/TC C2 Low Byte Compare C + "TCC0_CCD/TCC2_LCMPD", // 19: TC C0 Compare or Capture D/TC C2 Low Byte Compare D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "UNUSED", // 28: not implemented on this device + "UNUSED", // 29: not implemented on this device + "UNUSED", // 30: not implemented on this device + "USB_BUSEVENT", // 31: SOF, Suspend, Resume, Reset Bus Event Interrupts, CRC, Underflow, Overflow or Stall Error + "USB_TRNCOMPL", // 32: USB Transaction Complete + "UNUSED", // 33: not implemented on this device + "UNUSED", // 34: not implemented on this device + "LCD_INT", // 35: LCD Interrupt + "AES_INT", // 36: AES Interrupt + "NVM_EE", // 37: NVM EEPROM + "NVM_SPM", // 38: NVM SPM + "PORTB_INT0", // 39: External Interrupt 0 PORT B + "PORTB_INT1", // 40: External Interrupt 1 PORT B + "ACB_AC0", // 41: ACB AC 0 Interrupt + "ACB_AC1", // 42: ACB AC 1 Interrupt + "ACB_ACW", // 43: ACB AC Window Mode + "ADCB_CH0", // 44: ADCB Interrupt 0 + "UNUSED", // 45: not implemented on this device + "UNUSED", // 46: not implemented on this device + "UNUSED", // 47: not implemented on this device + "PORTD_INT0", // 48: External Interrupt 0 PORT D + "PORTD_INT1", // 49: External Interrupt 1 PORT D + "PORTG_INT0", // 50: External Interrupt 0 PORT G + "PORTG_INT1", // 51: External Interrupt 1 PORT G + "PORTM_INT0", // 52: External Interrupt 0 PORT M + "PORTM_INT1", // 53: External Interrupt 1 PORT M + "PORTE_INT0", // 54: External Interrupt 0 PORT E + "PORTE_INT1", // 55: External Interrupt 1 PORT E + "UNUSED", // 56: not implemented on this device + "UNUSED", // 57: not implemented on this device + "TCE0_OVF/TCE2_LUNF", // 58: TC E0 Overflow/TC E2 Low Byte Underflow + "TCE0_ERR/TCE2_HUNF", // 59: TC E0 Error/TC E2 High Byte Underflow + "TCE0_CCA/TCE2_LCMPA", // 60: TC E0 Compare or Capture A/TC E2 Low Byte Compare A + "TCE0_CCB/TCE2_LCMPB", // 61: TC E0 Compare or Capture B/TC E2 Low Byte Compare B + "TCE0_CCC/TCE2_LCMPC", // 62: TC E0 Compare or Capture C/TC E2 Low Byte Compare C + "TCE0_CCD/TCE2_LCMPD", // 63: TC E0 Compare or Capture D/TC E2 Low Byte Compare D + "UNUSED", // 64: not implemented on this device + "UNUSED", // 65: not implemented on this device + "UNUSED", // 66: not implemented on this device + "UNUSED", // 67: not implemented on this device + "UNUSED", // 68: not implemented on this device + "USARTE0_RXC", // 69: USARTE 0 Reception Complete + "USARTE0_DRE", // 70: USARTE 0 Data Register Empty + "USARTE0_TXC", // 71: USARTE 0 Transmission Complete + "UNUSED", // 72: not implemented on this device + "UNUSED", // 73: not implemented on this device + "UNUSED", // 74: not implemented on this device + "PORTA_INT0", // 75: External Interrupt 0 PORT A + "PORTA_INT1", // 76: External Interrupt 1 PORT A + "ACA_AC0", // 77: ACA AC 0 Interrupt + "ACA_AC1", // 78: ACA AC 1 Interrupt + "ACA_ACW", // 79: ACA AC Window Mode + "ADCA_CH0", // 80: ADCA Interrupt 0 +}; + +const char * const vtab_atxmega128b3[vts_atxmega128b3] = { // ATxmega128B3, ATxmega64B3 + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "DMA_CH0", // 6: DMA Channel 0 + "DMA_CH1", // 7: DMA Channel 1 + "UNUSED", // 8: not implemented on this device + "UNUSED", // 9: not implemented on this device + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF/TCC2_LUNF", // 14: TC C0 Overflow/TC C2 Low Byte Underflow + "TCC0_ERR/TCC2_HUNF", // 15: TC C0 Error/TC C2 High Byte Underflow + "TCC0_CCA/TCC2_LCMPA", // 16: TC C0 Compare or Capture A/TC C2 Low Byte Compare A + "TCC0_CCB/TCC2_LCMPB", // 17: TC C0 Compare or Capture B/TC C2 Low Byte Compare B + "TCC0_CCC/TCC2_LCMPC", // 18: TC C0 Compare or Capture C/TC C2 Low Byte Compare C + "TCC0_CCD/TCC2_LCMPD", // 19: TC C0 Compare or Capture D/TC C2 Low Byte Compare D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "UNUSED", // 28: not implemented on this device + "UNUSED", // 29: not implemented on this device + "UNUSED", // 30: not implemented on this device + "USB_BUSEVENT", // 31: SOF, Suspend, Resume, Reset Bus Event Interrupts, CRC, Underflow, Overflow or Stall Error + "USB_TRNCOMPL", // 32: USB Transaction Complete + "UNUSED", // 33: not implemented on this device + "UNUSED", // 34: not implemented on this device + "LCD_INT", // 35: LCD Interrupt + "AES_INT", // 36: AES Interrupt + "NVM_EE", // 37: NVM EEPROM + "NVM_SPM", // 38: NVM SPM + "PORTB_INT0", // 39: External Interrupt 0 PORT B + "PORTB_INT1", // 40: External Interrupt 1 PORT B + "ACB_AC0", // 41: ACB AC 0 Interrupt + "ACB_AC1", // 42: ACB AC 1 Interrupt + "ACB_ACW", // 43: ACB AC Window Mode + "ADCB_CH0", // 44: ADCB Interrupt 0 + "UNUSED", // 45: not implemented on this device + "UNUSED", // 46: not implemented on this device + "UNUSED", // 47: not implemented on this device + "PORTD_INT0", // 48: External Interrupt 0 PORT D + "PORTD_INT1", // 49: External Interrupt 1 PORT D + "PORTG_INT0", // 50: External Interrupt 0 PORT G + "PORTG_INT1", // 51: External Interrupt 1 PORT G + "PORTM_INT0", // 52: External Interrupt 0 PORT M + "PORTM_INT1", // 53: External Interrupt 1 PORT M +}; + +const char * const vtab_atxmega128a4u[vts_atxmega128a4u] = { // ATxmega128A4U, ATxmega64A4U, ATxmega32A4U, ATxmega16A4U + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "DMA_CH0", // 6: DMA Channel 0 + "DMA_CH1", // 7: DMA Channel 1 + "DMA_CH2", // 8: DMA Channel 2 + "DMA_CH3", // 9: DMA Channel 3 + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF/TCC2_LUNF", // 14: TC C0 Overflow/TC C2 Low Byte Underflow + "TCC0_ERR/TCC2_HUNF", // 15: TC C0 Error/TC C2 High Byte Underflow + "TCC0_CCA/TCC2_LCMPA", // 16: TC C0 Compare or Capture A/TC C2 Low Byte Compare A + "TCC0_CCB/TCC2_LCMPB", // 17: TC C0 Compare or Capture B/TC C2 Low Byte Compare B + "TCC0_CCC/TCC2_LCMPC", // 18: TC C0 Compare or Capture C/TC C2 Low Byte Compare C + "TCC0_CCD/TCC2_LCMPD", // 19: TC C0 Compare or Capture D/TC C2 Low Byte Compare D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "USARTC1_RXC", // 28: USARTC 1 Reception Complete + "USARTC1_DRE", // 29: USARTC 1 Data Register Empty + "USARTC1_TXC", // 30: USARTC 1 Transmission Complete + "AES_INT", // 31: AES Interrupt + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "UNUSED", // 36: not implemented on this device + "UNUSED", // 37: not implemented on this device + "UNUSED", // 38: not implemented on this device + "UNUSED", // 39: not implemented on this device + "UNUSED", // 40: not implemented on this device + "UNUSED", // 41: not implemented on this device + "UNUSED", // 42: not implemented on this device + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF", // 47: TC E0 Overflow + "TCE0_ERR", // 48: TC E0 Error + "TCE0_CCA", // 49: TC E0 Compare or Capture A + "TCE0_CCB", // 50: TC E0 Compare or Capture B + "TCE0_CCC", // 51: TC E0 Compare or Capture C + "TCE0_CCD", // 52: TC E0 Compare or Capture D + "UNUSED", // 53: not implemented on this device + "UNUSED", // 54: not implemented on this device + "UNUSED", // 55: not implemented on this device + "UNUSED", // 56: not implemented on this device + "UNUSED", // 57: not implemented on this device + "USARTE0_RXC", // 58: USARTE 0 Reception Complete + "USARTE0_DRE", // 59: USARTE 0 Data Register Empty + "USARTE0_TXC", // 60: USARTE 0 Transmission Complete + "UNUSED", // 61: not implemented on this device + "UNUSED", // 62: not implemented on this device + "UNUSED", // 63: not implemented on this device + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "ADCA_CH1", // 72: ADCA Interrupt 1 + "ADCA_CH2", // 73: ADCA Interrupt 2 + "ADCA_CH3", // 74: ADCA Interrupt 3 + "UNUSED", // 75: not implemented on this device + "UNUSED", // 76: not implemented on this device + "TCD0_OVF/TCD2_LUNF", // 77: TC D0 Overflow/TC D2 Low Byte Underflow + "TCD0_ERR/TCD2_HUNF", // 78: TC D0 Error/TC D2 High Byte Underflow + "TCD0_CCA/TCD2_LCMPA", // 79: TC D0 Compare or Capture A/TC D2 Low Byte Compare A + "TCD0_CCB/TCD2_LCMPB", // 80: TC D0 Compare or Capture B/TC D2 Low Byte Compare B + "TCD0_CCC/TCD2_LCMPC", // 81: TC D0 Compare or Capture C/TC D2 Low Byte Compare C + "TCD0_CCD/TCD2_LCMPD", // 82: TC D0 Compare or Capture D/TC D2 Low Byte Compare D + "TCD1_OVF", // 83: TC D1 Overflow + "TCD1_ERR", // 84: TC D1 Error + "TCD1_CCA", // 85: TC D1 Compare or Capture A + "TCD1_CCB", // 86: TC D1 Compare or Capture B + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete + "USARTD1_RXC", // 91: USARTD 1 Reception Complete + "USARTD1_DRE", // 92: USARTD 1 Data Register Empty + "USARTD1_TXC", // 93: USARTD 1 Transmission Complete + "UNUSED", // 94: not implemented on this device + "UNUSED", // 95: not implemented on this device + "UNUSED", // 96: not implemented on this device + "UNUSED", // 97: not implemented on this device + "UNUSED", // 98: not implemented on this device + "UNUSED", // 99: not implemented on this device + "UNUSED", // 100: not implemented on this device + "UNUSED", // 101: not implemented on this device + "UNUSED", // 102: not implemented on this device + "UNUSED", // 103: not implemented on this device + "UNUSED", // 104: not implemented on this device + "UNUSED", // 105: not implemented on this device + "UNUSED", // 106: not implemented on this device + "UNUSED", // 107: not implemented on this device + "UNUSED", // 108: not implemented on this device + "UNUSED", // 109: not implemented on this device + "UNUSED", // 110: not implemented on this device + "UNUSED", // 111: not implemented on this device + "UNUSED", // 112: not implemented on this device + "UNUSED", // 113: not implemented on this device + "UNUSED", // 114: not implemented on this device + "UNUSED", // 115: not implemented on this device + "UNUSED", // 116: not implemented on this device + "UNUSED", // 117: not implemented on this device + "UNUSED", // 118: not implemented on this device + "UNUSED", // 119: not implemented on this device + "UNUSED", // 120: not implemented on this device + "UNUSED", // 121: not implemented on this device + "UNUSED", // 122: not implemented on this device + "UNUSED", // 123: not implemented on this device + "UNUSED", // 124: not implemented on this device + "USB_BUSEVENT", // 125: SOF, Suspend, Resume, Reset Bus Event Interrupts, CRC, Underflow, Overflow or Stall Error + "USB_TRNCOMPL", // 126: USB Transaction Complete +}; + +const char * const vtab_atxmega128d4[vts_atxmega128d4] = { // ATxmega128D4, ATxmega64D4 + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "UNUSED", // 6: not implemented on this device + "UNUSED", // 7: not implemented on this device + "UNUSED", // 8: not implemented on this device + "UNUSED", // 9: not implemented on this device + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF/TCC2_LUNF", // 14: TC C0 Overflow/TC C2 Low Byte Underflow + "TCC0_ERR/TCC2_HUNF", // 15: TC C0 Error/TC C2 High Byte Underflow + "TCC0_CCA/TCC2_LCMPA", // 16: TC C0 Compare or Capture A/TC C2 Low Byte Compare A + "TCC0_CCB/TCC2_LCMPB", // 17: TC C0 Compare or Capture B/TC C2 Low Byte Compare B + "TCC0_CCC/TCC2_LCMPC", // 18: TC C0 Compare or Capture C/TC C2 Low Byte Compare C + "TCC0_CCD/TCC2_LCMPD", // 19: TC C0 Compare or Capture D/TC C2 Low Byte Compare D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "UNUSED", // 28: not implemented on this device + "UNUSED", // 29: not implemented on this device + "UNUSED", // 30: not implemented on this device + "UNUSED", // 31: not implemented on this device + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "UNUSED", // 36: not implemented on this device + "UNUSED", // 37: not implemented on this device + "UNUSED", // 38: not implemented on this device + "UNUSED", // 39: not implemented on this device + "UNUSED", // 40: not implemented on this device + "UNUSED", // 41: not implemented on this device + "UNUSED", // 42: not implemented on this device + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF", // 47: TC E0 Overflow + "TCE0_ERR", // 48: TC E0 Error + "TCE0_CCA", // 49: TC E0 Compare or Capture A + "TCE0_CCB", // 50: TC E0 Compare or Capture B + "TCE0_CCC", // 51: TC E0 Compare or Capture C + "TCE0_CCD", // 52: TC E0 Compare or Capture D + "UNUSED", // 53: not implemented on this device + "UNUSED", // 54: not implemented on this device + "UNUSED", // 55: not implemented on this device + "UNUSED", // 56: not implemented on this device + "UNUSED", // 57: not implemented on this device + "USARTE0_RXC", // 58: USARTE 0 Reception Complete + "USARTE0_DRE", // 59: USARTE 0 Data Register Empty + "USARTE0_TXC", // 60: USARTE 0 Transmission Complete + "UNUSED", // 61: not implemented on this device + "UNUSED", // 62: not implemented on this device + "UNUSED", // 63: not implemented on this device + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "UNUSED", // 72: not implemented on this device + "UNUSED", // 73: not implemented on this device + "UNUSED", // 74: not implemented on this device + "UNUSED", // 75: not implemented on this device + "UNUSED", // 76: not implemented on this device + "TCD0_OVF/TCD2_LUNF", // 77: TC D0 Overflow/TC D2 Low Byte Underflow + "TCD0_ERR/TCD2_HUNF", // 78: TC D0 Error/TC D2 High Byte Underflow + "TCD0_CCA/TCD2_LCMPA", // 79: TC D0 Compare or Capture A/TC D2 Low Byte Compare A + "TCD0_CCB/TCD2_LCMPB", // 80: TC D0 Compare or Capture B/TC D2 Low Byte Compare B + "TCD0_CCC/TCD2_LCMPC", // 81: TC D0 Compare or Capture C/TC D2 Low Byte Compare C + "TCD0_CCD/TCD2_LCMPD", // 82: TC D0 Compare or Capture D/TC D2 Low Byte Compare D + "UNUSED", // 83: not implemented on this device + "UNUSED", // 84: not implemented on this device + "UNUSED", // 85: not implemented on this device + "UNUSED", // 86: not implemented on this device + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete +}; + +const char * const vtab_atxmega256a3[vts_atxmega256a3] = { // ATxmega256A3, ATxmega192A3, ATxmega128A3, ATxmega64A3 + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "DMA_CH0", // 6: DMA Channel 0 + "DMA_CH1", // 7: DMA Channel 1 + "DMA_CH2", // 8: DMA Channel 2 + "DMA_CH3", // 9: DMA Channel 3 + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF", // 14: TC C0 Overflow + "TCC0_ERR", // 15: TC C0 Error + "TCC0_CCA", // 16: TC C0 Compare or Capture A + "TCC0_CCB", // 17: TC C0 Compare or Capture B + "TCC0_CCC", // 18: TC C0 Compare or Capture C + "TCC0_CCD", // 19: TC C0 Compare or Capture D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "USARTC1_RXC", // 28: USARTC 1 Reception Complete + "USARTC1_DRE", // 29: USARTC 1 Data Register Empty + "USARTC1_TXC", // 30: USARTC 1 Transmission Complete + "AES_INT", // 31: AES Interrupt + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "ACB_AC0", // 36: ACB AC 0 Interrupt + "ACB_AC1", // 37: ACB AC 1 Interrupt + "ACB_ACW", // 38: ACB AC Window Mode + "ADCB_CH0", // 39: ADCB Interrupt 0 + "ADCB_CH1", // 40: ADCB Interrupt 1 + "ADCB_CH2", // 41: ADCB Interrupt 2 + "ADCB_CH3", // 42: ADCB Interrupt 3 + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF", // 47: TC E0 Overflow + "TCE0_ERR", // 48: TC E0 Error + "TCE0_CCA", // 49: TC E0 Compare or Capture A + "TCE0_CCB", // 50: TC E0 Compare or Capture B + "TCE0_CCC", // 51: TC E0 Compare or Capture C + "TCE0_CCD", // 52: TC E0 Compare or Capture D + "TCE1_OVF", // 53: TC E1 Overflow + "TCE1_ERR", // 54: TC E1 Error + "TCE1_CCA", // 55: TC E1 Compare or Capture A + "TCE1_CCB", // 56: TC E1 Compare or Capture B + "SPIE_INT", // 57: SPI E Interrupt + "USARTE0_RXC", // 58: USARTE 0 Reception Complete + "USARTE0_DRE", // 59: USARTE 0 Data Register Empty + "USARTE0_TXC", // 60: USARTE 0 Transmission Complete + "USARTE1_RXC", // 61: USARTE 1 Reception Complete + "USARTE1_DRE", // 62: USARTE 1 Data Register Empty + "USARTE1_TXC", // 63: USARTE 1 Transmission Complete + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "ADCA_CH1", // 72: ADCA Interrupt 1 + "ADCA_CH2", // 73: ADCA Interrupt 2 + "ADCA_CH3", // 74: ADCA Interrupt 3 + "UNUSED", // 75: not implemented on this device + "UNUSED", // 76: not implemented on this device + "TCD0_OVF", // 77: TC D0 Overflow + "TCD0_ERR", // 78: TC D0 Error + "TCD0_CCA", // 79: TC D0 Compare or Capture A + "TCD0_CCB", // 80: TC D0 Compare or Capture B + "TCD0_CCC", // 81: TC D0 Compare or Capture C + "TCD0_CCD", // 82: TC D0 Compare or Capture D + "TCD1_OVF", // 83: TC D1 Overflow + "TCD1_ERR", // 84: TC D1 Error + "TCD1_CCA", // 85: TC D1 Compare or Capture A + "TCD1_CCB", // 86: TC D1 Compare or Capture B + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete + "USARTD1_RXC", // 91: USARTD 1 Reception Complete + "USARTD1_DRE", // 92: USARTD 1 Data Register Empty + "USARTD1_TXC", // 93: USARTD 1 Transmission Complete + "UNUSED", // 94: not implemented on this device + "UNUSED", // 95: not implemented on this device + "UNUSED", // 96: not implemented on this device + "UNUSED", // 97: not implemented on this device + "UNUSED", // 98: not implemented on this device + "UNUSED", // 99: not implemented on this device + "UNUSED", // 100: not implemented on this device + "UNUSED", // 101: not implemented on this device + "UNUSED", // 102: not implemented on this device + "UNUSED", // 103: not implemented on this device + "PORTF_INT0", // 104: External Interrupt 0 PORT F + "PORTF_INT1", // 105: External Interrupt 1 PORT F + "UNUSED", // 106: not implemented on this device + "UNUSED", // 107: not implemented on this device + "TCF0_OVF", // 108: TC F0 Overflow + "TCF0_ERR", // 109: TC F0 Error + "TCF0_CCA", // 110: TC F0 Compare or Capture A + "TCF0_CCB", // 111: TC F0 Compare or Capture B + "TCF0_CCC", // 112: TC F0 Compare or Capture C + "TCF0_CCD", // 113: TC F0 Compare or Capture D + "UNUSED", // 114: not implemented on this device + "UNUSED", // 115: not implemented on this device + "UNUSED", // 116: not implemented on this device + "UNUSED", // 117: not implemented on this device + "UNUSED", // 118: not implemented on this device + "USARTF0_RXC", // 119: USARTF 0 Reception Complete + "USARTF0_DRE", // 120: USARTF 0 Data Register Empty + "USARTF0_TXC", // 121: USARTF 0 Transmission Complete +}; + +const char * const vtab_atxmega256a3b[vts_atxmega256a3b] = { // ATxmega256A3B + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "DMA_CH0", // 6: DMA Channel 0 + "DMA_CH1", // 7: DMA Channel 1 + "DMA_CH2", // 8: DMA Channel 2 + "DMA_CH3", // 9: DMA Channel 3 + "RTC32_OVF", // 10: RTC32 Overflow + "RTC32_COMP", // 11: RTC32 Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF", // 14: TC C0 Overflow + "TCC0_ERR", // 15: TC C0 Error + "TCC0_CCA", // 16: TC C0 Compare or Capture A + "TCC0_CCB", // 17: TC C0 Compare or Capture B + "TCC0_CCC", // 18: TC C0 Compare or Capture C + "TCC0_CCD", // 19: TC C0 Compare or Capture D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "USARTC1_RXC", // 28: USARTC 1 Reception Complete + "USARTC1_DRE", // 29: USARTC 1 Data Register Empty + "USARTC1_TXC", // 30: USARTC 1 Transmission Complete + "AES_INT", // 31: AES Interrupt + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "ACB_AC0", // 36: ACB AC 0 Interrupt + "ACB_AC1", // 37: ACB AC 1 Interrupt + "ACB_ACW", // 38: ACB AC Window Mode + "ADCB_CH0", // 39: ADCB Interrupt 0 + "ADCB_CH1", // 40: ADCB Interrupt 1 + "ADCB_CH2", // 41: ADCB Interrupt 2 + "ADCB_CH3", // 42: ADCB Interrupt 3 + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF", // 47: TC E0 Overflow + "TCE0_ERR", // 48: TC E0 Error + "TCE0_CCA", // 49: TC E0 Compare or Capture A + "TCE0_CCB", // 50: TC E0 Compare or Capture B + "TCE0_CCC", // 51: TC E0 Compare or Capture C + "TCE0_CCD", // 52: TC E0 Compare or Capture D + "TCE1_OVF", // 53: TC E1 Overflow + "TCE1_ERR", // 54: TC E1 Error + "TCE1_CCA", // 55: TC E1 Compare or Capture A + "TCE1_CCB", // 56: TC E1 Compare or Capture B + "UNUSED", // 57: not implemented on this device + "USARTE0_RXC", // 58: USARTE 0 Reception Complete + "USARTE0_DRE", // 59: USARTE 0 Data Register Empty + "USARTE0_TXC", // 60: USARTE 0 Transmission Complete + "UNUSED", // 61: not implemented on this device + "UNUSED", // 62: not implemented on this device + "UNUSED", // 63: not implemented on this device + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "ADCA_CH1", // 72: ADCA Interrupt 1 + "ADCA_CH2", // 73: ADCA Interrupt 2 + "ADCA_CH3", // 74: ADCA Interrupt 3 + "UNUSED", // 75: not implemented on this device + "UNUSED", // 76: not implemented on this device + "TCD0_OVF", // 77: TC D0 Overflow + "TCD0_ERR", // 78: TC D0 Error + "TCD0_CCA", // 79: TC D0 Compare or Capture A + "TCD0_CCB", // 80: TC D0 Compare or Capture B + "TCD0_CCC", // 81: TC D0 Compare or Capture C + "TCD0_CCD", // 82: TC D0 Compare or Capture D + "TCD1_OVF", // 83: TC D1 Overflow + "TCD1_ERR", // 84: TC D1 Error + "TCD1_CCA", // 85: TC D1 Compare or Capture A + "TCD1_CCB", // 86: TC D1 Compare or Capture B + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete + "USARTD1_RXC", // 91: USARTD 1 Reception Complete + "USARTD1_DRE", // 92: USARTD 1 Data Register Empty + "USARTD1_TXC", // 93: USARTD 1 Transmission Complete + "UNUSED", // 94: not implemented on this device + "UNUSED", // 95: not implemented on this device + "UNUSED", // 96: not implemented on this device + "UNUSED", // 97: not implemented on this device + "UNUSED", // 98: not implemented on this device + "UNUSED", // 99: not implemented on this device + "UNUSED", // 100: not implemented on this device + "UNUSED", // 101: not implemented on this device + "UNUSED", // 102: not implemented on this device + "UNUSED", // 103: not implemented on this device + "PORTF_INT0", // 104: External Interrupt 0 PORT F + "PORTF_INT1", // 105: External Interrupt 1 PORT F + "UNUSED", // 106: not implemented on this device + "UNUSED", // 107: not implemented on this device + "TCF0_OVF", // 108: TC F0 Overflow + "TCF0_ERR", // 109: TC F0 Error + "TCF0_CCA", // 110: TC F0 Compare or Capture A + "TCF0_CCB", // 111: TC F0 Compare or Capture B + "TCF0_CCC", // 112: TC F0 Compare or Capture C + "TCF0_CCD", // 113: TC F0 Compare or Capture D + "UNUSED", // 114: not implemented on this device + "UNUSED", // 115: not implemented on this device + "UNUSED", // 116: not implemented on this device + "UNUSED", // 117: not implemented on this device + "UNUSED", // 118: not implemented on this device + "USARTF0_RXC", // 119: USARTF 0 Reception Complete + "USARTF0_DRE", // 120: USARTF 0 Data Register Empty + "USARTF0_TXC", // 121: USARTF 0 Transmission Complete +}; + +const char * const vtab_atxmega256a3bu[vts_atxmega256a3bu] = { // ATxmega256A3BU + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "DMA_CH0", // 6: DMA Channel 0 + "DMA_CH1", // 7: DMA Channel 1 + "DMA_CH2", // 8: DMA Channel 2 + "DMA_CH3", // 9: DMA Channel 3 + "RTC32_OVF", // 10: RTC32 Overflow + "RTC32_COMP", // 11: RTC32 Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF/TCC2_LUNF", // 14: TC C0 Overflow/TC C2 Low Byte Underflow + "TCC0_ERR/TCC2_HUNF", // 15: TC C0 Error/TC C2 High Byte Underflow + "TCC0_CCA/TCC2_LCMPA", // 16: TC C0 Compare or Capture A/TC C2 Low Byte Compare A + "TCC0_CCB/TCC2_LCMPB", // 17: TC C0 Compare or Capture B/TC C2 Low Byte Compare B + "TCC0_CCC/TCC2_LCMPC", // 18: TC C0 Compare or Capture C/TC C2 Low Byte Compare C + "TCC0_CCD/TCC2_LCMPD", // 19: TC C0 Compare or Capture D/TC C2 Low Byte Compare D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "USARTC1_RXC", // 28: USARTC 1 Reception Complete + "USARTC1_DRE", // 29: USARTC 1 Data Register Empty + "USARTC1_TXC", // 30: USARTC 1 Transmission Complete + "AES_INT", // 31: AES Interrupt + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "ACB_AC0", // 36: ACB AC 0 Interrupt + "ACB_AC1", // 37: ACB AC 1 Interrupt + "ACB_ACW", // 38: ACB AC Window Mode + "ADCB_CH0", // 39: ADCB Interrupt 0 + "ADCB_CH1", // 40: ADCB Interrupt 1 + "ADCB_CH2", // 41: ADCB Interrupt 2 + "ADCB_CH3", // 42: ADCB Interrupt 3 + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF/TCE2_LUNF", // 47: TC E0 Overflow/TC E2 Low Byte Underflow + "TCE0_ERR/TCE2_HUNF", // 48: TC E0 Error/TC E2 High Byte Underflow + "TCE0_CCA/TCE2_LCMPA", // 49: TC E0 Compare or Capture A/TC E2 Low Byte Compare A + "TCE0_CCB/TCE2_LCMPB", // 50: TC E0 Compare or Capture B/TC E2 Low Byte Compare B + "TCE0_CCC/TCE2_LCMPC", // 51: TC E0 Compare or Capture C/TC E2 Low Byte Compare C + "TCE0_CCD/TCE2_LCMPD", // 52: TC E0 Compare or Capture D/TC E2 Low Byte Compare D + "TCE1_OVF", // 53: TC E1 Overflow + "TCE1_ERR", // 54: TC E1 Error + "TCE1_CCA", // 55: TC E1 Compare or Capture A + "TCE1_CCB", // 56: TC E1 Compare or Capture B + "UNUSED", // 57: not implemented on this device + "USARTE0_RXC", // 58: USARTE 0 Reception Complete + "USARTE0_DRE", // 59: USARTE 0 Data Register Empty + "USARTE0_TXC", // 60: USARTE 0 Transmission Complete + "UNUSED", // 61: not implemented on this device + "UNUSED", // 62: not implemented on this device + "UNUSED", // 63: not implemented on this device + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "ADCA_CH1", // 72: ADCA Interrupt 1 + "ADCA_CH2", // 73: ADCA Interrupt 2 + "ADCA_CH3", // 74: ADCA Interrupt 3 + "UNUSED", // 75: not implemented on this device + "UNUSED", // 76: not implemented on this device + "TCD0_OVF/TCD2_LUNF", // 77: TC D0 Overflow/TC D2 Low Byte Underflow + "TCD0_ERR/TCD2_HUNF", // 78: TC D0 Error/TC D2 High Byte Underflow + "TCD0_CCA/TCD2_LCMPA", // 79: TC D0 Compare or Capture A/TC D2 Low Byte Compare A + "TCD0_CCB/TCD2_LCMPB", // 80: TC D0 Compare or Capture B/TC D2 Low Byte Compare B + "TCD0_CCC/TCD2_LCMPC", // 81: TC D0 Compare or Capture C/TC D2 Low Byte Compare C + "TCD0_CCD/TCD2_LCMPD", // 82: TC D0 Compare or Capture D/TC D2 Low Byte Compare D + "TCD1_OVF", // 83: TC D1 Overflow + "TCD1_ERR", // 84: TC D1 Error + "TCD1_CCA", // 85: TC D1 Compare or Capture A + "TCD1_CCB", // 86: TC D1 Compare or Capture B + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete + "USARTD1_RXC", // 91: USARTD 1 Reception Complete + "USARTD1_DRE", // 92: USARTD 1 Data Register Empty + "USARTD1_TXC", // 93: USARTD 1 Transmission Complete + "UNUSED", // 94: not implemented on this device + "UNUSED", // 95: not implemented on this device + "UNUSED", // 96: not implemented on this device + "UNUSED", // 97: not implemented on this device + "UNUSED", // 98: not implemented on this device + "UNUSED", // 99: not implemented on this device + "UNUSED", // 100: not implemented on this device + "UNUSED", // 101: not implemented on this device + "UNUSED", // 102: not implemented on this device + "UNUSED", // 103: not implemented on this device + "PORTF_INT0", // 104: External Interrupt 0 PORT F + "PORTF_INT1", // 105: External Interrupt 1 PORT F + "UNUSED", // 106: not implemented on this device + "UNUSED", // 107: not implemented on this device + "TCF0_OVF/TCF2_LUNF", // 108: TC F0 Overflow/TC F2 Low Byte Underflow + "TCF0_ERR/TCF2_HUNF", // 109: TC F0 Error/TC F2 High Byte Underflow + "TCF0_CCA/TCF2_LCMPA", // 110: TC F0 Compare or Capture A/TC F2 Low Byte Compare A + "TCF0_CCB/TCF2_LCMPB", // 111: TC F0 Compare or Capture B/TC F2 Low Byte Compare B + "TCF0_CCC/TCF2_LCMPC", // 112: TC F0 Compare or Capture C/TC F2 Low Byte Compare C + "TCF0_CCD/TCF2_LCMPD", // 113: TC F0 Compare or Capture D/TC F2 Low Byte Compare D + "UNUSED", // 114: not implemented on this device + "UNUSED", // 115: not implemented on this device + "UNUSED", // 116: not implemented on this device + "UNUSED", // 117: not implemented on this device + "UNUSED", // 118: not implemented on this device + "USARTF0_RXC", // 119: USARTF 0 Reception Complete + "USARTF0_DRE", // 120: USARTF 0 Data Register Empty + "USARTF0_TXC", // 121: USARTF 0 Transmission Complete + "UNUSED", // 122: not implemented on this device + "UNUSED", // 123: not implemented on this device + "UNUSED", // 124: not implemented on this device + "USB_BUSEVENT", // 125: SOF, Suspend, Resume, Reset Bus Event Interrupts, CRC, Underflow, Overflow or Stall Error + "USB_TRNCOMPL", // 126: USB Transaction Complete +}; + +const char * const vtab_atxmega256a3u[vts_atxmega256a3u] = { // ATxmega256A3U, ATxmega192A3U, ATxmega128A3U, ATxmega64A3U + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "DMA_CH0", // 6: DMA Channel 0 + "DMA_CH1", // 7: DMA Channel 1 + "DMA_CH2", // 8: DMA Channel 2 + "DMA_CH3", // 9: DMA Channel 3 + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF/TCC2_LUNF", // 14: TC C0 Overflow/TC C2 Low Byte Underflow + "TCC0_ERR/TCC2_HUNF", // 15: TC C0 Error/TC C2 High Byte Underflow + "TCC0_CCA/TCC2_LCMPA", // 16: TC C0 Compare or Capture A/TC C2 Low Byte Compare A + "TCC0_CCB/TCC2_LCMPB", // 17: TC C0 Compare or Capture B/TC C2 Low Byte Compare B + "TCC0_CCC/TCC2_LCMPC", // 18: TC C0 Compare or Capture C/TC C2 Low Byte Compare C + "TCC0_CCD/TCC2_LCMPD", // 19: TC C0 Compare or Capture D/TC C2 Low Byte Compare D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "USARTC1_RXC", // 28: USARTC 1 Reception Complete + "USARTC1_DRE", // 29: USARTC 1 Data Register Empty + "USARTC1_TXC", // 30: USARTC 1 Transmission Complete + "AES_INT", // 31: AES Interrupt + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "ACB_AC0", // 36: ACB AC 0 Interrupt + "ACB_AC1", // 37: ACB AC 1 Interrupt + "ACB_ACW", // 38: ACB AC Window Mode + "ADCB_CH0", // 39: ADCB Interrupt 0 + "ADCB_CH1", // 40: ADCB Interrupt 1 + "ADCB_CH2", // 41: ADCB Interrupt 2 + "ADCB_CH3", // 42: ADCB Interrupt 3 + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF/TCE2_LUNF", // 47: TC E0 Overflow/TC E2 Low Byte Underflow + "TCE0_ERR/TCE2_HUNF", // 48: TC E0 Error/TC E2 High Byte Underflow + "TCE0_CCA/TCE2_LCMPA", // 49: TC E0 Compare or Capture A/TC E2 Low Byte Compare A + "TCE0_CCB/TCE2_LCMPB", // 50: TC E0 Compare or Capture B/TC E2 Low Byte Compare B + "TCE0_CCC/TCE2_LCMPC", // 51: TC E0 Compare or Capture C/TC E2 Low Byte Compare C + "TCE0_CCD/TCE2_LCMPD", // 52: TC E0 Compare or Capture D/TC E2 Low Byte Compare D + "TCE1_OVF", // 53: TC E1 Overflow + "TCE1_ERR", // 54: TC E1 Error + "TCE1_CCA", // 55: TC E1 Compare or Capture A + "TCE1_CCB", // 56: TC E1 Compare or Capture B + "SPIE_INT", // 57: SPI E Interrupt + "USARTE0_RXC", // 58: USARTE 0 Reception Complete + "USARTE0_DRE", // 59: USARTE 0 Data Register Empty + "USARTE0_TXC", // 60: USARTE 0 Transmission Complete + "USARTE1_RXC", // 61: USARTE 1 Reception Complete + "USARTE1_DRE", // 62: USARTE 1 Data Register Empty + "USARTE1_TXC", // 63: USARTE 1 Transmission Complete + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "ADCA_CH1", // 72: ADCA Interrupt 1 + "ADCA_CH2", // 73: ADCA Interrupt 2 + "ADCA_CH3", // 74: ADCA Interrupt 3 + "UNUSED", // 75: not implemented on this device + "UNUSED", // 76: not implemented on this device + "TCD0_OVF/TCD2_LUNF", // 77: TC D0 Overflow/TC D2 Low Byte Underflow + "TCD0_ERR/TCD2_HUNF", // 78: TC D0 Error/TC D2 High Byte Underflow + "TCD0_CCA/TCD2_LCMPA", // 79: TC D0 Compare or Capture A/TC D2 Low Byte Compare A + "TCD0_CCB/TCD2_LCMPB", // 80: TC D0 Compare or Capture B/TC D2 Low Byte Compare B + "TCD0_CCC/TCD2_LCMPC", // 81: TC D0 Compare or Capture C/TC D2 Low Byte Compare C + "TCD0_CCD/TCD2_LCMPD", // 82: TC D0 Compare or Capture D/TC D2 Low Byte Compare D + "TCD1_OVF", // 83: TC D1 Overflow + "TCD1_ERR", // 84: TC D1 Error + "TCD1_CCA", // 85: TC D1 Compare or Capture A + "TCD1_CCB", // 86: TC D1 Compare or Capture B + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete + "USARTD1_RXC", // 91: USARTD 1 Reception Complete + "USARTD1_DRE", // 92: USARTD 1 Data Register Empty + "USARTD1_TXC", // 93: USARTD 1 Transmission Complete + "UNUSED", // 94: not implemented on this device + "UNUSED", // 95: not implemented on this device + "UNUSED", // 96: not implemented on this device + "UNUSED", // 97: not implemented on this device + "UNUSED", // 98: not implemented on this device + "UNUSED", // 99: not implemented on this device + "UNUSED", // 100: not implemented on this device + "UNUSED", // 101: not implemented on this device + "UNUSED", // 102: not implemented on this device + "UNUSED", // 103: not implemented on this device + "PORTF_INT0", // 104: External Interrupt 0 PORT F + "PORTF_INT1", // 105: External Interrupt 1 PORT F + "UNUSED", // 106: not implemented on this device + "UNUSED", // 107: not implemented on this device + "TCF0_OVF/TCF2_LUNF", // 108: TC F0 Overflow/TC F2 Low Byte Underflow + "TCF0_ERR/TCF2_HUNF", // 109: TC F0 Error/TC F2 High Byte Underflow + "TCF0_CCA/TCF2_LCMPA", // 110: TC F0 Compare or Capture A/TC F2 Low Byte Compare A + "TCF0_CCB/TCF2_LCMPB", // 111: TC F0 Compare or Capture B/TC F2 Low Byte Compare B + "TCF0_CCC/TCF2_LCMPC", // 112: TC F0 Compare or Capture C/TC F2 Low Byte Compare C + "TCF0_CCD/TCF2_LCMPD", // 113: TC F0 Compare or Capture D/TC F2 Low Byte Compare D + "UNUSED", // 114: not implemented on this device + "UNUSED", // 115: not implemented on this device + "UNUSED", // 116: not implemented on this device + "UNUSED", // 117: not implemented on this device + "UNUSED", // 118: not implemented on this device + "USARTF0_RXC", // 119: USARTF 0 Reception Complete + "USARTF0_DRE", // 120: USARTF 0 Data Register Empty + "USARTF0_TXC", // 121: USARTF 0 Transmission Complete + "UNUSED", // 122: not implemented on this device + "UNUSED", // 123: not implemented on this device + "UNUSED", // 124: not implemented on this device + "USB_BUSEVENT", // 125: SOF, Suspend, Resume, Reset Bus Event Interrupts, CRC, Underflow, Overflow or Stall Error + "USB_TRNCOMPL", // 126: USB Transaction Complete +}; + +const char * const vtab_atxmega256c3[vts_atxmega256c3] = { // ATxmega256C3, ATxmega192C3, ATxmega128C3, ATxmega64C3, ATxmega32C3 + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "UNUSED", // 6: not implemented on this device + "UNUSED", // 7: not implemented on this device + "UNUSED", // 8: not implemented on this device + "UNUSED", // 9: not implemented on this device + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF/TCC2_LUNF", // 14: TC C0 Overflow/TC C2 Low Byte Underflow + "TCC0_ERR/TCC2_HUNF", // 15: TC C0 Error/TC C2 High Byte Underflow + "TCC0_CCA/TCC2_LCMPA", // 16: TC C0 Compare or Capture A/TC C2 Low Byte Compare A + "TCC0_CCB/TCC2_LCMPB", // 17: TC C0 Compare or Capture B/TC C2 Low Byte Compare B + "TCC0_CCC/TCC2_LCMPC", // 18: TC C0 Compare or Capture C/TC C2 Low Byte Compare C + "TCC0_CCD/TCC2_LCMPD", // 19: TC C0 Compare or Capture D/TC C2 Low Byte Compare D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "UNUSED", // 28: not implemented on this device + "UNUSED", // 29: not implemented on this device + "UNUSED", // 30: not implemented on this device + "UNUSED", // 31: not implemented on this device + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "UNUSED", // 36: not implemented on this device + "UNUSED", // 37: not implemented on this device + "UNUSED", // 38: not implemented on this device + "UNUSED", // 39: not implemented on this device + "UNUSED", // 40: not implemented on this device + "UNUSED", // 41: not implemented on this device + "UNUSED", // 42: not implemented on this device + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF/TCE2_LUNF", // 47: TC E0 Overflow/TC E2 Low Byte Underflow + "TCE0_ERR/TCE2_HUNF", // 48: TC E0 Error/TC E2 High Byte Underflow + "TCE0_CCA/TCE2_LCMPA", // 49: TC E0 Compare or Capture A/TC E2 Low Byte Compare A + "TCE0_CCB/TCE2_LCMPB", // 50: TC E0 Compare or Capture B/TC E2 Low Byte Compare B + "TCE0_CCC/TCE2_LCMPC", // 51: TC E0 Compare or Capture C/TC E2 Low Byte Compare C + "TCE0_CCD/TCE2_LCMPD", // 52: TC E0 Compare or Capture D/TC E2 Low Byte Compare D + "UNUSED", // 53: not implemented on this device + "UNUSED", // 54: not implemented on this device + "UNUSED", // 55: not implemented on this device + "UNUSED", // 56: not implemented on this device + "UNUSED", // 57: not implemented on this device + "USARTE0_RXC", // 58: USARTE 0 Reception Complete + "USARTE0_DRE", // 59: USARTE 0 Data Register Empty + "USARTE0_TXC", // 60: USARTE 0 Transmission Complete + "UNUSED", // 61: not implemented on this device + "UNUSED", // 62: not implemented on this device + "UNUSED", // 63: not implemented on this device + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "UNUSED", // 72: not implemented on this device + "UNUSED", // 73: not implemented on this device + "UNUSED", // 74: not implemented on this device + "UNUSED", // 75: not implemented on this device + "UNUSED", // 76: not implemented on this device + "TCD0_OVF/TCD2_LUNF", // 77: TC D0 Overflow/TC D2 Low Byte Underflow + "TCD0_ERR/TCD2_HUNF", // 78: TC D0 Error/TC D2 High Byte Underflow + "TCD0_CCA/TCD2_LCMPA", // 79: TC D0 Compare or Capture A/TC D2 Low Byte Compare A + "TCD0_CCB/TCD2_LCMPB", // 80: TC D0 Compare or Capture B/TC D2 Low Byte Compare B + "TCD0_CCC/TCD2_LCMPC", // 81: TC D0 Compare or Capture C/TC D2 Low Byte Compare C + "TCD0_CCD/TCD2_LCMPD", // 82: TC D0 Compare or Capture D/TC D2 Low Byte Compare D + "UNUSED", // 83: not implemented on this device + "UNUSED", // 84: not implemented on this device + "UNUSED", // 85: not implemented on this device + "UNUSED", // 86: not implemented on this device + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete + "UNUSED", // 91: not implemented on this device + "UNUSED", // 92: not implemented on this device + "UNUSED", // 93: not implemented on this device + "UNUSED", // 94: not implemented on this device + "UNUSED", // 95: not implemented on this device + "UNUSED", // 96: not implemented on this device + "UNUSED", // 97: not implemented on this device + "UNUSED", // 98: not implemented on this device + "UNUSED", // 99: not implemented on this device + "UNUSED", // 100: not implemented on this device + "UNUSED", // 101: not implemented on this device + "UNUSED", // 102: not implemented on this device + "UNUSED", // 103: not implemented on this device + "PORTF_INT0", // 104: External Interrupt 0 PORT F + "PORTF_INT1", // 105: External Interrupt 1 PORT F + "UNUSED", // 106: not implemented on this device + "UNUSED", // 107: not implemented on this device + "TCF0_OVF/TCF2_LUNF", // 108: TC F0 Overflow/TC F2 Low Byte Underflow + "TCF0_ERR/TCF2_HUNF", // 109: TC F0 Error/TC F2 High Byte Underflow + "TCF0_CCA/TCF2_LCMPA", // 110: TC F0 Compare or Capture A/TC F2 Low Byte Compare A + "TCF0_CCB/TCF2_LCMPB", // 111: TC F0 Compare or Capture B/TC F2 Low Byte Compare B + "TCF0_CCC/TCF2_LCMPC", // 112: TC F0 Compare or Capture C/TC F2 Low Byte Compare C + "TCF0_CCD/TCF2_LCMPD", // 113: TC F0 Compare or Capture D/TC F2 Low Byte Compare D + "UNUSED", // 114: not implemented on this device + "UNUSED", // 115: not implemented on this device + "UNUSED", // 116: not implemented on this device + "UNUSED", // 117: not implemented on this device + "UNUSED", // 118: not implemented on this device + "UNUSED", // 119: not implemented on this device + "UNUSED", // 120: not implemented on this device + "UNUSED", // 121: not implemented on this device + "UNUSED", // 122: not implemented on this device + "UNUSED", // 123: not implemented on this device + "UNUSED", // 124: not implemented on this device + "USB_BUSEVENT", // 125: SOF, Suspend, Resume, Reset Bus Event Interrupts, CRC, Underflow, Overflow or Stall Error + "USB_TRNCOMPL", // 126: USB Transaction Complete +}; + +const char * const vtab_atxmega384c3[vts_atxmega384c3] = { // ATxmega384C3 + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "DMA_CH0", // 6: DMA Channel 0 + "DMA_CH1", // 7: DMA Channel 1 + "UNUSED", // 8: not implemented on this device + "UNUSED", // 9: not implemented on this device + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF/TCC2_LUNF", // 14: TC C0 Overflow/TC C2 Low Byte Underflow + "TCC0_ERR/TCC2_HUNF", // 15: TC C0 Error/TC C2 High Byte Underflow + "TCC0_CCA/TCC2_LCMPA", // 16: TC C0 Compare or Capture A/TC C2 Low Byte Compare A + "TCC0_CCB/TCC2_LCMPB", // 17: TC C0 Compare or Capture B/TC C2 Low Byte Compare B + "TCC0_CCC/TCC2_LCMPC", // 18: TC C0 Compare or Capture C/TC C2 Low Byte Compare C + "TCC0_CCD/TCC2_LCMPD", // 19: TC C0 Compare or Capture D/TC C2 Low Byte Compare D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "USARTC1_RXC", // 28: USARTC 1 Reception Complete + "USARTC1_DRE", // 29: USARTC 1 Data Register Empty + "USARTC1_TXC", // 30: USARTC 1 Transmission Complete + "AES_INT", // 31: AES Interrupt + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "UNUSED", // 36: not implemented on this device + "UNUSED", // 37: not implemented on this device + "UNUSED", // 38: not implemented on this device + "UNUSED", // 39: not implemented on this device + "UNUSED", // 40: not implemented on this device + "UNUSED", // 41: not implemented on this device + "UNUSED", // 42: not implemented on this device + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF/TCE2_LUNF", // 47: TC E0 Overflow/TC E2 Low Byte Underflow + "TCE0_ERR/TCE2_HUNF", // 48: TC E0 Error/TC E2 High Byte Underflow + "TCE0_CCA/TCE2_LCMPA", // 49: TC E0 Compare or Capture A/TC E2 Low Byte Compare A + "TCE0_CCB/TCE2_LCMPB", // 50: TC E0 Compare or Capture B/TC E2 Low Byte Compare B + "TCE0_CCC/TCE2_LCMPC", // 51: TC E0 Compare or Capture C/TC E2 Low Byte Compare C + "TCE0_CCD/TCE2_LCMPD", // 52: TC E0 Compare or Capture D/TC E2 Low Byte Compare D + "UNUSED", // 53: not implemented on this device + "UNUSED", // 54: not implemented on this device + "UNUSED", // 55: not implemented on this device + "UNUSED", // 56: not implemented on this device + "UNUSED", // 57: not implemented on this device + "USARTE0_RXC", // 58: USARTE 0 Reception Complete + "USARTE0_DRE", // 59: USARTE 0 Data Register Empty + "USARTE0_TXC", // 60: USARTE 0 Transmission Complete + "UNUSED", // 61: not implemented on this device + "UNUSED", // 62: not implemented on this device + "UNUSED", // 63: not implemented on this device + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "UNUSED", // 72: not implemented on this device + "UNUSED", // 73: not implemented on this device + "UNUSED", // 74: not implemented on this device + "UNUSED", // 75: not implemented on this device + "UNUSED", // 76: not implemented on this device + "TCD0_OVF/TCD2_LUNF", // 77: TC D0 Overflow/TC D2 Low Byte Underflow + "TCD0_ERR/TCD2_HUNF", // 78: TC D0 Error/TC D2 High Byte Underflow + "TCD0_CCA/TCD2_LCMPA", // 79: TC D0 Compare or Capture A/TC D2 Low Byte Compare A + "TCD0_CCB/TCD2_LCMPB", // 80: TC D0 Compare or Capture B/TC D2 Low Byte Compare B + "TCD0_CCC/TCD2_LCMPC", // 81: TC D0 Compare or Capture C/TC D2 Low Byte Compare C + "TCD0_CCD/TCD2_LCMPD", // 82: TC D0 Compare or Capture D/TC D2 Low Byte Compare D + "UNUSED", // 83: not implemented on this device + "UNUSED", // 84: not implemented on this device + "UNUSED", // 85: not implemented on this device + "UNUSED", // 86: not implemented on this device + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete + "UNUSED", // 91: not implemented on this device + "UNUSED", // 92: not implemented on this device + "UNUSED", // 93: not implemented on this device + "UNUSED", // 94: not implemented on this device + "UNUSED", // 95: not implemented on this device + "UNUSED", // 96: not implemented on this device + "UNUSED", // 97: not implemented on this device + "UNUSED", // 98: not implemented on this device + "UNUSED", // 99: not implemented on this device + "UNUSED", // 100: not implemented on this device + "UNUSED", // 101: not implemented on this device + "UNUSED", // 102: not implemented on this device + "UNUSED", // 103: not implemented on this device + "PORTF_INT0", // 104: External Interrupt 0 PORT F + "PORTF_INT1", // 105: External Interrupt 1 PORT F + "UNUSED", // 106: not implemented on this device + "UNUSED", // 107: not implemented on this device + "TCF0_OVF/TCF2_LUNF", // 108: TC F0 Overflow/TC F2 Low Byte Underflow + "TCF0_ERR/TCF2_HUNF", // 109: TC F0 Error/TC F2 High Byte Underflow + "TCF0_CCA/TCF2_LCMPA", // 110: TC F0 Compare or Capture A/TC F2 Low Byte Compare A + "TCF0_CCB/TCF2_LCMPB", // 111: TC F0 Compare or Capture B/TC F2 Low Byte Compare B + "TCF0_CCC/TCF2_LCMPC", // 112: TC F0 Compare or Capture C/TC F2 Low Byte Compare C + "TCF0_CCD/TCF2_LCMPD", // 113: TC F0 Compare or Capture D/TC F2 Low Byte Compare D + "UNUSED", // 114: not implemented on this device + "UNUSED", // 115: not implemented on this device + "UNUSED", // 116: not implemented on this device + "UNUSED", // 117: not implemented on this device + "UNUSED", // 118: not implemented on this device + "UNUSED", // 119: not implemented on this device + "UNUSED", // 120: not implemented on this device + "UNUSED", // 121: not implemented on this device + "UNUSED", // 122: not implemented on this device + "UNUSED", // 123: not implemented on this device + "UNUSED", // 124: not implemented on this device + "USB_BUSEVENT", // 125: SOF, Suspend, Resume, Reset Bus Event Interrupts, CRC, Underflow, Overflow or Stall Error + "USB_TRNCOMPL", // 126: USB Transaction Complete +}; + +const char * const vtab_atxmega384d3[vts_atxmega384d3] = { // ATxmega384D3, ATxmega256D3, ATxmega192D3, ATxmega128D3, ATxmega64D3, ATxmega32D3 + "RESET", // 0: Reset (various reasons) + "OSC_OSCF", // 1: Oscillator Failure NMI + "PORTC_INT0", // 2: External Interrupt 0 PORT C + "PORTC_INT1", // 3: External Interrupt 1 PORT C + "PORTR_INT0", // 4: External Interrupt 0 PORT R + "PORTR_INT1", // 5: External Interrupt 1 PORT R + "UNUSED", // 6: not implemented on this device + "UNUSED", // 7: not implemented on this device + "UNUSED", // 8: not implemented on this device + "UNUSED", // 9: not implemented on this device + "RTC_OVF", // 10: RTC Overflow + "RTC_COMP", // 11: RTC Compare + "TWIC_TWIS", // 12: 2-Wire Interface C Periphery + "TWIC_TWIM", // 13: 2-Wire Interface C Controller + "TCC0_OVF/TCC2_LUNF", // 14: TC C0 Overflow/TC C2 Low Byte Underflow + "TCC0_ERR/TCC2_HUNF", // 15: TC C0 Error/TC C2 High Byte Underflow + "TCC0_CCA/TCC2_LCMPA", // 16: TC C0 Compare or Capture A/TC C2 Low Byte Compare A + "TCC0_CCB/TCC2_LCMPB", // 17: TC C0 Compare or Capture B/TC C2 Low Byte Compare B + "TCC0_CCC/TCC2_LCMPC", // 18: TC C0 Compare or Capture C/TC C2 Low Byte Compare C + "TCC0_CCD/TCC2_LCMPD", // 19: TC C0 Compare or Capture D/TC C2 Low Byte Compare D + "TCC1_OVF", // 20: TC C1 Overflow + "TCC1_ERR", // 21: TC C1 Error + "TCC1_CCA", // 22: TC C1 Compare or Capture A + "TCC1_CCB", // 23: TC C1 Compare or Capture B + "SPIC_INT", // 24: SPI C Interrupt + "USARTC0_RXC", // 25: USARTC 0 Reception Complete + "USARTC0_DRE", // 26: USARTC 0 Data Register Empty + "USARTC0_TXC", // 27: USARTC 0 Transmission Complete + "UNUSED", // 28: not implemented on this device + "UNUSED", // 29: not implemented on this device + "UNUSED", // 30: not implemented on this device + "UNUSED", // 31: not implemented on this device + "NVM_EE", // 32: NVM EEPROM + "NVM_SPM", // 33: NVM SPM + "PORTB_INT0", // 34: External Interrupt 0 PORT B + "PORTB_INT1", // 35: External Interrupt 1 PORT B + "UNUSED", // 36: not implemented on this device + "UNUSED", // 37: not implemented on this device + "UNUSED", // 38: not implemented on this device + "UNUSED", // 39: not implemented on this device + "UNUSED", // 40: not implemented on this device + "UNUSED", // 41: not implemented on this device + "UNUSED", // 42: not implemented on this device + "PORTE_INT0", // 43: External Interrupt 0 PORT E + "PORTE_INT1", // 44: External Interrupt 1 PORT E + "TWIE_TWIS", // 45: 2-Wire Interface E Periphery + "TWIE_TWIM", // 46: 2-Wire Interface E Controller + "TCE0_OVF/TCE2_LUNF", // 47: TC E0 Overflow/TC E2 Low Byte Underflow + "TCE0_ERR/TCE2_HUNF", // 48: TC E0 Error/TC E2 High Byte Underflow + "TCE0_CCA/TCE2_LCMPA", // 49: TC E0 Compare or Capture A/TC E2 Low Byte Compare A + "TCE0_CCB/TCE2_LCMPB", // 50: TC E0 Compare or Capture B/TC E2 Low Byte Compare B + "TCE0_CCC/TCE2_LCMPC", // 51: TC E0 Compare or Capture C/TC E2 Low Byte Compare C + "TCE0_CCD/TCE2_LCMPD", // 52: TC E0 Compare or Capture D/TC E2 Low Byte Compare D + "UNUSED", // 53: not implemented on this device + "UNUSED", // 54: not implemented on this device + "UNUSED", // 55: not implemented on this device + "UNUSED", // 56: not implemented on this device + "UNUSED", // 57: not implemented on this device + "USARTE0_RXC", // 58: USARTE 0 Reception Complete + "USARTE0_DRE", // 59: USARTE 0 Data Register Empty + "USARTE0_TXC", // 60: USARTE 0 Transmission Complete + "UNUSED", // 61: not implemented on this device + "UNUSED", // 62: not implemented on this device + "UNUSED", // 63: not implemented on this device + "PORTD_INT0", // 64: External Interrupt 0 PORT D + "PORTD_INT1", // 65: External Interrupt 1 PORT D + "PORTA_INT0", // 66: External Interrupt 0 PORT A + "PORTA_INT1", // 67: External Interrupt 1 PORT A + "ACA_AC0", // 68: ACA AC 0 Interrupt + "ACA_AC1", // 69: ACA AC 1 Interrupt + "ACA_ACW", // 70: ACA AC Window Mode + "ADCA_CH0", // 71: ADCA Interrupt 0 + "UNUSED", // 72: not implemented on this device + "UNUSED", // 73: not implemented on this device + "UNUSED", // 74: not implemented on this device + "UNUSED", // 75: not implemented on this device + "UNUSED", // 76: not implemented on this device + "TCD0_OVF/TCD2_LUNF", // 77: TC D0 Overflow/TC D2 Low Byte Underflow + "TCD0_ERR/TCD2_HUNF", // 78: TC D0 Error/TC D2 High Byte Underflow + "TCD0_CCA/TCD2_LCMPA", // 79: TC D0 Compare or Capture A/TC D2 Low Byte Compare A + "TCD0_CCB/TCD2_LCMPB", // 80: TC D0 Compare or Capture B/TC D2 Low Byte Compare B + "TCD0_CCC/TCD2_LCMPC", // 81: TC D0 Compare or Capture C/TC D2 Low Byte Compare C + "TCD0_CCD/TCD2_LCMPD", // 82: TC D0 Compare or Capture D/TC D2 Low Byte Compare D + "UNUSED", // 83: not implemented on this device + "UNUSED", // 84: not implemented on this device + "UNUSED", // 85: not implemented on this device + "UNUSED", // 86: not implemented on this device + "SPID_INT", // 87: SPI D Interrupt + "USARTD0_RXC", // 88: USARTD 0 Reception Complete + "USARTD0_DRE", // 89: USARTD 0 Data Register Empty + "USARTD0_TXC", // 90: USARTD 0 Transmission Complete + "UNUSED", // 91: not implemented on this device + "UNUSED", // 92: not implemented on this device + "UNUSED", // 93: not implemented on this device + "UNUSED", // 94: not implemented on this device + "UNUSED", // 95: not implemented on this device + "UNUSED", // 96: not implemented on this device + "UNUSED", // 97: not implemented on this device + "UNUSED", // 98: not implemented on this device + "UNUSED", // 99: not implemented on this device + "UNUSED", // 100: not implemented on this device + "UNUSED", // 101: not implemented on this device + "UNUSED", // 102: not implemented on this device + "UNUSED", // 103: not implemented on this device + "PORTF_INT0", // 104: External Interrupt 0 PORT F + "PORTF_INT1", // 105: External Interrupt 1 PORT F + "UNUSED", // 106: not implemented on this device + "UNUSED", // 107: not implemented on this device + "TCF0_OVF/TCF2_LUNF", // 108: TC F0 Overflow/TC F2 Low Byte Underflow + "TCF0_ERR/TCF2_HUNF", // 109: TC F0 Error/TC F2 High Byte Underflow + "TCF0_CCA/TCF2_LCMPA", // 110: TC F0 Compare or Capture A/TC F2 Low Byte Compare A + "TCF0_CCB/TCF2_LCMPB", // 111: TC F0 Compare or Capture B/TC F2 Low Byte Compare B + "TCF0_CCC/TCF2_LCMPC", // 112: TC F0 Compare or Capture C/TC F2 Low Byte Compare C + "TCF0_CCD/TCF2_LCMPD", // 113: TC F0 Compare or Capture D/TC F2 Low Byte Compare D +}; + +const char * const vtab_attiny402[vts_attiny402] = { // ATtiny402, ATtiny202 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "PORTA_PORT", // 3: Interrupt PORT A + "UNUSED", // 4: not implemented on this device + "UNUSED", // 5: not implemented on this device + "RTC_CNT", // 6: RTC Counter Interrupt + "RTC_PIT", // 7: RTC Periodic Interrupt Timer + "TCA0_LUNF/TCA0_OVF", // 8: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 10: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 11: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 12: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "UNUSED", // 14: not implemented on this device + "UNUSED", // 15: not implemented on this device + "AC0_AC", // 16: AC0 AC Interrupt + "ADC0_RESRDY", // 17: ADC 0 Result Ready + "ADC0_WCOMP", // 18: ADC 0 Window Comparator + "TWI0_TWIS", // 19: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 20: 2-Wire Interface 0 Controller + "SPI0_INT", // 21: SPI 0 Interrupt + "USART0_RXC", // 22: USART 0 Receive Complete + "USART0_DRE", // 23: USART 0 Data Register Empty + "USART0_TXC", // 24: USART 0 Transmit Complete + "NVMCTRL_EE", // 25: NVM EEPROM +}; + +const char * const vtab_attiny404[vts_attiny404] = { // ATtiny404, ATtiny204 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "PORTA_PORT", // 3: Interrupt PORT A + "PORTB_PORT", // 4: Interrupt PORT B + "UNUSED", // 5: not implemented on this device + "RTC_CNT", // 6: RTC Counter Interrupt + "RTC_PIT", // 7: RTC Periodic Interrupt Timer + "TCA0_LUNF/TCA0_OVF", // 8: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 10: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 11: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 12: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "UNUSED", // 14: not implemented on this device + "UNUSED", // 15: not implemented on this device + "AC0_AC", // 16: AC0 AC Interrupt + "ADC0_RESRDY", // 17: ADC 0 Result Ready + "ADC0_WCOMP", // 18: ADC 0 Window Comparator + "TWI0_TWIS", // 19: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 20: 2-Wire Interface 0 Controller + "SPI0_INT", // 21: SPI 0 Interrupt + "USART0_RXC", // 22: USART 0 Receive Complete + "USART0_DRE", // 23: USART 0 Data Register Empty + "USART0_TXC", // 24: USART 0 Transmit Complete + "NVMCTRL_EE", // 25: NVM EEPROM +}; + +const char * const vtab_attiny406[vts_attiny406] = { // ATtiny406 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "PORTA_PORT", // 3: Interrupt PORT A + "PORTB_PORT", // 4: Interrupt PORT B + "PORTC_PORT", // 5: Interrupt PORT C + "RTC_CNT", // 6: RTC Counter Interrupt + "RTC_PIT", // 7: RTC Periodic Interrupt Timer + "TCA0_LUNF/TCA0_OVF", // 8: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 10: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 11: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 12: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "UNUSED", // 14: not implemented on this device + "UNUSED", // 15: not implemented on this device + "AC0_AC", // 16: AC0 AC Interrupt + "ADC0_RESRDY", // 17: ADC 0 Result Ready + "ADC0_WCOMP", // 18: ADC 0 Window Comparator + "TWI0_TWIS", // 19: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 20: 2-Wire Interface 0 Controller + "SPI0_INT", // 21: SPI 0 Interrupt + "USART0_RXC", // 22: USART 0 Receive Complete + "USART0_DRE", // 23: USART 0 Data Register Empty + "USART0_TXC", // 24: USART 0 Transmit Complete + "NVMCTRL_EE", // 25: NVM EEPROM +}; + +const char * const vtab_attiny412[vts_attiny412] = { // ATtiny412, ATtiny212 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "PORTA_PORT", // 3: Interrupt PORT A + "UNUSED", // 4: not implemented on this device + "UNUSED", // 5: not implemented on this device + "RTC_CNT", // 6: RTC Counter Interrupt + "RTC_PIT", // 7: RTC Periodic Interrupt Timer + "TCA0_LUNF/TCA0_OVF", // 8: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 10: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 11: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 12: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "TCD0_OVF", // 14: TC D0 Overflow + "TCD0_TRIG", // 15: TC D0 Trigger + "AC0_AC", // 16: AC0 AC Interrupt + "ADC0_RESRDY", // 17: ADC 0 Result Ready + "ADC0_WCOMP", // 18: ADC 0 Window Comparator + "TWI0_TWIS", // 19: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 20: 2-Wire Interface 0 Controller + "SPI0_INT", // 21: SPI 0 Interrupt + "USART0_RXC", // 22: USART 0 Receive Complete + "USART0_DRE", // 23: USART 0 Data Register Empty + "USART0_TXC", // 24: USART 0 Transmit Complete + "NVMCTRL_EE", // 25: NVM EEPROM +}; + +const char * const vtab_attiny814[vts_attiny814] = { // ATtiny814, ATtiny414, ATtiny214 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "PORTA_PORT", // 3: Interrupt PORT A + "PORTB_PORT", // 4: Interrupt PORT B + "UNUSED", // 5: not implemented on this device + "RTC_CNT", // 6: RTC Counter Interrupt + "RTC_PIT", // 7: RTC Periodic Interrupt Timer + "TCA0_LUNF/TCA0_OVF", // 8: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 10: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 11: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 12: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "TCD0_OVF", // 14: TC D0 Overflow + "TCD0_TRIG", // 15: TC D0 Trigger + "AC0_AC", // 16: AC0 AC Interrupt + "ADC0_RESRDY", // 17: ADC 0 Result Ready + "ADC0_WCOMP", // 18: ADC 0 Window Comparator + "TWI0_TWIS", // 19: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 20: 2-Wire Interface 0 Controller + "SPI0_INT", // 21: SPI 0 Interrupt + "USART0_RXC", // 22: USART 0 Receive Complete + "USART0_DRE", // 23: USART 0 Data Register Empty + "USART0_TXC", // 24: USART 0 Transmit Complete + "NVMCTRL_EE", // 25: NVM EEPROM +}; + +const char * const vtab_attiny817[vts_attiny817] = { // ATtiny817, ATtiny816, ATtiny417, ATtiny416auto, ATtiny416 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "PORTA_PORT", // 3: Interrupt PORT A + "PORTB_PORT", // 4: Interrupt PORT B + "PORTC_PORT", // 5: Interrupt PORT C + "RTC_CNT", // 6: RTC Counter Interrupt + "RTC_PIT", // 7: RTC Periodic Interrupt Timer + "TCA0_LUNF/TCA0_OVF", // 8: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 10: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 11: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 12: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "TCD0_OVF", // 14: TC D0 Overflow + "TCD0_TRIG", // 15: TC D0 Trigger + "AC0_AC", // 16: AC0 AC Interrupt + "ADC0_RESRDY", // 17: ADC 0 Result Ready + "ADC0_WCOMP", // 18: ADC 0 Window Comparator + "TWI0_TWIS", // 19: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 20: 2-Wire Interface 0 Controller + "SPI0_INT", // 21: SPI 0 Interrupt + "USART0_RXC", // 22: USART 0 Receive Complete + "USART0_DRE", // 23: USART 0 Data Register Empty + "USART0_TXC", // 24: USART 0 Transmit Complete + "NVMCTRL_EE", // 25: NVM EEPROM +}; + +const char * const vtab_attiny1607[vts_attiny1607] = { // ATtiny1607, ATtiny1606, ATtiny1604, ATtiny807, ATtiny806, ATtiny804 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "PORTA_PORT", // 3: Interrupt PORT A + "PORTB_PORT", // 4: Interrupt PORT B + "PORTC_PORT", // 5: Interrupt PORT C + "RTC_CNT", // 6: RTC Counter Interrupt + "RTC_PIT", // 7: RTC Periodic Interrupt Timer + "TCA0_LUNF/TCA0_OVF", // 8: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 10: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 11: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 12: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "UNUSED", // 14: not implemented on this device + "UNUSED", // 15: not implemented on this device + "UNUSED", // 16: not implemented on this device + "AC0_AC", // 17: AC0 AC Interrupt + "UNUSED", // 18: not implemented on this device + "UNUSED", // 19: not implemented on this device + "ADC0_RESRDY", // 20: ADC 0 Result Ready + "ADC0_WCOMP", // 21: ADC 0 Window Comparator + "UNUSED", // 22: not implemented on this device + "UNUSED", // 23: not implemented on this device + "TWI0_TWIS", // 24: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 25: 2-Wire Interface 0 Controller + "SPI0_INT", // 26: SPI 0 Interrupt + "USART0_RXC", // 27: USART 0 Receive Complete + "USART0_DRE", // 28: USART 0 Data Register Empty + "USART0_TXC", // 29: USART 0 Transmit Complete + "NVMCTRL_EE", // 30: NVM EEPROM +}; + +const char * const vtab_attiny1614[vts_attiny1614] = { // ATtiny1614 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "PORTA_PORT", // 3: Interrupt PORT A + "PORTB_PORT", // 4: Interrupt PORT B + "UNUSED", // 5: not implemented on this device + "RTC_CNT", // 6: RTC Counter Interrupt + "RTC_PIT", // 7: RTC Periodic Interrupt Timer + "TCA0_LUNF/TCA0_OVF", // 8: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 10: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 11: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 12: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "TCB1_INT", // 14: TC B1 Interrupt + "TCD0_OVF", // 15: TC D0 Overflow + "TCD0_TRIG", // 16: TC D0 Trigger + "AC0_AC", // 17: AC0 AC Interrupt + "AC1_AC", // 18: AC1 AC Interrupt + "AC2_AC", // 19: AC2 AC Interrupt + "ADC0_RESRDY", // 20: ADC 0 Result Ready + "ADC0_WCOMP", // 21: ADC 0 Window Comparator + "ADC1_RESRDY", // 22: ADC 1 Result Ready + "ADC1_WCOMP", // 23: ADC 1 Window Comparator + "TWI0_TWIS", // 24: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 25: 2-Wire Interface 0 Controller + "SPI0_INT", // 26: SPI 0 Interrupt + "USART0_RXC", // 27: USART 0 Receive Complete + "USART0_DRE", // 28: USART 0 Data Register Empty + "USART0_TXC", // 29: USART 0 Transmit Complete + "NVMCTRL_EE", // 30: NVM EEPROM +}; + +const char * const vtab_attiny3214[vts_attiny3214] = { // ATtiny3214 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "PORTA_PORT", // 3: Interrupt PORT A + "PORTB_PORT", // 4: Interrupt PORT B + "PORTC_PORT", // 5: Interrupt PORT C + "RTC_CNT", // 6: RTC Counter Interrupt + "RTC_PIT", // 7: RTC Periodic Interrupt Timer + "TCA0_LUNF", // 8: TC A0 Low Underflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0", // 10: TC A0 Compare 0 + "TCA0_CMP1", // 11: TC A0 Compare 1 + "TCA0_CMP2", // 12: TC A0 Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "TCB1_INT", // 14: TC B1 Interrupt + "TCD0_OVF", // 15: TC D0 Overflow + "TCD0_TRIG", // 16: TC D0 Trigger + "AC0_AC", // 17: AC0 AC Interrupt + "AC1_AC", // 18: AC1 AC Interrupt + "AC2_AC", // 19: AC2 AC Interrupt + "ADC0_RESRDY", // 20: ADC 0 Result Ready + "ADC0_WCOMP", // 21: ADC 0 Window Comparator + "ADC1_RESRDY", // 22: ADC 1 Result Ready + "ADC1_WCOMP", // 23: ADC 1 Window Comparator + "TWI0_TWIS", // 24: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 25: 2-Wire Interface 0 Controller + "SPI0_INT", // 26: SPI 0 Interrupt + "USART0_RXC", // 27: USART 0 Receive Complete + "USART0_DRE", // 28: USART 0 Data Register Empty + "USART0_TXC", // 29: USART 0 Transmit Complete + "NVMCTRL_EE", // 30: NVM EEPROM +}; + +const char * const vtab_attiny3217[vts_attiny3217] = { // ATtiny3217, ATtiny3216, ATtiny1617, ATtiny1616 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "PORTA_PORT", // 3: Interrupt PORT A + "PORTB_PORT", // 4: Interrupt PORT B + "PORTC_PORT", // 5: Interrupt PORT C + "RTC_CNT", // 6: RTC Counter Interrupt + "RTC_PIT", // 7: RTC Periodic Interrupt Timer + "TCA0_LUNF/TCA0_OVF", // 8: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 10: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 11: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 12: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "TCB1_INT", // 14: TC B1 Interrupt + "TCD0_OVF", // 15: TC D0 Overflow + "TCD0_TRIG", // 16: TC D0 Trigger + "AC0_AC", // 17: AC0 AC Interrupt + "AC1_AC", // 18: AC1 AC Interrupt + "AC2_AC", // 19: AC2 AC Interrupt + "ADC0_RESRDY", // 20: ADC 0 Result Ready + "ADC0_WCOMP", // 21: ADC 0 Window Comparator + "ADC1_RESRDY", // 22: ADC 1 Result Ready + "ADC1_WCOMP", // 23: ADC 1 Window Comparator + "TWI0_TWIS", // 24: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 25: 2-Wire Interface 0 Controller + "SPI0_INT", // 26: SPI 0 Interrupt + "USART0_RXC", // 27: USART 0 Receive Complete + "USART0_DRE", // 28: USART 0 Data Register Empty + "USART0_TXC", // 29: USART 0 Transmit Complete + "NVMCTRL_EE", // 30: NVM EEPROM +}; + +const char * const vtab_attiny3227[vts_attiny3227] = { // ATtiny3227, ATtiny3226, ATtiny3224, ATtiny1627, ATtiny1626, ATtiny1624, ATtiny827, ATtiny826, ATtiny824, ATtiny427, ATtiny426, ATtiny424 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "RTC_CNT", // 3: RTC Counter Interrupt + "RTC_PIT", // 4: RTC Periodic Interrupt Timer + "CCL_CCL", // 5: Configurable Custom Logic + "PORTA_PORT", // 6: Interrupt PORT A + "PORTB_PORT", // 7: Interrupt PORT B + "TCA0_LUNF/TCA0_OVF", // 8: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 10: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 11: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 12: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "TWI0_TWIS", // 14: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 15: 2-Wire Interface 0 Controller + "SPI0_INT", // 16: SPI 0 Interrupt + "USART0_RXC", // 17: USART 0 Receive Complete + "USART0_DRE", // 18: USART 0 Data Register Empty + "USART0_TXC", // 19: USART 0 Transmit Complete + "AC0_AC", // 20: AC0 AC Interrupt + "ADC0_ERROR", // 21: ADC 0 Error + "ADC0_RESRDY", // 22: ADC 0 Result Ready + "ADC0_SAMPRDY", // 23: ADC 0 Sample Ready + "PORTC_PORT", // 24: Interrupt PORT C + "TCB1_INT", // 25: TC B1 Interrupt + "USART1_RXC", // 26: USART 1 Receive Complete + "USART1_DRE", // 27: USART 1 Data Register Empty + "USART1_TXC", // 28: USART 1 Transmit Complete + "NVMCTRL_EE", // 29: NVM EEPROM +}; + +const char * const vtab_atmega4808[vts_atmega4808] = { // ATmega4808, ATmega3208, ATmega1608, ATmega808 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "RTC_CNT", // 3: RTC Counter Interrupt + "RTC_PIT", // 4: RTC Periodic Interrupt Timer + "CCL_CCL", // 5: Configurable Custom Logic + "PORTA_PORT", // 6: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 7: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 8: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 9: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 10: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 11: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 12: TC B0 Interrupt + "TCB1_INT", // 13: TC B1 Interrupt + "TWI0_TWIS", // 14: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 15: 2-Wire Interface 0 Controller + "SPI0_INT", // 16: SPI 0 Interrupt + "USART0_RXC", // 17: USART 0 Receive Complete + "USART0_DRE", // 18: USART 0 Data Register Empty + "USART0_TXC", // 19: USART 0 Transmit Complete + "PORTD_PORT", // 20: Interrupt PORT D + "AC0_AC", // 21: AC0 AC Interrupt + "ADC0_RESRDY", // 22: ADC 0 Result Ready + "ADC0_WCOMP", // 23: ADC 0 Window Comparator + "PORTC_PORT", // 24: Interrupt PORT C + "TCB2_INT", // 25: TC B2 Interrupt + "USART1_RXC", // 26: USART 1 Receive Complete + "USART1_DRE", // 27: USART 1 Data Register Empty + "USART1_TXC", // 28: USART 1 Transmit Complete + "PORTF_PORT", // 29: Interrupt PORT F + "NVMCTRL_EE", // 30: NVM EEPROM + "USART2_RXC", // 31: USART 2 Receive Complete + "USART2_DRE", // 32: USART 2 Data Register Empty + "USART2_TXC", // 33: USART 2 Transmit Complete + "PORTB_PORT", // 34: Interrupt PORT B + "PORTE_PORT", // 35: Interrupt PORT E +}; + +const char * const vtab_atmega4809[vts_atmega4809] = { // ATmega4809, ATmega3209, ATmega1609, ATmega809 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "RTC_CNT", // 3: RTC Counter Interrupt + "RTC_PIT", // 4: RTC Periodic Interrupt Timer + "CCL_CCL", // 5: Configurable Custom Logic + "PORTA_PORT", // 6: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 7: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 8: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 9: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 10: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 11: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 12: TC B0 Interrupt + "TCB1_INT", // 13: TC B1 Interrupt + "TWI0_TWIS", // 14: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 15: 2-Wire Interface 0 Controller + "SPI0_INT", // 16: SPI 0 Interrupt + "USART0_RXC", // 17: USART 0 Receive Complete + "USART0_DRE", // 18: USART 0 Data Register Empty + "USART0_TXC", // 19: USART 0 Transmit Complete + "PORTD_PORT", // 20: Interrupt PORT D + "AC0_AC", // 21: AC0 AC Interrupt + "ADC0_RESRDY", // 22: ADC 0 Result Ready + "ADC0_WCOMP", // 23: ADC 0 Window Comparator + "PORTC_PORT", // 24: Interrupt PORT C + "TCB2_INT", // 25: TC B2 Interrupt + "USART1_RXC", // 26: USART 1 Receive Complete + "USART1_DRE", // 27: USART 1 Data Register Empty + "USART1_TXC", // 28: USART 1 Transmit Complete + "PORTF_PORT", // 29: Interrupt PORT F + "NVMCTRL_EE", // 30: NVM EEPROM + "USART2_RXC", // 31: USART 2 Receive Complete + "USART2_DRE", // 32: USART 2 Data Register Empty + "USART2_TXC", // 33: USART 2 Transmit Complete + "PORTB_PORT", // 34: Interrupt PORT B + "PORTE_PORT", // 35: Interrupt PORT E + "TCB3_INT", // 36: TC B3 Interrupt + "USART3_RXC", // 37: USART 3 Receive Complete + "USART3_DRE", // 38: USART 3 Data Register Empty + "USART3_TXC", // 39: USART 3 Transmit Complete +}; + +const char * const vtab_avr64dd32[vts_avr64dd32] = { // AVR64DD32, AVR64DD28, AVR64DD20, AVR64DD14, AVR32DD32, AVR32DD28, AVR32DD20, AVR32DD14, AVR16DD32, AVR16DD28, AVR16DD20, AVR16DD14 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "CLKCTRL_CFD", // 3: Clock Failure Detection + "MVIO_MVIO", // 4: Multi-Voltage I/O + "RTC_CNT", // 5: RTC Counter Interrupt + "RTC_PIT", // 6: RTC Periodic Interrupt Timer + "CCL_CCL", // 7: Configurable Custom Logic + "PORTA_PORT", // 8: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 9: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 10: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 11: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 12: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 13: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 14: TC B0 Interrupt + "TCB1_INT", // 15: TC B1 Interrupt + "TCD0_OVF", // 16: TC D0 Overflow + "TCD0_TRIG", // 17: TC D0 Trigger + "TWI0_TWIS", // 18: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 19: 2-Wire Interface 0 Controller + "SPI0_INT", // 20: SPI 0 Interrupt + "USART0_RXC", // 21: USART 0 Receive Complete + "USART0_DRE", // 22: USART 0 Data Register Empty + "USART0_TXC", // 23: USART 0 Transmit Complete + "PORTD_PORT", // 24: Interrupt PORT D + "AC0_AC", // 25: AC0 AC Interrupt + "ADC0_RESRDY", // 26: ADC 0 Result Ready + "ADC0_WCMP", // 27: ADC 0 Window Comparator + "ZCD3_ZCD", // 28: Zero Cross Detect 3 + "PORTC_PORT", // 29: Interrupt PORT C + "TCB2_INT", // 30: TC B2 Interrupt + "USART1_RXC", // 31: USART 1 Receive Complete + "USART1_DRE", // 32: USART 1 Data Register Empty + "USART1_TXC", // 33: USART 1 Transmit Complete + "PORTF_PORT", // 34: Interrupt PORT F + "NVMCTRL_EE", // 35: NVM EEPROM +}; + +const char * const vtab_avr64ea32[vts_avr64ea32] = { // AVR64EA32, AVR64EA28 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "CLKCTRL_CFD", // 3: Clock Failure Detection + "RTC_CNT", // 4: RTC Counter Interrupt + "RTC_PIT", // 5: RTC Periodic Interrupt Timer + "CCL_CCL", // 6: Configurable Custom Logic + "PORTA_PORT", // 7: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 8: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 10: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 11: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 12: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "TCB1_INT", // 14: TC B1 Interrupt + "TWI0_TWIS", // 15: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 16: 2-Wire Interface 0 Controller + "SPI0_INT", // 17: SPI 0 Interrupt + "USART0_RXC", // 18: USART 0 Receive Complete + "USART0_DRE", // 19: USART 0 Data Register Empty + "USART0_TXC", // 20: USART 0 Transmit Complete + "PORTD_PORT", // 21: Interrupt PORT D + "AC0_AC", // 22: AC0 AC Interrupt + "ADC0_ERROR", // 23: ADC 0 Error + "ADC0_RESRDY", // 24: ADC 0 Result Ready + "ADC0_SAMPRDY", // 25: ADC 0 Sample Ready + "AC1_AC", // 26: AC1 AC Interrupt + "PORTC_PORT", // 27: Interrupt PORT C + "TCB2_INT", // 28: TC B2 Interrupt + "USART1_RXC", // 29: USART 1 Receive Complete + "USART1_DRE", // 30: USART 1 Data Register Empty + "USART1_TXC", // 31: USART 1 Transmit Complete + "PORTF_PORT", // 32: Interrupt PORT F + "NVMCTRL_EEREADY/NVMCTRL_FLREADY/NVMCTRL_NVMREADY", // 33: NVM EEPROM Ready/NVM Flash Ready/NVM Ready + "USART2_RXC", // 34: USART 2 Receive Complete + "USART2_DRE", // 35: USART 2 Data Register Empty + "USART2_TXC", // 36: USART 2 Transmit Complete +}; + +const char * const vtab_avr64ea48[vts_avr64ea48] = { // AVR64EA48 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "CLKCTRL_CFD", // 3: Clock Failure Detection + "RTC_CNT", // 4: RTC Counter Interrupt + "RTC_PIT", // 5: RTC Periodic Interrupt Timer + "CCL_CCL", // 6: Configurable Custom Logic + "PORTA_PORT", // 7: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 8: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 9: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 10: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 11: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 12: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 13: TC B0 Interrupt + "TCB1_INT", // 14: TC B1 Interrupt + "TWI0_TWIS", // 15: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 16: 2-Wire Interface 0 Controller + "SPI0_INT", // 17: SPI 0 Interrupt + "USART0_RXC", // 18: USART 0 Receive Complete + "USART0_DRE", // 19: USART 0 Data Register Empty + "USART0_TXC", // 20: USART 0 Transmit Complete + "PORTD_PORT", // 21: Interrupt PORT D + "AC0_AC", // 22: AC0 AC Interrupt + "ADC0_ERROR", // 23: ADC 0 Error + "ADC0_RESRDY", // 24: ADC 0 Result Ready + "ADC0_SAMPRDY", // 25: ADC 0 Sample Ready + "AC1_AC", // 26: AC1 AC Interrupt + "PORTC_PORT", // 27: Interrupt PORT C + "TCB2_INT", // 28: TC B2 Interrupt + "USART1_RXC", // 29: USART 1 Receive Complete + "USART1_DRE", // 30: USART 1 Data Register Empty + "USART1_TXC", // 31: USART 1 Transmit Complete + "PORTF_PORT", // 32: Interrupt PORT F + "NVMCTRL_EEREADY/NVMCTRL_FLREADY/NVMCTRL_NVMREADY", // 33: NVM EEPROM Ready/NVM Flash Ready/NVM Ready + "USART2_RXC", // 34: USART 2 Receive Complete + "USART2_DRE", // 35: USART 2 Data Register Empty + "USART2_TXC", // 36: USART 2 Transmit Complete + "TCB3_INT", // 37: TC B3 Interrupt + "TCA1_LUNF/TCA1_OVF", // 38: TC A1 Low Underflow/TC A1 Overflow + "TCA1_HUNF", // 39: TC A1 High Underflow + "TCA1_CMP0/TCA1_LCMP0", // 40: TC A1 Compare 0/TC A1 Low Compare 0 + "TCA1_CMP1/TCA1_LCMP1", // 41: TC A1 Compare 1/TC A1 Low Compare 1 + "TCA1_CMP2/TCA1_LCMP2", // 42: TC A1 Compare 2/TC A1 Low Compare 2 + "PORTE_PORT", // 43: Interrupt PORT E + "PORTB_PORT", // 44: Interrupt PORT B +}; + +const char * const vtab_avr128da28[vts_avr128da28] = { // AVR128DA28, AVR64DA28, AVR32DA28 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "RTC_CNT", // 3: RTC Counter Interrupt + "RTC_PIT", // 4: RTC Periodic Interrupt Timer + "CCL_CCL", // 5: Configurable Custom Logic + "PORTA_PORT", // 6: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 7: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 8: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 9: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 10: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 11: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 12: TC B0 Interrupt + "TCB1_INT", // 13: TC B1 Interrupt + "TCD0_OVF", // 14: TC D0 Overflow + "TCD0_TRIG", // 15: TC D0 Trigger + "TWI0_TWIS", // 16: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 17: 2-Wire Interface 0 Controller + "SPI0_INT", // 18: SPI 0 Interrupt + "USART0_RXC", // 19: USART 0 Receive Complete + "USART0_DRE", // 20: USART 0 Data Register Empty + "USART0_TXC", // 21: USART 0 Transmit Complete + "PORTD_PORT", // 22: Interrupt PORT D + "AC0_AC", // 23: AC0 AC Interrupt + "ADC0_RESRDY", // 24: ADC 0 Result Ready + "ADC0_WCMP", // 25: ADC 0 Window Comparator + "ZCD0_ZCD", // 26: Zero Cross Detect 0 + "PTC_PTC", // 27: PTC Interrupt + "AC1_AC", // 28: AC1 AC Interrupt + "PORTC_PORT", // 29: Interrupt PORT C + "TCB2_INT", // 30: TC B2 Interrupt + "USART1_RXC", // 31: USART 1 Receive Complete + "USART1_DRE", // 32: USART 1 Data Register Empty + "USART1_TXC", // 33: USART 1 Transmit Complete + "PORTF_PORT", // 34: Interrupt PORT F + "NVMCTRL_EE", // 35: NVM EEPROM + "SPI1_INT", // 36: SPI 1 Interrupt + "USART2_RXC", // 37: USART 2 Receive Complete + "USART2_DRE", // 38: USART 2 Data Register Empty + "USART2_TXC", // 39: USART 2 Transmit Complete + "AC2_AC", // 40: AC2 AC Interrupt +}; + +const char * const vtab_avr128db28[vts_avr128db28] = { // AVR128DB28, AVR64DB28, AVR32DB28 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "CLKCTRL_CFD", // 3: Clock Failure Detection + "MVIO_MVIO", // 4: Multi-Voltage I/O + "RTC_CNT", // 5: RTC Counter Interrupt + "RTC_PIT", // 6: RTC Periodic Interrupt Timer + "CCL_CCL", // 7: Configurable Custom Logic + "PORTA_PORT", // 8: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 9: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 10: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 11: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 12: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 13: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 14: TC B0 Interrupt + "TCB1_INT", // 15: TC B1 Interrupt + "TCD0_OVF", // 16: TC D0 Overflow + "TCD0_TRIG", // 17: TC D0 Trigger + "TWI0_TWIS", // 18: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 19: 2-Wire Interface 0 Controller + "SPI0_INT", // 20: SPI 0 Interrupt + "USART0_RXC", // 21: USART 0 Receive Complete + "USART0_DRE", // 22: USART 0 Data Register Empty + "USART0_TXC", // 23: USART 0 Transmit Complete + "PORTD_PORT", // 24: Interrupt PORT D + "AC0_AC", // 25: AC0 AC Interrupt + "ADC0_RESRDY", // 26: ADC 0 Result Ready + "ADC0_WCMP", // 27: ADC 0 Window Comparator + "ZCD0_ZCD", // 28: Zero Cross Detect 0 + "AC1_AC", // 29: AC1 AC Interrupt + "PORTC_PORT", // 30: Interrupt PORT C + "TCB2_INT", // 31: TC B2 Interrupt + "USART1_RXC", // 32: USART 1 Receive Complete + "USART1_DRE", // 33: USART 1 Data Register Empty + "USART1_TXC", // 34: USART 1 Transmit Complete + "PORTF_PORT", // 35: Interrupt PORT F + "NVMCTRL_EE", // 36: NVM EEPROM + "SPI1_INT", // 37: SPI 1 Interrupt + "USART2_RXC", // 38: USART 2 Receive Complete + "USART2_DRE", // 39: USART 2 Data Register Empty + "USART2_TXC", // 40: USART 2 Transmit Complete + "AC2_AC", // 41: AC2 AC Interrupt +}; + +const char * const vtab_avr128da32[vts_avr128da32] = { // AVR128DA32, AVR64DA32, AVR32DA32 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "RTC_CNT", // 3: RTC Counter Interrupt + "RTC_PIT", // 4: RTC Periodic Interrupt Timer + "CCL_CCL", // 5: Configurable Custom Logic + "PORTA_PORT", // 6: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 7: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 8: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 9: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 10: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 11: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 12: TC B0 Interrupt + "TCB1_INT", // 13: TC B1 Interrupt + "TCD0_OVF", // 14: TC D0 Overflow + "TCD0_TRIG", // 15: TC D0 Trigger + "TWI0_TWIS", // 16: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 17: 2-Wire Interface 0 Controller + "SPI0_INT", // 18: SPI 0 Interrupt + "USART0_RXC", // 19: USART 0 Receive Complete + "USART0_DRE", // 20: USART 0 Data Register Empty + "USART0_TXC", // 21: USART 0 Transmit Complete + "PORTD_PORT", // 22: Interrupt PORT D + "AC0_AC", // 23: AC0 AC Interrupt + "ADC0_RESRDY", // 24: ADC 0 Result Ready + "ADC0_WCMP", // 25: ADC 0 Window Comparator + "ZCD0_ZCD", // 26: Zero Cross Detect 0 + "PTC_PTC", // 27: PTC Interrupt + "AC1_AC", // 28: AC1 AC Interrupt + "PORTC_PORT", // 29: Interrupt PORT C + "TCB2_INT", // 30: TC B2 Interrupt + "USART1_RXC", // 31: USART 1 Receive Complete + "USART1_DRE", // 32: USART 1 Data Register Empty + "USART1_TXC", // 33: USART 1 Transmit Complete + "PORTF_PORT", // 34: Interrupt PORT F + "NVMCTRL_EE", // 35: NVM EEPROM + "SPI1_INT", // 36: SPI 1 Interrupt + "USART2_RXC", // 37: USART 2 Receive Complete + "USART2_DRE", // 38: USART 2 Data Register Empty + "USART2_TXC", // 39: USART 2 Transmit Complete + "AC2_AC", // 40: AC2 AC Interrupt + "UNUSED", // 41: not implemented on this device + "TWI1_TWIS", // 42: 2-Wire Interface 1 Periphery + "TWI1_TWIM", // 43: 2-Wire Interface 1 Controller +}; + +const char * const vtab_avr128db32[vts_avr128db32] = { // AVR128DB32, AVR64DB32, AVR32DB32 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "CLKCTRL_CFD", // 3: Clock Failure Detection + "MVIO_MVIO", // 4: Multi-Voltage I/O + "RTC_CNT", // 5: RTC Counter Interrupt + "RTC_PIT", // 6: RTC Periodic Interrupt Timer + "CCL_CCL", // 7: Configurable Custom Logic + "PORTA_PORT", // 8: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 9: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 10: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 11: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 12: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 13: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 14: TC B0 Interrupt + "TCB1_INT", // 15: TC B1 Interrupt + "TCD0_OVF", // 16: TC D0 Overflow + "TCD0_TRIG", // 17: TC D0 Trigger + "TWI0_TWIS", // 18: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 19: 2-Wire Interface 0 Controller + "SPI0_INT", // 20: SPI 0 Interrupt + "USART0_RXC", // 21: USART 0 Receive Complete + "USART0_DRE", // 22: USART 0 Data Register Empty + "USART0_TXC", // 23: USART 0 Transmit Complete + "PORTD_PORT", // 24: Interrupt PORT D + "AC0_AC", // 25: AC0 AC Interrupt + "ADC0_RESRDY", // 26: ADC 0 Result Ready + "ADC0_WCMP", // 27: ADC 0 Window Comparator + "ZCD0_ZCD", // 28: Zero Cross Detect 0 + "AC1_AC", // 29: AC1 AC Interrupt + "PORTC_PORT", // 30: Interrupt PORT C + "TCB2_INT", // 31: TC B2 Interrupt + "USART1_RXC", // 32: USART 1 Receive Complete + "USART1_DRE", // 33: USART 1 Data Register Empty + "USART1_TXC", // 34: USART 1 Transmit Complete + "PORTF_PORT", // 35: Interrupt PORT F + "NVMCTRL_EE", // 36: NVM EEPROM + "SPI1_INT", // 37: SPI 1 Interrupt + "USART2_RXC", // 38: USART 2 Receive Complete + "USART2_DRE", // 39: USART 2 Data Register Empty + "USART2_TXC", // 40: USART 2 Transmit Complete + "AC2_AC", // 41: AC2 AC Interrupt + "TWI1_TWIS", // 42: 2-Wire Interface 1 Periphery + "TWI1_TWIM", // 43: 2-Wire Interface 1 Controller +}; + +const char * const vtab_avr128da48[vts_avr128da48] = { // AVR128DA48, AVR64DA48, AVR32DA48 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "RTC_CNT", // 3: RTC Counter Interrupt + "RTC_PIT", // 4: RTC Periodic Interrupt Timer + "CCL_CCL", // 5: Configurable Custom Logic + "PORTA_PORT", // 6: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 7: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 8: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 9: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 10: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 11: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 12: TC B0 Interrupt + "TCB1_INT", // 13: TC B1 Interrupt + "TCD0_OVF", // 14: TC D0 Overflow + "TCD0_TRIG", // 15: TC D0 Trigger + "TWI0_TWIS", // 16: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 17: 2-Wire Interface 0 Controller + "SPI0_INT", // 18: SPI 0 Interrupt + "USART0_RXC", // 19: USART 0 Receive Complete + "USART0_DRE", // 20: USART 0 Data Register Empty + "USART0_TXC", // 21: USART 0 Transmit Complete + "PORTD_PORT", // 22: Interrupt PORT D + "AC0_AC", // 23: AC0 AC Interrupt + "ADC0_RESRDY", // 24: ADC 0 Result Ready + "ADC0_WCMP", // 25: ADC 0 Window Comparator + "ZCD0_ZCD", // 26: Zero Cross Detect 0 + "PTC_PTC", // 27: PTC Interrupt + "AC1_AC", // 28: AC1 AC Interrupt + "PORTC_PORT", // 29: Interrupt PORT C + "TCB2_INT", // 30: TC B2 Interrupt + "USART1_RXC", // 31: USART 1 Receive Complete + "USART1_DRE", // 32: USART 1 Data Register Empty + "USART1_TXC", // 33: USART 1 Transmit Complete + "PORTF_PORT", // 34: Interrupt PORT F + "NVMCTRL_EE", // 35: NVM EEPROM + "SPI1_INT", // 36: SPI 1 Interrupt + "USART2_RXC", // 37: USART 2 Receive Complete + "USART2_DRE", // 38: USART 2 Data Register Empty + "USART2_TXC", // 39: USART 2 Transmit Complete + "AC2_AC", // 40: AC2 AC Interrupt + "TCB3_INT", // 41: TC B3 Interrupt + "TWI1_TWIS", // 42: 2-Wire Interface 1 Periphery + "TWI1_TWIM", // 43: 2-Wire Interface 1 Controller + "PORTB_PORT", // 44: Interrupt PORT B + "PORTE_PORT", // 45: Interrupt PORT E + "TCA1_LUNF/TCA1_OVF", // 46: TC A1 Low Underflow/TC A1 Overflow + "TCA1_HUNF", // 47: TC A1 High Underflow + "TCA1_CMP0/TCA1_LCMP0", // 48: TC A1 Compare 0/TC A1 Low Compare 0 + "TCA1_CMP1/TCA1_LCMP1", // 49: TC A1 Compare 1/TC A1 Low Compare 1 + "TCA1_CMP2/TCA1_LCMP2", // 50: TC A1 Compare 2/TC A1 Low Compare 2 + "ZCD1_ZCD", // 51: Zero Cross Detect 1 + "USART3_RXC", // 52: USART 3 Receive Complete + "USART3_DRE", // 53: USART 3 Data Register Empty + "USART3_TXC", // 54: USART 3 Transmit Complete + "USART4_RXC", // 55: USART 4 Receive Complete + "USART4_DRE", // 56: USART 4 Data Register Empty + "USART4_TXC", // 57: USART 4 Transmit Complete +}; + +const char * const vtab_avr128db48[vts_avr128db48] = { // AVR128DB48, AVR64DB48, AVR32DB48 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "CLKCTRL_CFD", // 3: Clock Failure Detection + "MVIO_MVIO", // 4: Multi-Voltage I/O + "RTC_CNT", // 5: RTC Counter Interrupt + "RTC_PIT", // 6: RTC Periodic Interrupt Timer + "CCL_CCL", // 7: Configurable Custom Logic + "PORTA_PORT", // 8: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 9: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 10: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 11: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 12: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 13: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 14: TC B0 Interrupt + "TCB1_INT", // 15: TC B1 Interrupt + "TCD0_OVF", // 16: TC D0 Overflow + "TCD0_TRIG", // 17: TC D0 Trigger + "TWI0_TWIS", // 18: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 19: 2-Wire Interface 0 Controller + "SPI0_INT", // 20: SPI 0 Interrupt + "USART0_RXC", // 21: USART 0 Receive Complete + "USART0_DRE", // 22: USART 0 Data Register Empty + "USART0_TXC", // 23: USART 0 Transmit Complete + "PORTD_PORT", // 24: Interrupt PORT D + "AC0_AC", // 25: AC0 AC Interrupt + "ADC0_RESRDY", // 26: ADC 0 Result Ready + "ADC0_WCMP", // 27: ADC 0 Window Comparator + "ZCD0_ZCD", // 28: Zero Cross Detect 0 + "AC1_AC", // 29: AC1 AC Interrupt + "PORTC_PORT", // 30: Interrupt PORT C + "TCB2_INT", // 31: TC B2 Interrupt + "USART1_RXC", // 32: USART 1 Receive Complete + "USART1_DRE", // 33: USART 1 Data Register Empty + "USART1_TXC", // 34: USART 1 Transmit Complete + "PORTF_PORT", // 35: Interrupt PORT F + "NVMCTRL_EE", // 36: NVM EEPROM + "SPI1_INT", // 37: SPI 1 Interrupt + "USART2_RXC", // 38: USART 2 Receive Complete + "USART2_DRE", // 39: USART 2 Data Register Empty + "USART2_TXC", // 40: USART 2 Transmit Complete + "AC2_AC", // 41: AC2 AC Interrupt + "TWI1_TWIS", // 42: 2-Wire Interface 1 Periphery + "TWI1_TWIM", // 43: 2-Wire Interface 1 Controller + "TCB3_INT", // 44: TC B3 Interrupt + "PORTB_PORT", // 45: Interrupt PORT B + "PORTE_PORT", // 46: Interrupt PORT E + "TCA1_LUNF/TCA1_OVF", // 47: TC A1 Low Underflow/TC A1 Overflow + "TCA1_HUNF", // 48: TC A1 High Underflow + "TCA1_CMP0/TCA1_LCMP0", // 49: TC A1 Compare 0/TC A1 Low Compare 0 + "TCA1_CMP1/TCA1_LCMP1", // 50: TC A1 Compare 1/TC A1 Low Compare 1 + "TCA1_CMP2/TCA1_LCMP2", // 51: TC A1 Compare 2/TC A1 Low Compare 2 + "ZCD1_ZCD", // 52: Zero Cross Detect 1 + "USART3_RXC", // 53: USART 3 Receive Complete + "USART3_DRE", // 54: USART 3 Data Register Empty + "USART3_TXC", // 55: USART 3 Transmit Complete + "USART4_RXC", // 56: USART 4 Receive Complete + "USART4_DRE", // 57: USART 4 Data Register Empty + "USART4_TXC", // 58: USART 4 Transmit Complete + "UNUSED", // 59: not implemented on this device + "ZCD2_ZCD", // 60: Zero Cross Detect 2 +}; + +const char * const vtab_avr128da64[vts_avr128da64] = { // AVR128DA64, AVR64DA64 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "RTC_CNT", // 3: RTC Counter Interrupt + "RTC_PIT", // 4: RTC Periodic Interrupt Timer + "CCL_CCL", // 5: Configurable Custom Logic + "PORTA_PORT", // 6: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 7: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 8: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 9: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 10: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 11: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 12: TC B0 Interrupt + "TCB1_INT", // 13: TC B1 Interrupt + "TCD0_OVF", // 14: TC D0 Overflow + "TCD0_TRIG", // 15: TC D0 Trigger + "TWI0_TWIS", // 16: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 17: 2-Wire Interface 0 Controller + "SPI0_INT", // 18: SPI 0 Interrupt + "USART0_RXC", // 19: USART 0 Receive Complete + "USART0_DRE", // 20: USART 0 Data Register Empty + "USART0_TXC", // 21: USART 0 Transmit Complete + "PORTD_PORT", // 22: Interrupt PORT D + "AC0_AC", // 23: AC0 AC Interrupt + "ADC0_RESRDY", // 24: ADC 0 Result Ready + "ADC0_WCMP", // 25: ADC 0 Window Comparator + "ZCD0_ZCD", // 26: Zero Cross Detect 0 + "PTC_PTC", // 27: PTC Interrupt + "AC1_AC", // 28: AC1 AC Interrupt + "PORTC_PORT", // 29: Interrupt PORT C + "TCB2_INT", // 30: TC B2 Interrupt + "USART1_RXC", // 31: USART 1 Receive Complete + "USART1_DRE", // 32: USART 1 Data Register Empty + "USART1_TXC", // 33: USART 1 Transmit Complete + "PORTF_PORT", // 34: Interrupt PORT F + "NVMCTRL_EE", // 35: NVM EEPROM + "SPI1_INT", // 36: SPI 1 Interrupt + "USART2_RXC", // 37: USART 2 Receive Complete + "USART2_DRE", // 38: USART 2 Data Register Empty + "USART2_TXC", // 39: USART 2 Transmit Complete + "AC2_AC", // 40: AC2 AC Interrupt + "TCB3_INT", // 41: TC B3 Interrupt + "TWI1_TWIS", // 42: 2-Wire Interface 1 Periphery + "TWI1_TWIM", // 43: 2-Wire Interface 1 Controller + "PORTB_PORT", // 44: Interrupt PORT B + "PORTE_PORT", // 45: Interrupt PORT E + "TCA1_LUNF/TCA1_OVF", // 46: TC A1 Low Underflow/TC A1 Overflow + "TCA1_HUNF", // 47: TC A1 High Underflow + "TCA1_CMP0/TCA1_LCMP0", // 48: TC A1 Compare 0/TC A1 Low Compare 0 + "TCA1_CMP1/TCA1_LCMP1", // 49: TC A1 Compare 1/TC A1 Low Compare 1 + "TCA1_CMP2/TCA1_LCMP2", // 50: TC A1 Compare 2/TC A1 Low Compare 2 + "ZCD1_ZCD", // 51: Zero Cross Detect 1 + "USART3_RXC", // 52: USART 3 Receive Complete + "USART3_DRE", // 53: USART 3 Data Register Empty + "USART3_TXC", // 54: USART 3 Transmit Complete + "USART4_RXC", // 55: USART 4 Receive Complete + "USART4_DRE", // 56: USART 4 Data Register Empty + "USART4_TXC", // 57: USART 4 Transmit Complete + "PORTG_PORT", // 58: Interrupt PORT G + "ZCD2_ZCD", // 59: Zero Cross Detect 2 + "TCB4_INT", // 60: TC B4 Interrupt + "USART5_RXC", // 61: USART 5 Receive Complete + "USART5_DRE", // 62: USART 5 Data Register Empty + "USART5_TXC", // 63: USART 5 Transmit Complete +}; + +const char * const vtab_avr128db64[vts_avr128db64] = { // AVR128DB64, AVR64DB64 + "RESET", // 0: Reset (various reasons) + "CRCSCAN_NMI", // 1: CRCSCAN Non-maskable Interrupt + "BOD_VLM", // 2: Brown-out Detector Voltage Level Monitor + "CLKCTRL_CFD", // 3: Clock Failure Detection + "MVIO_MVIO", // 4: Multi-Voltage I/O + "RTC_CNT", // 5: RTC Counter Interrupt + "RTC_PIT", // 6: RTC Periodic Interrupt Timer + "CCL_CCL", // 7: Configurable Custom Logic + "PORTA_PORT", // 8: Interrupt PORT A + "TCA0_LUNF/TCA0_OVF", // 9: TC A0 Low Underflow/TC A0 Overflow + "TCA0_HUNF", // 10: TC A0 High Underflow + "TCA0_CMP0/TCA0_LCMP0", // 11: TC A0 Compare 0/TC A0 Low Compare 0 + "TCA0_CMP1/TCA0_LCMP1", // 12: TC A0 Compare 1/TC A0 Low Compare 1 + "TCA0_CMP2/TCA0_LCMP2", // 13: TC A0 Compare 2/TC A0 Low Compare 2 + "TCB0_INT", // 14: TC B0 Interrupt + "TCB1_INT", // 15: TC B1 Interrupt + "TCD0_OVF", // 16: TC D0 Overflow + "TCD0_TRIG", // 17: TC D0 Trigger + "TWI0_TWIS", // 18: 2-Wire Interface 0 Periphery + "TWI0_TWIM", // 19: 2-Wire Interface 0 Controller + "SPI0_INT", // 20: SPI 0 Interrupt + "USART0_RXC", // 21: USART 0 Receive Complete + "USART0_DRE", // 22: USART 0 Data Register Empty + "USART0_TXC", // 23: USART 0 Transmit Complete + "PORTD_PORT", // 24: Interrupt PORT D + "AC0_AC", // 25: AC0 AC Interrupt + "ADC0_RESRDY", // 26: ADC 0 Result Ready + "ADC0_WCMP", // 27: ADC 0 Window Comparator + "ZCD0_ZCD", // 28: Zero Cross Detect 0 + "AC1_AC", // 29: AC1 AC Interrupt + "PORTC_PORT", // 30: Interrupt PORT C + "TCB2_INT", // 31: TC B2 Interrupt + "USART1_RXC", // 32: USART 1 Receive Complete + "USART1_DRE", // 33: USART 1 Data Register Empty + "USART1_TXC", // 34: USART 1 Transmit Complete + "PORTF_PORT", // 35: Interrupt PORT F + "NVMCTRL_EE", // 36: NVM EEPROM + "SPI1_INT", // 37: SPI 1 Interrupt + "USART2_RXC", // 38: USART 2 Receive Complete + "USART2_DRE", // 39: USART 2 Data Register Empty + "USART2_TXC", // 40: USART 2 Transmit Complete + "AC2_AC", // 41: AC2 AC Interrupt + "TWI1_TWIS", // 42: 2-Wire Interface 1 Periphery + "TWI1_TWIM", // 43: 2-Wire Interface 1 Controller + "TCB3_INT", // 44: TC B3 Interrupt + "PORTB_PORT", // 45: Interrupt PORT B + "PORTE_PORT", // 46: Interrupt PORT E + "TCA1_LUNF/TCA1_OVF", // 47: TC A1 Low Underflow/TC A1 Overflow + "TCA1_HUNF", // 48: TC A1 High Underflow + "TCA1_CMP0/TCA1_LCMP0", // 49: TC A1 Compare 0/TC A1 Low Compare 0 + "TCA1_CMP1/TCA1_LCMP1", // 50: TC A1 Compare 1/TC A1 Low Compare 1 + "TCA1_CMP2/TCA1_LCMP2", // 51: TC A1 Compare 2/TC A1 Low Compare 2 + "ZCD1_ZCD", // 52: Zero Cross Detect 1 + "USART3_RXC", // 53: USART 3 Receive Complete + "USART3_DRE", // 54: USART 3 Data Register Empty + "USART3_TXC", // 55: USART 3 Transmit Complete + "USART4_RXC", // 56: USART 4 Receive Complete + "USART4_DRE", // 57: USART 4 Data Register Empty + "USART4_TXC", // 58: USART 4 Transmit Complete + "PORTG_PORT", // 59: Interrupt PORT G + "ZCD2_ZCD", // 60: Zero Cross Detect 2 + "TCB4_INT", // 61: TC B4 Interrupt + "USART5_RXC", // 62: USART 5 Receive Complete + "USART5_DRE", // 63: USART 5 Data Register Empty + "USART5_TXC", // 64: USART 5 Transmit Complete +}; + diff --git a/src/avrintel.h b/src/avrintel.h new file mode 100644 index 00000000..d8bc07ec --- /dev/null +++ b/src/avrintel.h @@ -0,0 +1,1477 @@ +/* + * Do not edit: automatically generated by mkavrintel.pl + * + * avrintel.h + * + * Atmel AVR8L, AVR8, XMEGA and AVR8X family description of interrupts and more + * + * published under GNU General Public License, version 3 (GPL-3.0) + * meta-author Stefan Rueger + * + * v 1.1 + * 30.08.2022 + * + */ + +#ifndef AVRINTEL_H +#define AVRINTEL_H + +#include "config.h" + +typedef struct { // Value of -1 typically means unknown + const char *name; // Name of part + uint16_t mcuid; // ID of MCU in 0..2039 + uint8_t avrarch; // F_AVR8L, F_AVR8, F_XMEGA or F_AVR8X + uint8_t sigs[3]; // Signature bytes + int32_t flashoffset; // Flash offset + int32_t flashsize; // Flash size + int16_t pagesize; // Flash page size + int8_t nboots; // Number of supported boot sectors + int16_t bootsize; // Size of (smallest) boot sector + int32_t eepromoffset; // EEPROM offset + int32_t eepromsize; // EEPROM size + int32_t eeprompagesize; // EEPROM page size + int32_t sramstart; // SRAM offset + int32_t sramsize; // SRAM size + int8_t nfuses; // Number of fuse bytes + int8_t nlocks; // Number of lock bytes + uint8_t ninterrupts; // Number of vectors in interrupt vector table + const char * const *isrtable; // Interrupt vector table vector names +} uPcore_t; + +#define F_AVR8L 1 // TPI programming, ATtiny(4|5|9|10|20|40|102|104) +#define F_AVR8 2 // ISP programming with SPI, "classic" AVRs +#define F_XMEGA 4 // PDI programming, ATxmega family +#define F_AVR8X 8 // UPDI programming, newer 8-bit MCUs + +#define UB_N_MCU 2040 // mcuid is in 0..2039 + +// MCU id: running number in arbitrary order; once assigned never change for backward compatibility +#define id_attiny4 0u +#define id_attiny5 1u +#define id_attiny9 2u +#define id_attiny10 3u +#define id_attiny20 4u +#define id_attiny40 5u +#define id_attiny102 6u +#define id_attiny104 7u +#define id_attiny11 8u +#define id_attiny12 9u +#define id_attiny13 10u +#define id_attiny13a 11u +#define id_attiny15 12u +#define id_attiny22 13u +#define id_attiny24 14u +#define id_attiny24a 15u +#define id_attiny25 16u +#define id_attiny26 17u +#define id_attiny28 18u +#define id_attiny43u 19u +#define id_attiny44 20u +#define id_attiny44a 21u +#define id_attiny45 22u +#define id_attiny48 23u +#define id_attiny84 24u +#define id_attiny84a 25u +#define id_attiny85 26u +#define id_attiny87 27u +#define id_attiny88 28u +#define id_attiny167 29u +#define id_attiny261 30u +#define id_attiny261a 31u +#define id_attiny441 32u +#define id_attiny461 33u +#define id_attiny461a 34u +#define id_attiny828 35u +#define id_attiny828r 36u +#define id_attiny841 37u +#define id_attiny861 38u +#define id_attiny861a 39u +#define id_attiny1634 40u +#define id_attiny1634r 41u +#define id_attiny2313 42u +#define id_attiny2313a 43u +#define id_attiny4313 44u +#define id_atmega8 45u +#define id_atmega8a 46u +#define id_atmega8hva 47u +#define id_atmega8u2 48u +#define id_atmega16 49u +#define id_atmega16a 50u +#define id_atmega16hva 51u +#define id_atmega16hvb 52u +#define id_atmega16hvbrevb 53u +#define id_atmega16m1 54u +#define id_atmega16hva2 55u +#define id_atmega16u2 56u +#define id_atmega16u4 57u +#define id_atmega32 58u +#define id_atmega32a 59u +#define id_atmega32hvb 60u +#define id_atmega32hvbrevb 61u +#define id_atmega32c1 62u +#define id_atmega32m1 63u +#define id_atmega32u2 64u +#define id_atmega32u4 65u +#define id_atmega32u6 66u +#define id_atmega48 67u +#define id_atmega48a 68u +#define id_atmega48p 69u +#define id_atmega48pa 70u +#define id_atmega48pb 71u +#define id_atmega64 72u +#define id_atmega64a 73u +#define id_atmega64hve 74u +#define id_atmega64c1 75u +#define id_atmega64m1 76u +#define id_atmega64hve2 77u +#define id_atmega64rfr2 78u +#define id_atmega88 79u +#define id_atmega88a 80u +#define id_atmega88p 81u +#define id_atmega88pa 82u +#define id_atmega88pb 83u +#define id_atmega103 84u +#define id_atmega128 85u +#define id_atmega128a 86u +#define id_atmega128rfa1 87u +#define id_atmega128rfr2 88u +#define id_atmega161 89u +#define id_atmega162 90u +#define id_atmega163 91u +#define id_atmega164a 92u +#define id_atmega164p 93u +#define id_atmega164pa 94u +#define id_atmega165 95u +#define id_atmega165a 96u +#define id_atmega165p 97u +#define id_atmega165pa 98u +#define id_atmega168 99u +#define id_atmega168a 100u +#define id_atmega168p 101u +#define id_atmega168pa 102u +#define id_atmega168pb 103u +#define id_atmega169 104u +#define id_atmega169a 105u +#define id_atmega169p 106u +#define id_atmega169pa 107u +#define id_atmega256rfr2 108u +#define id_atmega323 109u +#define id_atmega324a 110u +#define id_atmega324p 111u +#define id_atmega324pa 112u +#define id_atmega324pb 113u +#define id_atmega325 114u +#define id_atmega325a 115u +#define id_atmega325p 116u +#define id_atmega325pa 117u +#define id_atmega328 118u +#define id_atmega328p 119u +#define id_atmega328pb 120u +#define id_atmega329 121u +#define id_atmega329a 122u +#define id_atmega329p 123u +#define id_atmega329pa 124u +#define id_atmega406 125u +#define id_atmega640 126u +#define id_atmega644 127u +#define id_atmega644a 128u +#define id_atmega644p 129u +#define id_atmega644pa 130u +#define id_atmega644rfr2 131u +#define id_atmega645 132u +#define id_atmega645a 133u +#define id_atmega645p 134u +#define id_atmega649 135u +#define id_atmega649a 136u +#define id_atmega649p 137u +#define id_atmega1280 138u +#define id_atmega1281 139u +#define id_atmega1284 140u +#define id_atmega1284p 141u +#define id_atmega1284rfr2 142u +#define id_atmega2560 143u +#define id_atmega2561 144u +#define id_atmega2564rfr2 145u +#define id_atmega3250 146u +#define id_atmega3250a 147u +#define id_atmega3250p 148u +#define id_atmega3250pa 149u +#define id_atmega3290 150u +#define id_atmega3290a 151u +#define id_atmega3290p 152u +#define id_atmega3290pa 153u +#define id_atmega6450 154u +#define id_atmega6450a 155u +#define id_atmega6450p 156u +#define id_atmega6490 157u +#define id_atmega6490a 158u +#define id_atmega6490p 159u +#define id_atmega8515 160u +#define id_atmega8535 161u +#define id_at43usb320 162u +#define id_at43usb355 163u +#define id_at76c711 164u +#define id_at86rf401 165u +#define id_at90pwm1 166u +#define id_at90pwm2 167u +#define id_at90pwm2b 168u +#define id_at90pwm3 169u +#define id_at90pwm3b 170u +#define id_at90can32 171u +#define id_at90can64 172u +#define id_at90pwm81 173u +#define id_at90usb82 174u +#define id_at90scr100 175u +#define id_at90can128 176u +#define id_at90pwm161 177u +#define id_at90usb162 178u +#define id_at90pwm216 179u +#define id_at90pwm316 180u +#define id_at90usb646 181u +#define id_at90usb647 182u +#define id_at90s1200 183u +#define id_at90usb1286 184u +#define id_at90usb1287 185u +#define id_at90s2313 186u +#define id_at90s2323 187u +#define id_at90s2333 188u +#define id_at90s2343 189u +#define id_at90s4414 190u +#define id_at90s4433 191u +#define id_at90s4434 192u +#define id_at90s8515 193u +#define id_at90c8534 194u +#define id_at90s8535 195u +#define id_at94k 196u +#define id_ata5272 197u +#define id_ata5505 198u +#define id_ata5700m322 199u +#define id_ata5702m322 200u +#define id_ata5781 201u +#define id_ata5782 202u +#define id_ata5783 203u +#define id_ata5787 204u +#define id_ata5790 205u +#define id_ata5790n 206u +#define id_ata5791 207u +#define id_ata5795 208u +#define id_ata5831 209u +#define id_ata5832 210u +#define id_ata5833 211u +#define id_ata5835 212u +#define id_ata6285 213u +#define id_ata6286 214u +#define id_ata6289 215u +#define id_ata6612c 216u +#define id_ata6613c 217u +#define id_ata6614q 218u +#define id_ata6616c 219u +#define id_ata6617c 220u +#define id_ata8210 221u +#define id_ata8215 222u +#define id_ata8510 223u +#define id_ata8515 224u +#define id_ata664251 225u +#define id_m3000 226u +#define id_lgt8f88p 227u +#define id_lgt8f168p 228u +#define id_lgt8f328p 229u +#define id_atxmega8e5 230u +#define id_atxmega16a4 231u +#define id_atxmega16a4u 232u +#define id_atxmega16c4 233u +#define id_atxmega16d4 234u +#define id_atxmega16e5 235u +#define id_atxmega32c3 236u +#define id_atxmega32d3 237u +#define id_atxmega32a4 238u +#define id_atxmega32a4u 239u +#define id_atxmega32c4 240u +#define id_atxmega32d4 241u +#define id_atxmega32e5 242u +#define id_atxmega64a1 243u +#define id_atxmega64a1u 244u +#define id_atxmega64b1 245u +#define id_atxmega64a3 246u +#define id_atxmega64a3u 247u +#define id_atxmega64b3 248u +#define id_atxmega64c3 249u +#define id_atxmega64d3 250u +#define id_atxmega64a4 251u +#define id_atxmega64a4u 252u +#define id_atxmega64d4 253u +#define id_atxmega128a1 254u +#define id_atxmega128a1revd 255u +#define id_atxmega128a1u 256u +#define id_atxmega128b1 257u +#define id_atxmega128a3 258u +#define id_atxmega128a3u 259u +#define id_atxmega128b3 260u +#define id_atxmega128c3 261u +#define id_atxmega128d3 262u +#define id_atxmega128a4 263u +#define id_atxmega128a4u 264u +#define id_atxmega128d4 265u +#define id_atxmega192a1 266u +#define id_atxmega192a3 267u +#define id_atxmega192a3u 268u +#define id_atxmega192c3 269u +#define id_atxmega192d3 270u +#define id_atxmega256a1 271u +#define id_atxmega256a3 272u +#define id_atxmega256a3b 273u +#define id_atxmega256a3bu 274u +#define id_atxmega256a3u 275u +#define id_atxmega256c3 276u +#define id_atxmega256d3 277u +#define id_atxmega384c3 278u +#define id_atxmega384d3 279u +#define id_attiny202 280u +#define id_attiny204 281u +#define id_attiny212 282u +#define id_attiny214 283u +#define id_attiny402 284u +#define id_attiny404 285u +#define id_attiny406 286u +#define id_attiny412 287u +#define id_attiny414 288u +#define id_attiny416 289u +#define id_attiny416auto 290u +#define id_attiny417 291u +#define id_attiny424 292u +#define id_attiny426 293u +#define id_attiny427 294u +#define id_attiny804 295u +#define id_attiny806 296u +#define id_attiny807 297u +#define id_attiny814 298u +#define id_attiny816 299u +#define id_attiny817 300u +#define id_attiny824 301u +#define id_attiny826 302u +#define id_attiny827 303u +#define id_attiny1604 304u +#define id_attiny1606 305u +#define id_attiny1607 306u +#define id_attiny1614 307u +#define id_attiny1616 308u +#define id_attiny1617 309u +#define id_attiny1624 310u +#define id_attiny1626 311u +#define id_attiny1627 312u +#define id_attiny3214 313u +#define id_attiny3216 314u +#define id_attiny3217 315u +#define id_attiny3224 316u +#define id_attiny3226 317u +#define id_attiny3227 318u +#define id_atmega808 319u +#define id_atmega809 320u +#define id_atmega1608 321u +#define id_atmega1609 322u +#define id_atmega3208 323u +#define id_atmega3209 324u +#define id_atmega4808 325u +#define id_atmega4809 326u +#define id_avr8ea28 327u +#define id_avr8ea32 328u +#define id_avr16dd14 329u +#define id_avr16dd20 330u +#define id_avr16dd28 331u +#define id_avr16ea28 332u +#define id_avr16dd32 333u +#define id_avr16ea32 334u +#define id_avr16ea48 335u +#define id_avr32dd14 336u +#define id_avr32dd20 337u +#define id_avr32da28 338u +#define id_avr32db28 339u +#define id_avr32dd28 340u +#define id_avr32ea28 341u +#define id_avr32da32 342u +#define id_avr32db32 343u +#define id_avr32dd32 344u +#define id_avr32ea32 345u +#define id_avr32da48 346u +#define id_avr32db48 347u +#define id_avr32ea48 348u +#define id_avr64dd14 349u +#define id_avr64dd20 350u +#define id_avr64da28 351u +#define id_avr64db28 352u +#define id_avr64dd28 353u +#define id_avr64ea28 354u +#define id_avr64da32 355u +#define id_avr64db32 356u +#define id_avr64dd32 357u +#define id_avr64ea32 358u +#define id_avr64da48 359u +#define id_avr64db48 360u +#define id_avr64ea48 361u +#define id_avr64da64 362u +#define id_avr64db64 363u +#define id_avr128da28 364u +#define id_avr128db28 365u +#define id_avr128da32 366u +#define id_avr128db32 367u +#define id_avr128da48 368u +#define id_avr128db48 369u +#define id_avr128da64 370u +#define id_avr128db64 371u + +// Interrupt vector table sizes (number of vectors) +#define vts_attiny4 10 +#define vts_attiny5 11 +#define vts_attiny9 10 +#define vts_attiny10 11 +#define vts_attiny20 17 +#define vts_attiny40 18 +#define vts_attiny102 16 +#define vts_attiny104 16 +#define vts_attiny11 5 +#define vts_attiny12 6 +#define vts_attiny13 10 +#define vts_attiny13a 10 +#define vts_attiny15 9 +#define vts_attiny22 3 +#define vts_attiny24 17 +#define vts_attiny24a 17 +#define vts_attiny25 15 +#define vts_attiny26 12 +#define vts_attiny28 6 +#define vts_attiny43u 16 +#define vts_attiny44 17 +#define vts_attiny44a 17 +#define vts_attiny45 15 +#define vts_attiny48 20 +#define vts_attiny84 17 +#define vts_attiny84a 17 +#define vts_attiny85 15 +#define vts_attiny87 20 +#define vts_attiny88 20 +#define vts_attiny167 20 +#define vts_attiny261 19 +#define vts_attiny261a 19 +#define vts_attiny441 30 +#define vts_attiny461 19 +#define vts_attiny461a 19 +#define vts_attiny828 26 +#define vts_attiny841 30 +#define vts_attiny861 19 +#define vts_attiny861a 19 +#define vts_attiny1634 28 +#define vts_attiny2313 19 +#define vts_attiny2313a 21 +#define vts_attiny4313 21 +#define vts_atmega8 19 +#define vts_atmega8a 19 +#define vts_atmega8hva 21 +#define vts_atmega8u2 29 +#define vts_atmega16 21 +#define vts_atmega16a 21 +#define vts_atmega16hva 21 +#define vts_atmega16hvb 29 +#define vts_atmega16hvbrevb 29 +#define vts_atmega16m1 31 +#define vts_atmega16hva2 22 +#define vts_atmega16u2 29 +#define vts_atmega16u4 43 +#define vts_atmega32 21 +#define vts_atmega32a 21 +#define vts_atmega32hvb 29 +#define vts_atmega32hvbrevb 29 +#define vts_atmega32c1 31 +#define vts_atmega32m1 31 +#define vts_atmega32u2 29 +#define vts_atmega32u4 43 +#define vts_atmega32u6 38 +#define vts_atmega48 26 +#define vts_atmega48a 26 +#define vts_atmega48p 26 +#define vts_atmega48pa 26 +#define vts_atmega48pb 27 +#define vts_atmega64 35 +#define vts_atmega64a 35 +#define vts_atmega64hve 25 +#define vts_atmega64c1 31 +#define vts_atmega64m1 31 +#define vts_atmega64hve2 25 +#define vts_atmega64rfr2 77 +#define vts_atmega88 26 +#define vts_atmega88a 26 +#define vts_atmega88p 26 +#define vts_atmega88pa 26 +#define vts_atmega88pb 27 +#define vts_atmega103 24 +#define vts_atmega128 35 +#define vts_atmega128a 35 +#define vts_atmega128rfa1 72 +#define vts_atmega128rfr2 77 +#define vts_atmega161 21 +#define vts_atmega162 28 +#define vts_atmega163 18 +#define vts_atmega164a 31 +#define vts_atmega164p 31 +#define vts_atmega164pa 31 +#define vts_atmega165 22 +#define vts_atmega165a 22 +#define vts_atmega165p 22 +#define vts_atmega165pa 22 +#define vts_atmega168 26 +#define vts_atmega168a 26 +#define vts_atmega168p 26 +#define vts_atmega168pa 26 +#define vts_atmega168pb 27 +#define vts_atmega169 23 +#define vts_atmega169a 23 +#define vts_atmega169p 23 +#define vts_atmega169pa 23 +#define vts_atmega256rfr2 77 +#define vts_atmega323 21 +#define vts_atmega324a 31 +#define vts_atmega324p 31 +#define vts_atmega324pa 31 +#define vts_atmega324pb 51 +#define vts_atmega325 22 +#define vts_atmega325a 22 +#define vts_atmega325p 22 +#define vts_atmega325pa 22 +#define vts_atmega328 26 +#define vts_atmega328p 26 +#define vts_atmega328pb 45 +#define vts_atmega329 23 +#define vts_atmega329a 23 +#define vts_atmega329p 23 +#define vts_atmega329pa 23 +#define vts_atmega406 23 +#define vts_atmega640 57 +#define vts_atmega644 28 +#define vts_atmega644a 31 +#define vts_atmega644p 31 +#define vts_atmega644pa 31 +#define vts_atmega644rfr2 77 +#define vts_atmega645 22 +#define vts_atmega645a 22 +#define vts_atmega645p 22 +#define vts_atmega649 23 +#define vts_atmega649a 23 +#define vts_atmega649p 23 +#define vts_atmega1280 57 +#define vts_atmega1281 57 +#define vts_atmega1284 35 +#define vts_atmega1284p 35 +#define vts_atmega1284rfr2 77 +#define vts_atmega2560 57 +#define vts_atmega2561 57 +#define vts_atmega2564rfr2 77 +#define vts_atmega3250 25 +#define vts_atmega3250a 25 +#define vts_atmega3250p 25 +#define vts_atmega3250pa 25 +#define vts_atmega3290 25 +#define vts_atmega3290a 25 +#define vts_atmega3290p 25 +#define vts_atmega3290pa 25 +#define vts_atmega6450 25 +#define vts_atmega6450a 25 +#define vts_atmega6450p 25 +#define vts_atmega6490 25 +#define vts_atmega6490a 25 +#define vts_atmega6490p 25 +#define vts_atmega8515 17 +#define vts_atmega8535 21 +#define vts_at86rf401 3 +#define vts_at90pwm1 32 +#define vts_at90pwm2 32 +#define vts_at90pwm2b 32 +#define vts_at90pwm3 32 +#define vts_at90pwm3b 32 +#define vts_at90can32 37 +#define vts_at90can64 37 +#define vts_at90pwm81 20 +#define vts_at90usb82 29 +#define vts_at90scr100 38 +#define vts_at90can128 37 +#define vts_at90pwm161 20 +#define vts_at90usb162 29 +#define vts_at90pwm216 32 +#define vts_at90pwm316 32 +#define vts_at90usb646 38 +#define vts_at90usb647 38 +#define vts_at90s1200 4 +#define vts_at90usb1286 38 +#define vts_at90usb1287 38 +#define vts_at90s2313 11 +#define vts_at90s2323 3 +#define vts_at90s2333 14 +#define vts_at90s2343 3 +#define vts_at90s4414 13 +#define vts_at90s4433 14 +#define vts_at90s4434 17 +#define vts_at90s8515 13 +#define vts_at90s8535 17 +#define vts_ata5272 37 +#define vts_ata5505 20 +#define vts_ata5700m322 51 +#define vts_ata5702m322 51 +#define vts_ata5781 42 +#define vts_ata5782 42 +#define vts_ata5783 42 +#define vts_ata5787 44 +#define vts_ata5790 30 +#define vts_ata5790n 31 +#define vts_ata5791 31 +#define vts_ata5795 23 +#define vts_ata5831 42 +#define vts_ata5832 42 +#define vts_ata5833 42 +#define vts_ata5835 44 +#define vts_ata6285 27 +#define vts_ata6286 27 +#define vts_ata6289 27 +#define vts_ata6612c 26 +#define vts_ata6613c 26 +#define vts_ata6614q 26 +#define vts_ata6616c 20 +#define vts_ata6617c 20 +#define vts_ata8210 42 +#define vts_ata8215 42 +#define vts_ata8510 42 +#define vts_ata8515 42 +#define vts_ata664251 20 +#define vts_atxmega8e5 43 +#define vts_atxmega16a4 94 +#define vts_atxmega16a4u 127 +#define vts_atxmega16c4 127 +#define vts_atxmega16d4 91 +#define vts_atxmega16e5 43 +#define vts_atxmega32c3 127 +#define vts_atxmega32d3 114 +#define vts_atxmega32a4 94 +#define vts_atxmega32a4u 127 +#define vts_atxmega32c4 127 +#define vts_atxmega32d4 91 +#define vts_atxmega32e5 43 +#define vts_atxmega64a1 125 +#define vts_atxmega64a1u 127 +#define vts_atxmega64b1 81 +#define vts_atxmega64a3 122 +#define vts_atxmega64a3u 127 +#define vts_atxmega64b3 54 +#define vts_atxmega64c3 127 +#define vts_atxmega64d3 114 +#define vts_atxmega64a4u 127 +#define vts_atxmega64d4 91 +#define vts_atxmega128a1 125 +#define vts_atxmega128a1u 127 +#define vts_atxmega128b1 81 +#define vts_atxmega128a3 122 +#define vts_atxmega128a3u 127 +#define vts_atxmega128b3 54 +#define vts_atxmega128c3 127 +#define vts_atxmega128d3 114 +#define vts_atxmega128a4u 127 +#define vts_atxmega128d4 91 +#define vts_atxmega192a3 122 +#define vts_atxmega192a3u 127 +#define vts_atxmega192c3 127 +#define vts_atxmega192d3 114 +#define vts_atxmega256a3 122 +#define vts_atxmega256a3b 122 +#define vts_atxmega256a3bu 127 +#define vts_atxmega256a3u 127 +#define vts_atxmega256c3 127 +#define vts_atxmega256d3 114 +#define vts_atxmega384c3 127 +#define vts_atxmega384d3 114 +#define vts_attiny202 26 +#define vts_attiny204 26 +#define vts_attiny212 26 +#define vts_attiny214 26 +#define vts_attiny402 26 +#define vts_attiny404 26 +#define vts_attiny406 26 +#define vts_attiny412 26 +#define vts_attiny414 26 +#define vts_attiny416 26 +#define vts_attiny416auto 26 +#define vts_attiny417 26 +#define vts_attiny424 30 +#define vts_attiny426 30 +#define vts_attiny427 30 +#define vts_attiny804 31 +#define vts_attiny806 31 +#define vts_attiny807 31 +#define vts_attiny814 26 +#define vts_attiny816 26 +#define vts_attiny817 26 +#define vts_attiny824 30 +#define vts_attiny826 30 +#define vts_attiny827 30 +#define vts_attiny1604 31 +#define vts_attiny1606 31 +#define vts_attiny1607 31 +#define vts_attiny1614 31 +#define vts_attiny1616 31 +#define vts_attiny1617 31 +#define vts_attiny1624 30 +#define vts_attiny1626 30 +#define vts_attiny1627 30 +#define vts_attiny3214 31 +#define vts_attiny3216 31 +#define vts_attiny3217 31 +#define vts_attiny3224 30 +#define vts_attiny3226 30 +#define vts_attiny3227 30 +#define vts_atmega808 36 +#define vts_atmega809 40 +#define vts_atmega1608 36 +#define vts_atmega1609 40 +#define vts_atmega3208 36 +#define vts_atmega3209 40 +#define vts_atmega4808 36 +#define vts_atmega4809 40 +#define vts_avr16dd14 36 +#define vts_avr16dd20 36 +#define vts_avr16dd28 36 +#define vts_avr16dd32 36 +#define vts_avr32dd14 36 +#define vts_avr32dd20 36 +#define vts_avr32da28 41 +#define vts_avr32db28 42 +#define vts_avr32dd28 36 +#define vts_avr32da32 44 +#define vts_avr32db32 44 +#define vts_avr32dd32 36 +#define vts_avr32da48 58 +#define vts_avr32db48 61 +#define vts_avr64dd14 36 +#define vts_avr64dd20 36 +#define vts_avr64da28 41 +#define vts_avr64db28 42 +#define vts_avr64dd28 36 +#define vts_avr64ea28 37 +#define vts_avr64da32 44 +#define vts_avr64db32 44 +#define vts_avr64dd32 36 +#define vts_avr64ea32 37 +#define vts_avr64da48 58 +#define vts_avr64db48 61 +#define vts_avr64ea48 45 +#define vts_avr64da64 64 +#define vts_avr64db64 65 +#define vts_avr128da28 41 +#define vts_avr128db28 42 +#define vts_avr128da32 44 +#define vts_avr128db32 44 +#define vts_avr128da48 58 +#define vts_avr128db48 61 +#define vts_avr128da64 64 +#define vts_avr128db64 65 + +// Suggested vector bootloader interrupt number (first unused vector or, failing that, slot just above vector table) +#define vbu_attiny4 10 +#define vbu_attiny5 11 +#define vbu_attiny9 10 +#define vbu_attiny10 11 +#define vbu_attiny20 17 +#define vbu_attiny40 18 +#define vbu_attiny102 16 +#define vbu_attiny104 16 +#define vbu_attiny11 5 +#define vbu_attiny12 6 +#define vbu_attiny13 10 +#define vbu_attiny13a 10 +#define vbu_attiny15 9 +#define vbu_attiny22 3 +#define vbu_attiny24 17 +#define vbu_attiny24a 17 +#define vbu_attiny25 15 +#define vbu_attiny26 12 +#define vbu_attiny28 6 +#define vbu_attiny43u 16 +#define vbu_attiny44 17 +#define vbu_attiny44a 17 +#define vbu_attiny45 15 +#define vbu_attiny48 20 +#define vbu_attiny84 17 +#define vbu_attiny84a 17 +#define vbu_attiny85 15 +#define vbu_attiny87 20 +#define vbu_attiny88 20 +#define vbu_attiny167 20 +#define vbu_attiny261 19 +#define vbu_attiny261a 19 +#define vbu_attiny441 30 +#define vbu_attiny461 19 +#define vbu_attiny461a 19 +#define vbu_attiny828 26 +#define vbu_attiny841 30 +#define vbu_attiny861 19 +#define vbu_attiny861a 19 +#define vbu_attiny1634 28 +#define vbu_attiny2313 19 +#define vbu_attiny2313a 21 +#define vbu_attiny4313 21 +#define vbu_atmega8 19 +#define vbu_atmega8a 19 +#define vbu_atmega8hva 21 +#define vbu_atmega8u2 29 +#define vbu_atmega16 21 +#define vbu_atmega16a 21 +#define vbu_atmega16hva 21 +#define vbu_atmega16hvb 29 +#define vbu_atmega16hvbrevb 29 +#define vbu_atmega16m1 31 +#define vbu_atmega16hva2 22 +#define vbu_atmega16u2 29 +#define vbu_atmega16u4 43 +#define vbu_atmega32 21 +#define vbu_atmega32a 21 +#define vbu_atmega32hvb 29 +#define vbu_atmega32hvbrevb 29 +#define vbu_atmega32c1 31 +#define vbu_atmega32m1 31 +#define vbu_atmega32u2 29 +#define vbu_atmega32u4 43 +#define vbu_atmega32u6 38 +#define vbu_atmega48 26 +#define vbu_atmega48a 26 +#define vbu_atmega48p 26 +#define vbu_atmega48pa 26 +#define vbu_atmega48pb 27 +#define vbu_atmega64 35 +#define vbu_atmega64a 35 +#define vbu_atmega64hve 25 +#define vbu_atmega64c1 31 +#define vbu_atmega64m1 31 +#define vbu_atmega64hve2 25 +#define vbu_atmega64rfr2 77 +#define vbu_atmega88 26 +#define vbu_atmega88a 26 +#define vbu_atmega88p 26 +#define vbu_atmega88pa 26 +#define vbu_atmega88pb 27 +#define vbu_atmega103 24 +#define vbu_atmega128 35 +#define vbu_atmega128a 35 +#define vbu_atmega128rfa1 72 +#define vbu_atmega128rfr2 77 +#define vbu_atmega161 21 +#define vbu_atmega162 28 +#define vbu_atmega163 18 +#define vbu_atmega164a 31 +#define vbu_atmega164p 31 +#define vbu_atmega164pa 31 +#define vbu_atmega165 22 +#define vbu_atmega165a 22 +#define vbu_atmega165p 22 +#define vbu_atmega165pa 22 +#define vbu_atmega168 26 +#define vbu_atmega168a 26 +#define vbu_atmega168p 26 +#define vbu_atmega168pa 26 +#define vbu_atmega168pb 27 +#define vbu_atmega169 23 +#define vbu_atmega169a 23 +#define vbu_atmega169p 23 +#define vbu_atmega169pa 23 +#define vbu_atmega256rfr2 77 +#define vbu_atmega323 21 +#define vbu_atmega324a 31 +#define vbu_atmega324p 31 +#define vbu_atmega324pa 31 +#define vbu_atmega324pb 51 +#define vbu_atmega325 22 +#define vbu_atmega325a 22 +#define vbu_atmega325p 22 +#define vbu_atmega325pa 22 +#define vbu_atmega328 26 +#define vbu_atmega328p 26 +#define vbu_atmega328pb 45 +#define vbu_atmega329 23 +#define vbu_atmega329a 23 +#define vbu_atmega329p 23 +#define vbu_atmega329pa 23 +#define vbu_atmega406 23 +#define vbu_atmega640 57 +#define vbu_atmega644 28 +#define vbu_atmega644a 31 +#define vbu_atmega644p 31 +#define vbu_atmega644pa 31 +#define vbu_atmega644rfr2 77 +#define vbu_atmega645 22 +#define vbu_atmega645a 22 +#define vbu_atmega645p 22 +#define vbu_atmega649 23 +#define vbu_atmega649a 23 +#define vbu_atmega649p 23 +#define vbu_atmega1280 57 +#define vbu_atmega1281 57 +#define vbu_atmega1284 35 +#define vbu_atmega1284p 35 +#define vbu_atmega1284rfr2 77 +#define vbu_atmega2560 57 +#define vbu_atmega2561 57 +#define vbu_atmega2564rfr2 77 +#define vbu_atmega3250 25 +#define vbu_atmega3250a 25 +#define vbu_atmega3250p 25 +#define vbu_atmega3250pa 25 +#define vbu_atmega3290 25 +#define vbu_atmega3290a 25 +#define vbu_atmega3290p 25 +#define vbu_atmega3290pa 25 +#define vbu_atmega6450 25 +#define vbu_atmega6450a 25 +#define vbu_atmega6450p 25 +#define vbu_atmega6490 25 +#define vbu_atmega6490a 25 +#define vbu_atmega6490p 25 +#define vbu_atmega8515 17 +#define vbu_atmega8535 21 +#define vbu_at86rf401 3 +#define vbu_at90pwm1 32 +#define vbu_at90pwm2 14 +#define vbu_at90pwm2b 32 +#define vbu_at90pwm3 32 +#define vbu_at90pwm3b 32 +#define vbu_at90can32 37 +#define vbu_at90can64 37 +#define vbu_at90pwm81 20 +#define vbu_at90usb82 29 +#define vbu_at90scr100 38 +#define vbu_at90can128 37 +#define vbu_at90pwm161 20 +#define vbu_at90usb162 29 +#define vbu_at90pwm216 32 +#define vbu_at90pwm316 32 +#define vbu_at90usb646 38 +#define vbu_at90usb647 38 +#define vbu_at90s1200 4 +#define vbu_at90usb1286 38 +#define vbu_at90usb1287 38 +#define vbu_at90s2313 11 +#define vbu_at90s2323 3 +#define vbu_at90s2333 14 +#define vbu_at90s2343 3 +#define vbu_at90s4414 13 +#define vbu_at90s4433 14 +#define vbu_at90s4434 17 +#define vbu_at90s8515 13 +#define vbu_at90s8535 17 +#define vbu_ata5272 17 +#define vbu_ata5505 20 +#define vbu_ata5700m322 51 +#define vbu_ata5702m322 51 +#define vbu_ata5781 42 +#define vbu_ata5782 42 +#define vbu_ata5783 42 +#define vbu_ata5787 44 +#define vbu_ata5790 30 +#define vbu_ata5790n 31 +#define vbu_ata5791 31 +#define vbu_ata5795 23 +#define vbu_ata5831 42 +#define vbu_ata5832 42 +#define vbu_ata5833 42 +#define vbu_ata5835 44 +#define vbu_ata6285 27 +#define vbu_ata6286 27 +#define vbu_ata6289 27 +#define vbu_ata6612c 26 +#define vbu_ata6613c 26 +#define vbu_ata6614q 26 +#define vbu_ata6616c 20 +#define vbu_ata6617c 20 +#define vbu_ata8210 42 +#define vbu_ata8215 42 +#define vbu_ata8510 42 +#define vbu_ata8515 42 +#define vbu_ata664251 20 +#define vbu_atxmega8e5 43 +#define vbu_atxmega16a4 36 +#define vbu_atxmega16a4u 36 +#define vbu_atxmega16c4 6 +#define vbu_atxmega16d4 6 +#define vbu_atxmega16e5 43 +#define vbu_atxmega32c3 6 +#define vbu_atxmega32d3 6 +#define vbu_atxmega32a4 36 +#define vbu_atxmega32a4u 36 +#define vbu_atxmega32c4 6 +#define vbu_atxmega32d4 6 +#define vbu_atxmega32e5 43 +#define vbu_atxmega64a1 102 +#define vbu_atxmega64a1u 102 +#define vbu_atxmega64b1 8 +#define vbu_atxmega64a3 75 +#define vbu_atxmega64a3u 75 +#define vbu_atxmega64b3 8 +#define vbu_atxmega64c3 6 +#define vbu_atxmega64d3 6 +#define vbu_atxmega64a4u 36 +#define vbu_atxmega64d4 6 +#define vbu_atxmega128a1 102 +#define vbu_atxmega128a1u 102 +#define vbu_atxmega128b1 8 +#define vbu_atxmega128a3 75 +#define vbu_atxmega128a3u 75 +#define vbu_atxmega128b3 8 +#define vbu_atxmega128c3 6 +#define vbu_atxmega128d3 6 +#define vbu_atxmega128a4u 36 +#define vbu_atxmega128d4 6 +#define vbu_atxmega192a3 75 +#define vbu_atxmega192a3u 75 +#define vbu_atxmega192c3 6 +#define vbu_atxmega192d3 6 +#define vbu_atxmega256a3 75 +#define vbu_atxmega256a3b 57 +#define vbu_atxmega256a3bu 57 +#define vbu_atxmega256a3u 75 +#define vbu_atxmega256c3 6 +#define vbu_atxmega256d3 6 +#define vbu_atxmega384c3 8 +#define vbu_atxmega384d3 6 +#define vbu_attiny202 4 +#define vbu_attiny204 5 +#define vbu_attiny212 4 +#define vbu_attiny214 5 +#define vbu_attiny402 4 +#define vbu_attiny404 5 +#define vbu_attiny406 14 +#define vbu_attiny412 4 +#define vbu_attiny414 5 +#define vbu_attiny416 26 +#define vbu_attiny416auto 26 +#define vbu_attiny417 26 +#define vbu_attiny424 30 +#define vbu_attiny426 30 +#define vbu_attiny427 30 +#define vbu_attiny804 14 +#define vbu_attiny806 14 +#define vbu_attiny807 14 +#define vbu_attiny814 5 +#define vbu_attiny816 26 +#define vbu_attiny817 26 +#define vbu_attiny824 30 +#define vbu_attiny826 30 +#define vbu_attiny827 30 +#define vbu_attiny1604 14 +#define vbu_attiny1606 14 +#define vbu_attiny1607 14 +#define vbu_attiny1614 5 +#define vbu_attiny1616 31 +#define vbu_attiny1617 31 +#define vbu_attiny1624 30 +#define vbu_attiny1626 30 +#define vbu_attiny1627 30 +#define vbu_attiny3214 31 +#define vbu_attiny3216 31 +#define vbu_attiny3217 31 +#define vbu_attiny3224 30 +#define vbu_attiny3226 30 +#define vbu_attiny3227 30 +#define vbu_atmega808 36 +#define vbu_atmega809 40 +#define vbu_atmega1608 36 +#define vbu_atmega1609 40 +#define vbu_atmega3208 36 +#define vbu_atmega3209 40 +#define vbu_atmega4808 36 +#define vbu_atmega4809 40 +#define vbu_avr16dd14 36 +#define vbu_avr16dd20 36 +#define vbu_avr16dd28 36 +#define vbu_avr16dd32 36 +#define vbu_avr32dd14 36 +#define vbu_avr32dd20 36 +#define vbu_avr32da28 41 +#define vbu_avr32db28 42 +#define vbu_avr32dd28 36 +#define vbu_avr32da32 41 +#define vbu_avr32db32 44 +#define vbu_avr32dd32 36 +#define vbu_avr32da48 58 +#define vbu_avr32db48 59 +#define vbu_avr64dd14 36 +#define vbu_avr64dd20 36 +#define vbu_avr64da28 41 +#define vbu_avr64db28 42 +#define vbu_avr64dd28 36 +#define vbu_avr64ea28 37 +#define vbu_avr64da32 41 +#define vbu_avr64db32 44 +#define vbu_avr64dd32 36 +#define vbu_avr64ea32 37 +#define vbu_avr64da48 58 +#define vbu_avr64db48 59 +#define vbu_avr64ea48 45 +#define vbu_avr64da64 64 +#define vbu_avr64db64 65 +#define vbu_avr128da28 41 +#define vbu_avr128db28 42 +#define vbu_avr128da32 41 +#define vbu_avr128db32 44 +#define vbu_avr128da48 58 +#define vbu_avr128db48 59 +#define vbu_avr128da64 64 +#define vbu_avr128db64 65 + +// Aliases for parts with the same vector table +#define vtab_attiny4 vtab_attiny9 +#define vtab_attiny5 vtab_attiny10 +#define vtab_attiny102 vtab_attiny104 +#define vtab_attiny13 vtab_attiny13a +#define vtab_attiny24 vtab_attiny84a +#define vtab_attiny24a vtab_attiny84a +#define vtab_attiny25 vtab_attiny85 +#define vtab_attiny44 vtab_attiny84a +#define vtab_attiny44a vtab_attiny84a +#define vtab_attiny45 vtab_attiny85 +#define vtab_attiny48 vtab_attiny88 +#define vtab_attiny84 vtab_attiny84a +#define vtab_attiny87 vtab_attiny167 +#define vtab_attiny261 vtab_attiny861a +#define vtab_attiny261a vtab_attiny861a +#define vtab_attiny441 vtab_attiny841 +#define vtab_attiny461 vtab_attiny861a +#define vtab_attiny461a vtab_attiny861a +#define vtab_attiny861 vtab_attiny861a +#define vtab_attiny2313a vtab_attiny4313 +#define vtab_atmega8 vtab_atmega8a +#define vtab_atmega8hva vtab_atmega16hva +#define vtab_atmega8u2 vtab_atmega32u2 +#define vtab_atmega16 vtab_atmega16a +#define vtab_atmega16hvb vtab_atmega32hvbrevb +#define vtab_atmega16hvbrevb vtab_atmega32hvbrevb +#define vtab_atmega16m1 vtab_atmega64m1 +#define vtab_atmega16u2 vtab_atmega32u2 +#define vtab_atmega16u4 vtab_atmega32u4 +#define vtab_atmega32 vtab_atmega323 +#define vtab_atmega32a vtab_atmega323 +#define vtab_atmega32hvb vtab_atmega32hvbrevb +#define vtab_atmega32c1 vtab_atmega64m1 +#define vtab_atmega32m1 vtab_atmega64m1 +#define vtab_atmega48 vtab_atmega328p +#define vtab_atmega48a vtab_atmega328p +#define vtab_atmega48p vtab_atmega328p +#define vtab_atmega48pa vtab_atmega328p +#define vtab_atmega48pb vtab_atmega168pb +#define vtab_atmega64 vtab_atmega128a +#define vtab_atmega64a vtab_atmega128a +#define vtab_atmega64hve vtab_atmega64hve2 +#define vtab_atmega64c1 vtab_atmega64m1 +#define vtab_atmega64rfr2 vtab_atmega2564rfr2 +#define vtab_atmega88 vtab_atmega328p +#define vtab_atmega88a vtab_atmega328p +#define vtab_atmega88p vtab_atmega328p +#define vtab_atmega88pa vtab_atmega328p +#define vtab_atmega88pb vtab_atmega168pb +#define vtab_atmega128 vtab_atmega128a +#define vtab_atmega128rfr2 vtab_atmega2564rfr2 +#define vtab_atmega164a vtab_atmega644pa +#define vtab_atmega164p vtab_atmega644pa +#define vtab_atmega164pa vtab_atmega644pa +#define vtab_atmega165 vtab_atmega645p +#define vtab_atmega165a vtab_atmega645p +#define vtab_atmega165p vtab_atmega645p +#define vtab_atmega165pa vtab_atmega645p +#define vtab_atmega168 vtab_atmega328 +#define vtab_atmega168a vtab_atmega328p +#define vtab_atmega168p vtab_atmega328p +#define vtab_atmega168pa vtab_atmega328p +#define vtab_atmega169 vtab_atmega649p +#define vtab_atmega169a vtab_atmega649p +#define vtab_atmega169p vtab_atmega649p +#define vtab_atmega169pa vtab_atmega649p +#define vtab_atmega256rfr2 vtab_atmega2564rfr2 +#define vtab_atmega324a vtab_atmega644pa +#define vtab_atmega324p vtab_atmega644pa +#define vtab_atmega324pa vtab_atmega644pa +#define vtab_atmega325 vtab_atmega645p +#define vtab_atmega325a vtab_atmega645p +#define vtab_atmega325p vtab_atmega645p +#define vtab_atmega325pa vtab_atmega645p +#define vtab_atmega329 vtab_atmega649p +#define vtab_atmega329a vtab_atmega649p +#define vtab_atmega329p vtab_atmega649p +#define vtab_atmega329pa vtab_atmega649p +#define vtab_atmega640 vtab_atmega2561 +#define vtab_atmega644a vtab_atmega644pa +#define vtab_atmega644p vtab_atmega644pa +#define vtab_atmega644rfr2 vtab_atmega2564rfr2 +#define vtab_atmega645 vtab_atmega645p +#define vtab_atmega645a vtab_atmega645p +#define vtab_atmega649 vtab_atmega649p +#define vtab_atmega649a vtab_atmega649p +#define vtab_atmega1280 vtab_atmega2561 +#define vtab_atmega1281 vtab_atmega2561 +#define vtab_atmega1284 vtab_atmega1284p +#define vtab_atmega1284rfr2 vtab_atmega2564rfr2 +#define vtab_atmega2560 vtab_atmega2561 +#define vtab_atmega3250 vtab_atmega6450p +#define vtab_atmega3250a vtab_atmega6450p +#define vtab_atmega3250p vtab_atmega6450p +#define vtab_atmega3250pa vtab_atmega6450p +#define vtab_atmega3290 vtab_atmega6490p +#define vtab_atmega3290a vtab_atmega6490p +#define vtab_atmega3290p vtab_atmega6490p +#define vtab_atmega3290pa vtab_atmega6490p +#define vtab_atmega6450 vtab_atmega6450p +#define vtab_atmega6450a vtab_atmega6450p +#define vtab_atmega6490 vtab_atmega6490p +#define vtab_atmega6490a vtab_atmega6490p +#define vtab_at90pwm1 vtab_at90pwm316 +#define vtab_at90pwm2b vtab_at90pwm3b +#define vtab_at90pwm3 vtab_at90pwm3b +#define vtab_at90can32 vtab_at90can128 +#define vtab_at90can64 vtab_at90can128 +#define vtab_at90pwm81 vtab_at90pwm161 +#define vtab_at90usb82 vtab_atmega32u2 +#define vtab_at90usb162 vtab_atmega32u2 +#define vtab_at90pwm216 vtab_at90pwm316 +#define vtab_at90usb646 vtab_atmega32u6 +#define vtab_at90usb647 vtab_atmega32u6 +#define vtab_at90usb1286 vtab_atmega32u6 +#define vtab_at90usb1287 vtab_atmega32u6 +#define vtab_at90s2323 vtab_attiny22 +#define vtab_at90s2333 vtab_at90s4433 +#define vtab_at90s2343 vtab_attiny22 +#define vtab_at90s4414 vtab_at90s8515 +#define vtab_at90s4434 vtab_at90s8535 +#define vtab_ata5505 vtab_attiny167 +#define vtab_ata5700m322 vtab_ata5702m322 +#define vtab_ata5781 vtab_ata8515 +#define vtab_ata5782 vtab_ata8515 +#define vtab_ata5783 vtab_ata8515 +#define vtab_ata5787 vtab_ata5835 +#define vtab_ata5790n vtab_ata5791 +#define vtab_ata5831 vtab_ata8515 +#define vtab_ata5832 vtab_ata8515 +#define vtab_ata5833 vtab_ata8515 +#define vtab_ata6285 vtab_ata6289 +#define vtab_ata6286 vtab_ata6289 +#define vtab_ata6612c vtab_atmega328p +#define vtab_ata6613c vtab_atmega328p +#define vtab_ata6614q vtab_atmega328p +#define vtab_ata6616c vtab_attiny167 +#define vtab_ata6617c vtab_attiny167 +#define vtab_ata8210 vtab_ata8515 +#define vtab_ata8215 vtab_ata8515 +#define vtab_ata8510 vtab_ata8515 +#define vtab_ata664251 vtab_attiny167 +#define vtab_atxmega8e5 vtab_atxmega32e5 +#define vtab_atxmega16a4 vtab_atxmega32a4 +#define vtab_atxmega16a4u vtab_atxmega128a4u +#define vtab_atxmega16c4 vtab_atxmega32c4 +#define vtab_atxmega16d4 vtab_atxmega32d4 +#define vtab_atxmega16e5 vtab_atxmega32e5 +#define vtab_atxmega32c3 vtab_atxmega256c3 +#define vtab_atxmega32d3 vtab_atxmega384d3 +#define vtab_atxmega32a4u vtab_atxmega128a4u +#define vtab_atxmega64a1 vtab_atxmega128a1 +#define vtab_atxmega64a1u vtab_atxmega128a1u +#define vtab_atxmega64b1 vtab_atxmega128b1 +#define vtab_atxmega64a3 vtab_atxmega256a3 +#define vtab_atxmega64a3u vtab_atxmega256a3u +#define vtab_atxmega64b3 vtab_atxmega128b3 +#define vtab_atxmega64c3 vtab_atxmega256c3 +#define vtab_atxmega64d3 vtab_atxmega384d3 +#define vtab_atxmega64a4u vtab_atxmega128a4u +#define vtab_atxmega64d4 vtab_atxmega128d4 +#define vtab_atxmega128a3 vtab_atxmega256a3 +#define vtab_atxmega128a3u vtab_atxmega256a3u +#define vtab_atxmega128c3 vtab_atxmega256c3 +#define vtab_atxmega128d3 vtab_atxmega384d3 +#define vtab_atxmega192a3 vtab_atxmega256a3 +#define vtab_atxmega192a3u vtab_atxmega256a3u +#define vtab_atxmega192c3 vtab_atxmega256c3 +#define vtab_atxmega192d3 vtab_atxmega384d3 +#define vtab_atxmega256d3 vtab_atxmega384d3 +#define vtab_attiny202 vtab_attiny402 +#define vtab_attiny204 vtab_attiny404 +#define vtab_attiny212 vtab_attiny412 +#define vtab_attiny214 vtab_attiny814 +#define vtab_attiny414 vtab_attiny814 +#define vtab_attiny416 vtab_attiny817 +#define vtab_attiny416auto vtab_attiny817 +#define vtab_attiny417 vtab_attiny817 +#define vtab_attiny424 vtab_attiny3227 +#define vtab_attiny426 vtab_attiny3227 +#define vtab_attiny427 vtab_attiny3227 +#define vtab_attiny804 vtab_attiny1607 +#define vtab_attiny806 vtab_attiny1607 +#define vtab_attiny807 vtab_attiny1607 +#define vtab_attiny816 vtab_attiny817 +#define vtab_attiny824 vtab_attiny3227 +#define vtab_attiny826 vtab_attiny3227 +#define vtab_attiny827 vtab_attiny3227 +#define vtab_attiny1604 vtab_attiny1607 +#define vtab_attiny1606 vtab_attiny1607 +#define vtab_attiny1616 vtab_attiny3217 +#define vtab_attiny1617 vtab_attiny3217 +#define vtab_attiny1624 vtab_attiny3227 +#define vtab_attiny1626 vtab_attiny3227 +#define vtab_attiny1627 vtab_attiny3227 +#define vtab_attiny3216 vtab_attiny3217 +#define vtab_attiny3224 vtab_attiny3227 +#define vtab_attiny3226 vtab_attiny3227 +#define vtab_atmega808 vtab_atmega4808 +#define vtab_atmega809 vtab_atmega4809 +#define vtab_atmega1608 vtab_atmega4808 +#define vtab_atmega1609 vtab_atmega4809 +#define vtab_atmega3208 vtab_atmega4808 +#define vtab_atmega3209 vtab_atmega4809 +#define vtab_avr16dd14 vtab_avr64dd32 +#define vtab_avr16dd20 vtab_avr64dd32 +#define vtab_avr16dd28 vtab_avr64dd32 +#define vtab_avr16dd32 vtab_avr64dd32 +#define vtab_avr32dd14 vtab_avr64dd32 +#define vtab_avr32dd20 vtab_avr64dd32 +#define vtab_avr32da28 vtab_avr128da28 +#define vtab_avr32db28 vtab_avr128db28 +#define vtab_avr32dd28 vtab_avr64dd32 +#define vtab_avr32da32 vtab_avr128da32 +#define vtab_avr32db32 vtab_avr128db32 +#define vtab_avr32dd32 vtab_avr64dd32 +#define vtab_avr32da48 vtab_avr128da48 +#define vtab_avr32db48 vtab_avr128db48 +#define vtab_avr64dd14 vtab_avr64dd32 +#define vtab_avr64dd20 vtab_avr64dd32 +#define vtab_avr64da28 vtab_avr128da28 +#define vtab_avr64db28 vtab_avr128db28 +#define vtab_avr64dd28 vtab_avr64dd32 +#define vtab_avr64ea28 vtab_avr64ea32 +#define vtab_avr64da32 vtab_avr128da32 +#define vtab_avr64db32 vtab_avr128db32 +#define vtab_avr64da48 vtab_avr128da48 +#define vtab_avr64db48 vtab_avr128db48 +#define vtab_avr64da64 vtab_avr128da64 +#define vtab_avr64db64 vtab_avr128db64 + +// Interrupt vector table interrupt names +extern const char * const vtab_attiny9[10]; // ATtiny9, ATtiny4 +extern const char * const vtab_attiny10[11]; // ATtiny10, ATtiny5 +extern const char * const vtab_attiny20[17]; // ATtiny20 +extern const char * const vtab_attiny40[18]; // ATtiny40 +extern const char * const vtab_attiny104[16]; // ATtiny104, ATtiny102 +extern const char * const vtab_attiny11[5]; // ATtiny11 +extern const char * const vtab_attiny12[6]; // ATtiny12 +extern const char * const vtab_attiny13a[10]; // ATtiny13A, ATtiny13 +extern const char * const vtab_attiny15[9]; // ATtiny15 +extern const char * const vtab_attiny22[3]; // ATtiny22, AT90S2343, AT90S2323 +extern const char * const vtab_attiny26[12]; // ATtiny26 +extern const char * const vtab_attiny28[6]; // ATtiny28 +extern const char * const vtab_attiny43u[16]; // ATtiny43U +extern const char * const vtab_attiny84a[17]; // ATtiny84A, ATtiny84, ATtiny44A, ATtiny44, ATtiny24A, ATtiny24 +extern const char * const vtab_attiny85[15]; // ATtiny85, ATtiny45, ATtiny25 +extern const char * const vtab_attiny88[20]; // ATtiny88, ATtiny48 +extern const char * const vtab_attiny167[20]; // ATtiny167, ATtiny87, ATA664251, ATA6617C, ATA6616C, ATA5505 +extern const char * const vtab_attiny828[26]; // ATtiny828 +extern const char * const vtab_attiny841[30]; // ATtiny841, ATtiny441 +extern const char * const vtab_attiny861a[19]; // ATtiny861A, ATtiny861, ATtiny461A, ATtiny461, ATtiny261A, ATtiny261 +extern const char * const vtab_attiny1634[28]; // ATtiny1634 +extern const char * const vtab_attiny2313[19]; // ATtiny2313 +extern const char * const vtab_attiny4313[21]; // ATtiny4313, ATtiny2313A +extern const char * const vtab_atmega8a[19]; // ATmega8A, ATmega8 +extern const char * const vtab_atmega16a[21]; // ATmega16A, ATmega16 +extern const char * const vtab_atmega16hva[21]; // ATmega16HVA, ATmega8HVA +extern const char * const vtab_atmega16hva2[22]; // ATmega16HVA2 +extern const char * const vtab_atmega32hvbrevb[29]; // ATmega32HVBrevB, ATmega32HVB, ATmega16HVBrevB, ATmega16HVB +extern const char * const vtab_atmega32u2[29]; // ATmega32U2, ATmega16U2, ATmega8U2, AT90USB162, AT90USB82 +extern const char * const vtab_atmega32u4[43]; // ATmega32U4, ATmega16U4 +extern const char * const vtab_atmega32u6[38]; // ATmega32U6, AT90USB1287, AT90USB1286, AT90USB647, AT90USB646 +extern const char * const vtab_atmega64m1[31]; // ATmega64M1, ATmega64C1, ATmega32M1, ATmega32C1, ATmega16M1 +extern const char * const vtab_atmega64hve2[25]; // ATmega64HVE2, ATmega64HVE +extern const char * const vtab_atmega103[24]; // ATmega103 +extern const char * const vtab_atmega128a[35]; // ATmega128A, ATmega128, ATmega64A, ATmega64 +extern const char * const vtab_atmega128rfa1[72]; // ATmega128RFA1 +extern const char * const vtab_atmega161[21]; // ATmega161 +extern const char * const vtab_atmega162[28]; // ATmega162 +extern const char * const vtab_atmega163[18]; // ATmega163 +extern const char * const vtab_atmega168pb[27]; // ATmega168PB, ATmega88PB, ATmega48PB +extern const char * const vtab_atmega323[21]; // ATmega323, ATmega32A, ATmega32 +extern const char * const vtab_atmega324pb[51]; // ATmega324PB +extern const char * const vtab_atmega328[26]; // ATmega328, ATmega168 +extern const char * const vtab_atmega328p[26]; // ATmega328P, ATmega168PA, ATmega168P, ATmega168A, ATmega88PA, ATmega88P, ATmega88A, ATmega88, ATmega48PA, ATmega48P, ATmega48A, ATmega48, ATA6614Q, ATA6613C, ATA6612C +extern const char * const vtab_atmega328pb[45]; // ATmega328PB +extern const char * const vtab_atmega406[23]; // ATmega406 +extern const char * const vtab_atmega644[28]; // ATmega644 +extern const char * const vtab_atmega644pa[31]; // ATmega644PA, ATmega644P, ATmega644A, ATmega324PA, ATmega324P, ATmega324A, ATmega164PA, ATmega164P, ATmega164A +extern const char * const vtab_atmega645p[22]; // ATmega645P, ATmega645A, ATmega645, ATmega325PA, ATmega325P, ATmega325A, ATmega325, ATmega165PA, ATmega165P, ATmega165A, ATmega165 +extern const char * const vtab_atmega649p[23]; // ATmega649P, ATmega649A, ATmega649, ATmega329PA, ATmega329P, ATmega329A, ATmega329, ATmega169PA, ATmega169P, ATmega169A, ATmega169 +extern const char * const vtab_atmega1284p[35]; // ATmega1284P, ATmega1284 +extern const char * const vtab_atmega2561[57]; // ATmega2561, ATmega2560, ATmega1281, ATmega1280, ATmega640 +extern const char * const vtab_atmega2564rfr2[77]; // ATmega2564RFR2, ATmega1284RFR2, ATmega644RFR2, ATmega256RFR2, ATmega128RFR2, ATmega64RFR2 +extern const char * const vtab_atmega6450p[25]; // ATmega6450P, ATmega6450A, ATmega6450, ATmega3250PA, ATmega3250P, ATmega3250A, ATmega3250 +extern const char * const vtab_atmega6490p[25]; // ATmega6490P, ATmega6490A, ATmega6490, ATmega3290PA, ATmega3290P, ATmega3290A, ATmega3290 +extern const char * const vtab_atmega8515[17]; // ATmega8515 +extern const char * const vtab_atmega8535[21]; // ATmega8535 +extern const char * const vtab_at86rf401[3]; // AT86RF401 +extern const char * const vtab_at90pwm2[32]; // AT90PWM2 +extern const char * const vtab_at90pwm3b[32]; // AT90PWM3B, AT90PWM3, AT90PWM2B +extern const char * const vtab_at90scr100[38]; // AT90SCR100 +extern const char * const vtab_at90can128[37]; // AT90CAN128, AT90CAN64, AT90CAN32 +extern const char * const vtab_at90pwm161[20]; // AT90PWM161, AT90PWM81 +extern const char * const vtab_at90pwm316[32]; // AT90PWM316, AT90PWM216, AT90PWM1 +extern const char * const vtab_at90s1200[4]; // AT90S1200 +extern const char * const vtab_at90s2313[11]; // AT90S2313 +extern const char * const vtab_at90s4433[14]; // AT90S4433, AT90S2333 +extern const char * const vtab_at90s8515[13]; // AT90S8515, AT90S4414 +extern const char * const vtab_at90s8535[17]; // AT90S8535, AT90S4434 +extern const char * const vtab_ata5272[37]; // ATA5272 +extern const char * const vtab_ata5702m322[51]; // ATA5702M322, ATA5700M322 +extern const char * const vtab_ata5790[30]; // ATA5790 +extern const char * const vtab_ata5791[31]; // ATA5791, ATA5790N +extern const char * const vtab_ata5795[23]; // ATA5795 +extern const char * const vtab_ata5835[44]; // ATA5835, ATA5787 +extern const char * const vtab_ata6289[27]; // ATA6289, ATA6286, ATA6285 +extern const char * const vtab_ata8515[42]; // ATA8515, ATA8510, ATA8215, ATA8210, ATA5833, ATA5832, ATA5831, ATA5783, ATA5782, ATA5781 +extern const char * const vtab_atxmega32a4[94]; // ATxmega32A4, ATxmega16A4 +extern const char * const vtab_atxmega32c4[127]; // ATxmega32C4, ATxmega16C4 +extern const char * const vtab_atxmega32d4[91]; // ATxmega32D4, ATxmega16D4 +extern const char * const vtab_atxmega32e5[43]; // ATxmega32E5, ATxmega16E5, ATxmega8E5 +extern const char * const vtab_atxmega128a1[125]; // ATxmega128A1, ATxmega64A1 +extern const char * const vtab_atxmega128a1u[127]; // ATxmega128A1U, ATxmega64A1U +extern const char * const vtab_atxmega128b1[81]; // ATxmega128B1, ATxmega64B1 +extern const char * const vtab_atxmega128b3[54]; // ATxmega128B3, ATxmega64B3 +extern const char * const vtab_atxmega128a4u[127]; // ATxmega128A4U, ATxmega64A4U, ATxmega32A4U, ATxmega16A4U +extern const char * const vtab_atxmega128d4[91]; // ATxmega128D4, ATxmega64D4 +extern const char * const vtab_atxmega256a3[122]; // ATxmega256A3, ATxmega192A3, ATxmega128A3, ATxmega64A3 +extern const char * const vtab_atxmega256a3b[122]; // ATxmega256A3B +extern const char * const vtab_atxmega256a3bu[127]; // ATxmega256A3BU +extern const char * const vtab_atxmega256a3u[127]; // ATxmega256A3U, ATxmega192A3U, ATxmega128A3U, ATxmega64A3U +extern const char * const vtab_atxmega256c3[127]; // ATxmega256C3, ATxmega192C3, ATxmega128C3, ATxmega64C3, ATxmega32C3 +extern const char * const vtab_atxmega384c3[127]; // ATxmega384C3 +extern const char * const vtab_atxmega384d3[114]; // ATxmega384D3, ATxmega256D3, ATxmega192D3, ATxmega128D3, ATxmega64D3, ATxmega32D3 +extern const char * const vtab_attiny402[26]; // ATtiny402, ATtiny202 +extern const char * const vtab_attiny404[26]; // ATtiny404, ATtiny204 +extern const char * const vtab_attiny406[26]; // ATtiny406 +extern const char * const vtab_attiny412[26]; // ATtiny412, ATtiny212 +extern const char * const vtab_attiny814[26]; // ATtiny814, ATtiny414, ATtiny214 +extern const char * const vtab_attiny817[26]; // ATtiny817, ATtiny816, ATtiny417, ATtiny416auto, ATtiny416 +extern const char * const vtab_attiny1607[31]; // ATtiny1607, ATtiny1606, ATtiny1604, ATtiny807, ATtiny806, ATtiny804 +extern const char * const vtab_attiny1614[31]; // ATtiny1614 +extern const char * const vtab_attiny3214[31]; // ATtiny3214 +extern const char * const vtab_attiny3217[31]; // ATtiny3217, ATtiny3216, ATtiny1617, ATtiny1616 +extern const char * const vtab_attiny3227[30]; // ATtiny3227, ATtiny3226, ATtiny3224, ATtiny1627, ATtiny1626, ATtiny1624, ATtiny827, ATtiny826, ATtiny824, ATtiny427, ATtiny426, ATtiny424 +extern const char * const vtab_atmega4808[36]; // ATmega4808, ATmega3208, ATmega1608, ATmega808 +extern const char * const vtab_atmega4809[40]; // ATmega4809, ATmega3209, ATmega1609, ATmega809 +extern const char * const vtab_avr64dd32[36]; // AVR64DD32, AVR64DD28, AVR64DD20, AVR64DD14, AVR32DD32, AVR32DD28, AVR32DD20, AVR32DD14, AVR16DD32, AVR16DD28, AVR16DD20, AVR16DD14 +extern const char * const vtab_avr64ea32[37]; // AVR64EA32, AVR64EA28 +extern const char * const vtab_avr64ea48[45]; // AVR64EA48 +extern const char * const vtab_avr128da28[41]; // AVR128DA28, AVR64DA28, AVR32DA28 +extern const char * const vtab_avr128db28[42]; // AVR128DB28, AVR64DB28, AVR32DB28 +extern const char * const vtab_avr128da32[44]; // AVR128DA32, AVR64DA32, AVR32DA32 +extern const char * const vtab_avr128db32[44]; // AVR128DB32, AVR64DB32, AVR32DB32 +extern const char * const vtab_avr128da48[58]; // AVR128DA48, AVR64DA48, AVR32DA48 +extern const char * const vtab_avr128db48[61]; // AVR128DB48, AVR64DB48, AVR32DB48 +extern const char * const vtab_avr128da64[64]; // AVR128DA64, AVR64DA64 +extern const char * const vtab_avr128db64[65]; // AVR128DB64, AVR64DB64 + +const uPcore_t uP_table[372]; + +#endif diff --git a/src/avrpart.c b/src/avrpart.c index fb04a157..1e4fefee 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -583,6 +583,7 @@ AVRPART *avr_new_part(void) { p->mem_alias = lcreat(NULL, 0); // Default values + p->mcuid = -1; p->hvupdi_variant = -1; memset(p->signature, 0xFF, 3); p->reset_disposition = RESET_DEDICATED; diff --git a/src/config.c b/src/config.c index 531dac83..ebef8f4b 100644 --- a/src/config.c +++ b/src/config.c @@ -31,6 +31,7 @@ #include "avrdude.h" #include "libavrdude.h" #include "config.h" +#include "avrintel.h" #include "config_gram.h" @@ -834,3 +835,42 @@ void cfg_assign(char *sp, int strct, Component_t *cp, VALUE *v) { cp->name, cfg_strct_name(strct), cfg_comp_type(cp->type)); } } + +// Automatically assign an mcuid if known from avrintel.c table +void cfg_update_mcuid(AVRPART *part) { + // Don't assign an mcuid for template parts that has a space in desc + if(!part->desc || *part->desc == 0 || strchr(part->desc, ' ')) + return; + + // Don't assign an mcuid for template parts where id starts with "." + if(!part->id || !*part->id || *part->id == '.') + return; + + // Don't assign an mcuid for 32-bit AVR parts + if(part->prog_modes & PM_aWire) + return; + + // Find an entry that shares the same name + for(int i=0; i < sizeof uP_table/sizeof *uP_table; i++) { + if(strcasecmp(part->desc, uP_table[i].name) == 0) { + if(part->mcuid != (int) uP_table[i].mcuid) { + part->mcuid = uP_table[i].mcuid; + yywarning("assigned mcuid = %d to part %s", part->mcuid, part->desc); + } + return; + } + } + + // None have the same name: an entry with part->mcuid is an error + for(int i=0; i < sizeof uP_table/sizeof *uP_table; i++) + if(part->mcuid == (int) uP_table[i].mcuid) { + yywarning("mcuid %d is reserved for %s, use a free number >= %d", + part->mcuid, uP_table[i].name, sizeof uP_table/sizeof *uP_table); + return; + } + + // Range check + if(part->mcuid < 0 || part->mcuid >= UB_N_MCU) + yywarning("mcuid %d for %s is out of range [0..%d], use a free number >= %d", + part->mcuid, part->desc, UB_N_MCU-1, sizeof uP_table/sizeof *uP_table); +} diff --git a/src/config.h b/src/config.h index e92400b6..8bacda42 100644 --- a/src/config.h +++ b/src/config.h @@ -161,6 +161,7 @@ const char *cfg_strct_name(int strct); void cfg_assign(char *sp, int strct, Component_t *cp, VALUE *v); +void cfg_update_mcuid(AVRPART *part); #ifdef __cplusplus } diff --git a/src/config_gram.y b/src/config_gram.y index f8a20629..5c5a687d 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -374,6 +374,8 @@ part_def : YYABORT; } + cfg_update_mcuid(current_part); + // Sanity checks for memory sizes and compute/override num_pages entry for (ln=lfirst(current_part->mem); ln; ln=lnext(ln)) { m = ldata(ln); diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index 19d019c5..8b955d44 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -1766,7 +1766,7 @@ part id = ; # quoted string family_id = ; # quoted string, eg, "megaAVR" or "tinyAVR" prog_modes = PM_ @{ | PM_ @} # interfaces, eg, PM_SPM|PM_ISP|PM_HVPP|PM_debugWIRE - mcuid = ; # unique id in 0..2039 for urclock programmer + mcuid = ; # unique id in 0..2039 for 8-bit AVRs n_interrupts = ; # number of interrupts, used for vector bootloaders n_page_erase = ; # if set, number of pages erased during NVM erase hvupdi_variant = ; # numeric -1 (n/a) or 0..2 From 4f7868ef4bf66e9c59851ca20a219425c0480845 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 30 Aug 2022 19:54:41 +0100 Subject: [PATCH 225/511] Declare rather than define extern const uPcore_t uP_table[372]; --- src/avrintel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/avrintel.h b/src/avrintel.h index d8bc07ec..b4f40a44 100644 --- a/src/avrintel.h +++ b/src/avrintel.h @@ -1472,6 +1472,6 @@ extern const char * const vtab_avr128db48[61]; // AVR128DB48, AVR64DB48, AVR3 extern const char * const vtab_avr128da64[64]; // AVR128DA64, AVR64DA64 extern const char * const vtab_avr128db64[65]; // AVR128DB64, AVR64DB64 -const uPcore_t uP_table[372]; +extern const uPcore_t uP_table[372]; #endif From ffb8b7fcdf98df1d21ecac10c8f6b39019dbee4e Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 30 Aug 2022 21:31:11 +0100 Subject: [PATCH 226/511] Try different header files for Windows compatibility --- src/avrintel.c | 11 +++++++++++ src/avrintel.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/avrintel.c b/src/avrintel.c index c31b01eb..edf7d114 100644 --- a/src/avrintel.c +++ b/src/avrintel.c @@ -13,6 +13,17 @@ * */ +#include "ac_cfg.h" + +#include +#include +#include +#include +#include +#include +#include +#include + #include "avrintel.h" const uPcore_t uP_table[] = { // Value of -1 typically means unknown diff --git a/src/avrintel.h b/src/avrintel.h index b4f40a44..69f4862c 100644 --- a/src/avrintel.h +++ b/src/avrintel.h @@ -16,7 +16,7 @@ #ifndef AVRINTEL_H #define AVRINTEL_H -#include "config.h" +#include "libavrdude.h" typedef struct { // Value of -1 typically means unknown const char *name; // Name of part From b328067f874b782774cf00e4029d84f6fe0711c9 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 30 Aug 2022 23:25:00 +0100 Subject: [PATCH 227/511] Remove has_jtag, has_debugwire, etc assignments in avrdude.conf.in These assignments have been removed as they are redundant and only imitate the single prog_modes = PM_... | PM_....; assignment. They are still allowed in the grammar, and would still work. --- src/avrdude.conf.in | 67 --------------------------------------------- 1 file changed, 67 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 197663ef..df64dfea 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -2323,7 +2323,6 @@ programmer hvupdi_support = 1; ; - # # PART DEFINITIONS # @@ -2502,7 +2501,6 @@ part stk500_devcode = 0x14; chip_erase_delay = 4000; signature = 0x1e 0x90 0x07; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -3551,7 +3549,6 @@ part bs2 = 0xa0; signature = 0x1e 0x96 0x02; reset = io; - has_jtag = yes; allowfullpagebitstream = yes; timeout = 200; stabdelay = 100; @@ -3681,7 +3678,6 @@ part bs2 = 0xa0; signature = 0x1e 0x97 0x02; reset = io; - has_jtag = yes; allowfullpagebitstream = yes; timeout = 200; stabdelay = 100; @@ -3812,7 +3808,6 @@ part # avr910_devcode = 0x43; signature = 0x1e 0x97 0x81; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -3936,7 +3931,6 @@ part # avr910_devcode = 0x43; signature = 0x1e 0x96 0x81; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -4060,7 +4054,6 @@ part # avr910_devcode = 0x43; signature = 0x1e 0x95 0x81; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -4184,7 +4177,6 @@ part bs2 = 0xa0; signature = 0x1e 0x94 0x03; reset = io; - has_jtag = yes; allowfullpagebitstream = yes; timeout = 200; stabdelay = 100; @@ -4310,7 +4302,6 @@ part bs2 = 0xa0; signature = 0x1e 0x95 0x08; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -4508,7 +4499,6 @@ part bs2 = 0xa0; signature = 0x1e 0x96 0x09; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -4664,7 +4654,6 @@ part bs2 = 0xa0; signature = 0x1e 0x97 0x06; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -4800,7 +4789,6 @@ part bs2 = 0xa0; signature = 0x1e 0x94 0x04; reset = io; - has_jtag = yes; allowfullpagebitstream = yes; timeout = 200; stabdelay = 100; @@ -5023,7 +5011,6 @@ part avr910_devcode = 0x78; chip_erase_delay = 9000; signature = 0x1e 0x94 0x05; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -5181,7 +5168,6 @@ part chip_erase_delay = 9000; signature = 0x1e 0x95 0x03; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -5385,7 +5371,6 @@ part chip_erase_delay = 9000; signature = 0x1e 0x96 0x03; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -5567,7 +5552,6 @@ part bs2 = 0xa0; signature = 0x1e 0x95 0x02; reset = io; - has_jtag = yes; allowfullpagebitstream = yes; timeout = 200; stabdelay = 100; @@ -6218,7 +6202,6 @@ part # stk500_devcode = 0x21; # avr910_devcode = 0x5e; signature = 0x1e 0x91 0x0c; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -6355,7 +6338,6 @@ part # stk500_devcode = 0x21; # avr910_devcode = 0x5e; signature = 0x1e 0x92 0x08; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -6492,7 +6474,6 @@ part # stk500_devcode = 0x21; # avr910_devcode = 0x5e; signature = 0x1e 0x93 0x0d; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -6682,7 +6663,6 @@ part # avr910_devcode = 0x??; signature = 0x1e 0x92 0x05; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -6855,7 +6835,6 @@ part # avr910_devcode = 0x??; signature = 0x1e 0x93 0x0a; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -7029,7 +7008,6 @@ part # avr910_devcode = 0x??; signature = 0x1e 0x94 0x06; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -7203,7 +7181,6 @@ part # avr910_devcode = 0x??; signature = 0x1e 0x93 0x14; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -7341,7 +7318,6 @@ part chip_erase_delay = 15000; signature = 0x1e 0x93 0x87; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -7469,7 +7445,6 @@ part chip_erase_delay = 15000; signature = 0x1e 0x94 0x87; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -7596,7 +7571,6 @@ part # avr910_devcode = 0x??; signature = 0x1e 0x92 0x09; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -7725,7 +7699,6 @@ part # avr910_devcode = 0x??; signature = 0x1e 0x93 0x11; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -7854,7 +7827,6 @@ part # avr910_devcode = 0x??; signature = 0x1e 0x95 0x14; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -8069,7 +8041,6 @@ part bs2 = 0xd6; signature = 0x1e 0x91 0x0a; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -8214,7 +8185,6 @@ part bs2 = 0xd6; signature = 0x1e 0x92 0x0d; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -8342,7 +8312,6 @@ part # avr910_devcode = ?; signature = 0x1e 0x93 0x81; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -8543,7 +8512,6 @@ part chip_erase_delay = 4500; signature = 0x1e 0x91 0x08; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -8673,7 +8641,6 @@ part chip_erase_delay = 4500; signature = 0x1e 0x92 0x06; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -8804,7 +8771,6 @@ part chip_erase_delay = 4500; signature = 0x1e 0x93 0x0b; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -8935,7 +8901,6 @@ part bs2 = 0xa0; signature = 0x1e 0x96 0x08; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -9059,7 +9024,6 @@ part bs2 = 0xa0; signature = 0x1e 0x97 0x03; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -9196,7 +9160,6 @@ part bs2 = 0xa0; signature = 0x1e 0x98 0x01; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -9456,7 +9419,6 @@ part chip_erase_delay = 4500; signature = 0x1e 0x91 0x0b; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -9597,7 +9559,6 @@ part chip_erase_delay = 4500; signature = 0x1e 0x92 0x07; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -9738,7 +9699,6 @@ part chip_erase_delay = 4500; signature = 0x1e 0x93 0x0c; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -9930,7 +9890,6 @@ part chip_erase_delay = 1000; signature = 0x1e 0x92 0x0c; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -10061,7 +10020,6 @@ part signature = 0x1e 0x94 0x88; usbpid = 0x2ff4; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -10186,7 +10144,6 @@ part signature = 0x1e 0x95 0x87; usbpid = 0x2ff4; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -10311,7 +10268,6 @@ part signature = 0x1e 0x96 0x82; usbpid = 0x2ff9; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -10447,7 +10403,6 @@ part signature = 0x1e 0x97 0x82; usbpid = 0x2ffb; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -10581,7 +10536,6 @@ part signature = 0x1e 0x94 0x82; usbpid = 0x2ffa; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -10702,7 +10656,6 @@ part signature = 0x1e 0x93 0x82; usbpid = 0x2ff7; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -10823,7 +10776,6 @@ part signature = 0x1e 0x95 0x8a; usbpid = 0x2ff0; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -10944,7 +10896,6 @@ part signature = 0x1e 0x94 0x89; usbpid = 0x2fef; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -11065,7 +11016,6 @@ part signature = 0x1e 0x93 0x89; usbpid = 0x2fee; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -11187,7 +11137,6 @@ part bs2 = 0xa0; signature = 0x1e 0x94 0x10; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -11343,7 +11292,6 @@ part bs2 = 0xa0; signature = 0x1e 0x95 0x05; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -11502,7 +11450,6 @@ part bs2 = 0xa0; signature = 0x1e 0x96 0x05; reset = io; - has_jtag = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -11723,7 +11670,6 @@ part desc = "AVR XMEGA family common values"; id = ".xmega"; prog_modes = PM_SPM | PM_PDI; - has_pdi = yes; mcu_base = 0x0090; nvm_base = 0x01c0; @@ -12060,7 +12006,6 @@ part parent "x64a4u" mcuid = 243; n_interrupts = 125; signature = 0x1e 0x96 0x4e; - has_jtag = yes; memory "fuse0" size = 1; @@ -12235,7 +12180,6 @@ part parent "x128c3" mcuid = 254; n_interrupts = 125; signature = 0x1e 0x97 0x4c; - has_jtag = yes; memory "fuse0" size = 1; @@ -12301,7 +12245,6 @@ part parent ".xmega" prog_modes = PM_SPM | PM_PDI | PM_JTAG; mcuid = 263; signature = 0x1e 0x97 0x46; - has_jtag = yes; memory "eeprom" size = 2048; @@ -12418,7 +12361,6 @@ part parent ".xmega" n_interrupts = 81; signature = 0x1e 0x97 0x4d; usbpid = 0x2fea; - has_jtag = yes; memory "eeprom" size = 2048; @@ -12558,7 +12500,6 @@ part parent "x192c3" prog_modes = PM_SPM | PM_PDI | PM_JTAG; mcuid = 266; signature = 0x1e 0x97 0x4e; - has_jtag = yes; memory "fuse0" size = 1; @@ -12666,7 +12607,6 @@ part parent "x256c3" id = "x256a1"; prog_modes = PM_SPM | PM_PDI | PM_JTAG; mcuid = 271; - has_jtag = yes; memory "fuse0" size = 1; @@ -12960,8 +12900,6 @@ part id = "uc3a0512"; prog_modes = PM_JTAG | PM_aWire; signature = 0xed 0xc0 0x3f; - has_jtag = yes; - is_avr32 = yes; memory "flash" paged = yes; @@ -13000,7 +12938,6 @@ part # avr910_devcode = 0x??; signature = 0x1e 0x94 0x12; reset = io; - has_debugwire = yes; timeout = 200; stabdelay = 100; cmdexedelay = 25; @@ -13128,7 +13065,6 @@ part desc = "Common values for reduced core tinys"; id = ".reduced_core_tiny"; prog_modes = PM_TPI; - has_tpi = yes; memory "fuse" size = 1; @@ -13313,7 +13249,6 @@ part bs2 = 0xa0; signature = 0x1e 0x95 0x07; reset = io; - has_jtag = yes; serial = no; # STK500v2 HV programming parameters, from XML pp_controlstack = @@ -13371,7 +13306,6 @@ part desc = "AVR8X family common values"; id = ".avr8x"; prog_modes = PM_SPM | PM_UPDI; - has_updi = yes; nvm_base = 0x1000; ocd_base = 0x0f80; @@ -14745,7 +14679,6 @@ part prog_modes = PM_SPM | PM_UPDI; # Dedicated UPDI pin, no HV hvupdi_variant = 1; - has_updi = yes; nvm_base = 0x1000; ocd_base = 0x0f80; From 40896802af9f20658a362ac0a0af962a582ad40f Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 31 Aug 2022 11:29:06 +0100 Subject: [PATCH 228/511] Allow integer expressions in config file where numbers are expected Notable exceptions are for pin numbers and where numbers are separated by space only, eg, in signature and readback assignments. --- src/avrdude.conf.in | 148 +++++++++++++++++++++---------------------- src/config_gram.y | 132 +++++++++++++++++++------------------- src/doc/avrdude.texi | 125 ++++++++++++++++++++---------------- src/lexer.l | 2 +- 4 files changed, 213 insertions(+), 194 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index df64dfea..1152af77 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -17,51 +17,49 @@ # Possible entry formats are: # # programmer -# parent # optional parent -# id = [, [, ] ...] ; # are quoted strings -# desc = ; # quoted string -# type = ; # programmer type, quoted string -# # supported types can be listed by "-c ?type" -# prog_modes = PM_ {| PM_} # interfaces, eg, PM_SPM|PM_PDI (1) +# parent # optional parent +# id = [, ... ] ; # are quoted strings +# desc = ; # quoted string +# type = ; # programmer type, quoted string +# # supported types can be listed by "-c ?type" +# prog_modes = PM_ {| PM_} # interfaces, eg, PM_SPM|PM_PDI (1) # connection_type = parallel | serial | usb | spi -# baudrate = ; # baudrate for avr910-programmer -# vcc = [, ... ] ; # pin number(s) -# buff = [, ... ] ; # pin number(s) -# reset = ; # pin number -# sck = ; # pin number -# mosi = ; # pin number -# miso = ; # pin number -# errled = ; # pin number -# rdyled = ; # pin number -# pgmled = ; # pin number -# vfyled = ; # pin number -# usbvid = ; # USB VID (Vendor ID) -# usbpid = [, ...] ; # USB PID (Product ID) (2) -# usbdev = ; # USB interface or other device info -# usbvendor = ; # USB Vendor Name -# usbproduct = ; # USB Product Name -# usbsn = ; # USB Serial Number -# hvupdi_support = [, , ... ] ; # UPDI HV Variants Support +# baudrate = ; # baudrate for avr910-programmer +# vcc = [, ... ] ; # pin number(s) +# buff = [, ... ] ; # pin number(s) +# reset = ; # pin number +# sck = ; # pin number +# mosi = ; # pin number +# miso = ; # pin number +# errled = ; # pin number +# rdyled = ; # pin number +# pgmled = ; # pin number +# vfyled = ; # pin number +# usbvid = ; # USB VID (Vendor ID) +# usbpid = [, ...] ; # USB PID (Product ID) (2) +# usbdev = ; # USB interface or other device info +# usbvendor = ; # USB Vendor Name +# usbproduct = ; # USB Product Name +# usbsn = ; # USB Serial Number +# hvupdi_support = [, , ... ] ; # UPDI HV Variants Support # ; # -# # To invert a bit, use = ~ , the spaces are important. -# # For a pin list all pins must be inverted. -# # A single pin can be specified as usual = ~ , for lists -# # specify it as follows = ~ ( [, ... ] ). -# # -# # (1) The following program modes are known: -# # - PM_SPM: Bootloaders, self-programming with SPM opcodes or NVM Controllers -# # - PM_TPI: Tiny Programming Interface (t4, t5, t9, t10, t20, t40, t102, t104) -# # - PM_ISP: SPI programming for In-System Programming (almost all classic parts) -# # - PM_PDI: Program and Debug Interface (xmega parts) -# # - PM_UPDI: Unified Program and Debug Interface -# # - PM_HVSP: High Voltage Serial Programming (some classic parts) -# # - PM_HVPP: High Voltage Parallel Programming (most non-HVSP classic parts) -# # - PM_debugWIRE: Simpler alternative to JTAG (a subset of HVPP/HVSP parts) -# # - PM_JTAG: Joint Test Action Group standard (some classic parts, some xmega) -# # - PM_aWire: AVR32 parts -# # -# # (2) Not all programmer types can process a list of PIDs +# # To invert a pin use = ~ +# # To invert a pin list (all pins get inverted) use ~ ( [, ... ] ) +# # +# # (1) The following program modes are known: +# # - PM_SPM: Bootloaders, self-programming with SPM opcodes or NVM Controllers +# # - PM_TPI: Tiny Programming Interface (t4, t5, t9, t10, t20, t40, t102, t104) +# # - PM_ISP: SPI programming for In-System Programming (almost all classic parts) +# # - PM_PDI: Program and Debug Interface (xmega parts) +# # - PM_UPDI: Unified Program and Debug Interface +# # - PM_HVSP: High Voltage Serial Programming (some classic parts) +# # - PM_HVPP: High Voltage Parallel Programming (most non-HVSP classic parts) +# # - PM_debugWIRE: Simpler alternative to JTAG (a subset of HVPP/HVSP parts) +# # - PM_JTAG: Joint Test Action Group standard (some classic parts, some xmega) +# # - PM_aWire: AVR32 parts +# # +# # (2) Not all programmer types can process a list of PIDs # # part # desc = ; # quoted string @@ -75,13 +73,12 @@ # devicecode = ; # deprecated, use stk500_devcode # stk500_devcode = ; # numeric # avr910_devcode = ; # numeric -# has_jtag = ; # part has JTAG i/f -# has_debugwire = ; # part has debugWire i/f -# has_pdi = ; # part has PDI i/f -# has_updi = ; # part has UPDI i/f -# has_tpi = ; # part has TPI i/f -# is_avr32 = ; # AVR32 part -# +# has_jtag = ; # part has JTAG i/f (deprecated, use prog_modes) +# has_debugwire = ; # part has debugWire i/f (deprecated, use prog_modes) +# has_pdi = ; # part has PDI i/f (deprecated, use prog_modes) +# has_updi = ; # part has UPDI i/f (deprecated, use prog_modes) +# has_tpi = ; # part has TPI i/f (deprecated, use prog_modes) +# is_avr32 = ; # AVR32 part (deprecated, use prog_modes) # is_at90s1200 = ; # AT90S1200 part # signature = ; # signature bytes # usbpid = ; # DFU USB PID @@ -94,7 +91,7 @@ # bs2 = ; # pin name in hex, i.e., 0xA0 # serial = ; # can use serial downloading # parallel = ; # can use par. programming -# # STK500v2 parameters, to be taken from Atmel's XML files +# # STK500v2 parameters, to be taken from Atmel's ATDF files # timeout = ; # stabdelay = ; # cmdexedelay = ; @@ -106,13 +103,13 @@ # postdelay = ; # pollmethod = ; # hvspcmdexedelay = ; -# # STK500v2 HV programming parameters, from XML -# pp_controlstack = , , ... ; # PP only -# hvsp_controlstack = , , ... ; # HVSP only +# # STK500v2 HV programming parameters, from ATDFs +# pp_controlstack = , , ... ; # PP only +# hvsp_controlstack = , , ... ; # HVSP only # flash_instr = , , ; # eeprom_instr = , , ... ; # hventerstabdelay = ; -# progmodedelay = ; # PP only +# progmodedelay = ; # PP only # latchcycles = ; # togglevtg = ; # poweroffdelay = ; @@ -120,21 +117,21 @@ # resetdelayus = ; # hvleavestabdelay = ; # resetdelay = ; -# synchcycles = ; # HVSP only -# chiperasepulsewidth = ; # PP only +# synchcycles = ; # HVSP only +# chiperasepulsewidth = ; # PP only # chiperasepolltimeout = ; -# chiperasetime = ; # HVSP only -# programfusepulsewidth = ; # PP only +# chiperasetime = ; # HVSP only +# programfusepulsewidth = ; # PP only # programfusepolltimeout = ; -# programlockpulsewidth = ; # PP only +# programlockpulsewidth = ; # PP only # programlockpolltimeout = ; -# # JTAG ICE mkII parameters, also from XML files +# # JTAG ICE mkII parameters, also from ATDF files # allowfullpagebitstream = ; # enablepageprogramming = ; -# idr = ; # IO addr of IDR (OCD) reg -# rampz = ; # IO addr of RAMPZ reg -# spmcr = ; # mem addr of SPMC[S]R reg -# eecr = ; # mem addr of EECR reg only when != 0x3f +# idr = ; # IO addr of IDR (OCD) reg +# rampz = ; # IO addr of RAMPZ reg +# spmcr = ; # mem addr of SPMC[S]R reg +# eecr = ; # mem addr of EECR reg only when != 0x3f # mcu_base = ; # nvm_base = ; # ocd_base = ; @@ -154,7 +151,7 @@ # readback_p1 = ; # byte value (first component) # readback_p2 = ; # byte value (second component) # pwroff_after_write = ; # yes/no -# mode = ; # STK500 v2 file parameter, to be taken from Atmel's XML files +# mode = ; # STK500 v2 file parameter from ATDF files # delay = ; # " # blocksize = ; # " # readsize = ; # " @@ -171,10 +168,13 @@ # ; # # If any of the above parameters are not specified, the default value -# of 0 is used for numerics (except for hvupdi_variant and ocdrev, -# where the default value is -1) or the empty string ("") for string -# values. If a required parameter is left empty, AVRDUDE will -# complain. +# of 0 is used for numerics (except for mcuid, hvupdi_variant and +# ocdrev, where the default value is -1) or the empty string "" for +# string values. If a required parameter is left empty, AVRDUDE will +# complain. Almost all occurrences of numbers (with the exception of +# pin numbers and where they are separated by space, eg, in signature +# and readback) can also be given as simple expressions involving +# arithemtic and bitwise operators. # # Parts can also inherit parameters from previously defined parts # using the following syntax. In this case specified integer and @@ -185,7 +185,7 @@ # memory definition is extended, and components overwritten with new # values. Assigning NULL removes an inherited SPI instruction format, # memory definition, control stack, eeprom or flash instruction, eg, -# as in memory "efuse" = NULL; +# as in memory "efuse" = NULL; # # part parent # quoted string # id = ; # quoted string @@ -195,16 +195,16 @@ # NOTES: # * 'devicecode' is the device code used by the STK500 (see codes # listed below) -# * Not all memory types will implement all instructions. -# * AVR Fuse bits and Lock bits are implemented as a type of memory. +# * Not all memory types will implement all instructions +# * AVR Fuse bits and Lock bits are implemented as a type of memory # * Example memory types are: # "flash", "eeprom", "fuse", "lfuse" (low fuse), "hfuse" (high # fuse), "signature", "calibration", "lock" # * The memory type specified on the avrdude command line must match -# one of the memory types defined for the specified chip. +# one of the memory types defined for the specified chip # * The pwroff_after_write flag causes avrdude to attempt to # power the device off and back on after an unsuccessful write to -# the affected memory area if VCC programmer pins are defined. If +# the affected memory area if VCC programmer pins are defined. If # VCC pins are not defined for the programmer, a message # indicating that the device needs a power-cycle is printed out. # This flag was added to work around a problem with the diff --git a/src/config_gram.y b/src/config_gram.y index 5c5a687d..ca47dab5 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -227,7 +227,7 @@ static int pin_name; %% number_real : - TKN_NUMBER { + numexpr { $$ = $1; /* convert value to real */ $$->value.number_real = $$->value.number; @@ -461,8 +461,8 @@ string_list : num_list : - TKN_NUMBER { ladd(number_list, $1); } | - num_list TKN_COMMA TKN_NUMBER { ladd(number_list, $3); } + numexpr { ladd(number_list, $1); } | + num_list TKN_COMMA numexpr { ladd(number_list, $3); } ; prog_parms : @@ -496,7 +496,7 @@ prog_parm : current_prog->desc = cache_string($3->value.string); free_token($3); } | - K_BAUDRATE TKN_EQUAL TKN_NUMBER { + K_BAUDRATE TKN_EQUAL numexpr { { current_prog->baudrate = $3->value.number; free_token($3); @@ -545,7 +545,7 @@ prog_parm_usb: free_token($3); } } | - K_USBVID TKN_EQUAL TKN_NUMBER { + K_USBVID TKN_EQUAL numexpr { { current_prog->usbvid = $3->value.number; free_token($3); @@ -573,7 +573,7 @@ prog_parm_usb: ; usb_pid_list: - TKN_NUMBER { + numexpr { { /* overwrite pids, so clear the existing entries */ if(current_prog->usbpid) @@ -587,7 +587,7 @@ usb_pid_list: free_token($1); } } | - usb_pid_list TKN_COMMA TKN_NUMBER { + usb_pid_list TKN_COMMA numexpr { { int *ip = cfg_malloc("usb_pid_list", sizeof(int)); *ip = $3->value.number; @@ -602,7 +602,7 @@ prog_parm_updi: ; hvupdi_support_list: - TKN_NUMBER { + numexpr { { /* overwrite list entries, so clear the existing entries */ if(current_prog->hvupdi_support) @@ -616,7 +616,7 @@ hvupdi_support_list: free_token($1); } } | - hvupdi_support_list TKN_COMMA TKN_NUMBER { + hvupdi_support_list TKN_COMMA numexpr { { int *ip = cfg_malloc("hvupdi_support_list", sizeof(int)); *ip = $3->value.number; @@ -727,13 +727,13 @@ part_parm : free_token($3); } | - K_HVUPDI_VARIANT TKN_EQUAL TKN_NUMBER + K_HVUPDI_VARIANT TKN_EQUAL numexpr { current_part->hvupdi_variant = $3->value.number; free_token($3); } | - K_DEVICECODE TKN_EQUAL TKN_NUMBER { + K_DEVICECODE TKN_EQUAL numexpr { { yyerror("devicecode is deprecated, use " "stk500_devcode instead"); @@ -741,14 +741,14 @@ part_parm : } } | - K_STK500_DEVCODE TKN_EQUAL TKN_NUMBER { + K_STK500_DEVCODE TKN_EQUAL numexpr { { current_part->stk500_devcode = $3->value.number; free_token($3); } } | - K_AVR910_DEVCODE TKN_EQUAL TKN_NUMBER { + K_AVR910_DEVCODE TKN_EQUAL numexpr { { current_part->avr910_devcode = $3->value.number; free_token($3); @@ -766,7 +766,7 @@ part_parm : } } | - K_USBPID TKN_EQUAL TKN_NUMBER { + K_USBPID TKN_EQUAL numexpr { { current_part->usbpid = $3->value.number; free_token($3); @@ -921,19 +921,19 @@ part_parm : } } | - K_CHIP_ERASE_DELAY TKN_EQUAL TKN_NUMBER + K_CHIP_ERASE_DELAY TKN_EQUAL numexpr { current_part->chip_erase_delay = $3->value.number; free_token($3); } | - K_PAGEL TKN_EQUAL TKN_NUMBER + K_PAGEL TKN_EQUAL numexpr { current_part->pagel = $3->value.number; free_token($3); } | - K_BS2 TKN_EQUAL TKN_NUMBER + K_BS2 TKN_EQUAL numexpr { current_part->bs2 = $3->value.number; free_token($3); @@ -949,169 +949,169 @@ part_parm : free_tokens(2, $1, $3); } | - K_TIMEOUT TKN_EQUAL TKN_NUMBER + K_TIMEOUT TKN_EQUAL numexpr { current_part->timeout = $3->value.number; free_token($3); } | - K_STABDELAY TKN_EQUAL TKN_NUMBER + K_STABDELAY TKN_EQUAL numexpr { current_part->stabdelay = $3->value.number; free_token($3); } | - K_CMDEXEDELAY TKN_EQUAL TKN_NUMBER + K_CMDEXEDELAY TKN_EQUAL numexpr { current_part->cmdexedelay = $3->value.number; free_token($3); } | - K_HVSPCMDEXEDELAY TKN_EQUAL TKN_NUMBER + K_HVSPCMDEXEDELAY TKN_EQUAL numexpr { current_part->hvspcmdexedelay = $3->value.number; free_token($3); } | - K_SYNCHLOOPS TKN_EQUAL TKN_NUMBER + K_SYNCHLOOPS TKN_EQUAL numexpr { current_part->synchloops = $3->value.number; free_token($3); } | - K_BYTEDELAY TKN_EQUAL TKN_NUMBER + K_BYTEDELAY TKN_EQUAL numexpr { current_part->bytedelay = $3->value.number; free_token($3); } | - K_POLLVALUE TKN_EQUAL TKN_NUMBER + K_POLLVALUE TKN_EQUAL numexpr { current_part->pollvalue = $3->value.number; free_token($3); } | - K_POLLINDEX TKN_EQUAL TKN_NUMBER + K_POLLINDEX TKN_EQUAL numexpr { current_part->pollindex = $3->value.number; free_token($3); } | - K_PREDELAY TKN_EQUAL TKN_NUMBER + K_PREDELAY TKN_EQUAL numexpr { current_part->predelay = $3->value.number; free_token($3); } | - K_POSTDELAY TKN_EQUAL TKN_NUMBER + K_POSTDELAY TKN_EQUAL numexpr { current_part->postdelay = $3->value.number; free_token($3); } | - K_POLLMETHOD TKN_EQUAL TKN_NUMBER + K_POLLMETHOD TKN_EQUAL numexpr { current_part->pollmethod = $3->value.number; free_token($3); } | - K_HVENTERSTABDELAY TKN_EQUAL TKN_NUMBER + K_HVENTERSTABDELAY TKN_EQUAL numexpr { current_part->hventerstabdelay = $3->value.number; free_token($3); } | - K_PROGMODEDELAY TKN_EQUAL TKN_NUMBER + K_PROGMODEDELAY TKN_EQUAL numexpr { current_part->progmodedelay = $3->value.number; free_token($3); } | - K_LATCHCYCLES TKN_EQUAL TKN_NUMBER + K_LATCHCYCLES TKN_EQUAL numexpr { current_part->latchcycles = $3->value.number; free_token($3); } | - K_TOGGLEVTG TKN_EQUAL TKN_NUMBER + K_TOGGLEVTG TKN_EQUAL numexpr { current_part->togglevtg = $3->value.number; free_token($3); } | - K_POWEROFFDELAY TKN_EQUAL TKN_NUMBER + K_POWEROFFDELAY TKN_EQUAL numexpr { current_part->poweroffdelay = $3->value.number; free_token($3); } | - K_RESETDELAYMS TKN_EQUAL TKN_NUMBER + K_RESETDELAYMS TKN_EQUAL numexpr { current_part->resetdelayms = $3->value.number; free_token($3); } | - K_RESETDELAYUS TKN_EQUAL TKN_NUMBER + K_RESETDELAYUS TKN_EQUAL numexpr { current_part->resetdelayus = $3->value.number; free_token($3); } | - K_HVLEAVESTABDELAY TKN_EQUAL TKN_NUMBER + K_HVLEAVESTABDELAY TKN_EQUAL numexpr { current_part->hvleavestabdelay = $3->value.number; free_token($3); } | - K_RESETDELAY TKN_EQUAL TKN_NUMBER + K_RESETDELAY TKN_EQUAL numexpr { current_part->resetdelay = $3->value.number; free_token($3); } | - K_CHIPERASEPULSEWIDTH TKN_EQUAL TKN_NUMBER + K_CHIPERASEPULSEWIDTH TKN_EQUAL numexpr { current_part->chiperasepulsewidth = $3->value.number; free_token($3); } | - K_CHIPERASEPOLLTIMEOUT TKN_EQUAL TKN_NUMBER + K_CHIPERASEPOLLTIMEOUT TKN_EQUAL numexpr { current_part->chiperasepolltimeout = $3->value.number; free_token($3); } | - K_CHIPERASETIME TKN_EQUAL TKN_NUMBER + K_CHIPERASETIME TKN_EQUAL numexpr { current_part->chiperasetime = $3->value.number; free_token($3); } | - K_PROGRAMFUSEPULSEWIDTH TKN_EQUAL TKN_NUMBER + K_PROGRAMFUSEPULSEWIDTH TKN_EQUAL numexpr { current_part->programfusepulsewidth = $3->value.number; free_token($3); } | - K_PROGRAMFUSEPOLLTIMEOUT TKN_EQUAL TKN_NUMBER + K_PROGRAMFUSEPOLLTIMEOUT TKN_EQUAL numexpr { current_part->programfusepolltimeout = $3->value.number; free_token($3); } | - K_PROGRAMLOCKPULSEWIDTH TKN_EQUAL TKN_NUMBER + K_PROGRAMLOCKPULSEWIDTH TKN_EQUAL numexpr { current_part->programlockpulsewidth = $3->value.number; free_token($3); } | - K_PROGRAMLOCKPOLLTIMEOUT TKN_EQUAL TKN_NUMBER + K_PROGRAMLOCKPOLLTIMEOUT TKN_EQUAL numexpr { current_part->programlockpolltimeout = $3->value.number; free_token($3); } | - K_SYNCHCYCLES TKN_EQUAL TKN_NUMBER + K_SYNCHCYCLES TKN_EQUAL numexpr { current_part->synchcycles = $3->value.number; free_token($3); @@ -1201,49 +1201,49 @@ part_parm : free_token($3); } | - K_IDR TKN_EQUAL TKN_NUMBER + K_IDR TKN_EQUAL numexpr { current_part->idr = $3->value.number; free_token($3); } | - K_RAMPZ TKN_EQUAL TKN_NUMBER + K_RAMPZ TKN_EQUAL numexpr { current_part->rampz = $3->value.number; free_token($3); } | - K_SPMCR TKN_EQUAL TKN_NUMBER + K_SPMCR TKN_EQUAL numexpr { current_part->spmcr = $3->value.number; free_token($3); } | - K_EECR TKN_EQUAL TKN_NUMBER + K_EECR TKN_EQUAL numexpr { current_part->eecr = $3->value.number; free_token($3); } | - K_MCU_BASE TKN_EQUAL TKN_NUMBER + K_MCU_BASE TKN_EQUAL numexpr { current_part->mcu_base = $3->value.number; free_token($3); } | - K_NVM_BASE TKN_EQUAL TKN_NUMBER + K_NVM_BASE TKN_EQUAL numexpr { current_part->nvm_base = $3->value.number; free_token($3); } | - K_OCD_BASE TKN_EQUAL TKN_NUMBER + K_OCD_BASE TKN_EQUAL numexpr { current_part->ocd_base = $3->value.number; free_token($3); } | - K_OCDREV TKN_EQUAL TKN_NUMBER + K_OCDREV TKN_EQUAL numexpr { current_part->ocdrev = $3->value.number; free_token($3); @@ -1399,14 +1399,14 @@ mem_spec : free_token($3); } | - K_SIZE TKN_EQUAL TKN_NUMBER + K_SIZE TKN_EQUAL numexpr { current_mem->size = $3->value.number; free_token($3); } | - K_PAGE_SIZE TKN_EQUAL TKN_NUMBER + K_PAGE_SIZE TKN_EQUAL numexpr { int ps = $3->value.number; if (ps <= 0) @@ -1418,25 +1418,25 @@ mem_spec : free_token($3); } | - K_NUM_PAGES TKN_EQUAL TKN_NUMBER + K_NUM_PAGES TKN_EQUAL numexpr { current_mem->num_pages = $3->value.number; free_token($3); } | - K_OFFSET TKN_EQUAL TKN_NUMBER + K_OFFSET TKN_EQUAL numexpr { current_mem->offset = $3->value.number; free_token($3); } | - K_MIN_WRITE_DELAY TKN_EQUAL TKN_NUMBER + K_MIN_WRITE_DELAY TKN_EQUAL numexpr { current_mem->min_write_delay = $3->value.number; free_token($3); } | - K_MAX_WRITE_DELAY TKN_EQUAL TKN_NUMBER + K_MAX_WRITE_DELAY TKN_EQUAL numexpr { current_mem->max_write_delay = $3->value.number; free_token($3); @@ -1456,44 +1456,44 @@ mem_spec : free_token($4); } | - K_READBACK_P1 TKN_EQUAL TKN_NUMBER + K_READBACK_P1 TKN_EQUAL numexpr { current_mem->readback[0] = $3->value.number; free_token($3); } | - K_READBACK_P2 TKN_EQUAL TKN_NUMBER + K_READBACK_P2 TKN_EQUAL numexpr { current_mem->readback[1] = $3->value.number; free_token($3); } | - K_MODE TKN_EQUAL TKN_NUMBER + K_MODE TKN_EQUAL numexpr { current_mem->mode = $3->value.number; free_token($3); } | - K_DELAY TKN_EQUAL TKN_NUMBER + K_DELAY TKN_EQUAL numexpr { current_mem->delay = $3->value.number; free_token($3); } | - K_BLOCKSIZE TKN_EQUAL TKN_NUMBER + K_BLOCKSIZE TKN_EQUAL numexpr { current_mem->blocksize = $3->value.number; free_token($3); } | - K_READSIZE TKN_EQUAL TKN_NUMBER + K_READSIZE TKN_EQUAL numexpr { current_mem->readsize = $3->value.number; free_token($3); } | - K_POLLINDEX TKN_EQUAL TKN_NUMBER + K_POLLINDEX TKN_EQUAL numexpr { current_mem->pollindex = $3->value.number; free_token($3); diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index 8b955d44..3bcade32 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -1694,31 +1694,31 @@ The format of the programmer definition is as follows: @smallexample programmer - parent # optional parent - id = [, [, ] ...] ; # are quoted strings - desc = ; # quoted string - type = ; # programmer type, quoted string - # supported types can be listed by "-c ?type" - prog_modes = PM_ @{ | PM_ @} # interfaces, eg, PM_SPM|PM_PDI + parent # optional parent + id = [, ... ] ; # are quoted strings + desc = ; # quoted string + type = ; # programmer type, quoted string + # supported types can be listed by "-c ?type" + prog_modes = PM_ @{ | PM_ @} # interfaces, eg, PM_SPM|PM_PDI connection_type = parallel | serial | usb | spi - baudrate = ; # baudrate for avr910-programmer - vcc = [, ... ] ; # pin number(s) - buff = [, ... ] ; # pin number(s) - reset = ; # pin number - sck = ; # pin number - mosi = ; # pin number - miso = ; # pin number - errled = ; # pin number - rdyled = ; # pin number - pgmled = ; # pin number - vfyled = ; # pin number - usbvid = ; # USB VID (Vendor ID) - usbpid = [, ...] ; # USB PID (Product ID) - usbdev = ; # USB interface or other device info - usbvendor = ; # USB Vendor Name - usbproduct = ; # USB Product Name - usbsn = ; # USB Serial Number - hvupdi_support = [, , ... ] ; # UPDI HV Variants Support + baudrate = ; # baudrate for avr910-programmer + vcc = [, ... ] ; # pin number(s) + buff = [, ... ] ; # pin number(s) + reset = ; # pin number + sck = ; # pin number + mosi = ; # pin number + miso = ; # pin number + errled = ; # pin number + rdyled = ; # pin number + pgmled = ; # pin number + vfyled = ; # pin number + usbvid = ; # USB VID (Vendor ID) + usbpid = [, ...] ; # USB PID (Product ID) + usbdev = ; # USB interface or other device info + usbvendor = ; # USB Vendor Name + usbproduct = ; # USB Product Name + usbsn = ; # USB Serial Number + hvupdi_support = [, , ... ] ; # UPDI HV Variants Support ; @end smallexample @@ -1742,7 +1742,8 @@ Known programming modes are @end itemize @noindent -To invert a bit in the pin definitions, use @code{= ~ }. +To invert a bit in the pin definitions, use @code{= ~ }. To invert a pin list +(all pins get inverted) use @code{~ ( [, ... ] )}. @noindent Not all programmer types can handle a list of USB PIDs. @@ -1765,7 +1766,7 @@ part desc = ; # quoted string id = ; # quoted string family_id = ; # quoted string, eg, "megaAVR" or "tinyAVR" - prog_modes = PM_ @{ | PM_ @} # interfaces, eg, PM_SPM|PM_ISP|PM_HVPP|PM_debugWIRE + prog_modes = PM_ @{| PM_@} # interfaces, eg, PM_SPM|PM_ISP|PM_HVPP|PM_debugWIRE mcuid = ; # unique id in 0..2039 for 8-bit AVRs n_interrupts = ; # number of interrupts, used for vector bootloaders n_page_erase = ; # if set, number of pages erased during NVM erase @@ -1773,12 +1774,12 @@ part devicecode = ; # deprecated, use stk500_devcode stk500_devcode = ; # numeric avr910_devcode = ; # numeric - has_jtag = ; # part has JTAG i/f - has_debugwire = ; # part has debugWire i/f - has_pdi = ; # part has PDI i/f - has_updi = ; # part has UPDI i/f - has_tpi = ; # part has TPI i/f - is_avr32 = ; # AVR32 part + has_jtag = ; # part has JTAG i/f (deprecated, use prog_modes) + has_debugwire = ; # part has debugWire i/f (deprecated, use prog_modes) + has_pdi = ; # part has PDI i/f (deprecated, use prog_modes) + has_updi = ; # part has UPDI i/f (deprecated, use prog_modes) + has_tpi = ; # part has TPI i/f (deprecated, use prog_modes) + is_avr32 = ; # AVR32 part (deprecated, use prog_modes) is_at90s1200 = ; # AT90S1200 part signature = ; # signature bytes usbpid = ; # DFU USB PID @@ -1791,7 +1792,7 @@ part bs2 = ; # pin name in hex, i.e., 0xA0 serial = ; # can use serial downloading parallel = ; # can use par. programming - # STK500v2 parameters, to be taken from Atmel's XML files + # STK500v2 parameters, to be taken from Atmel's ATDF files timeout = ; stabdelay = ; cmdexedelay = ; @@ -1803,13 +1804,13 @@ part postdelay = ; pollmethod = ; hvspcmdexedelay = ; - # STK500v2 HV programming parameters, from XML - pp_controlstack = , , ... ; # PP only - hvsp_controlstack = , , ... ; # HVSP only + # STK500v2 HV programming parameters, from ATDFs + pp_controlstack = , , ... ; # PP only + hvsp_controlstack = , , ... ; # HVSP only flash_instr = , , ; eeprom_instr = , , ... ; hventerstabdelay = ; - progmodedelay = ; # PP only + progmodedelay = ; # PP only latchcycles = ; togglevtg = ; poweroffdelay = ; @@ -1817,21 +1818,21 @@ part resetdelayus = ; hvleavestabdelay = ; resetdelay = ; - synchcycles = ; # HVSP only - chiperasepulsewidth = ; # PP only + synchcycles = ; # HVSP only + chiperasepulsewidth = ; # PP only chiperasepolltimeout = ; - chiperasetime = ; # HVSP only - programfusepulsewidth = ; # PP only + chiperasetime = ; # HVSP only + programfusepulsewidth = ; # PP only programfusepolltimeout = ; - programlockpulsewidth = ; # PP only + programlockpulsewidth = ; # PP only programlockpolltimeout = ; - # JTAG ICE mkII parameters, also from XML files + # JTAG ICE mkII parameters, also from ATDF files allowfullpagebitstream = ; enablepageprogramming = ; - idr = ; # IO addr of IDR (OCD) reg - rampz = ; # IO addr of RAMPZ reg - spmcr = ; # mem addr of SPMC[S]R reg - eecr = ; # mem addr of EECR reg only when != 0x3f + idr = ; # IO addr of IDR (OCD) reg + rampz = ; # IO addr of RAMPZ reg + spmcr = ; # mem addr of SPMC[S]R reg + eecr = ; # mem addr of EECR reg only when != 0x3f mcu_base = ; nvm_base = ; ocd_base = ; @@ -1851,7 +1852,7 @@ part readback_p1 = ; # byte value (first component) readback_p2 = ; # byte value (second component) pwroff_after_write = ; # yes/no - mode = ; # STK500 v2 file parameter from Atmel's XML files + mode = ; # STK500 v2 file parameter from ATDF files delay = ; # " blocksize = ; # " readsize = ; # " @@ -1868,6 +1869,16 @@ part ; @end smallexample +@noindent +If any of the above parameters are not specified, the default value +of 0 is used for numerics (except for @code{mcuid}, @code{hvupdi_variant} and @code{ocdrev}, +where the default value is -1) or the empty string @code{""} for string +values. If a required parameter is left empty, AVRDUDE will complain. +Almost all occurrences of numbers (with the exception of pin numbers +and where they are separated by space, eg, in signature and readback) +can also be given as simple expressions involving arithemtic and +bitwise operators. + @menu * Parent Part:: * Instruction Format:: @@ -1880,11 +1891,19 @@ part @subsection Parent Part @noindent -Parts can also inherit parameters from previously defined parts -using the following syntax. In this case specified integer and -string values override parameter values from the parent part. New -memory definitions are added to the definitions inherited from the -parent. +Parts can also inherit parameters from previously defined parts using +the following syntax. In this case specified integer and string values +override parameter values from the parent part. New memory definitions +are added to the definitions inherited from the parent. If, however, a +new memory definition refers to an existing one of the same name for +that part then, from v7.1, the existing memory definition is extended, +and components overwritten with new values. Assigning @code{NULL} +removes an inherited SPI instruction format, memory definition, control +stack, eeprom or flash instruction, eg, as in @code{memory "efuse" = +NULL;} + +@noindent +Example format for part inheritance: @smallexample part parent # quoted string diff --git a/src/lexer.l b/src/lexer.l index 65b7a451..02fa6008 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -63,7 +63,7 @@ SIGN [+-] %% -{SIGN}?{DIGIT}+ { yylval = new_number(yytext); return TKN_NUMBER; } +{DIGIT}+ { yylval = new_number(yytext); return TKN_NUMBER; /* sign is treated in grammar */ } {SIGN}?{DIGIT}+"."{DIGIT}* { yylval = new_number_real(yytext); return TKN_NUMBER_REAL; } {SIGN}?"."{DIGIT}+ { yylval = new_number_real(yytext); return TKN_NUMBER_REAL; } From fc970226b663e8d55de2c366db3051c5656fdd44 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 31 Aug 2022 11:31:58 +0100 Subject: [PATCH 229/511] Add avrintel.[ch] to Makefile.am --- src/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am index 9e0929e1..cc1e2ee1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -198,6 +198,8 @@ avrdude_SOURCES = \ main.c \ whereami.c \ whereami.h \ + avrintel.c \ + avrintel.h \ developer_opts.c \ developer_opts.h \ developer_opts_private.h \ From 602fab481c32f015d50de641ee88db1c0a16aad6 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 31 Aug 2022 11:59:19 +0100 Subject: [PATCH 230/511] Relax uniqueness check of mcuid for parts that might be variants Two parts are considered variants here if one part name starts with the name of the other, flash memory sizes are the same, flash page sizes are the same and the number of interrupts are the same. --- src/config.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/config.c b/src/config.c index ebef8f4b..a0351833 100644 --- a/src/config.c +++ b/src/config.c @@ -861,11 +861,20 @@ void cfg_update_mcuid(AVRPART *part) { } } - // None have the same name: an entry with part->mcuid is an error + // None have the same name: an entry with part->mcuid might be an error for(int i=0; i < sizeof uP_table/sizeof *uP_table; i++) if(part->mcuid == (int) uP_table[i].mcuid) { - yywarning("mcuid %d is reserved for %s, use a free number >= %d", - part->mcuid, uP_table[i].name, sizeof uP_table/sizeof *uP_table); + // Complain unless it can be considered a variant, eg, ATmega32L and ATmega32 + AVRMEM *flash = avr_locate_mem(part, "flash"); + if(flash) { + size_t l1 = strlen(part->desc), l2 = strlen(uP_table[i].name); + if(strncasecmp(part->desc, uP_table[i].name, l1 < l2? l1: l2) || + flash->size != uP_table[i].flashsize || + flash->page_size != uP_table[i].pagesize || + part->n_interrupts != uP_table[i].ninterrupts) + yywarning("mcuid %d is reserved for %s, use a free number >= %d", + part->mcuid, uP_table[i].name, sizeof uP_table/sizeof *uP_table); + } return; } From dab99c082382159522770fa1e9f91a7c4aa1c38b Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 31 Aug 2022 17:35:03 +0100 Subject: [PATCH 231/511] Update NEWS --- NEWS | 24 +++++++++++++++++++----- src/avrintel.c | 2 +- src/avrintel.h | 2 +- src/developer_opts.c | 2 +- src/developer_opts.h | 2 +- src/developer_opts_private.h | 2 +- 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index c239ccba..d53dd42d 100644 --- a/NEWS +++ b/NEWS @@ -38,21 +38,21 @@ Changes since version 7.0: - Fix ft245r paged read for ATmega2560 et al #1018 - Add option -A that supresses trailing 0xff optimisation and automatically do so for -c arduino #936 - - Fix linuxspi default port #933 + - Fix linuxspi default port #933 - Add support for high-voltage UPDI im jtag3.c #1015 - Fix terminal write edge cases; add one read mode; add quell command #1025 - - Fix usbtiny read for parts with more than 64 kB flash #1029 - - CMakeLists.txt: fix build without C++ #1016 + - Fix usbtiny read for parts with more than 64 kB flash #1029 + - CMakeLists.txt: fix build without C++ #1016 - Provide file format I: Intel HEX with comments that ignores checksum errors #1030 - Enable writing fuse and lock bits for AVR-JTAGICE #1031 - Ignore -s flag as safemode is no longer supported #1033 - - Developer options to describe parts and + - Developer options to describe parts and extend avrdude.conf syntax #1040 - Deprecate original STK500 v1 protocol in favour of optiboot - and Arduino as ISP #1046 + and Arduino as ISP #1046 - Add jtagmkii_updi programmer option #1048 - Enable stdin verification, display correct number of bytes written/verified, check -U memory names against spelling @@ -72,6 +72,20 @@ Changes since version 7.0: void (*enable)(PROGRAMMER *pgm, const AVRPART *p) #1078 - Make avr910 programmer initialize() less verbose #1083 - Fix flash paged write for avrftdi.c #1074 + - Fix 4 parts wrt to their interfaces in avrdude.conf; rewrite + avrdude.conf.in file from avrdude -c* -p* output; reformat + conditional programmers in avrdude.conf.in using -c*; fix + reset=dedicated|io; entries #1086 + - Add prog_modes, a bitwise or of prgramming modes, to part and + programmer definitions; add to part definition + + mcuid, a unique id in 0..2039 for 8-bit AVR + + n_interrupts, the number of interrupts + + n_page_erase, if set, the # of pages erased for NVM erase + implement a simple calculator in config_gram.y for numeric + values; set part prog_modes, mcuid, n_interrupts and + n_page_erase in avrdude.conf.in; add external intelligence + about AVRs avrintel.[ch] to the project and warn during + parsing if mcuid is incompatible with it #1091 * Internals: diff --git a/src/avrintel.c b/src/avrintel.c index edf7d114..293362c4 100644 --- a/src/avrintel.c +++ b/src/avrintel.c @@ -6,7 +6,7 @@ * Atmel AVR8L, AVR8, XMEGA and AVR8X family description of interrupts and more * * published under GNU General Public License, version 3 (GPL-3.0) - * meta-author Stefan Rueger + * meta-author: Stefan Rueger * * v 1.1 * 30.08.2022 diff --git a/src/avrintel.h b/src/avrintel.h index 69f4862c..77147aad 100644 --- a/src/avrintel.h +++ b/src/avrintel.h @@ -6,7 +6,7 @@ * Atmel AVR8L, AVR8, XMEGA and AVR8X family description of interrupts and more * * published under GNU General Public License, version 3 (GPL-3.0) - * meta-author Stefan Rueger + * meta-author Stefan Rueger * * v 1.1 * 30.08.2022 diff --git a/src/developer_opts.c b/src/developer_opts.c index c9efc7cf..221a1954 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -1,6 +1,6 @@ /* * avrdude - A Downloader/Uploader for AVR device programmers - * Copyright (C) 2022, Stefan Rueger + * Copyright (C) 2022, Stefan Rueger * * 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 diff --git a/src/developer_opts.h b/src/developer_opts.h index bc04a9d8..d66e299b 100644 --- a/src/developer_opts.h +++ b/src/developer_opts.h @@ -1,6 +1,6 @@ /* * avrdude - A Downloader/Uploader for AVR device programmers - * Copyright (C) 2022, Stefan Rueger + * Copyright (C) 2022, Stefan Rueger * * 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 diff --git a/src/developer_opts_private.h b/src/developer_opts_private.h index 54012838..a9910fe0 100644 --- a/src/developer_opts_private.h +++ b/src/developer_opts_private.h @@ -1,6 +1,6 @@ /* * avrdude - A Downloader/Uploader for AVR device programmers - * Copyright (C) 2022, Stefan Rueger + * Copyright (C) 2022, Stefan Rueger * * 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 From a536a01ebfe5f8d34c9d0abc7364d260962b4aab Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 31 Aug 2022 18:15:35 +0100 Subject: [PATCH 232/511] Create a bespoke bootloader programmer for gammaBoot trinkets --- src/avrdude.conf.in | 17 +++++++++++++++++ src/usbtiny.c | 8 +++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 1152af77..f2d0c009 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -1458,6 +1458,23 @@ programmer usbpid = 0x0c9f; ; +#------------------------------------------------------------ +# gemmaBoot +#------------------------------------------------------------ + +# Serving the Gemma bootloader +# https://github.com/adafruit/Adafruit-Trinket-Gemma-Bootloader + +programmer + id = "gemmaBoot"; + desc = "Gemma bootloader disguised as USBtiny"; + type = "usbtiny"; + prog_modes = PM_SPM; + connection_type = usb; + usbvid = 0x2341; + usbpid = 0x0105; +; + #------------------------------------------------------------ # arduinoisp #------------------------------------------------------------ diff --git a/src/usbtiny.c b/src/usbtiny.c index 2e319318..7153ede9 100644 --- a/src/usbtiny.c +++ b/src/usbtiny.c @@ -618,7 +618,13 @@ static int usbtiny_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { if (! usbtiny_avr_op( pgm, p, AVR_OP_CHIP_ERASE, res )) { return -1; } - usleep( p->chip_erase_delay ); + + if(pgm->prog_modes & PM_SPM) { // Talking to bootloader directly + AVRMEM *fl = avr_locate_mem(p, "flash"); + // Estimated time it takes to erase all pages in bootloader + usleep(p->chip_erase_delay * (fl? fl->num_pages: 999)); + } else + usleep(p->chip_erase_delay); // prepare for further instruction pgm->initialize(pgm, p); From 4af49bb5fbe64f1db456562f7229b4a9af4d2bb3 Mon Sep 17 00:00:00 2001 From: Alex Papazoglou Date: Wed, 31 Aug 2022 11:45:08 -0700 Subject: [PATCH 233/511] avrdude.conf.in: Adds digilent-hs2 dongle Adds support for Digilint JTAG HS2 in MPSSE mode. --- src/avrdude.conf.in | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 1152af77..9b461996 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -1044,6 +1044,28 @@ programmer rdyled = ~15; ; +# +# Digilent JTAG HS2 programmer. FT232H-based dongle with +# buffers. +# +programmer + id = "digilent-hs2"; + desc = "Digilient JTAG HS2 (MPSSE)"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; + usbpid = 0x6014; + usbdev = "A"; + usbvendor = ""; + usbproduct = ""; + usbsn = ""; + reset = 3; + sck = 0; + mosi = 1; + miso = 2; + buff = 5,6,7; +; + #------------------------------------------------------------ # serialupdi #------------------------------------------------------------ From bf70b5fc8c6ac1cc6900a7285e2b7de17433a48f Mon Sep 17 00:00:00 2001 From: Alex Papazoglou Date: Wed, 31 Aug 2022 20:43:27 -0700 Subject: [PATCH 234/511] avrdude.conf.in: Cosmetic changes Corrected formatting using /s. Added a URL for the reference manual. --- src/avrdude.conf.in | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 9b461996..931c9c38 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -1044,26 +1044,30 @@ programmer rdyled = ~15; ; +#------------------------------------------------------------ +# digilent-hs2 +#------------------------------------------------------------ + # # Digilent JTAG HS2 programmer. FT232H-based dongle with # buffers. # +# The reference manual can be found at https://digilent.com/reference/_media/reference/programmers/jtag-hs2/jtag-hs2_rm.pdf +# + programmer - id = "digilent-hs2"; - desc = "Digilient JTAG HS2 (MPSSE)"; - type = "avrftdi"; - connection_type = usb; - usbvid = 0x0403; - usbpid = 0x6014; - usbdev = "A"; - usbvendor = ""; - usbproduct = ""; - usbsn = ""; - reset = 3; - sck = 0; - mosi = 1; - miso = 2; - buff = 5,6,7; + id = "digilent-hs2"; + desc = "Digilient JTAG HS2 (MPSSE)"; + type = "avrftdi"; + connection_type = usb; + usbvid = 0x0403; + usbpid = 0x6014; + usbdev = "A"; + buff = 5, 6, 7; + reset = 3; + sck = 0; + mosi = 1; + miso = 2; ; #------------------------------------------------------------ From b99df388bd221c9915861c6df22a0c111db88213 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 1 Sep 2022 13:08:44 +0100 Subject: [PATCH 235/511] Change comment for diligent-hs2 in avrdude.conf.in --- src/avrdude.conf.in | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 931c9c38..a719a17a 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -1048,12 +1048,8 @@ programmer # digilent-hs2 #------------------------------------------------------------ -# -# Digilent JTAG HS2 programmer. FT232H-based dongle with -# buffers. -# -# The reference manual can be found at https://digilent.com/reference/_media/reference/programmers/jtag-hs2/jtag-hs2_rm.pdf -# +# Digilent JTAG HS2 programmer. FT232H-based dongle with buffers. +# https://digilent.com/reference/_media/reference/programmers/jtag-hs2/jtag-hs2_rm.pdf programmer id = "digilent-hs2"; From 07ed4746be869b31d0ddeb1aeae2bdf9410db83c Mon Sep 17 00:00:00 2001 From: Marius Greuel Date: Sun, 4 Sep 2022 16:19:01 +0200 Subject: [PATCH 236/511] CMake: Fix dependency chain between avrdude.conf.in and avrdude.conf --- CMakeLists.txt | 21 ------------------ src/CMakeLists.txt | 52 ++++++++++++++++++++++++++++++++------------- src/configure.cmake | 35 ++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 36 deletions(-) create mode 100644 src/configure.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 5efc8d45..2840ff78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -281,27 +281,6 @@ endif() add_subdirectory(src) -# ===================================== -# Setup default port names -# ===================================== - -if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(DEFAULT_PAR_PORT "/dev/parport0") - set(DEFAULT_SER_PORT "/dev/ttyS0") -elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") - set(DEFAULT_PAR_PORT "/dev/ppi0") - set(DEFAULT_SER_PORT "/dev/cuad0") -elseif (CMAKE_SYSTEM_NAME STREQUAL "Solaris") - set(DEFAULT_PAR_PORT "/dev/printers/0") - set(DEFAULT_SER_PORT "/dev/term/a") -elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows") - set(DEFAULT_PAR_PORT "lpt1") - set(DEFAULT_SER_PORT "com1") -else() - set(DEFAULT_PAR_PORT "unknown") - set(DEFAULT_SER_PORT "unknown") -endif() - # ===================================== # Configuration # ===================================== diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2cb8f5f1..00d67892 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,31 +81,53 @@ else() add_compile_options(-Wall) # -Wextra endif() +# ===================================== +# Setup default port names +# ===================================== + +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(DEFAULT_PAR_PORT "/dev/parport0") + set(DEFAULT_SER_PORT "/dev/ttyS0") +elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + set(DEFAULT_PAR_PORT "/dev/ppi0") + set(DEFAULT_SER_PORT "/dev/cuad0") +elseif (CMAKE_SYSTEM_NAME STREQUAL "Solaris") + set(DEFAULT_PAR_PORT "/dev/printers/0") + set(DEFAULT_SER_PORT "/dev/term/a") +elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows") + set(DEFAULT_PAR_PORT "lpt1") + set(DEFAULT_SER_PORT "com1") +else() + set(DEFAULT_PAR_PORT "unknown") + set(DEFAULT_SER_PORT "unknown") +endif() + # ===================================== # Configure files # ===================================== -macro(configure_option option) - if(${${option}}) - string(REGEX REPLACE "(.*)@${option}_BEGIN@(.*)@${option}_END@(.*)" "\\1\\2\\3" conf_file "${conf_file}") - else() - string(REGEX REPLACE "(.*)@${option}_BEGIN@(.*)@${option}_END@(.*)" "\\1\\3" conf_file "${conf_file}") - endif() -endmacro() - -file(READ avrdude.conf.in conf_file) -configure_option(HAVE_PARPORT) -configure_option(HAVE_LINUXGPIO) -configure_option(HAVE_LINUXSPI) -file(WRITE "${PROJECT_BINARY_DIR}/avrdude.conf.in" "${conf_file}") - configure_file(cmake_config.h.in ac_cfg.h) -configure_file("${PROJECT_BINARY_DIR}/avrdude.conf.in" avrdude.conf) configure_file(avrdude.spec.in avrdude.spec) if(WIN32) configure_file(windows.rc.in windows.rc) endif() +add_custom_command( + OUTPUT avrdude.conf + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/avrdude.conf.in" avrdude.conf.in + COMMAND ${CMAKE_COMMAND} + -D HAVE_PARPORT=${HAVE_PARPORT} + -D HAVE_LINUXSPI=${HAVE_LINUXSPI} + -D HAVE_LINUXGPIO=${HAVE_LINUXGPIO} + -D DEFAULT_PAR_PORT=${DEFAULT_PAR_PORT} + -D DEFAULT_SER_PORT=${DEFAULT_SER_PORT} + -P "${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake" + DEPENDS avrdude.conf.in + VERBATIM + ) + +add_custom_target(conf ALL DEPENDS avrdude.conf) + # ===================================== # Project # ===================================== diff --git a/src/configure.cmake b/src/configure.cmake new file mode 100644 index 00000000..938c1752 --- /dev/null +++ b/src/configure.cmake @@ -0,0 +1,35 @@ +# +# configure.cmake - autoconf like multi-line configure +# Copyright (C) 2022 Marius Greuel +# +# 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, see . +# + +# Do a multi-line replace based on @