Skip to main content
ssk
Associate III
April 22, 2015
Question

Using standard header files

  • April 22, 2015
  • 16 replies
  • 4252 views
Posted on April 22, 2015 at 11:47

I am trying to use standard header files - string.h, stdint.h with SPC5Studio. When included to the project, it displays a message as 'unresolved inclusion <string.h>'. What can be done to resolve this? Whether SPC5Studio supports these type of standard header files or not? Whether need to add these files externally? If yes, which files to use for this?

Thanks in advance.

Mike.
    This topic has been closed for replies.

    16 replies

    Erwan YVIN
    ST Employee
    May 18, 2015
    Posted on May 18, 2015 at 14:13

    Hello Mike ,

    Could you try to synchronize your project with ''F5'' ?

    SPC5Studio 3.5 on Luna eclipse framework will arrive in the next days.

    I hope that it will solve the issue

              Best regards

                        Erwan

    Patriks
    Senior
    July 2, 2015
    Posted on July 02, 2015 at 15:14

    Hello!

    I have a similar issue when I tried to include math.h in one of my projects. In properties->path and symbols I added the .../hightec/ppc-ht-eabi/include path. I had to use other settings than Erwan in his screenshot. Setting the option ''Is a workspace path'' leads to an unresolved inclusion warning (question mark at line of #include <math.h>). Therefore, I unchecked this option and the inclusion seems to work. I can jump to the file or function when clicking with ctrl+left mouse button on the source code.

    So my next step was to use simple sine function with a=sin(b). Both values are defined as double and the project can be build successfully. But when I flashed the program to SPC56EL Discovery Board and the program counter gets to this line of code it hangs in while loop of function osalSysHalt within osal.c. Same behavior when I tried to use any other function from math.h.

    Defines like M_PI are no problem to use. Any suggestions what I have done wrong? I am using version 3.5 of SPC5Studio with hitec compiler. By the way, the path I included in path and symbols is also looking like that C:\SPC5Studio\... It uses ''\'' and not ''/'' as the predefined entries.

    Best regards,

    Patrik

    Erwan YVIN
    ST Employee
    July 2, 2015
    Posted on July 02, 2015 at 17:11

    Hello Patrick ,

    functions relative to math.h is using float

    could you use -msoft-float in your compiler options and try to link with libm ?

    Anyway , we have added a change request concerning the libm

    Best regards

                                 Erwan

    Patriks
    Senior
    July 3, 2015
    Posted on July 03, 2015 at 09:00

    Hello Erwan,

    Floating point operations like multiplications are working without additional compiler options. Nevertheless, I added -msoft-float. What I am not sure about is how to link with libm? I add libm.a in Properties->Path and Symbols->Libraries and insert -lm in compiler options which now looks like that:

    # Compiler options here. 
    ifeq ($(USE_OPT),) 
    USE_OPT = -O0 -lm -ggdb -fomit-frame-pointer -falign-functions=16 
    endif

    But it is still not working.

    Best regards, Patrik
    Erwan YVIN
    ST Employee
    July 7, 2015
    Posted on July 07, 2015 at 15:45

    Hello Patrik ,

    I ma checking the issue today 

    Best regards

     

                          Erwan

    Erwan YVIN
    ST Employee
    July 7, 2015
    Posted on July 07, 2015 at 16:51

    Hello Patrik ,

    it is working well from my side

    From an application ChibiOS-RT SPC560Dxx Test Application for Discovery

    Compile with these following options in Common options :

    -ggdb -DCHPRINTF_USE_FLOAT -lm -fomit-frame-pointer -falign-functions=16 -msoft-float

    Cf Application in attachment

    and screenshot in attachment

    Best regards

    Erwan

    ________________

    Attachments :

    2015-07-07_164341.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtcR&d=%2Fa%2F0X0000000aS7%2FJLuMHgB482kCcchoRL9VbEYa8ioam8HjYUbvlgwsRoM&asPdf=false

    ChibiOS-RT_SPC560Dxx_Test_Application_for_Discovery_LIBM.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtfU&d=%2Fa%2F0X0000000aVa%2FOImDBGKi0JrtRrQcfSfGH17nm0hJPmv0xRbRNCxYR3w&asPdf=false