CX51 用户手册----RET_PSTK伪指令

声明:

1、本翻译仅供个人学习使用,本人没有提供技术支持的义务,也不承担由此引发的任何后果。

2、请勿用于商业用途。

3、英文来自:http://www.keil.com/support/man/docs/c51/。

4、欢迎大家共同与我交流探讨(290207203@qq.com)。

RET_PSTK Compiler Directive

Abbreviation

RP

Arguments

None.

Default

None.

µVision

Options — C51 — Misc controls.

Description

The RET_PSTK directive instructs the compiler to use the pdata (Compact Model) reentrant stack for return addresses. Normally, return addresses are stored on the 8051's hardware stack. When this directive is specified the compiler generates code that pops the return address from the hardware stack and stores it on the reentrant stack. For example:

   1          #pragma RET_PSTK
   2          extern void func2 (void);
   3
   4          void func (void)  {
   5   1        func2 ();
   6   1      }

ASSEMBLY LISTING OF GENERATED OBJECT CODE
             ; FUNCTION func (BEGIN)
0000 120000      E     LCALL   ?C?CALL_PBP
                                     ; SOURCE LINE # 5
0003 120000      E     LCALL   func2
                                     ; SOURCE LINE # 6
0006 020000      E     LJMP    ?C?RET_PBP
             ; FUNCTION func (END)

 Note

  • You may use this directive to unload return addresses from the on-chip or hardware stack. It may be selectively used on modules that contain the deepest stack nesting.
  • If you use this directive you must initialize the reentrant stack pointer defined in the startup code. Refer to STARTUP.A51 for more information on how to initialize the reentrant stacks.
See Also

RET_XSTK

Example
C51 SAMPLE.C RET_PSTK


RET_PSTK 编译器伪指令

缩写

RP

参数

无。

缺省

无。

µVision

Options — C51 — Misc controls.

描述

RET_PSTK 伪指令告诉编译器对返回地址使用 pdata (Compact模型) 重入栈。 一般情况下,返回地址保存在 8051的硬件栈中。当使用这个伪指令时,编译器生成的代码从硬件栈中弹出返回地址,并保存到重入栈中。例如: 

   1          #pragma RET_PSTK
   2          extern void func2 (void);
   3
   4          void func (void)  {
   5   1        func2 ();
   6   1      }

ASSEMBLY LISTING OF GENERATED OBJECT CODE
             ; FUNCTION func (BEGIN)
0000 120000      E     LCALL   ?C?CALL_PBP
                                     ; SOURCE LINE # 5
0003 120000      E     LCALL   func2
                                     ; SOURCE LINE # 6
0006 020000      E     LJMP    ?C?RET_PBP
             ; FUNCTION func (END)

 注意

  • 用户可以使用这个伪指令从片上或硬件栈卸载返回地址。包含深度栈嵌套的模块可以选择性的使用。
  • 如果用户使用这个伪指令,必须在启动代码中初始化重入栈指针。 关于如何初始化重入栈的更多信息,参考 STARTUP.A51 。
参考

RET_XSTK

示例
C51 SAMPLE.C RET_PSTK



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值