winIDEA SDK
test_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 umiCtrl = ic.CUMIController(connMgr)
16 devIndex = umiCtrl.getDeviceIndex("Infineon TC39x_PFLASH_16MB")
17
18 # print(f"Securing 16 bytes from range 0x80000000 of a device with index: {devIndex}")
19 # umiCtrl.secure(devIndex, 0x80000000, 16)
20 # print(f"\tIs secured: {umiCtrl.secureCheck(devIndex, 0x80000000, 16)}")
21
22 print(f"Securing entire device with index: {devIndex}")
23 umiCtrl.secure(devIndex)
24 print(f"\tIs secured: {umiCtrl.secureCheck(devIndex)}")
25
26 print(f"Un-securing 16 bytes from range 0x80000000 of a device with index: {devIndex}")
27 umiCtrl.unsecure(devIndex, 0x80000000, 16)
28
29 print(f"Un-securing entire device with index: {devIndex}")
30 umiCtrl.unsecure(devIndex)
31
32
33if __name__ == "__main__":
34 test_secureUnsecureCheck()