Skip to main content
Knowledgebase
Home
Renesas Electronics Europe - Knowledgebase

Changing a string constant to have the far attribute (CC-RL)

Last Updated:05/10/2017

Question:

I am using the CC-RL compiler for RL78 devices. I understand that string constants enclosed with “” are handled with the near attribute in the area of the .const section. How can I allocate them to the area of the .constf section so that they have the far attribute?

Answer:

String constants are not defined with use of the __far qualifier. Specify the -far_rom option to make ROM data have the far attribute.
This method gives all data for placement in ROM the far attribute.
With this reason, in access by pointers, use pointers which have the far attribute.

[ Example ]

    __far char *p; /* Define a pointer having the far attribute*/
    p = ""abc"";

When you want to give a const variable which you have defined the near attribute, use the __near qualifier to do so.

Suitable Products
e² studio
CS+ (formerly CubeSuite+)
C Compiler Package for RL78 Family