-Cc: Allocate Const Objects into ROM

Group

OUTPUT

Scope

Compilation Unit

Syntax
  -Cc 
  
Arguments

None

Default

None

Defines

None

Pragmas

#pragma INTO_ROM: Put Next Variable Definition into ROM

Description

The -Cc command line option puts const objects into the ROM_VAR segment, which the Linker parameter file assigns to a ROM section (refer Linker section in the Build Tool Utilities Reference Manual).

Note: Use this option only for HIWARE object-file formats. In the ELF/DWARF object-file format, the Compiler allocates constants into the .rodata section.

The Linker does not initialize objects allocated into a read-only section. The startup code does not have to copy the constant data.

You may also put variables into the ROM_VAR segment by using the segment pragma (refer Linker section in the Build Tool Utilities manual). Using the #pragma CONST_SECTION for constant-segment allocation, the Compiler allocates const variables into the ROM_VAR segment.

If the current data segment is not the default segment, const objects remain in the user-defined segment. If the data segment contains onlyconst objects, the Compiler may allocate the segment to a ROM memory section (refer to the Linker section in the Build Tool Utilities Reference Manual for more information).

Note: The Compiler uses the default addressing mode for the constants specified by the memory model.
Example

The following listing shows how the -Cc compiler option affects the SECTIONS segment of a PRM file (HIWARE object-file format only).

Listing: Constant Objects into ROM


SECTIONS
  MY_ROM  READ_ONLY     0x1000 TO 0x2000

PLACEMENT

  DEFAULT_ROM, ROM_VAR  INTO MY_ROM
See also

Segmentation

Linker Manual

-F (-Fh, -F1, -F1o, -F2, -F2o,-F6, or -F7): Object-File Format option

#pragma INTO_ROM: Put Next Variable Definition into ROM