Everything

.CSEG


Indicate to the assembler the start of a code section.

[Syntax]

Symbol field
Mnemonic field
Operand field
Comment field
[section-name]
.CSEG
[relocation-attribute]
[; comment]

[Function]

-

The .CSEG directive indicates to the assembler the start of a code section.

-

All instructions described following the .CSEG directive belong to the code section until it comes across a section definition directives.

[Description]

-

This directive defines a portion that has a coherent set of functions in a program.
This directive is valid until another section definition directive appears.

-

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.
In this case, the section name will be ".text", and the relocation attribute is set to "TEXT".

-

.CSEG directive can specify the start address of a section by specifying AT in the operand field..
The section start address can also be specified through the .ORG directive.
In this case, the section name will be "the specified section name" + "_AT" + "specified address (hexadecimal notation in uppercase letters without prefix (0x or 0X) or suffix (h or H)".

-

The following shows the relocation attributes that can be specified through .CSEG.

Table 5.16

Relocation Attributes of .CSEG

Relocation Attribute

Description Format

Default Section Name

Explanation

Default Value of Alignment ConditionNote 1

CALLT0

CALLT0

.callt0

Allocates a section between addresses 0x00080 and 0x000BF in the code flash areaNote 2 with the start address set to an even address.

2

TEXT

TEXT

.text

Allocates a section between addresses 0x000C0 and 0x0FFFF in the code flash areaNote 2 with the start address set to an even address.

1

TEXTF

TEXTF

.textf

Allocates a section between addresses 0x000C0 and 0xEFFFF in the code flash areaNote 2 with the start address set to an even address.

1

TEXTF_UNIT64KP

TEXTF_UNIT64KP

.textf_unit64kp

Allocates a section with the start address set to an even address so that it does not extend across a boundary of 64 Kbytes - 1Note 3.

2Note 4

CONST

CONST

.const

Allocates a section in the mirror source areaNote 2 with the start address set to an even address so that it does not extend across a boundary of 64 Kbytes - 1Note 3.

2

CONSTF

CONSTF

.constf

Allocates a section in the code flash areaNote 2 with the start address set to an even address so that it does not extend across a boundary of 64 Kbytes - 1Note 3.

2

ATΔaddress

AT absolute- expressionNote 5

None

Allocates a section at a specified address.

1 (fixed)

OPT_BYTE

OPT_BYTE

.option_byteNote 6

This attribute is dedicated to the user option byte setting and on-chip debugging settingNote 7.

The size is fixed to 4 bytes.

1 (fixed)

SECUR_ID

SECUR_ID

.security_idNote 6

This attribute is dedicated to the security ID settingNote 7.

Machine-language instructions cannot be written in this section.

The size is fixed to 10 bytes.

1 (fixed)

Note 1.

The alignment condition can be modified through the .ALIGN directive.

Note 2.

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.

Note 3.

Allocation beyond a boundary of 64 Kbytes - 1 is prohibited by default.

Note 4.

To guarantee correct access to 16-bit data, the alignment condition value is set to "2".

Note 5.

If the specified absolute expression is illegal or its value is outside the range from 0x00000 to 0xFFFFF, an error will occur.

Note 6.

This is a special section and the section name must not be changed (the name is fixed).

Note 7.

For addresses where the option byte, on-chip debugging, and security ID settings are allocated, see the user's manual of the device.

 

-

When a section definition does not include a section name, the assembler gives a separate default section name for each relocation attribute.
The following shows the section names given by the assembler.

Relocation Attribute

Section Name

CALLT0

.callt

TEXT

.text

TEXTF

.textf

TEXTF_UNIT64KP

.textf_unit64kp

CONST

.const

CONSTF

.constf

ATΔaddress

.text_AT start-address

OPT_BYTE

.option_byteNote

SECUR_ID

.security_idNote

Note

This is a special section and the section name must not be changed (the name is fixed).

 

A section having one of the above names has the corresponding relocation attribute shown above and no different relocation attribute can be assigned.

 

-

When a section definition does not include a relocation attribute, relocation attribute "TEXT" is assumed.

-

The following characters are usable in section names.

-

Alphanumeric characters (0-9, a-z, A-Z)

-

Special characters (@, _, .)

[Example]

To define section ".text" having the TEXT attribute.

.text   .CSEG   TEXT
        NOP

 

To define section ".unit" having the TEXTF_UNIT64KP attribute.

unit    .CSEG   TEXTF_UNIT64KP
        MOV     A, !LABEL

 

To define section "EX" having the AT attribute with address 0x00200 specified.

The section name will be set to "EX_AT200".

EX      .CSEG   AT 0x00200
        .DS     2

 

To define a section for the option byte setting.

.CSEG   OPT_BYTE
.DB     0xFF