AnsweredAssumed Answered

File rename fail

Question asked by Randall Jordan on Dec 30, 2015
Latest reply on Dec 30, 2015 by Daniel Chen

I’m having a problem renaming a temporary file when there are 170 files saved to NAND flash.


I am using CodeWarrior 10.6

MQX 4.1

Spansion S34ML08G201 NAND flash



The NAND flash is used to store telemetry data files.  When the temporary file size is between 1 - 2 MEG the file is renamed and another temporary file is created

and written to. When the number of files stored on flash reaches 170, and the temporary file is renamed, it causes an unhandled interrupt.
The file size of the individual files does not seem to matter, nor the amount of free space available on flash. If one file is deleted leaving 169 files,
then the temporary file can be renamed.


Stepping through the code I noticed that the issue happens in MFS_Create_directory _entry() in mfs_dir_entry.c,  The variable dir_index starts
at 511 but is changed to 254 when it is returned from MFS_Find_directiry_entry (at line 143) instead of incrementing to 512.  Stepping through a good

file renaming the dir_index is incremented from it last value when MFS_Find_directiry_entry is returned.


The unhandled interrupt occurs at the end of the function when _mem_zero (line 356) is called and dir_entry_ptr is null.


Has anyone seen this, or has had this problem.


Thank you for you time.