RL78 Options (Using the GNU Compiler Collection (GCC))

#### 3.20.43 RL78 Options ¶

`-msim` ¶

  Links in additional target libraries to support operation within a simulator.

`-mmul=none` ¶
`-mmul=g10`
`-mmul=g13`
`-mmul=g14`
`-mmul=rl78`

  Specifies the type of hardware multiplication and division support to be used. The simplest is `none`, which uses software for both multiplication and division. This is the default. The `g13` value is for the hardware multiply/divide peripheral found on the RL78/G13 (S2 core) targets. The `g14` value selects the use of the multiplication and division instructions supported by the RL78/G14 (S3 core) parts. The value `rl78` is an alias for `g14` and the value `mg10` is an alias for `none`.

  In addition a C preprocessor macro is defined, based upon the setting of this option. Possible values are: `__RL78_MUL_NONE__`, `__RL78_MUL_G13__` or `__RL78_MUL_G14__`.

`-mcpu=g10` ¶
`-mcpu=g13`
`-mcpu=g14`
`-mcpu=rl78`

  Specifies the RL78 core to target. The default is the G14 core, also known as an S3 core or just RL78. The G13 or S2 core does not have multiply or divide instructions, instead it uses a hardware peripheral for these operations. The G10 or S1 core does not have register banks, so it uses a different calling convention.

  If this option is set it also selects the type of hardware multiply support to use, unless this is overridden by an explicit `-mmul=none` option on the command line. Thus specifying `-mcpu=g13` enables the use of the G13 hardware multiply peripheral and specifying `-mcpu=g10` disables the use of hardware multiplications altogether.

  Note, although the RL78/G14 core is the default target, specifying `-mcpu=g14` or `-mcpu=rl78` on the command line does change the behavior of the toolchain since it also enables G14 hardware multiply support. If these options are not specified on the command line, then software multiplication routines are used even though the code targets the RL78 core. This is for backward compatibility with older toolchains which did not have hardware multiply and divide support.

  In addition a C preprocessor macro is defined, based upon the setting of this option. Possible values are: `__RL78_G10__`, `__RL78_G13__` or `__RL78_G14__`.

`-mg10` ¶
`-mg13`
`-mg14`
`-mrl78`

  These are aliases for the corresponding `-mcpu=` option. They are provided for backwards compatibility.

`-mallregs` ¶

  Allow the compiler to use all of the available registers. By default registers `r24..r31` are reserved for use in interrupt handlers. With this option enabled these registers can be used in ordinary functions as well.

`-mrelax` ¶
`-mno-relax`

  Enable/disable assembler and linker relaxation. This is enabled by default at `-Os`.

`-mes0` ¶

  Assume `ES` is zero throughout program execution, and use it to address read-only data.

`-msave-mduc-in-interrupts` ¶
`-mno-save-mduc-in-interrupts`

  Specifies that interrupt handler functions should preserve the MDUC registers. This is only necessary if normal code might use the MDUC registers, for example because it performs multiplication and division operations. The default is to ignore the MDUC registers as this makes the interrupt handlers faster. The target option `-mg13` needs to be passed for this to work as this feature is only available on the G13 target (S2 core). The MDUC registers are only saved if the interrupt handler performs a multiplication or division operation or it calls another function.