Skip to main content

IAR Embedded Workbench for RH850 3.20.x

Assembler instructions used for calling functions

In this section:

This section presents the assembler instructions that can be used for calling and returning from functions on the RH850 microcontroller.

Functions can be called in different ways—directly or via a function pointer. In this section we will discuss how these types of calls will be performed.

The normal function calling instruction is the jump-and-link instruction:

            jarl label, reg

The location that the called function should return to (that is, the location immediately after this instruction) is stored in the register.

The destination label cannot be further away than 2 Mbytes.

            jmp [reg]

This is an instruction to jump to the location that reg points to. After the instruction has been performed, the code located at the label will start executing.

A C function, for instance alpha, is represented in assembler language as a label with the same name as the function, in this case _alpha. The location of the label is the actual location of the code of the function.