winIDEA SDK
test_code_store_item.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import os
6
7import isystem.connect as ic
8
9
10winidea_id = ''
11
12
13def test_codeStoreItem():
14 connMgr = ic.ConnectionMgr()
15 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
16
17 dataCtrl = ic.CDataController(connMgr)
18
19 print(f"Loading current download file...")
20 codeStore = dataCtrl.csCreate()
21 wksFolderPath = ic.CIDEController(connMgr).getPath(ic.CIDEController.WORKSPACE_DIR)
22 dlFilePath = os.path.join(wksFolderPath, "build", "debug", "STM32", "sdk_example_stm32.elf")
23 codeStore.load(0, dlFilePath, 0)
24
25 numOfItems = codeStore.numItems()
26 for index in range(numOfItems):
27 csItem = codeStore.getItem(index)
28 print(f"Dowload file region '{index}':")
29 print(f"\tStart address: {hex(csItem.getAddress())}")
30 print(f"\tEnd address: {hex(csItem.getLastAddress())}")
31
32
33if __name__ == "__main__":
34 test_codeStoreItem()