• AVR Freaks

Hot!XC8 v2.05 C99 compiler error

Page: 123 > Showing page 1 of 3
Author
mouchuanlin
Starting Member
  • Total Posts : 56
  • Reward points : 0
  • Joined: 2019/01/23 12:41:10
  • Location: 0
  • Status: offline
2019/09/05 12:25:01 (permalink)
0

XC8 v2.05 C99 compiler error

Hi,
I am using XC8 v2.05 compiler in C99, see error below. It's fine with C90.
 
::: error: (2047) 24-bit floating point types are not supported when compiling in C99
 
Any suggestions what might be wrong?
 
Thx
#1

45 Replies Related Threads

    1and0
    Access is Denied
    • Total Posts : 10223
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 12:32:55 (permalink)
    +2 (2)
    mouchuanlin
    I am using XC8 v2.05 compiler in C99, see error below. It's fine with C90.
     
    ::: error: (2047) 24-bit floating point types are not supported when compiling in C99
     
    Any suggestions what might be wrong?

    What part of that error message you do not understand?
     
    #2
    mouchuanlin
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2019/01/23 12:41:10
    • Location: 0
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 12:34:53 (permalink)
    0
    I don't use any floating point type. So what am I getting floating point error?
    #3
    1and0
    Access is Denied
    • Total Posts : 10223
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 12:42:24 (permalink)
    +1 (1)
    mouchuanlin
    I don't use any floating point type. So what am I getting floating point error?

    Are you really sure? Maybe some library functions you're using that use float. Try changing Size of float from 24 bits to 32 bits in your Project Properties, and see if the error goes away.
    #4
    mouchuanlin
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2019/01/23 12:41:10
    • Location: 0
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 14:13:36 (permalink)
    0
    I saw following files from Microchip folder which I do not specific include in the project. Any thoughts on how it get into project? Does this come from the include header file?
     
    Thx
     
    C:\Program Files (x86)\Microchip\xc8\v2.05\pic\sources\c90\common\float.c:62:: advisory: (1510) non-reentrant function "___ftpack" appears in multiple call graphs and has been duplicated by the compiler
    C:\Program Files (x86)\Microchip\xc8\v2.05\pic\sources\c90\common\ftge.c:4:: advisory: (1510) non-reentrant function "___ftge" appears in multiple call graphs and has been duplicated by the compiler
    C:\Program Files (x86)\Microchip\xc8\v2.05\pic\sources\c90\common\lwmod.c:7:: advisory: (1510) non-reentrant function "___lwmod" appears in multiple call graphs and has been duplicated by the compiler
    C:\Program Files (x86)\Microchip\xc8\v2.05\pic\sources\c90\common\lwtoft.c:28:: advisory: (1510) non-reentrant function "___lwtoft" appears in multiple call graphs and has been duplicated by the compiler


    #5
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11524
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 14:58:27 (permalink)
    +1 (1)
    They are not part of the project.  Those are just library files referenced by your code.  It would appear that not only are you using floating point, but that you're using it in the interrupt handler.
     
    Post your code.
    #6
    mouchuanlin
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2019/01/23 12:41:10
    • Location: 0
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 15:53:54 (permalink)
    0
    Those are the .h files I include.
     
    #include <stdint.h>
    #include <stdbool.h>
    #include <stdint.h>
    #include <stdbool.h>
    #include <stdlib.h>
    #include <pic18f26k22.h>
    #include <string.h>
    #include <xc.h>
    #include <ctype.h>
    #7
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11524
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 16:03:21 (permalink)
    +1 (1)
    Your header files have nothing to do with any of this.  Post all of your .c files.
    #8
    mouchuanlin
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2019/01/23 12:41:10
    • Location: 0
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 16:11:51 (permalink)
    0
    There are many files, don't think I can post those. What are you looking for in the .c file?
    #9
    1and0
    Access is Denied
    • Total Posts : 10223
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 16:23:08 (permalink)
    +1 (1)
    mouchuanlin
    There are many files, don't think I can post those. What are you looking for in the .c file?

    Anything that uses or is a floating point. It could be as simple as a "." in the wrong place. But we can only guess without seeing your .c file.
     
    For starter, try posting all your ISR functions and all the functions they called.
    post edited by 1and0 - 2019/09/05 16:31:24
    #10
    NKurzman
    A Guy on the Net
    • Total Posts : 18183
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: XC8 v2.05 C99 compiler error 2019/09/05 16:35:56 (permalink)
    +1 (1)
    search for "float", and "double" in your Project code to start.
    then look for Constants with a decimal point.
    #11
    mouchuanlin
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2019/01/23 12:41:10
    • Location: 0
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 16:50:47 (permalink)
    0
    I don't have any float and double or decimal define in my project. I do found the --float in generated Makefile-default.mk and configurations.xml. Not sure what's that for.
     
    ${OBJECTDIR}/data_handling.p1: data_handling.c nbproject/Makefile-${CND_CONF}.mk
    @${MKDIR} "${OBJECTDIR}"
    @${RM} ${OBJECTDIR}/data_handling.p1.d
    @${RM} ${OBJECTDIR}/data_handling.p1
    ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/data_handling.p1 data_handling.c
    @-${MV} ${OBJECTDIR}/data_handling.d ${OBJECTDIR}/data_handling.p1.d
    @${FIXDEPS} ${OBJECTDIR}/data_handling.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
     
     
     
    <property key="data-model-size-of-float" value="24"/>
    <property key="data-model-size-of-float-gcc" value="short-float"/>
    #12
    ric
    Super Member
    • Total Posts : 25215
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 16:53:42 (permalink)
    +2 (2)
    mouchuanlin
    Those are the .h files I include.
     
    #include <stdint.h>
    #include <stdbool.h>
    #include <stdint.h>
    #include <stdbool.h>
    #include <stdlib.h>
    #include <pic18f26k22.h>
    #include <string.h>.
    #include <xc.h>
    #include <ctype.h>


    As jtemples stated, these have no bearing on your immediate problem, but a couple of comments:
    • Move xc.h to the top of the list.
    • Get rid of pic18f26k22.h (it gets included automatically by xc.h You don't need it twice.)
    • Get rid of the second occurrence of stdbool.h
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #13
    1and0
    Access is Denied
    • Total Posts : 10223
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 17:10:07 (permalink)
    +1 (1)
    mouchuanlin
    I don't have any float and double or decimal define in my project. I do found the --float in generated Makefile-default.mk and configurations.xml. Not sure what's that for.
     
     --double=24 --float=24 
     
     <property key="data-model-size-of-float" value="24"/>
    <property key="data-model-size-of-float-gcc" value="short-float"/>

    They just mean you have selected the size of float and double to be 24 bits.
     
    From your Post #5 messages:
    • __ftpack() is used to pack a floating point number.
    • __ftge() is used to perform a >= comparison of two floating point numbers.
    • __lwtoft() is used to convert an integer to a floating point number.
    #14
    mouchuanlin
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2019/01/23 12:41:10
    • Location: 0
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 17:10:13 (permalink)
    0
    Yeah, I did remove the duplicate of the .h files. Thx
    #15
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11524
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/05 22:48:59 (permalink)
    +1 (1)
    Also keep in mind that most functions in math.h (sqrt, pow, etc.) are floating point, even if you pass integer values to them.
    #16
    mouchuanlin
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2019/01/23 12:41:10
    • Location: 0
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/06 10:04:12 (permalink)
    0
    See attached led.h/.c file and make file section of the led.c.
    Note - this forum doesn't allow to upload .h file so I rename .h to led-h.c.
     
    Thx
     
    ${OBJECTDIR}/led.p1: led.c nbproject/Makefile-${CND_CONF}.mk
    @${MKDIR} "${OBJECTDIR}"
    @${RM} ${OBJECTDIR}/led.p1.d
    @${RM} ${OBJECTDIR}/led.p1
    ${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -fshort-double -fshort-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o ${OBJECTDIR}/led.p1 led.c
    @-${MV} ${OBJECTDIR}/led.d ${OBJECTDIR}/led.p1.d
    @${FIXDEPS} ${OBJECTDIR}/led.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
     
    #17
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11524
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/06 10:12:49 (permalink)
    0
    Do you have a question about those files?
    #18
    mouchuanlin
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2019/01/23 12:41:10
    • Location: 0
    • Status: offline
    Re: XC8 v2.05 C99 compiler error 2019/09/06 10:16:28 (permalink)
    0
    Checking the file, there is no float, double at all. Why there is a 24-bit floating point types are not supported error?
     
     
    nbproject/Makefile-default.mk:218: recipe for target 'build/default/production/Main.p1' failed
    nbproject/Makefile-default.mk:234: recipe for target 'build/default/production/led.p1' failed
    nbproject/Makefile-default.mk:258: recipe for target 'build/default/production/uart.p1' failed
    ::: error: (2047) 24-bit floating point types are not supported when compiling in C99
    (908) exit status = 1
    ::: error: (2047) 24-bit floating point types are not supported when compiling in C99
    ::: error: (2047) 24-bit floating point types are not supported when compiling in C99
    ::: error: (2047) 24-bit floating point types are not supported when compiling in C99
    #19
    NKurzman
    A Guy on the Net
    • Total Posts : 18183
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: XC8 v2.05 C99 compiler error 2019/09/06 10:29:56 (permalink)
    0
    Try the Map file.  It should give the specific functions that call the FP Functions.
    I did not see anything in the code you posted.
    #20
    Page: 123 > Showing page 1 of 3
    Jump to:
    © 2020 APG vNext Commercial Version 4.5