ARM Technical Support Knowledge Articles

ADDRESS SPACE OVERFLOW WITH FAR CONST

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

I need many constants in my project and for this reason I initialize them as follows (This is just and example, the real initialization is a lot more complex and longer):

const char far * text1[]= "Text1";
const char far * text2[]= "Text2";

However, it appears that these constants are still in the CODE space. During linkage I get the following error:

*** ERROR L107: ADDRESS SPACE OVERFLOW
    SPACE:   CODE
    SEGMENT: ?CO?MAIN

How can I put the constants into the 'const far' memory type?

ANSWER

There are two solutions to this problem. The STRING compiler directive locates strings into various memory classes. At the beginning of your source file, specify:

#pragma STRING (far)   // locate string constants into 'far const' memory

You may define the explicit memory type of the constants by using another variable as shown below:

const char far       text1a[]= "Text1";
const char far       text2a[]= "Text2";
const char far * far text1[]= text1a;
const char far * far text2[]= text2a;

You may also look to the example ConstFar in the folder Keilc51ExamplesFarMemory1MB Constants on Classic 8051. This shows you some techniques that might be useful for you.

MORE INFORMATION

SEE ALSO

Article last edited on: 2005-07-15 09:53:35

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