forked from platformio/platformio-core
Added "upload_resetmethod" option to Project Configuration File platformio.ini and allowed to change default upload reset method for Espressif development platform // Resolve #444
This commit is contained in:
@ -9,7 +9,8 @@ PlatformIO 2.0
|
|||||||
|
|
||||||
* Added SPL-Framework support for Nucleo F401RE board
|
* Added SPL-Framework support for Nucleo F401RE board
|
||||||
(`issue #453 <https://github.com/platformio/platformio/issues/453>`_)
|
(`issue #453 <https://github.com/platformio/platformio/issues/453>`_)
|
||||||
* Explained in documentation how to `overwrite upload reset method <http://docs.platformio.org/en/latest/platforms/espressif.html#custom-reset-method>`_
|
* Added ``upload_resetmethod`` option to `Project Configuration File platformio.ini <http://docs.platformio.org/en/latest/projectconf.html>`__
|
||||||
|
and allowed to `change default upload reset method <http://docs.platformio.org/en/latest/platforms/espressif.html#custom-reset-method>`_
|
||||||
for Espressif development platform
|
for Espressif development platform
|
||||||
(`issue #444 <https://github.com/platformio/platformio/issues/444>`_)
|
(`issue #444 <https://github.com/platformio/platformio/issues/444>`_)
|
||||||
* Fixed builder for mbed framework and ST STM32 platform
|
* Fixed builder for mbed framework and ST STM32 platform
|
||||||
|
@ -23,6 +23,19 @@ from :ref:`projectconf`
|
|||||||
|
|
||||||
upload_speed = 9600
|
upload_speed = 9600
|
||||||
|
|
||||||
|
Custom Reset Method
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
See :ref:`projectconf_upload_resetmethod` option from :ref:`projectconf`
|
||||||
|
|
||||||
|
.. code-block:: ini
|
||||||
|
|
||||||
|
[env:esp12e]
|
||||||
|
platform = espressif
|
||||||
|
framework = arduino
|
||||||
|
board = esp12e
|
||||||
|
upload_resetmethod = ck
|
||||||
|
|
||||||
.. _platform_espressif_customflash:
|
.. _platform_espressif_customflash:
|
||||||
|
|
||||||
Custom Flash Size
|
Custom Flash Size
|
||||||
@ -53,34 +66,6 @@ To override default LD script please use :ref:`projectconf_build_flags` from
|
|||||||
[env:myenv]
|
[env:myenv]
|
||||||
build_flags = -Wl,-Tesp8266.flash.4m.ld
|
build_flags = -Wl,-Tesp8266.flash.4m.ld
|
||||||
|
|
||||||
Custom Reset Method
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
To overwrite predefined reset method for uploading please use :ref:`projectconf_extra_script`.
|
|
||||||
For example, default reset method for ``esp12e`` board is ``nodemcu``. Let's
|
|
||||||
overwrite it to ``ck``:
|
|
||||||
|
|
||||||
* :ref:`projectconf`
|
|
||||||
|
|
||||||
.. code-block:: ini
|
|
||||||
|
|
||||||
[env:esp12e]
|
|
||||||
platform = espressif
|
|
||||||
framework = arduino
|
|
||||||
board = esp12e
|
|
||||||
extra_script = extra_script.py
|
|
||||||
|
|
||||||
|
|
||||||
* ``extra_script.py`` should be located on the same level as :ref:`projectconf`
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
from SCons.Script import DefaultEnvironment
|
|
||||||
|
|
||||||
env = DefaultEnvironment()
|
|
||||||
env['BOARD_OPTIONS']['upload']['resetmethod'] = 'ck'
|
|
||||||
|
|
||||||
|
|
||||||
.. _platform_espressif_uploadfs:
|
.. _platform_espressif_uploadfs:
|
||||||
|
|
||||||
Uploading files to file system SPIFFS
|
Uploading files to file system SPIFFS
|
||||||
|
@ -445,6 +445,13 @@ which "uploader" tool uses when sending firmware to board.
|
|||||||
Extra flags for uploader. Will be added to the end of uploader command. If you
|
Extra flags for uploader. Will be added to the end of uploader command. If you
|
||||||
need to override uploader command or base flags please use :ref:`projectconf_extra_script`.
|
need to override uploader command or base flags please use :ref:`projectconf_extra_script`.
|
||||||
|
|
||||||
|
.. _projectconf_upload_resetmethod:
|
||||||
|
|
||||||
|
``upload_resetmethod``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Specify reset method for "uploader" tool. This option isn't available for all
|
||||||
|
development platforms. The only :ref:`platform_espressif` supports it.
|
||||||
|
|
||||||
Library options
|
Library options
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION = (2, 7, "2.dev0")
|
VERSION = (2, 7, "2.dev1")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -56,7 +56,8 @@ commonvars.AddVariables(
|
|||||||
("UPLOAD_PORT",),
|
("UPLOAD_PORT",),
|
||||||
("UPLOAD_PROTOCOL",),
|
("UPLOAD_PROTOCOL",),
|
||||||
("UPLOAD_SPEED",),
|
("UPLOAD_SPEED",),
|
||||||
("UPLOAD_FLAGS",)
|
("UPLOAD_FLAGS",),
|
||||||
|
("UPLOAD_RESETMETHOD",)
|
||||||
)
|
)
|
||||||
|
|
||||||
DefaultEnvironment(
|
DefaultEnvironment(
|
||||||
@ -103,16 +104,16 @@ if "BOARD" in env:
|
|||||||
except UnknownBoard as e:
|
except UnknownBoard as e:
|
||||||
env.Exit("Error: %s" % str(e))
|
env.Exit("Error: %s" % str(e))
|
||||||
|
|
||||||
if "BOARD_MCU" not in env:
|
for k in commonvars.keys():
|
||||||
env.Replace(BOARD_MCU="${BOARD_OPTIONS['build']['mcu']}")
|
if (k in env or
|
||||||
if "BOARD_F_CPU" not in env:
|
not any([k.startswith("BOARD_"), k.startswith("UPLOAD_")])):
|
||||||
env.Replace(BOARD_F_CPU="${BOARD_OPTIONS['build']['f_cpu']}")
|
continue
|
||||||
if "UPLOAD_PROTOCOL" not in env:
|
_opt, _val = k.lower().split("_", 1)
|
||||||
env.Replace(
|
if _opt == "board":
|
||||||
UPLOAD_PROTOCOL="${BOARD_OPTIONS['upload'].get('protocol', None)}")
|
_opt = "build"
|
||||||
if "UPLOAD_SPEED" not in env:
|
if _val in env['BOARD_OPTIONS'][_opt]:
|
||||||
env.Replace(
|
env.Replace(**{k: "${BOARD_OPTIONS['%s']['%s']}" % (_opt, _val)})
|
||||||
UPLOAD_SPEED="${BOARD_OPTIONS['upload'].get('speed', None)}")
|
|
||||||
if "ldscript" in env.get("BOARD_OPTIONS", {}).get("build", {}):
|
if "ldscript" in env.get("BOARD_OPTIONS", {}).get("build", {}):
|
||||||
env.Replace(
|
env.Replace(
|
||||||
LDSCRIPT_PATH="${BOARD_OPTIONS['build']['ldscript']}"
|
LDSCRIPT_PATH="${BOARD_OPTIONS['build']['ldscript']}"
|
||||||
|
@ -108,7 +108,7 @@ env.Replace(
|
|||||||
|
|
||||||
UPLOADERFLAGS=[
|
UPLOADERFLAGS=[
|
||||||
"-vv",
|
"-vv",
|
||||||
"-cd", "${BOARD_OPTIONS['upload']['resetmethod']}",
|
"-cd", "$UPLOAD_RESETMETHOD",
|
||||||
"-cb", "$UPLOAD_SPEED",
|
"-cb", "$UPLOAD_SPEED",
|
||||||
"-cp", "$UPLOAD_PORT"
|
"-cp", "$UPLOAD_PORT"
|
||||||
],
|
],
|
||||||
|
@ -302,12 +302,15 @@ def on_exception(e):
|
|||||||
def _finalize():
|
def _finalize():
|
||||||
timeout = 1000 # msec
|
timeout = 1000 # msec
|
||||||
elapsed = 0
|
elapsed = 0
|
||||||
while elapsed < timeout:
|
try:
|
||||||
if not MPDataPusher().in_wait():
|
while elapsed < timeout:
|
||||||
break
|
if not MPDataPusher().in_wait():
|
||||||
sleep(0.2)
|
break
|
||||||
elapsed += 200
|
sleep(0.2)
|
||||||
backup_reports(MPDataPusher().get_items())
|
elapsed += 200
|
||||||
|
backup_reports(MPDataPusher().get_items())
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def backup_reports(items):
|
def backup_reports(items):
|
||||||
|
Reference in New Issue
Block a user