public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: [ECOS] File IO under Linux synthetic target
@ 2001-05-31  7:30 rob.wj.jansen
  0 siblings, 0 replies; 3+ messages in thread
From: rob.wj.jansen @ 2001-05-31  7:30 UTC (permalink / raw)
  To: bartv; +Cc: ecos-discuss

Bart,

> File I/O is not yet available on the synthetic target - at least, not
> using the eCos functionality. With the current release sources it is
> possible to make some Linux system calls to perform file I/O, for
> example by calling cyg_hal_sys_open() and cyg_hal_sys_read(), but
> obviously those will have the Linux semantics rather than the eCos
> ones.

thanks. 
I now just read a file into memory and access this as if it were my flash region.
Works great, I use mount in a similar way as in the ROM FS and for the linux target the fs_mount
function now reads a file containing the flash image  into memory as below.

---###---
externC int cyg_hal_sys_open(const char *, int, unsigned int);
externC int cyg_hal_sys_close(int);
externC unsigned long cyg_hal_sys_read(int, void *, long);
externC unsigned long cyg_hal_sys_lseek(int, unsigned long, int);
 
#define O_RDONLY        0
#define SEEK_END        2
#define SEEK_SET        0

      fd = cyg_hal_sys_open(pDevice, O_RDONLY, 0);    // Open the FATFS file
      if(fd) {
          fsize = cyg_hal_sys_lseek(fd, 0, SEEK_END); // Determine size
          pMedium->base = malloc(fsize);              // Allocate mem
          cyg_hal_sys_lseek(fd, 0, SEEK_SET);         // Rewind
          cyg_hal_sys_read(fd, pMedium->base, fsize); // Read complete file
          cyg_hal_sys_close(fd);
          pMedium->offset = 0;
      } else {
          pMedium->base = NULL;
      }                                                                     
---###---

This could also work for the ROM FS package.

Regards,

	Rob Jansen

Software Engineer
Competence Center Platforms
BU Mobile Communications
Meijhorst 60-10, 6537 KT Nijmegen, The Netherlands
Tel: +31-24-353-6329
Fax: +31-24-353-3613
mailto:Rob.WJ.Jansen@philips.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] File IO under Linux synthetic target
  2001-05-30  8:05 rob.wj.jansen
@ 2001-05-30  8:13 ` Bart Veer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Veer @ 2001-05-30  8:13 UTC (permalink / raw)
  To: rob.wj.jansen; +Cc: ecos-discuss

>>>>> "Rob" == rob wj jansen <rob.wj.jansen@philips.com> writes:

    Rob> I'm using a ROM filesystem on my target (ARM710T) but want to
    Rob> do some testing/debugging of the application on a linux
    Rob> target.

    Rob> Is File I/O on the linux target supported / which package(s)
    Rob> do I need= ?

File I/O is not yet available on the synthetic target - at least, not
using the eCos functionality. With the current release sources it is
possible to make some Linux system calls to perform file I/O, for
example by calling cyg_hal_sys_open() and cyg_hal_sys_read(), but
obviously those will have the Linux semantics rather than the eCos
ones.

Bart

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ECOS] File IO under Linux synthetic target
@ 2001-05-30  8:05 rob.wj.jansen
  2001-05-30  8:13 ` Bart Veer
  0 siblings, 1 reply; 3+ messages in thread
From: rob.wj.jansen @ 2001-05-30  8:05 UTC (permalink / raw)
  To: ecos-discuss

Hi,

I'm using a ROM filesystem on my target (ARM710T) but want to do some testing/debugging
of the application on a linux target.

Is  File I/O on the linux target supported / which package(s) do I need?

Thanks,

	Rob Jansen

Software Engineer
Competence Center Platforms
BU Mobile Communications
Meijhorst 60-10, 6537 KT Nijmegen, The Netherlands
Tel: +31-24-353-6329
Fax: +31-24-353-3613
mailto:Rob.WJ.Jansen@philips.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-05-31  7:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-31  7:30 [ECOS] File IO under Linux synthetic target rob.wj.jansen
  -- strict thread matches above, loose matches on Subject: below --
2001-05-30  8:05 rob.wj.jansen
2001-05-30  8:13 ` Bart Veer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).