mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-23 21:23:09 +02:00
avrdude/patches/: added skipping of untouched bytes in write/verify
- series, low-addr.patch: record the lowest address touched (only for ihex, all others default to 0) - series, skip-low-addr.patch: skip untouched addresses in avr_read and avr_write
This commit is contained in:
parent
ea5b8af399
commit
d7874e306c
142
avrdude/patches/low-addr.patch
Normal file
142
avrdude/patches/low-addr.patch
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
Index: avrdude/avrdude-5.10/avrpart.h
|
||||||
|
===================================================================
|
||||||
|
--- avrdude.orig/avrdude-5.10/avrpart.h 2011-03-08 23:40:10.000000000 -0300
|
||||||
|
+++ avrdude/avrdude-5.10/avrpart.h 2011-03-08 23:40:13.000000000 -0300
|
||||||
|
@@ -185,6 +185,8 @@
|
||||||
|
|
||||||
|
unsigned char * buf; /* pointer to memory buffer */
|
||||||
|
OPCODE * op[AVR_OP_MAX]; /* opcodes */
|
||||||
|
+
|
||||||
|
+ int low_addr; /* lowest address used, in bytes */
|
||||||
|
} AVRMEM;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
Index: avrdude/avrdude-5.10/config_gram.y
|
||||||
|
===================================================================
|
||||||
|
--- avrdude.orig/avrdude-5.10/config_gram.y 2011-03-08 23:40:10.000000000 -0300
|
||||||
|
+++ avrdude/avrdude-5.10/config_gram.y 2011-03-08 23:40:13.000000000 -0300
|
||||||
|
@@ -1209,6 +1209,7 @@
|
||||||
|
}
|
||||||
|
mem_specs
|
||||||
|
{
|
||||||
|
+ current_mem->low_addr = current_mem->size;
|
||||||
|
ladd(current_part->mem, current_mem);
|
||||||
|
current_mem = NULL;
|
||||||
|
} |
|
||||||
|
Index: avrdude/avrdude-5.10/fileio.c
|
||||||
|
===================================================================
|
||||||
|
--- avrdude.orig/avrdude-5.10/fileio.c 2011-03-08 23:40:10.000000000 -0300
|
||||||
|
+++ avrdude/avrdude-5.10/fileio.c 2011-03-08 23:40:13.000000000 -0300
|
||||||
|
@@ -52,7 +52,7 @@
|
||||||
|
char * outfile, FILE * outf);
|
||||||
|
|
||||||
|
static int ihex2b(char * infile, FILE * inf,
|
||||||
|
- unsigned char * outbuf, int bufsize);
|
||||||
|
+ unsigned char * outbuf, int bufsize, int *low_addr);
|
||||||
|
|
||||||
|
static int b2srec(unsigned char * inbuf, int bufsize,
|
||||||
|
int recsize, int startaddr,
|
||||||
|
@@ -69,7 +69,8 @@
|
||||||
|
char * filename, FILE * f, unsigned char * buf, int size);
|
||||||
|
|
||||||
|
static int fileio_ihex(struct fioparms * fio,
|
||||||
|
- char * filename, FILE * f, unsigned char * buf, int size);
|
||||||
|
+ char * filename, FILE * f, unsigned char * buf, int size,
|
||||||
|
+ int *low_addr);
|
||||||
|
|
||||||
|
static int fileio_srec(struct fioparms * fio,
|
||||||
|
char * filename, FILE * f, unsigned char * buf, int size);
|
||||||
|
@@ -262,7 +263,7 @@
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
static int ihex2b(char * infile, FILE * inf,
|
||||||
|
- unsigned char * outbuf, int bufsize)
|
||||||
|
+ unsigned char * outbuf, int bufsize, int *low_addr)
|
||||||
|
{
|
||||||
|
char buffer [ MAX_LINE_LEN ];
|
||||||
|
unsigned char * buf;
|
||||||
|
@@ -271,7 +272,7 @@
|
||||||
|
int lineno;
|
||||||
|
int len;
|
||||||
|
struct ihexrec ihex;
|
||||||
|
- int rc;
|
||||||
|
+ int rc, lowest;
|
||||||
|
|
||||||
|
lineno = 0;
|
||||||
|
buf = outbuf;
|
||||||
|
@@ -279,6 +280,7 @@
|
||||||
|
maxaddr = 0;
|
||||||
|
offsetaddr = 0;
|
||||||
|
nextaddr = 0;
|
||||||
|
+ lowest = bufsize;
|
||||||
|
|
||||||
|
while (fgets((char *)buffer,MAX_LINE_LEN,inf)!=NULL) {
|
||||||
|
lineno++;
|
||||||
|
@@ -313,11 +315,14 @@
|
||||||
|
for (i=0; i<ihex.reclen; i++) {
|
||||||
|
buf[nextaddr+i-offsetaddr] = ihex.data[i];
|
||||||
|
}
|
||||||
|
+ if (nextaddr-offsetaddr < lowest)
|
||||||
|
+ lowest = nextaddr-offsetaddr;
|
||||||
|
if (nextaddr+ihex.reclen > maxaddr)
|
||||||
|
maxaddr = nextaddr+ihex.reclen;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: /* end of file record */
|
||||||
|
+ *low_addr = lowest;
|
||||||
|
return maxaddr-offsetaddr;
|
||||||
|
break;
|
||||||
|
|
||||||
|
@@ -354,6 +359,7 @@
|
||||||
|
"file \"%s\"\n",
|
||||||
|
progname, infile);
|
||||||
|
|
||||||
|
+ *low_addr = lowest;
|
||||||
|
return maxaddr-offsetaddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -777,7 +783,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
static int fileio_ihex(struct fioparms * fio,
|
||||||
|
- char * filename, FILE * f, unsigned char * buf, int size)
|
||||||
|
+ char * filename, FILE * f, unsigned char * buf, int size,
|
||||||
|
+ int *low_addr)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
@@ -790,7 +797,7 @@
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIO_READ:
|
||||||
|
- rc = ihex2b(filename, f, buf, size);
|
||||||
|
+ rc = ihex2b(filename, f, buf, size, low_addr);
|
||||||
|
if (rc < 0)
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
@@ -1021,6 +1028,7 @@
|
||||||
|
struct fioparms fio;
|
||||||
|
AVRMEM * mem;
|
||||||
|
int using_stdio;
|
||||||
|
+ int low_addr = 0;
|
||||||
|
|
||||||
|
mem = avr_locate_mem(p, memtype);
|
||||||
|
if (mem == NULL) {
|
||||||
|
@@ -1113,7 +1121,7 @@
|
||||||
|
|
||||||
|
switch (format) {
|
||||||
|
case FMT_IHEX:
|
||||||
|
- rc = fileio_ihex(&fio, fname, f, buf, size);
|
||||||
|
+ rc = fileio_ihex(&fio, fname, f, buf, size, &low_addr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FMT_SREC:
|
||||||
|
@@ -1149,6 +1157,8 @@
|
||||||
|
*/
|
||||||
|
rc = avr_mem_hiaddr(mem);
|
||||||
|
}
|
||||||
|
+ if (op == FIO_READ && low_addr < mem->low_addr)
|
||||||
|
+ mem->low_addr = low_addr;
|
||||||
|
}
|
||||||
|
if (format != FMT_IMM && !using_stdio) {
|
||||||
|
fclose(f);
|
@ -1,3 +1,5 @@
|
|||||||
|
low-addr.patch
|
||||||
|
skip-low-addr.patch
|
||||||
nanonote.patch
|
nanonote.patch
|
||||||
nanonote-nxuart.patch
|
nanonote-nxuart.patch
|
||||||
nanonote-atusb.patch
|
nanonote-atusb.patch
|
||||||
|
36
avrdude/patches/skip-low-addr.patch
Normal file
36
avrdude/patches/skip-low-addr.patch
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
Index: avrdude/avrdude-5.10/avr.c
|
||||||
|
===================================================================
|
||||||
|
--- avrdude.orig/avrdude-5.10/avr.c 2011-03-08 23:46:53.000000000 -0300
|
||||||
|
+++ avrdude/avrdude-5.10/avr.c 2011-03-08 23:50:06.000000000 -0300
|
||||||
|
@@ -192,7 +192,8 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- for (i=0; i<size; i++) {
|
||||||
|
+ i = mem->paged ? mem->low_addr : 0;
|
||||||
|
+ for (; i<size; i++) {
|
||||||
|
rc = pgm->read_byte(pgm, p, mem, i, &rbyte);
|
||||||
|
if (rc != 0) {
|
||||||
|
fprintf(stderr, "avr_read(): error reading address 0x%04lx\n", i);
|
||||||
|
@@ -580,7 +581,8 @@
|
||||||
|
pgm->write_setup(pgm, p, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
- for (i=0; i<wsize; i++) {
|
||||||
|
+ i = m->paged ? m->low_addr-(m->low_addr % m->page_size) : 0;
|
||||||
|
+ for (; i<wsize; i++) {
|
||||||
|
data = m->buf[i];
|
||||||
|
report_progress(i, wsize, NULL);
|
||||||
|
|
||||||
|
Index: avrdude/avrdude-5.10/update.c
|
||||||
|
===================================================================
|
||||||
|
--- avrdude.orig/avrdude-5.10/update.c 2011-03-08 23:46:53.000000000 -0300
|
||||||
|
+++ avrdude/avrdude-5.10/update.c 2011-03-08 23:47:45.000000000 -0300
|
||||||
|
@@ -224,6 +224,7 @@
|
||||||
|
progname, mem->desc);
|
||||||
|
}
|
||||||
|
report_progress(0,1,"Reading");
|
||||||
|
+ mem->low_addr = 0; /* @@@ hackish */
|
||||||
|
rc = avr_read(pgm, p, upd->memtype, 0, 1);
|
||||||
|
if (rc < 0) {
|
||||||
|
fprintf(stderr, "%s: failed to read all of %s memory, rc=%d\n",
|
Loading…
Reference in New Issue
Block a user