This is the mail archive of the
mailing list for the eCos project.
Re: flash/am29xxxxx flash_program_buf length fix
- From: David Vrabel <dvrabel at arcom dot com>
- To: Peter Korsgaard <jacmet at sunsite dot dk>
- Cc: ecos-patches at ecos dot sourceware dot org
- Date: Thu, 01 Sep 2005 10:12:30 +0100
- Subject: Re: flash/am29xxxxx flash_program_buf length fix
- References: <email@example.com>
Peter Korsgaard wrote:
> --- packages/devs/flash/amd/am29xxxxx/current/ChangeLog 12 Jun 2005 13:41:11 -0000 1.35
> +++ packages/devs/flash/amd/am29xxxxx/current/ChangeLog 31 Aug 2005 20:19:57 -0000
> @@ -1,5 +1,10 @@
> +2005-08-31 Peter Korsgaard <firstname.lastname@example.org>
> + * include/flash_am29xxxxx.inl (flash_program_buf): Round up length
> + to next multiple of flash word size.
I don't think this is correct. You're going to overwrite the partial
word following the buffer you're writing with garbage.
I think instead an check (in addition to the check to ensure the buffer
is word-size aligned) needs to be made at the start of
flash_program_buf() to ensure the len is a multiple of word size.
Something like this, I think:
if (len & (CYGNUM_FLASH_INTERLEAVE * CYGNUM_FLASH_WIDTH / 8 - 1))
This will require that you fix the caller.
David Vrabel, Design Engineer
Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK Web: http://www.arcom.com/