Skip to content

Commit

Permalink
Merge branch 'develop' into feature/py3
Browse files Browse the repository at this point in the history
* develop: (31 commits)
  Document "erase" target
  Docs: Grammar fixes
  Bump version to 3.6.2b5
  Improved IntelliSense for PlatformIO IDE for VSCode via passing extra compiler information for C/C++ Code Parser
  Bump version to 3.6.2b4
  LDF: Stop handling "define" and "undef" when condition fails; handle CPP files in "chain+" and "deep+" modes // Resolve #1930
  Bump version to 3.6.2b3
  Handle CWD when searching for a file // Resolve #1930
  Document in `library.json` how to pass flags to a global build environment
  Bump version to 3.6.2b2
  Fix an issue when Library Dependency Finder (LDF) finds spurious dependencies in ``chain+`` and ``deep+`` modes // Resolve #1930
  Fix an issue when Library Dependency Finder (LDF) does not handle project `src_filter ` // Resolve #1905
  Bump version to 3.6.2b1
  Prepend CPPATH of library dependencies instead of appending // Resolve #1914
  Bump version to 3.6.2a3
  Go over 8010-8100 TCP ports when shutting down PIO Home server
  Docs: Add support for OLIMEX ESP32-PRO
  Rename "System" to "Hardware" for board spec
  Add info about "EN" pin for ESP32 and debug probes
  Fix pinouts for oddWires IOT-Bus JTAG
  ...

# Conflicts:
#	platformio/__init__.py
#	platformio/managers/core.py
  • Loading branch information
ivankravets committed Nov 24, 2018
2 parents 188c880 + 7574798 commit 50f26d9
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 59 deletions.
15 changes: 14 additions & 1 deletion HISTORY.rst
Expand Up @@ -4,7 +4,20 @@ Release Notes
PlatformIO 3.0
--------------

3.6.1 (2018-??-??)
3.6.2 (2018-??-??)
~~~~~~~~~~~~~~~~~~

* Improved IntelliSense for `PlatformIO IDE for VSCode <http://docs.platformio.org/page/ide/vscode.html>`__ via passing extra compiler information for C/C++ Code Parser (resolves issues with spurious project's "Problems")
* Fixed an issue with VSCode IntelliSense warning about the missed headers located in `include <http://docs.platformio.org/page/projectconf/section_platformio.html#include-dir>`__ folder
* Fixed incorrect wording when initializing/updating project
* Fixed an issue with incorrect order for library dependencies ``CPPPATH``
(`issue #1914 <https://github.com/platformio/platformio-core/issues/1914>`_)
* Fixed an issue when Library Dependency Finder (LDF) does not handle project `src_filter <http://docs.platformio.org/page/projectconf/section_env_build.html#src-filter>`__
(`issue #1905 <https://github.com/platformio/platformio-core/issues/1905>`_)
* Fixed an issue when Library Dependency Finder (LDF) finds spurious dependencies in ``chain+`` and ``deep+`` modes
(`issue #1930 <https://github.com/platformio/platformio-core/issues/1930>`_)

3.6.1 (2018-10-29)
~~~~~~~~~~~~~~~~~~

* Generate an `include <http://docs.platformio.org/page/projectconf/section_platformio.html#include-dir>`__ and `test <http://docs.platformio.org/page/projectconf/section_platformio.html#test-dir>`__ directories with a README file when initializing a new project
Expand Down
6 changes: 3 additions & 3 deletions platformio/__init__.py
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION = (3, 6, "1rc7")
VERSION = (4, 0, "a1")
__version__ = ".".join([str(s) for s in VERSION])

__title__ = "platformio"
Expand All @@ -24,8 +24,8 @@
"FPGA, CMSIS, SPL, AVR, Samsung ARTIK, libOpenCM3")
__url__ = "https://platformio.org"

__author__ = "Ivan Kravets"
__email__ = "me@ikravets.com"
__author__ = "PlatformIO"
__email__ = "contact@platformio.org"

__license__ = "Apache Software License"
__copyright__ = "Copyright 2014-present PlatformIO"
Expand Down
10 changes: 7 additions & 3 deletions platformio/builder/tools/pioide.py
Expand Up @@ -25,7 +25,7 @@


def _dump_includes(env):
includes = [env.subst("$PROJECTINCLUDE_DIR"), env.subst("$PROJECTSRC_DIR")]
includes = []

for item in env.get("CPPPATH", []):
includes.append(env.subst(item))
Expand Down Expand Up @@ -53,6 +53,10 @@ def _dump_includes(env):
if unity_dir:
includes.append(unity_dir)

includes.extend(
[env.subst("$PROJECTINCLUDE_DIR"),
env.subst("$PROJECTSRC_DIR")])

# remove duplicates
result = []
for item in includes:
Expand Down Expand Up @@ -130,8 +134,8 @@ def _get_svd_path(env):


def DumpIDEData(env):
LINTCCOM = "$CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS"
LINTCXXCOM = "$CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS"
LINTCCOM = "$CFLAGS $CCFLAGS $CPPFLAGS"
LINTCXXCOM = "$CXXFLAGS $CCFLAGS $CPPFLAGS"

data = {
"libsource_dirs":
Expand Down
57 changes: 32 additions & 25 deletions platformio/builder/tools/piolib.py
Expand Up @@ -354,7 +354,7 @@ def _get_found_includes(self, search_files=None):
for path in self._validate_search_files(search_files):
try:
assert "+" in self.lib_ldf_mode
incs = LibBuilderBase.CCONDITIONAL_SCANNER(
candidates = LibBuilderBase.CCONDITIONAL_SCANNER(
self.env.File(path),
self.env,
tuple(include_dirs),
Expand All @@ -364,26 +364,26 @@ def _get_found_includes(self, search_files=None):
sys.stderr.write(
"Warning! Classic Pre Processor is used for `%s`, "
"advanced has failed with `%s`\n" % (path, e))
_incs = LibBuilderBase.CLASSIC_SCANNER(
candidates = LibBuilderBase.CLASSIC_SCANNER(
self.env.File(path), self.env, tuple(include_dirs))
incs = []
for inc in _incs:
incs.append(inc)
if not self.PARSE_SRC_BY_H_NAME:
continue
_h_path = inc.get_abspath()
if not self.env.IsFileWithExt(_h_path,
piotool.SRC_HEADER_EXT):

# print(path, map(lambda n: n.get_abspath(), candidates))
for item in candidates:
if item not in result:
result.append(item)
if not self.PARSE_SRC_BY_H_NAME:
continue
_h_path = item.get_abspath()
if not self.env.IsFileWithExt(_h_path, piotool.SRC_HEADER_EXT):
continue
_f_part = _h_path[:_h_path.rindex(".")]
for ext in piotool.SRC_C_EXT:
if not isfile("%s.%s" % (_f_part, ext)):
continue
_f_part = _h_path[:_h_path.rindex(".")]
for ext in piotool.SRC_C_EXT:
if isfile("%s.%s" % (_f_part, ext)):
incs.append(
self.env.File("%s.%s" % (_f_part, ext)))
# print(path, map(lambda n: n.get_abspath(), incs))
for inc in incs:
if inc not in result:
result.append(inc)
_c_path = self.env.File("%s.%s" % (_f_part, ext))
if _c_path not in result:
result.append(_c_path)

return result

def depend_recursive(self, lb, search_files=None):
Expand Down Expand Up @@ -439,23 +439,23 @@ def build(self):
libs.extend(lb.build())
# copy shared information to self env
for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"):
self.env.AppendUnique(**{key: lb.env.get(key)})
self.env.PrependUnique(**{key: lb.env.get(key)})

for lb in self._circular_deps:
self.env.AppendUnique(CPPPATH=lb.get_include_dirs())
self.env.PrependUnique(CPPPATH=lb.get_include_dirs())

if self._is_built:
return libs
self._is_built = True

self.env.AppendUnique(CPPPATH=self.get_include_dirs())
self.env.PrependUnique(CPPPATH=self.get_include_dirs())

if self.lib_ldf_mode == "off":
for lb in self.env.GetLibBuilders():
if self == lb or not lb.is_built:
continue
for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"):
self.env.AppendUnique(**{key: lb.env.get(key)})
self.env.PrependUnique(**{key: lb.env.get(key)})

if self.lib_archive:
libs.append(
Expand Down Expand Up @@ -670,6 +670,12 @@ def get_include_dirs(self):

class ProjectAsLibBuilder(LibBuilderBase):

def __init__(self, env, *args, **kwargs):
# backup original value, will be reset in base.__init__
project_src_filter = env.get("SRC_FILTER")
super(ProjectAsLibBuilder, self).__init__(env, *args, **kwargs)
self.env['SRC_FILTER'] = project_src_filter

@property
def include_dir(self):
include_dir = self.env.subst("$PROJECTINCLUDE_DIR")
Expand Down Expand Up @@ -708,7 +714,8 @@ def lib_ldf_mode(self):

@property
def src_filter(self):
return self.env.get("SRC_FILTER", LibBuilderBase.src_filter.fget(self))
return (self.env.get("SRC_FILTER")
or LibBuilderBase.src_filter.fget(self))

def process_extra_options(self):
# skip for project, options are already processed
Expand Down Expand Up @@ -750,7 +757,7 @@ def process_dependencies(self): # pylint: disable=too-many-branches

def build(self):
self._is_built = True # do not build Project now
self.env.AppendUnique(CPPPATH=self.get_include_dirs())
self.env.PrependUnique(CPPPATH=self.get_include_dirs())
return LibBuilderBase.build(self)


Expand Down
13 changes: 7 additions & 6 deletions platformio/builder/tools/pioplatform.py
Expand Up @@ -129,15 +129,15 @@ def LoadPioPlatform(env, variables):
def PrintConfiguration(env):
platform = env.PioPlatform()
platform_data = ["PLATFORM: %s >" % platform.title]
system_data = ["SYSTEM:"]
hardware_data = ["HARDWARE:"]
configuration_data = ["CONFIGURATION:"]
mcu = env.subst("$BOARD_MCU")
f_cpu = env.subst("$BOARD_F_CPU")
if mcu:
system_data.append(mcu.upper())
hardware_data.append(mcu.upper())
if f_cpu:
f_cpu = int("".join([c for c in str(f_cpu) if c.isdigit()]))
system_data.append("%dMHz" % (f_cpu / 1000000))
hardware_data.append("%dMHz" % (f_cpu / 1000000))

debug_tools = None
if "BOARD" in env:
Expand All @@ -147,13 +147,14 @@ def PrintConfiguration(env):
debug_tools = board_config.get("debug", {}).get("tools")
ram = board_config.get("upload", {}).get("maximum_ram_size")
flash = board_config.get("upload", {}).get("maximum_size")
system_data.append("%s RAM (%s Flash)" % (util.format_filesize(ram),
util.format_filesize(flash)))
hardware_data.append(
"%s RAM (%s Flash)" % (util.format_filesize(ram),
util.format_filesize(flash)))
configuration_data.append(
"https://docs.platformio.org/page/boards/%s/%s.html" %
(platform.name, board_config.id))

for data in (configuration_data, platform_data, system_data):
for data in (configuration_data, platform_data, hardware_data):
if len(data) > 1:
print(" ".join(data))

Expand Down
6 changes: 3 additions & 3 deletions platformio/builder/tools/platformio.py
Expand Up @@ -44,10 +44,10 @@ def scons_patched_match_splitext(path, suffixes=None):
def _build_project_deps(env):
project_lib_builder = env.ConfigureProjectLibBuilder()

# append project libs to the beginning of list
# prepend project libs to the beginning of list
env.Prepend(LIBS=project_lib_builder.build())
# append extra linker related options from libs
env.AppendUnique(
# prepend extra linker related options from libs
env.PrependUnique(
**{
key: project_lib_builder.env.get(key)
for key in ("LIBS", "LIBPATH", "LINKFLAGS")
Expand Down
13 changes: 7 additions & 6 deletions platformio/commands/init.py
Expand Up @@ -87,6 +87,7 @@ def cli(
click.echo("%s - Project Configuration File" % click.style(
"platformio.ini", fg="cyan"))

is_new_project = not util.is_platformio_project(project_dir)
init_base_project(project_dir)

if board:
Expand All @@ -100,18 +101,18 @@ def cli(
pg = ProjectGenerator(project_dir, ide, env_name)
pg.generate()

init_ci_conf(project_dir)
init_cvs_ignore(project_dir)
if is_new_project:
init_ci_conf(project_dir)
init_cvs_ignore(project_dir)

if silent:
return

project_inited_before = util.is_platformio_project(project_dir)
if ide:
click.secho(
"\nProject has been successfully %s including configuration files "
"for `%s` IDE." %
("updated" if project_inited_before else "initialized", ide),
"for `%s` IDE." % ("initialized" if is_new_project else "updated",
ide),
fg="green")
else:
click.secho(
Expand All @@ -121,7 +122,7 @@ def cli(
"- upload firmware to a target\n"
"`pio run --target clean` - clean project (remove compiled files)"
"\n`pio run --help` - additional information" %
("updated" if project_inited_before else "initialized"),
("initialized" if is_new_project else "updated"),
fg="green")


Expand Down
5 changes: 3 additions & 2 deletions platformio/ide/tpls/atom/.gcc-flags.json.tpl
@@ -1,7 +1,8 @@
% _defines = " ".join(["-D%s" % d for d in defines])
{
"execPath": "{{ cxx_path.replace("\\", "/") }}",
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}",
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}",
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
"gccErrorLimit": 15,
"gccIncludePaths": "{{ ','.join(includes).replace("\\", "/") }}",
"gccSuppressWarnings": false
Expand Down
5 changes: 3 additions & 2 deletions platformio/ide/tpls/vim/.gcc-flags.json.tpl
@@ -1,7 +1,8 @@
% _defines = " ".join(["-D%s" % d for d in defines])
{
"execPath": "{{ cxx_path.replace("\\", "/") }}",
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}",
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}",
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
"gccErrorLimit": 15,
"gccIncludePaths": "{{! ','.join("'{}'".format(w.replace("\\", '/')) for w in includes)}}",
"gccSuppressWarnings": false
Expand Down
Expand Up @@ -56,7 +56,7 @@
% if cxx_stds:
"cppStandard": "c++{{ cxx_stds[-1] }}",
% end
"compilerPath": "{{ cc_path.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"') }}"
"compilerPath": "{{ cc_path.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"') }} {{! STD_RE.sub("", cc_flags).replace('"', '\\"') }}"
}
]
}
8 changes: 4 additions & 4 deletions platformio/managers/core.py
Expand Up @@ -28,7 +28,7 @@
"contrib-pysite": ">=0.3.2,<2",
"tool-pioplus": "^1.5.0",
"tool-unity": "~1.20403.0",
"tool-scons": "~2.20501.4" if util.PY2 else "~3.30100.0"
"tool-scons": "~2.20501.7" if util.PY2 else "~3.30100.0"
}

PIOPLUS_AUTO_UPDATES_MAX = 100
Expand Down Expand Up @@ -106,12 +106,12 @@ def update_core_packages(only_check=False, silent=False):

def shutdown_piohome_servers():
port = 8010
while port < 9000:
while port < 8100:
try:
requests.get("http://127.0.0.1:%d?__shutdown__=1" % port)
port += 1
except: # pylint: disable=bare-except
return
pass
port += 1


def pioplus_call(args, **kwargs):
Expand Down
6 changes: 3 additions & 3 deletions scripts/docspregen.py
Expand Up @@ -628,8 +628,8 @@ def update_embedded_board(rst_path, board):
lines.append("""
.. contents::
System
------
Hardware
--------
Platform :ref:`platform_{platform}`: {platform_description}
Expand Down Expand Up @@ -822,7 +822,7 @@ def update_debugging():
# Debug tools
for tool, platforms in tool_to_platforms.items():
tool_path = join(DOCS_ROOT_DIR, "plus", "debug-tools", "%s.rst" % tool)
assert isfile(tool_path)
assert isfile(tool_path), tool
platforms = sorted(set(platforms))

lines = [".. begin_platforms"]
Expand Down

0 comments on commit 50f26d9

Please sign in to comment.