ARM Technical Support Knowledge Articles

WARNING L13 (RECURSIVE CALL TO SEGMENT) WITH CONSTANTS

Applies to: BL51 Code-banking Linker/Locator

Answer


Information in this article applies to:


SYMPTOMS

The following program example:

#pragma code symbols debug oe

void func1 (unsigned char *msg) {
  ;
}

void func2 (void) {
  unsigned char uc;
  func1("xxxxxxxxxxxxxxx");
}

code void (*func_array[])() = { func2 };

void main( void ) {
  (*func_array[0])();
}

when compiled and linked using the following command lines:

C51 EXAMPLE1.C
BL51 EXAMPLE1.OBJ IX

causes the following linker warning:

*** WARNING 13: RECURSIVE CALL TO SEGMENT
SEGMENT: ?CO?EXAMPLE1
CALLER: ?PR?FUNC2?EXAMPLE1

What

CAUSE

In this program example, func2 defines a constant string ("xxx...xxx") which is located in the constant code segment ?CO?EXAMPLE1. The definition:

code void (*func_array[])() = { func2 };

generates a reference between segment ?CO?EXAMPLE1 (where the code table is located) and the executable code segment ?PR?FUNC2?EXAMPLE1. Since func2 also refers to segment ?CO?EXAMPLE1, BL51 assumes that there is a recursive call.

RESOLUTION

To avoid this problem, you must manually remove the reference between func2 and the ?CO?EXAMPLE1 segment. The following overlay directive does that:

bl51 EXAMPLE1.OBJ IX OVERLAY (?CO?EXAMPLE1 ~ FUNC2, MAIN ! FUNC2)

?CO?EXAMPLE1 ~ FUNC2 deletes the implied call reference between func2 and the code constant segment in the example. Then, MAIN ! FUNC2 adds a reference between MAIN and FUNC2. This is required because main calls func2 indirectly. Note that automatic overlay analysis does not allow for references made to functions via pointers. References of this type must be manually implemented, as in the example above.

MORE INFORMATION

SEE ALSO

Article last edited on: 2012-09-10 13:15:33

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