mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-13 17:34:56 +00:00
2006-02-27 Colin O'Flynn <coflynn@newae.com>
Contributed by Wim Lewis, add support for checking device
signatures in detail (patch #4924 and #4925)
* avrdude.conf.in: Add signatures
* avrpart.c: Set default signature
* avrpart.h: Variable for signature
* config_gram.y: More signature reading
* lexer.l: Define that signatures exist
* main.c: Read signatures and check them against hardware
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@573 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
@@ -1201,8 +1201,8 @@ int main(int argc, char * argv [])
|
||||
/*
|
||||
* Let's read the signature bytes to make sure there is at least a
|
||||
* chip on the other end that is responding correctly. A check
|
||||
* against 0xffffffff should ensure that the signature bytes are
|
||||
* valid.
|
||||
* against 0xffffff / 0x000000 should ensure that the signature bytes
|
||||
* are valid.
|
||||
*/
|
||||
rc = avr_signature(pgm, p);
|
||||
if (rc != 0) {
|
||||
@@ -1220,24 +1220,26 @@ int main(int argc, char * argv [])
|
||||
}
|
||||
|
||||
if (sig != NULL) {
|
||||
int ff;
|
||||
int ff, zz;
|
||||
|
||||
if (quell_progress < 2) {
|
||||
fprintf(stderr, "%s: Device signature = 0x", progname);
|
||||
}
|
||||
ff = 1;
|
||||
ff = zz = 1;
|
||||
for (i=0; i<sig->size; i++) {
|
||||
if (quell_progress < 2) {
|
||||
fprintf(stderr, "%02x", sig->buf[i]);
|
||||
}
|
||||
if (sig->buf[i] != 0xff)
|
||||
ff = 0;
|
||||
if (sig->buf[i] != 0x00)
|
||||
zz = 0;
|
||||
}
|
||||
if (quell_progress < 2) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
if (ff) {
|
||||
if (ff || zz) {
|
||||
fprintf(stderr,
|
||||
"%s: Yikes! Invalid device signature.\n", progname);
|
||||
if (!ovsigck) {
|
||||
@@ -1249,6 +1251,23 @@ int main(int argc, char * argv [])
|
||||
goto main_exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (sig->size != 3 ||
|
||||
sig->buf[0] != p->signature[0] ||
|
||||
sig->buf[1] != p->signature[1] ||
|
||||
sig->buf[2] != p->signature[2]) {
|
||||
fprintf(stderr,
|
||||
"%s: Expected signature for %s is %02X %02X %02X\n",
|
||||
progname, p->desc,
|
||||
p->signature[0], p->signature[1], p->signature[2]);
|
||||
if (!ovsigck) {
|
||||
fprintf(stderr, "%sDouble check chip, "
|
||||
"or use -F to override this check.\n",
|
||||
progbuf);
|
||||
exitrc = 1;
|
||||
goto main_exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (safemode == 1) {
|
||||
|
||||
Reference in New Issue
Block a user