import isystem.connect as ic
winidea_id = ''
def test_erase():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
devName = "eMMCtest"
partitionName = "Boot1"
startAddress = 0x0
eraseSize = 0x400
storageCtrl = ic.CStorageDeviceFactory.makeDevice(connMgr, ic.EStorageDevice_EMMCDevice, devName, partitionName)
storageCtrl.erase(ic.IConnectUMI.wProgDevice)
print(f"Erasing entire partition with name {partitionName}...")
storageCtrl.erase(ic.IConnectUMI.wProgDevice,startAddress,int(eraseSize))
print(f"Erasing {int(eraseSize)} bytes with offset {startAddress} of partition with name {partitionName}...")
ic.CStorageDeviceFactory.terminateDevice(connMgr, ic.EStorageDevice_EMMCDevice, devName)
if __name__ == "__main__":
test_erase()