Skip to content

Commit

Permalink
Merge branch 'release/v5.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Jan 28, 2021
2 parents 3f3c8ca + fd54014 commit 90a325a
Show file tree
Hide file tree
Showing 54 changed files with 884 additions and 572 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [2.7, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-16.04, windows-latest, macos-latest]
python-version: [2.7, 3.7]
python-version: [3.7]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[settings]
line_length=88
known_third_party=OpenSSL, SCons, autobahn, jsonrpc, twisted, zope
known_third_party=OpenSSL, SCons, jsonrpc, twisted, zope
1 change: 0 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ disable=
too-few-public-methods,
useless-object-inheritance,
useless-import-alias,
fixme,
bad-option-value,

; PY2 Compat
Expand Down
45 changes: 42 additions & 3 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,54 @@ PlatformIO Core 5

**A professional collaborative platform for embedded development**

5.1.0 (2021-01-28)
~~~~~~~~~~~~~~~~~~

* **PlatformIO Home**

- Boosted PlatformIO Home performance thanks to migrating the codebase to the pure Python 3 Asynchronous I/O stack
- Added a new ``--session-id`` option to `pio home <https://docs.platformio.org/page/core/userguide/cmd_home.html>`__ command that helps to keep PlatformIO Home isolated from other instances and protect from 3rd party access (`issue #3397 <https://github.com/platformio/platformio-core/issues/3397>`_)

* **Build System**

- Upgraded build engine to the SCons 4.1 (`release notes <https://scons.org/scons-410-is-available.html>`_)
- Refactored a workaround for a maximum command line character limitation (`issue #3792 <https://github.com/platformio/platformio-core/issues/3792>`_)
- Fixed an issue with Python 3.8+ on Windows when a network drive is used (`issue #3417 <https://github.com/platformio/platformio-core/issues/3417>`_)

* **Package Management**

- New options for `pio system prune <https://docs.platformio.org/page/core/userguide/system/cmd_prune.html>`__ command:

+ ``--dry-run`` option to show data that will be removed
+ ``--core-packages`` option to remove unnecessary core packages
+ ``--platform-packages`` option to remove unnecessary development platform packages (`issue #923 <https://github.com/platformio/platformio-core/issues/923>`_)

- Added new `check_prune_system_threshold <https://docs.platformio.org/page/core/userguide/cmd_settings.html#check-prune-system-threshold>`__ setting
- Disabled automatic removal of unnecessary development platform packages (`issue #3708 <https://github.com/platformio/platformio-core/issues/3708>`_, `issue #3770 <https://github.com/platformio/platformio-core/issues/3770>`_)
- Fixed an issue when unnecessary packages were removed in ``update --dry-run`` mode (`issue #3809 <https://github.com/platformio/platformio-core/issues/3809>`_)
- Fixed a "ValueError: Invalid simple block" when uninstalling a package with a custom name and external source (`issue #3816 <https://github.com/platformio/platformio-core/issues/3816>`_)

* **Debugging**

- Configure a custom debug adapter speed using a new `debug_speed <https://docs.platformio.org/page/projectconf/section_env_debug.html#debug-speed>`__ option (`issue #3799 <https://github.com/platformio/platformio-core/issues/3799>`_)
- Handle debugging server's "ready_pattern" in "stderr" output

* **Miscellaneous**

- Improved listing of `multicast DNS services <https://docs.platformio.org/page/core/userguide/device/cmd_list.html>`_
- Fixed a "UnicodeDecodeError: 'utf-8' codec can't decode byte" when using J-Link for firmware uploading on Linux (`issue #3804 <https://github.com/platformio/platformio-core/issues/3804>`_)
- Fixed an issue with a compiler driver for ".ccls" language server (`issue #3808 <https://github.com/platformio/platformio-core/issues/3808>`_)
- Fixed an issue when `pio device monitor --eol <https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#cmdoption-pio-device-monitor-eol>`__ and "send_on_enter" filter do not work properly (`issue #3787 <https://github.com/platformio/platformio-core/issues/3787>`_)

5.0.4 (2020-12-30)
~~~~~~~~~~~~~~~~~~

- Added "Core" suffix when showing PlatformIO Core version using ``pio --version`` command
- Improved ``.ccls`` configuration file for Emacs, Vim, and Sublime Text integrations
- Improved ".ccls" configuration file for Emacs, Vim, and Sublime Text integrations
- Updated analysis tools:

* `Cppcheck <https://docs.platformio.org/page/plus/check-tools/cppcheck.html>`__ v2.3 with improved C++ parser and several new MISRA rules
* `PVS-Studio <https://docs.platformio.org/page/plus/check-tools/pvs-studio.html>`__ v7.11 with new diagnostics and updated mass suppression mechanism
* `Cppcheck <https://docs.platformio.org/page/plus/check-tools/cppcheck.html>`__ v2.3 with improved C++ parser and several new MISRA rules
* `PVS-Studio <https://docs.platformio.org/page/plus/check-tools/pvs-studio.html>`__ v7.11 with new diagnostics and updated mass suppression mechanism

- Show a warning message about deprecated support for Python 2 and Python 3.5
- Do not provide "intelliSenseMode" option when generating configuration for VSCode C/C++ extension
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ lint:
pylint -j 6 --rcfile=./.pylintrc ./tests

isort:
isort -rc ./platformio
isort -rc ./tests
isort ./platformio
isort ./tests

format:
black --target-version py27 ./platformio
Expand Down
2 changes: 1 addition & 1 deletion docs
Submodule docs updated 47 files
+5 −0 articles.rst
+1 −1 boards/asrmicro650x/cubecell_board.rst
+1 −1 boards/asrmicro650x/cubecell_board_plus.rst
+1 −1 boards/asrmicro650x/cubecell_capsule.rst
+1 −1 boards/asrmicro650x/cubecell_capsule_solar_sensor.rst
+1 −1 boards/asrmicro650x/cubecell_gps.rst
+1 −1 boards/asrmicro650x/cubecell_module.rst
+1 −1 boards/asrmicro650x/cubecell_module_plus.rst
+1 −1 boards/asrmicro650x/cubecell_node.rst
+1 −4 boards/atmelavr/nanoatmega328new.rst
+4 −3 boards/index.rst
+5 −5 boards/nordicnrf52/reel_board.rst
+5 −5 boards/nordicnrf52/reel_board_v2.rst
+134 −0 boards/ststm32/genericSTM32F373RC.rst
+10 −0 core/userguide/cmd_home.rst
+24 −2 core/userguide/cmd_settings.rst
+1 −1 core/userguide/remote/cmd_run.rst
+56 −3 core/userguide/system/cmd_prune.rst
+4 −0 envvars.rst
+2 −2 frameworks/arduino.rst
+13 −0 frameworks/cmsis.rst
+10 −0 frameworks/espidf_extra.rst
+0 −13 frameworks/simba.rst
+13 −0 frameworks/stm32cube.rst
+12 −12 frameworks/zephyr.rst
+6 −8 home/index.rst
+11 −4 librarymanager/config.rst
+4 −4 platforms/asrmicro650x.rst
+2 −2 platforms/espressif32.rst
+1 −1 platforms/freescalekinetis.rst
+1 −1 platforms/maxim32.rst
+10 −10 platforms/nordicnrf52.rst
+1 −1 platforms/nxpimxrt.rst
+1 −1 platforms/nxplpc.rst
+11 −1 platforms/ststm32.rst
+1 −1 platforms/wiznet7500.rst
+21 −14 plus/debug-tools/blackmagic.rst
+21 −14 plus/debug-tools/cmsis-dap.rst
+39 −15 plus/debug-tools/jlink.rst
+26 −70 plus/debug-tools/stlink.rst
+7 −0 plus/debugging.rst
+28 −0 projectconf/section_env_debug.rst
+3 −3 projectconf/section_env_monitor.rst
+1 −1 projectconf/section_env_platform.rst
+1 −1 projectconf/section_env_test.rst
+1 −2 projectconf/section_env_upload.rst
+1 −0 tutorials/index.rst
6 changes: 3 additions & 3 deletions platformio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import sys

