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.
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.
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?
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.
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.
When performing make for a Photon device do I need to pass the PLATFORM=photon argument when performing make?
What directory should make be performed in? Modules or Main?
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?
Yes. You need to tell make what platform you are targeting.
The link @mdma referenced above spells out the effect of building in various directories.
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
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
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.
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.