I'd like to add the commit hash to a file on every build to be used in firmware. Is there a way to do that with Code Composer Studio with a pre-build step? Here's how I do that in a Makefile for STM32 boards:
GIT_COMMIT_HASH := $(shell git rev-parse --short HEAD) # Check if there are any modified or untracked files included in this build. Ignore the gitcommit.h file. MODIFIED_OR_UNTRACKED := $(shell git status --porcelain | grep -E "(\.c|\.h|\.ld)$$" | grep -v "gitcommit.h" | wc -l) BUILD_STATUS := $(if $(filter 0,$(MODIFIED_OR_UNTRACKED)),clean,dirty)