< Compile Options / Microcontroller Options >
This option does not generate code with the program section as PIC (position independent code).
In PIC, all function calls are performed with BSR or BRA instructions. When acquiring the address of a function, a relative address from the PC should be used. This allows PIC to be located at a desired address after linkage. |
[Without -pic] _func2: MOV.L #_f_ptr,R4 MOV.L #_func1,[R4] RTS [With -pic] _func2: MOV.L #_f_ptr,R4 L11: MVFC PC,R14 ADD #_func1-L11,R14 MOV.L R14,[R4] RTS |
In C++ or EC++ compilation, the pic option cannot be selected. If selected, message W0511171 is output as a warning and the selection of the pic option is disabled. |
The address of a function which is PIC should not be used in the initialization expression used for static initialization. If used, error E0523026 will occur. |
When creating a code for startup of the application program using the PIC function, refer to the Application Startup section of the STARTUP chapter. |