winIDEA SDK
test_storage_secure_unsecure_check.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_secureUnsecureCheck():
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 # NOT IMPLEMENTED!
23 # print(f"Securing 16 bytes from range 0x80000000 of a device with index: {devIndex}")
24 # storageCtrl.secure(0x80000000, 16)
25 # print(f"\tIs secured: {umiCtrl.secureCheck(devIndex, 0x80000000, 16)}")
26
27 # print(f"Securing entire device with index: {devIndex}")
28 # storageCtrl.secure(devIndex)
29 # print(f"\tIs secured: {umiCtrl.secureCheck(devIndex)}")
30 #
31 # print(f"Un-securing 16 bytes from range 0x80000000 of a device with index: {devIndex}")
32 # storageCtrl.unsecure(0x80000000, 16)
33 #
34 # print(f"Un-securing entire device with index: {devIndex}")
35 # storageCtrl.unsecure()
36
37
38if __name__ == "__main__":
39 test_secureUnsecureCheck()