• AVR Freaks

Hot!"inline" not working when nesting functions PIC32MK1024MCF

Author
MPaulHolmes
Junior Member
  • Total Posts : 98
  • Reward points : 0
  • Joined: 2009/10/31 10:52:40
  • Location: 0
  • Status: offline
2020/11/29 06:10:02 (permalink)
0

"inline" not working when nesting functions PIC32MK1024MCF

I have a time sensitive ISR, and I noticed that if I have an inline function that runs in the ISR, everything is fine.  There is no penalty for calling the function.  But if I have an inline function within an inline function, the deepest inline function has a very large time penalty for calling it as if it is not an inline function.  Is there a way to solve this problem?  
#1

2 Replies Related Threads

    crosland
    Super Member
    • Total Posts : 2143
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Warks, UK
    • Status: offline
    Re: "inline" not working when nesting functions PIC32MK1024MCF 2020/11/29 06:48:27 (permalink)
    4.5 (2)
    The compiler is free to ignore inlining suggestions (that's all they are) for whatever reason it sees fit. I would imaging the gnu compiler knows what it is doing.
     
    Have you examined the resulting assembly code to see what is happening? Inlining doesn't mean the compiler will not have to generate code to stack registers that it needs to use for the new inline function.
    #2
    Mysil
    Super Member
    • Total Posts : 4065
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: "inline" not working when nesting functions PIC32MK1024MCF 2020/11/29 08:01:45 (permalink)
    3.5 (2)
    Hi,
    You say 'time sensitive ISR'
    Is the code in the deepest function called within ISR, something that only need to happen occasionally?
     
    You could divide the interrupt handling into two interrupt handlers,
    and trigger the handling of rare events as a software interrupt, only when needed.
     
    Higher, same or lower priority settings may have different effects.
     
        Mysil
    #3
    Jump to:
    © 2021 APG vNext Commercial Version 4.5