#pragma INTO_ROM: Put Next Variable Definition into ROM

Scope

Data Definition

Syntax
#pragma INTO_ROM 
Synonym

None

Arguments

None

Default

None

Description

This pragma forces the next (non-constant) variable definition to be const (together with the -Cc compiler option).

The pragma is active only for the next single variable definition. A following segment pragma (CONST_SEG, DATA_SEG, CODE_SEG) disables the pragma.

Note: This pragma is only useful for the HIWARE object-file format (and not for ELF/DWARF).
Note: This pragma forces the Compiler to recognize a non-constant (means normal `variable') object as const. If the variable already is declared as `const' in the source, this pragma is not needed. This pragma was introduced to cheat the constant handling of the compiler, and shall not be used any longer. It is supported for legacy reasons only. Do not use in new code
Example

The following listing is an example using the INTO_ROM pragma.

Listing: Using the INTO_ROM Pragma
#pragma INTO_ROM
char *const B[] = {"hello", "world"};

#pragma INTO_ROM

int constVariable; /* put into ROM_VAR, .rodata */

int other; /* put into default segment */

#pragma INTO_ROM

#pragma DATA_SEG MySeg /* INTO_ROM overwritten! */

int other2; /* put into MySeg */
See also

-Cc: Allocate Const Objects into ROM compiler option