Tools: Add --no-reset option for IDF Monitor in order to avoid resetting the chip target upon connection

Closes https://github.com/espressif/esp-idf/issues/8889

Closes IDFGH-7189, IDFGH-7301, IDFGH-5963

Closes https://github.com/espressif/esp-idf/issues/7651

Merges https://github.com/espressif/esp-idf/pull/8788
This commit is contained in:
Martin Gaňo 2022-05-10 14:19:37 +02:00
parent 9266a7c52e
commit c02c0cc9b7
4 changed files with 14 additions and 5 deletions

View File

@ -184,6 +184,15 @@ To decode each address, IDF Monitor runs the following command in the background
Set environment variable ``ESP_MONITOR_DECODE`` to ``0`` or call idf_monitor.py with specific command line option: ``idf_monitor.py --disable-address-decoding`` to disable address decoding. Set environment variable ``ESP_MONITOR_DECODE`` to ``0`` or call idf_monitor.py with specific command line option: ``idf_monitor.py --disable-address-decoding`` to disable address decoding.
Reset of the chip target on connect
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The reset of the target chip is performed using DTR and RTS serial lines. For preventing the reset of the target on idf monitor startup call idf_monitor.py with specific command line option: ``idf_monitor.py --no-reset``.
.. note::
The same behavior can be achieved using ``idf.py monitor`` interface with specific command line option: ``--no-reset``. To prevent the reset on startup is required to call the command with explicitly set port ``idf.py monitor --no-reset -p [PORT]``
Launching GDB with GDBStub Launching GDB with GDBStub
~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -18,9 +18,8 @@ def get_parser(): # type: () -> argparse.ArgumentParser
) )
parser.add_argument( parser.add_argument(
'--no-reset', '-R', '--no-reset',
help='Do not reset the chip on monitor startup', help='Do not reset the chip on monitor startup',
default=False,
action='store_true' action='store_true'
) )

View File

@ -193,7 +193,6 @@ class SerialHandler:
console_reader.stop() console_reader.stop()
serial_reader.stop() serial_reader.stop()
elif cmd == CMD_RESET: elif cmd == CMD_RESET:
self.serial_instance.setDTR(high) # IO0=HIGH, default state
self.serial_instance.setRTS(low) # EN=LOW, chip in reset self.serial_instance.setRTS(low) # EN=LOW, chip in reset
self.serial_instance.setDTR(self.serial_instance.dtr) # usbser.sys workaround self.serial_instance.setDTR(self.serial_instance.dtr) # usbser.sys workaround
time.sleep(reset_delay) time.sleep(reset_delay)

View File

@ -95,7 +95,9 @@ def action_extensions(base_actions, project_path):
if project_desc['target'] != 'linux': if project_desc['target'] != 'linux':
if no_reset and args.port is None: if no_reset and args.port is None:
sys.stderr.write('WARNING: --no-reset is ignored. Please specify the port with the --port argument in order to use this option.\n') msg = ('WARNING: --no-reset is ignored. '
'Please specify the port with the --port argument in order to use this option.')
yellow_print(msg)
no_reset = False no_reset = False
esp_port = args.port or _get_default_serial_port(args) esp_port = args.port or _get_default_serial_port(args)
@ -269,7 +271,7 @@ def action_extensions(base_actions, project_path):
'if this option is set. This option is set by default if IDF Monitor was invoked ' 'if this option is set. This option is set by default if IDF Monitor was invoked '
'together with encrypted-flash or encrypted-app-flash target.'), 'together with encrypted-flash or encrypted-app-flash target.'),
}, { }, {
'names': ['--no-reset', '-R'], 'names': ['--no-reset'],
'is_flag': True, 'is_flag': True,
'help': ('Disable reset on monitor startup. ' 'help': ('Disable reset on monitor startup. '
'IDF Monitor will not reset the MCU target by toggling DTR/RTS lines on startup ' 'IDF Monitor will not reset the MCU target by toggling DTR/RTS lines on startup '