VERSION = (5, 0, 4)
VERSION = (5, 1, 0)
__version__ = ".".join([str(s) for s in VERSION])

__title__ = "platformio"
Expand Down Expand Up @@ -47,10 +47,10 @@
__default_requests_timeout__ = (10, None) # (connect, read)

__core_packages__ = {
"contrib-piohome": "~3.3.1",
"contrib-piohome": "~3.3.3",
"contrib-pysite": "~2.%d%d.0" % (sys.version_info.major, sys.version_info.minor),
"tool-unity": "~1.20500.0",
"tool-scons": "~2.20501.7" if sys.version_info.major == 2 else "~4.40001.0",
"tool-scons": "~2.20501.7" if sys.version_info.major == 2 else "~4.40100.2",
"tool-cppcheck": "~1.230.0",
"tool-clangtidy": "~1.100000.0",
"tool-pvs-studio": "~7.11.0",
Expand Down
4 changes: 4 additions & 0 deletions platformio/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def projects_dir_validate(projects_dir):
"description": "Check for the platform updates interval (days)",
"value": 7,
},
"check_prune_system_threshold": {
"description": "Check for pruning unnecessary data threshold (megabytes)",
"value": 1024,
},
"enable_cache": {
"description": "Enable caching for HTTP API requests",
"value": True,
Expand Down
17 changes: 12 additions & 5 deletions platformio/builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,19 @@
IDE_EXTRA_DATA={},
)

# Declare command verbose messages
command_strings = dict(
ARCOM="Archiving",
LINKCOM="Linking",
RANLIBCOM="Indexing",
ASCOM="Compiling",
ASPPCOM="Compiling",
CCCOM="Compiling",
CXXCOM="Compiling",
)
if not int(ARGUMENTS.get("PIOVERBOSE", 0)):
DEFAULT_ENV_OPTIONS["ARCOMSTR"] = "Archiving $TARGET"
DEFAULT_ENV_OPTIONS["LINKCOMSTR"] = "Linking $TARGET"
DEFAULT_ENV_OPTIONS["RANLIBCOMSTR"] = "Indexing $TARGET"
for k in ("ASCOMSTR", "ASPPCOMSTR", "CCCOMSTR", "CXXCOMSTR"):
DEFAULT_ENV_OPTIONS[k] = "Compiling $TARGET"
for name, value in command_strings.items():
DEFAULT_ENV_OPTIONS["%sSTR" % name] = "%s $TARGET" % (value)

env = DefaultEnvironment(**DEFAULT_ENV_OPTIONS)

Expand Down
4 changes: 2 additions & 2 deletions platformio/builder/tools/compilation_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# should hold the compilation database, otherwise, the file defaults to compile_commands.json,
# which is the name that most clang tools search for by default.

# TODO: Is there a better way to do this than this global? Right now this exists so that the
# Is there a better way to do this than this global? Right now this exists so that the
# emitter we add can record all of the things it emits, so that the scanner for the top level
# compilation database can access the complete list, and also so that the writer has easy
# access to write all of the files. But it seems clunky. How can the emitter and the scanner
Expand Down Expand Up @@ -104,7 +104,7 @@ def EmitCompilationDbEntry(target, source, env):
__COMPILATIONDB_ENV=env,
)

# TODO: Technically, these next two lines should not be required: it should be fine to
# Technically, these next two lines should not be required: it should be fine to
# cache the entries. However, they don't seem to update properly. Since they are quick
# to re-generate disable caching and sidestep this problem.
env.AlwaysBuild(entry)
Expand Down
41 changes: 24 additions & 17 deletions platformio/builder/tools/pioide.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
import os
from glob import glob

