Skip to main content

IAR Embedded Workbench for RL78 5.20

Memory access methods

In this section:

This section describes the memory types presented in the chapter Data storage. In addition to presenting the assembler code used for accessing data, this section will explain the reason behind the different memory types.

You should be familiar with the RL78 instruction set, in particular the different addressing modes used by the instructions that can access memory.

For each of the access methods described in the following sections, there are three examples:

  • Accessing a global variable

  • Accessing a global array using an unknown index

  • Accessing a structure using a pointer.

These three examples can be illustrated by this C program:

char myVar;
char MyArr[10];

struct MyStruct
{
  long mA;
  char mB;
};

char Foo(int i, struct MyStruct *p)
{
  return myVar + MyArr[i] + p->mB;
}