- IAR Embedded Workbench for RX 5.20
- IAR C/C++ Development
- Developing embedded applications
- Basic project configuration
Basic project configuration
This page gives an overview of the basic settings needed to generate the best code for the RX 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:
Processor core
Byte order
Position independence (read-only or read-write)
Data model
Size of
intdata typeSize of
doublefloating-point typeOptimization settings
Runtime environment, see Setting up the runtime environment
Customizing the ILINK configuration, see Linking considerations.
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 configuration
To make the compiler generate optimum code, you should configure it for the RXmicrocontroller you are using.
Core
The compiler supports all RX architectures. To generate optimum code, you should configure the compiler for the RX microcontroller you are using.
Caution
In the IDE, choose Project>Options>General Options>Target and choose an appropriate device from the Device drop-down list. The core and device options will then be automatically selected.
Danger
Use the --core option to select the core for which the code will be generated.
Note
Device-specific configuration files for the linker and the debugger will also be automatically selected.
Byte order
For data access, the RX architecture allows a choice between the big- and little-endian byte order. All user and library modules in your application must use the same byte order.
Caution
In the IDE, choose Project>Options>General Options>Byte order to set the byte order for data.
Danger
Use the --endian compiler option to specify the byte order for data for your project; see --endian for syntax information.
ROPI/RWPI
Most applications are designed to be placed at a fixed position in memory. However, sometimes it is useful to instead decide at runtime where to place the application, for example in certain systems where applications are loaded dynamically.
Danger
Use the --ropi and --rwpi options to configure the compiler to generate position-independent code and data.
Caution
In the IDE, choose Project>Options>General Options>Target>Code and read-only data and/or Project>Options>General Options>Target>Read-write data to generate position-independent code and data.
Read about the advantages and drawbacks with ROPI/RWPI in Position-independent code and data.
Size of int data type
The int data type can be represented with either 16 or 32 (default) bits. Use the compiler option --int to change the default size if you are migrating code written for another microcontroller that uses a 16-bit int size. See --int.
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, scheduling, 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.