【发布时间】:2020-08-19 07:28:38
【问题描述】:
我有一个批处理文件,它编译一个项目,然后运行一个连接到 DSP 的 JS,运行程序并从 DSP 的内存中读取结果(关于 DSP 等的更详细信息在我的问题的末尾)。 我的问题是编译和 JS 运行在我的批处理文件内循环运行,有时,由于某种原因,构建被卡住,DSP 中的异常被抛出或 DSP 卡在阻止批处理的条件下继续循环中的下一步。 我想在我的批处理文件中实现某种看门狗,让当前循环步骤持续有限的时间,如果该时间到期,继续下一步。
DSP 是 TI6678EVM,使用 CodeComposer v5.3 和 DSS。 批处理文件的循环:
:CREATE_TEST_DIR
SET "test_dir=%cur_dir%%proj_name%"
ECHO %test_dir%
IF NOT EXIST %test_dir% GOTO INC_TESTN
ECHO ************************************************************************
ECHO Copying headers from %headers_folder_name%%test_num%
ECHO ************************************************************************
SET /a Idx=10
:CHANGE_HEADERS
REM Delete the header files from project dir
del %test_dir%\HeaderFiles\R_Main_%Idx%.h"
REM Copy test vectors header file to workspace
COPY /y "%test_dir%\%headers_folder_name%%test_num%\R_Main_%Idx%_%test_num%.h" "%test_dir%\HeaderFiles\R_Main_%Idx%.h"
SET /a Idx+=1
IF %Idx% leq 16 GOTO CHANGE_HEADERS
ECHO ************************************************************************
ECHO Building project
ECHO ************************************************************************
REM Create and build project
CALL "%eclipsec_path%" -noSplash -data "%test_dir%" -application com.ti.ccstudio.apps.projectBuild -ccs.workspace -ccs.buildType clean > "%test_dir%\p_build.log" || GOTO FAIL_BUILD
CALL "%eclipsec_path%" -noSplash -data "%test_dir%" -application com.ti.ccstudio.apps.projectBuild -ccs.workspace > "%test_dir%\p_build.log" || GOTO FAIL_BUILD
REM ECHO Project build successful
FOR /r "%test_dir%" %%a in (*.ccxml) do set CCXML_path=%%~dpnxa
IF "%CCXML_path%"=="" GOTO BAD_CCXML
ECHO Found .ccxml file %CCXML_path%
FOR /r "%test_dir%" %%a in (*.out) do set OUT_path=%%~dpnxa
IF "%OUT_path%"=="" GOTO BAD_OUT
ECHO Found .out file %OUT_path%
SET "testVecPath=%test_dir%\%headers_folder_name%%test_num%"
ECHO ************************************************************************
ECHO Runing tet
ECHO ************************************************************************
CALL "%dss_path%" "ccsRunTestVectors.js" %ccs_path% %test_dir% %CCXML_path% %OUT_path% %datetimef% %testVecPath%|| GOTO FAIL_BASIC
ECHO ************************************************************************
ECHO Test Done.
ECHO ************************************************************************
GOTO INC_TESTN
:FAIL_CREATE
ECHO Failed
:INC_TESTN
SET /a test_num+=1
REM pause
IF %test_num% gtr %TestNumEnd% GOTO DONE
GOTO CREATE_TEST_DIR
:DONE
【问题讨论】:
-
timeout 10 /nobreak >nul -
@Gerhard 这将暂停批处理运行。我需要的是,只要未达到超时,批处理就可以继续运行
-
创建一个该文件调用的批处理文件,在该批处理文件中使用
timeout并给它一个标题,在你的循环中使用tasklist来查看那个windowtitled进程是否仍在运行,如果没有那么退出。
标签: batch-file watchdog texas-instruments code-composer