[an error occurred while processing this directive] CSC369H: Using Eclipse with OS/161

CSC369H: Using Eclipse with OS/161

NB: These instructions were graciously donated by Karen Reid. They have become a bit dated, but they continue to work for me. If you find any errors -- or if you'd like to update them -- please send me corrections. Thank you!

Introduction

You really want to use some good tools to help you navigate, run and debug a big system like OS/161. You are welcome to use any tools you like, but I guarantee that spending a few hours to learn your way around a tool like Eclipse is worth your time.

A good development environment has at least the following features:

Eclipse has all of these features. It is a bit tricky to set up, and it is not fast, but it will save you time and let you spend your thinking time on the actual problems.

System Requirements

The following instructions should work on Linux and on Mac OS X. I have not tested any of this on Microsoft Windows or Cygwin.

You need the following packages. The version numbers correspond to the packages used to prepare this document -- but you should use the most recent stable releases.

Details

  1. If you are working in the linux labs all the plugins should be installed on Eclipse so all you need to do is configure your workspace.
  2. If you don't already have Eclipse on your machine, you can download the Eclipse IDE for C/C++ Developers. This includes the CDT plugin so you don't need to load it separately.
  3. Installing plugins is usually fairly straightforward. Once you have Eclipse running go to Help->Software Updates->Find and Install. You will need to add a "New Remote Site" for Subclipse and for CDT if you don't already have it. The rest of the process is pretty automatic.
  4. You will need OS/161 and System/161 on your machine. Instructions are available here.

Configuring Eclipse

Step 1: Getting the code from the repository

Open the "SVN Repository Exploring" perspective. By right-clicking in the "SVN Repository" window, you can add a new repository. The URL is https://cslinux.utm.utoronto.ca/svn/csc369h/your-group-id. You will be asked for your password and then you will see the URL in the SVN Repository view. Click on the triangle to open the folder, and select the src folder. By right-clicking on the folder you can checkout the repository. Select "Checkout as a project configured using the New Project Wizard", and click on "Finish".

In the wizard, create a C Project, call it 369-A1 (or something similarly useful), and make it a Makefile project with the Other Toolchain. (It will take a while to check out the code.)

Step 2: A couple of kernel configuration steps

In a terminal window (Unix shell), cd into your Eclipse workspace directory and into the 369-A1 project. Configure the system once as described here so that the appropriate make files are available.

Step 3: Configuring the Project

Project Properties

  1. C/C++ Build: Build directory: add /kern/compile/ASST1 to the end of the string that is there.(screenshot)
  2. Environment: Add the PATH variable using "Select" and then selecting it in the list and "Edit". Add the path to cs161-gcc.
  3. Settings: Under "Binary Parsers" add the relevant ones to your machine (Elf and/or GNU Elf for Linux, Mach-O for Mac OS X).

Step 4: Creating Make targets

In the right pane of the C/C++ perspective are two tabs: Outline and Make. Select the Make tab and open folders to get to kern/compile/ASST1 (or whichever assignment you wish to compile). Right-click on ASST1 to add Make targets. Add targets for "all", "clean", "depend", and "install". You can make the target name the same as the Make Target. (And yes, it is a pain to have to create these, but you should only have to do it once.)

Tip: The icon in the upper right corner of the Make window will hide all the folders you don't care about, for a tidier view.

Step 5: Compile

If everything has gone well, you should be able to double click on depend target and then the all target and the kernel will compile. Check the Console tab at the bottom to see the compilation output.

If you get an error that it can't find cs161-gcc then the Environment variable PATH is not set correctly (or you haven't compiled the cs161-gcc compiler).

Finally, double click on the "install" target to install the kernel in the right location

Step 6: Running OS/161

If you just want to run OS/161, switch to a shell window, and cd to ~/csc369/root (or whatever your OSTREE directory is) and run sys161 kernel. You should see some output go by and then a menu prompt. This means that everything is working.

To use the debugger from within Eclipse, you first need to run System/161 in a shell window as sys161 -p 30002 -w kernel. The -w tells the simulator to break and wait for a debugger connection. The -p 30002 tells it that the debugger connection will be on a tcp connection on port 30002 (you can use whichever port you want.)

Now in Eclipse, go to "Open Debug Dialog". Create a new configuration. Following are screenshots of the 3 screens where I had to change things. You will need to know the path on your own machine.

Debugger changes - set Application to kern/compile/ASST0/kernel Debugger changes - set Application to kern/compile/ASST0/kernel Debugger changes - Set connection type to tcp, host to localhost, and port to some number (e.g., 30002) [an error occurred while processing this directive]