This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
alignment issue when writing to flash
- From: Edgar Grimberg <edgar dot grimberg at zylin dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Fri, 22 Feb 2008 10:07:31 +0100
- Subject: [ECOS] alignment issue when writing to flash
- Reply-to: edgar dot grimberg at zylin dot com
Hi,
I'm sharing this information, maybe the documentation needs a bit of
adjustment.
Having this code:
unsigned char buffer[1024];
.............
flash_program(addr, buffer, 1024, &err_addr);
and the flash is 16bit, flash_program can produce unwanted results,
because the address of buffer can be located at an unaligned location.
In the documentation, as there is a warning for flash_erase working only
with sectors, there should be some warning on flash_program that the
source data should be aligned.
Also, writing just one byte to a 16bit flash should be done by first
reading the 16bit data from flash first, and then writing the correct
half-word back.
Best regards,
Edgar
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss