Skip to content

Commit

Permalink
Merge branch 'release/v5.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Mar 17, 2021
2 parents 90a325a + 18b18f1 commit d2ae333
Show file tree
Hide file tree
Showing 36 changed files with 248 additions and 177 deletions.
3 changes: 0 additions & 3 deletions .isort.cfg

This file was deleted.

13 changes: 11 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ PlatformIO Core 5

**A professional collaborative platform for embedded development**

5.1.1 (2021-03-17)
~~~~~~~~~~~~~~~~~~

* Fixed a "The command line is too long" issue with a linking process on Windows (`issue #3827 <https://github.com/platformio/platformio-core/issues/3827>`_)
* Fixed an issue with `device monitor <https://docs.platformio.org/page/core/userguide/device/cmd_monitor.html>`__ when the "send_on_enter" filter didn't send EOL chars (`issue #3787 <https://github.com/platformio/platformio-core/issues/3787>`_)
* Fixed an issue with silent mode when unwanted data is printed to stdout (`issue #3837 <https://github.com/platformio/platformio-core/issues/3837>`_)
* Fixed an issue when code inspection fails with "Bad JSON" (`issue #3790 <https://github.com/platformio/platformio-core/issues/3790>`_)
* Fixed an issue with overriding user-specified debugging configuration information in VSCode (`issue #3824 <https://github.com/platformio/platformio-core/issues/3824>`_)

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
- Boosted `PlatformIO Home <https://docs.platformio.org/page/home/index.html>`__ 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**
Expand Down Expand Up @@ -45,7 +54,7 @@ PlatformIO Core 5
- 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>`_)
- Fixed an issue when `pio device monitor --eol <https://docs.platformio.org/page/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)
~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion docs
Submodule docs updated 89 files
+153 −0 boards/espressif32/esp32-s2-kaluga-1.rst
+153 −0 boards/espressif32/esp32-s2-saola-1.rst
+156 −0 boards/espressif32/esp32doit-espduino.rst
+156 −0 boards/espressif32/esp32thing_plus.rst
+102 −0 boards/espressif32/etboard.rst
+153 −0 boards/espressif32/featheresp32-s2.rst
+102 −0 boards/espressif32/healthypi4.rst
+102 −0 boards/espressif32/heltec_wireless_stick_lite.rst
+156 −0 boards/espressif32/honeylemon.rst
+102 −0 boards/espressif32/imbrios-logsens-v1p1.rst
+102 −0 boards/espressif32/inex_openkb.rst
+102 −0 boards/espressif32/kits-edu.rst
+102 −0 boards/espressif32/labplus_mpython.rst
+102 −0 boards/espressif32/lolin32_lite.rst
+1 −1 boards/espressif32/lolin_d32_pro.rst
+102 −0 boards/espressif32/m5stack-atom.rst
+102 −0 boards/espressif32/m5stack-core2.rst
+102 −0 boards/espressif32/m5stack-coreink.rst
+102 −0 boards/espressif32/m5stack-timer-cam.rst
+102 −0 boards/espressif32/mgbot-iotik32a.rst
+102 −0 boards/espressif32/mgbot-iotik32b.rst
+102 −0 boards/espressif32/piranha_esp32.rst
+102 −0 boards/espressif32/s_odi_ultra.rst
+156 −0 boards/espressif32/sensesiot_weizen.rst
+156 −0 boards/espressif32/ttgo-lora32-v21.rst
+102 −0 boards/espressif32/ttgo-t7-v13-mini32.rst
+156 −0 boards/espressif32/ttgo-t7-v14-mini32.rst
+102 −0 boards/espressif32/wifiduino32.rst
+30 −0 boards/index.rst
+2 −2 boards/nxpimxrt/mimxrt1020_evk.rst
+2 −2 boards/nxpimxrt/mimxrt1050_evk.rst
+2 −2 boards/nxpimxrt/mimxrt1060_evk.rst
+2 −2 boards/nxpimxrt/mimxrt1064_evk.rst
+135 −0 boards/ststm32/genericSTM32F407IGT6.rst
+5 −5 boards/ststm32/genericSTM32F411RE.rst
+3 −0 boards/ststm32/nucleo_f303k8.rst
+3 −0 boards/ststm32/nucleo_f410rb.rst
+138 −0 boards/ststm32/nucleo_h723zg.rst
+3 −0 boards/ststm32/nucleo_l011k4.rst
+3 −0 boards/ststm32/nucleo_l031k6.rst
+3 −0 boards/ststm32/nucleo_l433rc_p.rst
+1 −0 boards/teensy/teensy40.rst
+1 −0 boards/teensy/teensy41.rst
+100 −0 boards/timsp430/lpmsp430g2476.rst
+1 −1 core/installation.rst
+0 −10 faq.rst
+387 −2 frameworks/arduino.rst
+28 −2 frameworks/cmsis.rst
+411 −0 frameworks/espidf.rst
+1 −0 frameworks/index.rst
+15 −2 frameworks/libopencm3.rst
+4 −4 frameworks/mbed.rst
+27 −0 frameworks/pulp-sdk.rst
+3 −3 frameworks/siwisdk.rst
+4 −0 frameworks/spl.rst
+28 −2 frameworks/stm32cube.rst
+94 −16 frameworks/zephyr.rst
+10 −0 integration/ide/vscode.rst
+1 −1 librarymanager/config.rst
+3 −3 platforms/atmelavr.rst
+13 −7 platforms/atmelsam.rst
+6 −6 platforms/chipsalliance.rst
+366 −1 platforms/espressif32.rst
+4 −0 platforms/espressif32_extra.rst
+3 −5 platforms/espressif8266_extra.rst
+13 −7 platforms/freescalekinetis.rst
+13 −7 platforms/nordicnrf51.rst
+13 −7 platforms/nordicnrf52.rst
+29 −23 platforms/nxpimxrt.rst
+13 −7 platforms/nxplpc.rst
+12 −6 platforms/sifive.rst
+13 −7 platforms/siliconlabsefm32.rst
+38 −9 platforms/ststm32.rst
+12 −1 platforms/timsp430.rst
+23 −9 plus/debug-tools/blackmagic.rst
+7 −0 plus/debug-tools/cmsis-dap.rst
+63 −0 plus/debug-tools/esp-prog.rst
+63 −0 plus/debug-tools/iot-bus-jtag.rst
+87 −10 plus/debug-tools/jlink.rst
+63 −0 plus/debug-tools/minimodule.rst
+7 −0 plus/debug-tools/mspdebug.rst
+63 −0 plus/debug-tools/olimex-arm-usb-ocd-h.rst
+63 −0 plus/debug-tools/olimex-arm-usb-ocd.rst
+63 −0 plus/debug-tools/olimex-arm-usb-tiny-h.rst
+63 −0 plus/debug-tools/olimex-jtag-tiny.rst
+15 −1 plus/debug-tools/stlink.rst
+63 −0 plus/debug-tools/tumpa.rst
+121 −9 plus/debugging.rst
+1 −1 tutorials/espressif32/espidf_debugging_unit_testing_analysis.rst
4 changes: 2 additions & 2 deletions platformio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import sys

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

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

__core_packages__ = {
"contrib-piohome": "~3.3.3",
"contrib-piohome": "~3.3.4",
"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.40100.2",
Expand Down
4 changes: 2 additions & 2 deletions platformio/builder/tools/piomaxlen.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
# 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
# We need ~512 characters for compiler and temporary file paths
MAX_LINE_LENGTH = (8192 if WINDOWS else 131072) - 512

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

Expand Down
1 change: 1 addition & 0 deletions platformio/builder/tools/pioplatform.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def BoardConfig(env, board=None):
except (AssertionError, UnknownBoard) as e:
sys.stderr.write("Error: %s\n" % str(e))
env.Exit(1)
return None


def GetFrameworkScript(env, framework):
Expand Down
33 changes: 17 additions & 16 deletions platformio/commands/check/tools/cppcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,13 @@ def parse_defect(self, raw_line):
)
click.echo()
self._bad_input = True
self._buffer = ""
return None

self._buffer = ""
return DefectItem(**args)

def configure_command(
self, language, src_files
): # pylint: disable=arguments-differ
def configure_command(self, language, src_file): # pylint: disable=arguments-differ
tool_path = os.path.join(get_core_package_dir("tool-cppcheck"), "cppcheck")

cmd = [
Expand Down Expand Up @@ -157,8 +156,8 @@ def configure_command(
"--include=" + inc
for inc in self.get_forced_includes(build_flags, self.cpp_includes)
)
cmd.append("--file-list=%s" % self._generate_src_file(src_files))
cmd.append("--includes-file=%s" % self._generate_inc_file())
cmd.append('"%s"' % src_file)

return cmd

Expand Down Expand Up @@ -227,23 +226,25 @@ def is_check_successful(cmd_result):

def check(self, on_defect_callback=None):
self._on_defect_callback = on_defect_callback
project_files = self.get_project_target_files(self.options["patterns"])

languages = ("c", "c++")
if not any([project_files[t] for t in languages]):
project_files = self.get_project_target_files(self.options["patterns"])
src_files_scope = ("c", "c++")
if not any(project_files[t] for t in src_files_scope):
click.echo("Error: Nothing to check.")
return True
for language in languages:
if not project_files[language]:
continue
cmd = self.configure_command(language, project_files[language])
if not cmd:
self._bad_input = True

for scope, files in project_files.items():
if scope not in src_files_scope:
continue
if self.options.get("verbose"):
click.echo(" ".join(cmd))
for src_file in files:
cmd = self.configure_command(scope, src_file)
if not cmd:
self._bad_input = True
continue
if self.options.get("verbose"):
click.echo(" ".join(cmd))

self.execute_check_cmd(cmd)
self.execute_check_cmd(cmd)

self.clean_up()

Expand Down
8 changes: 7 additions & 1 deletion platformio/commands/check/tools/pvsstudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,13 @@ def _prepare_preprocessed_file(self, src_file):
flags = self.cc_flags
compiler = self.cc_path

cmd = [compiler, src_file, "-E", "-o", self._tmp_preprocessed_file]
cmd = [
compiler,
'"%s"' % src_file,
"-E",
"-o",
'"%s"' % self._tmp_preprocessed_file,
]
cmd.extend([f for f in flags if f])
cmd.extend(["-D%s" % d for d in self.cpp_defines])
cmd.append('@"%s"' % self._tmp_cmd_file)
Expand Down
2 changes: 1 addition & 1 deletion platformio/commands/debug/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def configure_esp32_load_cmds(debug_options, configuration):
debug_options["load_cmds"] != ["load"],
"xtensa-esp32" not in configuration.get("cc_path", ""),
not flash_images,
not all([isfile(item["path"]) for item in flash_images]),
not all(isfile(item["path"]) for item in flash_images),
]
if any(ignore_conds):
return debug_options["load_cmds"]
Expand Down
2 changes: 1 addition & 1 deletion platformio/commands/device/filters/send_on_enter.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, *args, **kwargs):
def tx(self, text):
self._buffer += text
if self._buffer.endswith(self._eol):
text = self._buffer[: len(self._eol) * -1]
text = self._buffer
self._buffer = ""
return text
return ""
4 changes: 2 additions & 2 deletions platformio/commands/home/rpc/handlers/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import jsonrpc
from ajsonrpc.core import JSONRPC20DispatchException

