]>
Commit | Line | Data |
---|---|---|
c63539ff ML |
1 | .. |
2 | Copyright 1988-2022 Free Software Foundation, Inc. | |
3 | This is part of the GCC manual. | |
4 | For copying conditions, see the copyright.rst file. | |
5 | ||
6 | .. program:: MSP430 | |
7 | ||
8 | .. index:: MSP430 Options | |
9 | ||
10 | .. _msp430-options: | |
11 | ||
12 | MSP430 Options | |
13 | ^^^^^^^^^^^^^^ | |
14 | ||
15 | These options are defined for the MSP430: | |
16 | ||
17 | .. option:: -masm-hex | |
18 | ||
19 | Force assembly output to always use hex constants. Normally such | |
20 | constants are signed decimals, but this option is available for | |
21 | testsuite and/or aesthetic purposes. | |
22 | ||
23 | .. option:: -mmcu= | |
24 | ||
25 | Select the MCU to target. This is used to create a C preprocessor | |
26 | symbol based upon the MCU name, converted to upper case and pre- and | |
27 | post-fixed with :samp:`__`. This in turn is used by the | |
28 | :samp:`msp430.h` header file to select an MCU-specific supplementary | |
29 | header file. | |
30 | ||
31 | The option also sets the ISA to use. If the MCU name is one that is | |
32 | known to only support the 430 ISA then that is selected, otherwise the | |
33 | 430X ISA is selected. A generic MCU name of :samp:`msp430` can also be | |
34 | used to select the 430 ISA. Similarly the generic :samp:`msp430x` MCU | |
35 | name selects the 430X ISA. | |
36 | ||
37 | In addition an MCU-specific linker script is added to the linker | |
38 | command line. The script's name is the name of the MCU with | |
39 | :samp:`.ld` appended. Thus specifying :option:`-mmcu=xxx` on the :command:`gcc` | |
40 | command line defines the C preprocessor symbol ``__XXX__`` and | |
41 | cause the linker to search for a script called :samp:`xxx.ld`. | |
42 | ||
43 | The ISA and hardware multiply supported for the different MCUs is hard-coded | |
44 | into GCC. However, an external :samp:`devices.csv` file can be used to | |
45 | extend device support beyond those that have been hard-coded. | |
46 | ||
47 | GCC searches for the :samp:`devices.csv` file using the following methods in the | |
48 | given precedence order, where the first method takes precendence over the | |
49 | second which takes precedence over the third. | |
50 | ||
51 | Include path specified with -I and -L | |
52 | ||
53 | :samp:`devices.csv` will be searched for in each of the directories specified by | |
54 | include paths and linker library search paths. | |
55 | ||
56 | Path specified by the environment variable MSP430_GCC_INCLUDE_DIR | |
57 | ||
58 | Define the value of the global environment variable | |
59 | :samp:`MSP430_GCC_INCLUDE_DIR` | |
60 | to the full path to the directory containing devices.csv, and GCC will search | |
61 | this directory for devices.csv. If devices.csv is found, this directory will | |
62 | also be registered as an include path, and linker library path. Header files | |
63 | and linker scripts in this directory can therefore be used without manually | |
64 | specifying ``-I`` and ``-L`` on the command line. | |
65 | ||
66 | The msp430-elf{,bare}/include/devices directory | |
67 | ||
68 | Finally, GCC will examine :samp:`msp430-elf{,bare}/include/devices` from the | |
69 | toolchain root directory. This directory does not exist in a default | |
70 | installation, but if the user has created it and copied :samp:`devices.csv` | |
71 | there, then the MCU data will be read. As above, this directory will | |
72 | also be registered as an include path, and linker library path. | |
73 | ||
74 | If none of the above search methods find :samp:`devices.csv`, then the | |
75 | hard-coded MCU data is used. | |
76 | ||
77 | .. option:: -mwarn-mcu, -mno-warn-mcu | |
78 | ||
79 | This option enables or disables warnings about conflicts between the | |
80 | MCU name specified by the :option:`-mmcu` option and the ISA set by the | |
81 | :option:`-mcpu` option and/or the hardware multiply support set by the | |
82 | :option:`-mhwmult` option. It also toggles warnings about unrecognized | |
83 | MCU names. This option is on by default. | |
84 | ||
85 | .. option:: -mcpu= | |
86 | ||
87 | Specifies the ISA to use. Accepted values are :samp:`msp430`, | |
88 | :samp:`msp430x` and :samp:`msp430xv2`. This option is deprecated. The | |
89 | :option:`-mmcu=` option should be used to select the ISA. | |
90 | ||
91 | .. option:: -msim | |
92 | ||
93 | Link to the simulator runtime libraries and linker script. Overrides | |
94 | any scripts that would be selected by the :option:`-mmcu=` option. | |
95 | ||
96 | .. option:: -mlarge | |
97 | ||
98 | Use large-model addressing (20-bit pointers, 20-bit ``size_t``). | |
99 | ||
100 | .. option:: -msmall | |
101 | ||
102 | Use small-model addressing (16-bit pointers, 16-bit ``size_t``). | |
103 | ||
104 | .. option:: -mrelax | |
105 | ||
106 | This option is passed to the assembler and linker, and allows the | |
107 | linker to perform certain optimizations that cannot be done until | |
108 | the final link. | |
109 | ||
110 | .. option:: mhwmult= | |
111 | ||
112 | Describes the type of hardware multiply supported by the target. | |
113 | Accepted values are :samp:`none` for no hardware multiply, :samp:`16bit` | |
114 | for the original 16-bit-only multiply supported by early MCUs. | |
115 | :samp:`32bit` for the 16/32-bit multiply supported by later MCUs and | |
116 | :samp:`f5series` for the 16/32-bit multiply supported by F5-series MCUs. | |
117 | A value of :samp:`auto` can also be given. This tells GCC to deduce | |
118 | the hardware multiply support based upon the MCU name provided by the | |
119 | :option:`-mmcu` option. If no :option:`-mmcu` option is specified or if | |
120 | the MCU name is not recognized then no hardware multiply support is | |
121 | assumed. ``auto`` is the default setting. | |
122 | ||
123 | Hardware multiplies are normally performed by calling a library | |
124 | routine. This saves space in the generated code. When compiling at | |
125 | :option:`-O3` or higher however the hardware multiplier is invoked | |
126 | inline. This makes for bigger, but faster code. | |
127 | ||
128 | The hardware multiply routines disable interrupts whilst running and | |
129 | restore the previous interrupt state when they finish. This makes | |
130 | them safe to use inside interrupt handlers as well as in normal code. | |
131 | ||
132 | .. option:: -minrt | |
133 | ||
134 | Enable the use of a minimum runtime environment - no static | |
135 | initializers or constructors. This is intended for memory-constrained | |
136 | devices. The compiler includes special symbols in some objects | |
137 | that tell the linker and runtime which code fragments are required. | |
138 | ||
139 | .. option:: -mtiny-printf | |
140 | ||
141 | Enable reduced code size ``printf`` and ``puts`` library functions. | |
142 | The :samp:`tiny` implementations of these functions are not reentrant, so | |
143 | must be used with caution in multi-threaded applications. | |
144 | ||
145 | Support for streams has been removed and the string to be printed will | |
146 | always be sent to stdout via the ``write`` syscall. The string is not | |
147 | buffered before it is sent to write. | |
148 | ||
149 | This option requires Newlib Nano IO, so GCC must be configured with | |
150 | :samp:`--enable-newlib-nano-formatted-io`. | |
151 | ||
152 | .. option:: -mmax-inline-shift= | |
153 | ||
154 | This option takes an integer between 0 and 64 inclusive, and sets | |
155 | the maximum number of inline shift instructions which should be emitted to | |
156 | perform a shift operation by a constant amount. When this value needs to be | |
157 | exceeded, an mspabi helper function is used instead. The default value is 4. | |
158 | ||
159 | This only affects cases where a shift by multiple positions cannot be | |
160 | completed with a single instruction (e.g. all shifts >1 on the 430 ISA). | |
161 | ||
162 | Shifts of a 32-bit value are at least twice as costly, so the value passed for | |
163 | this option is divided by 2 and the resulting value used instead. | |
164 | ||
165 | .. option:: -mcode-region= | |
166 | ||
167 | These options tell the compiler where to place functions and data that | |
168 | do not have one of the :msp430-fn-attr:`lower`, :msp430-fn-attr:`upper`, ``either`` or | |
169 | ``section`` attributes. Possible values are :msp430-fn-attr:`lower`, | |
170 | :msp430-fn-attr:`upper`, ``either`` or ``any``. The first three behave | |
171 | like the corresponding attribute. The fourth possible value - | |
172 | ``any`` - is the default. It leaves placement entirely up to the | |
173 | linker script and how it assigns the standard sections | |
174 | (``.text``, ``.data``, etc) to the memory regions. | |
175 | ||
176 | .. option:: -msilicon-errata= | |
177 | ||
178 | This option passes on a request to assembler to enable the fixes for | |
179 | the named silicon errata. | |
180 | ||
181 | .. option:: -msilicon-errata-warn= | |
182 | ||
183 | This option passes on a request to the assembler to enable warning | |
184 | messages when a silicon errata might need to be applied. | |
185 | ||
186 | .. option:: -mwarn-devices-csv, -mno-warn-devices-csv | |
187 | ||
188 | Warn if :samp:`devices.csv` is not found or there are problem parsing it | |
3ed1b4ce | 189 | (default: on). |