|
|||||||||||
Technical Support Support Resources
Product Information |
BL51: Warning 15 (Multiple Call To Segment)Information in this article applies to:
SYMPTOMSI have added an Interrupt Service Routine (ISR) to my project and I am now getting the following warnings:
What does it mean and how do I solve the problem? CAUSEWarning 15 indicates that the linker has found a function that may be called from both main code and an ISR (or functions called by an ISR) or from multiple ISRs at the same time. One problem is that the function is not reentrant and it may get invoked (by an ISR) while the function is already executing. The result will be variable and probably involve some form of argument corruption. Another problem is that memory used for local variables and arguments may be overlaid with the memory of other functions. If the function is invoked by an interrupt, that memory will be used. This may cause memory corruption of other functions. For example, for your first warning 15 the WRITE_GMVLX1_REG function is being called from multiple roots. This function is defined in the file D_GMVLX1.C or D_GMVLX1.A51. It is called from both an ISR (or a function called by an ISR) and the function VSYNC_INTERRUPT in MAIN.C RESOLUTIONThere are several ways to solve this problem. Method 1If you are certain that the function is not executed in a reentrant fashion and that there is no physical memory used by the function (only registers are used), then you may simply choose to ignore this warning. If arguments are passed in registers and if the function uses only registers during its execution, the function may be reentrant. However, you must be very careful that changes to compiler or to the compiler settings do not change this. Method 2If there is physical memory used by the function, you should use the linker OVERLAY directive to remove the function from overlay analysis. For example:
This prevents memory used by this function from being overlaid. If this function calls other functions that are also used elsewhere in your program, you may need to exclude those functions from overlay analysis as well. This overlay command makes the linker happy and removes the Warning 15 for this function. The function is not reentrant. However, it may be called from multiple threads without corrupting other function memory. Nonetheless, you must ensure that the function is not called simultaneously by multiple threads. Method 3If the function could be called while it is executing then things become slightly more complex. You may:
This results in a reentrant stack being used to store arguments and local variables. With this method the reentrant stack must be configured in the STARTUP.A51 file. This consumes more RAM and slows down execution of the reentrant function. 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.