Added some verbose-level messages.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1259 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
efc87b6d2e
commit
e2462d535f
|
@ -1,3 +1,8 @@
|
||||||
|
2014-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||||
|
|
||||||
|
* flip.c: Added some verbose-level messages (-vv)
|
||||||
|
* dfu.c: Added some verbose-level messages (-vvvv)
|
||||||
|
|
||||||
2014-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
2014-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||||
|
|
||||||
Submitted by Kirill Levchenko:
|
Submitted by Kirill Levchenko:
|
||||||
|
|
35
dfu.c
35
dfu.c
|
@ -110,7 +110,7 @@ struct dfu_dev * dfu_open(char *port_spec)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (strncmp(port_spec, "usb", 3) != 0) {
|
if (strncmp(port_spec, "usb", 3) != 0) {
|
||||||
fprintf(stderr, "%s: Error: " \
|
fprintf(stderr, "%s: Error: "
|
||||||
"Invalid port specification \"%s\" for USB device\n",
|
"Invalid port specification \"%s\" for USB device\n",
|
||||||
progname, port_spec);
|
progname, port_spec);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -168,7 +168,7 @@ int dfu_init(struct dfu_dev *dfu, unsigned short vid, unsigned short pid)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (pid == 0 && dfu->dev_name == NULL) {
|
if (pid == 0 && dfu->dev_name == NULL) {
|
||||||
fprintf(stderr, "%s: Error: No DFU support for part; " \
|
fprintf(stderr, "%s: Error: No DFU support for part; "
|
||||||
"specify PID in config or USB address (via -P) to override.\n",
|
"specify PID in config or USB address (via -P) to override.\n",
|
||||||
progname);
|
progname);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -311,6 +311,10 @@ int dfu_getstatus(struct dfu_dev *dfu, struct dfu_status *status)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
if (verbose > 3)
|
||||||
|
fprintf(stderr, "%s: dfu_getstatus(): issuing control IN message\n",
|
||||||
|
progname);
|
||||||
|
|
||||||
result = usb_control_msg(dfu->dev_handle,
|
result = usb_control_msg(dfu->dev_handle,
|
||||||
0x80 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_GETSTATUS, 0, 0,
|
0x80 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_GETSTATUS, 0, 0,
|
||||||
(char*) status, sizeof(struct dfu_status), DFU_TIMEOUT);
|
(char*) status, sizeof(struct dfu_status), DFU_TIMEOUT);
|
||||||
|
@ -328,11 +332,20 @@ int dfu_getstatus(struct dfu_dev *dfu, struct dfu_status *status)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result > sizeof(struct dfu_status)) {
|
if (result > sizeof(struct dfu_status)) {
|
||||||
fprintf(stderr, "%s: Error: Oversize read (should not happen); " \
|
fprintf(stderr, "%s: Error: Oversize read (should not happen); "
|
||||||
"exiting\n", progname);
|
"exiting\n", progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (verbose > 3)
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: dfu_getstatus(): bStatus 0x%02x, bwPollTimeout %d, bState 0x%02x, iString %d\n",
|
||||||
|
progname,
|
||||||
|
status->bStatus,
|
||||||
|
status->bwPollTimeout[0] | (status->bwPollTimeout[1] << 8) | (status->bwPollTimeout[2] << 16),
|
||||||
|
status->bState,
|
||||||
|
status->iString);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,6 +353,10 @@ int dfu_clrstatus(struct dfu_dev *dfu)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
if (verbose > 3)
|
||||||
|
fprintf(stderr, "%s: dfu_clrstatus(): issuing control OUT message\n",
|
||||||
|
progname);
|
||||||
|
|
||||||
result = usb_control_msg(dfu->dev_handle,
|
result = usb_control_msg(dfu->dev_handle,
|
||||||
USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_CLRSTATUS, 0, 0,
|
USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_CLRSTATUS, 0, 0,
|
||||||
NULL, 0, DFU_TIMEOUT);
|
NULL, 0, DFU_TIMEOUT);
|
||||||
|
@ -357,6 +374,11 @@ int dfu_dnload(struct dfu_dev *dfu, void *ptr, int size)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
if (verbose > 3)
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: dfu_dnload(): issuing control OUT message, wIndex = %d, ptr = %p, size = %d\n",
|
||||||
|
progname, wIndex, ptr, size);
|
||||||
|
|
||||||
result = usb_control_msg(dfu->dev_handle,
|
result = usb_control_msg(dfu->dev_handle,
|
||||||
USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_DNLOAD, wIndex++, 0,
|
USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_DNLOAD, wIndex++, 0,
|
||||||
ptr, size, DFU_TIMEOUT);
|
ptr, size, DFU_TIMEOUT);
|
||||||
|
@ -386,6 +408,11 @@ int dfu_upload(struct dfu_dev *dfu, void *ptr, int size)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
if (verbose > 3)
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: dfu_upload(): issuing control IN message, wIndex = %d, ptr = %p, size = %d\n",
|
||||||
|
progname, wIndex, ptr, size);
|
||||||
|
|
||||||
result = usb_control_msg(dfu->dev_handle,
|
result = usb_control_msg(dfu->dev_handle,
|
||||||
0x80 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_UPLOAD, wIndex++, 0,
|
0x80 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_UPLOAD, wIndex++, 0,
|
||||||
ptr, size, DFU_TIMEOUT);
|
ptr, size, DFU_TIMEOUT);
|
||||||
|
@ -403,7 +430,7 @@ int dfu_upload(struct dfu_dev *dfu, void *ptr, int size)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result > size) {
|
if (result > size) {
|
||||||
fprintf(stderr, "%s: Error: Oversize read (should not happen); " \
|
fprintf(stderr, "%s: Error: Oversize read (should not happen); "
|
||||||
"exiting\n", progname);
|
"exiting\n", progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
33
flip.c
33
flip.c
|
@ -301,6 +301,9 @@ int flip2_chip_erase(PROGRAMMER* pgm, AVRPART *part)
|
||||||
int cmd_result = 0;
|
int cmd_result = 0;
|
||||||
int aux_result;
|
int aux_result;
|
||||||
|
|
||||||
|
if (verbose > 1)
|
||||||
|
fprintf(stderr, "%s: flip_chip_erase()\n", progname);
|
||||||
|
|
||||||
struct flip2_cmd cmd = {
|
struct flip2_cmd cmd = {
|
||||||
FLIP2_CMD_GROUP_EXEC, FLIP2_CMD_CHIP_ERASE, { 0xFF, 0, 0, 0 }
|
FLIP2_CMD_GROUP_EXEC, FLIP2_CMD_CHIP_ERASE, { 0xFF, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
@ -339,7 +342,7 @@ int flip2_read_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
|
||||||
mem_unit = flip2_mem_unit(mem->desc);
|
mem_unit = flip2_mem_unit(mem->desc);
|
||||||
|
|
||||||
if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) {
|
if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) {
|
||||||
fprintf(stderr, "%s: Error: " \
|
fprintf(stderr, "%s: Error: "
|
||||||
"\"%s\" memory not accessible using FLIP",
|
"\"%s\" memory not accessible using FLIP",
|
||||||
progname, mem->desc);
|
progname, mem->desc);
|
||||||
if (strcmp(mem->desc, "flash") == 0)
|
if (strcmp(mem->desc, "flash") == 0)
|
||||||
|
@ -362,7 +365,7 @@ int flip2_write_byte(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
|
||||||
mem_unit = flip2_mem_unit(mem->desc);
|
mem_unit = flip2_mem_unit(mem->desc);
|
||||||
|
|
||||||
if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) {
|
if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) {
|
||||||
fprintf(stderr, "%s: Error: " \
|
fprintf(stderr, "%s: Error: "
|
||||||
"\"%s\" memory not accessible using FLIP",
|
"\"%s\" memory not accessible using FLIP",
|
||||||
progname, mem->desc);
|
progname, mem->desc);
|
||||||
if (strcmp(mem->desc, "flash") == 0)
|
if (strcmp(mem->desc, "flash") == 0)
|
||||||
|
@ -392,7 +395,7 @@ int flip2_paged_load(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
|
||||||
mem_unit = flip2_mem_unit(mem->desc);
|
mem_unit = flip2_mem_unit(mem->desc);
|
||||||
|
|
||||||
if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) {
|
if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) {
|
||||||
fprintf(stderr, "%s: Error: " \
|
fprintf(stderr, "%s: Error: "
|
||||||
"\"%s\" memory not accessible using FLIP",
|
"\"%s\" memory not accessible using FLIP",
|
||||||
progname, mem->desc);
|
progname, mem->desc);
|
||||||
if (strcmp(mem->desc, "flash") == 0)
|
if (strcmp(mem->desc, "flash") == 0)
|
||||||
|
@ -411,11 +414,6 @@ int flip2_paged_load(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
|
||||||
result = flip2_read_memory(FLIP2(pgm)->dfu, mem_unit, addr,
|
result = flip2_read_memory(FLIP2(pgm)->dfu, mem_unit, addr,
|
||||||
mem->buf + addr, n_bytes);
|
mem->buf + addr, n_bytes);
|
||||||
|
|
||||||
#if 0 /* DEBUG */
|
|
||||||
fprintf(stderr, "%s: Debug: flip2_read_memory(%s,0x%04X,0x%04X) = %d\n",
|
|
||||||
progname, mem->desc, addr, n_bytes, result);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return (result == 0) ? n_bytes : -1;
|
return (result == 0) ? n_bytes : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +429,7 @@ int flip2_paged_write(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
|
||||||
mem_unit = flip2_mem_unit(mem->desc);
|
mem_unit = flip2_mem_unit(mem->desc);
|
||||||
|
|
||||||
if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) {
|
if (mem_unit == FLIP2_MEM_UNIT_UNKNOWN) {
|
||||||
fprintf(stderr, "%s: Error: " \
|
fprintf(stderr, "%s: Error: "
|
||||||
"\"%s\" memory not accessible using FLIP",
|
"\"%s\" memory not accessible using FLIP",
|
||||||
progname, mem->desc);
|
progname, mem->desc);
|
||||||
if (strcmp(mem->desc, "flash") == 0)
|
if (strcmp(mem->desc, "flash") == 0)
|
||||||
|
@ -450,12 +448,7 @@ int flip2_paged_write(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem,
|
||||||
result = flip2_write_memory(FLIP2(pgm)->dfu, mem_unit, addr,
|
result = flip2_write_memory(FLIP2(pgm)->dfu, mem_unit, addr,
|
||||||
mem->buf + addr, n_bytes);
|
mem->buf + addr, n_bytes);
|
||||||
|
|
||||||
#if 0 /* DEBUG */
|
return (result == 0) ? n_bytes : -1;
|
||||||
fprintf(stderr, "%s: Debug: flip2_write_memory(%s,0x%04X,0x%04X) = %d\n",
|
|
||||||
progname, mem->desc, addr, n_bytes, result);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int flip2_read_sig_bytes(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem)
|
int flip2_read_sig_bytes(PROGRAMMER* pgm, AVRPART *part, AVRMEM *mem)
|
||||||
|
@ -526,6 +519,11 @@ int flip2_read_memory(struct dfu_dev *dfu,
|
||||||
int read_size;
|
int read_size;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
if (verbose > 1)
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: flip_read_memory(%s, 0x%04x, %d)\n",
|
||||||
|
progname, flip2_mem_unit_str(mem_unit), addr, size);
|
||||||
|
|
||||||
result = flip2_set_mem_unit(dfu, mem_unit);
|
result = flip2_set_mem_unit(dfu, mem_unit);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
|
@ -586,6 +584,11 @@ int flip2_write_memory(struct dfu_dev *dfu,
|
||||||
int write_size;
|
int write_size;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
if (verbose > 1)
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: flip_write_memory(%s, 0x%04x, %d)\n",
|
||||||
|
progname, flip2_mem_unit_str(mem_unit), addr, size);
|
||||||
|
|
||||||
result = flip2_set_mem_unit(dfu, mem_unit);
|
result = flip2_set_mem_unit(dfu, mem_unit);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
|
|
Loading…
Reference in New Issue