3.4 #pragma section

#pragma section requires the section name to be converted because the section names differ between the CA78K0R and CC-RL. However, some sections cannot be converted because there are no corresponding sections on the CC-RL side. Though conversion is possible, some sections have slightly different facilities. The CcnvCA78K0R outputs a message to the standard error output upon conversion of some sections. For details, see "Correspondence Table of Section Names".

 

The format of the CA78K0R is as follows.

#pragma section section-name changed-section-name [AT-start-address]

The format of the CC-RL is as follows.

#pragma section [{textconstdatabss}] [changed-section-name]

 

-

Since the CC-RL does not have a facility equivalent to "AT-start-address", if there is "AT-start-address", the CcnvCA78K0R deletes it and outputs a message. Use the -start option to specify the location of the section in the CC-RL. For details on the -start option, see the user's manual of the CC-RL.

-

"changed-section-name" is directly output without being converted. If a character unusable in the CC-RL (e.g., ?) is used in the changed section name, a compile error will occur in the CC-RL. Change the string after conversion.

-

In #pragma section of the CC-RL, the section name for the near area is "changed section name + _n", the section name for the far area is "changed section name + _f", and the section name for the saddr area is "changed section name + _s". For details, see the user's manual of the CC-RL.

-

Since the section for RAM allocation in the CA78K0R cannot be allocated to RAM in the CC-RL, the CcnvCA78K0R outputs a message. Though specifying the CC-RL link option -NO_CHECK_SECTION_LAYOUT allows the section to be allocated to RAM, the ROM data needs to be changed to the far attribute in CC-RL V1.02.

-

If conversion is not possible because there is no corresponding section in the CC-RL, the CcnvCA78K0R outputs a message and does not perform conversion. Then the CC-RL outputs a message and ignores the #pragma directive. Modify the C source program in accordance with the section correspondence table described later.

 

[Examples]

Pattern 1

(Replaced successfully)

Before conversion

#pragma section @@CODE MY_CODE

After conversion

#pragma section text MY_CODE

Pattern 2

(Deletion of AT)

Before conversion

#pragma section @@CODE MY_CODE AT 0x2000

After conversion

#pragma section text MY_CODE

Pattern 3

(Compile error after replacement)

Before conversion

#pragma section @@CODE ??CODE AT 0x2000

After conversion

#pragma section text ??CODE

Corrective action

Though conversion is performed, an error will occur at compilation.

Change the section name.

Pattern 4

(Replacement is not possible)

Before conversion

#pragma section @@LBASE MY_BASE

After conversion

#pragma section @@LBASE MY_BASE

Corrective action

Since there is no corresponding section in the CC-RL, the program is output without being converted.

Correct the program according to the section correspondence table.

 

Table 3.3

Correspondence Table of Section Names

CA78K0R

Section Name

Description

CC-RL

Section Type

CcnvCA78K0R Operation

Corrective Action after Conversion

@@CODE

@ECODE

Segment for code portion (allocated to near area)

text

The section is changed to the corresponding section type.

No action is required.

The section name in the CC-RL is "changed section name + _n".

@@CODEL

@ECODEL

Segment for code portion (allocated to far area)

text

The section is changed to the corresponding section type.

No action is required.

The section name in the CC-RL is "changed section name + _f".

@@CODER

@ECODER

Segment for code portion (allocated to RAM)

text

Though the section is changed to the corresponding section type, a message is output because the code section cannot be allocated to RAM in the CC-RL.

Specify the link option -NO_CHECK_SECTION_LAYOUT to allocate a section to RAM in the CC-RL.

@@LCODE

@LECODE

Segment for library code (allocated to near area)

text

A message is output and conversion is not performed.

Delete #pragma.

Specify the location of the library in the CC-RL with the link option -ROm.

@@LCODEL

@LECODEL

Segment for library code (allocated to far area)

text

A message is output and conversion is not performed.

Delete #pragma.

Specify the location of the library in the CC-RL with the link option -ROm.

@@LCODER

@LECODER

Segment for library code (allocated to RAM)

text

A message is output and conversion is not performed.

Delete #pragma.

