First cut at supporting the ATmega 103 which uses bank addressing and

has a 128K flash.

Due to the bank addressing required, interactive update of the flash
is not supported, though the eeprom can be updated interactively.
Both memories can be programmed via non-interactive mode.

Intel Hex Record type '04' is now generated as required for outputing
memory contents that go beyond 64K.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@78 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Brian S. Dean
2001-10-14 02:53:21 +00:00
parent f73b0f9eba
commit 3bae0d8d14
5 changed files with 119 additions and 28 deletions

View File

@@ -93,12 +93,12 @@ char * fmtstr(FILEFMT format)
int b2ihex(unsigned char * inbuf, int bufsize,
int recsize, int startaddr,
char * outfile, FILE * outf)
int recsize, int startaddr,
char * outfile, FILE * outf)
{
unsigned char * buf;
unsigned int nextaddr;
int n, nbytes;
int n, nbytes, n_64k;
int i;
unsigned char cksum;
@@ -108,6 +108,7 @@ int b2ihex(unsigned char * inbuf, int bufsize,
return -1;
}
n_64k = 0;
nextaddr = startaddr;
buf = inbuf;
nbytes = 0;
@@ -117,6 +118,9 @@ int b2ihex(unsigned char * inbuf, int bufsize,
if (n > bufsize)
n = bufsize;
if ((nextaddr + n) > 0x10000)
n = 0x10000 - nextaddr;
if (n) {
cksum = 0;
fprintf(outf, ":%02X%04X00", n, nextaddr);
@@ -132,6 +136,20 @@ int b2ihex(unsigned char * inbuf, int bufsize,
nbytes += n;
}
if (nextaddr >= 0x10000) {
int lo, hi;
/* output an extended address record */
n_64k++;
lo = n_64k & 0xff;
hi = (n_64k >> 8) & 0xff;
cksum = 0;
fprintf(outf, ":02000004%02X%02X", hi, lo);
cksum += 2 + 0 + 4 + hi + lo;
cksum = -cksum;
fprintf(outf, "%02X\n", cksum);
nextaddr = 0;
}
/* advance to next 'recsize' bytes */
buf += n;
bufsize -= n;