请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号: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)