在Z-Stack代码中使用常量(Using Constants in Code with Z-stack)

DN200 Using Constants in Code with Z-stack

The data model used for all Z-Stack projects, by default, copies constants into XDATA (RAM) during initialization. This reduces the amount of RAM that is available for application purposes. For most applications, this does not present a problem. Most constants used in Z-Stack are located in XDATA and should not be changed by the user. Constants are placed in XDATA by omitting any data space declaration or by using the keyword __xdata. NOTE: TI only recommends the solutions outlined in this document if it is not possible to locate all necessary constants in XDATA. When a project uses pointer types that differ from the default type, the user can expect a loss in performance. All constants that a project uses will be located in the NEAR_CODE segment by the linker. Therefore, it is possible to run into a situation where a small or medium size project (i.e. 100k of code) will fail to link because there is not enough space in the NEAR_CODE segment. The developer should take this into account and avoid using too many constants.


在Z-Stack代码中使用常量

所有Z-Stack项目使用的数据模型,在默认情况下会在初始化期间将常量复制到XDATA(RAM)。出于应用目的,这减少了RAM的使用量。对于大多数应用,这不会产生什么问题。Z-Stack中大多数被使用的常量位于XDATA,不允许用户改变这些常量。通过省略任何数据空间声明或使用关键字__ xdata,常量被放置在XDATA空间。

注意:如果不可能将所有必要的常量放置在XDATA中,TI只将本文档中介绍的方案作为一种建议。当一个项目使用不同于默认类型的指针类型,将会导致性能上的损失。所有项目使用的常量,将由连接器放置于NEAR_CODE段。因此,有可能一个小型或中型规模的工程(即100K代码)将无法连接,因为NEAR_CODE段没有足够的空间。码农们应该考虑到这一点,并避免使用太多常数。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值