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:
- Install Development Dependencies
- Install Spinnaker Tools
- Optional: Install spinn_common Library (for additional utility, mathematical and efficiency library functions)
- Optional: Install SpiNNFrontEndCommon Library (for front-end development support)
- Optional: Install ybug (for command-line debugging)
Once you’ve got a working development environment:
spinnaker_tools
Build System Usage- See-Also
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 Linux
- Development Dependencies for 64-bit Fedora Linux
- Development Dependencies for 32-bit Ubuntu Linux
- Development Dependencies for 32-bit Fedora Linux
- Development Dependencies for Mac OS X
- Development Dependencies for Windows
Development Dependencies for 64-bit Ubuntu
- Install 32-bit libc
sudo apt-get install libc6-i386
- Install perl and dependencies
sudo apt-get install perl perl-tk libterm-readline-gnu-perl
- Follow the instructions for the Linux C Compiler
Development Dependencies for 64-bit Fedora
- Install 32-bit libc
sudo dnf install glibc.i686
- Install perl and dependencies
sudo dnf install perl perl-Tk perl-Term-ReadLine-Gnu
- Follow the instructions for the Linux C Compiler
Development Dependencies for 32-bit Ubuntu
- Install perl and dependencies
sudo apt-get install perl perl-tk libterm-readline-gnu-perl
- Follow the instructions for the Linux C Compiler
Development Dependencies for 32-bit Fedora
- Install perl and dependencies
sudo dnf install perl perl-Tk perl-Term-ReadLine-Gnu
- Follow the instructions for the Linux C Compiler
Linux C Compiler
- Download CodeSourcery GCC ARM EABI Compiler
- Extract the downloaded archive to the location of your choice
- 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
- Install the arm-none-eabi toolchain
sudo port install arm-none-eabi-gcc
- Install perl and dependencies
sudo port install perl5 p5-tk p5-term-readline-gnu
- Optional: Install Xcode and all its development tools from here NOTE: take into account your Mac version.
Development Dependencies for Windows
- Download the prepackaged MinGW Environment
- Extract the downloaded archive to the location of your choice
- 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
- Download the current version of SpiNNaker Tools as a zip or as a tar.gz
- Extract the archive to the location of your choice.
- 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). - 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.
- Download the current version of spinn_common as a zip or as a tar.gz.
- Extract the archive to the location of your choice.
- In the directory of the extracted archive, run
make
. - Run
make install
.
SpiNNFrontEndCommon Library Installation
The SpiNNFrontEndCommon library will be installed into the SpiNNaker Tools installation directory, as set up above.
- Download the current version of SpiNNFrontEndCommon as a zip or as a tar.gz.
- Extract the archive to the location of your choice.
- In the
c_common
directory of the extracted archive, runmake
. - Run
make install
.
YBug Installation
- Download the current version of ybug as a zip or as a tar.gz.
- 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:
- Add the extracted ybug folder to your
PATH
environment variable - Add the extracted ybug folder to your
PERL5LIB
environment variable (or create this environment variable if it is not already set; note that in Windows, this should be the MinGW Posix path e.g. if you have extracted the archive to C:\ybug\, you should set the environment variable to /c/ybug) - If you are going to boot your board using ybug, create a new environment variable
YBUG_PATH
and set this to theboot
subdirectory of the extracted ybug folder.
To allow history of commands ran in ybug using normal arrow keys on a mac. Follow the following instructions:
- sudo port install rlwrap
then prepend rlwrap to the ybug commands described below to run correctly.
To run ybug:
- If you haven’t added the environment variables detailed above, go into the directory where you extracted the archive and run:
source setup
- Run:
ybug <ip-or-host>
where<ip-or-host>
is the ip address or hostname of your SpiNNaker board. - Type
help
to get further usage instructions.
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