EmbeddedRelated.com
Forums

Adding Filesystem on LPC2138 or 2294

Started by SR October 9, 2005
Basically I need to use it to send stuff out from the
LPC2294 board to a terminal after logging is done, is
the JFFS2 file compatible with that we use in windows,
(sorry for my ignorance)

Samuel

--- Charles Manning <manningc2@mann...> wrote:

> On Monday 10 October 2005 20:24, Sten wrote:
>
> >
> > Correct! If you want to log data continously only,
> why you want to spent
> > a lot of time in implementing a file system? Just
> write your data
> > byte4byte to your flash and wrap around if it is
> full.
>
> Definitely concur on this point. Using a file system
> just to do some
> append-only logging like using a chainsaw to cut
> butter.
>
> > If there are other reasons for using a file
> system, a flash file system
> > like JFFS(2) could be better solution than FAT.
>
> Again, concur, JFFS(2) and other log structured fs
> are far less corruption
> prone than FAT. However, these fs tend to need quite
> a bit of RAM for large
> flash partitions.
>
> > Because it is balancing
> > write/erase cycles to your flash other than FAT.
>
> Most FTLs (eg the Smartmedia one) will effect
> sufficient wear levelling to
> make this a non-issue.
>
> > Just have look to the
> > Linux kernel (the greatest resource of open-source
> code in this world!).
> > Check the uClinux resources and mailing list for a
> good (bug-free)
> > implementation, too.
>
> Be mindful of the GPL. This might limit what you can
> do with the code. >


__________________________________


An Engineer's Guide to the LPC2100 Series

On Tuesday 11 October 2005 14:20, Samuel wrote:
> Basically I need to use it to send stuff out from the
> LPC2294 board to a terminal after logging is done, is
> the JFFS2 file compatible with that we use in windows,
> (sorry for my ignorance)

There are two ways I can think of doing this:
1) USB Mass Storage model: Data gets saved in a file on the device. At some
stage, the device gets hooked up to a PC via USB Mass Storage interface (like
a USB disk) and the data can be read off.

For this to work, you really need to use FAT because the PC has to understand
the file system layout.

2) Device transfers data via a serial pipe or equivalent download mechanism.
The device can store the data in any format (the PC does not care) and at
some stage it is connected to the PC, the data is dumped, and the file si
purged.

For this model you can store the data in any form.

JFFS2 will work for the second scenario. However integrating JFFS2 is quite
hard because it expects Linux or eCOS.



Paul Curtis wrote:
> Hi, >>>Correct! If you want to log data continously only, why you want to
>>>spent a lot of time in implementing a file system? Just write your
>>>data byte4byte to your flash and wrap around if it is full.
>>
>>Definitely concur on this point. Using a file system just to
>>do some append-only logging like using a chainsaw to cut butter. > You can't write byte-by-byte to the LPC flash. IIRC, an ECC byte cannot
> be changed without erasing the flash so you cannot over-program and
> already-programmed word. Hence you must write in groups of four bytes
> aligned to a word boundary. The other thing to say is that the IAP
> routines write a minimum of 256 bytes to a 256-byte-aligned page, so to
> synthesize word-wise writing you need a buffer of 256 bytes and a copy
> of the previous flash contents for the page.
>

Due to the small sector sizes of LPC flashes it would be a good
compromise to simply erase a whole sector, write to this sector
block-by-block (not byte-by-byte :-) until this is sector is full. It is
possible to programm a block more than once if you keep in mind that
bits can only be erased. So you can modify a block byte-by-byte
continiously.
If you implement a methode "read sector to RAM, modify sector in RAM,
erase sector in ROM, programm sector from RAM to ROM" than you still
have a base implementation of a flash file system.

Sten

--
/************************************************
Do you need a tiny and efficient real time
operating system (RTOS) with a preemtive
multitasking for LPC2000 or AT91SAM7?

http://nanortos.net-attack.de/

Or some open-source tools and code for LPC2000?

http://www.net-attack.de/

************************************************/



Charles Manning wrote:
> On Tuesday 11 October 2005 14:20, Samuel wrote:
>
>>Basically I need to use it to send stuff out from the
>>LPC2294 board to a terminal after logging is done, is
>>the JFFS2 file compatible with that we use in windows,
>>(sorry for my ignorance) > There are two ways I can think of doing this:
> 1) USB Mass Storage model: Data gets saved in a file on the device. At some
> stage, the device gets hooked up to a PC via USB Mass Storage interface (like
> a USB disk) and the data can be read off.
>
> For this to work, you really need to use FAT because the PC has to understand
> the file system layout.
>
> 2) Device transfers data via a serial pipe or equivalent download mechanism.
> The device can store the data in any format (the PC does not care) and at
> some stage it is connected to the PC, the data is dumped, and the file si
> purged.
>
> For this model you can store the data in any form.
>
> JFFS2 will work for the second scenario. However integrating JFFS2 is quite
> hard because it expects Linux or eCOS.
>

Hello,

how is your data transfered to your PC? If your PC depends on visible FS
on your device (e.g. your device acts as USB mass storage device) you
also can emulate a FS with exactly one file on it. Your log data is
written block-by-block and the PC side read the "file" transparently
through "virtual FAT file system".
If you upload your data via serial line or something else a FS is
definitely not needed.

