Page 1 of 1

autoincreasing build number

Posted: Sun Mar 25, 2018 7:58 pm
by aixakt
Hi everybody,

I work with the ESP32 IDF in several IoT-Projects. Most I use over the air updates and I need to know which build is running.

Has anyone an idea how I can get automatically increasing build number with every build. I need the number in my program.

Thanks
aixakt

Re: autoincreasing build number

Posted: Mon Mar 26, 2018 6:06 pm
by kolban
What about using the C macros __date__ and __time__ which produce string representations of the date and time. Instead of creating a "build number" create a "build date/time"?

Re: autoincreasing build number

Posted: Mon Mar 26, 2018 8:52 pm
by WiFive
You should be able to do this in makefile try googling "makefile automatic build number" for examples

Re: autoincreasing build number

Posted: Thu Mar 29, 2018 6:10 am
by markwj
Have a look here for how we do it on ESP32:

https://github.com/openvehicles/Open-Ve ... MS.V3/main

Look in component.mk and ovms_version.{h,cpp}.

We don't use incrementing build numbers (but wouldn't be hard to adapt to that), but instead the output of:

git describe --always --tags --dirty

That comes out looking like this:

3.1.001-11-g2f50fc1-dirty/factory/main

We get the version, the incremental commit number, the hash of the last commit, an indication of whether that commit is dirty or not, and then finally we add on whether we are factory/ota and which stream (for ota updates).

We also make sure the code has the version number embedded surrounded by '########' style markers, so we can search through flash to find out the version number.

Re: autoincreasing build number

Posted: Fri May 11, 2018 12:56 pm
by meneldor
markwj wrote:Have a look here for how we do it on ESP32:

https://github.com/openvehicles/Open-Ve ... MS.V3/main

Look in component.mk and ovms_version.{h,cpp}.

We don't use incrementing build numbers (but wouldn't be hard to adapt to that), but instead the output of:

git describe --always --tags --dirty

That comes out looking like this:

3.1.001-11-g2f50fc1-dirty/factory/main

We get the version, the incremental commit number, the hash of the last commit, an indication of whether that commit is dirty or not, and then finally we add on whether we are factory/ota and which stream (for ota updates).

We also make sure the code has the version number embedded surrounded by '########' style markers, so we can search through flash to find out the version number.
@markwj, could you tell me please, what this line in component.mk does:

Code: Select all

COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive -T main/ovms_boot.ld

Re: autoincreasing build number

Posted: Fri May 11, 2018 1:25 pm
by markwj
meneldor wrote: @markwj, could you tell me please, what this line in component.mk does:

Code: Select all

COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive -T main/ovms_boot.ld
Includes all components, whether or not they are actually referenced.