7 years, 11 months ago.

Linker error when using the Nordics FlashDataStorage API's.

I am using the online compiler to compile against the NRF52_DK platform. Although there are no compilation errors while using the FDS api's. But I get the linker error below. I call the fds_register method from a custom c++ class TestFlashStorage.

Error: Undefined symbol fds_register(void(*)(const fds_evt_t*)) (referred from TestFlashStorage.NRF52_DK.o).

Can I not invoke FDS api's from c++ methods as shown below?

linker error:Undefined symbol fds_register

ret_code_t TestFlashStorage::Initialize() {
    
    ret_code_t ret = fds_register(&TestFlashStorage::OnFDSEvents);
    
    if (ret != FDS_SUCCESS)
    {
        logError("FDS Registration failed with error code: %d", ret);
        return ret;
    }
    return NRF_SUCCESS;
}

Thanks, Yogesh

Question relating to:

The nRF52 Development Kit is a single-board development kit for Bluetooth Smart, ANT and 2.4GHz proprietary applications using the nRF52 Series SoC. This kit supports both development for nRF52832 SoCs.

1 Answer

7 years, 11 months ago.

Yes you can use fds from c++. You must make toolchain aware of that C code is called instead of C++: Use extern "c" statement in order to include fds header:

extern "C"
{
   #include "fds.h"
}

For clarification - because FDS is not a generic API for mbed-os it is not included by e.g. mbed.h. You can expect similar behaviour for other nordic's specific code.

Accepted Answer

Thanks a lot Andrzej, I had asked the same question to Nordic support and they told me FDS is not enabled and the FDS API is not supported in the MBED platform or rather not implemented. But I had looked up in the MBED-OS branch in github and I do see the FDS libarary.

Thanks for the simple fix you suggested and the linker error is gone. So I am assuming the FDS related libraries are compiled for the NRF52 target?

Thanks, Yogesh

posted by Yogesh k 27 Jan 2017

Yes, FDS libraries are compiled for NRF52 targets.

posted by Andrzej Puzdrowski 30 Jan 2017