In this topic:
•Create a Python script
•Create a Workspace with Basic Debug Configuration
•Set advanced configuration
•Create an advanced Python configuration from an existing workspace
•Finalize the Python script
Introduction
To control an SoC, winIDEA needs to know about the exact device, which files to program into FLASH, which files to use for debugging, etc. This configuration is typically done manually in an interactive session using winIDEA configuration dialogs.
In an automated test environment (CI/CD) the configuration may need to be created programmatically.
Requirements
•winIDEA 9.21.283 or newer
•Python SDK 9.21.283 or newer
Configuration steps
Create a Python script

|
Use your preferred Python IDE to create a new Python script.
|

|
Create a function that will create the workspace.
|
import isystem.connect as ic
def create_ws(path_WS):
"""
Create workspace, additionally configure applications, symbol and program files
"""
cmgr = ic.ConnectionMgr()
# open and connect to winIDEA, no WS open
cmgr.connect()
ws_ctrl = ic.CWorkspaceController(cmgr)
|
Create a Workspace with Basic Debug Configuration

|
Create a CCfg_debug_basic object and use its functions to specify your SoC configuration.
|

|
Create the Workspace.
|
# create basic debug configuration
cfg = ic.CCfg_debug_basic()
cfg.set_Device('TC399XE')
cfg.set_SymPath('bin/output.elf')
cfg.set_UseSymForPgm(True) # use same file also for FLASH program
cfg.set_CreateSMP(True) # bind all cores into SMP configuration
# create WS, use 'HASYST' iOpen - this selects TASKING debug tools
ws_ctrl.create(path_WS, 'HASYST', cfg)
|
Set advanced configuration
Use CConfigurationController to access the winIDEA configuration. For frequently used configurations the CConfigurationController provides convenient accessor functions.
# to adjust additional configuration, use the CConfigurationController
cfg_ctrl = ic.CConfigurationController(cmgr)
opt_session = cfg_ctrl.ide_session() # debug session configuration node
# add another program file to default SoC
opt_SoC = opt_session.SoC('') # empty string selects the default SoC
opt_SoC.program_files().add_file('bin/output3.bin', 'bin', 0)
# add another symbol file to the default Application
opt_app_files = cfg_ctrl.ide_app_files(''); # empty string selects the default Application
opt_app_files.add_file('bin/output2.elf', 'Elf', 0)
# add another application for the SCR core and assign it a symbol file
opt_app = opt_session.add_app('SleepCtrl')
opt_app.symbol_files().add_file('bin/output23.elf', 'Elf', 0)
# add a memory space for the HSM core and assign it the SleepCtrl application
opt_SoC.add_memory_space('SCR', 'SCR', 'SleepCtrl')
|
For finer configuration use, go to Help | Display Option in winIDEA to identify the configuration URL.
optBB = ic.COptionController(cmgr, '/iOPEN/BB')
optBB.set('EE.Emulator', 'iC7max')
optBB.set('Communication.Mode', 'USB')
|
Create an advanced Python configuration from an existing workspace
If you have manually prepared a working Workspace configuration using winIDEA and want to extract the CPU configuration directly into a Python snippet, select Hardware | Diff Config to Clipboard | Python/SDK and paste into your Python file.
# adjust advanced CPU configuration, located under '/iOPEN/Emulation.Debugging' configuration URL
optCPU = ic.COptionController(cmgr, '/iOPEN/Emulation.Debugging')
optCPU.set('Emulation.Debugging.ResetDuration','100')
optCPU.set('Emulation.OCD_TRICORE.DAPClock','110000')
|
Finalize the Python script
Adjust the script with anything specific to your use case, like saving the workspace as a test artifact.
def create_ws(path_WS):
"""
Create workspace, additionally configure applications, symbol and program files
"""
cmgr = ic.ConnectionMgr()
# open and connect to winIDEA, no WS open
cmgr.connect()
ws_ctrl = ic.CWorkspaceController(cmgr)
# create basic debug configuration
cfg = ic.CCfg_debug_basic()
cfg.set_Device('TC399XE')
cfg.set_SymPath('bin/output.elf')
cfg.set_UseSymForPgm(True) # use same file also for FLASH program
cfg.set_CreateSMP(True) # bind all cores into SMP configuration
# create WS, use 'HASYST' iOpen - this selects TASKING debug tools
ws_ctrl.create(path_WS, 'HASYST', cfg)
# to adjust additional configuration, use the CConfigurationController
cfg_ctrl = ic.CConfigurationController(cmgr)
opt_session = cfg_ctrl.ide_session() # debug session configuration node
# add another program file to default SoC
opt_SoC = opt_session.SoC('') # empty string selects the default SoC
opt_SoC.program_files().add_file('bin/output3.bin', 'bin', 0)
# add another symbol file to the default Application
opt_app_files = cfg_ctrl.ide_app_files(''); # empty string selects the default Application
opt_app_files.add_file('bin/output2.elf', 'Elf', 0)
# add another application for the SCR core and assign it a symbol file
opt_app = opt_session.add_app('SleepCtrl')
opt_app.symbol_files().add_file('bin/output23.elf', 'Elf', 0)
# add a memory space for the HSM core and assign it the SleepCtrl application
opt_SoC.add_memory_space('SCR', 'SCR', 'SleepCtrl')
optBB = ic.COptionController(cmgr, '/iOPEN/BB')
optBB.set('EE.Emulator', 'iC7max')
optBB.set('Communication.Mode', 'USB')
# adjust advanced CPU configuration, located under '/iOPEN/Emulation.Debugging' configuration URL
optCPU = ic.COptionController(cmgr, '/iOPEN/Emulation.Debugging')
optCPU.set('Emulation.Debugging.ResetDuration','100')
optCPU.set('Emulation.OCD_TRICORE.DAPClock','110000')
|
More resources
•Access winIDEA settings via option URL
•isys::CConfigurationController Class Reference - winIDEA SDK User’s Guide
•isys::CCfg_debug_basic Class Reference - winIDEA SDK User’s Guide