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.

Compiler/MSP430F5529: upgrade compile created a warning - part 2

Part Number: MSP430F5529


Tool/software: TI C/C++ Compiler

I upgraded my firmware from TI V15.?.?.LTS to the latest compiler V16.9.0.LTS and when I built my project I got some new errors.  I am unclear as to what to do.  The code works but I am half way into development and need to add more, so I would rather deal with these warnings now so it does not turn into a potential bigger problem later.

I am rather rusty on my firmware coding so I am unsure what I am looking at.

Here is the code.

/***********************************************************************************
 *
 *      Global Variables
 *
 ***********************************************************************************/
//
FIL file;                                               /* Opened file object */
FATFS fatfs;                                            /* File system object */
DIRS rootDir;                                           /* Directory object   */
DIRS dir;
FRESULT errCode;                                        /* Error code object  */
FRESULT res;                                            /* Result object      */
UINT bytesRead;                                         /* Bytes read object  */
//UINT read;                                            /* Read bytes object  */
//
//
void sdcardtest(void)               // This tests the SD card by checking
{                                   // the different commands in one set.
    char line[82];                  /* Line buffer */
    int result;
//    FIL fTest;                     /* File objects */
    int files_left;
    FILINFO fileEntry;
    unsigned char file_open = 0;        //0 if no file currently open, 1 if a file is open
    FRESULT errCode = -1;
     fprintf(stdout,("Initializing SD card\r\n"));
     while (errCode != FR_OK)
     {
        do a bunch of stuff to the SD CARD
        This code uses errCode alot
     }

I truncated the code at the while loop as it goes through a bunch of steps to intilize, read and write to the SD card.   But the issue is with FRESULT errCode = -1.

Why do I get these warnings  for FRESULT errCode = -1?

#190-D enumerated type mixed with another type

#69-D integer conversion resulted in a change of sign.

  • The type FRESULT is a enumerated type.  I recommend you add another enumerated value for invalid values.  Something like ...

    enum FRESULT { THE, NAMES, THERE, NOW, INVALID_VALUE=-1};

    Now use INVALID_VALUE wherever you initialize with, or check for, -1.

    Thanks and regards,

    -George