C Development for SpiNNaker

Follow me on GitHub

The version described here is no longer supported.

Home page for current version

This guide is intended to help you set up your development environment so that you can write C code and compile binaries to be run on SpiNNaker.

To set up your development environment:

  1. Install Development Dependencies
  2. Install Spinnaker Tools
  3. Optional: Install spinn_common Library (for additional utility, mathematical and efficiency library functions)
  4. Optional: Install ybug (for command-line debugging)
  5. Optional: for compiling the documentation of c Install Doxygen

Once you’ve got a working development environment:

Install Development Dependencies

Primarily, you will need to install a C compiler that is compatible with SpiNNaker. At present, we recommend using gcc for this. Instructions for installing this on your system are below, depending on which platform you are using, as well as instructions for installing Perl, which is used by the development tools to modify the generated binaries to run on SpiNNaker:

Development Dependencies for 64-bit Ubuntu

  1. Install 32-bit libc
    sudo apt-get install libc6-i386
  2. Install perl and dependencies
    sudo apt-get install perl perl-tk libterm-readline-gnu-perl
  3. Follow the instructions for the Linux C Compiler

Development Dependencies for 64-bit Fedora

  1. Install 32-bit libc
    sudo yum install glibc.i686
  2. Install perl and dependencies
    sudo yum install perl perl-Tk perl-Term-ReadLine-Gnu
  3. Follow the instructions for the Linux C Compiler

Development Dependencies for 32-bit Ubuntu

  1. Install perl and dependencies
    sudo apt-get install perl perl-tk libterm-readline-gnu-perl
  2. Follow the instructions for the Linux C Compiler

Development Dependencies for 32-bit Fedora

  1. Install perl and dependencies
    sudo yum install perl perl-Tk perl-Term-ReadLine-Gnu
  2. Follow the instructions for the Linux C Compiler

Linux C Compiler

  1. Download CodeSourcery GCC ARM EABI Compiler
  2. Extract the downloaded archive to the location of your choice
  3. Add the “bin” directory within the installed location to the PATH enviroment variable in .profile in your home directory e.g. append the following:
    export PATH=$PATH:<install-location>/bin
    where <install-location> is the place where you extracted the file.

Development Dependencies for Mac OS X

  1. Install the arm-none-eabi toolchain
    sudo port install arm-none-eabi-gcc
  2. Install perl and dependencies
    sudo port install perl5 p5-tk p5-term-readline-gnu
  3. Optional: Install Xcode and all its development tools from here NOTE: take into account your Mac version.

Development Dependencies for Windows

  1. Download the prepackaged MinGW Environment
  2. Extract the downloaded archive to the location of your choice
  3. Create a shortcut to MinGW/msys/1.0/msys.bat and add it to your start menu

You can now use the msys.bat to start up an environment from in which you can compile C code for SpiNNaker.

SpiNNakerTools Installation

  1. Download the current version of SpiNNaker Tools as a zip or as a tar.gz
  2. Extract the archive to the location of your choice.
  3. Create an environment variable SPINN_DIRS that points at the location of the extracted archive (note that in Windows, this should be the MinGW Posix path e.g. if you have extracted the archive to C:\SpiNNaker-Tools\, you should set the environment variable to /c/SpiNNaker-Tools).
  4. Run make in the root directory of the extracted archive.

spinn_common Library Installation

The spinn_common library will be installed into the SpiNNaker Tools installation directory, as set up above.

  1. Download the current version of spinn_common as a zip or as a tar.gz.
  2. Extract the archive to the location of your choice.
  3. In the directory of the extracted archive, run make.
  4. Run make install.

SpiNNFrontEndCommon Library Installation

The SpiNNFrontEndCommon library will be installed into the SpiNNaker Tools installation directory, as set up above.

  1. Download the current version of SpiNNFrontEndCommon as a zip or as a tar.gz.
  2. Extract the archive to the location of your choice.
  3. In the c_common directory of the extracted archive, run make.
  4. Run make install.

YBug Installation

  1. Download the current version of ybug as a zip or as a tar.gz.
  2. Extract the archive to the location of your choice.

If you want to avoid having to run “source setup” in the ybug folder every time you log in or start a new terminal:

  1. Add the extracted ybug folder to your PATH environment variable
  2. Add the extracted ybug folder to your PERL5LIB environment variable (or create this environment variable if it is not already set)
  3. If you are going to boot your board using ybug, create a new environment variable YBUG_PATH and set this to the boot subdirectory of the extracted ybug folder.

To run ybug:

  1. If you haven’t added the environment variables detailed above, go into the directory where you extracted the archive and run:
    source setup
  2. Run:
    ybug <ip-or-host>
    where <ip-or-host> is the ip address or hostname of your SpiNNaker board.
  3. Type help to get further usage instructions.

Doxygen Installation

Ubuntu Linux sudo apt-get install doxygen

Fedora Linux sudo yum install doxygen

Mac OS X sudo port install doxygen

Windows follows these instructions

spinnaker_tools Build System Usage

When using the makefiles supplied in this repository, you must set up a number of environment variables using:

$ cd spinnaker_tools  # You must be in the spinnaker_tools directory!
$ source setup

You should also ensure you have compiled the SpiNNaker libraries as described above otherwise application compilation will fail.

Basic Application Compilation

To quickly compile a simple single-file application for SpiNNaker, you can use the following command:

$ make -f $SPINN_DIRS/Makefile.app APP=example

This will compile the application in example.c and produce a SpiNNaker binary called example.aplx in the current directory.

Example Makefile

Though the above is suitable while prototyping applications, real-world applications may contain many source files and should be compiled using their own makefile.

Makefile.example in the root of the spinnaker_tools repository provides an annotated Makefile template which compiles simple C programs for SpiNNaker using these tools. Once your makefile is set up, your application can then be compiled by calling:

$ make