Skip to content

Commit

Permalink
Exit avrftdi_jtag_enable() when encountering incompatible chip
Browse files Browse the repository at this point in the history
The use of exit() is brought about by the fact that, unlike all other
programming functions, pgm->enable() is of type void, ie, cannot easily
tell the caller something went wrong.
  • Loading branch information
stefanrueger committed Jul 31, 2023
1 parent fb63b28 commit c1d7f91
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/avrftdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,18 @@ static int avrftdi_jtag_dr_inout(const PROGRAMMER *pgm, unsigned int dr,

static void avrftdi_jtag_enable(PROGRAMMER *pgm, const AVRPART *p)
{
if(!ovsigck) {
if(str_eq(p->id, "m128a") || str_eq(p->id, "m128") ||
str_eq(p->id, "m64a") || str_eq(p->id, "m64") ||
str_eq(p->id, "m32a") || str_eq(p->id, "m32") ||
str_eq(p->id, "m16a") || str_eq(p->id, "m16") ||
str_eq(p->id, "m162")) {
pmsg_error("programmer type %s is known not to work for %s\n", pgm->type, p->desc);
imsg_error("exiting; use -F to carry on regardless\n");
exit(1);
}
}

pgm->powerup(pgm);

set_pin(pgm, PIN_AVR_RESET, OFF);
Expand Down

0 comments on commit c1d7f91

Please sign in to comment.