summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/msp430-options.html
blob: a785d60a5da417e5c7eaadb724fe81ce868458a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<div class="subsection-level-extent" id="MSP430-Options"> <div class="nav-panel"> <p> Next: <a href="nds32-options" accesskey="n" rel="next">NDS32 Options</a>, Previous: <a href="moxie-options" accesskey="p" rel="prev">Moxie Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div>  <h1 class="subsection" id="MSP430-Options-1"><span>3.19.32 MSP430 Options<a class="copiable-link" href="#MSP430-Options-1"> ¶</a></span></h1>  <p>These options are defined for the MSP430: </p> <dl class="table"> <dt>
<span><code class="code">-masm-hex</code><a class="copiable-link" href="#index-masm-hex"> ¶</a></span>
</dt> <dd>
<p>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. </p> </dd> <dt>
<span><code class="code">-mmcu=</code><a class="copiable-link" href="#index-mmcu_003d"> ¶</a></span>
</dt> <dd>
<p>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 ‘<samp class="samp">__</samp>’. This in turn is used by the <samp class="file">msp430.h</samp> header file to select an MCU-specific supplementary header file. </p> <p>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 ‘<samp class="samp">msp430</samp>’ can also be used to select the 430 ISA. Similarly the generic ‘<samp class="samp">msp430x</samp>’ MCU name selects the 430X ISA. </p> <p>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 <samp class="file">.ld</samp> appended. Thus specifying <samp class="option">-mmcu=xxx</samp> on the <code class="command">gcc</code> command line defines the C preprocessor symbol <code class="code">__XXX__</code> and cause the linker to search for a script called <samp class="file">xxx.ld</samp>. </p> <p>The ISA and hardware multiply supported for the different MCUs is hard-coded into GCC. However, an external ‘<samp class="samp">devices.csv</samp>’ file can be used to extend device support beyond those that have been hard-coded. </p> <p>GCC searches for the ‘<samp class="samp">devices.csv</samp>’ 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. </p> <dl class="table"> <dt>Include path specified with <code class="code">-I</code> and <code class="code">-L</code>
</dt> <dd><p>‘<samp class="samp">devices.csv</samp>’ will be searched for in each of the directories specified by include paths and linker library search paths. </p></dd> <dt>Path specified by the environment variable ‘<samp class="samp">MSP430_GCC_INCLUDE_DIR</samp>’</dt> <dd><p>Define the value of the global environment variable ‘<samp class="samp">MSP430_GCC_INCLUDE_DIR</samp>’ 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 <code class="code">-I</code> and <code class="code">-L</code> on the command line. </p></dd> <dt>The ‘<samp class="samp">msp430-elf{,bare}/include/devices</samp>’ directory</dt> <dd>
<p>Finally, GCC will examine ‘<samp class="samp">msp430-elf{,bare}/include/devices</samp>’ from the toolchain root directory. This directory does not exist in a default installation, but if the user has created it and copied ‘<samp class="samp">devices.csv</samp>’ there, then the MCU data will be read. As above, this directory will also be registered as an include path, and linker library path. </p> </dd> </dl> <p>If none of the above search methods find ‘<samp class="samp">devices.csv</samp>’, then the hard-coded MCU data is used. </p> </dd> <dt>
 <span><code class="code">-mwarn-mcu</code><a class="copiable-link" href="#index-mwarn-mcu"> ¶</a></span>
