Keil™, An ARM® Company

Technical Support

C166: GENERATING A CALL TO AN ABSOLUTE MEMORY LOCATION


Information in this article applies to:

  • C166 Version 4.20

QUESTION

I need to call a routine at address 0x100000. Is there a way to do this in C?

ANSWER

Yes. The following statement generates call to a function at address 0x100000.

((void (far *) (void)) 0x100000) ();

The function called is a far function and must return with a RETS instruction. In the SMALL and COMPACT memory models, you must declare this function as a far function. For example:

void far func (void)  {
  // your code goes here
}

SEE ALSO

Last Reviewed: Tuesday, June 26, 2007


Did this article provide the answer you needed?
 
Yes
No
Not Sure