• AVR Freaks

Hot!XC8 compiler errors using built in library functions

Author
mike_sprauve@yahoo.com
New Member
  • Total Posts : 12
  • Reward points : 0
  • Joined: 2014/02/06 15:37:53
  • Location: 0
  • Status: offline
2019/09/11 14:13:00 (permalink)
0

XC8 compiler errors using built in library functions

Hi,
I am trying to use the prebuilt library functions (such as NOP() or __delay_ms())... In every case I am getting an undefined reference error even though I have included <xc.h> in my main.c file. I am running XC8 (2.10) compiler for a ATtiny416 processor on a MacBook Pro
 
I need help Captain Obvious !!!!
#1

9 Replies Related Threads

    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11338
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: XC8 compiler errors using built in library functions 2019/09/11 14:52:18 (permalink)
    +1 (1)
    I don't see __delay_ms in the XC8 AVR user's manual.
    #2
    mike_sprauve@yahoo.com
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2014/02/06 15:37:53
    • Location: 0
    • Status: offline
    Re: XC8 compiler errors using built in library functions 2019/09/11 15:02:22 (permalink)
    0
    My mistake I downloaded the regular XC8 user manual ... not the AVR version
     
    Thanks Captain Obvious....
    #3
    mike_sprauve@yahoo.com
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2014/02/06 15:37:53
    • Location: 0
    • Status: offline
    Re: XC8 compiler errors using built in library functions 2019/09/11 15:05:20 (permalink)
    0
    Just downloaded the AVR user guide and it is in there  - Table A-19 (pg. 139) So I am back to my initial problem
     
    #4
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11338
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: XC8 compiler errors using built in library functions 2019/09/11 15:28:23 (permalink)
    +1 (1)
    The manual is in the "docs" directory of your compiler installation, you shouldn't need to download anything.  Table A-19 in the XC8 2.10 manual is not on page 139, so I'm guessing you have the wrong manual.
    #5
    ric
    Super Member
    • Total Posts : 23851
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: XC8 compiler errors using built in library functions 2019/09/11 15:37:22 (permalink)
    +1 (1)
    As above.
    The only delay mentioned in the correct User Guide is:
    __builtin_avr_delay_cycles
    Look in C:\Program Files (x86)\Microchip\xc8\v2.10\avr\doc\avr-libc\avr-libc-user-manual.pdf for more utility functions.
    (They do require #including more header files to use them)
     

    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!
    #6
    mike_sprauve@yahoo.com
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2014/02/06 15:37:53
    • Location: 0
    • Status: offline
    Re: XC8 compiler errors using built in library functions 2019/09/11 15:51:23 (permalink)
    0
    I see that now... and looking at the correct manual there are no built-in delay functions for the AVR XC8 compiler. Is there any other options than have to "roll" my own
    #7
    1and0
    Access is Denied
    • Total Posts : 9748
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: XC8 compiler errors using built in library functions 2019/09/11 16:02:50 (permalink)
    +1 (1)
    #define F_CPU 10000000UL
    #include <util/delay.h>
     
    and use the _delay_ms() there.
    #8
    ric
    Super Member
    • Total Posts : 23851
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: XC8 compiler errors using built in library functions 2019/09/11 16:14:05 (permalink)
    +1 (1)
    mike_sprauve@yahoo.com
    I see that now... and looking at the correct manual there are no built-in delay functions for the AVR XC8 compiler. Is there any other options than have to "roll" my own

    I guess you didn't read post#6

    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!
    #9
    mike_sprauve@yahoo.com
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2014/02/06 15:37:53
    • Location: 0
    • Status: offline
    Re: XC8 compiler errors using built in library functions 2019/09/11 16:27:11 (permalink)
    0
    Thanks everyone (especially Post #6) ...
    #10
    Jump to:
    © 2019 APG vNext Commercial Version 4.5