This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CODECOMPOSER:添加提交哈希的预编译步骤

Guru**** 1133960 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1348198/codecomposer-pre-build-step-to-add-commit-hash

器件型号:CODECOMPOSER

我想在要在固件中使用的每个版本上向文件添加提交哈希。  是否有办法通过预编译步骤使用 Code Composer Studio 执行此操作?  以下是我如何在 STM32板的 Makefile 中执行该操作:

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)