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.

[参考译文] TMS320F28075:从源代码中提取版本号并使用它来重命名目标文件

Guru**** 2782445 points

Other Parts Discussed in Thread: C2000WARE

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1272140/tms320f28075-extract-version-number-from-source-code-and-use-it-to-rename-object-file

器件型号:TMS320F28075
主题中讨论的其他器件:C2000WARE

大家好、

我的客户希望 从源代码中提取版本号、并使用该编号重命名目标文件。

现在、他们使用 bat 脚本+ CCS 编译后步骤来实现这一目标。

它们使用 bat  指令'令牌'来提取版本号并将此值提供给它们命名的变量 str1。 然后将此值传输到 表示目标文件的名称"new"。  

他们遇到的问题是:执行后、文件名仍然是"新的"、而不是版本号。

以下是他们的蝙蝠脚本:

@echo off
setlocal enabledelayedexpansion
for /f "tokens=2,3" %%i in (CFG_SysParaInit.h) do (
if %%i==DSP_VERSION (
set str1=%%j
set str2=TPaa!str1!
echo !str2!
)
)
for /f "tokens=2,3" %%i in (CFG_SysParaInit.h) do (
if %%i==DSP_DEBUG_VERSION (
set str3=%%j
set str4=_D!str3!
set new1=!str2!!str4!_075
echo !new1!
)
)
for /f "tokens=2,3" %%i in (CFG_SysParaInit.h) do (
if %%i==DSP_VERSION2 (
set str5=%%j
set str6=TPaa!str5!
echo !str6!
set new2=!str6!!str4!_075
echo !new2!
)
)
for /f "tokens=2,3" %%i in (CFG_SysParaInit.h) do (
if %%i==HIL_TEST (
set str=%%j
if "!str!"=="0" (
cd "../../.././CPU1_FLASH"
copy WIS215KW_TL3_inv_f28075.hex WIS215KW_TL3_inv_f28075bak.hex
ren WIS215KW_TL3_inv_f28075bak.hex !new2!.hex
)
if "!str!"=="1" (
cd "../../.././CPU1_FLASH"
copy WIS215KW_TL3_inv_f28075.hex WIS215KW_TL3_inv_f28075bak.hex
ren WIS215KW_TL3_inv_f28075bak.hex !new1!.hex
)
)
)
pause

您能 给我们提供一些帮助吗?

--

谢谢、此致

耶鲁

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

    你好,耶鲁,

    需要说明的是、他们遇到的问题在 CCS post-build 步骤或批处理脚本方面。 我们没有任何专家积极支持此主题、因此除非他们在从 CCS 或 C2000Ware 中提取信息时遇到问题(我不确定他们正在做什么)、否则 最好在另一个论坛上提出此问题、以解答更一般的编程/脚本问题。

    此致、

    阿米尔·奥马尔