[ECOS] devfs cyg_io_flash

Moussa Ba mba@embedded-zone.com
Wed Jul 26 14:09:00 GMT 2006

I realized after sending the email, however, I should be able to do an 
open("/dev/flash1",O_WRONLY); and use the standard file io operation on 
the flash? I am referring to Chapter 29 of the ecos ref manual


  Chapter 29. FLASH I/O devices

*Table of Contents*
Overview and CDL Configuration 
Using FLASH I/O devices 

It can be useful to be able to access FLASH devices using the generic 
I/O infrastructure found in |CYGPKG_IO|, and the generic FLASH layer 
provides an optional ability to do so. This allows the use of functions 
like |cyg_io_lookup()|, |cyg_io_read()|, |cyg_io_write()| etc.

Additionally it means that, courtesy of the “devfs” pseudo-filesystem in 
the file I/O layer (|CYGPKG_IO_FILEIO|), functions like |open()|, 
|read()|, |write()| etc. can even be used directly on the FLASH devices.

Nick Garnett wrote:
> "Moussa A. Ba" <mba@embedded-zone.com> writes:
>> I am able to successfully read and write from y ATMEL dataflash using
>> cyg_io_read cyg_io_program.... I am attempting to use the devfs from
>> CYGPKG_IO_FILEIO but I am encountering some difficulty.  I have
>> selected the option to provide a block device from the flash driver
>> such that my device is hat /dev/flash1
>> In my test code I do the following
>> mount("/dev/flash1","/","devfs");
>> createfile("/foo",200);
>> checkfile("/foo");
>> When I run this I get :
>> <INFO>: create file /foo size 200
>> <INFO>: open() returned -1 No such entity
>> <INFO>: write() returned -1 Bad file handle
>> <INFO>: write() returned -1 Bad file handle
>> I have not setup the MTAB entries statically as I assume that mount
>> would take care of it dynamically, am I missing something?
> devfs is no a proper filesystem, it merely maps device IO operations
> onto the standard file IO operations. It is mounted by default on
> /dev, it should not be mounted anywhere else.
> For flash, the only filesystem supported is JFF2.

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

More information about the Ecos-discuss mailing list