How to place a variable at a given absolute address in memory (with GCC)

后端 未结 5 1796
野的像风
野的像风 2020-11-29 08:28

The RealView ARM C Compiler supports placing a variable at a given memory address using the variable attribute at(address):

int var __attribute_         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-29 08:39

    You answered your question, In your link above it states:

    With the GNU GCC Compiler you may use only pointer definitions to access absolute memory locations. For example:

    #define IOPIN0         (*((volatile unsigned long *) 0xE0028000))
    IOPIN0 = 0x4;
    

    Btw http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Variable-Attributes.html#Variable%20Attributes

提交回复
热议问题