Menu

#81 test for stdint.h fails on IAR/MSP430X

v1.0 (example)
closed-invalid
nobody
None
5
2014-01-20
2014-01-19
No

SVN 2168 adds a new test for stdint.h being included. That test fails on IAR/MSP430X despite that file being present.

Compiling a file that includes FreeRTOS.h produces the error: "Fatal Error[Pe035]: #error directive: Read the instructions in FreeRTOS/source/stdint.readme if stdint.h is not provided with your compiler or you are building with standard libraries excluded (for example, with -nostdint in GCC). B:\src\FreeRTOS\include\FreeRTOS.h 84".

IAR does provide stdint.h, and it is included by the project successfully. However, it doesn't define UINT32_MAX so the test fails and the #error is produced. I don't know if that's the fault of the IAR include files, or FreeRTOS is using an incorrect test.

The workaround is fairly simple: define UINT32_MAX in the project options. But, I'm not sure that's the correct solution.

Discussion

  • Richard Barry

    Richard Barry - 2014-01-19

    Hmm. I already checked with IAR/MSP430X and didn't get a problem. I just rechecked with the compiler set to C89 and C99 and again didn't have any problem. Strictly speaking I think the stdint.h is only mandated for C99, but my testing so far has shown it present with all 14 compilers used by FreeRTOS bar one, which was the old C18 PIC18 compiler.

    Which version of the compiler are you using? Can you determine which stdint.h it is actually including and attach it to this ticket?

    Reference to your previous ticket - are you still building the code as C++ rather than C? Maybe that could be the difference?

    Regards.

     
  • Richard Damon

    Richard Damon - 2014-01-19

    That sounds like the IAR stdint.h is not compliant (or the MSP430 has no 32 bit unsigned type.)

     
  • Graham Menhennitt

    You're right - it works correctly when compiling as C, but fails as C++.

    The stdint.h file does have a definition of UINT32_MAX, but it's wrapped in "#ifdef INT32_T_TYPE" and that doesn't seem to be defined anywhere. So, it's not seeing the definition. I don't know how it works for C.

    Is there a better test that can be used for C++?

    I'm using IAR Embedded Workbench for MSP430 v 5.60.1.

    stdint.h has the following comments:

    /* stdint.h standard header */
    /* Copyright 2003-2010 IAR Systems AB. */
    and
    /*
    * Copyright (c) 1992-2009 by P.J. Plauger. ALL RIGHTS RESERVED.
    * Consult your license regarding permissions and restrictions.
    V5.04:0576 */

    Thanks,
    Graham

     

    Last edit: Graham Menhennitt 2014-01-20
  • Richard Barry

    Richard Barry - 2014-01-20

    If I understand you correctly, it is finding stdint.h and stdint.h does include the necessary types - so it is only the guard around the #error that is causing the problem.

    If that is the case then maybe it would be best to just remove the #error altogether. The release candidate #2 code does not have the #error anyway - it is only in svn as a 'nice to have' afterthought.

    The only project I had a problem compiling with the dependency on stdint.h were those from one particular manufacture that that had the -nostlib GCC setting on by default. Removing that command line option allowed them to build too.

    Regards.

     
  • Richard Barry

    Richard Barry - 2014-01-20

    The code (not yet checked in) has the #error removed and replaced with a verbose comment thus:

    /*

    • If stdint.h cannot be located then:
      • If using GCC ensure the -nostdint options is not being used.
      • Ensure the project's include path includes the directory in which your
    • compiler stores stdint.h.
      • Set any compiler options necessary for it to support C99, as technically
    • stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any
    • other way).
      • The FreeRTOS download includes a simple stdint.h definition that can be
    • used in cases where none is provided by the compiler. The files only
    • contains the typedefs required to build FreeRTOS. Read the instructions
    • in FreeRTOS/source/stdint.readme for more information.
      */

    Regards.

     
  • Richard Barry

    Richard Barry - 2014-01-20
    • status: open --> closed-invalid
     
  • Richard Barry

    Richard Barry - 2014-01-20

    [as an aside, the support forum is the best place to discuss these things, especially in code that is not yet released. your time spent in providing feedback is greatly appreciated]

     

Log in to post a comment.

MongoDB Logo MongoDB