ARM Technical Support Knowledge Articles


Applies to: C51 C Compiler


Information in this article applies to:


I have a code banking application that uses indirect function pointers. It appears that the linker does not add an entry to the interbank call table for my indirectly called function. My program appears as follows:

Code Bank 1:

typedef void (code* pback) (void);

void func2 (pback func);

static void return_here (void)  {

void func1 (void)  {
  func2 (return_here);

Code Bank 2:

typedef void (code * pback) (void);

void func2 (pback callback_func)  {
  callback_func ();

When calling callback_func () in func2 my code should jump to the return_here function. However, it doesn't. It appears that there is no entry in the interbank call table for return_here. How can I solve this problem?


The linker does not create an entry in the call tree for functions that indirectly call functions in other banks. If the call is not listed in the call tree, no entry is made in the interbank call table.

Check the Overlay Map of Module section in your linker map file (*.M51 or *.MAP) for functions called by func2 and you will find that return_here is not listed.

Indirect function references cannot be inferred by the linker for indirect function calls, so you must add them manually.


Use the OVERLAY linker directive to add a reference from the func2 function to the return_here function.

In uVision, under Project - Options for Target - Lx51 Misc - Overlay: enter func1 ~ return_here, func2 ! return_here.

This removes the reference from func1 to return_here (since return_here is not actually called from func1) and adds a reference from func2 to return_here (the function call that is made via the function pointer).

Re-link the application and the overlay map shows the correct function references.

  +--> ?PR?_FUNC2?BANK2


Another problem in your example is that the static attribute is applied to the return_here function. The linker cannot generate an interbank call table entry for non-public (static) functions (because there is no public address for a static function). Therefore, you must remove the static attribute for any function that is called from a different code bank.


The BL51 Linker V5.03 and LX51 Linker V3.54 issue a warning when the OVERLAY directive adds a call reference to a static function that requires a bank table entry.

If you use a previous version of the tools, make sure that indirectly called functions that are called from different banks are not declared with the static attribute.




Request the files attached to this knowledgebase article.

Article last edited on: 2005-07-15 10:11:13

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