SLAU646F September   2015  – June 2020

 

  1.   Read This First
    1.     How to Use This User's Guide
    2.     Related Documentation
    3.     If You Need Assistance
    4.     Trademarks
  2. 1Introduction
  3. 2Installing MSP430 GCC Toolchain
    1. 2.1 Installing MSP430 GCC in CCS Releases Before v7.2
    2. 2.2 Installing MSP430 GCC as Stand-Alone Package
  4. 3Using MSP430 GCC Within CCS
    1. 3.1 Create New Project
    2. 3.2 Debug Using MSP-FET, MSPFET430UIF, eZ-FET, eZ430
    3. 3.3 Build Options for MSP430 GCC
      1. 3.3.1  GNU Compiler
      2. 3.3.2  GNU Compiler: Runtime
      3. 3.3.3  GNU Compiler: Symbols
      4. 3.3.4  GNU Compiler: Directories
      5. 3.3.5  GNU Compiler: Optimization
      6. 3.3.6  GNU Compiler: Preprocessor
      7. 3.3.7  GNU Compiler: Assembler
      8. 3.3.8  GNU Compiler: Debugging
      9. 3.3.9  GNU Compiler: Diagnostic Options
      10. 3.3.10 GNU Compiler: Miscellaneous
      11. 3.3.11 GNU Linker
      12. 3.3.12 GNU Linker: Basic
      13. 3.3.13 GNU Linker: Libraries
      14. 3.3.14 GNU Linker: Symbols
      15. 3.3.15 GNU Linker: Miscellaneous
      16. 3.3.16 GNU Objcopy Utility
    4. 3.4 CCS Compared to MSP430 GCC
  5. 4MSP430 GCC Stand-Alone Package
    1. 4.1 MSP430 GCC Stand-Alone Package Folder Structure
    2. 4.2 Package Content
    3. 4.3 MSP430 GCC Options
    4. 4.4 MSP430 Built-in Functions
    5. 4.5 Using MSP430 GCC Support Files
    6. 4.6 Quick Start: Blink the LED
      1. 4.6.1 Building with a Makefile
      2. 4.6.2 Building Manually with gcc
      3. 4.6.3 Debugging
        1. 4.6.3.1 Starting GDB Agent
          1. 4.6.3.1.1 Using the GUI
          2. 4.6.3.1.2 Using the Command Line
        2. 4.6.3.2 Debugging With GDB
          1. 4.6.3.2.1 Running a Program in the Debugger
          2. 4.6.3.2.2 Setting a Breakpoint
          3. 4.6.3.2.3 Single Stepping
          4. 4.6.3.2.4 Stopping or Interrupting a Running Program
      4. 4.6.4 Creating a New Project
    7. 4.7 GDB Settings
      1. 4.7.1 Console Application
      2. 4.7.2 Optional Parameters for msp430.dat
      3. 4.7.3 GUI Application
      4. 4.7.4 Attaching the Debugger
      5. 4.7.5 Configuring the Target Voltage
      6. 4.7.6 Resetting the Target
      7. 4.7.7 Halting the Target
  6. 5MSP430 GCC Features
    1. 5.1 C/C++ Attributes
      1. 5.1.1 GCC Function Attribute Support
      2. 5.1.2 GCC Data Attribute Support
      3. 5.1.3 GCC Section Attribute Support
    2. 5.2 Hints for Reducing the Size of MSP430 GCC Programs
      1. 5.2.1 The -mtiny-printf Option
      2. 5.2.2 The -ffunction-sections and -fdata-sections Options
      3. 5.2.3 Making Large Programs Fit Across Upper and Lower Memory
      4. 5.2.4 NOP Instructions Surrounding Interrupt State Changes
    3. 5.3 C Runtime Library (CRT) Startup Behavior
    4. 5.4 Using printf with MSP430 GCC
    5. 5.5 Link-time Optimization (LTO)
    6. 5.6 The __int20 Type and Pointers in the Large Memory Model
  7. 6Building MSP430 GCC From Sources
    1. 6.1 Required Tools
    2. 6.2 Building MSP430 GCC (Mitto Systems Limited)
      1. 6.2.1 Building a Native MSP430 GCC Toolchain
      2. 6.2.2 Building the MSP430 GCC Toolchain for Windows
    3. 6.3 Building MSP430 GCC Stand-Alone Full Package
  8. 7MSP430 GCC and MSPGCC
    1. 7.1 Calling Convention
    2. 7.2 Other Portions of the ABI
  9. 8Appendix
    1. 8.1 GCC Intrinsic Support
    2. 8.2 NOP Instructions Required Between Interrupt State Changes
  10. 9References
  11.   Revision History

