Local RPi firmware development

If you want to contribute to the Particle on Raspberry Pi firmware here are some instructions to compile for the Raspberry Pi from your computer.

All the build tools needed are bundled in a Raspberry Pi buildpack. This buildpack runs on Docker. This is so we don’t need special instructions on how to get the right version of GCC and other tools for macOS, Windows and Linux.

  • Install Docker on your computer. These steps will vary depending on your OS.

  • Clone the Particle firmware at the Raspberry Pi branch. Later on we’ll merge this back to the firmware develop branch.

git clone -b feature/raspberry-pi https://github.com/spark/firmware

  • Create a directory for your app with at least one .cpp file.

  • Compile your app to an executable.

In your app directory run:

docker run --rm -it -v ~/Programming/firmware:/firmware -v $PWD:/input -v $PWD:/output particle/buildpack-raspberrypi

You’ll need to change ~/Programming/firmware to where you cloned the firmware.

This will run make from the firmware/main directory which compiles the firmware and saves the output as firmware.bin in your app directory.

To customize the build, write out the make command at the end of the docker run. For example, to rebuild from scratch you can do:

docker run --rm -it -v ~/Programming/firmware:/firmware -v $PWD:/input -v $PWD:/output particle/buildpack-raspberrypi make clean all

See the firmware build docs for info on various parameters that can be passed to the build. Not all of them are relevant for the Pi, for example, there are no system and user modules on the Pi, only a single executable.

If you’re on Linux or macOS, you can use this shell script as a shortcut:

On Windows, it’s best to clone the firmware and save your app in C:\Users since this folder is available by default inside Docker. Other folders need some custom mapping.

docker run --rm -it -v /c/Users/%USERNAME%/rpi/firmware:/firmware -v /c/Users/%USERNAME%/rpi/my_app:/input -v /c/Users/%USERNAME%/rpi/my_app:/output particle/buildpack-raspberrypi

  • Flash the firmware to your Pi

particle flash mypi firmware.bin


po-util – a tool I developed for Linux and macOS to simplify offline Particle Development – can now build firmware and flash binaries for Raspberry Pi.

It supports project directories and lets you do many other things with your Particles.



1 Like

thanks for this. I was able to get this going first try.

rare for me when it comes to docker!

1 Like