login
Header Space

 
 

Saving data

April 22, 2008 - 12:55am
Submitted by Anonymous on April 22, 2008 - 12:55am.
Linux

Hello!

Need advise. I have imx31(ARM) based device with external ram and nand flash.
How can i save some important working data from ram to the flash? I need to do it quick then the main power is lost. I have an external signal from power supervisor. It asserted when power drops below defined level and ARM generates interrupt. I want to use this interrupt to save data but dont know how to use file i/o in the ISR.

Thanks.

maybe raw access to mtd/block device is a better thing?

April 22, 2008 - 1:33am

Any emergency stuff, such as reliable and quick storing of important data under extreme conditions, IMHO requires as few layers as possible.

Reserve some blocks of FLASH for such data and don't let userspace use it. The quickest thing will be memcpy() from RAM to memory mapped mtd device and flushing any hardware caches.
_____

Any emergency stuff, such as

April 22, 2008 - 6:45am
DenF1 (not verified)

Any emergency stuff, such as reliable and quick storing of important data under extreme conditions, IMHO requires as few layers as possible.
I agree.

Reserve some blocks of FLASH for such data and don't let userspace use it.
I have 4 nand partitions: /dev/mtdblock1 .. /dev/mtdblock4. How can i split last partition /dev/mtdblock4 in two parts?

The quickest thing will be memcpy() from RAM to memory mapped mtd device and flushing any hardware caches.
Dont understand how to memory map mtd device? Do i need to write own kernel module for my nand flash chip?

http://www.linux-mtd.infradead.org/

April 22, 2008 - 8:16am

Better contact experienced specialists: http://www.linux-mtd.infradead.org/

They can point out many hardware as well as software/userspace things, because this whole implementation requires many steps. For example on every boot you must reserve and erase region/page (FLASH can be written only after erase).

Use linux source (mtd drivers) as a playground.
Good luck.
____

high priority task

April 22, 2008 - 2:26am

how about a high priority task in userspace or kernel waiting on some synchronization primitive (e.g. completion or signal) and the interrupt handler just giving the signal to run? how much time do you have (i.e. how big is your buffering capacitor) and which real time features are enabled?

how about a high priority

April 22, 2008 - 7:01am
DenF1 (not verified)

how about a high priority task in userspace or kernel waiting on some synchronization primitive (e.g. completion or signal) and the interrupt handler just giving the signal to run? how much time do you have (i.e. how big is your buffering capacitor) and which real time features are enabled?
Availaible time about 20ms. I dont use any real time features now. Do you think i should look at rt-patch and rtai/xenomai?
I think sending signals from ISR to realtime task is not good because i dont know when my task will run. Maybe another interrupt will occur when i will exit from my ISR or something.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
speck-geostationary