</dt> <dt><code class="code">-mno-warn-mcu</code></dt> <dd>
<p>This option enables or disables warnings about conflicts between the MCU name specified by the <samp class="option">-mmcu</samp> option and the ISA set by the <samp class="option">-mcpu</samp> option and/or the hardware multiply support set by the <samp class="option">-mhwmult</samp> option. It also toggles warnings about unrecognized MCU names. This option is on by default. </p> </dd> <dt>
<span><code class="code">-mcpu=</code><a class="copiable-link" href="#index-mcpu_003d-4"> ¶</a></span>
</dt> <dd>
<p>Specifies the ISA to use. Accepted values are ‘<samp class="samp">msp430</samp>’, ‘<samp class="samp">msp430x</samp>’ and ‘<samp class="samp">msp430xv2</samp>’. This option is deprecated. The <samp class="option">-mmcu=</samp> option should be used to select the ISA. </p> </dd> <dt>
<span><code class="code">-msim</code><a class="copiable-link" href="#index-msim-5"> ¶</a></span>
</dt> <dd>
<p>Link to the simulator runtime libraries and linker script. Overrides any scripts that would be selected by the <samp class="option">-mmcu=</samp> option. </p> </dd> <dt>
<span><code class="code">-mlarge</code><a class="copiable-link" href="#index-mlarge"> ¶</a></span>
</dt> <dd>
<p>Use large-model addressing (20-bit pointers, 20-bit <code class="code">size_t</code>). </p> </dd> <dt>
<span><code class="code">-msmall</code><a class="copiable-link" href="#index-msmall"> ¶</a></span>
</dt> <dd>
<p>Use small-model addressing (16-bit pointers, 16-bit <code class="code">size_t</code>). </p> </dd> <dt>
<span><code class="code">-mrelax</code><a class="copiable-link" href="#index-mrelax-3"> ¶</a></span>
</dt> <dd>
<p>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. </p> </dd> <dt>
<span><code class="code">mhwmult=</code><a class="copiable-link" href="#index-mhwmult_003d"> ¶</a></span>
</dt> <dd>
<p>Describes the type of hardware multiply supported by the target. Accepted values are ‘<samp class="samp">none</samp>’ for no hardware multiply, ‘<samp class="samp">16bit</samp>’ for the original 16-bit-only multiply supported by early MCUs. ‘<samp class="samp">32bit</samp>’ for the 16/32-bit multiply supported by later MCUs and ‘<samp class="samp">f5series</samp>’ for the 16/32-bit multiply supported by F5-series MCUs. A value of ‘<samp class="samp">auto</samp>’ can also be given. This tells GCC to deduce the hardware multiply support based upon the MCU name provided by the <samp class="option">-mmcu</samp> option. If no <samp class="option">-mmcu</samp> option is specified or if the MCU name is not recognized then no hardware multiply support is assumed. <code class="code">auto</code> is the default setting. </p> <p>Hardware multiplies are normally performed by calling a library routine. This saves space in the generated code. When compiling at <samp class="option">-O3</samp> or higher however the hardware multiplier is invoked inline. This makes for bigger, but faster code. </p> <p>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. </p> </dd> <dt>
<span><code class="code">-minrt</code><a class="copiable-link" href="#index-minrt"> ¶</a></span>
</dt> <dd>
<p>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. </p> </dd> <dt>
<span><code class="code">-mtiny-printf</code><a class="copiable-link" href="#index-mtiny-printf"> ¶</a></span>
</dt> <dd>
<p>Enable reduced code size <code class="code">printf</code> and <code class="code">puts</code> library functions. The ‘<samp class="samp">tiny</samp>’ implementations of these functions are not reentrant, so must be used with caution in multi-threaded applications. </p> <p>Support for streams has been removed and the string to be printed will always be sent to stdout via the <code class="code">write</code> syscall. The string is not buffered before it is sent to write. </p> <p>This option requires Newlib Nano IO, so GCC must be configured with ‘<samp class="samp">--enable-newlib-nano-formatted-io</samp>’. </p> </dd> <dt>
<span><code class="code">-mmax-inline-shift=</code><a class="copiable-link" href="#index-mmax-inline-shift_003d"> ¶</a></span>
</dt> <dd>
<p>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. </p> <p>This only affects cases where a shift by multiple positions cannot be completed with a single instruction (e.g. all shifts &gt;1 on the 430 ISA). </p> <p>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. </p> </dd> <dt>
 <span><code class="code">-mcode-region=</code><a class="copiable-link" href="#index-mcode-region"> ¶</a></span>
</dt> <dt><code class="code">-mdata-region=</code></dt> <dd>
<p>These options tell the compiler where to place functions and data that do not have one of the <code class="code">lower</code>, <code class="code">upper</code>, <code class="code">either</code> or <code class="code">section</code> attributes. Possible values are <code class="code">lower</code>, <code class="code">upper</code>, <code class="code">either</code> or <code class="code">any</code>. The first three behave like the corresponding attribute. The fourth possible value - <code class="code">any</code> - is the default. It leaves placement entirely up to the linker script and how it assigns the standard sections (<code class="code">.text</code>, <code class="code">.data</code>, etc) to the memory regions. </p> </dd> <dt>
<span><code class="code">-msilicon-errata=</code><a class="copiable-link" href="#index-msilicon-errata"> ¶</a></span>
</dt> <dd>
<p>This option passes on a request to assembler to enable the fixes for the named silicon errata. </p> </dd> <dt>
<span><code class="code">-msilicon-errata-warn=</code><a class="copiable-link" href="#index-msilicon-errata-warn"> ¶</a></span>
</dt> <dd>
<p>This option passes on a request to the assembler to enable warning messages when a silicon errata might need to be applied. </p> </dd> <dt>
 <span><code class="code">-mwarn-devices-csv</code><a class="copiable-link" href="#index-mwarn-devices-csv"> ¶</a></span>
</dt> <dt><code class="code">-mno-warn-devices-csv</code></dt> <dd>
<p>Warn if ‘<samp class="samp">devices.csv</samp>’ is not found or there are problem parsing it (default: on). </p> </dd> </dl> </div>  <div class="nav-panel"> <p> Next: <a href="nds32-options">NDS32 Options</a>, Previous: <a href="moxie-options">Moxie Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution">
  <p class="_attribution-p">
    &copy; Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br>
    <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MSP430-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MSP430-Options.html</a>
  </p>
</div>