Building Spark Core firmware locally

I have recently started a couple of projects based on the great Spark Core board. Hopefully I will be able to talk about them here soon.

The Spark Core

The Spark Core (courtesy of

The Spark Core is a development board based on the STM32F103CB, an ARM 32-bit Cortex M3 microcontroller by ST Microelectronics (the same you can find in the new Nucleo platform by ST) that was crowd-funded through a kickstarted campaign. But there are some big things about this board.

  • First, it comes with a CC3000 WIFI module by Texas Instruments, which is the shiny new kid on the block. Adafruit has the module available in a convenient breakout board.
  • Second, it is Arduino compatible in the sense that it implements the wiring library, that is, you can port Arduino projects to this board with little effort.
  • Third,, the company behind the Spark Core, has developed a cloud based IDE you can use to write your code and flash it to your Spark Core Over the Air (OTA).
  • And fourth, you can communicate with your Spark Core with a simple API through the cloud, exposing variables and invoking methods.

It is really awesome, and it works!

Now there are similar solutions, even for the Arduino platform, like or the mbed Compiler, but they don’t pack all the features Spark Core does, and the hardware they require is more expensive and sensibly bulkier.

The team at is very involved and active so I foresee a great future for their solution, but there are still lots of things to polish. They are facing some criticism due to the fact that the Spark Core has to be connected to the cloud in order to work, that means it needs a WIFI connection and Internet access. Besides, that also means that all the communications have to pass through servers. But this will soon be only optional. On one hand they are refactoring the code to remove the requirement for the Spark Core to be connected at all, and on the other hand they are about to release their cloud server under an open source license (the firmware is open source already) so you could have your own cloud in your own server. The release of their cloud server will be a major event. The Spark Core strength lies on the possibility of flashing it remotely and the API to execute methods and retrieve values.

In the mean time I have to say that building and flashing the code remotely is slow… If you are like me and want to code small iterations and build frequently it is a bit frustrating… But since the firmware is open you can build it locally.

The Spark Core firmware is split into 3 different repositories: core-firmware, core-common-lib and core-communication-lib, totaling almost 500 files and more than 336k lines (including comments, makefiles,…). It is big. To build your own firmware you have to modify/add your files to the core-firmware project. This means having copies of this repository for every single project you are working on. And this repository alone is +187k lines of code. If you use a code versioning system for your code (GIT, SVN,…) you have two main options: forking and have big repositories or ignoring a bunch of files (but having the whole firmware code in the working copy, presumably outdated). Not good.

So I decided to go the other way round. Projects with just the minimum required files and a way to transparently “merge” and “unmerge” a single core-firmware folder with my project. I have created a small bash script that does that and allows you to build and upload the code from the command line without leaving you project folder.

I don’t know if I am reinventing the wheel but “my” wheel is making me save a lot of time. I can manage my build from within my favourite IDE (vim) keeping the main core-firmware folder clean and up to date.

The code is in the spark-util repository at bitbucket. The README file explains the basics of it and provides some use cases.

Any comment will be very welcomed.

CC BY-SA 4.0 Building Spark Core firmware locally by Tinkerman is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

3 thoughts on “Building Spark Core firmware locally

  1. Bobby Cooper

    I like what you are doing creating a streamline option for Spark Core firmware compiling. Did I say that right ? I an very new to working with microprocessor firmware.

    Another aspect I like about the Spark Core is I can control all Analog & Digital pins an set there use (Write or Read) using jquery Post Statements with very minimal code added to the main Spark Core core-firmware. This is best suited behind a firewall on a local network as the http post statements sent to the Spark Core API transmit the access token number with each post.

    One drawback that may turn off some MCU users (in my opinion) is a current issue of not being able to run a Spark Core program without being connected to either a local API cloud or the Spark API cloud. Not speaking for the Spark Team but, I hear they are working on a fix for the near future.

    The real awesomeness of the Spark Core lies within its small footprint; the cost of only $39 for a wifi enable MCU; and the excellent spark team and spark core community help at every level. I have used others, I will stay with the Spark Core. Now, if I can only put the API in my rocket ship, my core can act as the guidance system 🙂

    Disclaimer: I am only a user of the Spark Core with NO connection with the company who developed it or its distributors.

  2. kay

    Hi, I am looking to buy a spark core or implement something similar using the CC3000 wifi chip for some home automation but I really want something locally managed with no cloud involvement as these are simple home projects for controlling multiple things. Does this code u created allow you to manage your core locally without the cloud servers? Also what is involved?

    1. xose Post author

      I’m sorry but this script was meant to help people build their code locally (that is compile it, link it and upload it to the board).
      Soon after I released it the Spark team released the Spark CLI which does more or less the same plus many other things. One of the features of the Spark CLI script is that it allows you to set up a “local cloud”, so you can connect your Core to a server in your network without going out to the Internet. Maybe that feature might help you? Look for “local cloud” in the forums.


Leave a Reply (all comments are moderated, be patient)

This site uses Akismet to reduce spam. Learn how your comment data is processed.