• AVR Freaks

Hot!Looping around allocGlobals()

Author
ProfessorChaos
New Member
  • Total Posts : 19
  • Reward points : 0
  • Joined: 2019/01/15 09:40:47
  • Location: 0
  • Status: offline
2019/06/19 13:09:25 (permalink)
0

Looping around allocGlobals()

Trying to port a C18 program to XC8 2.05 and getting this error when I try to build.
 
The code I'm working with does quite a lot of stuff in the interrupt handler (I know, I know!), so I am seeing a fair amount of (1510) advisory messages about function duplication by the compiler.
 
Any ideas about where to start looking? Or at least an explanation of what the error means?
#1

5 Replies Related Threads

    mbrowning
    Just a Member
    • Total Posts : 1432
    • Reward points : 0
    • Joined: 2005/03/16 14:32:56
    • Location: Melbourne, FL
    • Status: online
    Re: Looping around allocGlobals() 2019/06/19 13:52:00 (permalink)
    +1 (1)
    What error? An advisory message is just that. It's not an error. Just telling you what's happening.
     
    XC8 uses a compiled stack by default. It's not a real stack and makes functions non-reentrant. If you use a function both in interrupt and background code, and there's a possibility that the function might be interrupted and called in the interrupt, it must be duplicated so that it doesn't stomp on it's own variables in the compiled stack. XC8 does this automatically but tells you that it did it.
     
    There are options to prevent duplication if you know for sure this can't happen. You can also go to a software stack which makes functions reentrant, but there's a lot of overhead. The compiler manual discusses all this in detail.
     
    Best is don't call functions in interrupts. There's a lot of context saving overhead.
     

    Oh well - there's always next year
    #2
    ProfessorChaos
    New Member
    • Total Posts : 19
    • Reward points : 0
    • Joined: 2019/01/15 09:40:47
    • Location: 0
    • Status: offline
    Re: Looping around allocGlobals() 2019/06/19 13:54:10 (permalink)
    0
    This is what I get (after the 1510 advisory messages):
     
    make[2]: *** [dist/default/production/AMA911Axx_controller.X.production.hex] Error 1
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2
    Looping around allocGlobals()
    (908) exit status = 1
    BUILD FAILED (exit value 2, total time: 53s)
    post edited by ProfessorChaos - 2019/06/19 13:57:08
    #3
    du00000001
    Just Some Member
    • Total Posts : 2792
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Looping around allocGlobals() 2019/06/19 14:38:11 (permalink)
    +1 (1)
    @ the Chaos
    Look for a message differing from the (1510)!
    The (1510) doesn't cause the abort, a memory overflow resulting from function duplication would.

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #4
    mad_c
    Super Member
    • Total Posts : 1188
    • Reward points : 0
    • Joined: 2010/12/12 17:48:27
    • Location: Brisbane, Australia
    • Status: offline
    Re: Looping around allocGlobals() 2019/06/19 16:13:16 (permalink)
    +1 (1)
    ProfessorChaos
     
    Looping around allocGlobals()

     
    That's an internal error. I would create a support case and submit the project for review.
     
    Jeff.
    #5
    ProfessorChaos
    New Member
    • Total Posts : 19
    • Reward points : 0
    • Joined: 2019/01/15 09:40:47
    • Location: 0
    • Status: offline
    Re: Looping around allocGlobals() 2019/07/03 07:01:34 (permalink)
    +2 (2)
    Belated follow up on this. I haven't had time to submit a support case, but I did narrow down the problem further.
     
    Turns out there was a call to a function that had been removed from the project, but for some reason this was not reported at all during the build process - it would just churn for about 30-40 seconds and then terminate with the "Looping around allocGlobals" error.
     
    The function was prototyped as follows, which might be a clue:
    void Displayprintf(uchar cmd, const rom char *format, ...);
     
    If I changed that definition to:
    void Displayprintf(uchar cmd, const rom char *format, uint data);
    and built the project, I got the expected
    "error: (499) undefined symbol _Displayprintf"
     
    So, my guess is that linker has some difficulty recognizing a missing function when it uses a variable argument list.
     
    I will try to put together a small project that illustrates this and get it submitted next week.
    #6
    Jump to:
    © 2019 APG vNext Commercial Version 4.5