ARM Technical Support Knowledge Articles

WARNING 5 (CODE SPACE MEMORY OVERLAP)

Applies to: BL51 Code-banking Linker/Locator

Answer


Information in this article applies to:


SYMPTOMS

When linking your program, the linker responds the following warning:

WARNING L5: CODE SPACE MEMORY OVERLAP

CAUSE

This warning is caused by one or more code segments that overlap (reside at the same address). The warning message you receive should indicate the address range where the overlap occurred. The segments are typically absolute (interrupt service routines or buffers located at fixed addresses).

One common cause is two interrupt routines declared with the same interrupt vector. For example:

void ISR1 ( void ) interrupt 0
{
}

and

void ISR2 ( void ) interrupt 0
{
}

Note that the interrupt function names are different but the interrupt vectors are the same. This often happens when an interrupt routine is copied but the vector isn't changed.

RESOLUTION

Resolving this problem is usually very easy.

First, check the linker MAP file for the Code Memory Link Map.

LINK MAP OF MODULE:  test (MAIN)

            TYPE    BASE      LENGTH    RELOCATION   SEGMENT NAME
            -----------------------------------------------------
.
.
.
            * * * * * * *   C O D E   M E M O R Y   * * * * * * *
            CODE    0000H     0003H     ABSOLUTE
            CODE    0003H     000CH     UNIT         ?C_C51STARTUP
            CODE    000FH     0001H     UNIT         ?PR?MAIN?MAIN
            CODE    0010H     0014H     ABSOLUTE
* OVERLAP * CODE    001BH     0003H     ABSOLUTE
            CODE    0024H     0001H     UNIT         ?PR?ISR?MAIN

From here, you can locate all of the overlapping segments. Simply search for OVERLAP in the link map section of the map file. In this case, it appears an absolute segment from 10h-23h (14h bytes long) and another absolute segment from 1Bh-1Dh (3h bytes long) are overlapping each other.

An absolute segment 3 bytes long starting at address 0000h is the reset vector. Absolute segments 3 bytes long starting at address 0003h, 000Bh, 0013h, 001Bh, and so on are interrupt vectors. These point to the interrupt function (usually written in C). In this case, the absolute segment at address 001Bh is the interrupt vector for interrupt 3.

Next, determine where the absolute address comes from by checking the symbol table (from the linker MAP file). For example:

SYMBOL TABLE OF MODULE:  test (MAIN)

  VALUE           TYPE          NAME
  ----------------------------------
  -------         MODULE        MAIN
  C:0000H         SYMBOL        _ICE_DUMMY_
  C:000FH         PUBLIC        main
  C:0010H         PUBLIC        buf
  C:0024H         PUBLIC        ISR
  -------         PROC          MAIN
  C:000FH         LINE#         3
  C:000FH         LINE#         4
  C:000FH         LINE#         5
  -------         ENDPROC       MAIN

Here you can see that 0010h is buf from the MAIN module (main.c) and 0024h is ISR. If you take a look in the MAIN source file you'll see the problem:

int code buf[10] _at_ 0x10;

void main (void)
{
}


void ISR (void) interrupt 3
{
}

In this case, buf is stored at address 0x10-0x23 and the ISR vector is at address 0x1B-0x1D. And, this is the overlapping memory.

MORE INFORMATION

SEE ALSO

Article last edited on: 2005-07-19 15:23:21

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