avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avrdude-dev] I think I have solved the Verify issues on Win2K


From: Alex Shepherd
Subject: [avrdude-dev] I think I have solved the Verify issues on Win2K
Date: Tue, 22 Jul 2003 22:53:13 +1200

Hi Guys,

I think I have solved the verify problem - well for me anyway!

I have been experimenting with the source code in the file:
avrdude-4.1.0.tar.gz and replaced the cygwin usleep() library function with
a local version by adding the code at the bottom of this e-mail into the
ppiwin.c file at about line 76 just below the function prototypes. The code
came from the uisp function TDAPA::Delay_usec in the DAPA.C file.

With this new code, avrdude seems to work fine and when I remove it by
commenting out the "#define _REPLACE_USLEEP_" statement and recompiling then
it fails almost immediately, so it would appear to fix the time delay
problem for me.

Another thing that may have been masking the problem is that I had also
changed the code to do with printing the number of bytes processed in avr.c
to simply print a '.' every 128 cycles instead of printing the offset every
16. This is so it doesn't add heaps of lines to the command output window on
the IDE I'm using.

I'm wondering if printing after every 16 as it was may have had the side
effect of causing a longer delay after every 16 bytes, masking the usleep
deficiency.

The code changes were as follows (note there are two instances)
from:
    if (verbose) {
      if ((i % 16 == 0)||(i == (size-1))) {
        printed = 1;
        fprintf(stderr, "\r        \r%6lu", i);
      }
    }

to:
    if (verbose) {
      if ((i % 128 == 0)||(i == (size-1))) {
        printed = 1;
        fprintf(stderr, ".");
      }
    }

I'm not setup to commit to CVS (long story) so would one of you guys who can
please try these changes and rearrange/relocate the new usleep() code as
appropriate (maybe change the function name to not clash with the library
usleep() or whatever you think is best) and commit it into CVS so we all get
them next release.

I would also appreciate it if you added the '.' printing into avr.c as well!

Cheers

Alex Shepherd

=====================================================
#define _REPLACE_USLEEP_
#ifdef _REPLACE_USLEEP_
#include <sys/time.h>

#ifndef MIN_SLEEP_USEC
#define MIN_SLEEP_USEC 20000
#endif

unsigned usleep( unsigned int uSeconds )
{
  struct timeval t1, t2;

  gettimeofday(&t1, NULL);
  if (uSeconds > MIN_SLEEP_USEC)
    usleep(uSeconds - MIN_SLEEP_USEC);
  /* loop for the remaining time */
  t2.tv_sec = uSeconds / 1000000UL;
  t2.tv_usec = uSeconds % 1000000UL;
  timeradd(&t1, &t2, &t1);
  do
  {
    gettimeofday(&t2, NULL);
  } while (timercmp(&t2, &t1, <));
}

#endif
=====================================================

Cheers

Alex Shepherd

Phone  (Home) +64 (7) 854 0819
Email: address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]