winIDEA SDK
Loading...
Searching...
No Matches
test_configure_stack_usage.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 isystem.connect as ic
winidea_id = ''
def test_configureStackUsage():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
# Initialize controllers
addrCtrl = ic.CAddressController(connMgr)
cfgCtrl = ic.CConfigurationController(connMgr)
dataCtrl = ic.CDataController(connMgr)
# Get stack end from program symbols
STACK_START_ADDR = addrCtrl.getVariableAddress("_sdata").getAddress()
STACK_END_ADDR = addrCtrl.getVariableAddress("_edata").getAddress()
VALUE = 0x55
# Get current process and choose option controller for its StackUsage
stack_cfg = cfgCtrl.ide_app().opt('StackUsage')
# Configure stack
stack_cfg.set_bool('Use', True)
stack_cfg.set_uint('Pattern', VALUE)
stack_cfg.set('Position', 'End')
stack_cfg.set('Start', str(hex(STACK_START_ADDR)))
stack_cfg.set('End', str(hex(STACK_END_ADDR)))
# NOTE: changes apply only after `download`!
# <your code>
print(f'Disable by setting option `Use` to `False`')
stack_cfg.set_bool('Use', False)
if __name__ == "__main__":
test_configureStackUsage()