This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

is rf irq for PRX reentrant?

Hi, Can the RF irq be triggered while it's already executing? I'm having a strange problem that may be explained by this. Best, Mahesh

Parents
  • Hi Mahesh,

     

    Since the 8051 has limited memory, the stack is not re-entrant.

    It may be that you have issues wrt. memory overlay.

    This means that if you enter function_1(), the auto-variables in this scope will always have the same address area.

     

    This is a problem when you introduce interrupts. If function_1() is called from main and interrupt context, you may get into a scenario where you are in the same scope in main and the interrupt, thus corrupting (read: overwriting) your scope variable.

     

    To fix this, you have to set "Memory overlay" specific linker options to tell the linker not to place the segments in the same area. I am attaching a picture that shows where to set this.

     

    When warning #15 is not suppressed, the linker will give you warnings about segments that are called from interrupt and main thread. You then add this to the linker Overlay section:

    function_1 ! *,

    function_2 ! *,

    function_3 ! *

     

    Best regards,

    Kenneth

    keil_c51_overlay.png

Reply
  • Hi Mahesh,

     

    Since the 8051 has limited memory, the stack is not re-entrant.

    It may be that you have issues wrt. memory overlay.

    This means that if you enter function_1(), the auto-variables in this scope will always have the same address area.

     

    This is a problem when you introduce interrupts. If function_1() is called from main and interrupt context, you may get into a scenario where you are in the same scope in main and the interrupt, thus corrupting (read: overwriting) your scope variable.

     

    To fix this, you have to set "Memory overlay" specific linker options to tell the linker not to place the segments in the same area. I am attaching a picture that shows where to set this.

     

    When warning #15 is not suppressed, the linker will give you warnings about segments that are called from interrupt and main thread. You then add this to the linker Overlay section:

    function_1 ! *,

    function_2 ! *,

    function_3 ! *

     

    Best regards,

    Kenneth

    keil_c51_overlay.png

Children
No Data
Related