Keil Logo

C166: CONSTANTS IN SPECIFIC MEMORY AREAS


Information in this article applies to:

  • C166 Version 4.24 or higher

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:

  • For far space use fstrxxx and fmemxxx functions.
  • For huge space use hstrxxx and hmemxxx functions.
  • For xhuge space use xstrxxx and xmemxxx functions.

SEE ALSO

Last Reviewed: Saturday, April 24, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.