ARM Technical Support Knowledge Articles

CONSTANTS IN SPECIFIC MEMORY AREAS

Applies to: C166 C Compiler

Answer


Information in this article applies to:


QUESTION

I have a large pointer array for text constants. Here is a simplified example:

const unsigned char *text[]= { "text1", "text2", "text3", };

However, this text is allocated in NCONST (near) memory. I would like to have this text in other ROM spaces, for example in HCONST (huge), since there is no more space in my NCONST space. How may I achieve that?

ANSWER

Just specify the correct memory type in your definition. For example:

unsigned char const huge *text[]= { "text1", "text2", "text3", };  // for HCONST
unsigned char const far *text[]= { "text1", "text2", "text3", };   // for FCONST

Note that this works only if you are using C166 Version 4.24 or higher.

To access such variables you can use the following functions:

SEE ALSO

Article last edited on: 2004-04-24 12:33:51

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