CLI Compiling does not run

I have a program that runs fine when I build with the web IDE.

I copied the one source file I made along with the source files for one library I used.

I then tried to compile with the command line tools.

I had to modified the include path so the library would work
I also had to add prototypes for all my local functions.

After making these changes the program compiles fine and the bin file is created.

However, when I load this bin file into my electron, the led breathes magenta indicating it is in safe mode.

When I compare the bin files of the web compile and the local CLI compile they are totally different.

Is there something I need to do on the CLI compile to make this work?

– Edit –
I just downloaded the Tinker ino file, compiled on command line, flashed over serial, and it also breathes magenta after reboot

What version of system firmware are you building against in Build?

Do you mean in the CLI? Is there a way to select a firmware version? When I run

particle compile help

there is no option for firmware version

When i said Build i meant the Web IDE :smiley:

The Particle CLI by default will build for system firmware 0.5.3. Most likely your Electron does not have 0.5.3 installed on it, so it enters safe mode (blinking magenta) because it cannot run your newly compiled binary.

You can solve this by upgrading the firmware on your Electron, or by telling the CLI to build for an earlier version of system firmware.

Update using Firmware Manager

Download the Firmware Manager for Mac OS or Windows and use that.

Upgrade using the CLI

If you don’t have the CLI installed, the instructions are here.

Otherwise, make sure your Particle CLI is up-to-date:

Windows:

particle update -g particle-cli

Mac:

sudo particle update -g particle-cli

Then put the Electron in DFU mode (blinking yellow) by holding down RESET and MODE, release RESET and continue to hold down MODE while it blinks magenta, until it blinks yellow, then release.

Then do:

particle update

Build for older system firmware

Or you can use the –target option for the particle compile command, as in:

particle compile electron --target 0.4.8 tinker.ino --saveTo firmware.bin

Thanks, looks like the CLI help is lacking. using the --target switch worked, I currently have 0.5.1 on my device