* update.c (parse_op): do not assume default memtype here

* main.c: after locating the part information, determine default
memtype for all update options that didn't have a memtype
specified; this is "application" for Xmega parts, and "flash" for
everything else.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1086 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch
2012-04-25 16:32:23 +00:00
parent 0bda6f26d1
commit c4bcc20e07
4 changed files with 46 additions and 10 deletions

24
main.c
View File

@@ -859,6 +859,30 @@ int main(int argc, char * argv [])
exit(1);
}
/*
* Now that we know which part we are going to program, locate any
* -U options using the default memory region, and fill in the
* device-dependent default region name, either "application" (for
* Xmega devices), or "flash" (everything else).
*/
for (ln=lfirst(updates); ln; ln=lnext(ln)) {
upd = ldata(ln);
if (upd->memtype == NULL) {
const char *mtype = (p->flags & AVRPART_HAS_PDI)? "application": "flash";
if (verbose >= 2) {
fprintf(stderr,
"%s: defaulting memtype in -U %c:%s option to \"%s\"\n",
progname,
(upd->op == DEVICE_READ)? 'r': (upd->op == DEVICE_WRITE)? 'w': 'v',
upd->filename, mtype);
}
if ((upd->memtype = strdup(mtype)) == NULL) {
fprintf(stderr, "%s: out of memory\n", progname);
exit(1);
}
}
}
/*
* open the programmer
*/