SDCard Using FatFS without SDK doesn't compile

Hi,

During the development of the firmware over nRF5340, I need to modify the ffconf.h file without changing the SDK. Based on this post I copied the FATFS files into the application root in this way: src/fatfs/<files> and into pro.conf I modified the file in this way:

# SDCard & Filesystem
CONFIG_DISK_DRIVERS=y
CONFIG_DISK_DRIVER_SDMMC=y
CONFIG_DISK_ACCESS=y

# Added FATFS library into application project folder!
CONFIG_FILE_SYSTEM=n
CONFIG_FAT_FILESYSTEM_ELM=n

When I try to compile (pristine build) the project, I receive the following errors:

Y:\Projects\X\src\fatfs\ff.c:4989: multiple definition of `f_mkdir'; app/libapp.a(ff.c.obj):Y:\Projects\X\src\fatfs\ff.c:4989: first defined here
c:/users/warcomeb/ncs/toolchains/v2.1.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.exe: app/libapp.a(file.c.obj): in function `f_rename':
Y:\Projects\X\src\fatfs\ff.c:5074: multiple definition of `f_rename'; app/libapp.a(ff.c.obj):Y:\Projects\X\src\fatfs\ff.c:5074: first defined here
c:/users/warcomeb/ncs/toolchains/v2.1.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.exe: app/libapp.a(file.c.obj): in function `f_mkfs':
Y:\Projects\X\src\fatfs\ff.c:5808: multiple definition of `f_mkfs'; app/libapp.a(ff.c.obj):Y:\Projects\X\src\fatfs\ff.c:5808: first defined here
c:/users/warcomeb/ncs/toolchains/v2.1.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.exe: app/libapp.a(file.c.obj): in function `File_directoryChange':
Y:\Projects\X\src\file.c:177: undefined reference to `fs_opendir'
c:/users/warcomeb/ncs/toolchains/v2.1.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.exe: app/libapp.a(file.c.obj): in function `File_init':
Y:\Projects\X\src\file.c:155: undefined reference to `fs_mount'

I can't delete the reference to zephyr module...

Where is it the problem?

Thanks 

Parents Reply
  • Hi Marco,

    Disregard my previous answer, I was thinking about my previous solution.

    The current solution that is working is as you write.

    I have copied this folder from the SDK into my project source file:

    <SDK location>\nRF5_SDK_17.1.0_ddde560\external\fatfs\src

    Then, in the <myProject>.emProject file (xml), I am making sure that I am no longer referencing the SDK copy of the fatfs, by removing any references to it in the "c_user_include_directories"

    I am also using "Dynamic Folders" instead of "Virtual Folders" for my source folder in SEGGER Embedded studio. They are folders that are synchronized with my disk. They are denoted like this in my .emProject file:

        <folder Name="Source" exclude="" filter="" path="Source" recurse="Yes" /> 

    I used this forum post to find out how to make them:

    https://forum.segger.com/index.php/Thread/4750-SOLVED-Feedback-on-SES/

    Hope this helps,

    Br. Casper

    Edit: It is specifically the "src" of the fatfs that I have included directly in my project.

Children
Related