Zatig

Spark Core compiler toolchain under cygwin

There are good instructions how to install the local toolchain to compile the Spark Core firmware. I don’t want to replicate them here. Go to the Spark Core Github and check the Readme.md or search for a tutorial.
The purpose of this page is to show the steps and pitfalls when installing this toolchain under cygwin on a Windows 7 64 bit computer.
I assume you have at least the base cygwin installation on your machine. For instructions please head over to cygwin.org:
Screenshot 2014-04-07 22.05.40
Make sure you install git and any other goodies you like under cygwin.

  1. GCC for ARM Cortex processors – ARM cross compiler tool chain for Windows
  2. Make – Windows version of gmake
  3. Device Firmware Upgrade (DFU) Utilities – Utility to download the firmware to the Spark Core
  4. Zatig – USB driver for firmware downloads

Now install gcc for ARM and gnu make for Windows. Yes, cygwin also includes gmake. However there is a problem with it around dependencies. The MINGW GCC compiler uses Windows path notation in the *.d dependencies files that gmake under cygwin chokes on. So if you, the second time you try to compile, get an error like this:

obj/src/application.o.d:1: *** multiple target patterns. Stop.

it is because we use MINGW GCC under cygwin instead of a native cygwin compiler. You can also checkout a related posts on the Spark Community Board. It is now time to install the firmware. Pull the following three repositories from Github:

git clone https://github.com/spark/core-firmware.git
git clone https://github.com/spark/core-common-lib.git
git clone https://github.com/spark/core-communication-lib.git

These repositories contain all the Spark Core firmware. Once the source code is downloaded, go to the build directory in the firmware folder and start the compile:

cd core-firmware/build
make

If everything went smooth you should now have a core-firmware.bin file.  Run the Zatig program to install the USB driver. The moment has come to flash the firmware into the Spark Core. For this, push the left button to reset the core while holding down the right button. Release the reset button and wait until the RGB-LED is flashing yellow. You can now download the firmware with the following command:

make program-dfu

Screenshot 2014-04-08 03.03.57
Note the DFU utility always indicates an error “Error during download get_status” This is normal and as long as you see “File downloaded successfully” everything is fine.