Skip to main content

IAR Embedded Workbench for RL78 5.20

Basic project configuration

In this section:

This page gives an overview of the basic settings needed to generate the best code for the RL78 device you are using. You can specify the options either from the command line interface or in the IDE. On the command line, you must specify each option separately, but if you use the IDE, many options will be set automatically, based on your settings of some of the fundamental options.

You need to make settings for:

In addition to these settings, you can use many other options and settings to fine-tune the result even further. For information about how to set options and for a list of all available options, see Compiler options, Linker options, and the IDE Project Management and Building documentation, respectively.

Processor core

The compiler supports these processor cores of the RL78 family:

Core

Description

S1

An S2 core with only one register bank and a multiplexed 8-bit bus.

S2

Does not have instructions to support a hardware multiplier/divider. Using a hardware multiplier/divider is instead supported by I/O register access.

S3 (default)

Has instructions to support a hardware multiplier/divider.

Table 52. Processor cores


Use the --core option to specify the processor core for your project, see --core.

Note

By default, the compiler uses bank 0 and never switches banks automatically. To make the compiler use banks 1–3, you must use the #pragma bank directive, see bank.

Data model

The compiler uses three data models, to make it easier to write code for applications with different data requirements:

  • The Near data model can access data in the highest 64 Kbytes of data memory

  • The Far data model can address data in the entire 1 Mbyte of data memory. It uses a faster but less flexible method than the Huge data model.

  • The Huge data model can address data in the entire 1 Mbyte of data memory. It uses a slower but more flexible method than the Far data model.

For more information about the data models, see Data storage.

Code model

The compiler uses two code models that you can set on file- or function-level to control which function calls are generated by default:

  • The Near code model has an upper limit of 64 Kbytes

  • The Far code model can access the entire 1 Mbyte memory.

For more information about the code models, see Functions.

Size of double floating-point type

Floating-point values are represented by 32- and 64-bit numbers in standard IEEE 754 format. If you use the compiler option ‑‑double={32|64}, you can choose whether data declared as double should be represented with 32 bits or 64 bits. The data type float is always represented using 32 bits.

Optimization for speed and size

The compiler’s optimizer performs, among other things, dead-code elimination, constant propagation, inlining, common sub-expression elimination, and precision reduction. It also performs loop optimizations, such as unrolling and induction variable elimination.

You can choose between several optimization levels, and for the highest level you can choose between different optimization goals—size, speed, or balanced. Most optimizations will make the application both smaller and faster. However, when this is not the case, the compiler uses the selected optimization goal to decide how to perform the optimization.

The optimization level and goal can be specified for the entire application, for individual files, and for individual functions. In addition, some individual optimizations, such as function inlining, can be disabled.

For information about compiler optimizations and for more information about efficient coding techniques, see Efficient coding for embedded applications.