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.

[参考译文] CCSTUDIO3:使用 Jython 脚本触发时、未发生复位

Guru**** 2460850 points
Other Parts Discussed in Thread: CCSTUDIO

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1505697/ccstudio3-reset-is-not-happening-when-triggered-using-jython-script

器件型号:CCSTUDIO3

工具/软件:

您好团队:

我正在尝试使用 Jython 脚本执行"hello_world.out"。 我需要使用脚本进行重置、但尚未设置。

从 GUI 手动完成后、将看到 terminate -> Launch configuration -> reset -> run Jython script -> output。

尝试使用 Jython 脚本执行相同的过程,但我没有观察到下面显示的日志,并且看不到输出。

脚本片段详细信息->

debugServer = script.getServer ("DebugServer.1")
debugServer.setConfig("AM62PX_XDS110.ccxml");
debugSession = debugServer.openSession ("Texas Instruments XDS110 USB Debug Probe_0/A53SS0_CORE0_0")
script.traceWrite ("连接目标")

debugSession.target.connect ()
debugSession.target.reset ()
debugSession.terminate()
debugSession = debugServer.openSession ("Texas Instruments XDS110 USB Debug Probe_0/A53SS0_CORE0_0")
debugSession.target.connect ()

script.traceWrite ("加载程序")

日志详细信息-从 CCS GUI 窗口完成复位时看到的日志。 然后执行它工作的脚本。

正在启动 NULL 引导加载程序...

SYSFW 固件版本10.0.8--v10.00.08 (Fiery Fox)
SYSFW 固件版本0xA
SYSFW ABI 修订版4.0

