ARM Technical Support Knowledge Articles

WARNING 15 (MULTIPLE CALL TO SEGMENT)

Applies to: BL51 Code-banking Linker/Locator

Answer


Information in this article applies to:


SYMPTOMS

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?

CAUSE

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

RESOLUTION

There are several ways to solve this problem.

Method 1

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.

Method 2

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.

Method 3

If the function could be called while it is executing then things become slightly more complex. You may:

  1. Disable interrupts whenever the function is called from main code. You may use #pragma disable with the function that is called. You must also use the OVERLAY directive to remove the function from overlay analysis.
  2. Make two copies of the function. One for main code and one for ISR code.
  3. Make the function reentrant. For example:
    void myfunc(void) reentrant {
     ...
    }
    

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

Article last edited on: 2009-01-12 06:21:40

Rate this article

[Bad]
|
|
[Good]
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