A.2.2 Calling away function

The C compiler uses the jarl instruction to call functions.

However, depending on the program allocation the address may not be able to be resolved, resulting in an error when linking because the jarl instruction is 22-bit displacement.

One way to resolve the error above is to first specify -Xcall_jump=32 to generate jarl32 and jr32 instructions.

If the -Xcall_jump=22 option is specified, then you can make function calls that do not depend on the displacement width by specifying the C compiler's -Xfar_jump option.

When calling a function set as far jump, the jarl32 and jr32 instruction rather than the jarl instruction is output.

One function is described per line in the file where the -Xfar_jump option is specified. The names described should be C language function names prefixed with "_" (an underscore).

Example

The file where the -Xfar_jump option is specified

_func_led
_func_beep
_func_motor
    :
_func_switch

 

If the following is described in place of "_function-name", all functions will be called using far jump.

{all_function}