FR_OK marked as unresolved symbol
Answer
9/24/18 10:20 AM

Hello,

I just upgraded to Workbench 3.4. I noticed that FR_OK (enum F_RESULT from ff.h) is now marked as unresolved even though the build was finished successfully.

What should I do to remove these error marks (aside from migrating code to use XDK_Storage.h)? Thank you

 

+1 (1 Vote)
RE: FR_OK marked as unresolved symbol
Answer
9/24/18 6:40 PM as a reply to Ikhwani Ikhwani.
Hello Ikhwani,

this is a common issue with unresolved flags, which can be solved by following these steps:
  • Restart your XDK Workbench
  • Rightclick on your affected project and choose Clean Project
  • After cleaning the project, rightclick on your project again and choose Build Project
This process reloads the whole SDK, so the previous unresolved flags usually disappear.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 Votes)
RE: FR_OK marked as unresolved symbol
Answer
9/25/18 3:08 AM as a reply to Franjo Stjepandic.

Hello Franjo,

Thank you for your response. I followed your advice, but the unresolved errors for FR_OK still exist.

As mentioned before, I have included ff.h which contains FR_OK and the build process actually finished successfully. Only these error marks are annoying.

This happened after I upgraded from 3.3.1 to 3.4 (didn't happen before)
You can try this with the SDCardExample project from 3.3.1 but compile it in 3.4

0 (0 Votes)
RE: FR_OK marked as unresolved symbol
Answer
9/25/18 9:17 AM as a reply to Ikhwani Ikhwani.

Hello Franjo,

The issue is resolved. This has to do with the Eclipse C/C++ indexer.
What I did: right clicked on the project and then selected Index -> Rebuild. The invalid unresolved errors are now gone.

 

0 (0 Votes)
RE: FR_OK marked as unresolved symbol
Answer
9/25/18 7:56 PM as a reply to Ikhwani Ikhwani.
Hello Ikhwani,

I'm glad that you found a solution which seems to work for this case.
To avoid possible clashes, which are based on the same main issue, I would like to add some insight to the general issue.

The SDK from Workbench version 3.3.1 to Workbench version 3.4.0 improved due to many changes.

If a project is imported from 3.3.1 into 3.4.0, the source code expects to run with the SDK it was created with (3.3.1).

To solve this issue in a suggested clean and stable way, there is always the option to create a new project within the Workbench version 3.4.0. and to adapt the old project into the new created.
I also suggest another solution, which is to keep a second outdated Workbench (in your case version 3.3.1) to run earlier projects like yours, without the need to recreate them in 3.4.0.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 Votes)
RE: FR_OK marked as unresolved symbol
Answer
4/18/19 7:54 AM as a reply to Franjo Stjepandic.

Hello Franjo,

I get the same problem, I have used the example code provided in the sdcard guide

and this is the code

 

 

#include "BCDS_SDCard_Driver.h"
#include "ff.h"
// constant definitions
#define DEFAULT_LOGICAL_DRIVE ""
#define DRIVE_ZERO UINT8_C(0)
#define FORCE_MOUNT UINT8_C(1)
#define FIRST_LOCATION UINT8_C(0)


static FIL fileObject; // file object pointer to be used for all file actions


void writeDataIntoFileOnSdCard(const char* filename, const char* dataBuffer){
     FRESULT fileSystemResult;
     char ramBufferWrite[UINT16_C(512)]; // Temporary buffer for write file
     uint16_t fileSize;
     UINT bytesWritten;

     fileSize = (uint16_t) strlen(dataBuffer);
     for(uint32_t index = 0; index < fileSize; index++){
         ramBufferWrite[index] = dataBuffer[index];
      }

     f_open(&fileObject, filename, FA_OPEN_EXISTING | FA_WRITE);
     f_lseek(&fileObject, f_size(&fileObject));
     fileSystemResult = f_write(&fileObject, ramBufferWrite, fileSize, &bytesWritten);

     if((fileSystemResult != FR_OK) || (fileSize != bytesWritten)){
        printf(" Error: Cannot write to file %s \n\r",filename);
     }
     fileSystemResult = f_close(&fileObject);
     }

void createFileOnSdCard(const char* filename){
         if(FR_OK == f_open(&fileObject, filename, FA_CREATE_NEW)){
            printf("File %s was created successfully \n\r",filename);
         }
}

void deleteFileOnSdCard(const char* filename){
    f_unlink(filename);
}

Retcode_T searchForFileOnSdCard(const char* filename, FILINFO* fileData){
   if(FR_OK == f_stat(filename, fileData)){
           printf("File %s found on SD card. \n\r",filename);
            return RETCODE_OK;
      }
    else{
         printf("File %s does not exist. \n\r",filename);
          return RETCODE_FAILURE;
         }
}

void readDataFromFileOnSdCard(const char* filename){
    FRESULT fileSystemResult;
    FILINFO fileInfo;
    char ramBufferRead[UINT16_C(512)]; // Temporary buffer for read file
    UINT bytesRead;

    if(RETCODE_OK == searchForFileOnSdCard(filename,&fileInfo)){
        f_open(&fileObject, filename, FA_OPEN_EXISTING | FA_READ);
        f_lseek(&fileObject, FIRST_LOCATION);
        fileSystemResult = f_read(&fileObject, ramBufferRead, fileInfo.fsize, &bytesRead);
        if((fileSystemResult != FR_OK) || (fileInfo.fsize != bytesRead)){
            printf("Error: Cannot read file %s \n\r",filename);
         }
         else{
              ramBufferRead[bytesRead] = '\0';
              printf("Read data from file %s of the SD card \n\r",filename);
              printf(ramBufferRead);
              printf("\n\r");
         }
         f_close(&fileObject);
   }
  else{
      printf("No file with name %s exists on the SD card \n\r",filename);
  }
}

void InitSdCard(void){
     Retcode_T retVal = RETCODE_FAILURE;
     FRESULT FileSystemResult = FR_OK;
      static FATFS FatFileSystemObject;

       SDCardDriver_Initialize();

        if(SDCARD_INSERTED == SDCardDriver_GetDetectStatus()){
             retVal = SDCardDriver_DiskInitialize(DRIVE_ZERO);
              if(RETCODE_OK == retVal){
                   printf("SD Card Disk initialize succeeded \n\r");
                   FileSystemResult = f_mount(&FatFileSystemObject, DEFAULT_LOGICAL_DRIVE, FORCE_MOUNT);
                    if (FR_OK != FileSystemResult){
                         printf("Mounting SD card failed \n\r");
                    }
              }
        }
}
void appInitSystem(void * CmdProcessorHandle, uint32_t param2){
     if (CmdProcessorHandle == NULL){
          printf("Command processor handle is null \n\r");
           assert(false);
     }
      BCDS_UNUSED(param2);
       InitSdCard();
        const char Filename [] = "test_xdk.txt";
         // implicit conversion from lower to upper case file name
       if(RETCODE_OK == searchForFileOnSdCard(Filename,NULL)){
            deleteFileOnSdCard(Filename);
       }
        createFileOnSdCard(Filename);
         const char FileContent[] =
         "Hello XDK community, the SD card guide created Content on this SD Card \n";
          writeDataIntoFileOnSdCard(Filename,FileContent);
          readDataFromFileOnSdCard(Filename);
}

/**@} */
/** ************************************************************************* */
Also the same goes to this line  f_lseek(&fileObject, f_size(&fileObject));

I have tried the suggested solution but still getting the same error

 

+3 (3 Votes)