This is the mail archive of the
mailing list for the eCos project.
Re: Local file system access with Linux Synthetic target
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Tyler Wilson <TWilson at ugobe dot com>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Fri, 19 Sep 2008 19:38:18 +0200
- Subject: Re: [ECOS] Local file system access with Linux Synthetic target
- References: <B3D51DDE088F664CA567D79180F5DD3C42F25F@ev-core.ugobe.local>
On Fri, Sep 19, 2008 at 09:20:08AM -0700, Tyler Wilson wrote:
> Good day,
> I would like to perform file io from my eCos application in the
> synthetic target for testing. I did some searching for the answer to
> this question, but all I saw was a reference to 'you have to mount'. I
> am hoping someone here might have a more concrete example I could use
> for this.
> Also, when searching for the mount command in the default linux
> template, I could find one. What are the minimal additional packages I
> need to enable local file IO in the synthetic target?
There is no access from eCos into the host filesystem via mount etc.
There are a few things you can however do
1) Include the fatfs support in eCos. You can create a fat filesystem
in a file. This can be mounted in Linux using the loopback device. In
eCos you can mount it using the synthetic flash device. See
However don't have the mounted in eCos and Linux at the same
time. Doing so will lead to corruption of the filesystem.
2) eCos can call host system calls. So you can call the kernel open
system call, followed by the kernel read system call, write system
call etc. There are functions
cyg_hal_sys_open(), cyg_hal_sys_write(), cyg_hal_sys_read() and
However, be careful with blocking calls. They will block the whole of
eCos, not just one eCos thread.
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss