mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Handle new environment variables PLATFORMIO_UPLOAD_PORT and PLATFORMIO_UPLOAD_FLAGS
This commit is contained in:
@ -18,6 +18,10 @@ PlatformIO 2.0
|
||||
* Added ``board_flash_mode`` option to `Project Configuration File platformio.ini <http://docs.platformio.org/en/latest/projectconf.html>`__
|
||||
which allows to specify `custom flash chip mode <http://docs.platformio.org/en/latest/platforms/espressif.html#custom-flash-mode>`_
|
||||
for Espressif development platform
|
||||
* Handle new environment variables
|
||||
`PLATFORMIO_UPLOAD_PORT <http://docs.platformio.org/en/latest/envvars.html#platformio-upload-port>`_
|
||||
and `PLATFORMIO_UPLOAD_FLAGS <http://docs.platformio.org/en/latest/envvars.html#platformio-upload-flags>`_
|
||||
(`IDE issue #518 <https://github.com/platformio/platformio/issues/518>`_)
|
||||
* Fixed issue with ``CPPDEFINES`` which contain space and break PlatformIO
|
||||
IDE Linter
|
||||
(`IDE issue #34 <https://github.com/platformio/platformio-atom-ide/issues/34>`_)
|
||||
|
@ -70,8 +70,8 @@ Allows to override :ref:`projectconf` option :ref:`projectconf_pio_envs_dir`.
|
||||
Allows to override :ref:`projectconf` option :ref:`projectconf_pio_data_dir`.
|
||||
|
||||
|
||||
Builder
|
||||
-------
|
||||
Building
|
||||
--------
|
||||
|
||||
.. envvar:: PLATFORMIO_BUILD_FLAGS
|
||||
|
||||
@ -90,6 +90,18 @@ Allows to set :ref:`projectconf` option :ref:`projectconf_src_filter`.
|
||||
Allows to set :ref:`projectconf` option :ref:`projectconf_extra_script`.
|
||||
|
||||
|
||||
Uploading
|
||||
---------
|
||||
|
||||
.. envvar:: PLATFORMIO_UPLOAD_PORT
|
||||
|
||||
Allows to set :ref:`projectconf` option :ref:`projectconf_upload_port`.
|
||||
|
||||
.. envvar:: PLATFORMIO_UPLOAD_FLAGS
|
||||
|
||||
Allows to set :ref:`projectconf` option :ref:`projectconf_upload_flags`.
|
||||
|
||||
|
||||
Settings
|
||||
--------
|
||||
|
||||
|
@ -433,6 +433,8 @@ When no targets are defined, *PlatformIO* will build only sources by default.
|
||||
Uploading options
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. _projectconf_upload_port:
|
||||
|
||||
``upload_port``
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
@ -448,6 +450,9 @@ automatically.
|
||||
|
||||
To print all available serial ports use :ref:`cmd_serialports` command.
|
||||
|
||||
This option can be set by global environment variable
|
||||
:envvar:`PLATFORMIO_UPLOAD_PORT`.
|
||||
|
||||
``upload_protocol``
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@ -461,12 +466,17 @@ A protocol that "uploader" tool uses to talk to the board.
|
||||
A connection speed (`baud rate <http://en.wikipedia.org/wiki/Baud>`_)
|
||||
which "uploader" tool uses when sending firmware to board.
|
||||
|
||||
.. _projectconf_upload_flags:
|
||||
|
||||
``upload_flags``
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
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`.
|
||||
|
||||
This option can be set by global environment variable
|
||||
:envvar:`PLATFORMIO_UPLOAD_FLAGS`.
|
||||
|
||||
.. _projectconf_upload_resetmethod:
|
||||
|
||||
``upload_resetmethod``
|
||||
|
@ -139,6 +139,13 @@ if env.subst("$PIOPACKAGE_TOOLCHAIN"):
|
||||
env.subst(join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN", "bin"))
|
||||
)
|
||||
|
||||
# handle custom variable from system environment
|
||||
for var in ("BUILD_FLAGS", "SRC_BUILD_FLAGS", "SRC_FILTER", "EXTRA_SCRIPT",
|
||||
"UPLOAD_PORT", "UPLOAD_FLAGS"):
|
||||
k = "PLATFORMIO_%s" % var
|
||||
if environ.get(k):
|
||||
env[var] = environ.get(k)
|
||||
|
||||
env.SConscriptChdir(0)
|
||||
env.SConsignFile(join("$PIOENVS_DIR", ".sconsign.dblite"))
|
||||
env.SConscript("$BUILD_SCRIPT")
|
||||
@ -146,9 +153,8 @@ env.SConscript("$BUILD_SCRIPT")
|
||||
if "UPLOAD_FLAGS" in env:
|
||||
env.Append(UPLOADERFLAGS=["$UPLOAD_FLAGS"])
|
||||
|
||||
if environ.get("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT")):
|
||||
env.SConscript(
|
||||
environ.get("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT")))
|
||||
if env.get("EXTRA_SCRIPT"):
|
||||
env.SConscript(env.get("EXTRA_SCRIPT"))
|
||||
|
||||
if "envdump" in COMMAND_LINE_TARGETS:
|
||||
print env.Dump()
|
||||
|
@ -32,7 +32,7 @@ import re
|
||||
import sys
|
||||
import xml.etree.ElementTree as ElementTree
|
||||
from binascii import crc32
|
||||
from os import getenv, walk
|
||||
from os import walk
|
||||
from os.path import basename, isfile, join, normpath
|
||||
|
||||
from SCons.Script import DefaultEnvironment
|
||||
@ -233,8 +233,7 @@ env.Replace(
|
||||
# restore external build flags
|
||||
env.ProcessFlags([
|
||||
env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags"),
|
||||
env.get("BUILD_FLAGS"),
|
||||
getenv("PLATFORMIO_BUILD_FLAGS"),
|
||||
env.get("BUILD_FLAGS")
|
||||
])
|
||||
|
||||
# Hook for K64F and K22F
|
||||
|
@ -16,7 +16,7 @@ from __future__ import absolute_import
|
||||
|
||||
import re
|
||||
from glob import glob
|
||||
from os import getenv, listdir, sep, walk
|
||||
from os import listdir, sep, walk
|
||||
from os.path import basename, dirname, isdir, isfile, join, normpath, realpath
|
||||
|
||||
from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, SConscript
|
||||
@ -44,8 +44,7 @@ def BuildProgram(env):
|
||||
|
||||
env.ProcessFlags([
|
||||
env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags"),
|
||||
env.get("BUILD_FLAGS"),
|
||||
getenv("PLATFORMIO_BUILD_FLAGS"),
|
||||
env.get("BUILD_FLAGS")
|
||||
])
|
||||
|
||||
if env.get("FRAMEWORK"):
|
||||
@ -72,10 +71,7 @@ def BuildProgram(env):
|
||||
)
|
||||
|
||||
# Handle SRC_BUILD_FLAGS
|
||||
env.ProcessFlags([
|
||||
env.get("SRC_BUILD_FLAGS", None),
|
||||
getenv("PLATFORMIO_SRC_BUILD_FLAGS"),
|
||||
])
|
||||
env.ProcessFlags([env.get("SRC_BUILD_FLAGS", None)])
|
||||
|
||||
env.Append(
|
||||
CPPDEFINES=["PLATFORMIO={0:02d}{1:02d}{2:02d}".format(
|
||||
@ -86,7 +82,7 @@ def BuildProgram(env):
|
||||
|
||||
sources = env.LookupSources(
|
||||
"$BUILDSRC_DIR", "$PROJECTSRC_DIR", duplicate=False,
|
||||
src_filter=getenv("PLATFORMIO_SRC_FILTER", env.get("SRC_FILTER")))
|
||||
src_filter=env.get("SRC_FILTER"))
|
||||
|
||||
if not sources and not COMMAND_LINE_TARGETS:
|
||||
env.Exit(
|
||||
|
Reference in New Issue
Block a user