mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-19 08:21:54 +02:00
f67681360f
Only one trivial context mismatch. Plus a refresh of all the patches.
143 lines
4.0 KiB
Diff
143 lines
4.0 KiB
Diff
Index: avrdude-5.11.1/avrpart.h
|
|
===================================================================
|
|
--- avrdude-5.11.1.orig/avrpart.h 2012-07-22 10:29:39.275651769 -0300
|
|
+++ avrdude-5.11.1/avrpart.h 2012-07-22 10:29:41.387721159 -0300
|
|
@@ -186,6 +186,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-5.11.1/config_gram.y
|
|
===================================================================
|
|
--- avrdude-5.11.1.orig/config_gram.y 2012-07-22 10:29:39.287652163 -0300
|
|
+++ avrdude-5.11.1/config_gram.y 2012-07-22 10:29:41.391721290 -0300
|
|
@@ -1297,6 +1297,7 @@
|
|
}
|
|
mem_specs
|
|
{
|
|
+ current_mem->low_addr = current_mem->size;
|
|
ladd(current_part->mem, current_mem);
|
|
current_mem = NULL;
|
|
} |
|
|
Index: avrdude-5.11.1/fileio.c
|
|
===================================================================
|
|
--- avrdude-5.11.1.orig/fileio.c 2012-07-22 10:29:39.263651374 -0300
|
|
+++ avrdude-5.11.1/fileio.c 2012-07-22 10:29:41.391721290 -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);
|