Skip to main content

IAR Embedded Workbench for RISC-V 3.40

Basic project configuration

In this section:

This page gives an overview of the basic settings needed to generate the best code for the RISC-V 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.

Core

To make the compiler generate optimum code, you should configure it for the RISC-V device you are using.

The compiler supports RV32I, RV32E, and RV64I devices, including some extensions.

Warning

Use the ‑‑core option to select the architecture extensions for which the code will be generated, see ‑‑core.

Caution

In the IDE, choose Project>Options>General Options>Target and choose an appropriate device from the Device drop-down list. The supported architecture extensions will then be automatically selected.

Note

Device-specific configuration files for the linker and the debugger will also be automatically selected.

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.