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.

RTOS/SIMPLELINK-CC26X2-SDK: SDFatFS undefined Symbols

Part Number: SIMPLELINK-CC26X2-SDK

Tool/software: TI-RTOS

Hello Ti Experts,

I am trying to implement the SDFatFS module ____  

I was following the example implementation detailed in the following link:

http://dev.ti.com/tirex/#/?link=Software%2FSimpleLink%20CC26X2%20SDK%2FDocuments%2FSimpleLink%20MCU%20SDK%20User's%20Guide

From that link I developed the following code:

#if FATFS_ON
#include "ff.h"
//#include "ff.c"
#include "SDFatFS.h"
#include <ti/drivers/SD.h>
/* Drive number used for FatFs */
#define SD_DRIVE_NUM 0
char fileName[100] = "1";
#endif


void mainThread()
{
#if FATFS_ON

        SDFatFS_Handle sdfatfsHandle;
        FILE *src;
        // const char inputfile[] = "fat:"STR(SD_DRIVE_NUM)":input.txt";

        /* Mount and register the SD Card */
        sdfatfsHandle = SDFatFS_open(Board_SD0, SD_DRIVE_NUM);

        /* Open the source file */
        src = fopen(fileName, "r");
#endif
}


int main()
{
    /* Call driver init functions */
    Board_initGeneral();
    I2C_init();
    SPI_init();
    UART_init();
#if FATFS_ON
    SDFatFS_init();
#endif


    // Declare task param structure and task handle
    Task_Params taskParams;
    Task_Handle sampleSensors;

    Error_Block eb;
    Error_init(&eb);

    /* Create 1 task with priority 1 */
    Task_Params_init(&taskParams);
    taskParams.stackSize = 2048;
    taskParams.priority = 1;
    sampleSensors = Task_create((Task_FuncPtr)mainThread, &taskParams, &eb);
    if (sampleSensors == NULL) {
        System_abort("Task create failed");
    }

    //call BIOS_start() enables interrupts and starts the scheduler with BIOS
    BIOS_start();

    return (0);
}

I was having a number of issues with undefined symbols so I needed up directly importing ff.h and SDFatFS.c/h into the project.  This brought the number of undefines down to the following:

 undefined      first referenced
  symbol            in file     
 ---------      ----------------
 SDFatFS_config ./SDFatFS.obj   
 SDFatFS_count  ./SDFatFS.obj   
 ff_cre_syncobj ./ff.obj        
 ff_del_syncobj ./ff.obj        
 ff_rel_grant   ./ff.obj        
 ff_req_grant   ./ff.obj 

Any ideas on how to deal with these undefined symbols?

Also, I get a warning saying that the handle for the FATfs is not being used despite having it set equal to SDFatFS_open(Board_SD0, SD_DRIVE_NUM). 

Any help would be greatly appreciated,

Thanks

  • From the driver documentation:

    *  The SDFatFS driver interface module is joined (at link time) to a NULL

    *  terminated array of SDFatFS_Config data structures named *SDFatFS_config*.

    *  *SDFatFS_config* is implemented in the application with each entry being an

    *  instance of the driver. Each entry in *SDFatFS_config* contains a:

    *  - (void *) data object that contains internal driver data structures

    Meaning that you have to do this:

    SDFatFS_Object myObj;
    
    SDFatFS_Config SDFatFS_config[] =
    {
        { &myObj },
        NULL
    };
    

    You also have to :

    uint_least8_t SDFatFS_count = sizeof(SDFatFS_config) / sizeof(SDFatFS_config[0]) - 1;

    And do

    SDFatFS_init();

    IN the linker setup:

    AND, also link FATFS in linker options, AFTER drivers.

     

    ${COM_TI_SIMPLELINK_CC13X0_SDK_INSTALL_DIR}/source/ti/drivers/lib/drivers_cc13x0.aem3

    ${COM_TI_SIMPLELINK_CC13X0_SDK_INSTALL_DIR}/source/third_party/fatfs/lib/ccs/m3/fatfs.a