Hi,
I don't know if somebody experienced something like that.
I'm running KSDK V. 2 FRDM-K64F USB HOST FATFS demo project. Everything works. But, when I enable LFN (long file name) in ffconf.h file, I run into a lot of build errors. I notice that all those errors are caused by ff_memalloc and ff_memfree functions that compiler could find in the project, though they are there.
That doesn't make any sense at all, because I didn't change anything in demo project. So, why is this happening? Am I missing something?
Can anybody help me on that please?
Thanks and best regards,
Marco Coelho
Applications Engineer
Siletec Eletronica
已解决! 转到解答。
Hi, Colin
In "C:\Freescale\SDK_2.0_MK64FN1M0xxx12\middleware\fatfs_0.11a\src\option", I found "syscall.c" and "ccsbcs.c" files where "ff_malloc", "ff_memfree","ff_convert" and "ff_wtoupper" functions are declared.
I just copied them to my project and those build errors are gone! Incredibly, those files are not included or linked in KSDK demo project, neither their KSDK path are included in Project Compiler Settings.
Thanks for your help!
It sounds like ff_memalloc() etc. are the OS-dependent functions of the FatFs library, and as a user of the library you need to define them. The FatFs documentation says, "When use heap memory for the working buffer, memory management functions, ff_memalloc and ff_memfree, need to be added to the project."
See this link MakefileBasedBuild/Atmel/sam3x/sam3x-ek/libraries/libfatfs/fatfs/src/option/syscall.c - device/googl... for and example. You can implement them to simply delegate to the C standard library malloc() and free() functions.
Hi, Colin
In "C:\Freescale\SDK_2.0_MK64FN1M0xxx12\middleware\fatfs_0.11a\src\option", I found "syscall.c" and "ccsbcs.c" files where "ff_malloc", "ff_memfree","ff_convert" and "ff_wtoupper" functions are declared.
I just copied them to my project and those build errors are gone! Incredibly, those files are not included or linked in KSDK demo project, neither their KSDK path are included in Project Compiler Settings.
Thanks for your help!