BL51: WARNING 15 (MULTIPLE CALL TO SEGMENT)
Information in this article applies to:
I have added an Interrupt Service Routine (ISR) to my project and I am now getting the following warnings:
***WARNING L15: MULTIPLE CALL TO SEGMENT SEGMENT: ?PR?_WRITE_GMVLX1_REG?D_GMVLX1 CALLER1: ?PR?VSYNC_INTERRUPT?MAIN CALLER2: ?C_C51STARTUP ***WARNING L15: MULTIPLE CALL TO SEGMENT SEGMENT: ?PR?_SPI_SEND_WORD?D_SPI CALLER1: ?PR?VSYNC_INTERRUPT?MAIN CALLER2: ?C_C51STARTUP ***WARNING L15: MULTIPLE CALL TO SEGMENT SEGMENT: ?PR?SPI_RECEIVE_WORD?D_SPI CALLER1: ?PR?VSYNC_INTERRUPT?MAIN CALLER2: ?C_C51STARTUP
What does it mean and how do I solve the problem?
Warning 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
There are several ways to solve this problem.
If 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.
If there is physical memory used by the function, you should use the linker OVERLAY directive to remove the function from overlay analysis. For example:
OVERLAY (?PR?_WRITE_GMVLX1_REG?D_GMVLX1 ! *)
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.
If 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.
The following Discussion Forum threads may provide information related to this topic.
Last Reviewed: Monday, January 12, 2009
of your data.