This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: flash/am29xxxxx flash_program_buf length fix


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]