Pular para o conteúdo principal
Renesas Brasil - Knowledgebase

Can I allocate function and variable in single section?(CC-RL)

Last Updated:06/21/2017


I am using RL78 Compiler CC-RL.
When I declare a local variable array with the initial value, the initial value is allocated to the .data section rather than the section to which the declaration function is allocated.
Is there any way to allocate the initial value to the same section as the function, or specify a section to which the initial value is to be allocated?


The reallocation attribute is different between the section for the initial value of a variable and the section for a function. Therefore, initial values and a function cannot be allocated to the same section.

You can change the name of the allocation section and specify section allocation by the -start option of the linker to allocate initial values and a function in a successive area.

To change the allocation section, use the #pragma section directive.

For details, refer to the following document.

 CC-RL Compiler User's Manual

 4.2.4 Using extended language specifications

 Changing compiler output section name (#pragma section)

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