cmake: Add ESPORT/ESPBAUD environment variables to idf.py & docs

This commit is contained in:
Angus Gratton 2018-05-07 09:31:37 +08:00 committed by Angus Gratton
parent b7ddb0c3d3
commit 6f31674b28
3 changed files with 10 additions and 2 deletions

View file

@ -88,6 +88,8 @@ Type ``idf.py --help`` for a full list of commands. Here are a summary of the mo
Multiple ``idf.py`` commands can be combined into one. For example, ``idf.py -p COM4 clean flash monitor`` will clean the source tree, then build the project and flash it to the ESP32 before running the serial monitor.
.. note:: The environment variables ``ESPPORT`` and ``ESPBAUD`` can be used to set default values for the ``-p`` and ``-b`` options, respectively. Providing these options on the command line overrides the default.
Advanced Commands
^^^^^^^^^^^^^^^^^

View file

@ -40,11 +40,15 @@ To set the serial port for flashing/monitoring:
- CMake based: ``idf.py -p (port) flash``
- GNU Make based: ``make flash ESPPORT=/dev/ttyUSB0``, or set in ``menuconfig``.
(Note: ``idf.py`` will also use the ``ESPPORT`` environment variable for a default serial port, if no ``-p`` argument is provided.)
To set the baud rate for flashing:
- CMake based: ``idf.py -b 921600 flash``
- GNU Make based: ``make flash ESPBAUD=921600``, or set in ``menuconfig``.
(Note: ``idf.py`` will also use the ``ESPBAUD`` environment variable for a default baud rate, if no ``-b`` argument is provided.)
Porting GNU Make Based Components to CMake
==========================================

View file

@ -346,8 +346,10 @@ def get_commandline_options():
def main():
parser = argparse.ArgumentParser(description='ESP-IDF build management tool')
parser.add_argument('-p', '--port', help="Serial port", default=None)
parser.add_argument('-b', '--baud', help="Baud rate", default=460800)
parser.add_argument('-p', '--port', help="Serial port",
default=os.environ.get('ESPPORT', None))
parser.add_argument('-b', '--baud', help="Baud rate",
default=os.environ.get('ESPBAUD', 460800))
parser.add_argument('-C', '--project-dir', help="Project directory", default=os.getcwd())
parser.add_argument('-B', '--build-dir', help="Build directory", default=None)
parser.add_argument('-G', '--generator', help="Cmake generator", choices=GENERATOR_CMDS.keys())