winIDEA SDK
Loading...
Searching...
No Matches
test_code_store.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_codeStore():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
dataCtrl = ic.CDataController(connMgr)
print(f"Creating new empty code store object...")
codeStore = dataCtrl.csCreate()
print(f"\tIs empty: {codeStore.empty()}, num of items: {codeStore.numItems()}")
print(f"Loading current download file...")
wksFolderPath = ic.CIDEController(connMgr).getPath(ic.CIDEController.WORKSPACE_DIR)
dlFilePath = os.path.join(wksFolderPath, "CORE0", "Debug", "example.elf")
codeStore.load(0, dlFilePath, 0)
print(f"\tIs empty: {codeStore.empty()}, num of items: {codeStore.numItems()}")
print(f"\tStart address: {hex(codeStore.getRangeLo())}")
print(f"\tEnd address: {hex(codeStore.getRangeHi())}")
print(f"Adding new area to code store object...")
dataContainer = ic.VectorBYTE(0xF)
codeStore.insert(0xFFFFFF00, dataContainer)
print(f"\tNew number of items: {codeStore.numItems()}")
csDownloaded = dataCtrl.csGetDownloaded(0, dlFilePath, False)
print(f"\tNumber of actual downloaded locations: {csDownloaded.getTotal()}")
codeStore.save(ic.ICodeCache.lFormatMotorolaS, 'MemoryDump.s37', 0) # save to MotorolaS format
# NOTE: Other functions exists for building areas and reports, check documentation.
if __name__ == "__main__":
test_codeStore()