EmbeddedRelated.com
Forums

RCM6700 , VBAT & FAT

Started by akisppoli July 29, 2012
Hi all

I have a problem with RCM6700 and the fat16 filesystem.
I have 3 files, exactly :

#define FAT_BLOCK
#use "fat16.lib"
#include

FATfile data_file;
FATfile log_file;
FATfile init_file;

fat_part *first_part;

All the file operations are with fat_Xxxx (fat_Open(...) etc) commands and the filesystem is mounted with the automount USE_FEFAULTS routine.

Well, when the backup battery is mounted you leave the device unplugged from power and the files and the data are there.
If you unplug the device without a battery and after you plug it again
all the files are erased. The partition is blank.
The question is how we can tell to RCM to put the files in the flash
or if they are in flash (as I thought) the static ram holds some informations about these files ?

Thank's in advance

Akis

The fat table is stored in battery backed ram, to commit it to non volitile
memory dismount and remount the file system

Phil
On Jul 29, 2012 9:44 PM, "akisppoli" wrote:
>
> Hi all
>
> I have a problem with RCM6700 and the fat16 filesystem.
> I have 3 files, exactly :
>
> #define FAT_BLOCK
> #use "fat16.lib"
> #include FATfile data_file;
> FATfile log_file;
> FATfile init_file;
>
> fat_part *first_part;
>
> All the file operations are with fat_Xxxx (fat_Open(...) etc) commands
and the filesystem is mounted with the automount USE_FEFAULTS routine.
>
> Well, when the backup battery is mounted you leave the device unplugged
from power and the files and the data are there.
> If you unplug the device without a battery and after you plug it again
> all the files are erased. The partition is blank.
> The question is how we can tell to RCM to put the files in the flash
> or if they are in flash (as I thought) the static ram holds some
informations about these files ?
>
> Thank's in advance
>
> Akis
Thank’s Phil for your immediate answer
When I mount and dismount the file system (with automount) or when format
the device and after mounting the device the symptoms are the same.
There is a #define to tell to compiler to storte the fat table in another
location ?
Akis
After writing to FAT I perform;

for (i = 0; i < num_fat_devices * FAT_MAX_PARTITIONS;i +FAT_MAX_PARTITIONS) {
if (fat_part_mounted[i]) {
fat_UnmountDevice(fat_part_mounted[i]->dev);
}
} rc = sspec_automount(SSPEC_MOUNT_ANY, NULL, NULL, NULL);

to dismount and remount partitions this works for me through power cycles
without VBAT connected.

I'm using sspec_write function to write to flash i don't know if that makes
a difference

Regards

Phil
On 29 July 2012 23:40, Theodore Politis wrote:

> **
> Thanks Phil for your immediate answer
> When I mount and dismount the file system (with automount) or when format
> the device and after mounting the device the symptoms are the same.
> There is a #define to tell to compiler to storte the fat table in another
> location ?
> Akis
>
>
Thank's a lot Phil

I will try it

Akis
Hi Phil
You use the zserver lib for these functions?
Because to work with sspec_write the file argument is a (int)file hanler so i must change all the functions of open,close etc..
(The file name must be "A/xxxxx.xxx" in order to put in in A partition ?)

Thank's
Akis
I dont use zserver lib i have:

#use "fat16.lib"
#define FAT_BLOCK //
#define FAT_USE_FORWARDSLASH //
#define SSPEC_ALLOW_ANONYMOUS_WRITE
#define SSPEC_ALLOW_ANONYMOUS_WRITE
initial mount
rc = sspec_automount(SSPEC_MOUNT_ANY, NULL, NULL, NULL);

open of file
file=sspec_open("/A/labels.xml", testcontext,O_WRITE|O_CREAT, 0);
close of file
sspec_close(file);

there may be away of using the functions your already using. I
just implemented it this way after i had problems with it not working with
no VBAT

Phil

On 30 July 2012 13:12, Theodore Politis wrote:

> **
> Hi Phil
> You use the zserver lib for these functions?
> Because to work with sspec_write the file argument is a (int)file hanler
> so i must change all the functions of open,close etc..
> (The file name must be "A/xxxxx.xxx" in order to put in in A partition ?)
>
> Thank's
> Akis
>
>
Thank's Phil

I wil try to make it like this

Akis
Hi Phil again

When i make only the definition that you propose i have the folowing errors
//line 2371 : ERROR : SSPEC_MOUNT_ANY is out of scope/ not declared.
//line 2371 : WARNING : Reference to 'sspec_automount' has no corresponding prototype.

These definitions i think exist in zserver lib.
Did you have any other definitions in the environment ?
I use DC10.70

Thank's
Akis
Im using dc 10.64 i dont believe i have zserver defined anywhere in my code
i will check tomorow
On Jul 30, 2012 3:08 PM, "Theodore Politis" wrote:
>
> Hi Phil again
>
> When i make only the definition that you propose i have the folowing
errors
> //line 2371 : ERROR : SSPEC_MOUNT_ANY is out of scope/ not declared.
> //line 2371 : WARNING : Reference to 'sspec_automount' has no
corresponding prototype.
>
> These definitions i think exist in zserver lib.
> Did you have any other definitions in the environment ?
> I use DC10.70
>
> Thank's
> Akis