pbLua Eclipse

Important Notes

Personally, for something as simple as pbLua, I never use an IDE. A decent text editor and terminal emulator is all you need. Copy the text you want to send to the NXT from the text editor, paste it to the terminal emulator. Keep it simple.

You don’t need to have an IDE to use pbLua on the NXT. But if you want to have an IDE then read this page first, then read it again as you follow the steps to get Eclipse installed.

These instructions were updated on April 7, 2008 to use the new JRE 6 from Sun, the LuaEclipse pugin instead of LunarEclipse, and eliminated a number of plugins that were not really needed.

Here’s the final result with the terminal connected from one computer to a serial port on another computer over a telnet interface. Now I can debug an NXT problem from anywhere in the world – and that’s really cool.

Terminal Settings

Contents

Introduction

Using pbLua is simple with any device that has access to a serial terminal application that works on a USB or Bluetooth interface, and that’s just about anything from a WinCE/Palm PDA or Nokia N770 Internet Tablet to a PC or Mac running Windows, Linux, or OSX.

But some people don’t want to use the bare minimum tools. Some people want to have a full IDE for even the smallest project. Some people can’t believe that software development used to be done on punched cards and that RAM was actually little magnets strung on wires.

If this is you, then this is the page that will get you a full IDE that understands Lua code, and has a built in terminal application for communicating with pbLua on your NXT – and the happy news is that after you are done, you’ll have an IDE that you can use for other development as well…

You’ll need to be somewhat comfortable downloading software from the Internet and installing apps on your machine. The process will take anywhere from 30 minutes to 2 hours depending on your Internet connection speed and your computer.

Fortunately, the Eclipse IDE was designed right from the start to be cross platform. I’ll describe the install step by step on a clean Windows 2000 machine with nothing else installed. It should work almost exactly the same for XP and Vista.

If you have a Linux or OSX machine, then the steps should be more or less the same. If they are radically different then email me and I’ll get this guide updated as quickly as possible.

What You’ll Need To Download

Before we do anything, it’s a good idea to donwload all the stuff we’ll be using. Don’t install anything yet – just get it all assembled in one place on your hard drive.

  1. Java 6 Runtime Environment ~ 17 MB

    You’ll want the Java Runtime Environment (JRE) 6 Update 5 as the recommended base on which to build your Eclipse installation, according to the JRE Info page on the Eclipse website. The following are some links to get the Sun JRE for your computer.

    OSX users – your computer comes with a comaptible Java Runtime by default.

    Windows and Linux users, if you have the same or newer version of the JRE already installed on your computer, then you don’t need to download and intall this one. You’ll need to register on the Sun website to download the JRE.

    You’ll have to pick the one appropriate for your platform, as it’s impossible to provide direct links to these files.

  2. The Eclipse 3.3.2 SDK ~ 140 MB

    This is the actual IDE we’ll be installing. The Java Runtime is required for this part to work. I suggest getting the full install since you’ll probably love Eclipse so much you’ll use it for all your new projects anyways.

That’s all the direct downloads you need, let’s get going on the install…

Installing What You Downloaded

This part is pretty easy on Windows. If you try this on a Linux or an OSX machine and have different results or a procedure that works, please email me the details.

  1. Java 6 Runtime Environment

    OSX users can skip this step – it’s already installed on your machine.

    Everyone else, double click to start the installer, choose “Typical Setup” text=then click “Accept” to continue the install process. After a few minutes, the install completes and you click “Finish”.

  2. Eclipse IDE

    For a Windows install, create a folder at the root of your hard drive called:

    c:\eclipse-SDK-3.3-win32

    Unzip the package you downloaded to this directory on your hard drive. The eclipse executable file should be located at:

    c:\eclipse-SDK-3.3-win32\eclipse\eclipse.exe

    You might want to create a shortcut on the desktop to this executable to make it easier to start Eclipse.

That’s it – the install is done! Now let’s move on to running Eclipse and getting it set up for pbLua development.

Starting Eclipse For The First Time

Double click the shortcut you created for the Eclipse application. From this point forward, the instructions will be the same regardless of the operating system you are running on. I hope.

The first time you start Eclipse, you’ll be asked where you want your projects to be stored. I really don’t like having my home directory under Windows as the place for this, so I just specify:

c:\projects

And click the box that makes this the default, then click “OK” to continue.

2cwSelect WorkspaceTerminal Settings

Eclipse should start up and you’ll be presented with a big screen that looks something like this:

Startup

Now what?! This looks complicated! And can we start yet?

Not quite. There are just a few more things that have to get installed into Eclipse before we can start editing Lua code and send it to the NXT. So let’s keep going.

Installing Plugins For pbLua and the NXT

Here’s where we install the rest of the bits and pieces we need to communicate with the NXT. Please install them in this order, and use the screenshots as guides, keeping in mind that these updates do change from time to time.

Navigate to the update installer using:

Help -> Software Updates -> Find and Install

Install Updates

And then select “Search for new features to install” and click “Next”.

Choose “New Remote Site” for each of the plugins listed below and fill in the dialog box that looks like this. Click OK after filling in each one, and make sure that it’s added to the update list and checked.

Lua Eclipse Plugin

Lua Eclipse Update Site

http://luaeclipse.luaforge.net/update-site

DSDP Target Management Plugin

Name: DSDP TM 2.0 Update Site

URL: http://download.eclipse.org/dsdp/tm/updates/2.0

RXTX Serial and Parallel I/O Plugin

Name: RXTX Update Site

URL: http://rxtx.qbang.org/eclipse

Subclipse SVN Plugin – optional

Name: Subclipse Update Site

URL: http://subclipse.tigris.org/update_1.2.x

I’ve got the first one filled in to get us started:

Remote Site

Once you’ve entered these items, click “Finish” to begin the process of downloading and installing the updates. You’ll see a dialog that indicates which plugins are going to be checked for updates, like this:

Update Sites

For updates that are part of the overall Eclipse project, you may have to specify a mirror site to download from – try to pick one that is geographically close to you to reduce traffic on the web. You can also click the checkbox to let Eclipse automatically select mirrors for you.

Update Mirrors

Once that’s done, the dialog has figured out what you asked it to update and what errors there might be. Select all of the items on the main tree for RXTX, and Lua Eclipse. For the DSDP plugin, click on the “+” to open the tree, then click on the “+” beside “TM and RSE 2.0.3″ and then select everything except:

  • Remote System Exporer Examples
  • Remote Sysytem Explorer C/C++ Remote Debug Launcher

Here’s a picture of what it should look like:

Plugin Select

Then click “Next” to keep going with the installation of the updates.

You’ll need to accept the terms of any license agreements for the updates before clicking “Next” yet again to keep going.

One last dialog shows what’s about to get installed. Click “Finish” to start the download process and then take a break. The download of the actual updates will take a few minutes. You may get warnings about installing unsigned toolkit features for the DLTK update, but go ahead and intall it anyways.

When the download and installation of the updates completes, you’ll be asked to restart Eclipse, which is a good idea. After the restart Eclipse looks pretty much like it did before, so what now?

Connecting to the NXT

Assuming that you’ve already installed the pbLua Serial Port Driver the first time you plugged in the NXT, you can now connect to the NXT using the Terminal in Eclipse.

To start the terminal, navigate to:

Window -> Show View -> Other

As shown in the next screenshot

Show View Other

And then choose the Terminal widget as shown in this screen shot:

Show View Terminal

The Terminal will show up in the lower right hand corner of the Eclipse screen. Before connecting, you’ll need to set up the connection properties for either a real serial port, or a telnet port on this or another machine.

Here’s where to adjust the settings for a terminal:

Terminal Settings

Of course, have to choose either serial or telnet, but you can have multiple terminal sessions in one Eclipse sessions, for the times you want to test communications between multiple NXTs.

Summary

You don’t need to install an IDE to use pbLua, but if you want to, this set of instructions will get you started. The next tutorial will go through setting up a small project and using some of the features of an IDE to get things done easily.