winIDEA SDK
test_storage_emmc_erase.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_erase():
12 connMgr = ic.ConnectionMgr()
13 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
14
15 devName = "eMMCtest"
16 partitionName = "Boot1"
17 startAddress = 0x0
18 eraseSize = 0x400
19
20 storageCtrl = ic.CStorageDeviceFactory.makeDevice(connMgr, ic.EStorageDevice_EMMCDevice, devName, partitionName)
21
22 storageCtrl.erase(ic.IConnectUMI.wProgDevice)
23 print(f"Erasing entire partition with name {partitionName}...")
24
25 storageCtrl.erase(ic.IConnectUMI.wProgDevice,startAddress,int(eraseSize))
26 print(f"Erasing {int(eraseSize)} bytes with offset {startAddress} of partition with name {partitionName}...")
27
28 ic.CStorageDeviceFactory.terminateDevice(connMgr, ic.EStorageDevice_EMMCDevice, devName)
29
30
31if __name__ == "__main__":
32 test_erase()