ARM Technical Support Knowledge Articles

ERROR L107 (ADDRESS SPACE OVERFLOW) FOR ?STACK

Applies to: BL51 Code-banking Linker/Locator

Answer


Information in this article applies to:


SYMPTOMS

I've created a program that has an absolute IDATA variable located at 0xFE in internal memory.

idata unsigned int xxx _at_ 0xFE;

void main (void)
{
xxx = 1234;
while (1);
}

My program compiles OK, but when I link it, I receive the following linker error messages:

*** ERROR L107: ADDRESS SPACE OVERFLOW
    SPACE:   IDATA
    SEGMENT: ?STACK
    LENGTH:  0001H

*** ERROR L107: ADDRESS SPACE OVERFLOW
    SPACE:   IDATA
    SEGMENT: ?STACK
    LENGTH:  0001H

*** ERROR L119: REFERENCE MADE TO ERRONEOUS SEGMENT
    SEGMENT: ?C_C51STARTUP
    MODULE:  C:KEILC51LIBC51S.LIB (?C_STARTUP)
    ADDRESS: 000BH

What's wrong with my program?

CAUSE

By default, the linker locates IDATA segments starting with the segments other than the ?STACK segment. When you declare IDATA variables, you typically want them to be located in memory at lower addresses than the stack (since the stack grows up). The linker tries to locate IDATA segments this way for you.

Since your IDATA variable (xxx) is located at 0xFE-0xFF, the is no space after it for the stack and the linker emits the errors you received. This is shown in the map file:

            TYPE    BASE      LENGTH    RELOCATION   SEGMENT NAME
            -----------------------------------------------------

            * * * * * * *   D A T A   M E M O R Y   * * * * * * *
            REG     0000H     0008H     ABSOLUTE     "REG BANK 0"
                    0008H     00F6H                  *** GAP ***
            IDATA   00FEH     0002H     ABSOLUTE

Note that there is no stack located in the IDATA memory area.

RESOLUTION

To solve this problem, you must manualy specify the order in which the IDATA segments (like ?STACK) are located. In you example, you may specify the ?STACK segment in the IDATA linker command. For example:

BL51 test.obj IDATA(?STACK)

This instructs the linker allocate memory for the IDATA segments starting with the ?STACK segment. If you have other IDATA segments that should be located before ?STACK, you may specify them as follows:

BL51 test.obj IDATA(?ID?VAR1,?ID?VAR2,?STACK)

The following map file shows the result of this linker directive:

            TYPE    BASE      LENGTH    RELOCATION   SEGMENT NAME
            -----------------------------------------------------

            * * * * * * *   D A T A   M E M O R Y   * * * * * * *
            REG     0000H     0008H     ABSOLUTE     "REG BANK 0"
            IDATA   0008H     0001H     UNIT         ?STACK
                    0009H     00F5H                  *** GAP ***
            IDATA   00FEH     0002H     ABSOLUTE

Note that the ?STACK directive is located in the first available space in the IDATA memory and that the xxx variable (which is an absolute segment) is located at 0xFE.

MORE INFORMATION

SEE ALSO

Article last edited on: 2005-07-19 15:32:08

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