Indicate to the assembler the start of section.
Symbol field |
Mnemonic field |
Operand field |
Comment field |
[label:] |
.SECTION |
section-name, relocation-attribute [, ALIGN=absolute-expressions] |
[; comment] |
The .SECTION directive indicates to the assembler the start of a section (no separation of code and data). |
This directive defines a program or data that has a coherent set of functions in a program. |
When an instruction that outputs a label or an object code is used at the beginning of a source program before this directive appears, a relocatable code section is generated as a default section. |
.SECTION directive can specify the start address of a section by specifying AT, DATA_AT, BSS_AT, or BIT_AT as the relocation attribute in the operand field. |
The following shows the relocation attributes that can be specified. |
For the code flash area, mirror area, RAM area, and saddr area, see the user's manual of the device. For the RAM area, note that only the on-chip RAM allocated to an address range from 0xF0000 to 0xFFFFF is supported. |
If the specified absolute expression is illegal or its value is outside the range from 0x00000 to 0xFFFFF, an error will occur. |
For addresses where the option byte, on-chip debugging, and security ID settings are allocated, see the user's manual of the device. |
The two sections with the same name and different relocation attributes SBSS and SBSS_BIT, relocation attributes BSS and BSS_BIT, or relocation attributes BSS_AT and BIT_AT are processed as a single consecutive section in the assembler. |
The section is output to the object file with the relocation attribute of SBSS, and the optimizing linker allocates the section with the relocation attribute of SBSS. |
The section is output to the object file with the relocation attribute of BSS, and the optimizing linker allocates the section with the relocation attribute of BSS. |
The section is output to the object file with the relocation attribute of BSS_AT, and the optimizing linker allocates the section with the relocation attribute of BSS_AT. |
You can change the default alignment condition by specifying the ALIGN parameter. For the .ALIGN directive, specifying a larger value than that specified in the ALIGN parameter results in an error. [V1.10.00 or later] |
To define section ".text" having the TEXT attribute.
To define section ".data" having the DATA attribute.
To define section "EX" having the DATA_AT attribute with address 0xf2000 specified.