How can I know what firmware is on my Core/Photon now?

Hi,

I wanted to know if there is a way to find out what firmware I flashed in my cores last month :smile:
or even if there is a way to download it from the core to my laptop or the web IDE?
I regularly use the web IDE at https://build.particle.io to flash them.

thanks!

Hi @gusgonnet

You could read the core’s program out over DFU-UTIL but you still would not know which binary file you downloaded unless you kept a binary copy to compare against.

A better solution would be to have your firmware publish a version message via Spark.publish() in setup(). That way you can just reset the device while looking for that event to see what code you are running.

1 Like

Next firmware release should be useful - https://github.com/spark/firmware/commit/1a9b4b02567f1b4ce2231b357c2ca5d6b0da14ca

Also what @bko suggested is useful stuff :wink:

thank you! I will implement the Spark.publish() tip in the future :wink:

1 Like

Hi Kenneth, I think you are trying to tell me something with your link, but nothing is clicking on my mind…
do you mind elaborating what you meant? thanks a lot!

1 Like

@kennethlimcp was referring to the system firmware version being available at compile time. For your own app version, using @bko’s approach is great. :smile:

1 Like

In future releases, you’ll be able to write

PRODUCT_VERSION(12); // or whatever version you're currently at

And this will be placed at a specific location in firmware which you’ll be able to retrieve using our Fleet Management tools.

5 Likes

I'm doing something similar. I wanted a way to automatically include the git revision of the firmware.

I have a file version.template that gets converted to version.cpp before flashing.

version.template

char APPLICATION_VERSION[] = "{{VERSION}}";

I'm using a small Ruby script to update the version and flash on the cloud from local files.

firmware_flash.rb

# set APPLICATION_VERSION to 2015-06-15 20:00:00  9e58e24bf06daf4df2014f7940a01c4945f512e8
current_version = "#{Time.now.to_s[0..18]} #{`git rev-parse HEAD`.strip}"
template = File.read "version.template"
contents = template.gsub /{{VERSION}}/, current_version
File.open("version.cpp", "w") { |f| f.puts contents }
`particle flash device firmware_folder`

APPLICATION_VERSION is made available through a Spark.variable() call in the firmware.

2 Likes