[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avrdude-dev] chip_erase and cycle_count cleanup
From: |
Jan-Hinnerk Reichert |
Subject: |
Re: [avrdude-dev] chip_erase and cycle_count cleanup |
Date: |
Mon, 1 Dec 2003 13:07:39 +0100 |
User-agent: |
KMail/1.5.1 |
On Monday 01 December 2003 04:06, Brian Dean wrote:
> On Sun, Nov 30, 2003 at 10:53:52PM +0100, Jan-Hinnerk Reichert
wrote:
> > However, I'm still unsure about a few things.
> > - I have added a check, so that cycle count isn't tracked, if it
> > can't be read before erase. Is this the right thing to do?
>
> Sounds reasonable. If it cannot be read, it cannot be updated.
>
> > - Why is cycle count reset at 0xffff?
>
> Good question. I think this is a bug. I think it should be
> compared against 0xffffffff. A long time ago the cycle count was
> 16 bits, but was later changed to 32 bits. This code was progably
> missed.
There was another goodie in avr_get_cycle(). If the count was
0xffffffff it was set to 0xffff. So, every check against 0xffffffff
was not doing anything.
> The idea here is that if '-y' is specified, but we are using a
> blank chip, i.e., one where -Y has never been used, just assume
> that 0xffffffff means 0 for the cycle count instead of forcing
> someone to initialize the cycle count to 0 first.
Okay, I now do the following: avr_get_cycle_count() returns 0 in
cycles if 0xffffffff is read.
The only downside is that -y does not display the cycle count if it is
not set yet and no erase is performed.
I also changed the output logic a bit:
- main.c outputs the cycle count, if it is not set anywhere else.
- on all other occasions cycle count is output, if and only if it is
set.
And I changed avr_get_cycle_count() and avr_set_cycle_count() to use a
loop. I'm not sure, if this increases or decreases readability.
Patch still works fine for avr910.
> At least that is what I think. I've been tracking down the origin
> of that code via CVS. Funny how we come full circle - there
> actually used to be an avr_chip_erase() function in avr.c and that
> is where the cycle count code eventually ended up (moved from
> main.c). Later, the avr_chip_erase() function became the
> pgm->erase() function for each programmer, and at that time there
> were only 2 programmers: ppi and stk500.
;-)
/Jan-Hinnerk
cycle_count2.diff
Description: Text Data
- Re: [avrdude-dev] chip_erase and cycle_count cleanup,
Jan-Hinnerk Reichert <=
- Re: [avrdude-dev] chip_erase and cycle_count cleanup, Jan-Hinnerk Reichert, 2003/12/01
- Re: [avrdude-dev] chip_erase and cycle_count cleanup, Theodore A. Roth, 2003/12/01
- Re: [avrdude-dev] chip_erase and cycle_count cleanup, Jan-Hinnerk Reichert, 2003/12/01
- Re: [avrdude-dev] chip_erase and cycle_count cleanup, Jan-Hinnerk Reichert, 2003/12/01
- Re: [avrdude-dev] chip_erase and cycle_count cleanup, Theodore A. Roth, 2003/12/02
- Re: [avrdude-dev] chip_erase and cycle_count cleanup, Jan-Hinnerk Reichert, 2003/12/01
- Re: [avrdude-dev] chip_erase and cycle_count cleanup, Theodore A. Roth, 2003/12/01