Selecting Correct Target

I am working on an electron and am having issues compiling and flashing a basic application.

I’m setting the target via ctrl+shift+p > Particle:Set Target Device to “electron” and I can confirm the value is updated in the workspace file.

However, when I build I still see lots of references to photon and when I try to flash the image via CLI it fails to flash.

ah, perhaps we can find a way to make these commands clearer

Particle: Set Target Platform - which type of hardware are you targeting (photon, electron, etc)?

Particle: Set Target Device - which specific device of yours will you be sending updates to?

Particle: Set Firmware Version - which version of the Device OS you’ll be compiling for?

sounds like you are like me and named your dev hardware the same as what we call platform - e.g. electron, etc.

try running Particle: Set Target Platform and recompiling from there :+1:

1 Like

Maybe not only clearer but rather have Set Target Device implicitly/automatically also select the correct platform :wink:

1 Like

haha! good point @ScruffR thanks :+1:

Thanks that helps clear that up, however I am still unable to flash the compiled binary to my electron. Any thoughts on why that might be?

> particle flash --serial .\testApp.bin
! PROTIP: Hold the SETUP button on your device until it blinks blue!
? Press ENTER when your device is blinking BLUE
sending file: .\testApp.bin
Error writing firmware: Transfer cancelled

Try via DFU Mode and particle flash --usb ./testApp.bin -v
You can also check the binary via particle binary inspect testApp.bin to see what platform it’s targeted at.
And also check the device via particle serial inspect (in Listening Mode) to make sure the bootloader isn’t out of sync with your device OS (you can post the output for us to have a look).

Thanks, that helped. It was still compiling for photon for some reason. I had to delete the target folder and build again to have it targeted at the electron.

1 Like

The solution provided in post #2 is now outdated
All Particle: Set * commands have been replaced with Particle: Configure Workspace for Device

Or you just manually add/edit the following entries in the .code-workspace file

    "settings": {
        "particle.targetDevice": "yourDeviceName", # optional 
        "particle.firmwareVersion": "0.8.0-rc.27",
        "particle.targetPlatform": "yourPlatform" # any of [ photon | p1 | electron | argon | boron | xenon ]

If the required toolchain is missing it will be downloaded automatically when the workspace file gets saved.

1 Like