INFO:bootloader_runCpu:176:CPU mcu-R5f 被初始化为800000000 Hz!!
INFO:bootloader_runCpu:176:CPU A530-0被初始化为1400000000 Hz!!
INFO:bootloader_runCpu:176: CPU A530-1被初始化为1400000000 Hz!!
INFO:bootloader_runCpu:176:CPU a531-0初始化为1400000000 Hz!!
INFO:bootloader_runCpu:176:CPU a531-1初始化为1400000000 Hz!!
INFO:bootloadSelfCpu:229:CPU wkup-R5f 已初始化为800000000 Hz!!
信息: Bootloader_Jump SelfCpu:248:所有完成,跳跃自我...

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

    尊敬的 Shriya:

    您能否说明在运行脚本时是否没有获得任何输出、或者只是没有与所发出的复位相关联的输出?

    谢谢、

    Ricky

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

    您好、Ricky、

    注释 -我已经找到了关于"系统重置"使用 DSS 脚本,重置在我的脚本中工作,但面临其他挑战。

    问题-  

    我正在编写脚本、以便自动执行->终止->启动配置->系统复位->然后加载.out 文件->获取输出->终止->停止会话的过程。

    当我将我的脚本配置为支持此功能时、它无法正常工作、因为我看不到输出。

    因此、我手动执行了 Terminate -> Launch configuration -> system reset from CCS GUI、然后执行了我的现有脚本、那么成功了、可以看到输出。

    使用脚本我遇到问题、您能帮助我更正我的脚本吗-如下所示。 无法在此找到确切的错误。

    脚本-

    from java.lang import *
    from java.util import *
    from com.ti.debug.engine.scripting import *
    from com.ti.ccstudio.scripting.environment import *
    import time
    import subprocess
    
    # Create our scripting environment object - which is the main entry point into any script and
    # the factory for creating other Scriptable Servers and Sessions
    script = ScriptingEnvironment.instance()
    
    # Create a log file in the current directory to log script execution
    script.traceBegin("BreakpointsTestLog_python.xml", "DefaultStylesheet.xsl")
    
    # Set our TimeOut
    script.setScriptTimeout(25000)
    
    # Log everything
    script.traceSetConsoleLevel(TraceLevel.ALL)
    script.traceSetFileLevel(TraceLevel.ALL)
    
    # Get the Debug Server and start a Debug Session
    debugServer = script.getServer("DebugServer.1")
    debugServer.setConfig("AM62P.ccxml");
    debugSession = debugServer.openSession("Texas Instruments XDS110 USB Debug Probe/A53SS0_CORE0_0")
    script.traceWrite("CONNECTING TARGET")
    debugSession.target.connect()
    
    
    resetType = debugSession.target.getResetType(3)
    script.traceWrite("Going to issue reset: '" + resetType.getName() + "' (" + resetType.getDescription() + ")... ")
    resetType.issueReset();
    script.traceWrite("Done\n");
    
    
    script.traceWrite("LOADING PROGRAM")
    # Load a program
    # (ScriptingEnvironment has a concept of a working folder and for all of the APIs which take
    # path names as arguments you can either pass a relative path or an absolute path)
    debugSession.memory.loadProgram("hello_world.debug.out")
    
    # Set a breakpoint
    address = debugSession.symbol.getAddress("main")
    bp = debugSession.breakpoint.add(address)
    script.traceWrite("Address of MAIN -".format(hex(address)))
    # Using an expression - get the current value of the PC
    
    nPC = debugSession.expression.evaluate("PC")
    script.traceWrite("Current halted at {}. This should be at the start of main().".format(hex(nPC)))
    
    # Run the target. Should halt at our breakpoint.
    debugSession.target.run()
    debugSession.target.waitForHalt();
    script.traceWrite("HALTING")
    
    nPC = debugSession.expression.evaluate("PC")
    
    #Verify we halted at the correct address.
    if (nPC == address):
        script.traceWrite("SUCCESS: Halted at correct location")
    else:
        script.traceWrite("FAIL: Expected halt at " + hex(address) + ", actually halted at " + hex(nPC))
        script.traceSetConsoleLevel(TraceLevel.INFO)
        script.traceWrite("TEST FAILED!")
        script.traceEnd()
        System.exit(1);
    
    
    #Get reset working
    resetType = debugSession.target.getResetType(3)
    script.traceWrite("Going to issue reset: '" + resetType.getName() + "' (" + resetType.getDescription() + ")... ")
    resetType.issueReset();
    script.traceWrite("Done\n");
    
    # All done
    debugSession.terminate()
    debugServer.stop()
    

    错误日志-

    正在加载程序
    loadProgram:条目 sFileName:hello_world.debug.out
    LOAD:请求程序加载
    waitUntil:输入超时:25000 (ms)
    严重:A53SS0_CORE0_0:停止目标 CPU 时出现问题:(错误-2062 -(0:23:2))无法停止设备。 重置器件、然后重试此操作。 如果错误仍然存在、请确认配置、对电路板进行下电上电、和/或尝试更可靠的 JTAG 设置(例如下 TCLK)。 (仿真包20.0.0.3178)

    严重:A53SS0_CORE0_0:停止目标 CPU 时出现问题:(错误-2062 -(0:23:2))无法停止设备。 重置器件、然后重试此操作。 如果错误仍然存在、请确认配置、对电路板进行下电上电、和/或尝试更可靠的 JTAG 设置(例如下 TCLK)。 (仿真包20.0.0.3178)

    严重:A53SS0_CORE0_0:文件加载程序:验证失败:无法写入0x0000000080000000:执行状态阻止访问

    严重:A53SS0_CORE0_0:GEL:文件:/home/dinakar/ti/ccs1281/ccs/ccs_base/scripting/hello_world.debug.out:加载失败。

    waitUntil:返回
    严重:文件:/home/dinakar/ti/ccs1281/ccs/ccs_base/scripting/hello_world.debug.out:加载失败。
    严重:加载" hello_world.debug.out":文件:/home/dinakar/ti/ccs1281/ccs/ccs_base/scripting/hello_world.debug.out:加载失败。
    回溯(最近一次呼叫):
    文件"trite.py"、第40行、输入
    debugSession.memory.loadProgram (hello_world.debug.out")
    com.ti.debug.engine.scripting.Memory.loadProgram(Memory.java:932)
    在 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    在 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown 源)
    在 java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown 源)
    在 java.base/java.lang.reflect.Method.invoke(Unknown 源)
    com.ti.ccstudio.scripting.environment.ScriptingException: com.ti.ccstudio.scripting.environment.ScriptingException:加载" hello_world.debug.out":文件:/home/dinakar/ti/ccs1281/ccs/ccs_base/scripting/hello_world.debug.out:加载失败。

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

    您好、Ricky、

    您能帮助我对这篇文章和上一篇文章的评论。 请告诉我所做的更正。

    第二项意见 -

    通过注释掉第30-33行修改了前一个脚本  

    from java.lang import *
    from java.util import *
    from com.ti.debug.engine.scripting import *
    from com.ti.ccstudio.scripting.environment import *
    import time
    import subprocess
    
    # Create our scripting environment object - which is the main entry point into any script and
    # the factory for creating other Scriptable Servers and Sessions
    script = ScriptingEnvironment.instance()
    
    # Create a log file in the current directory to log script execution
    script.traceBegin("BreakpointsTestLog_python.xml", "DefaultStylesheet.xsl")
    
    # Set our TimeOut
    script.setScriptTimeout(25000)
    
    # Log everything
    script.traceSetConsoleLevel(TraceLevel.ALL)
    script.traceSetFileLevel(TraceLevel.ALL)
    
    # Get the Debug Server and start a Debug Session
    debugServer = script.getServer("DebugServer.1")
    debugServer.setConfig("AM62P.ccxml");
    debugSession = debugServer.openSession("Texas Instruments XDS110 USB Debug Probe/A53SS0_CORE0_0")
    script.traceWrite("CONNECTING TARGET")
    debugSession.target.connect()
    
    
    #resetType = debugSession.target.getResetType(3)
    #script.traceWrite("Going to issue reset: '" + resetType.getName() + "' (" + resetType.getDescription() + ")... ")
    #resetType.issueReset();
    #script.traceWrite("Done\n");
    
    
    script.traceWrite("LOADING PROGRAM")
    # Load a program
    # (ScriptingEnvironment has a concept of a working folder and for all of the APIs which take
    # path names as arguments you can either pass a relative path or an absolute path)
    debugSession.memory.loadProgram("hello_world.debug.out")
    
    # Set a breakpoint
    address = debugSession.symbol.getAddress("main")
    bp = debugSession.breakpoint.add(address)
    script.traceWrite("Address of MAIN -".format(hex(address)))
    # Using an expression - get the current value of the PC
    
    nPC = debugSession.expression.evaluate("PC")
    script.traceWrite("Current halted at {}. This should be at the start of main().".format(hex(nPC)))
    
    # Run the target. Should halt at our breakpoint.
    debugSession.target.run()
    #debugSession.target.waitForHalt();
    script.traceWrite("HALTING")
    
    nPC = debugSession.expression.evaluate("PC")
    
    #Verify we halted at the correct address.
    if (nPC == address):
        script.traceWrite("SUCCESS: Halted at correct location")
    else:
        script.traceWrite("FAIL: Expected halt at " + hex(address) + ", actually halted at " + hex(nPC))
        script.traceSetConsoleLevel(TraceLevel.INFO)
        script.traceWrite("TEST FAILED!")
        script.traceEnd()
        System.exit(1);
    
    
    #Get reset working
    resetType = debugSession.target.getResetType(3)
    script.traceWrite("Going to issue reset: '" + resetType.getName() + "' (" + resetType.getDescription() + ")... ")
    resetType.issueReset();
    script.traceWrite("Done\n");
    
    # All done
    debugSession.terminate()
    debugServer.stop()
    
    

    手动从 CCS GUI Window -> Terminate + Launch + System reset ->触发上述脚本。

    输出 -在串行端口终端上看到

    日志 -

    getAddress:返回0x80000bd8
    地址:条目 n 地址:2147486680
    添加:获取断点管理器
    ADD:分配地址位置
    createAtLocation:创建新断点
    addAndEnable:添加断点
    addAndEnable:启用断点
    地址:返回52
    main 的地址-
    Evaluate:Entry sExpression:PC
    评估:请求对表达式进行评估:"PC"
    已连接:进入
    已连接:目标已连接
    isconnected:返回 true
    isHalted:条目
    isHalted:目标已停止
    isHalted:返回 true
    waitUntil:entry com.ti.ccstudio.scripting.environment.ScriptingEnvironment@11b5f4e2超时:25000 (ms)
    waitUntil:Return com.ti.ccstudio.scripting.environment.ScriptingEnvironment@11b5f4e2
    waitUntil:输入超时:25000 (ms)
    onevent:已求值表达式: PC
    waitUntil:返回
    Evaluate:返回0x80000bd8
    电流在0x80000bd8L 停止。 这应该在 main()的开头。
    Run:entry
    GO:请求执行目标
    waitUntil:输入超时:25000 (ms)
    严重:25000毫秒后超时
    严重:com.ti.debug.engine.scripting.Target.run():在25000毫秒后超时
    回溯(最近一次呼叫):
    中的文件"trite.py"第53行
    debugSession.target.run()
    com.ti.debug.engine.scripting.ExecutionOperation.go(ExecutionOperation.java:68)
    com.ti.debug.engine.scripting.Target.run(Target.java:818)
    在 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    在 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown 源)
    在 java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown 源)
    在 java.base/java.lang.reflect.Method.invoke(Unknown 源)
    com.ti.ccstudio.scripting.environment.ScriptingException: com.ti.cstudio.scripting.environment.ScriptingException: com.ti.debug.engine.scripting.Target.run():在25000ms 后超时

    谢谢、

    Shriya

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    waitUntil:输入超时:25000 (ms)
    严重:25000毫秒后超时
    严重:com.ti.debug.engine.scripting.Target.run():在25000毫秒后超时

    脚本超时设置为25秒。

    target.run()是一个阻塞调用。 它将一直阻止、直到目标停止或脚本超时被触发。 此处发生后者-在25秒后触发超时并引发异常。 似乎未到达断点设置 main (0x80000bd8)、因此会发生超时。 假设程序有一个有效的 main 函数未到达、那么程序似乎没有正确执行。 也许需要进行系统复位才能将目标置于良好状态。

    如果您对目标进行下电上电、然后按原样运行脚本、它是否有效(REACH MAIN)?

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

    谢谢您、Ki。  

    是的,我更改了.out 文件,在脚本的开头添加了系统重置,脚本已在确切的断点处停止。