ARM Technical Support Knowledge Articles

PUTTING TABLES IN HCONST

Applies to: C251 C Compiler

Answer

QUESTION

Help. I need to create a string table in HCONST in my 251 program. I need my program to run in X-Tiny memory model by default. How do I do that?

ANSWER

Creating a table of strings in HCONST is easy to do. The following code will help you get started:

const char far str1 [] = "This is string 1";
const char far str2 [] = "This is string 2";
const char far str3 [] = "This is string 3";

const char far * const far junk [] =
  {
  str1, str2, str3,
  };

In this example, the strings str1, str2, and str3 are stored in HCONST (the const char far does that). The array junk is an array of pointers to const char far things (str1, str2, and str3). To make junk live in HCONST, you must also put the const far in front of junk.

Article last edited on: 2004-05-20 20:20:18

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