This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: flash/am29xxxxx flash_program_buf length fix
- From: Peter Korsgaard <jacmet at sunsite dot dk>
- To: David Vrabel <dvrabel at arcom dot com>
- Cc: ecos-patches at ecos dot sourceware dot org
- Date: Thu, 01 Sep 2005 21:57:43 +0200
- Subject: Re: flash/am29xxxxx flash_program_buf length fix
- References: <87wtm1263m.fsf@p4.48ers.dk> <4316C5FE.7000305@arcom.com>
>>>>> "David" == David Vrabel <dvrabel@arcom.com> writes:
David> I don't think this is correct. You're going to overwrite the
David> partial word following the buffer you're writing with garbage.
True, it isn't perfect, but neither is the current approach of simply
discarding the last bytes.
David> I think instead an check (in addition to the check to ensure
David> the buffer is word-size aligned) needs to be made at the start
David> of flash_program_buf() to ensure the len is a multiple of word
David> size. Something like this, I think:
David> if (len & (CYGNUM_FLASH_INTERLEAVE * CYGNUM_FLASH_WIDTH /
David> 8 - 1)) return FLASH_ERR_INVALID;
David> This will require that you fix the caller.
But then the caller needs to the flash width - is there a simple way
to do that?
The problem comes up fairly often in RedBoot here when we update the (gzip
compressed) application in flash with a simple:
fis create app
If you're lucky this compilation exactly takes up a multiple of the
flash word size and it works, and if not you get a flash verify error
because the remaining bytes weren't written :/
Suggestions?
--
Bye, Peter Korsgaard