Hi.
I’m making a project with FreeRTOS+FAT SL.
I refered window simulator demo and tested it.
FAT was imported on my CCS project and make some codes for init volume, format, read, and etc…
But it was not worked. I’m using RM48 MCU.
I don’t know how can make a new file like a ‘test.txt’.
The file system has a fairly standard API, so files are created in the same way they would be with any other standard file system. Also, if you have the Win32 simulator demo running, and step through the code, you will see the files being created - as it uses a RAM disk when the disk is initialised there are no files on it, then there is a loop that creates the files, then loops that read back from the files to ensure they are correct, plus CLI commands to copy files (which involves creating a new file), etc.
In the Win32 simulator demo, find the file File-system-demo.c, then in that file find the function vCreateAndVerifySampleFiles(). That function calls two further functions: prvCreateDemoFilesUsing_f_write() and prvCreateDemoFileUsing_f_putc().
Then, inside prvCreateDemoFilesUsing_f_write() you will see lines such as:
/* Open the file, creating the file if it does not already exist. */
pxFile = f_open( cFileName, "w" );
…so you can see that files are automatically created if an attempt is made to open a file that does not exist.
Everything going well… but “_f_setfsname(filename, &fsname)” makes error.
There is 430 line in file.c
I use ‘step into’ when I debugging, and I found strange phenomenon…
There is value at ‘name’ that input argument, until line 287 in util_sfn.c
But it is disappear suddenly. Then I see “Error: Memory map prevented reading 0x07FFFFF8” ‘Value’ in ‘Variables window’ when it goes line 289.
If you are going to use line numbers please also specify which version of the file you are using. In my version line 430 is in the middle of a large comment, outside of a function.
I’m afraid I don’t fully understand what you are saying in your post, but I think you are saying that the parameter ‘name’ is getting corrupted inside the _f_setfsname() function.
Inside that function the line “ch = _f_toupper( *name++ );” is incrementing through the character string pointed to by name, so when viewed in the debugger the string will appear to get shorter and shorter until it does not exist (just the terminating null).
My program going well until this function(_f_setfsname))
There are values in input parameter ‘name’ and ‘fsname’ when it stop line 287 in debugging mode.
When I click the ‘Step into’ and move to line 289, problem is occured I described in previous post.
‘name’ and ‘fsname’ disappear.
All the same I would try increasing the stack size of the task calling f_open(). What is the size? Does the problem still exist if you multiply the size by 4?
No, leave that at 2. Dave is suggesting that, because an array is being allocated on the task stack, you may need to increase the size of the stack used by the task to accommodate it.
The size of the stack allocated to a task is set when the task is created. See the usStackDepth parameter on the following page:
Go to the line of code that creates the task that uses the file system, and increase the size of the usStackDepth parameter by a factor of 4.