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,

    In earlier versions of SEGGER embedded studio (I think before 5.30) and with SDK version 15.3.0 I was able to make it work.

    I was not an elegant solution, but I duplicated the ffconf.h file into my source folder and prepended it with the line "#pragma once"

    Then my FatFS would use the configuration file in my source folder over the one in the SDK.

    However, after updating to newer versions of both the SDK and SEGGER this no longer works for me. I would also suggest trying to move the entire FatFS into your source folder. I have not done this myself yet.

    Br. Casper

Children
Related