from SCons.Defaults import processDefines # pylint: disable=import-error
import SCons.Defaults # pylint: disable=import-error
import SCons.Subst # pylint: disable=import-error

from platformio.compat import glob_escape
from platformio.package.manager.core import get_core_package_dir
Expand Down Expand Up @@ -58,8 +59,16 @@ def _dump_includes(env):
for g in toolchain_incglobs:
includes["toolchain"].extend([os.path.realpath(inc) for inc in glob(g)])

# include Unity framework if there are tests in project
includes["unity"] = []
unity_dir = get_core_package_dir("tool-unity")
auto_install_unity = False
test_dir = env.GetProjectConfig().get_optional_dir("test")
if os.path.isdir(test_dir) and os.listdir(test_dir) != ["README"]:
auto_install_unity = True
unity_dir = get_core_package_dir(
"tool-unity",
auto_install=auto_install_unity,
)
if unity_dir:
includes["unity"].append(unity_dir)

Expand Down Expand Up @@ -92,7 +101,7 @@ def _get_gcc_defines(env):
def _dump_defines(env):
defines = []
# global symbols
for item in processDefines(env.get("CPPDEFINES", [])):
for item in SCons.Defaults.processDefines(env.get("CPPDEFINES", [])):
item = item.strip()
if item:
defines.append(env.subst(item).replace("\\", ""))
Expand Down Expand Up @@ -141,25 +150,17 @@ def _get_svd_path(env):
return None


def _escape_build_flag(flags):
return [flag if " " not in flag else '"%s"' % flag for flag in flags]
def _subst_cmd(env, cmd):
args = env.subst_list(cmd, SCons.Subst.SUBST_CMD)[0]
return " ".join([SCons.Subst.quote_spaces(arg) for arg in args])


def DumpIDEData(env, globalenv):
""" env here is `projenv`"""

env["__escape_build_flag"] = _escape_build_flag

LINTCCOM = (
"${__escape_build_flag(CFLAGS)} ${__escape_build_flag(CCFLAGS)} $CPPFLAGS"
)
LINTCXXCOM = (
"${__escape_build_flag(CXXFLAGS)} ${__escape_build_flag(CCFLAGS)} $CPPFLAGS"
)

