directory, file creation and writing not working on SD card

Chan Kim ckim at etri.re.kr
Tue Nov 15 14:34:32 UTC 2016




 

 I found the file path was wrongly set to my linux machine environment(while debugging). 
That was why the files were not open correctly. I can see correct values are being processed now.. Sorry..

(and the reason files and directories are not being created.. I'll verify the files are in the SD card tomorrow morning at work.)

Thanks.


 Chan Kim



보낸 사람 :  "Chan Kim" <ckim at etri.re.kr>

보낸 날짜 :  2016-11-15 18:18:53 ( +09:00 )

받는 사람 :  users at rtems.org <users at rtems.org>

참조 :  

제목 :  directory, file creation and writing not working on SD card 

 

 

 

 

 

 
Hello rtems users,
 

 
Some time ago, I have made a SD card driver for rtems for our proprietary SD card controller and the test program for read, writing and copying file on SD card runs ok. 
 

 

 
I've made an rtems application which calls a function that I tested on Linux. I called the function from rtems (rtems has all the same header files which were in Linux) and during the processing, the function tests if a directory called 'result' exists (using stat function, with ) and if not, calls mkdir function and open a file for write under the directory and fills it with text (printed floating point values) and closes. It does this(file open, filling, file close many times looping for some numbers. But after the program run(after file system unmount is done), I find there is no such 'result' directory and no files created under there in the SD card. I tried running with existing 'result' directory, but no created files either.. (But the previous SD card file system test program creates files with correct data).
 

 
I tried adding almost all header files that I used in my test program (for testing file system on SD card, which runs ok) , but the problem persists. In the previous test program, I don't use 'mkdir' function but just opens the file with write priviledge.
 

 
In what circumstances can this happen? (the mkdir returns 0 and fopen(.."w") returns some non-zero value).
 

 
By the way, another difference is that in the previous program, I used fputc to write char by char but in the current program I'm using fprintf(file, "%f ", val);. I could add fprintf("PI = %f\n", 3.1415); in the old program and saw it was correctly written in the file.
 

 
Any suggestion would be deeply appreciated. I'm using fat32.
 

 
Thanks!
 

 
Chan Kim / ETRI
 
_______________________________________________
 
users mailing list
 
users at rtems.org
 
http://lists.rtems.org/mailman/listinfo/users
 


More information about the users mailing list