winIDEA SDK
test_cs_read_memory.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_csReadMemory():
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 MEM_START = addCtrl.getVariableAddress("main_loop_counter").getAddress()
19 MEM_SIZE = 4
20
21 codeStore = dataCtrl.csCreate()
22 dataContainer = ic.VectorBYTE(MEM_SIZE)
23 codeStore.insert(MEM_START, dataContainer)
24
25 print(f"Reading '{MEM_SIZE}' bytes of memory from '{hex(MEM_START)}'...")
26 readCodeStore = dataCtrl.csReadMemory(0, codeStore)
27 print(f"\tMemory read, explore 'readCodeStore' object.")
28
29 # NOTE: Returned diff object is again `ic.CCodeStore` object, explore other available methods.
30
31
32if __name__ == "__main__":
33 test_csReadMemory()