• AVR Freaks

Lockederror: recursive function call...

Author
ilkintacan
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2003/11/07 12:52:27
  • Status: offline
2014/07/11 04:20:41 (permalink)
0

error: recursive function call...

Hi,
 
I was compile my project with C18 compiler but now I've migrated to XC8 and compiler giving an error that "error: recursive function call...".
I've implemented my function like recursive, so no problem, I am handling recursive necessities, I just want to disable this error to allow compiling.
 
Please help.
#1

8 Replies Related Threads

    ric
    Super Member
    • Total Posts : 24582
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: error: recursive function call... 2014/07/11 04:29:09 (permalink)
    +1 (1)
    What do you mean "I've implemented my function like recursive, so no problem" ?
    XC8 does NOT allow recursive function calls.

    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!
    #2
    NorthGuy
    Super Member
    • Total Posts : 5805
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: error: recursive function call... 2014/07/11 07:02:07 (permalink)
    +2 (2)
    You always can re-write a recursive function without recursion, and it will be more efficient.
    #3
    pcbbc
    Super Member
    • Total Posts : 1381
    • Reward points : 0
    • Joined: 2014/03/27 07:04:41
    • Location: 0
    • Status: offline
    Re: error: recursive function call... 2014/07/11 07:31:35 (permalink)
    +1 (1)
    ricWhat do you mean "I've implemented my function like recursive, so no problem, I am handling recursive necessities" ?
    I assume the OP means they have ensured that their recursion always has an exit condition, etc.
     
     
    XC8 does NOT allow recursive function calls.
    Yep - Unfortunately what the OP doesn't realise is that the machine/compiler architecture does not support recursion because it lacks a user accessible stack.


    I would suggest rewriting as NorthGuy suggests.  If you really can not avoid it, you may need to implement your own software stack to hold your state within the function using an array.
    #4
    cobusve
    Super Member
    • Total Posts : 495
    • Reward points : 0
    • Joined: 2012/04/02 16:15:40
    • Location: Chandler
    • Status: offline
    Re: error: recursive function call... 2014/07/11 08:47:59 (permalink)
    +2 (2)
    XC8 now supports recursive function calls if you change the compiler configuration to use a software stack. The defauls uses a compiled stack which does not allow recursive calls.


    #5
    ilkintacan
    New Member
    • Total Posts : 21
    • Reward points : 0
    • Joined: 2003/11/07 12:52:27
    • Status: offline
    Re: error: recursive function call... 2014/07/15 00:45:13 (permalink)
    0
    could you please give me an example? I dont know how many times this function will be recalled again. It can be max 10 level depth.
    #6
    ilkintacan
    New Member
    • Total Posts : 21
    • Reward points : 0
    • Joined: 2003/11/07 12:52:27
    • Status: offline
    Re: error: recursive function call... 2014/07/15 00:49:22 (permalink)
    0
    Hi
    I am already doing this with an array max 10 level depth. "I am handling recursive necessities" mean this.
    I just want want to recall a function like C18! It is working with C18, so I've done my own implemantain for psedo-recursive...
     
    #7
    ilkintacan
    New Member
    • Total Posts : 21
    • Reward points : 0
    • Joined: 2003/11/07 12:52:27
    • Status: offline
    Re: error: recursive function call... 2014/07/15 00:51:55 (permalink)
    0
    could you please tell me where is this configuration? I couldnt find.
     
    #8
    pcbbc
    Super Member
    • Total Posts : 1381
    • Reward points : 0
    • Joined: 2014/03/27 07:04:41
    • Location: 0
    • Status: offline
    Re: error: recursive function call... 2014/07/15 01:03:03 (permalink)
    +2 (2)
    XC8 1.30 release notes
    Function specified reentrant/software

    One might assume:
    int reentrant MyFunction(...)
    {
    }


    Or:
    int software MyFunction(...)
    {
    }


    But I haven't used this feature so I can not be sure.
    #9
    Jump to:
    © 2019 APG vNext Commercial Version 4.5