ARM Technical Support Knowledge Articles

FUNCTION POINTERS IN CONTIGUOUS MODE

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

I am using the following code with a Dallas 390 target in Contiguous Mode (program size up to 16MB). However, function pointers that are defined with the code attribute fail.

The following program does not work:

typedef void (code *FUNCT_PTR_V_V)(void);
unsigned char IntSrc0;
static void function_0(void){ IntSrc0=0x00; }
static void function_1(void){ IntSrc0=0x01; }

const  FUNCT_PTR_V_V code function_table2[2] ={ function_0, function_1 };

void main(void){
  function_table2[0]();   // function pointer is loaded with invalid value
  while(1);
}

Why do I have this problem?

ANSWER

When working in the Contiguous Mode you must use generic pointers as function pointers. Only generic pointers store the complete address information which is required. So you need to define the function pointer as shown below:

typedef void (*FUNCT_PTR_V_V)(void);

SEE ALSO

Article last edited on: 2007-01-16 12:07:44

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential