Keil Logo

C51: Setting the Location of the Reentrant Stack Pointer


Information in this article applies to:

  • C51 Version 5.50a and later

QUESTION

How can I set the address of the reentrant stack pointer? It is easy to set the size of the stack, but I can't figure out how to specify the location of the actual pointer.

ANSWER

You must modify the startup code as follows (to put the IDATA reentrant stack pointer at address 40h):

IF IBPSTACK <> 0
        DSEG    AT      0x40
?C_IBP:         DS      1
PUBLIC          ?C_IBP

                RSEG    ?C_C51STARTUP
                MOV     ?C_IBP,#LOW IBPSTACKTOP
ENDIF

Note that you may change DSEG at 40 to whatever address (in DATA space) you want the point to "live" at. Other reentrant stack pointers may be located similarly.

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.