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

Interrupt VS Non Interrupt Overlaying....

An older post, in the knowledge base describes that variable corruption can occur if local variables in an interrupt are overlayed with non interrupt or lower priority local variables.

http://www.keil.com/support/docs/658.htm

I am using C51.exe V7.06.
BL51.exe V5.03

This post does not state my version of compiler as having this issue, but it sounds like a generic problem.

I can't use the first 3 options because of the complexity of my code, but I am unclear about the last point

"Make sure the memory usage of your interrupts is not greater than the registerbank it's using when it "fires"."

I am not using register banking for any interrupt and I believe I only have then 8 bytes of register bank 0 to use for back up when an interrupt fires.

Does that mean if my interrupt fires and uses more than 8 bytes in common with another level interrupt I could have variable corruption.

Parents
  • I think this point is saying merely that if your interrupt uses only registers, then it won't use any data space for local / temporary values. Thus, it won't overlay that storage with another routine's locals, and thus there is no possibility of corrupting data. The other three points are other ways of making sure that your interrupt locals aren't overlaid with another routine's locals.

    Every interrupt handler is the root of its own overlay call tree. This should keep you safe for the most part. I was under the impression that this is automatic with C51 7.0. This note may be out of date. (Or, I may be living in a fool's paradise!)

    The problem that usually arises is when an interrupt handler wants to call a routine that is shared with another interrupt, or with the main code. This usage requires that routine to be reentrant (either "naturally" so, or because you declare it reentrant and force it to use the software stack rather than overlay mechanism for local storage).

Reply
  • I think this point is saying merely that if your interrupt uses only registers, then it won't use any data space for local / temporary values. Thus, it won't overlay that storage with another routine's locals, and thus there is no possibility of corrupting data. The other three points are other ways of making sure that your interrupt locals aren't overlaid with another routine's locals.

    Every interrupt handler is the root of its own overlay call tree. This should keep you safe for the most part. I was under the impression that this is automatic with C51 7.0. This note may be out of date. (Or, I may be living in a fool's paradise!)

    The problem that usually arises is when an interrupt handler wants to call a routine that is shared with another interrupt, or with the main code. This usage requires that routine to be reentrant (either "naturally" so, or because you declare it reentrant and force it to use the software stack rather than overlay mechanism for local storage).

Children