Installing a Propeller Tool-Chain

Update:Since when you say ARM this days, you need to say Raspberry Pi too, right? Thus, I wrote a post about how to use the installer on the Pi. In this post, you will also find a read made binary.

1. Introduction

Since the original Propeller-Tool from Parallax is Windows only, something else is needed for programming the Propeller in Linux. A very close replacement for the Propeller-Tool is Brad’s Spin Tool (BST). It runs on Linux, OS X and Windows, provides compiler. loader and IDE. The big drawback: it is only distributed in binary form for Intel based Linux distributions. Since I use my Tegra 2 based Netwbook almost daily in the train for coding embedded stuff, this was also not the solution I was looking for. Investigating more, I found the open-source-spin-compiler, which works well on ARM based systems too. As the name suggests, this is only a compiler, not a loader. Searching some more, I found a Python script from Remy Blank (found no good link for this) which does the trick loading a binary to the Propeller.

BST Linux

BST Linux

All tools mentioned so far only support the SPIN and PASM language (which is fine, but I relay like C/C++). Luckily Parallax released a GCC port for the Propeller lately which one could compile also for ARM, well almost: the loader uses some SPIN code which is compiled with the BST compiler, which again is only available as Intel binary. I am going to describe later on how to overcome that last obstacle too.

Since it is time consuming to puzzle all the above together, I wrote a simple installer script to get all the tools installed quickly (well BST will not be installed on non-Intel machines). The script works for Linux on Intel and non-Intel machines (e.g. ARM) and installs the following to /opt/parallax:

2. A Note on Building Propeller GCC for non Intel Linux

Using this script on a non Intel build host does only work partially when it comes to GCC. This is because the propeller-loader tool relays on the bstc Linux binary which is a Intel binary. At the moment the loader fails to build, no propeller-gdb will be build since it relays on the loader library. However, on a ARM machine you will end up with a working propeller-gcc including working C-libraries and binutils, but you will not get the loader nor gdb.

However, it is possible to copy the SPIN binaries generated on a Intel platform to the non Intel build host, and make propeller-loader and gdb compile. If you like to try that, you
could enable “USE_LOADER_HACK” in the “config.inc” file. This will copy the SPIN binaries (I compiled earlier on my Intel machine) to the build directory right after the GCC sources where HG cloned. Thus, the binaries get a newer date then the sources and make will think it has already done the build.

3. Requirements

  • GIT is needed to clone the installer script.
  • A working GCC environment on the host system you are building is required for gcc.
  • Mercurial needs to be installed clone the gcc sources.
  • Internet connection is required since the script downloads all the needed sources.
  • For running the python based loader, python2.6 with py-serial is required.
  • SVN is required to build the open-source-spin-compiler.

If you use a Debian fqlavored OS (e.g. Ubuntu), you easily can install the above mentioned dependencies by executing the following command:

sudo apt-get install git subversion mercurial texinfo flex libncurses5-dev python-serial

4. Getting the Installer Script

The installer script is available on github. You could clone the sources by using the following command:

git clone https://github.com/wendlers/install-propeller-toolchain.git

5. Using the Installer Script

For various user setting see “config.inc”. Note, that the destination (/opt/parallax) could not be changed since the Propeller GCC build scripts hard-coded relay on that.

To build and install the whole tool-chain under /opt/parallax just issue:

./install-propeller-toolchain.sh install

Note: the script may ask you for your root password to make the install dir with “sudo”.

After the script installed everything, you might want to add “/opt/parallax/bin” to your path.

To clean up all temporary stuff use:

./install-propeller-toolchain.sh clean

6. Check the Result

1. Check Propeller GCC

Propeller QuickStart Board running test

Propeller QuickStart Board running test

Change to the “gcctest” sub-directory containing a simple test program which blinks all the build in LEDs of the Parallax Quick-Start board and prints out some message through the serial line. To build the binary do the following:

cd ./gcctest
export PATH=/opt/parallax/bin:$PATH
make

This should produce a “main.elf” binary. Load this to the propellers memory and execute it with:

make load

Note:The loader assumes your Propeller is connected to “/dev/ttyUSB0″. If this is not true, change the makefile.

2. Check open-source-spin-compiler and spin-loader

Change to “spintest/osspin” sub-directory. This contains a simple SPIN program which blinks the LED on
P16. To compile the sources use:

cd ./spintest/osspin
export PATH=/opt/parallax/bin:$PATH
make

This should produce “blinky.binary”. Load this to the propellers memory and execute it with:

make load

Note:The loader assumes your Propeller is connected to “/dev/ttyUSB0″. If this is not true, change the makefile.

3. Check BST Spin Command-line

Change to “spintest/bstspin” sub-directory containing a simple SPIN program which blinks the LED on
P16. To compile the sources use:

cd ./spintest/bstspin
export PATH=/opt/parallax/bin:$PATH
make

This should produce “blinky.binary”. Load this to the propellers memory and execute it with:

make load

Note:The loader assumes your Propeller is connected to “/dev/ttyUSB0″. If this is not true, change the makefile.

4. Check BST Spin GUI

The above SPIN code (blinky.spin) could also be compiled and uploaded to the propeller through the GUI. To start the GUI:

export PATH=/opt/parallax/bin:$PATH
bst

Then, in the file-explorer on the left navigate to the sample code and open it. Then go to compile, to the “Compile” and choose “Compile and Load RAM” to execute your program on the Propeller.

Note: in the editor, check if the font looks “right” otherwise something went wrong withe the installation of the Propeller TTF-font.

7. VIM Syntax Highlighting for SPIN Code

The sub-directory “extra” contains some SPIN syntax high-lightning files for VIM. I found these in the Parallax forums posted by Andrey Demenev. TO use them, simply copy the directories “syntax” and “ftdetect” into your “~/.vim” directory.

VIM SPIN

VIM SPIN

Leave a Reply

You must be logged in to post a comment.