[Lazarus] Using Lazarus on Embedded Linux?

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Mon Sep 27 11:50:12 CEST 2010


Henry Vermaak wrote:
> On 27/09/10 08:50, Michael Schnell wrote:
>> On 09/25/2010 09:07 AM, Bo Berglund wrote:

>> After writing to the card, same performs the storage procedure
>> internally which takes a undefined amount of time and can't be watched
>> from outside. So you don't know how long you need to apply power to the
>> card after switching off the system. If you remove the power to the card
>> too early, _all_ (even unrelated) data on the card might be lost. This
>> is why using a special file system (a Flash File system and/or a
>> journaling file system) does not help.
> 
> See sync, fsync, fdatasync, etc.  You can also mount some filesystems 
> with sync, but that's usually not a good idea for performance and flash 
> cycle issues.  Best is to remove the power only after your kernel has 
> powered down, obviously, so you know that all the buffers have been 
> flushed.

I think I'd like to see a clarification from Michael here: did he mean 
that the kernel/filesystem/drivers take an indefinite time committing 
the data or that the card takes an indefinite time after receiving data 
from the operating system?

The first of those can at least be initiated using a sync() call, and 
it's reasonable to assume that a filesystem designed for the purpose 
won't get screwed if the driver finds it can no longer talk to the 
storage device. However if the storage device itself is susceptible to 
errors caused by power removal that is far more sinister.

We have equipment scattered around Europe, and the reliability of the 
power sources on industrial sites is far worse than most people 
appreciate. A common scenario is where our kit is wired to a supply that 
intermittently runs a pump or similar, i.e. sometimes it sees 230V but 
most of the time it doesn't.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list