I have a project in a git repository and I would like to get the git hash into the source so it can be queried later.
I can pass -DGITVERSION=\"$(git describe --abbrev=6 --dirty --always --tags)\"
to mbed compile command but I would like to define the macro in one of the configuration files (mbed_app.json).
I added a macro definition in mbed_app.json like this
I’m afraid neither the online compiler nor the Mbed Studio support custom commands. Nor does the mbed-cli tool let you do it directly (run mbed compile -h to check for all available options). That’s why to run more commands in sequence (pre-build + build + post-build) I usually create a batch file. For example: