Jump to content
xpg

Eclipse plugin for mspdebug and msp430-gcc

Recommended Posts

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.

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

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:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...