GNU Objcopy Utility

Figure 3-18 shows the MSP430 GCC GNU Objcopy Utility settings window.

GUID-0BC28D19-52B0-4507-8F4F-050F82E335F4-low.pngFigure 3-18 MSP430 GCC GNU Objcopy Utility Settings

Table 3-16 describes the options that are available for GNU Objcopy Utility.

Table 3-16 MSP430 GCC GNU Objcopy Utility Settings
OptionDescription
Enable GNU Objcopy UtilityEnable this option to enable the GNU Objcopy Utility. It is disabled by default.
CommandGNU Objcopy location
Command-line patternCommand line parameters
Summary of flags setCommand line with which the GNU Objcopy is called. Displays all the flags passed to the Objcopy command.

Figure 3-19 shows the MSP430 GCC GNU Objcopy Utility General Options settings window.

GUID-BFCDF7DE-3A4C-4174-891E-5D1152B51D4E-low.pngFigure 3-19 MSP430 GCC GNU Objcopy Utility General Options Settings

Table 3-17 describes the options that are available for GNU Objcopy Utility General Options.

Table 3-17 MSP430 GCC GNU Objcopy Utility General Options Settings
OptionDescription
Specify output file nameSpecifies the output file name
Assume input file is in format <bfdname>
-I bfdname

--input-target=bfdname

Consider the source file's object format to be bfdname, rather than attempting to deduce it.
Create an output file in format <bfdname>
-O bfdname

--output-target=bfdname

Write the output file using the object format bfdname.
Set output arch when input is arch-less
-B bfdarch

--binary-architecture=bfdarch

Useful when transforming an architecture-less input file into an object file. In this case the output architecture can be set to bfdarch.
Convert debugging information, if possible
(--debugging)
Convert debugging information, if possible. This is not the default because only certain debugging formats are supported, and the conversion process can be time consuming.
Copy modified/access timestamps to the output (-p, --preserve-dates)Set the access and modification dates of the output file to be the same as those of the input file.
Remove section <name> from the output
-R sectionpattern

--remove-section=sectionpattern

Remove any section matching sectionpattern from the output file. This option may be given more than once. Note that using this option inappropriately may make the output file unusable. Wildcard characters are accepted in sectionpattern. Using the -j and -R options together results in undefined behavior.
Remove all symbol and relocation information (-S, --strip-all)Do not copy relocation and symbol information from the source file.
Remove all debugging symbols sections
(-g, --strip-debug)
Do not copy debugging symbols or sections from the source file.
Remove all symbols not needed by relocations (--strip-unneeded)Strip all symbols that are not needed for relocation processing.
Set the start address to <addr>
(--set-start)
Set the start address of the new file to the specified value. Not all object file formats support setting the start address.
List all object files modified (-v, --verbose)Verbose output: list all object files modified. In the case of archives, 'objcopy -V' lists all members of the archive.

Figure 3-20 shows the MSP430 GCC GNU Objcopy Utility Miscellaneous settings window.

GUID-5565CD41-7070-41BE-AD58-9E5CAB4AB44F-low.pngFigure 3-20 MSP430 GCC GNU Objcopy Utility Miscellaneous Settings

Table 3-18 describes the options that are available for GNU Objcopy Utility Miscellaneous.

Table 3-18 MSP430 GCC GNU Objcopy Utility Miscellaneous Settings
OptionDescription
Other flagsSpecifies individual flags based on the user requirements.