This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28379D: Using the Flash API with C++

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi,

I am trying out a simple code which writes a few variables to flash memory.  I am trying to call the Flash API library from the code but even the initialization is not being recognized and I am getting a 10234D error for unresolved symbols. I checked the library includes and the project shows the library added from C2000Ware and the #include "F021_F2837xD_C28x.h" in my project.  I am not sure if I am missing anything else.

My project is in C++ is there a chance that it is not able to recognize the C code for the flash API library?  Any suggestions would be very helpful. 

undefined                                                                                       first referenced
symbol                                                                                            in file
--------- ----------------
Fapi_initializeAPI(volatile FMC_REGISTERS *, unsigned long) ./main.obj

Thanks a lot!

Aditya

  • I am not sure if I am missing anything else.

    If your file calling Fapi_initializeAPI() is a .cpp file then it is likely the call is mangled. You need to prevent mangling by telling the C++ compiler to treat the function call as a C function, not a C++ function.

    Where you have included the declaration of Fapi_ functions in your .cpp file, just wrap it as follows:

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

    Be aware that because extern "C" is missing from the flash API, it is indicative that TI have probably not tested or guarantee that it works in a C++ project.

  • Thanks a lot! 
    I added the lines you have suggested instead of just including the F021_F28x header files.  This helped with removing the unresolved symbols fault.

    Edit: I was able to get the Fapi_initialize() to run. However I was not able to get the next step to run. 

    When I try to use Fapi_setActiveFlashBank it gives me the following unresolved symbol: 

     _Fapi_serviceWatchdogTimer                    .../...Workspace/FLASH_Test/F021_API_F2837xD_FPU32.lib<Utilities.obj>

    I am guessing the serviceWatchdogTimer function is defined inside the F021_API lib and I cannot add an extern "C" to all those functions?

    Thank you again,

    Aditya

  • Aditya,

    Please look at these files:

    C:\ti\c2000\C2000Ware_4_02_00_00\device_support\f2837xd\examples\dual\flash_programming\cpu01\Fapi_UserDefinedFunctions.c

    C:\ti\c2000\C2000Ware_4_02_00_00\libraries\flash_api\f2837xd\include\F021.h

    Thanks and regards,

    Vamsi

  • Thanks Vamsi,

    The UserdefinedFunctions file did not get associated with the project for some reason. Thanks a lot!

    Aditya 

  • Sure Aditya, I am closing this post.

    Thanks and regards,
    Vamsi