I’ve been building a lot of Particle projects recently on the command line rather than using the cloud IDE, so I figured I’d share my boilerplate app template for new Particle projects:
The web IDE is awesome, but there are many situations where it is more convenient to use your desktop text editor, or to pull in libraries and other source code you already have on your computer.
- Organize your code however you like in the
- Include libraries as git submodules in the
- Build with
- Install via USB (with auto switch to DFU mode) with
- Install via the cloud with
Would love any feedback, comments or PRs!
Though flashing via DFU and Cloud is already supported by the firmware makefile itself
Of course this separates the user firmware and the base firmware which is pretty useful.
Since building using the firmware makefile requires a ton of steps, and Particle is meant to be a great platform for beginners, I built this to avoid having to pull down the firmware repo and install all the dependencies.
I’m hoping that one day Particle will come to the awesome PlatformIO to make this process much easier in future.
@loopj This sounds interesting.
I have attempted to build locally by using a automated installer Toolchain for Windows Installer
Using that installer one or 2 of the programs that are part of the whole package of programs has a error and did not install which leaves me having to install it properly manually which I have not done yet.
I’m looking for the easiest way to compile locally to use the latest firmware that is not official firmware yet. There is a Sleep function bug fix that I want to test out and building locally is the only way to do it. I also want to be able to setup Webhooks.
So what your sharing sounds like a easier path to build locally.
Pardon my ignorance at this point but will what your offering allow me to build locally without all the programs that the Auto installer here is trying to install? Toolchain for Windows Installer
Any advice is appreciated
@RWB, the tool uses the Particle CLI so there is no “local” compiling since the CLI uses the Cloud compile servers. For true local compiling, you still need to install a local toolchain.
I like to have true local compiling and flashing of the firmware via USB. Also I like a debugger.
In PlatformIO I am able to make a custom_boards.json and put it in .platformio/boards.
At this time I have the following inside the custom_boards.json:
It automatically installs the toolchain for the ARM, probably need to add some stuff to automatically install dfu-util. Now I need to know what the absolute minimum source is to build and flash it in the photon.
How do you autoswitch to DFU mode? I noticed this in the make file, how does it work?
enter-dfu-mode: ## Enter DFU mode on the attached USB device
-stty -f /dev/tty.usbmodem1411 14400
I saw that the particle CLI is using the dfu-util to flash the code.
see: https://github.com/spark/particle-cli/blob/master/lib/dfu.js at line 129 writeDfu.
Any suggestion to make this work?
A little update
“extra_flags”: “-DSTM32F2 -DSTM32F2XX -DSTM32F205xx”,
I need a correct linker file but the linker file are deeply nested for the photon so it is not clear what settings I need.