This is the mail archive of the ecos-discuss@sources.redhat.com 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 device interface


Roland Caßebohm wrote:

On Dienstag, 4. November 2003 16:57, Roland Caßebohm wrote:
Hi again,

I'm just trying to use the flash device interface (/dev/flash1)
for accessing flash, but if I write to flash with write() I get
an "I/O error".

The problem seems to be, that flashiodev_bwrite() does not erase
the region before programming it. I also think about a possibility
to write regions, which are not block aligned.

Maybe the function calls flash_erase() and flash_program() block
by block and for the first and the last block which are not block
aligned, it first makes a copy of the current flash content,
replaces the to be written data in this copy and programs the copy
back.

I also want to use flash_read() instead of directly read the flash.
Then it should work with flashes with indirect access too.

Any suggestions?

In the attached patch I have made such a change, but as I have written in an other mail the devfs which is used by this layer doesn't support lseek() and fstat(). That's why it is even with this changes not possible to use a flash image like a file.

But at least erasing the flash before writing it should be done,
else the flash content would be corrupted.

[ ... ]

I don't think this is a way to go if you want to have byte access to your flash.
You have a read/modify/erase/write cycle if your data is not block alligned for every write -
a lot of work if you want to change just a byte of two, not to mention the limited amount of
times you can do that with one flash chip.


Using my block library should give you much better results.
It caches the blocks for you and writes only when block gets thrown out of cache or you
request it. Beside that you have byte access and block access functions and the cache size and
block size are configurable. You can write a simple filesystem on top of that wich suits your needs,
and this is really simple if all what you need is file like access to your flash region.


savin




-- Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos and search the list archive: http://sources.redhat.com/ml/ecos-discuss


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