Hello
I use FreeRTOS + FAT with Renesas RA6M3.
I write data to a file on the SD card.
When I look at a file on my PC, the update time is blank.
How do I set the write time?
Hello
I use FreeRTOS + FAT with Renesas RA6M3.
I write data to a file on the SD card.
When I look at a file on my PC, the update time is blank.
How do I set the write time?
Hi @taki. Can you check your ffconfigTIME_SUPPORT
config. It is disabled by default over here. A lot of time functions are conditionally compiled and if this config is off, no timestamps are written.
Also, if the time support is ON, you must implement the time_t FreeRTOS_time( time_t *pxTime );
function for your specific platform. This function fetches the current time.
Thank you for reply.
ffconfigTIME_SUPPORT was 0.
Change it to 1 and check.
Are there any documents about time_t FreeRTOS_time( time_t *pxTime )?
I would like to use it for implementation.
When I set ffconfigTIME_SUPPORT to 1, many errors occurred in ff_studio.c.
Here is the documentation: FreeRTOS-Plus-FAT Configuration - FreeRTOS™.
Please make sure that ffconfigTIME_SUPPORT
is defined in your copy of FreeRTOSFATConfig.h
, and nowhere else.
Also make sure that there is only one visible FreeRTOSFATConfig.h
Can you also show the compilation error in English, or translate it?
Thank you for reply.
I understand that I have to write FreeRTOS_time().
Sorry, I don’t know what to write in FreeRTOS_time().
Are there any samples?
I have confirmed that FreeRTOS_time() is declared.
It is called within FF_GetSystemTime().
Thank you for reply.
I checked it. Only FreeRTOSFATConfig.h.
I write error message in English below.
Field ‘Day’ cannot be resolved
Field ‘ff_atime’ cannot be resolved
Field ‘ff_ctime’ cannot be resolved
Content is the same, just the items change
Hour,Minute,Month,Seconds,xAccessedTime,xCreateTime, etc.
Can you do a little test in ff_stdio.c, around line 1024 in ff_stat()
, add the following dummy code:
#if ( ffconfigTIME_SUPPORT == 1 )
{
pxStatBuffer->ff_atime = ( unsigned long ) prvFileTime( &( xDirEntry.xAccessedTime ) );
pxStatBuffer->ff_mtime = ( unsigned long ) prvFileTime( &( xDirEntry.xModifiedTime ) );
pxStatBuffer->ff_ctime = ( unsigned long ) prvFileTime( &( xDirEntry.xCreateTime ) );
+ if (pxStatBuffer->st_ino)
+ {
+ // Should be good
+ }
+ if (pxStatBuffer->ff_ctime)
+ {
+ // Should be good
+ }
+ if (pxStatBuffer->ff_xtime)
+ {
+ // Should give an error
+ }
}
#endif
In other words, I want to know the value of ffconfigTIME_SUPPORT
at the moment struct FF_STAT
is declared in ff_stdio.h
I added the code and build
Error occuured
error: ‘FF_Stat_t’ {aka ‘struct FF_STAT’} has no member named ‘ff_xtime’
What am I doing wrong?
I implemented FreeRTOS_time() that I found online.
The date and time are fixed values.
The error has disappeared, but the file creation date and time remains blank.
Could you tell me what I should check?
EDIT
Note that pxTime must be set to GMT, not the local time.
The existing files will remain without a timestamp. What if you create new files? Do they get a time-stamp “July 6, 2025” ?
No it is good, you can take the test code away. These now compile well:
Field ‘Day’ cannot be resolved
Field ‘ff_atime’ cannot be resolved
Field ‘ff_ctime’ cannot be resolved
I was able to write it by adding the following description after FF_GetSystemTime
Thank you very much
FF_GetSystemTime( &pxDirEntry->xAccessedTime );
//20025/07/08 add
pxDirEntry->xCreateTime = pxDirEntry->xAccessedTime;
pxDirEntry->xModifiedTime = pxDirEntry->xAccessedTime;