Sten

--
/************************************************
Do you need a tiny and efficient real time
operating system (RTOS) with a preemtive
multitasking for LPC2000 or AT91SAM7?

http://nanortos.net-attack.de/

Or some open-source tools and code for LPC2000?

http://www.net-attack.de/

************************************************/



I will be recieving the File via Xmodem on the PC, any
help on how I can implement a virtual filesystem?

--- Sten <list@list...> wrote:

> Charles Manning wrote:
> > On Tuesday 11 October 2005 14:20, Samuel wrote:
> >
> >>Basically I need to use it to send stuff out from
> the
> >>LPC2294 board to a terminal after logging is done,
> is
> >>the JFFS2 file compatible with that we use in
> windows,
> >>(sorry for my ignorance)
> >
> >
> > There are two ways I can think of doing this:
> > 1) USB Mass Storage model: Data gets saved in a
> file on the device. At some
> > stage, the device gets hooked up to a PC via USB
> Mass Storage interface (like
> > a USB disk) and the data can be read off.
> >
> > For this to work, you really need to use FAT
> because the PC has to understand
> > the file system layout.
> >
> > 2) Device transfers data via a serial pipe or
> equivalent download mechanism.
> > The device can store the data in any format (the
> PC does not care) and at
> > some stage it is connected to the PC, the data is
> dumped, and the file si
> > purged.
> >
> > For this model you can store the data in any form.
> >
> > JFFS2 will work for the second scenario. However
> integrating JFFS2 is quite
> > hard because it expects Linux or eCOS.
> >
>
> Hello,
>
> how is your data transfered to your PC? If your PC
> depends on visible FS
> on your device (e.g. your device acts as USB mass
> storage device) you
> also can emulate a FS with exactly one file on it.
> Your log data is
> written block-by-block and the PC side read the
> "file" transparently
> through "virtual FAT file system".
> If you upload your data via serial line or something
> else a FS is
> definitely not needed.
>
> Sten
>
> --
> /************************************************
> Do you need a tiny and efficient real time
> operating system (RTOS) with a preemtive
> multitasking for LPC2000 or AT91SAM7?
>
> http://nanortos.net-attack.de/
>
> Or some open-source tools and code for LPC2000?
>
> http://www.net-attack.de/
>
> ************************************************/
>


__________________________________


If you receive it through a serial communication via Xmodem you do not
need a FS. Just send your log data within Xmodem protocol to your PC
where your PC application stores this data into a file. It is simple!

Sten

--- In lpc2000@lpc2..., Samuel <emddjava@y...> wrote:
>
> I will be recieving the File via Xmodem on the PC, any
> help on how I can implement a virtual filesystem?
>
> --- Sten <list@n...> wrote:
>
> > Charles Manning wrote:
> > > On Tuesday 11 October 2005 14:20, Samuel wrote:
> > >
> > >>Basically I need to use it to send stuff out from
> > the
> > >>LPC2294 board to a terminal after logging is done,
> > is
> > >>the JFFS2 file compatible with that we use in
> > windows,
> > >>(sorry for my ignorance)
> > >
> > >
> > > There are two ways I can think of doing this:
> > > 1) USB Mass Storage model: Data gets saved in a
> > file on the device. At some
> > > stage, the device gets hooked up to a PC via USB
> > Mass Storage interface (like
> > > a USB disk) and the data can be read off.
> > >
> > > For this to work, you really need to use FAT
> > because the PC has to understand
> > > the file system layout.
> > >
> > > 2) Device transfers data via a serial pipe or
> > equivalent download mechanism.
> > > The device can store the data in any format (the
> > PC does not care) and at
> > > some stage it is connected to the PC, the data is
> > dumped, and the file si
> > > purged.
> > >
> > > For this model you can store the data in any form.
> > >
> > > JFFS2 will work for the second scenario. However
> > integrating JFFS2 is quite
> > > hard because it expects Linux or eCOS.
> > >
> >
> > Hello,
> >
> > how is your data transfered to your PC? If your PC
> > depends on visible FS
> > on your device (e.g. your device acts as USB mass
> > storage device) you
> > also can emulate a FS with exactly one file on it.
> > Your log data is
> > written block-by-block and the PC side read the
> > "file" transparently
> > through "virtual FAT file system".
> > If you upload your data via serial line or something
> > else a FS is
> > definitely not needed.
> >
> > Sten
> >
> > --
> > /************************************************
> > Do you need a tiny and efficient real time
> > operating system (RTOS) with a preemtive
> > multitasking for LPC2000 or AT91SAM7?
> >
> > http://nanortos.net-attack.de/
> >
> > Or some open-source tools and code for LPC2000?
> >
> > http://www.net-attack.de/
> >
> > ************************************************/
> > __________________________________




On Tuesday 11 October 2005 22:37, Samuel wrote:
> I will be recieving the File via Xmodem on the PC, any
> help on how I can implement a virtual filesystem?

If you are using XModem then you can use any soft of file system or Linear
File Store (LFS).

Look at http://www.cs.tau.ac.il/~stoledo/pubs.html for some interesting ideas
on flash storage.

Here is what I would do: A tiny log structured file system. This is a
well-proven mechanism that I used for YAFFS etc.

-- Charles