winIDEA SDK
test_reset_and_run.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import isystem.connect as ic
6
7
8winidea_id = ''
9
10
11def test_resetAndRun():
12 connMgr = ic.ConnectionMgr()
13 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
14
15 execCtrl = ic.CExecutionController(connMgr)
16 addCtrl = ic.CAddressController(connMgr)
17 bpCtrl = ic.CBreakpointController(connMgr)
18
19 print("`resetAndRun` the CPU without timeout (not expecting `STOP` state)...")
20 execCtrl.resetAndRun()
21
22 address = addCtrl.getFunctionAddress("main").getAddress()
23 print(f"Setting BP at function 'main': {hex(address)}")
24 bpCtrl.setBP(0, address)
25
26 print("`resetAndRun` the CPU with 1 sec timeout (expecting stop at function 'main')...")
27 if execCtrl.resetAndRun(ic.CExecutionController.TOUT_1s) == 0:
28 print("\tSuccess.")
29 else:
30 print("\tTIMEOUT!")
31
32 bpCtrl.deleteAll()
33
34
35if __name__ == "__main__":
36 test_resetAndRun()