winIDEA SDK
Loading...
Searching...
No Matches
test_code_store_diff.py
# This script is licensed under BSD License, see file LICENSE.txt, or search for `License` in the SDK online help.
#
# (c) TASKING Germany GmbH, 2023
import os
import isystem.connect as ic
winidea_id = ''
def test_codeStoreDiff():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
dataCtrl = ic.CDataController(connMgr)
print(f"Creating 2 new empty code store object...")
codeStore = dataCtrl.csCreate()
codeStore2 = dataCtrl.csCreate()
wksFolderPath = ic.CIDEController(connMgr).getPath(ic.CIDEController.WORKSPACE_DIR)
dlFilePath = os.path.join(wksFolderPath, "CORE0", "Debug", "example.elf")
codeStore.load(0, dlFilePath, 0)
codeStore2.load(0, dlFilePath, 0)
print(f"Adding example area to 'codeStore2' object...")
DIFF_SIZE = 0xF
dataContainer = ic.VectorBYTE(DIFF_SIZE)
codeStore2.insert(0xFFFFFFFF - DIFF_SIZE, dataContainer)
print(f"Creating codeStore/codeStore2 diff...")
csDiff = dataCtrl.csDif(codeStore, codeStore2)
print(f"\tSize difference: {hex(csDiff.getTotal())}")
# NOTE: Returned diff object is again `ic.CCodeStore` object, explore other available methods.
if __name__ == "__main__":
test_codeStoreDiff()