|
|||||||||||
|
Technical Support Support Resources
Product Information |
C51: Bank Table Entries for Indirectly Called FunctionsInformation in this article applies to:
SYMPTOMSI 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:
Code Bank 2:
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? CAUSEThe 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. RESOLUTIONUse the OVERLAY linker directive to add a reference from the func2 function to the return_here function. In µVision, 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.
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. STATUSThe 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. MORE INFORMATION
SEE ALSO
Last Reviewed: Thursday, February 25, 2021 | ||||||||||
|
|||||||||||
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.