Merge pull request #1386 from stefanrueger/stk500v2

Fix stk500v2.c's write_byte() for old parts
This commit is contained in:
Stefan Rueger
2023-06-16 00:02:17 +01:00
committed by GitHub
2 changed files with 51 additions and 71 deletions

View File

@@ -3995,77 +3995,6 @@ part parent "2333"
;
;
#------------------------------------------------------------
# AT90S4434
#------------------------------------------------------------
part
##### WARNING: No XML file for device 'AT90S4434'! #####
desc = "AT90S4434";
id = "4434";
variants =
"AT90S4434-8AC: TQFP44, Fmax=8 MHz, T=[0 C, 70 C], Vcc=[4 V, 6 V]",
"AT90S4434-8AI: TQFP44, Fmax=8 MHz, T=[-40 C, 85 C], Vcc=[4 V, 6 V]",
"AT90S4434-8JC: LCC44, Fmax=8 MHz, T=[0 C, 70 C], Vcc=[4 V, 6 V]",
"AT90S4434-8JI: LCC44, Fmax=8 MHz, T=[-40 C, 85 C], Vcc=[4 V, 6 V]",
"AT90S4434-8PC: DIP40, Fmax=8 MHz, T=[0 C, 70 C], Vcc=[4 V, 6 V]",
"AT90S4434-8PI: DIP40, Fmax=8 MHz, T=[-40 C, 85 C], Vcc=[4 V, 6 V]";
prog_modes = PM_SPM | PM_ISP;
mcuid = 192;
n_interrupts = 17;
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";
;
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";
;
memory "fuse"
size = 1;
initval = 0xdf;
bitmask = 0x21;
min_write_delay = 9000;
max_write_delay = 20000;
read = "0101.1000--xxxx.xxxx--xxxx.xxxx--xxox.xxxo";
write = "1010.1100--1011.111i--xxxx.xxxx--xxxx.xxxx";
;
memory "lock"
size = 1;
initval = 0xff;
bitmask = 0x06;
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 o1 o2 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";
;
;
#------------------------------------------------------------
# AT90S8515
#------------------------------------------------------------
@@ -4249,6 +4178,51 @@ part
;
;
#------------------------------------------------------------
# AT90S4434
#------------------------------------------------------------
# No XML file for device AT90S4434, so parenting off AT90S8535
# with which it shares the datasheet.
part parent "8535"
desc = "AT90S4434";
id = "4434";
variants =
"AT90S4434-8AC: TQFP44, Fmax=8 MHz, T=[0 C, 70 C], Vcc=[4 V, 6 V]",
"AT90S4434-8AI: TQFP44, Fmax=8 MHz, T=[-40 C, 85 C], Vcc=[4 V, 6 V]",
"AT90S4434-8JC: LCC44, Fmax=8 MHz, T=[0 C, 70 C], Vcc=[4 V, 6 V]",
"AT90S4434-8JI: LCC44, Fmax=8 MHz, T=[-40 C, 85 C], Vcc=[4 V, 6 V]",
"AT90S4434-8PC: DIP40, Fmax=8 MHz, T=[0 C, 70 C], Vcc=[4 V, 6 V]",
"AT90S4434-8PI: DIP40, Fmax=8 MHz, T=[-40 C, 85 C], Vcc=[4 V, 6 V]";
mcuid = 192;
stk500_devcode = 0x52;
avr910_devcode = 0x6c;
signature = 0x1e 0x92 0x02;
memory "eeprom"
size = 256;
read = "1010.0000--xxxx.xxxx--aaaa.aaaa--oooo.oooo";
write = "1100.0000--xxxx.xxxx--aaaa.aaaa--iiii.iiii";
;
memory "flash"
size = 4096;
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"
max_write_delay = 20000;
;
memory "lock"
max_write_delay = 20000;
;
;
#------------------------------------------------------------
# ATmega103
#------------------------------------------------------------

View File

@@ -1807,6 +1807,10 @@ static void stk500v2_enable(PROGRAMMER *pgm, const AVRPART *p) {
stk600_setup_isp(pgm);
}
}
AVRMEM *mem = avr_locate_mem(p, "flash");
if(mem && mem->op[AVR_OP_WRITE_LO]) // Old part that can only write flash bytewise
if(mem->page_size < 2) // Override page size, as STK500v2/EDBG uses flash word addresses
mem->page_size = 2;
return;
}
@@ -2720,6 +2724,7 @@ static int stk500v2_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const A
// determine which command is to be used
if (strcmp(m->desc, "flash") == 0) {
addrshift = 1;
PDATA(pgm)->flash_pageaddr = -1UL; // Invalidate cache
commandbuf[0] = CMD_PROGRAM_FLASH_ISP;
/*
* If bit 31 is set, this indicates that the following read/write
@@ -2731,6 +2736,7 @@ static int stk500v2_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const A
use_ext_addr = (1U << 31);
}
} else if (strcmp(m->desc, "eeprom") == 0) {
PDATA(pgm)->eeprom_pageaddr = -1UL; // Invalidate cache
commandbuf[0] = CMD_PROGRAM_EEPROM_ISP;
}
commandbuf[4] = m->delay;