How to install the spark toolchain in Ubuntu 14.04

Thanks @Dave! One of my buddies had helped me complete it recently :smile:!

1 Like

I was able to make this work in Linux Mint 16.
The main problem I had was this error :

arm-none-eabi-gcc
bash: /home/david/bin/gcc-arm-embedded/gcc-arm-none-eabi-4_8-2014q2/bin/arm-none-eabi-gcc: No such file or directory

Turns out it was because I have 64-bit linux, so I installed the ia32-libs metapackage and then it worked.

2 Likes

Hi @Hypnopompia

Were you able to get Serial.println to work in Ubuntu 14.04 ?
I have tried with :

sudo screen /dev/usb 9600

but I get the error :
Cannot exec ‘/dev/usb’: Permission denied
[screen is terminating]

@Rockvole, Try this:

sudo screen /dev/ttyACM0 9600
2 Likes

Thank-you @Hypnopompia - that worked.

I needed some help from this page also to get it to work:
http://forums.linuxmint.com/viewtopic.php?f=90&t=135914

I had a problem trying to install the spark-cli on Ubuntu Server 14.04. I’m going to give my solution just in case anyone else encounters the same problem.

Problem: node-pre-gyp uses node instead of nodejs, so the following package didn’t install

> serialport@1.4.5 install /usr/local/lib/node_modules/spark-cli/node_modules/serialport
> node-pre-gyp install --fallback-to-build

/usr/bin/env: node: No such file or directory
npm info serialport@1.4.5 Failed to exec install script
npm info /usr/local/lib/node_modules/spark-cli/node_modules/serialport unbuild
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

This occurred even after I had removed node

The fix is to use a symbolic link:

sudo ln -s /usr/bin/nodejs /usr/bin/node

After creating the symlink, installing the spark-cli succeeded.

1 Like

Hey guys I am stuck on this part. I am using Linux Mint.

 cd dfu-util
sudo apt-get build-dep dfu-util
./autogen.sh
./configure
make
sudo make install
cd ..

When I run the cmd. sudo apt-get build-dep dfu-util I got an error that says

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to find a source package for dfu-util

I am having issues to install this utility even on windows thats why I tried to do it on Linux, any help is appreciated
Thanks

Rather than all that initial faffing with tarballs and PATHs to make sure you’re using the right version of gcc-arm-none-eabi, you can instead just

$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-add-repository ppa:terry.guo/gcc-arm-embedded
$ sudo tee /etc/apt/preferences.d/terry_guo-gcc-arm-embedded # copypasta the next 3 lines, then press Ctrl-D
Package: *
Pin: release o=LP-PPA-terry.guo-gcc-arm-embedded
Pin-Priority: 1000
$ sudo apt-get update
$ sudo apt-get install nodejs gcc-arm-none-eabi

Then continue on from ‘Install the spark command line tools’.

Also, instead of cloning dfu-utils and building it from source, I was able to install version 0.8 (effectively as recent as you’re going to get from the git repository) by selecting the most recent build for my architecture, downloading the .deb at the bottom of the page and:

$ sudo dpkg -i dfu-util_0.8-1_amd64.deb

Since it’s such a simple package it doesn’t depend on anything that’s not already in Trusty.

3 Likes

Hey I’m a Linux beginner and I just wanted add something I had trouble with in the hopes that I can spare someone a headache. I was having trouble adding arm-none-eabi-gcc to my$PATH variable. Turns out I needed to add the following line to my ~/.bash_rc instead of ~/.bash_profile as instructed above to save the path permanently:

export PATH=$PATH:$HOME/bin/gcc-arm-embedded/gcc-arm-none-eabi-4_8-2014q2/bin

According to this it has to do with login shells vs. non-login shells. Anyway it worked after I added it to the other file.

Thanks so much for this tutorial! I would never have got this working without it.

Note that dfu-util is moving. I got a clone from:

git clone git://git.code.sf.net/p/dfu-util/dfu-util dfu-util

Thank you for documenting this!

I got stuck at cloning the spark git repos until I cloned them using https like this (yup, took this from the spark github):

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

other than that, I am happy to be able to flash the core from my Ubuntu laptop!

again, thanks a bunch! :smile:

I think we need a new place to find this source, this is asking for a username and password
This whole thing is already quite the bundle of steps never mind signing up for new version control services
… I’ll look around

I ended up just downloading the dfu-utls zip from sorceforge, and compiling from that.
Unfortunately all in vain, flashed the latest build of the firmware, but no dice on my network,
I have no router access where I’m at right now, only wireless AP access,
port or protocol the spark is using is probably blocked, just like everything else here…

works with my phone hotspot… but that doesn’t help me make my own lockatron.
Anyhow on to the next project.

Just a note though: an hour plus to set up the particle-cli is a bit excessive, most folks would give-up, maybe 5 steps in.
I second the motion for not needing the second repo, my running instance of node worked, unless the repo is
for other things?
Might want to make a shell script for this whole thing and just wait for folks to report back when it enviably stops working two months later.

also - git clone git://**** has never worked for me, the https links always work. (when the repo still exist)

Thanks for the detailed instructions! I appreciate it

I should have read this, scrolled too far down

Now that Spark is now Particle, how do the instructions above change ?

Is there a way to just run everything, instead of typing every line in one-at-a-time ?

I am a noob and I find all this typing confusing.

Looks like the most recent one for ubuntu 14.04 is obtained via:
sudo apt-get install gcc-arm-none-eabi=4.9.3.2015q3-1trusty1

There’s a script, though it’s still a work in progress that will do the full set up of dependencies on Mac and Linux (debian/ubuntu based):

http://po-util.com/

It will pull down everything you need and build it.

1 Like

That looks handy, but I’d suggest not promoting doing such commands as

curl po-util.com/download | bash

See these two articles:

https://www.seancassidy.me/dont-pipe-to-your-shell.html

3 Likes

Also available as a handy dandy utility script.

1 Like

As TJ has pointed out - there might (to say the least :wink:) be vulnerabilities in that script that could be exploited by not-so-well-meaning beings.
So everybody is free to use that script, but please handle with care - it’s a question of convenience vs. security