Hello,
I got:
- STM32F103RC (Cortex-M3), - I2C EEPROM M24128 (16KB, page size 64 bytes), - Flash-FS V4.20.
I modified a FS_SPI_FlashPrg.c from an example to acces an I2C EEPROM. Taking the article http://www.keil.com/support/docs/3482.htm into consideration I described in FS_SPI_FlashDev.h the storage as 8 virtual sectors (blocks) of 2KB each. The EraseSector procedure takes care of writing 0xFF to all 64 Byte long EEPROM pages building a virtual sector.
It works so far that I can format via fformat("S0:") and write a file via f=fopen("S0:\\filename.txt", "w") followed by fputs("Test", f). Both return success, on the dump of the EEPROM the "\filename.txt" string and after some bytes the string "Test" can be seen. At the top of the EEPROM address space masks of the allocation information seem to be present, too, as described in help to EFS.
The problem is: while f=fopen("S0:\\filename.txt", "r") returns success, the following fgets(s, sizeof(s), f) (and fread(...) I tried) returns always NULL. Besides, ffind(...) gets like:
\filename.txt 0, 01-01-1980 12:00:00
Total: 0 Free: 0.
This picture could be seen as a suggestion that Keils EFS might potentially use same format for file date/time information as FAT: http://www.keil.com/support/man/docs/rlarm/rlarm_fs_flashfs.htm
Of course, I could be wrong, since I haven't been using any of the Keil-supplied file systems.
Thanks for replies, PPL!
I solved the problem. It was my fault (what else): because of a wrong definition in the code I wrote always two bytes less than needed. Now it works!