Add insertion of git short hash as a custom build step?

How would I get the platformIO build to generate and insert a git short hash of the current directory? I want to be able to embed this short hash in the build so we can uniquely identify each binary.

Do you mean envs_dir?

http://docs.platformio.org/en/latest/projectconf/section_platformio.html#id8

Thanks, I checked out that link, but couldn’t find what I wanted. What is the actual env. var. or command name to get a git short hash id of the current project?

You have a few options how to achieve that:

  1. Override Redirecting...
    [platformio]
    envs_dir = custom_env_dir_name
    
  2. Using pre:extra scripting override $PROGNAME variable.

Fredb,

Are you looking for Dynamic build flags?

1 Like