Home/Support/Support Forum/How to calculate avaliable space in RCM2200 board for SRam FS2 System
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to calculate avaliable space in RCM2200 board for SRam FS2 System

0 votes
Greetings,

I am using RCM2200 board; DCRabbit ver 9.62
In my project, I am required to store an Alarm Log and some user settings (3 FS2 files total)
I want to store as many Alarm Logs as possible.


Question 1: How do I calculate how much SRam space avaliable for me to use?



I configure FS2 filesystem for that purpose as below:

Question 2: Is it the right/best way?

// memconfig.lib: "#define FS2_RAM_RESERVE 12 //12x4096=49152 bytes
// STDBIOS.C: "#define DATAORG 0x9000

#define FX_MAX_FILES 3
#define FS2_USE_PROGRAM_FLASH 0
#use "FS2.LIB"

void setupFS()
{ int b, i;
Hinfo h; // Empty Log Record, value will be overwrite
FSLXnum Ram;
File file;
Ram=fs_get_ram_lx();
b=fs_init(0,0);
b=fs_format(0,0,0);
b=fcreate(&file, 1);
b=fopen_wr(&file, 1);
for(i=0;i<MAXLOG;i++)
b=fwrite(&file, &h, sizeof(Hinfo));
fclose(&file);
}
asked May 9, 2014 in Rabbit Software by soonki New to the Community (1 point)

Please log in or register to answer this question.

1 Answer

0 votes
See Chapter 10 of the Dynamic C user manual:

The maximum file size for an individual file depends on the total file system size and the number of files
present. Each file requires at least two sectors: at least one for data and always one for metadata (for information
used internally). There also needs to be two free sectors per file to allow for moving data around.
Here is a formula you can use to determine how many bytes to allocate for the total file system (assuming
all files are the same size):
Bytes = (Nbr_of_files * file_size * 1.14 ) + (Nbr_of_files * 128) +
(2 * 128)
FS2 supports a total of 255 files, but storing a large number of small files is not recommended. It is much
more efficient to have a few large ones.
answered May 9, 2014 by trooper2 Veteran of the Digi Community (589 points)
...