I just upgraded to Ubuntu 14.04 and had to set my spark environment back up from scratch. I thought I'd document the process and share it with anyone else attempting to get it running.
Spark toolchain setup for Ubuntu 14.04 (Trusty)
Make sure you don't have the wrong node package installed (
node is for Amateur Packet Radio,
nodejs is the one we want and we'll install that below). Also remove the modemmanager package if you're not using it. It likes to send junk AT commands to the spark core when you first plug it in and takes over the serial port for the first 45 seconds or so. If you've already installed the gcc-arm-none-eabi package, remove it now as well. It doesn't work and will conflict with our installation of gcc-arm-none-eabi below.
sudo apt-get remove node modemmanager gcc-arm-none-eabi
Let's get to it by installing nodejs and some other dependencies!
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install python-software-properties python g++ make nodejs
sudo apt-get install build-essential libusb-1.0-0-dev
Download and install the gcc-arm-none-eabi package:
mkdir -p ~/bin/gcc-arm-embedded && cd "$_"
tar xjf gcc-arm-none-eabi-*-linux.tar.bz2
echo 'export PATH=$PATH:$HOME/bin/gcc-arm-embedded/gcc-arm-none-eabi-4_8-2014q2/bin' >> ~/.bash_profile
At this point, if you run:
You should see something like:
If you don't, check that you setup your shell's $PATH environment variable correctly.
Install the spark command line tools
sudo npm install -g spark-cli
spark cloud login
git clone email@example.com:spark/core-communication-lib.git
git clone firstname.lastname@example.org:spark/core-firmware.git
git clone email@example.com:spark/core-common-lib.git
git clone git://gitorious.org/dfu-util/dfu-util.git
Now compile and install dfu-util
sudo apt-get build-dep dfu-util
sudo make install
Now plug your spark core in via usb. Hold down the mode button and press and release the reset button until the core starts flashing yellow, then release the mode button. Then run:
sudo dfu-util -l
You should see some lines like the following:
Found DFU: [1d50:607f] ver=0200, devnum=2, cfg=1, intf=0, alt=1, name="@SPI Flash : SST25x/0x00000000/512*04Kg", serial="8D91517D5055"
Found DFU: [1d50:607f] ver=0200, devnum=2, cfg=1, intf=0, alt=0, name="@Internal Flash /0x08000000/20*001Ka,108*001Kg", serial="8D91517D5055"
The file core-firmware/src/application.cpp is the default tinker app. You can change it to your own code.
Now you can compile the spark firmware.
Make sure your spark core is in yellow-flashing mode (hold down the mode button and press and release the reset button until the core starts flashing yellow, then release the mode button) and then run the following to flash your firmware!
sudo dfu-util -d 1d50:607f -a 0 -s 0x08005000:leave -D core-firmware.bin
Updated 07/04/2014: No longer installed gcc-arm-none-eabi from packages (too much headache because of conflicts). Install from the tarball.
Updated 07/16/2014: Instructions to remove the
node Amateur Radio Package if installed. It conflicts with nodejs. Minor edits.