你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

STM8S 头文件的 __near是什么意思

[复制链接]
瀏惺俣 提问时间:2017-6-27 21:39 /

#define __IO_REG8_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT)       \
                      __near __no_init volatile ATTRIBUTE union   \
                        {                                         \
                          unsigned char NAME;                     \
                          BIT_STRUCT NAME ## _bit;                \
                        } @ ADDRESS;

__near是什么意思求大神帮助   !
还有这 预定义替换 为什么动下都不行? 我随便改成别的,然后再改回原来一模一样的也没用,就提示我一大堆错误

求大神帮助   !
求大神帮助   !
求大神帮助   !
求大神帮助   !
求大神帮助   !

收藏 评论3 发布时间:2017-6-27 21:39

举报

3个回答
wdshuang09 回答时间:2017-6-28 08:06:23
__IO_REG8_BIT( SYS,             0xFFFFF802, __READ_WRITE )
#define __IO_REG8_BIT(NAME, ADDRESS, ATTRIBUTE)                 \
                      __near __no_init volatile ATTRIBUTE union \
                        {                                       \
                          unsigned char NAME;                   \
                          __BITS8 NAME ## _bit;                 \ // ## _bit ?? ## 可以连接前后
                                                                               //比如 NAME 是 a,这句就//是    __BITS8   a_bit;
                        } @ ADDRESS;
typedef struct
{
    unsigned char no0:1;
    unsigned char no1:1;
    unsigned char no2:1;
    unsigned char no3:1;
    unsigned char no4:1;
    unsigned char no5:1;
    unsigned char no6:1;
    unsigned char no7:1;
} __BITS8;
__near
Syntax Follows the generic syntax rules for memory type attributes that can be used on data
objects, see Type attributes, page 193.
Description The __near memory attribute overrides the default storage of variables given by the
selected data model and places individual variables and constants in near memory. You
can also use the __near attribute to create a pointer explicitly pointing to an object
located in the near memory.
Storage information Address range: 0x0-07FFF and 0xFFFF8000-0xFFFFFFFF (64 Kbytes)
Example __near int x;
See also Memory types, page 13.
__no_init
Syntax Follows the generic syntax rules for object attributes, see Object attributes, page 195.
Description Use the __no_init keyword to place a data object in non-volatile memory. This means
that the initialization of the variable, for example at system startup, is suppressed.
Example __no_init int myarray[10];
#define PRERR             SYS_bit.no0
以下转自http://renesasrulz.spaces.eepw.com.cn/articles/article/item/69883
SInzo 回答时间:2017-6-28 09:41:31
__near  会把宣告变量放在0x0-07FFF和0xFFFF8000-0xFFFFFFFF这两个靠近头尾的内存范围。

而__no_init会把变量放在非易失性存储器比如eeprom中,将其作为已初始化的变量来存储。
wdshuang09 回答时间:2017-6-28 12:29:18
SInzo 发表于 2017-6-28 09:41
__near  会把宣告变量放在0x0-07FFF和0xFFFF8000-0xFFFFFFFF这两个靠近头尾的内存范围。

而__no_init会把 ...

楼上说的对,就是这个意思
关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
微信公众号二维码 微信公众号
手机版二维码 手机版