cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMx incorrect FatFS code generation

Posted on March 18, 2018 at 13:37

Hello,

In CubeMx, when the option USE_LFN is enabled, the code generator doesnt generate all necessary code. The missing files are supposed to be in this directory:

Middlewares\Third_Party\FatFs\src\option\

There are no unicode.c and ccXXX.c files (the last depends on the CODE_PAGE). Because of that, no unicode support functions are available:

/* Unicode support functions */

&sharpif _USE_LFN                            /* Unicode - OEM code conversion */

WCHAR ff_convert (WCHAR chr, UINT dir);    /* OEM-Unicode bidirectional conversion */

WCHAR ff_wtoupper (WCHAR chr);            /* Unicode upper-case conversion */

&sharpif _USE_LFN == 3                        /* Memory functions */

void* ff_memalloc (UINT msize);            /* Allocate memory block */

void ff_memfree (void* mblock);            /* Free memory block */

&sharpendif

&sharpendif

I would appreciate a confirmation of this. Looking forward to your answer.

#fatfs
6 REPLIES 6
Doug Kehn
Senior
Posted on March 19, 2018 at 13:18

Correct, the needed code page file is not copied by CubeMX. You can copy the desired code page file manually from the firmware library installation directory.

Posted on March 19, 2018 at 20:07

Thanks for answer,

But do you mean this is by design or is it a bug? Because if this is a feature it doesn't really make sense...

Posted on March 19, 2018 at 20:34

I don't know the answer to that question. I would hope that this is just an oversight or that it is on the TODO list. Maybe some from ST will chime in here.

Posted on March 19, 2018 at 20:59

Not sure who the point person here for that. Perhaps they can use current version also.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
FCR
Associate III
Posted on March 20, 2018 at 11:56

Hi

Przenioslo.Lukasz

I have tried to reproduce, but without knowing much about the configuration and the scenario (new project? old one imported?), I do not know and cannot really figure out what could be the source of the issue.

Would be great to get more information so that we can investigate where the issue is.

- OS: Windows / Linux / Mac OS ?

- CubeMx version: 4.0 (or older) ?

- STM32 series/mcu used ?

- Fatfs parameters settings (USE_LFN? CODE_PAGE? LFN_UNICODE? ...) ?

On my side, using CubeMx 4.0, Windows OS 7, F4 series (supporting FatFS R0.12c in CubeMx), playing with some (USE_LFN=3, CODE_PAGE=Japanese, with/without LFN_UNICODE), and creating new project for IAR Ewarmand forTrueStudio as well, files are copied in the option folder created and the functions you mention are found in syscall.c (ff_memalloc and ff_memfree) and the ccXXX.c file, cc9c file in my example, for Japanese mode (

ff_wtoupper and ff_convert).

Regards,

Fred

Posted on March 21, 2018 at 11:37

Hello Fred,

Let me write everything here:

- OS: Windows 10 64 bit

- CubeMx vesrion: 4.23.00

- MCU used: STM32L452VE

- Fat parameters:

0690X0000060A8UQAU.png

I am generating the code for truestudio.