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
autoincreasing build number
Re: autoincreasing build number
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"?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: autoincreasing build number
You should be able to do this in makefile try googling "makefile automatic build number" for examples
Re: autoincreasing build number
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.
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
@markwj, could you tell me please, what this line in component.mk does: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.
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
Includes all components, whether or not they are actually referenced.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
Who is online
Users browsing this forum: Bing [Bot], nspode and 120 guests