winIDEA SDK
test_read_write_value.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_readWriteValue():
12 connMgr = ic.ConnectionMgr()
13 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
14
15 dataCtrl = ic.CDataController(connMgr)
16 addCtrl = ic.CAddressController(connMgr)
17
18 address = addCtrl.getVariableAddress("main_loop_counter").getAddress()
19
20 print(f"Writing value '{42}' to address: '{hex(address)}'...")
21 valType = ic.SType()
22 valType.m_byType = ic.SType.tUnsigned
23 valType.m_byBitSize = 32
24 cVal = ic.CValueType(valType, 42)
25 dataCtrl.writeValue(ic.IConnectDebug.fRealTime,
26 ic.maPhysicalTriCore,
27 address,
28 cVal)
29
30 print(f"Reading back value...")
31 value = dataCtrl.readValue(ic.IConnectDebug.fRealTime,
32 ic.maPhysicalTriCore,
33 address,
34 valType)
35 print(f"\tValue: '{value.getInt()}'")
36
37 print(f"Alternatively, value can be written without updating winIDEA GUI (faster method)...")
38 dataCtrl.writeValue(ic.IConnectDebug.fRealTime,
39 False,
40 ic.maPhysicalTriCore,
41 address,
42 cVal)
43
44
45if __name__ == "__main__":
46 test_readWriteValue()