PRODUCT_VERSION(uint16_t) Issue: The product version in the binary must match the provided product version

I am trying to set a value in to the PRODUCT_VERSION from code (below). The reason for this is so that I can create a Major/Minor/Revision format, although the revision part I just use to sent the exact version to my servers in a Publish event.

However, when I try to upload the binary to the particle console for my product, I get an error message “Bummer! Your firmware could not be created. The product version in the binary must match the provided product version”.

For the version # in the prompt I am entering 2, and as you can see from the code prodVer would be “2”. If I manually set PRODUCT_VERSION(2); then it works fine.

I checked the source code of the particle itself, and PRODUCT_VERSION is expecting a uint16_t.

So I don’t know why this would not work?

uint16_t  verMajor=0;
uint16_t  verMinor=2;
uint16_t  verRev=2;
uint16_t prodVer = (verMajor * 1000) + verMinor;
PRODUCT_VERSION(prodVer);
String softVer = String(verMajor) + "." + String(verMinor) + "." +  String(verRev);

I’d think that’s because PRODUCT_VERSION() is a compile time macro but variables are run time entities.

1 Like

Well crap.