Using the GNU Compiler Collection (GCC): MSP430 Options

Next: NDS32 Options, Previous: Moxie Options, Up: Submodel Options [Contents][Index]

#### 3.19.34 MSP430 Options

These options are defined for the MSP430:

`-masm-hex`

  Force assembly output to always use hex constants. Normally such constants are signed decimals, but this option is available for testsuite and/or aesthetic purposes.

`-mmcu=`

  Select the MCU to target. This is used to create a C preprocessor symbol based upon the MCU name, converted to upper case and pre- and post-fixed with ‘`__`’. This in turn is used by the `msp430.h` header file to select an MCU-specific supplementary header file.

  The option also sets the ISA to use. If the MCU name is one that is known to only support the 430 ISA then that is selected, otherwise the 430X ISA is selected. A generic MCU name of ‘`msp430`’ can also be used to select the 430 ISA. Similarly the generic ‘`msp430x`’ MCU name selects the 430X ISA.

  In addition an MCU-specific linker script is added to the linker command line. The script’s name is the name of the MCU with `.ld` appended. Thus specifying `-mmcu=xxx` on the `gcc` command line defines the C preprocessor symbol `__XXX__` and cause the linker to search for a script called `xxx.ld`.

  The ISA and hardware multiply supported for the different MCUs is hard-coded into GCC. However, an external ‘`devices.csv`’ file can be used to extend device support beyond those that have been hard-coded.

  GCC searches for the ‘`devices.csv`’ file using the following methods in the given precedence order, where the first method takes precendence over the second which takes precedence over the third.

  Include path specified with `-I` and `-L`

    ‘`devices.csv`’ will be searched for in each of the directories specified by include paths and linker library search paths.

  Path specified by the environment variable ‘`MSP430_GCC_INCLUDE_DIR`’

    Define the value of the global environment variable ‘`MSP430_GCC_INCLUDE_DIR`’ to the full path to the directory containing devices.csv, and GCC will search this directory for devices.csv. If devices.csv is found, this directory will also be registered as an include path, and linker library path. Header files and linker scripts in this directory can therefore be used without manually specifying `-I` and `-L` on the command line.

  The ‘`msp430-elf{,bare}/include/devices`’ directory

    Finally, GCC will examine ‘`msp430-elf{,bare}/include/devices`’ from the toolchain root directory. This directory does not exist in a default installation, but if the user has created it and copied ‘`devices.csv`’ there, then the MCU data will be read. As above, this directory will also be registered as an include path, and linker library path.

  If none of the above search methods find ‘`devices.csv`’, then the hard-coded MCU data is used.

`-mwarn-mcu`
`-mno-warn-mcu`

  This option enables or disables warnings about conflicts between the MCU name specified by the `-mmcu` option and the ISA set by the `-mcpu` option and/or the hardware multiply support set by the `-mhwmult` option. It also toggles warnings about unrecognized MCU names. This option is on by default.

`-mcpu=`

  Specifies the ISA to use. Accepted values are ‘`msp430`’, ‘`msp430x`’ and ‘`msp430xv2`’. This option is deprecated. The `-mmcu=` option should be used to select the ISA.

`-msim`

  Link to the simulator runtime libraries and linker script. Overrides any scripts that would be selected by the `-mmcu=` option.

`-mlarge`

  Use large-model addressing (20-bit pointers, 20-bit `size_t`).

`-msmall`

  Use small-model addressing (16-bit pointers, 16-bit `size_t`).

`-mrelax`

  This option is passed to the assembler and linker, and allows the linker to perform certain optimizations that cannot be done until the final link.

`mhwmult=`

  Describes the type of hardware multiply supported by the target. Accepted values are ‘`none`’ for no hardware multiply, ‘`16bit`’ for the original 16-bit-only multiply supported by early MCUs. ‘`32bit`’ for the 16/32-bit multiply supported by later MCUs and ‘`f5series`’ for the 16/32-bit multiply supported by F5-series MCUs. A value of ‘`auto`’ can also be given. This tells GCC to deduce the hardware multiply support based upon the MCU name provided by the `-mmcu` option. If no `-mmcu` option is specified or if the MCU name is not recognized then no hardware multiply support is assumed. `auto` is the default setting.

  Hardware multiplies are normally performed by calling a library routine. This saves space in the generated code. When compiling at `-O3` or higher however the hardware multiplier is invoked inline. This makes for bigger, but faster code.

  The hardware multiply routines disable interrupts whilst running and restore the previous interrupt state when they finish. This makes them safe to use inside interrupt handlers as well as in normal code.

`-minrt`

  Enable the use of a minimum runtime environment - no static initializers or constructors. This is intended for memory-constrained devices. The compiler includes special symbols in some objects that tell the linker and runtime which code fragments are required.

`-mtiny-printf`

  Enable reduced code size `printf` and `puts` library functions. The ‘`tiny`’ implementations of these functions are not reentrant, so must be used with caution in multi-threaded applications.

  Support for streams has been removed and the string to be printed will always be sent to stdout via the `write` syscall. The string is not buffered before it is sent to write.

  This option requires Newlib Nano IO, so GCC must be configured with ‘`--enable-newlib-nano-formatted-io`’.

`-mmax-inline-shift=`

  This option takes an integer between 0 and 64 inclusive, and sets the maximum number of inline shift instructions which should be emitted to perform a shift operation by a constant amount. When this value needs to be exceeded, an mspabi helper function is used instead. The default value is 4.

  This only affects cases where a shift by multiple positions cannot be completed with a single instruction (e.g. all shifts >1 on the 430 ISA).

  Shifts of a 32-bit value are at least twice as costly, so the value passed for this option is divided by 2 and the resulting value used instead.

`-mcode-region=`
`-mdata-region=`

  These options tell the compiler where to place functions and data that do not have one of the `lower`, `upper`, `either` or `section` attributes. Possible values are `lower`, `upper`, `either` or `any`. The first three behave like the corresponding attribute. The fourth possible value - `any` - is the default. It leaves placement entirely up to the linker script and how it assigns the standard sections (`.text`, `.data`, etc) to the memory regions.

`-msilicon-errata=`

  This option passes on a request to assembler to enable the fixes for the named silicon errata.

`-msilicon-errata-warn=`

  This option passes on a request to the assembler to enable warning messages when a silicon errata might need to be applied.

`-mwarn-devices-csv`
`-mno-warn-devices-csv`

  Warn if ‘`devices.csv`’ is not found or there are problem parsing it (default: on).

Next: NDS32 Options, Previous: Moxie Options, Up: Submodel Options [Contents][Index]