The STRING directive specifies the memory type used for implicit strings. By default, implicit strings are located in code memory. For example:
void main (void) {
printf ("hello world\n");
}
in this example, the string "hello world" is located in code memory. The STRING directive changes the default location for implicitly located strings. This directive must be used carefully, since existing programs might use memory typed pointers to access strings. One good reason to consider changing the default location of implicit strings (to the xdata or far memory areas) to avoid using code banking. This directive is useful especially for extended 8051 devices like the Philips 80C51MX. | Option | Description |
|---|
| CODE | Implicit strings are located in code space. This is the default setting of the Cx51 Compiler. | | XDATA | Implicit strings are located in const xdata space. | | FAR | Implicit strings are located in const far space. |
Note - The XDATA and FAR options require that you use the OMF2 directive.
|