how to set fixed address for variables/functions  at compiling stage in ADS?

Note: This was originally posted on 18th September 2009 at http://forums.arm.com

in ads 1.2, I set fixed address for a variable like this:

int    file_len  __attribute__((_at_(0x16000))) = 0;  

but compile error, how can i do?

thank you very much!
Parents
  • Note: This was originally posted on 18th September 2009 at http://forums.arm.com

    You can do this directly using linker tricks, but it's not really designed for placement of individual variables.

    If you really need this, I'd suggested storing a pointer to the location rather than the value itself:

    static int * const pFileLen = (int *)(0x00016000);

    /* Store value. */
    *pFileLen = uiMyValue;

    /* Get value. */
    uiMyValue = *pFileLen;
Reply
  • Note: This was originally posted on 18th September 2009 at http://forums.arm.com

    You can do this directly using linker tricks, but it's not really designed for placement of individual variables.

    If you really need this, I'd suggested storing a pointer to the location rather than the value itself:

    static int * const pFileLen = (int *)(0x00016000);

    /* Store value. */
    *pFileLen = uiMyValue;

    /* Get value. */
    uiMyValue = *pFileLen;
Children
No data
More questions in this forum