This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Warning:multiple call to a segment

Hi
i have written a ISR for external intr 0 and from this routine i am calling other functions.
On compiling above routines i am getting following warning

Warning:Multiple call to segment
Caller1:?PR?ex0_ISR?main
Caller2:?C_C51STARTUP

(where ex0 is the name of isr given in file)
there was same warning for each function which i had called from isr
Can anybody give me the reason for this ?
and solution ?

Parents
  • Naresh, it sounds like you need to learn a bit more about interrupts.
    It is your responsibility to preserve any hardware settings that are used by both your interrupt service, and your high level code.
    Remember that the interrupt service could happen at any time, regardless of what your high level code is doing.
    How are you going to use timer1 inside the service, without disrupting whatever the high level code is using it for? (You can read the timer, but if you write to it or any of its control bits, you could have a problem)
    Do you really need to have this code inside an interrupt service? Maybe you could just set a flag in the ISR, and poll this flag in high level code. I'm guessnig a bit here, not knowing what your actual objective is.

    The point that earlier posters are making is that functions are handled a little differently in Keil C, to fit into the restricted RAM & stack available. Functions are NOT re-entrant by default, so you must not call them from both ISR code and high level code. The extra code (& RAM) required to make a function re-entrant will more than offset the inefficiency of having two copies of the function.

Reply
  • Naresh, it sounds like you need to learn a bit more about interrupts.
    It is your responsibility to preserve any hardware settings that are used by both your interrupt service, and your high level code.
    Remember that the interrupt service could happen at any time, regardless of what your high level code is doing.
    How are you going to use timer1 inside the service, without disrupting whatever the high level code is using it for? (You can read the timer, but if you write to it or any of its control bits, you could have a problem)
    Do you really need to have this code inside an interrupt service? Maybe you could just set a flag in the ISR, and poll this flag in high level code. I'm guessnig a bit here, not knowing what your actual objective is.

    The point that earlier posters are making is that functions are handled a little differently in Keil C, to fit into the restricted RAM & stack available. Functions are NOT re-entrant by default, so you must not call them from both ISR code and high level code. The extra code (& RAM) required to make a function re-entrant will more than offset the inefficiency of having two copies of the function.

Children
No data