from platformio.clients.account import AccountClient

Expand All @@ -24,6 +24,6 @@ def call_client(method, *args, **kwargs):
client = AccountClient()
return getattr(client, method)(*args, **kwargs)
except Exception as e: # pylint: disable=bare-except
raise jsonrpc.exceptions.JSONRPCDispatchException(
raise JSONRPC20DispatchException(
code=4003, message="PIO Account Call Error", data=str(e)
)
8 changes: 4 additions & 4 deletions platformio/commands/home/rpc/handlers/ide.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import time

import jsonrpc
from ajsonrpc.core import JSONRPC20DispatchException

from platformio.compat import get_running_loop

Expand All @@ -25,19 +25,19 @@ def __init__(self):

def send_command(self, sid, command, params):
if not self._queue.get(sid):
raise jsonrpc.exceptions.JSONRPCDispatchException(
raise JSONRPC20DispatchException(
code=4005, message="PIO Home IDE agent is not started"
)
while self._queue[sid]:
self._queue[sid].pop().set_result(
{"id": time.time(), "method": command, "params": params}
)

def listen_commands(self, sid=0):
async def listen_commands(self, sid=0):
if sid not in self._queue:
self._queue[sid] = []
self._queue[sid].append(get_running_loop().create_future())
return self._queue[sid][-1]
return await self._queue[sid][-1]

def open_project(self, sid, project_dir):
return self.send_command(sid, "open_project", project_dir)
Expand Down
4 changes: 2 additions & 2 deletions platformio/commands/home/rpc/handlers/piocore.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from io import StringIO

import click
import jsonrpc
from ajsonrpc.core import JSONRPC20DispatchException
from starlette.concurrency import run_in_threadpool

from platformio import __main__, __version__, fs, proc
Expand Down Expand Up @@ -99,7 +99,7 @@ async def call(args, options=None):
result = await PIOCoreRPC._call_subprocess(args, options)
return PIOCoreRPC._process_result(result, to_json)
except Exception as e: # pylint: disable=bare-except
raise jsonrpc.exceptions.JSONRPCDispatchException(
raise JSONRPC20DispatchException(
code=4003, message="PIO Core Call Error", data=str(e)
)

Expand Down
20 changes: 9 additions & 11 deletions platformio/commands/home/rpc/handlers/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import shutil
import time

import jsonrpc
from ajsonrpc.core import JSONRPC20DispatchException

from platformio import exception, fs
from platformio.commands.home.rpc.handlers.app import AppRPC
Expand Down Expand Up @@ -257,18 +257,16 @@ async def import_arduino(self, board, use_arduino_libs, arduino_project_dir):
return arduino_project_dir

is_arduino_project = any(
[
os.path.isfile(
os.path.join(
arduino_project_dir,
"%s.%s" % (os.path.basename(arduino_project_dir), ext),
)
os.path.isfile(
os.path.join(
arduino_project_dir,
"%s.%s" % (os.path.basename(arduino_project_dir), ext),
)
for ext in ("ino", "pde")
]
)
for ext in ("ino", "pde")
)
if not is_arduino_project:
raise jsonrpc.exceptions.JSONRPCDispatchException(
raise JSONRPC20DispatchException(
code=4000, message="Not an Arduino project: %s" % arduino_project_dir
)

Expand Down Expand Up @@ -303,7 +301,7 @@ async def import_arduino(self, board, use_arduino_libs, arduino_project_dir):
@staticmethod
async def import_pio(project_dir):
if not project_dir or not is_platformio_project(project_dir):
raise jsonrpc.exceptions.JSONRPCDispatchException(
raise JSONRPC20DispatchException(
code=4001, message="Not an PlatformIO project: %s" % project_dir
)
new_project_dir = os.path.join(
Expand Down
45 changes: 12 additions & 33 deletions platformio/commands/home/rpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import inspect
import json

import click
import jsonrpc
from ajsonrpc.dispatcher import Dispatcher
from ajsonrpc.manager import AsyncJSONRPCResponseManager
from starlette.endpoints import WebSocketEndpoint

from platformio.compat import create_task, get_running_loop, is_bytes
from platformio.compat import create_task, get_running_loop
from platformio.proc import force_exit


Expand All @@ -30,13 +28,15 @@ class JSONRPCServerFactoryBase:

def __init__(self, shutdown_timeout=0):
self.shutdown_timeout = shutdown_timeout
self.dispatcher = jsonrpc.Dispatcher()
self.manager = AsyncJSONRPCResponseManager(
Dispatcher(), is_server_error_verbose=True
)

def __call__(self, *args, **kwargs):
raise NotImplementedError

def addHandler(self, handler, namespace):
self.dispatcher.build_method_map(handler, prefix="%s." % namespace)
def addObjectHandler(self, handler, namespace):
self.manager.dispatcher.add_object(handler, prefix="%s." % namespace)

def on_client_connect(self):
self.connection_nums += 1
Expand Down Expand Up @@ -90,29 +90,8 @@ async def on_disconnect(self, websocket, close_code):
self.factory.on_client_disconnect() # pylint: disable=no-member

async def _handle_rpc(self, websocket, data):
response = jsonrpc.JSONRPCResponseManager.handle(
data, self.factory.dispatcher # pylint: disable=no-member
)
if response.result and inspect.isawaitable(response.result):
try:
response.result = await response.result
response.data["result"] = response.result
response.error = None
except Exception as exc: # pylint: disable=broad-except
if not isinstance(exc, jsonrpc.exceptions.JSONRPCDispatchException):
exc = jsonrpc.exceptions.JSONRPCDispatchException(
code=4999, message=str(exc)
)
response.result = None
response.error = exc.error._data # pylint: disable=protected-access
new_data = response.data.copy()
new_data["error"] = response.error
del new_data["result"]
response.data = new_data

# pylint: disable=no-member
response = await self.factory.manager.get_response_for_payload(data)
if response.error:
click.secho("Error: %s" % response.error, fg="red", err=True)
if "result" in response.data and is_bytes(response.data["result"]):
response.data["result"] = response.data["result"].decode("utf-8")

await websocket.send_text(json.dumps(response.data))
click.secho("Error: %s" % response.error.data, fg="red", err=True)
await websocket.send_text(self.factory.manager.serialize(response.body))
14 changes: 7 additions & 7 deletions platformio/commands/home/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ def run_server(host, port, no_open, shutdown_timeout, home_url):
raise PlatformioException("Invalid path to PIO Home Contrib")

ws_rpc_factory = WebSocketJSONRPCServerFactory(shutdown_timeout)
ws_rpc_factory.addHandler(AccountRPC(), namespace="account")
ws_rpc_factory.addHandler(AppRPC(), namespace="app")
ws_rpc_factory.addHandler(IDERPC(), namespace="ide")
ws_rpc_factory.addHandler(MiscRPC(), namespace="misc")
ws_rpc_factory.addHandler(OSRPC(), namespace="os")
ws_rpc_factory.addHandler(PIOCoreRPC(), namespace="core")
ws_rpc_factory.addHandler(ProjectRPC(), namespace="project")
ws_rpc_factory.addObjectHandler(AccountRPC(), namespace="account")
ws_rpc_factory.addObjectHandler(AppRPC(), namespace="app")
ws_rpc_factory.addObjectHandler(IDERPC(), namespace="ide")
ws_rpc_factory.addObjectHandler(MiscRPC(), namespace="misc")
ws_rpc_factory.addObjectHandler(OSRPC(), namespace="os")
ws_rpc_factory.addObjectHandler(PIOCoreRPC(), namespace="core")
ws_rpc_factory.addObjectHandler(ProjectRPC(), namespace="project")

path = urlparse(home_url).path
routes = [
Expand Down
Loading

0 comments on commit d2ae333

Please sign in to comment.