Controls the section where constant data is emitted.
This pragma is compatible with the DSP56800, but it is not compatible with the DSP56800E.
#pragma use_rodata [ on | off | reset ]
By default, the compiler emits const defined data to the .data section. There are two ways to cause the compiler to emit const defined data to the .rodata section:
This method is a global change and emits all const-defined data to the .rodata section for the current build target.
on Write const data to .rodata section.
off Write const data to .data section.
reset Toggle pragma state.
To use this pragma, place the pragma before the const data that you wish the compiler to emit to the .rodata section. This method overrides the target setting and allows a subset of constant data to be emitted to or excluded from the .rodata section.
To see the usage of the pragma use_rodata see the code example in the following listing.
const UInt16 len_l_mult_ls_data = sizeof(l_mult_ls_data) / sizeof(Frac32) ; const Int16 g = a+b+c; #pragma use_rodata on const Int16 d[]={0xdddd}; const Int16 e[]={0xeeee}; const Int16 f[]={0xffff}; #pragma use_rodata off main() { // ... code }
You must then appropriately locate the .rodata section created by the compiler using the linker command file. For example, see the following listing.
MEMORY { .text_segment (RWX) : ORIGIN = 0x2000, LENGTH = 0x00000000 .data_segment (RW) : ORIGIN = 0x3000, LENGTH = 0x00000000 .rodata_segment (R) : ORIGIN = 0x5000, LENGTH = 0x00000000 } SECTIONS { .main_application : { # .text sections } > .text_segment .main_application_data : { # .data sections # .bss sections } > .data_segment .main_application_constant_data: { # constant data sections * (.rodata) } > .rodata_segment }