The defaults for the mapped sections of variables are as follows:
For changing the area (section) to map variables, specify the section type and section name through #pragma section.
Variable declaration/definition
When a section type is specified, only section names of the specified type can be changed.
Note that in the RX family C/C++ compiler, the section to map a variable depends on the alignment value of the variable.
B: Variables without initial values and an alignment value of four bytes are mapped
B_2: Variables without initial values and an alignment value of two bytes are mapped
B_1: Variables without initial values and an alignment value of one byte are mapped
For variables with initial values, the initial value is mapped to ROM and the variable itself is mapped to RAM (both ROM and RAM areas are necessary). When the resetprg.c file of the startup routine is used, the INITSCT function copies the initial values in ROM to the variables in RAM.
The relationship between the section type and the created section is shown in the following.
Section names can be switched by the section option or the #pragma section extension. However, partial data (e.g., string literal) is not affected by #pragma section. For details, see the detailed description of 4.2.3 #pragma Directive - #pragma section. |
Specifying a section with an alignment value of 4 when switching the section names also changes the section name of sections with an alignment value of 1 or 2. When #pragma endian is used to specify an endian that differs from the setting by the endian option, a dedicated section is created and the relevant data stored. For this section, after the section name, _B is added for #pragma endian big and _L is added for #pragma endian little. However, partial data (e.g., string literal) is not affected by #pragma endian. For details, see the detailed description of 4.2.3 #pragma Directive - #pragma endian. |
<section> is a C, D, or B section name, and <address> is an absolute address (hexadecimal). |