8.4.2 __ep_data

The value of __ep_data is determined in the following order of precedence.

(1)

When __ep_data is defined in the application, that value is used.

Note

The compiler generates code based on the assumption that __ep_data is aligned at the 2-byte or 4-byte boundary. Therefore, make sure the defined value is a multiple of 4 when defining __ep_data in the application.

 

(2)

When there is only a reference to __ep_data in the application, the optimizing linker (rlink) automatically determines the __ep_data value in the following order of precedence.

(2-1) If there is a tdata, tdata4, tbss4, tdata5, tbss5, tdata7, tbss7, tdata8, or tbss8 attribute section, the value is

the minimum address of all of those sections that have that attribute in the following order of precedence.

(a) tdata attribute section

(b) tdata4 or tbss4 attribute section

(c) tdata5 or tbss5 attribute section

(d) tdata7 or tbss7 attribute section

(e) tdata8 or tbss8 attribute section

Note

If sections with the above attributes are used, they should be allocated in the above order. The sld or sst instruction has an unsigned offset. Therefore, if a low-priority section is allocated to an address that is smaller than that for a high-priority section, the low-priority section cannot be referenced with the sld or sst instruction. In this case, an error will occur at linkage.

(2-2) If there is an edata or ebss attribute section, the value is the intermediate value of the minimum address

and maximum address of all of those sections.

(2-3) If there is an edata23 or ebss23 attribute section, the value is the intermediate value of the minimum

address and maximum address of all of those sections.

(2-4) If there is an edata32 or ebss32 attribute section, the value is the intermediate value of the minimum

address and maximum address of all of those sections.

(2-5) If none of the above sections exist and there is only a reference to __ep_data, the value is 0.

 

Note, however, that if the value attempted to be defined is an odd value, 1 is added to that value.

The compiler will not generate code to directly reference __ep_data. Normally, a reference to __ep_data indicates the processing to set the __ep_data value to the element pointer register (r30) in the startup routine.

 

(3)

When there is no definition or reference regarding __ep_data in the application, the optimizing linker (rlink) does not generate __ep_data. If there is code to reference an EP-relative section in this state, an error will occur at linkage.

Undefined external symbol "EP-symbol (__ep_data)" referenced in "FILE"