Pull firmware out of Photon module

Hey everyone,

So I developed some custom code for a customer about 2 years ago and shipped the board/module out to him. Somehow or another I lost the code. He wants another board but I don’t have that code I wrote. His Photon module is still alive and well. Is there any way to pull firmware out of a Photon module so I don’t have to write it again from scratch?

I know, Put it in a repo stupid! What an idiot lol.

If you have physical access to the older Photon, it would be possible to clone it using DFU, including the system and user firmware.

It is not possible to recover the source code for user firmware in any reasonable way.


Thank you @bko
Can you explain a bit more? When you say clone what exactly do you mean? Would I need to have both modules connected to the computer at the same time and then would run some DFU command to clone? What would the DFU-UTIL command be?

1 Like

You will want to connect the working device to USB and put it in DFU mode. The do the following:

dfu-util -d 2b04:d006 -a 0 -s 0x8000000:0x100000 -U fulldump.bin

The connect the new Photon and write that firmware to the new device:

dfu-util -d 2b04:d00a -a 0 -s 0x8000000 -D fulldump.bin

Since this will move the keys from the old device to new, you should then run the CLI particle keys doctor.

1 Like

Thanks @bko I will give it a shot. Going to have the customer return the unit back here so I can do it for him.

Hey @bko
So I just got the module back from the customer. I guess it’s been longer than I thought on this project, turns out the module was a Spark Core, not a Photon.

So…do the dfu-util arguments change if I need to pull the code out of a Spark Core? Also is there any feasible way to put that into a Photon module or do I have to use Spark Cores? I did not use any cloud functionality on the project, System mode was set to manual(or WiFI was just disabled, can’t remember how that worked on Core now).

@IOTrav, the hardware is radically different between the Core and the Photon so you can’t transpose the extracted bin file. Only a Core can be used.

1 Like

Eh…Rain on my parade. I figured as much. Any idea on the flags for dfu-util to pull the binary out of the Core module?

Perhaps @bko can answer that one :wink:

1 Like

The Core has two DFU devices, the internal flash and an external flash chip plus a different USB descriptor, so the command is slightly different:

Read Core firmware:

dfu-util -d 1d50:607f -a 0 -s 0x08005000:0x20000 -U fulldump.bin

Write Core firmware:

dfu-util -d 1d50:607f -a 0 -s 0x08005000:0x20000 -D fulldump.bin

Thanks @bko Will give it a whirl.