winIDEA SDK
configure_ws_advanced.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5"""
6This script demonstrates how to use WorkspaceConfigurator in order to
7create a winIDEA workspace, and configure it to use two different applications
8with multiple download files on the same core. It then configures the profiler to
9record both applications at the same time.
10"""
11
12import isystem.connect as ic
13
14# When using this example, make sure to download also ws_cfg.py from the
15# same location as this file.
16from ws_cfg import WorkspaceConfigurator
17
18
19winidea_id = ''
20
21
22def main():
23 cmgr = ic.ConnectionMgr()
24 cmgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
25
26 wsCfg = WorkspaceConfigurator(cmgr)
27
28 WORKSPACE_NAME = 'example.xjrf'
29 wsCfg.create_workspace(WORKSPACE_NAME)
30 wsCfg.set_emulator_type('iC5000')
31 wsCfg.set_USB_comm('iC5000 (SN 12345)')
32 # wsCfg.set_TCP_comm(IP='12.34.56.78', port='1234')
33
34 wsCfg.set_SoC('LS1012A')
35
36 wsCfg.add_application('myApplication0')
37 wsCfg.add_application('myApplication1')
38
39 wsCfg.add_symbol_file('myApplication0', 'program.elf', 'ELF')
40 wsCfg.add_symbol_file('myApplication1', 'program2.elf', 'ELF')
41
42 wsCfg.add_memory_space('memorySpace0', 'Core0',
43 'myApplication0', isEnabled=True,
44 useMsid=True, msidLevel='HV')
45 wsCfg.add_memory_space('memorySpace1', 'Core0',
46 'myApplication1', isEnabled=True,
47 useMsid=True, msidLevel='VM')
48
49 wsCfg.add_program_file('program.elf', 'ELF')
50 wsCfg.add_program_file('program2.elf', 'ELF')
51 wsCfg.add_program_file('program3.hex', 'HEX', offset=0x1000)
52
53 wsCfg.set_demo_mode(True)
54
55 # Download required to load symbols.
56 debugCtrl = ic.CDebugFacade(cmgr)
57 debugCtrl.download()
58
59 TRD_FILE_NAME = "sample.trd"
60 # Create a profiler document
61 profilerCtrl = ic.CProfilerController2(cmgr, TRD_FILE_NAME, 'w')
62
63 analyzerTriggerIdx = wsCfg.create_analyzer_trigger(profilerCtrl, "trigger")
64
65 configCtrl = ic.CConfigurationController(cmgr)
66
67 # Create analyzer document Option controller instance
68 optDoc = configCtrl.doc(TRD_FILE_NAME)
69 optAnalyzerTrigger = configCtrl.doc_an_triggers(optDoc).at(analyzerTriggerIdx)
70
71 optProcessTrigger = configCtrl.doc_an_trig_processes(optAnalyzerTrigger)
72 wsCfg.remove_existing_process_triggers(optProcessTrigger)
73
74 optProcessTrigger0 = wsCfg.add_new_process_trigger(optProcessTrigger,
75 "myApplication0", "memorySpace0")
76 # Enable profiler data trace
77 optProcessTrigger0.set('Profiler.ProfileData', 'true')
78
79 optProcessTrigger1 = wsCfg.add_new_process_trigger(optProcessTrigger,
80 "myApplication1", "memorySpace1")
81 # Enable profiler data trace
82 optProcessTrigger1.set('Profiler.ProfileData', 'true')
83
84 # Create a profiler data option controller for the first and second process trigger
85 optProfilerData0 = configCtrl.doc_an_trig_process_profiler_data(optProcessTrigger0)
86
87 optProfilerData1 = configCtrl.doc_an_trig_process_profiler_data(optProcessTrigger1)
88
89 wsCfg.add_new_profiler_data_area(optProfilerData0, variableName="iCounter",
90 appName="myApplication0", memorySpaceName="memorySpace0",
91 interpretationType="State", accessType="Write")
92 wsCfg.add_new_profiler_data_area(optProfilerData1, variableName="iCounter",
93 appName="myApplication1", memorySpaceName="memorySpace1",
94 interpretationType="State", accessType="Write")
95
96 wsCfg.save_workspace()
97 wsCfg.close_workspace()
98
99
100if __name__ == "__main__":
101 main()