This is the mail archive of the ecos-discuss@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]

alignment issue when writing to flash


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


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