|
|||||||||||
Technical Support Support Resources
Product Information |
C51: Indirect Function Calls with Code BankingInformation in this article applies to:
QUESTIONI 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. ANSWERThere 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. Example: Module in Common Area:
Module in Code Bank:
By using the NOINDIRECTCALL linker directive, the intrabank table entries for funca and funcb are avoided. 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.