mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-14 01:44:58 +00:00
Weaken -U memory type check and move after config file parsing in main.c
The check for typos in -U memory names against a list of known memory names now happens after the config files have been read, so newly declared memory names can be considered. This commit also weakens the check against existence of a known memory: it is now sufficent for a name to pass when it could be the initial string of any known memory of any part. Any -U memory that cannot possibly be matched up with a known memory is considered a typo and leads to an exit before the programmer is opened. This to protect users from typos that leave a device partially programmed. When every -U memory name might be matching one of the known memories, the programming is attempted. If the part to be programmed turns out not to have a particular -U memory, AVRDUDE warns the user and skips this -U update. This to support unifying interfaces that call AVRDUDE with potentially more memories than the actual part has (eg, efuse on ATmega8).
This commit is contained in:
@@ -751,6 +751,7 @@ int main(int argc, char * argv [])
|
||||
bitclock = default_bitclock;
|
||||
}
|
||||
|
||||
|
||||
avrdude_message(MSG_NOTICE, "\n");
|
||||
|
||||
// developer option -p <wildcard>/[*codws] prints various aspects of part descriptions and exits
|
||||
@@ -918,6 +919,12 @@ int main(int argc, char * argv [])
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!avr_mem_might_be_known(upd->memtype)) {
|
||||
avrdude_message(MSG_INFO, "%s: unknown memory type %s\n", progname, upd->memtype);
|
||||
exit(1);
|
||||
}
|
||||
// TODO: check whether filename other than "-" is readable/writable
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user