[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avrdude-dev] [bug #48131] Problem with EEprom address of avrdude for di
From: |
Joerg Wunsch |
Subject: |
[avrdude-dev] [bug #48131] Problem with EEprom address of avrdude for different processors! |
Date: |
Sat, 4 Jun 2016 18:29:52 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; FreeBSD amd64; rv:46.0) Gecko/20100101 Firefox/46.0 |
Update of bug #48131 (project avrdude):
Status: None => Confirmed
Assigned to: None => bdean
_______________________________________________________
Follow-up Comment #1:
The problem is apparently that piece of code in stk500.c:
if ((m->op[AVR_OP_LOADPAGE_LO]) || (m->op[AVR_OP_READ_LO]))
a_div = 2;
else
a_div = 1;
Later on, a_div is used to determine whether the address in
the load command needs to be divided by 2:
stk500_loadaddr(pgm, m, addr/a_div);
(Similar code exists in both, stk500_paged_write() as well as
stk500_paged_load()).
I think the intention was to divide the load address by 2 when
accessing flash. Now, the ATmega328 entry (as well as others)
has an AVR_OP_LOADPAGE_LO instruction even in the EEPROM memory
section. Thus, load addresses are halved for it when accessing
EEPROM.
If the only decision needed is whether flash or EEPROM is going
to be accessed, my suggestion is to combine that with the 'F' and
'E' decision a few lines before:
if (strcmp(m->desc, "flash") == 0) {
memtype = 'F';
a_div = 2;
}
else if (strcmp(m->desc, "eeprom") == 0) {
memtype = 'E';
a_div = 1;
}
else {
return -2;
}
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?48131>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/