Enabling LFN configuration in KSDK V. 2 FRDM-K64F USB HOST FATFS demo project causes build errors

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Enabling LFN configuration in KSDK V. 2 FRDM-K64F USB HOST FATFS demo project causes build errors

跳至解决方案
1,595 次查看
MAPC
Senior Contributor I

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?

 

152640_152640.pnglfn_setttings.png

152641_152641.pngpastedImage_1.png

152642_152642.pngerror_mem_alloc_function_call.png

Can anybody help me on that please?

 

Thanks and best regards,

 

Marco Coelho

Applications Engineer

Siletec Eletronica

标签 (1)
0 项奖励
回复
1 解答
1,400 次查看
MAPC
Senior Contributor I

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!

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,400 次查看
colin
Contributor III

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.

0 项奖励
回复
1,401 次查看
MAPC
Senior Contributor I

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!

0 项奖励
回复