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.

F021 Flash API CGT.IAR.h

Other Parts Discussed in Thread: TMS570LS2124

I am working with the F021 flash library on a TMS570LS2124 microprocessor using the IAR development environment.  While investigating the behavior of the  FAPI_CHECK_FSM_READY_BUSY macro, I discovered the an issue with the endian detection logic in the CGT.IAR.h file.

Per the IAR Embedded Workbench documentation, the __LITTLE_ENDIAN__ preprocessor symbol is defined to 1 when the byte order is little endian and 0 when the byte order is big endian.  The F021 Flash Library CGT.IAR.h file makes its endian decision based on the presence of the _LITTLE_ENDIAN__ preprocessor symbol rather than the symbols value.  Because IAR always defines the __LITTLE_ENDIAN__ symbol, _LITTLE_ENDIAN is always defined by the F021 Flash Library.

Could you confirm this problem and provide an timeline for resolution?  I changed my local copy of CGT.IAR.h for now.  Thanks.

  • Hi Jose,

    I don't see any problem in CGT.IAR.h file. If I define a symbol with a value (#define ABC 123;), I can use ABC in "#if define(ABC)" without any issue.

    Regards,
    QJ
  • Your statement is true.  However, IAR 7.40.1 defines the __LITTLE_ENDIAN__ symbol regardless of the project's endian setting.  Therefore, based on the following code in CGT.IAR.h, the symbol _LITTLE_ENDIAN will always be defined.  For the TMS570LS2124, _BIG_ENDIAN must be defined in order for the FAPI_CHECK_FSM_READY_BUSY macro to work.

    #if !defined(__LITTLE_ENDIAN__)   /* is big endian compile */
    #if !defined(_BIG_ENDIAN)
        #define _BIG_ENDIAN           /* FAPI generic define for big endian */
    #endif
    #endif
    #if  defined(__LITTLE_ENDIAN__)   /* is little endian compile */
    #if !defined(_LITTLE_ENDIAN)
        #define _LITTLE_ENDIAN        /* FAPI generic define for little endian */
    #endif
    #endif

    I suggest changing CGT.IAR.h to use the value of the __LITTLE_ENDIAN__ symbol to make the endian setting determination as follows:

    #if (__LITTLE_ENDIAN__ == 0)   /* is big endian compile */
    #if !defined(_BIG_ENDIAN)
        #define _BIG_ENDIAN           /* FAPI generic define for big endian */
    #endif
    #endif
    #if (__LITTLE_ENDIAN__ == 1)   /* is little endian compile */
    #if !defined(_LITTLE_ENDIAN)
        #define _LITTLE_ENDIAN        /* FAPI generic define for little endian */
    #endif
    #endif

  • Thanks Jose, you are right. We filed a CQ ticket SDOCM00116928 on this issue so it can be corrected.