#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 subsequent segment pragma (CONST_SEG, DATA_SEG, CODE_SEG) disables the pragma.

Note: This pragma is only useful for the HIWARE object-file format (but not for ELF/DWARF).
Note: This pragma is to force a non-constant (meaning a normal `variable') object to be recognized as `const' by the compiler. 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.
Example

The following listing presents some examples which use 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