flash/am29xxxxx flash_program_buf length fix
David Vrabel
dvrabel@arcom.com
Thu Sep 1 09:13:00 GMT 2005
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 <jacmet@sunsite.dk>
> +
> + * 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))
return FLASH_ERR_INVALID;
This will require that you fix the caller.
David Vrabel
--
David Vrabel, Design Engineer
Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK Web: http://www.arcom.com/
More information about the Ecos-patches
mailing list