Skip to main content

IAR Embedded Workbench for RX 5.20

Introduction

In this section:

The RXmicrocontroller has one continuous memory space for both code and data, ranging from 0x00000000 to 0xFFFFFFFF. Different types of memory can be placed in the memory range. A typical application will have ROM memory in the upper address interval, and RAM in the lower address interval.

Both code and data can be efficiently read. Physically, data and code reside on different memory buses, but the address spaces are disjoint.

Different ways to store data

In a typical application, data can be stored in memory in three different ways:

  • Auto variables

    All variables that are local to a function, except those declared static, are stored either in registers or on the stack. These variables can be used as long as the function executes. When the function returns to its caller, the memory space is no longer valid. For more information, see The user mode and supervisor mode stacks and Storage of auto variables and parameters.

  • Global variables, module-static variables, and local variables declared static

    In this case, the memory is allocated once and for all. The word static in this context means that the amount of memory allocated for this kind of variables does not change while the application is running. For more information, see and Data modelsMemory types.

  • Dynamically allocated data

    An application can allocate data on the heap, where the data remains valid until it is explicitly released back to the system by the application. This type of memory is useful when the number of objects is not known until the application executes.

    Note: There are potential risks connected with using dynamically allocated data in systems with a limited amount of memory, or systems that are expected to run for a long time. For more information, see Dynamic memory on the heap.