Particle Offline Compiler
apm install particle-offline-compiler
An Atom / Particle Dev package for 100% offline code compilation for Particle Devices.
For situations where you need to compile and test Particle projects locally, and keep to a streamlined workflow.
This should be compatible with projects that connect to Particle.io, or if you’re deploying your own local cloud.
particle local compiler
Install the Particle local compiler (full instructions here), including dependencies.
This package also assumes that you have the latest
particle-cliinstalled on your system – this will be required for OTA updates (coming soon)
To install particle-cli:
$ npm install -g particle-cli $ particle cloud login
atom / Particle Dev > Preferences > Install, search for
particle-offline-compiler and install it.
Before using it, open up the settings on the package, and enter the Particle Compiler Path – this should point to the location where you downloaded and compiled the particle local compiler (see instructions above). The Device Type and Serial Port can be left empty, as they can be set easily in the Particle.offline user menu.
Once installed, you should see a Particle.offline menubar with self-explanatory options listed.
- If you’re using the package in atom, ensure the following:
.cppfile extensions, not
#include "application.h"at the top of your main
*.cpp/*.hlibraries should be in the same folder as your main
- declare your C prototypes manually, either in a
.hfile of the same name as the main
.cppfile, or alternatively at the beginning of your main
[refresh DFU serial device list]menu item under
Particle.offline > DFU serial portneeds to be manually refreshed to get the latest list of serial devices connected to your computer.
- If you are connecting multiple Particle devices to your computer at any one time, be sure to double-check the serial port that you are uploading to!
Compile locally + DFU uploadto compile and upload your code. You might want to toggle the Console first to see the progress of the compilation and spot errors.
OSX – Important note on environment variables:
In order for all of your PATH environment variables to be picked up, launch Atom from the terminal:
$ open -a "/Applications/Atom.app"
or, if you have already installed the Atom Shell commands:
If you’re using Particle Dev, launch the application similarly from Terminal:
open -a "/Applications/Particle Dev.app"
If you skip this step, the compile will not be able to find
arm-none-eabi-gcc in your PATH environment variable, as the standard PATH launched from a Finder instance of Atom most likely excludes the gcc compiler location (default: /usr/local/bin).
Work in progress!
This is a work in progress.
At this point the package is only tested on OSX Yosemite, Atom 1.0.3+ and Particle Dev 0.0.25. YMMV.
Dfu-util has a bug where the conclusion of every firmware upload presents
STDERR: dfu-util: Error during download get_status, despite the firmware uploading OK. This can be safely ignored.
* Automatic DFU (Core/Photon) upload of firmware works – no need to put your device manually into DFU mode
* (to implement) Core OTA updates
* (to implement) Photon OTA updates, currently not supported in the 0.4.3rc2 firmware of the Photon devices for local clouds, so we’ll have to wait until Particle releases a major update to
Wait, isn’t there Particle Dev that does the same thing?
Yes and no. Particle Dev, which was built on top of Atom Shell a.k.a. Electron, is a fantastic project that addresses a specific need – quick, easy local development (and storage) of code, with firmware builds/uploads still routed through Particle.io for ease of use. This same ease of use presents workflow obstacles when it comes to local cloud development, and slows down development massively.
This package was developed to improve workflow bottlenecks of the existing official Particle IDEs (Build Web IDE and Particle Dev).
If you encounter any of these scenarios, I hope this package will be of help:
You are developing a local cloud. Your current means of uploading new firmware is a combination of a) writing code in the Build Web IDE / Particle Dev, b) downloading the .bin files manually, before c) using
particle-clito send OTA updates to your Core(s), or perhaps, via DFU to your Photons. It’s a slow process switching through these tasks just to get firmware uploaded.
You want to try out the latest firmware releases from Particle.io and/or custom code libraries, but the Build Web IDE is still pegged to earlier, stable builds (for good reason), leaving you to build your own local compiler, but without a streamlined way to upload your binaries to your devices.
It’s worth noting that Particle Dev (and the Particle platform at large) goes through continuous development, and will eventually implement much better development workflows. This tiny Atom package might be helpful for those who want an immediate, interim solution to a faster workflow for local-cloud and/or offline Particle projects.