avrdudes / avarice

AVaRICE is a program for interfacing the Atmel JTAG ICE to GDB to allow users to debug their embedded AVR target.
GNU General Public License v2.0
38 stars 12 forks source link

[patch #7] set parameter command failed #41

Closed avrs-admin closed 2 years ago

avrs-admin commented 2 years ago

skut 2007-07-09 07:54:01

avarice -r -2 -j usb -w :1212

however fails with the following message: $ avarice -2 -j usb -w :1212 AVaRICE version 2.6.20070222, Apr 29 2007 11:16:28

Defaulting JTAG bitrate to 1 MHz. Make sure that the target frequency is at least 4 MHz or you will likely encounter failures controlling the target.

JTAG config starting. Found a device: JTAGICEmkII Serial number: 00:b0:00:00:16:01 Reported debugWire device ID: 0x9406 Configured for device ID: 0x9406 atmega168 JTAG config complete. Preparing the target device for On Chip Debugging. set paramater command failed

when I run with the -d option I see the following:

command[0x02, 10]: 02 09 00 recv: 0x1b recv: 0x06 recv: 0x00 recv: 0x01 recv: 0x00 recv: 0x00 recv: 0x00 recv: 0x0e sDATA: reading 1 bytes read: a0 recv: 0xc1 recv: 0x3e CRC OK Got message seqno 6 (command_sequence == 6) response: A0 set parameter command failed

Jorge's Patch

Using hack below, I got my local version working around it. Still, it's not clear to me why the ICE reacts that allergic to the combination of commands issed. My only guess so far is that after the resetProgram(), we should rather expect the "break" event being returned, and await that before trying to set parameters. So perhaps it would suffice to just remove the first resetProgram() call (there's a second afterwards anyway).

Index: src/jtag2io.cc

RCS file: /home/cvs/avarice/avarice/src/jtag2io.cc,v retrieving revision 1.11 diff -u -u -r1.11 jtag2io.cc --- src/jtag2io.cc 17 Feb 2007 22:41:46 -0000 1.11 +++ src/jtag2io.cc 7 May 2007 19:55:24 -0000 @@ -688,9 +688,9 @@ }

  • resetProgram();
  • uchar timers = 0; // stopped
  • setJtagParameter(PAR_TIMERS_RUNNING, &timers, 1); +// resetProgram(); +// uchar timers = 0; // stopped +// setJtagParameter(PAR_TIMERS_RUNNING, &timers, 1); resetProgram(); }

This issue was migrated from https://sourceforge.net/p/avarice/patches/7/

avrs-admin commented 2 years ago

joerg_wunsch 2008-05-26 12:49:22

Logged In: YES user_id=1097648 Originator: NO

Fixed but using a different approach than the hack I once suggested. jtag2::resetProgram() now calls jtag2::eventLoop() immediately after issuing CMND_RESET, in order to catch the EVT_BREAK event posted by the ICE. Thus, program flow only continues after the ICE is guaranteed to have the target in stopped state.

avrs-admin commented 2 years ago

joerg_wunsch 2008-05-26 12:49:23