Can't locally compile Firmware for Electron [SOLVED: different dfu address]

Hi guys,

I am trying to compile firmware for Electron. My problem is that even though my code compiles successfully, and is flashed to my Electron with dfu-util successfully, it is not evident that the code has been updated.

Here is an example of how I am compiling my firmware. (This happens inside of my script.):

make all -s -C github/firmware APPDIR="$HOME/electron-project/firmware" TARGET_DIR="$HOME/electron-project/bin" PLATFORM="electron"

I then upload my code with dfu-util:

dfu-util -d 2b04:d006 -a 0 -i 0 -s 0x080A0000:leave -D "$CWD/bin/firmware.bin"

Code flashes successfully…
Electron reboots…

But firmware on device has not changed.

Why is this happening? I have tried compiling on latest and develop and I get the same issue.

If I compile my firmware in the cloud and then flash with dfu-util it works fine.

particle compile electron firmware/

Hi @nrobinson2000

This can happen when the version of the system firmware (parts 1 & 2) does not agree with the version required by the app you are compiling for the user firmware.

If you put the device in listening mode and type “v” you can see the system version.

https://docs.particle.io/support/troubleshooting/troubleshooting-tools/electron/#display-system-firmware-version

Once you are compiling locally, as you are, you can just build system parts 1 and 2 and flash them as well.

Hi @bko
I just tried that. Got

system firmware version: 0.5.0

Should I be using a branch other than latest?

I just tried recompiling and flashing parts 1 and 2 on the release/v0.5.0 branch, but I am still experiencing this issue.

No latest should correspond to 0.5.0 right now (but develop is ahead).

Are you sure you dfu-util address range is correct? That looks like the address for the Photon app area but I think Electron is different (and I see that doc section is blank for Electron!).

I don’t have an Electron handy to test right now but I would run the CLI command and pay attention to the exact dfu-util command to be sure.

I just tried particle flash --usb bin/firmware.bin
It turns out that it does use a different dfu address for an Electron.

spawning dfu-util -d 2b04:d00a -a 0 -i 0 -s 0x08080000:leave -D bin/firmware.bin

2b04:d00a

It works now.

UPDATE: Updated my script with this fix

1 Like

BTW, if you build a develop branch you’d need to add PARTICLE_DEVELOP=1

Yeah, I read this in the firmware documentation.

Hi @nrobinson2000

I wanted to point out that there is a make target program-dfu that does everything you want.

make clean all program-dfu ...

Thanks. I read this in the documentation and I use it in my script for recompiling the system firmware. When compiling the user firmware I prefer using my own method.

If you’re only rebuilding your own user app firmware, and you have previously built all, you can save a significant amount of build time by building from the firmware/main directory. You use the same make options as normal, and you can either flash the resulting binary or use the program-dfu make option.

1 Like