Indigresso Wiki

Open Source Stuff for DASH7

User Tools

Site Tools


Using Eclipse IDE with MSPGCC

These instructions apply equally to all host platforms

Obtaining Eclipse

Eclipse for C/C++ can be obtained at
see Eclipse IDE for C/C++ Developers (includes Incubating components)
If you do not already have mspgcc, see codeblocks_mspgcc
Use mspgcc release at (or after) 20120311 to avoid gdb problem with display of local variables.

zylin plugin

zylin plugin allows eclipse to use msp430-gdb as debugger
install using update site

Project creation

  • without any msp430-specific build-management plugins (generic Cross GCC)

Eclipse for C/C++ developers has a generic project type: Cross GCC

  • File → New → C Project:
    • under Project type: Executable → Cross-Compile Project, Toolchains: Cross GCC
    • enter a project name, hit Finish
  • setup project properties for mspgcc:
    • right-click project (in project explorer), or hit Alt-Enter
    • under C/C++ Build → Settings → Cross Settings:
      • set Prefix: msp430-
      • set path to where mspgcc is installed, with bin subdirectory (eclipse doesn't look under bin)
  • to add files to project:
    • right-click project (in Project Explorer), Import
    • Select General → File System
    • From directory text entry will keep a history of last-visted
    • If you want to create portable project instead of copying file into your project: hit Advanced button and check Create links in workspace.
    • startup (crt0.S) and linker scripts are included with mspgcc

Flags for compiler and linker

  • mandatory cpu setting for compiler and linker:
    • project properties → C/C++ Build → Settings → Cross GCC Compiler, Miscellaneous:
      • add to flags your mcu, ie: -mmcu=cc430f5137
    • and to Cross GCC Linker, Miscellaneous:
      • add to Linker flags (not under Xlinker), the same -mcu=xxx
  • to output map file from linker:
    • project properties → C/C++ Build → Settings :
      • under Cross GCC Linker → Miscellaneous:
        • add Linker flags: click green +, adding
  • size optimization:
    • project properties → C/C++ Build → Settings → Cross GCC Compiler, Optimization level:
      • -Os
    • to remove unused code:
      • compiler flags:
        • project properties → C/C++ Build → Settings → Cross GCC Compiler, Miscellaneous:
          • Other flags, add: -ffunction-sections -fdata-sections
      • linker flags:
        • project properties → C/C++ Build → Settings → Cross GCC Linker, Miscellaneous:
          • add Linker flags: click green +, adding –gc-sections

Custom Linker Script

To support placing data at specific address, you can put your own memory.x into project CWD/PWD. This location can be seen at: project properties → C/C++ Build → Environment
The common msp430 linker script includes memory.x, when this file exists in CWD, then in will override the default memory.x
no extra linker flags necessary

Displaying Executable Size (memory usage)

  • project properties → C/C++ Build → Settings → Build Steps tab:
    • under Post-build steps command: msp430-size <projectname>

Debugging Setup

If mspdebug not setup yet, first follow instructions at codeblocks_mspgcc
Once mspdebug is running and await connection on port 2000, you can create a debug configuration:

  • Run → Debug Configurations…
    • if no configuration for your project yet exists under Zylin Embedded debug (Native), double-click it or hit new (each project must have its own config)
    • in debugger tab, GDB debugger: msp430-gdb (replacing arm-elf-gdb)
    • in commands tab, initialize commands:
  set remoteaddresssize 64
  set remotetimeout 999999
  target remote :2000
  set download-write-size 2000
  set remote memory-write-packet-size 2000
  set remote memory-write-packet-size fixed
  set remote memory-read-packet-size 2000
  set remote memory-read-packet-size fixed
  • hit Debug button to start debugging
  • if gdb complains about missing ../../../gcc-4.6.x/gcc/config/msp430/crt0.S, you will need to create that directory relative to CWD, and put crt0.S (from mspgcc source) in there. CWD is Debug or Release subdirectory in your project directory.
  • reset target, in eclipse console:
    monitor reset

flushregs is currently necessary to refresh gdb after target reset.

Register view

Register viewing eclipse plugin might support your cpu, check plugin page
Enable it: Window → Show view → EmbSys Registers
You may drag the tab elsewhere.
click on wrench to select CPU type.
Additional cpu can be added by XML editing.

GIT source control

For GIT integrated into Eclipse, try EGit

XPG plugin

xpg plugin specific to msp430
Perhaps not much benefit due to Eclipse supporting Cross GCC with little trouble.

opentag/tools/eclipse_mspgcc.txt · Last modified: 2012/03/13 11:40 by dudmuck