IAR自带帮助文档compiler reference细读

<一>:extended keyword

 (1) : type attributes

You can either place the type attributes directly in your source code, or use the pragma directive #pragma type_attribute.

这句话的意思是当你想为段源代码指定type attributes,要么直接指示,要么通过#pragma type_attribute指示

 

Type attributes can be further divided into memory attributes and general type attributes.

类型属性可进一步分为存储器属性和通用类型属性

 

Memory attributes(存储器属性)

     1: Available function memory attributes: __banked_func, __far_func, and __near_func

         有效的函数存储属性:__banked_func, __far_func, and __near_func

     2: Available data memory attributes (有效的数据存储属性):__bdata, __bit, __code, __data, __far, __far_code, __far_rom, __generic,

        __huge, __huge_code, __huge_rom, __idata, __ixdata, __pdata, __sfr, __xdata, and __xdata_rom.

    以上两种属性的使用说明:Data objects, functions, and destinations of pointers or C++ references always have a memory attribute. If no

                         attribute is explicitly specified in the declaration or by the pragma directive #pragma type_attribute, an  

                         appropriate default attribute is used. You can only specify one memory attribute for each level of pointer 

                         indirection.

 

General type attributes (通用类型属性)

     1: Function type attributes (函数类型属性控制函数怎么样被调用)

          __data_overlay, __ext_stack_reentrant, __idata_overlay,

         __idata_reentrant, __interrupt, __monitor, __pdata_reentrant, __task, and __xdata_reentrant

     2: Data type attributes:(数据类型属性)

        const and volatile

   使用实例

       __data int i, j;
       int __data k, l;

        Note that the attribute affects both identifiers.

        The following declaration of i and j is equivalent with the previous one:

         #pragma type_attribute=__data
         int i, j;
    函数指针定义

To declare a function pointer, use the following syntax:

         int (__far_func * fp) (double);
After this declaration, the function pointer fp points to farfunc memory.

An easier way of specifying storage is to use type definitions:

        typedef __far_func void FUNC_TYPE(int);
        typedef FUNC_TYPE *FUNC_PTR_TYPE;
        FUNC_TYPE func();
         FUNC_PTR_TYPE funcptr;
 (2): object attributes
     作用:Object attributes affect the internal functionality of functions and data objects, but not how the function is called or how   
          the data is accessed. This means that an object attribute does not need to be present in the declaration of an object.

     类型:

        a:  Object attributes that can be used for variables: __no_init

        b:  Object attributes that can be used for functions and variables: location, @, and __root

        c:  Object attributes that can be used for functions: __intrinsic, __noreturn, and vector.

 

<三> intrinsic funcition 内部函数

          函数名                                         描述

         __disable_interrupt                  Disable interrupts

        __enable_interrupt                    Enables interrupts

        __get_interrupt_state                 Returns the interrupt state

        __no_operation                            Inserts a NOP instruction

        __parity                                            Indicates the parity of the argument

         __set_ interrupt_state                 Restores the interrupt state

         __tbac                                              Atomic read, modify, write instruction

 

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值