winIDEA SDK
test_storage_verify.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_verify():
12 connMgr = ic.ConnectionMgr()
13 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
14
15 devName = "ST STM32C0x6 (32 kB)"
16 optCtrl = ic.COptionController(connMgr, ic.CStorageDeviceFactory.DEVICES_OPT_URL)
17 devIndex = optCtrl.index_of("Name", devName)
18 print("Index of the item whose 'Name' attribute has value " + devName + f": {devIndex}")
19
20 storageCtrl = ic.CStorageDeviceFactory.makeDevice(connMgr, ic.EStorageDevice_EmbeddedFlashDevice, devIndex)
21
22 sess_ctrl = ic.CSessionCtrl(connMgr)
23 sess_ctrl.begin_program()
24
25 print("Next call will raise exception if memory contents do not match real values")
26 storageCtrl.verify()
27 print("\tVerification passed.")
28
29 print("Verify only 16 bytes from address 0x08000000 to current cache values...")
30 storageCtrl.verify(0x08000000, 16)
31
32
33if __name__ == "__main__":
34 test_verify()