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

声明:

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

2、请勿用于商业用途。

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

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

RET_XSTK Compiler Directive

Abbreviation

RX

Arguments

None.

Default

None.

µVision

Options — C51 — Misc controls.

Description

The RET_XSTK directive instructs the compiler to use the xdata (Large 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_XSTK
   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_XBP
                                     ; SOURCE LINE # 5
0003 120000      E     LCALL   func2
                                     ; SOURCE LINE # 6
0006 020000      E     LJMP    ?C?RET_XBP
             ; 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_PSTK

Example
C51 SAMPLE.C RET_XSTK



RET_XSTK 编译器伪指令

缩写

RX

参数

None.

缺省

None.

µVision

Options — C51 — Misc controls.

描述

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

   1          #pragma RET_XSTK
   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_XBP
                                     ; SOURCE LINE # 5
0003 120000      E     LCALL   func2
                                     ; SOURCE LINE # 6
0006 020000      E     LJMP    ?C?RET_XBP
             ; FUNCTION func (END)

 注意

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

RET_PSTK

示例
C51 SAMPLE.C RET_XSTK



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值