Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

+FAT Unicode file names and ff_fopen()

Posted by sonycman on June 5, 2017

Hello!

I`am using +FAT version 160919FreeRTOSLabs UTF-16 unicode support is enabled by setting ffconfigUNICODEUTF16SUPPORT to 1. Long file names support is enabled also by setting ffconfigLFN_SUPPORT to 1.

That would let me to use filenames in unicode, i supposed.

But how can I pass a unicode string to ff_fopen() function, if its pcFile parameter have the type of const char *?

How could one open a file which filename is a unicode string?

Regards Vladimir


+FAT Unicode file names and ff_fopen()

Posted by heinbali01 on June 6, 2017

Vladimir, I am guessing that you want to see file names in Cyrillic?

The Unicode variant of the library ( ffconfigUNICODE_UTF16_SUPPORT ) has been tested, but it was never included into the top layer: ff_stdio.c

When you use the low-level functions like FF_Open(), you do have Unicode, but you will miss the "file system layer". Which is no problem if you just have a single volume, an SD-card.

I think I would define a type that holds a character ( of file name ) :

~~~ #if( ffconfigUNICODEUTF16SUPPORT != 0 ) typedef FFTWCHAR FileNamet; #else typedef const char FileNamet; #endif

FF_FILE *ff_fopen( FileName_t *pcFile, const char *pcMode );
int ff_mkdir( FileName_t *pcPath );
int ff_rmdir( FileName_t *pcDirectory );
int ff_remove( FileName_t *pcPath );

~~~


+FAT Unicode file names and ff_fopen()

Posted by heinbali01 on June 6, 2017

Just checked the above change with ff_stdio.c I'm afraid it is a lot more work because there are lots of manipulations with the file- and directory-names. Also ff_sys.c will need to be adapted to use Unicode. No quick fix available, I'm afraid


+FAT Unicode file names and ff_fopen()

Posted by sonycman on June 6, 2017

Hi, Hein.

Vladimir, I am guessing that you want to see file names in Cyrillic?

Exactly! I was very confused realising that Unicode enabled file system actually does not support it from the top layer. But I'am understand its still in development and unfinished.

Maybe, I should try an ANSI OEM code page for extra cyrillic symbols? Windows 1251 suits me best. That will let me use the existing top layer interface, with insertion of conversion function (OEM to UTF-16 and vice versa) before making calls to native UTF-16 layer.

I need fffopen(), fffindfirst() and ff_findnext() only for now.

I will be appreciated for any advices.

PS: I'am very liked +FAT at the moment. Sectors caching and consecutive clusters read (in one driver function call!) is a very nice features!


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS