xpg

Eclipse plugin for mspdebug and msp430-gcc

250 posts in this topic

Hi guys,

I've finally hacked together a plugin for Eclipse that allows the msp430-gcc toolchain to be used from within Eclipse more easily.
I must warn you that this is by no means finished, but I wanted to get it out there to get some opinions before I spend too much time on it.

Features and Limitations:

- Supports msp430-gcc macro and include directory discovery (though msp430-gcc must be in your PATH).
- Extracts list of supportet MCUs from msp430-gcc, and allows target MCU to be easily selected and changed.
- Use mspdebug to upload to target (only Launchpad is supported and the device is autodetected).
- Only Linux and Windows are supported at this point.
- Binary toolchains are provided for Linux and Windows, in order to ease installation.

Changelog:
1.0.5.1

-Added Windows support.
-Added dependency on "Target Management Terminal".
-Add .cpp as C++ extension.
-Support for FRAM board (by using a newer version of mspdebug).
-Fix a bug: mspdebug fails to startup successfully for debugging session.
-Group MCU List to make selection easier.
-Remove usage of stdbuf.
-Simplify tool selection by adding an "Activate"-button to the tool manager.
-Add support for static libraries (project type).
-Kill mspdebug when debugger is stopped.
-"tilib" to the mspdebug driver selection.
 

1.0.4.1
-gcc, gdb, and mspdebug are no longer distributed as an eclipse plugin, but as a separate download package. This allows the tools to be installed in a user select location, rather than trying to install into the eclipse directory.
-MSP430 C/C++ projects can now be created.
-The protocol (SBW, JTAG) used by MSPDebug can now be selected.
 

Installation:
Add http://eclipse.xpg.dk as a software source in Eclipse, and install the Msp430Eclipse plugin.
Currently, only Indigo is supported, but the plugin might work with Helios and Juno as well.

If your system does not have up-to-date version of msp430-gcc, msp430-gdb, and mspdebug, you can download one of the following tool-packages:

Linux 64-bit: msp430-toolchain-linux-amd64-3.0.tar.bz2
Linux 32-bit: msp430-toolchain-linux-i386-2.1.tar.bz2
Windows 32-bit: msp430-toolchain-win-x86-3.0.zip

Mac OS X: msp430-toolchain-mac_os_x-x86_64-2.2.tar.bz2

Extract the package in an appropriate location ($HOME, for instance), and go to Eclipse (with the MSP430Eclipse plugin installed), and from the menu select MSP430->Tool Manager. Click the "Add..."-button, and browse to the tool-package directory. Select the tool-chain and press the "Activate"-button in order to tell Eclipse to use it.

You can verify that the right tool-package is used by going to the Eclipse preference and select "MSP430". Here you will be able to see and choose what tools are used from which package.

For windows, you will need to install USB-drivers as described in the MSPDebug FAQ.

Getting Started:
In order to use the MSP430 features, you have to create a new C project and choose "Empty Project" from the "MSP430 Cross Target Application" group. It is possible to select the target MCU from the wizard, but this does currently not work.

After having created the project, right click on it and select properties. In the "MSP430"-setting it is possible to select the target MCU. Remember to press "Apply" in order for the selection to take effect.

After having added some source files and compiled the project, you can upload it to the MSP430 by choosing the MSP430-menu, and selecting the "Upload to target action"

Using the Debugger
In order to debug your program, go to the "Debug Configuration"-dialog, and create a new configuration in the "MPS430 Debug"-group (by right-clicking it). Having that new configurations elected, simply click "Debug".

 

For people interested in hacking on the source code of msp430Eclipse, it is available at gitorious: https://gitorious.org/msp430eclipse

 


Updated September 3rd: New version released (1.0.5.1), updated description

Updated April 23rd 2013: Links to toolchains updated.

Updated April 25th 2013: Added link to gitorious project.

timotet, Rickta59, nemetila and 6 others like this

Share this post


Link to post
Share on other sites
Awesome xpg!

....so does the plugin install all the necessary binaries? All we have to do is include the plugin?

Well, only mspdebug and msp430-gdb at this point. One has to have the rest of the msp430 toolchain. It might, however, be possible to include the entire chain with sufficient hacks in place.

As far as I can see, the entire toolchain (mspgcc, msp430mcu and msp430-libc) weights in at 203MB, so that's probably not the deal breaker. Main problem might very well be to get gcc invoked properly such that it does not rely on hardcoded paths. I'll definitely think about this :-)

 

Could I get a screenshot of this for the Blog.

 

Something along the lines of the attached file?

Please remember, that this is still a very early version.

 

/Paul

post-2106-135135522822_thumb.jpg

bluehash likes this

Share this post


Link to post
Share on other sites

Cool stuff!

 

I'm thinking, for a bundled MSPDebug and msp430-gdb, you'd probably better compile both of them with as few features as possible (ie. no readline for MSPDebug, no expat, snake and whatnot else for msp430-gdb) -- the closer they are to depend only on libc the better chances are for them to run on more distros :).

Share this post


Link to post
Share on other sites

I get this:

Cannot complete the install because one or more required items could not be found.

Software being installed: Msp430eclipse 1.0.0.201111152139 (dk.xpg.msp430eclipse.feature.feature.group 1.0.0.201111152139)

Missing requirement: Msp430eclipse 1.0.0.201111152139 (dk.xpg.msp430eclipse.feature.feature.group 1.0.0.201111152139) requires 'org.eclipse.cdt.managedbuilder.core 7.0.2' but it could not be found

Eclipse SDK

Version: 3.5.2

Build id: M20100211-1343

 

Ubuntu 10.10

Share this post


Link to post
Share on other sites
Cool stuff!

 

I'm thinking, for a bundled MSPDebug and msp430-gdb, you'd probably better compile both of them with as few features as possible (ie. no readline for MSPDebug, no expat, snake and whatnot else for msp430-gdb) -- the closer they are to depend only on libc the better chances are for them to run on more distros :).

 

Very, very good point. I'll keep that in mind as I move away from proof-of-concept to something that is to be used more broadly. Thanks, for pointing it out!

 

Cheers,

Paul

Share this post


Link to post
Share on other sites
I get this:
Cannot complete the install because one or more required items could not be found.

Software being installed: Msp430eclipse 1.0.0.201111152139 (dk.xpg.msp430eclipse.feature.feature.group 1.0.0.201111152139)

Missing requirement: Msp430eclipse 1.0.0.201111152139 (dk.xpg.msp430eclipse.feature.feature.group 1.0.0.201111152139) requires 'org.eclipse.cdt.managedbuilder.core 7.0.2' but it could not be found

Eclipse SDK

Version: 3.5.2

Build id: M20100211-1343

 

Ubuntu 10.10

 

Your Eclipse version is too old. You need at least 3.7 for the plugin to work. However, I'll try to test and rebuild for 3.5, as you are probably not the only one running 3.5.

Actually, I'll try to maintain three separate update-sites for 3.5, 3.6, and 3.7. I'll keep you guys posted when I'm done.

 

Cheers,

Paul

Share this post


Link to post
Share on other sites
I get this:

Eclipse SDK

Version: 3.5.2

Build id: M20100211-1343

 

Ubuntu 10.10

 

I've just quickly looked into this, and I would suggest that you download a newer version of Eclipse. While I might be able to get things running on Eclipse 3.5, I think I will prioritize getting the plugin into a better shape at this point. The minimum requirement will be Eclipse 3.6 Helios. I'm sorry for this, but I'm afraid I'll spend too much time on a two year old Eclipse release :-(

 

Cheers,

Paul

Share this post


Link to post
Share on other sites

Apparently msp430-gdbproxy has been built into the latest version of mspdebug!

 

Anyway, I hope this helps you get debugging working. I look forward to see if it helps you.

 

That is exactly what I am trying to utilize. My greatest problem at this point (with regards to debugging) is that Eclipse CDT does not really support launching a debugging proxy. I have a workaround that works fairly well, but it is, well, a hack, and it only works on Indigo.

 

On a related note: I am soon ready to release another early test version of the MSP430Eclipse plugin. This time I have packaged GCC, GDB, and MSPDebug for 32 and 64 bit Linux. Stay tuned. Hopefully, I will be able to put it out there tonight.

 

/Paul

Share this post


Link to post
Share on other sites

It's seem that I finally succeeded in building a plugin for Eclipse, which contains compiled versions of GCC, GDB, and mspdebug, and also integrates these somewhat into Eclipse. Currently, I would strongly advice people, who which to try my plugin, to use Eclipse Indigo.

 

There are three installable features: MSP430Eclipse, which is the Eclipse integration, and two binary toolchains (32 and 64 bit Linux). Yes, it's Linux only for now. Installing MSP430Eclipse and the appropriate toolchain will take a while, as the toolchains are quite big (yes, there are plenty of improvements to be made). I'll try to describe how to get started with this Eclipse plugin in this post.

 

Go to the "Help->Install new software" menu, and type in "http://eclipse.xpg.dk" as the repository. If you had installed my previous version, please uninstall it first by going to "Help->About", select "Installation Details" and choose the MSP430Eclipse feature and click "Uninstall".

 

post-2106-135135525216_thumb.jpg

 

Once installed, Eclipse will prompt you to restart. Please do. Once Eclipse pops up again, start by going to the Eclipse preferences ( Select menu "Window->Preference"). There should be a MSP430-tab at the left side. Selecting it will show the toolchain configuration. Here it is possible to use the MSP430 toolchain that comes with your distribution, or you can select a prebuild one (if installed). Perform your selection of choice, and hit the "Apply" button.

 

post-2106-135135524915_thumb.jpg

 

Next task is to create a MSP430 C project. Go to "File->New->Project...", a project type selection box will appear. Open the "C/C++"-group, select "C Project", and press Next.

Here, you open the "MSP430 Cross Target Application" group and select "Empty Project". Name your project (let's call it Blinky),

post-2106-135135524924_thumb.jpg

and hit the "Next"-button. Next part of the wizard is about configurations, just press "Next" (not Finish, yet). Finally, you will be brought to a dialog to select the MSP430 target. Select the appropriate MCU from the (huge) drop-down list, and then click "Finish".

 

post-2106-135135525194_thumb.jpg

 

Now we create a source file: Right click the project and select "New->Source File"; name it "main.c". Write some simple code, such as:

#include 
#include 

void delay(unsigned int j) {
for(;j>0;j--);
}

void main(void) {
WDTCTL = WDTHOLD | WDTPW;

P1DIR |= BIT6;

while(true) {
	P1OUT ^= BIT6;
	delay(20000);
}
}

 

Right click the project and select "Build Project". If everything goes well, your project should start compiling. If not, please let me know :).

 

Before trying to upload the binary to your Launchpad, please ensure that you have the following udev rule installed on your system (and that your user is in the plugdev group):

ATTRS{idVendor}=="0451", ATTRS{idProduct}=="f432", MODE="0660", GROUP="plugdev"

Place the code in /etc/udev/rules.d/90-launchpad.rules, or something similar. Some distributions have done this for you, others have not.

 

In order to upload the binary select the MSP430-menu and choose "Upload to target". Note, that this is the MSP430-menu in the main Eclipse menubar (there is also one in the context menu of the project, but it does not work). With a bit of luck, the code should be uploaded to the Launchpad and blink LED2.

 

Next up is debugging. This is the most experimental part of the plugin, so don't expect it to work :-). Click "Run->Debug Configurations..." from the Eclipse menubar. Right click the "GDB Hardware Debugging"-group on the left, and select "New".

Go to the "Debugger"-tab and ensure that "Use remote target" is checked and that "mspdebug" is chosen in the list. In the "GDB Command" field type: "${dk.xpg.msp430eclipse.variable.debugger}" instead of "gdb".

post-2106-135135525204_thumb.jpg

 

Now, press "Debug" and the magic should happen. Eclipse will most likely ask if it should open the Debug perspective, say "Yes". The MCU will be reset and the current program location will be somewhere strange. Select the "main.c" file and place a breakpoint somewhere in main().

post-2106-135135525204_thumb.jpg

Press F8 to run until the breakpoint is reached. Now it should be possible to single step through the program. When you are done with debugging, simply terminate the session by pressing the red stop button.

 

Well, I guess that's it for now. Please try it out, and tell me if it works for you. If there is sufficient interest in this, I'll keep developing it. Now, I need to get some sleep, it's 1 AM and I need to get up early tomorrow :oops:

Rickta59, Tieri, bluehash and 6 others like this

Share this post


Link to post
Share on other sites

:) Failed as anything with eclipse so far.

An error occurred while configuring the installed items
session context was:(profile=PlatformProfile, phase=org.eclipse.equinox.internal.p2.engine.phases.Configure, operand=null --> [R]dk.xpg.msp430eclipse.toolchain.linux32.feature.feature.group 1.0.2.1, action=org.eclipse.equinox.internal.p2.touchpoint.natives.actions.ChmodAction).
The action chmod failed - file /usr/lib/eclipse/msp430-toolchain/linux-i386 does not exist

Some files missing from the 32bit toolchain ?

oppa@oppa-mag:~$ infobash -v3
Host/Kernel/OS  "oppa-mag" running Linux 3.1-0.slh.2-aptosid-686 i686 [ sidux 2010-01 ????? - kde-lite - (201006131622) ]
CPU Info        4x Intel Atom 330 @ 512 KB cache flags( sse3 ht nx lm ) clocked at [ 1600.179 MHz ]
Videocard       nVidia ION VGA  X.Org 1.11.1.901  [ 1920x1080@50.0hz ]
Network cards   nVidia MCP79
               Atheros AR9285 Wireless
Processes 152 | Uptime 5:01 | Memory 1076.2/1771.1MB | HDD WDC WD5000BEVT-2 Size 500GB (6%used) | GLX Renderer ION/PCI/SSE2 | GLX Version 3.3.0 NVIDIA 275.28 | Client Shell | Infobash v3.37

Share this post


Link to post
Share on other sites
:) Failed as anything with eclipse so far.

An error occurred while configuring the installed items
session context was:(profile=PlatformProfile, phase=org.eclipse.equinox.internal.p2.engine.phases.Configure, operand=null --> [R]dk.xpg.msp430eclipse.toolchain.linux32.feature.feature.group 1.0.2.1, action=org.eclipse.equinox.internal.p2.touchpoint.natives.actions.ChmodAction).
The action chmod failed - file /usr/lib/eclipse/msp430-toolchain/linux-i386 does not exist

Some files missing from the 32bit toolchain ?

 

Ahh, I have an idea what goes wrong. My guess is that you have eclipse installed by your distribution, and that you are installing the plugin as a regular user. As I need to install native binary files, I need somewhere to write this rather arbitrary data. Unfortunately, the most convenient way I have found is to install files to the installation root of Eclipse. I am looking for better ways to do this, but unfortunately there seem to be no straight forward solutions.

 

In order to get this working, your best bet is to download the Eclipse tarball directly from eclipse.org and extract it somewhere where you have write-permissions.

 

I'm sorry for the inconvenience, I'm still learning my way around Eclipse.

 

Cheers,

Paul

Share this post


Link to post
Share on other sites

I am running on Fedora 16 with Indigo.

I got the plugin installed by running Eclipse as root one time, so now I get things going.

I chose my processor from the list (an MCP430G2231), but when I go to build I get

Building file: ../main.c
Invoking: MSP430 C Compiler
msp430-gcc -O0 -g -Wall -mmcu=msp430g2231 -std=gnu89 -c -o "main.o" "../main.c"
cc1: MCU msp430g2231 not supported
Known MCU names:
  msp1
  msp2
  msp430x110
  msp430x112
  msp430x1101
  msp430x1111
  msp430x1121
  msp430x1122
  msp430x1132
  msp430x122
  msp430x123
  msp430x1222
  msp430x1232
  msp430x133
  msp430x135
  msp430x1331
  msp430x1351
  msp430x147
  msp430x148
  msp430x149
  msp430x1471
  msp430x1481
  msp430x1491
  msp430x155
  msp430x156
  msp430x157
  msp430x167
  msp430x168
  msp430x169
  msp430x1610
  msp430x1611
  msp430x1612
  msp430x2001
  msp430x2011
  msp430x2002
  msp430x2012
  msp430x2003
  msp430x2013
  msp430x2101
  msp430x2111
  msp430x2121
  msp430x2131
  msp430x2112
  msp430x2122
  msp430x2132
  msp430x2232
  msp430x2252
  msp430x2272
  msp430x2234
  msp430x2254
  msp430x2274
  msp430x233
  msp430x235
  msp430x2330
  msp430x2350
  msp430x2370
  msp430x247
  msp430x248
  msp430x249
  msp430x2410
  msp430x2471
  msp430x2481
  msp430x2491
  msp430x2416
  msp430x2417
  msp430x2418
  msp430x2419
  msp430x2616
  msp430x2617
  msp430x2618
  msp430x2619
  msp430x311
  msp430x312
  msp430x313
  msp430x314
  msp430x315
  msp430x323
  msp430x325
  msp430x336
  msp430x337
  msp430x412
  msp430x413
  msp430x415
  msp430x417
  msp430x423
  msp430x425
  msp430x427
  msp430x4250
  msp430x4260
  msp430x4270
  msp430xG4250
  msp430xG4260
  msp430xG4270
  msp430xE423
  msp430xE425
  msp430xE427
  msp430xE4232
  msp430xE4242
  msp430xE4252
  msp430xE4272
  msp430xW423
  msp430xW425
  msp430xW427
  msp430xG437
  msp430xG438
  msp430xG439
  msp430x435
  msp430x436
  msp430x437
  msp430x4351
  msp430x4361
  msp430x4371
  msp430x447
  msp430x448
  msp430x449
  msp430xG4616
  msp430xG4617
  msp430xG4618
  msp430xG4619
  msp430x4783
  msp430x4784
  msp430x4793
  msp430x4794
  msp430x5418
  msp430x5419
  msp430x5435
  msp430x5436
  msp430x5437
  msp430x5438
(null):0: confused by earlier errors, bailing out
make: *** [main.o] Error 1

**** Build Finished ****

 

Solved.

I had installed the toolchain in Fedora before doing the Eclipse integration. Putting /usr/lib64/eclipse/msp430-toolchain/linux-amd64/bin first in the $PATH, and /usr/lib64/eclipse/msp430-toolchain/linux-amd64/lib in $LD_LIBRARY_PATH seems to work.

Share this post


Link to post
Share on other sites

mymaestro: you should also be able to solve the problem by choosing the pre-build toolchain from the msp430 preferences in Eclipse, rather than the System Toolchain. If that does not work, please let me know.

Share this post


Link to post
Share on other sites

I got the plugin installed by running Eclipse as root one time, so now I get things going.

I chose my processor from the list (an MCP430G2231), but when I go to build I get

I could get it to install as without errors as root too. Now, the target selection page is empty, nothing, just a grey page. I don't want to bypass apt.

 

http://foto.arcor-online.net/palb/alben ... 643334.jpg

Share this post


Link to post
Share on other sites

I could get it to install as without errors as root too. Now, the target selection page is empty, nothing, just a grey page. I don't want to bypass apt.

 

You can easily install Eclipse in your home directory, or anywhere else without polluting /usr, /usr/local, etc. So it is perfectly safe to have, $HOME/opt/eclipse, for instance. But I do understand that you want to go through your distribution's regular channels. I'll try to fix it, but I can't really promise anything.

 

I do have a couple of questions which might help me remedy the situation: First, which version of Eclipse are you running? (if you don't know, you can just tell me your distribution name and version). 32 or 64 bit?

If you go to the properties of your project (right click the project and select "Properties"), and select MSP430 in the left-side pane. Is the page still blank?

 

Cheers,

Paul

Share this post


Link to post
Share on other sites

Hi,

 

it's aptosid = Debian sid with a different kernel, 32 bit.

Eclipse Platform

Version: 3.7.0
Build id: I20110613-1736

I've started eclipse from the command line and I get:

oppa@oppa-mag:~$ eclipse
Gtk-Message: Failed to load module "pk-gtk-module"

Google said this is provided by packagekit-gtk-module, which I've installed but still this error. I'm affraid the box is there but just invisible.

 

Anyway, I'll give $HOME install a try now.

 

Cheers,

Stephan

 

http://foto.arcor-online.net/palb/alben ... 616630.jpg

Edit: I've downloaded and installed the tarball to /home/oppa/bin/eclipse and set to use the precompiled toolchain. I get the target selction box now but it's still 'no worky'. When I hit the 'play' button I get

The selection can not be launched, and there are no recent launches

:!!!:

http://foto.arcor-online.net/palb/alben ... 613162.jpg

 

Edit2: OK, sorted. For whatever reason "File->New" did not assign this file to the project. It is building now but upload fails:

usbutil: unable to find a device matching 0451:f432

which is no surprise because:

Bus 004 Device 003: ID 0451:f430 Texas Instruments, Inc. MSP-FET430UIF JTAG Tool

Share this post


Link to post
Share on other sites

it's aptosid = Debian sid with a different kernel, 32 bit.

Eclipse Platform

Version: 3.7.0
Build id: I20110613-1736

I've started eclipse from the command line and I get:

oppa@oppa-mag:~$ eclipse
Gtk-Message: Failed to load module "pk-gtk-module"

Google said this is provided by packagekit-gtk-module, which I've installed but still this error. I'm affraid the box is there but just invisible.

 

I think that the message is harmless, but I really don't know. But I'll try to install Debian sid and try to reproduce and see if I can do anything about it.

 

http://foto.arcor-online.net/palb/alben ... 616630.jpg

Edit: I've downloaded and installed the tarball to /home/oppa/bin/eclipse and set to use the precompiled toolchain. I get the target selction box now but it's still 'no worky'. When I hit the 'play' button I get

The selection can not be launched, and there are no recent launches

:!!!:

http://foto.arcor-online.net/palb/alben ... 613162.jpg

 

Ahh, that's because you can't launch it like that. You have to go to the MSP430 menu and select "Upload to target", which should launch mspdebug to program your chip. However, mspdebug is currently always invoked with the rf2500 driver. It's not difficult to add a "Programmer Setting" to each project, but I wanted to figure the binary toolchain stuff out first.

 

Cheers,

Paul

Share this post


Link to post
Share on other sites
It's not difficult to add a "Programmer Setting" to each project, but I wanted to figure the binary toolchain stuff out first.

Well, obviously too difficult for me. Anyway, I've uploaded the binary using mspdebug in console. It does not what's supposed to do.


/*
* blinky149x.c
*
*  Created on: 27.11.2011
*      Author: oppa
*/
// eclipse blinky test
// 430F149 board (Itead)
// LEDs 1-4 at 6.7-6.4, low active

#include 

#define LED1	BIT7        // seems there is a space instead of a tab, could this fool eclipse ?
#define	LED2	BIT6
#define	LED3	BIT5
#define	LED4	BIT4

unsigned volatile int i;

void delay(void);

int main(void){

WDTCTL = WDTPW + WDTHOLD;

P6DIR |= LED1 + LED2 + LED3 + LED4;
P6OUT = 0xf0;

while(1){
	P6OUT|= LED2;
	P6OUT &= ~LED1;
	delay();
	P6OUT &= ~LED2;
	P6OUT |= LED1;
	delay();
	P6OUT &= ~LED3;
	P6OUT |= LED2;
	delay();
	P6OUT &= ~LED4;
	P6OUT |= LED3;
	delay();
	P6OUT &= ~LED3;
	P6OUT |= LED4;
	delay();
	P6OUT &= ~LED2;
	P6OUT |= LED3;
	delay();
}

return 0;
}

void delay(void){
for(i=0;i<27000;i++);
return;
}

Works with IAR, works with mspgcc from the command line but not with the binary eclipse built. LEDs stay dark.

 

Thanks for your hard work but it looks like I'm too numb to benefit from it.

 

Have a nice sunday,

Stephan :wave:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now