winIDEA SDK
test_run_until_function.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2# (c) TASKING Germany GmbH, 2023
3#
4# This Python example runs the target until the specified function,
5# and the CSessionCtrl class to begin the program.
6
7import isystem.connect as ic
8
9
10winidea_id = ''
11
12
13def test_run_until_function():
14 connMgr = ic.ConnectionMgr()
15 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
16
17 execCtrl = ic.CExecutionController(connMgr)
18
19 sessionCtrl = ic.CSessionCtrl(connMgr)
20
21 sessionCtrl.begin_program()
22 print("Running CPU to function 'main' (without timeout)...")
23 execCtrl.runUntilFunction("main")
24
25 print("Running CPU to function 'target_init' (with 1 sec timeout)...")
26 execCtrl.runUntilFunction("target_init",
27 ic.CExecutionController.TOUT_1s,
28 True) # raise exception on timeout
29
30 print("Running to the same function ('target_init') again will fail...")
31 if execCtrl.runUntilFunction("target_init",
32 ic.CExecutionController.TOUT_1s,
33 False): # do not raise exception on timeout
34 print("\tOK: exception was not raised, although timeout was reached.")
35
36
37if __name__ == "__main__":
38 test_run_until_function()