C1131: Illegal use of global variable address modifier

[ERROR]

Description

The global variable address modifier was used for another object than a global variable.

Example
  int glob @0xf90b;  // ok, the global variable "glob" is 
  at 0xf90b

  
  int *globp @0xf80b = &glob; // ok, the global 
  variable

  
                              // "globp" is at 0xf80b and

  
                              // points to "glob"

  
  void g() @0x40c0;  // error (the object is a function)

  
  void f() {

  
    int i @0x40cc; // error (the object is a local variable)

  
  }

  
Tips

Global variable address modifiers can only be used for global variables. They cannot be used for functions or local variables. Global variable address modifiers are a not ANSI standard. So the option -Ansi has to be disabled. To Put a function at a fixed address, use a pragma CODE_SEG to specify a segment for a function. Then map the function in the prm file with the linker. To call a function at a absolute address use a cast:

  #define f ((void (*) (void)) 0x100)

  
  void main(void) {

  
   f();

  
  }