data = {
"env_name": env["PIOENV"],
"libsource_dirs": [env.subst(l) for l in env.GetLibSourceDirs()],
"libsource_dirs": [env.subst(item) for item in env.GetLibSourceDirs()],
"defines": _dump_defines(env),
"includes": _dump_includes(env),
"cc_path": where_is_program(env.subst("$CC"), env.subst("${ENV['PATH']}")),
Expand All @@ -181,15 +182,21 @@ def DumpIDEData(env, globalenv):
env_ = env.Clone()
# https://github.com/platformio/platformio-atom-ide/issues/34
_new_defines = []
for item in processDefines(env_.get("CPPDEFINES", [])):
for item in SCons.Defaults.processDefines(env_.get("CPPDEFINES", [])):
item = item.replace('\\"', '"')
if " " in item:
_new_defines.append(item.replace(" ", "\\\\ "))
else:
_new_defines.append(item)
env_.Replace(CPPDEFINES=_new_defines)

data.update({"cc_flags": env_.subst(LINTCCOM), "cxx_flags": env_.subst(LINTCXXCOM)})
# export C/C++ build flags
data.update(
{
"cc_flags": _subst_cmd(env_, "$CFLAGS $CCFLAGS $CPPFLAGS"),
"cxx_flags": _subst_cmd(env_, "$CXXFLAGS $CCFLAGS $CPPFLAGS"),
}
)

return data

Expand Down
81 changes: 42 additions & 39 deletions platformio/builder/tools/piomaxlen.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,30 @@

from __future__ import absolute_import

from hashlib import md5
from os import makedirs
from os.path import isdir, isfile, join
import hashlib
import os
import re

from SCons.Platform import TempFileMunge # pylint: disable=import-error
from SCons.Subst import quote_spaces # pylint: disable=import-error

from platformio.compat import WINDOWS, hashlib_encode_data

# Windows CLI has limit with command length to 8192
# Leave 2000 chars for flags and other options
MAX_LINE_LENGTH = 6000 if WINDOWS else 128072
# There are the next limits depending on a platform:
# - Windows = 8192
# - Unix = 131072
# We need ~256 characters for a temporary file path
MAX_LINE_LENGTH = (8192 if WINDOWS else 131072) - 256

WINPATHSEP_RE = re.compile(r"\\([^\"'\\]|$)")


def tempfile_arg_esc_func(arg):
arg = quote_spaces(arg)
if not WINDOWS:
return arg
# GCC requires double Windows slashes, let's use UNIX separator
return WINPATHSEP_RE.sub(r"/\1", arg)


def long_sources_hook(env, sources):
Expand All @@ -41,30 +56,14 @@ def long_sources_hook(env, sources):
return '@"%s"' % _file_long_data(env, " ".join(data))


def long_incflags_hook(env, incflags):
_incflags = env.subst(incflags).replace("\\", "/")
if len(_incflags) < MAX_LINE_LENGTH:
return incflags

# fix space in paths
data = []
for line in _incflags.split(" -I"):
line = line.strip()
if not line.startswith("-I"):
line = "-I" + line
data.append('-I"%s"' % line[2:])

return '@"%s"' % _file_long_data(env, " ".join(data))


def _file_long_data(env, data):
build_dir = env.subst("$BUILD_DIR")
if not isdir(build_dir):
makedirs(build_dir)
tmp_file = join(
build_dir, "longcmd-%s" % md5(hashlib_encode_data(data)).hexdigest()
if not os.path.isdir(build_dir):
os.makedirs(build_dir)
tmp_file = os.path.join(
build_dir, "longcmd-%s" % hashlib.md5(hashlib_encode_data(data)).hexdigest()
)
if isfile(tmp_file):
if os.path.isfile(tmp_file):
return tmp_file
with open(tmp_file, "w") as fp:
fp.write(data)
Expand All @@ -76,17 +75,21 @@ def exists(_):


def generate(env):
env.Replace(_long_sources_hook=long_sources_hook)
env.Replace(_long_incflags_hook=long_incflags_hook)
coms = {}
for key in ("ARCOM", "LINKCOM"):
coms[key] = env.get(key, "").replace(
"$SOURCES", "${_long_sources_hook(__env__, SOURCES)}"
)
for key in ("_CCCOMCOM", "ASPPCOM"):
coms[key] = env.get(key, "").replace(
"$_CPPINCFLAGS", "${_long_incflags_hook(__env__, _CPPINCFLAGS)}"
)
env.Replace(**coms)
kwargs = dict(
_long_sources_hook=long_sources_hook,
TEMPFILE=TempFileMunge,
MAXLINELENGTH=MAX_LINE_LENGTH,
TEMPFILEARGESCFUNC=tempfile_arg_esc_func,
TEMPFILESUFFIX=".tmp",
TEMPFILEDIR="$BUILD_DIR",
)

for name in ("LINKCOM", "ASCOM", "ASPPCOM", "CCCOM", "CXXCOM"):
kwargs[name] = "${TEMPFILE('%s','$%sSTR')}" % (env.get(name), name)

kwargs["ARCOM"] = env.get("ARCOM", "").replace(
"$SOURCES", "${_long_sources_hook(__env__, SOURCES)}"
)
env.Replace(**kwargs)

return env
1 change: 1 addition & 0 deletions platformio/commands/debug/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def _cleanup_cmds(items):
tool_name,
tool_settings,
),
speed=env_options.get("debug_speed", tool_settings.get("speed")),
server=server_options,
)
return result
Expand Down
Loading

0 comments on commit 90a325a

Please sign in to comment.