ARM Technical Support Knowledge Articles


Applies to: C51 C Compiler


Information in this article applies to:


I do an indirect call through a table of function pointers from bank 0 to a function in the same bank. The compiler generates a call to ?C?ICALL which is in the common area. The linker then seems to assume that the call must go through the bank switch jump table since we are now jumping from common to bank 0. My table of function pointers is located in the same bank as the calling and called functions.

Is there any way (other than modifying my source) of telling the linker that these calls can be made directly without going through the jump table?

I don't mind the speed hit, but I can't afford the 6-byte overhead in the common area on each function.


There is a simple way to avoid this kind of cross call in C51 V5.50 and later. The linker offers a directive called NOINDIRECTCALL. By default, the linker inserts inter-bank CALLs for indirectly called functions in code banking applications. If your application uses multiple pointers to functions and if you can ensure that these indirect calls never cross a code bank you may use the NOINDIRECTCALL (NOIC) linker directive.

Note that the NOINDIRECTCALL only works for function tables and not for function pointer references within a function.


Module in Common Area:

extern void id_call (void (* f) ());
extern void funca (void);
extern void funcb (void);
extern void funcc (void);

void (*f[])(void) = { func2a, func2b };

void test (void)  {
  id_call (f[0]);
  id_call (f[1]);

// The following always generates an inter-bank table entry
  id_call (func2c);

Module in Code Bank:

void funca ()  {

void funcb ()  {

void funcc ()  {

void id_call (void (* f) ())  {
  f ();

By using the NOINDIRECTCALL linker directive, the intrabank table entries for funca and funcb are avoided.



Article last edited on: 2005-07-15 12:53:48

Rate this article

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