DFU-UTIL for Photon

Hey everyone,

So I have some new Photons here I am ready to start playing with. I have been writing firmware and developing for the older Spark Cores for a while now and know my way around pretty well.

My development setup is Eclipse on a Mac and I really like it. I use external tools in Eclipse to flash my firmware to the module via DFU-UTIL. Previously the arguments passed to DFU-UTIL for flashing the Spark Core were:
-d 1d50:607f -a 0 -s 0x08005000:leave -D core-firmware.bin

Can anyone tell me the required arguments for flashing to the Photon? I know the device id/address is 2b04:d0006 but not sure about the firmware flash start address which was previously 0x08005000 I notice this address is not writable on the new module so I assume it is write protected with Particle recovery firmware.

Other than the flash start address is there anything else I would have to change really to flash my old Spark firmware onto Photon modules? I apologize if this info is easily accessible elsewhere but I did not see it after scanning for about an hour.

Thanks guys!

dfu-util -d 0x2B04:0xD006 -a 0 -s 0x80A0000:leave -D [firmware-name].bin

1 Like

Thank you so much @jakeypoo!!!! thats it! Flashing no problem now. Is this documented somewhere for future users?

Somewhat, Photon/P1 Memory Map
Documentation for the new hardware is still coming together.

By default there are 3 parts to the firmware for the photon - 2 system parts and 1 user part. Each part (obviously) gets loaded at a different address.

There is a make flag that forces the generation of a single monolithic image, see this thread

You might want to try and use the program-dfu target of the makefile(s) - that will ensure that all the relevant pieces match and takes care of the addresses that each gets loaded at.

I run under linux, and did have to make sure dfu-util could run as non-root in order for these make targets to work correctly - your mileage under OSX may vary, but I recommend taking the effort to do that if you can; that way if things get moved around later, you won’t have a problem.

isn’t it just “make flash” these days, no need to directly call dfu-util, maybe pass in PLATFORM=photon ?

This is a good “official” reference for dfu-util:

I guess my original other question of do I need to change anything else is a yes. It appears my old Spark firmware is not compatible with the new Photon module. It seems the file structure has changed a bit on the new Photon. Anyone setup eclipse to flash to a Photon yet?

How are you building your binaries?

Hey @jakeypoo

In Eclipse I use External tools configuration to call dfu-util just like you would from the command line passing it the arguments we hashed out earlier. However I notice that if I flash my current binary to the module it does not work because it doesn’t run. So what is required to change over to Photon? Just a different Make? In my original setup I did something similar to this(specific to mac but similar none the less):


I have core-common-lib, core-communications-lib, and core-firmware all in my project explorer. Maybe I am just way off. I have no idea.

@IOTrav I see.

You would need to set up the build to compile from a different set of source code.

The semantics of the make file are different as well. It’s documented in the readme.md

@jakeypoo

I pulled in the latest develop branch from the github repo earlier and have been futzing around with it. Being a completely different file structure I of course have questions. Does this repo have any other dependencies as the Spark core-firmware did with core-common-lib and core-communication-lib or is it all self contained?

If it is all self contained what application runs on boot up? It use to be src/application.cpp in the old core-firmware project.

Thanks for all the help! Perhaps Ill put together a tutorial for this if I can get it working.

The firmware repo is completely self-contained (yay!)

I’ll get the details wrong if I try, but I believe it can build apps (e.g. specifying “APP=tinker” on the make command line.)

I’ll let the architects of the makefile describe the details and options, I’m sure they are watching…

1 Like

Please see the documentation in the repo. It describes the dependencies, layout and how to build and flash firmware.

Thank you @mdma, @AndyW and @jakeypoo

Just a few more questions.

  1. When performing make for a Photon device do I need to pass the PLATFORM=photon argument when performing make?
  2. What directory should make be performed in? Modules or Main?
  3. After this make is performed in the proper directory for photon where will the .bin file be generated we need for flashing to the Photon? I do see files called user-part.bin, user-part.elf, etc being generated in the /build/target/platform-6-m directory. Is user-part.bin the binary I would flash to the controller like we did with core-firmware.bin? If not where is the equivalent to core-firmware.bin generated?

Thanks everyone!

  1. Yes. You need to tell make what platform you are targeting.
  2. The link @mdma referenced above spells out the effect of building in various directories.
  3. I’ve let go of some of the details and learned to embrace program-dfu as a target, it just does it’s thing as long as my (photon|core) is in dfu mode. If you really want the gory details, I’ll defer to @mdma

Thank you @AndyW

I am not opposed to doing what you suggest at all. I however have become quite lazy in Eclipse and like clicking a single button to flash the firmware to the module(minus the buttons on module to put it in dfu-util mode).

I can set eclipse to build automatically by calling make PLATFORM=photon clean all on occasion then in external tools I can make command line calls to dfu-util so everything is done through the eclipse gui.

I think I have everything setup properly but am getting errors on make. These are the errors being thrown in eclipse when I perform a build:

make[2]: arm-none-eabi-gcc: No such file or directory
make[2]: *** [../build/target/user/platform-6-m/src/src/application.o] Error 1
make[1]: *** [user] Error 2
make: *** [modules/photon/user-part] Error 2

Here are some screen shots of my setup in eclipse:

Project Properties

C/C++ Build:

C/C++ Build/Environment(Added Environment Path):

ideas? I should also note I can build and flash from the command line. It just isnt building in Eclipse

The compiler is not in your path, that’s what is happening with the makefile error you are seeing, it just cannot find the toolchain to run.

Sorry, I’m not much help with eclipse.

1 Like

If you only ever build for the photon (or any other single platform) you can set up an environment variable

PLATFORM=photon

so that make always builds for the photon. The same is true for all variables in make you can specify them as environment variables rather than command line arguments if they are always the same.

Thank you @AndyW

If arm-none-eabi-gcc were not in my environment path would make not fail from the terminal? I can build and flash from the command line but make fails in eclipse. I added the the environment variable $PATH in eclipse but am still getting errors.