winIDEA SDK
test_storage_fill.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_fill():
12 connMgr = ic.ConnectionMgr()
13 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
14
15 ideCtrl = ic.CIDEController(connMgr)
16 devName = "ST STM32C0x6 (32 kB)"
17 optCtrl = ic.COptionController(connMgr, ic.CStorageDeviceFactory.DEVICES_OPT_URL)
18 devIndex = optCtrl.index_of("Name",devName)
19 print("Index of the item whose 'Name' attribute has value " + devName + f": {devIndex}")
20
21 storageCtrl = ic.CStorageDeviceFactory.makeDevice(connMgr, ic.EStorageDevice_EmbeddedFlashDevice, devIndex)
22
23 print(f"Enabling 'allow erase' for device: {devIndex}")
24 url = f"/iOPEN/Data.UMI.Devices.Devices[{devIndex}].AllowErase"
25 ideCtrl.setOption(url, "True")
26
27 print(f"Erasing device with index: {devIndex}")
28 storageCtrl.erase(ic.IConnectUMI.wProgDevice)
29
30 print(f"Performing device fill with a default value...")
31 #storageCtrl.fill() NOT IMPLEMENTED
32
33 print(f"Disabling 'allow erase' for device: {devIndex}")
34 ideCtrl.setOption(url, "False")
35
36
37if __name__ == "__main__":
38 test_fill()