Specify the location of the library in the CC-RL with the link option -ROm.

Specify the link option -NO_CHECK_SECTION_LAYOUT to allocate a section to RAM in the CC-RL.

@@CNST

@ECNST

Segment for ROM data (allocated to near area)

const

The section is changed to the corresponding section type.

No action is required.

The section name in the CC-RL is "changed section name + _n".

@@CNSTR

@ECNSTR

Segment for ROM data (allocated to RAM) (allocated to near area)

const

Though the section is changed to the corresponding section type, a message is output because ROM data cannot be allocated to RAM in the CC-RL.

Delete #pragma.

The CC-RL has no means to allocate the ROM data that has been allocated to the near area to RAM. In order to allocate such data to RAM, change the variable of the target section to the far attribute.

@@CNSTL

@ECNSTL

Segment for ROM data (allocated to far area)

const

The section is changed to the corresponding section type.

No action is required.

The section name in the CC-RL is "changed section name + _f".

@@CNSTLR

@ECNSTR

Segment for ROM data (allocated to RAM) (allocated to far area)

const

Though the section is changed to the corresponding section type, a message is output because ROM data cannot be allocated to RAM in the CC-RL.

Specify the link option -NO_CHECK_SECTION_LAYOUT to allocate a section to RAM in the CC-RL.

@@R_INIT

@ER_INIT

Segment for initialized data (near variable)

data

The section is changed to the corresponding section type.

No action is required.

The section name in the CC-RL is "changed section name + _n".

@@RLINIT

@ERLINIT

Segment for initialized data (far variable)

data

The section is changed to the corresponding section type.

No action is required.

The section name in the CC-RL is "changed section name + _f".

@@R_INIS

@ER_INIS

Segment for initialized data (sreg variable)

data

The section is changed to the corresponding section type.

No action is required.

The section name in the CC-RL is "changed section name + _s".

@@CALT

Segment for callt function table

None

A message is output and conversion is not performed.

Delete #pragma.

The section name cannot be changed in the CC-RL.

@@VECTnn

@EVECTnn

Segment for vector table

None

A message is output and conversion is not performed.

Delete #pragma.

The section name cannot be changed in the CC-RL.

@EXTxx

Segment for flash area branch table

None

A message is output and conversion is not performed.

Delete #pragma.

There is no corresponding facility in the CC-RL. Processing needs to be reviewed.

@@BASE

@EBASE

Segment for callt function and interrupt function

text

The section is changed to the corresponding section type.

No action is required.

The section name in the CC-RL is "changed section name + _n".

@@LBASE

Segment for library and callt function

text

A message is output and conversion is not performed.

Delete #pragma.

Specify the location of the library in the CC-RL with the link option -ROm.

@@INIT

@EINIT

Segment for data area (near variable, initialized)

None

A message is output and conversion is not performed.

Delete #pragma.

Specify the section for mapping ROM to RAM with the link option -ROm.

@@INITL

@EINITL

Segment for data area (far variable, initialized)

None

A message is output and conversion is not performed.

Delete #pragma.

Specify the section for mapping ROM to RAM with the link option -ROm.

@@INIS

@EINIS

Segment for data area (sreg variable, initialized)

None

A message is output and conversion is not performed.

Delete #pragma.

Specify the section for mapping ROM to RAM with the link option -ROm.

@@DATA

EDATA

Segment for data area (near variable, uninitialized)

bss

The section is changed to the corresponding section type.

No action is required.

The section name in the CC-RL is "changed section name + _n".

@@DATAL

@EDATAL

Segment for data area (far variable, uninitialized)

bss

The section is changed to the corresponding section type.

No action is required.

The section name in the CC-RL is "changed section name + _f".

@@DATS

@EDATS

Segment for data area (sreg variable, uninitialized)

bss

The section is changed to the corresponding section type.

No action is required.

The section name in the CC-RL is "changed section name + _s".

@@BITS

@EBITS

Segment for boolean type and bit type variables

None

A message is output and conversion is not performed.

Delete #pragma.

The section is allocated to the same section as other data as the _Bool type in the CC-RL.