int flip2_parseextparams(PROGRAMMER* pgm, LISTID
extparams)
{
LNODEID ln;
const char *extended_param;
//struct dfu_status status;
int cmd_result = 0;
//int aux_result;
for (ln = lfirst(extparams); ln; ln = lnext(ln)) {
extended_param = ldata(ln);
if (strncmp(extended_param, "s", strlen("s")) == 0) {
if (verbose >= 2)
fprintf(stderr,
"%s: flip2_parseextparams(): start
application\n", progname);
struct flip2_cmd cmd = {
FLIP2_CMD_GROUP_EXEC, FLIP2_CMD_START_APP, { 0x00,
0, 0, 0 }
};
cmd_result = dfu_dnload(FLIP2(pgm)->dfu,
&cmd, sizeof(cmd));
aux_result = dfu_getstatus(FLIP2(pgm)->dfu,
&status);
if (aux_result != 0)
return aux_result;
if (status.bStatus != DFU_STATUS_OK) {
fprintf(stderr, "%s: Error: DFU status %s\n",
progname,
flip2_status_str(&status));
dfu_clrstatus(FLIP2(pgm)->dfu);
} else
break;
break;
}
fprintf(stderr,
"%s: wiring_parseextparms(): invalid
extended parameter '%s'\n",
progname, extended_param);
cmd_result = -1;
}
return cmd_result;
}
Hey,
In the DFU FLIP there is a "Start application" command: http://www.atmel.com/Images/doc8457.pdf [Page 13]
In flip2.c (DFU implementation for avrdude) this command is not implemented,
So I added another function:
int flip2_parseextparams(PROGRAMMER* pgm, LISTID extparams) { LNODEID ln; const char *extended_param; //struct dfu_status status; int cmd_result = 0; //int aux_result; for (ln = lfirst(extparams); ln; ln = lnext(ln)) { extended_param = ldata(ln); if (strncmp(extended_param, "s", strlen("s")) == 0) { if (verbose >= 2) fprintf(stderr, "%s: flip2_parseextparams(): start application\n", progname); struct flip2_cmd cmd = { FLIP2_CMD_GROUP_EXEC, FLIP2_CMD_START_APP, { 0x00, 0, 0, 0 } }; cmd_result = dfu_dnload(FLIP2(pgm)->dfu, &cmd, sizeof(cmd)); aux_result = dfu_getstatus(FLIP2(pgm)->dfu, &status); if (aux_result != 0) return aux_result; if (status.bStatus != DFU_STATUS_OK) { fprintf(stderr, "%s: Error: DFU status %s\n", progname, flip2_status_str(&status)); dfu_clrstatus(FLIP2(pgm)->dfu); } else break; break; } fprintf(stderr, "%s: flip2_parseextparams(): invalid extended parameter '%s'\n", progname, extended_param); cmd_result = -1; } return cmd_result; }
But when I run it, I get the next error:
Segmentation fault (core dumped)
What is the problem?