How to engrave application name & version in esp32 partitions with arduino framework?

I’ve been searching for months how to engrave the application name, version & date in the firmware image generated by an espressif32 project with framework = arduino only
(so no CMakeList.txt, neither any pio menu -t menuconfig), and have find very little (eg 12927: how-to-set-app-version-for-esp32).

RATIONAL: ESP_IDF projects record application name, version & date information near the beginning of the image in the esp_app_desc_t struct, which ita is retrievable on runtime with OTA API or system API, important when discerning remote devices running different OTA firmwares. It is a petty to lose the ability to utilize this infrastructure when using the arduino framework alone (instead of the dreaded arduino+espidf).

I would expect this capability to have been included by default by platformio - any help apreciated, i will try to bake something my self till then.

This the relevant part of my platformio.ini:

[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32.git#develop
platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
framework = arduino
board = esp32dev

(i’m following the very latest from both platforms & packages, above, bc i’m also experiment with puttingespidf into the mix, but is much harder to make it work, since the respective platformio projects need careful syncing, eg eg 14949/18], 14949/18, etc))

Eventually i baked and served this dinner myself…which maybe a useful capability for platformio project (any core devs around??)

You may review the extra_scripts = post:patchappinfos.py script in action.

  • it patches x4 fields(app-name, app-version,build-date & build-time) in the esp_app_desc_t struct at the begining of the generated image, and recalculates checksum and (optionally) sha256.
  • It is configurable, fetching app-name, app-version, & build-date from a cascade of sources.
  • it tries to mimic ESP_IDF behavior but with custom_option_xxx
    (the original build-flags are not only cumbersome vs custom-options, but are impossible to override,
    since they are hard-coded in the sdkconfig file of the pre-compiled underlying esp32 lib).
  • it is loosely tied with another extra-script progname.py that modifies the generated image filename,
    to include version from git-describe, etc - both scripts are good additions for platformio default behavior.

You may find more infos at the header of the the file, where extensive documentation is provided.

@ankostis I’d like to do the same as you, but it looks like the files you link to in your github repo have moved - did you find issues with your implementation?