Rename “debug_link” option to “debug_tool”

This commit is contained in:
Ivan Kravets
2017-04-01 14:35:55 +03:00
parent 8055c84087
commit 73f4bce99a
7 changed files with 30 additions and 27 deletions

2
docs

Submodule docs updated: b40924ea07...449625cac2

View File

@ -14,7 +14,7 @@
import sys
VERSION = (3, 4, "0a1")
VERSION = (3, 4, "0a2")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

@ -65,7 +65,7 @@ commonvars.AddVariables(
("UPLOAD_RESETMETHOD",),
# debug options
("DEBUG_LINK",),
("DEBUG_TOOL",),
("DEBUG_PORT",),
("DEBUG_GDBINIT",)

View File

@ -28,19 +28,19 @@ def ProcessDebug(env):
BUILD_UNFLAGS=["-Os", "-O0", "-O1", "-O2", "-O3"])
def DebugLinkSettings(env):
def DebugToolSettings(env):
if "BOARD" not in env:
return
board_debug = env.BoardConfig().get("debug", {})
if not board_debug or not board_debug.get("links"):
if not board_debug or not board_debug.get("tools"):
return
debug_links = board_debug.get("links")
link_name = (env.subst("$DEBUG_LINK") or
board_debug.get("default_link", debug_links.keys()[0]))
settings = debug_links.get(link_name)
debug_tools = board_debug.get("tools")
tool_name = (env.subst("$DEBUG_TOOL") or
board_debug.get("default_tool", debug_tools.keys()[0]))
settings = debug_tools.get(tool_name)
if not settings:
return
settings.update({"name": link_name})
settings.update({"name": tool_name})
return settings
@ -75,15 +75,15 @@ def AutodetectDebugPort(env):
if "BOARD" not in env or ("DEBUG_PORT" in env and not _get_pattern()):
return
link_settings = env.DebugLinkSettings()
if not link_settings:
tool_settings = env.DebugToolSettings()
if not tool_settings:
return
if not link_settings.get("require_debug_port"):
if not tool_settings.get("require_debug_port"):
return
need_openocd_rules = [
system() == "Linux",
"openocd" in link_settings.get("server", {}).get("package", ""),
"openocd" in tool_settings.get("server", {}).get("package", ""),
not any([
isfile("/etc/udev/rules.d/98-openocd-udev.rules"),
isfile("/lib/udev/rules.d/98-openocd-udev.rules")
@ -97,7 +97,7 @@ def AutodetectDebugPort(env):
"/develop/scripts/98-openocd-udev.rules\n")
env.Replace(
DEBUG_PORT=_look_for_serial_port(link_settings.get("hwids", [])))
DEBUG_PORT=_look_for_serial_port(tool_settings.get("hwids", [])))
if not env.subst("$DEBUG_PORT"):
sys.stderr.write(
@ -111,6 +111,6 @@ def exists(_):
def generate(env):
env.AddMethod(ProcessDebug)
env.AddMethod(DebugLinkSettings)
env.AddMethod(DebugToolSettings)
env.AddMethod(AutodetectDebugPort)
return env

View File

@ -15,7 +15,7 @@
from __future__ import absolute_import
from glob import glob
from os.path import join
from os.path import join, sep
from SCons.Defaults import processDefines
@ -64,6 +64,9 @@ def dump_defines(env):
def dump_debug(env):
def _fix_path_sep(path):
return path.replace("/", sep).replace("\\", sep)
def _dump_server(configuration):
if not configuration:
return
@ -74,8 +77,8 @@ def dump_debug(env):
return
return {
"cwd": pkg_dir,
"executable": configuration['executable'],
"arguments": configuration.get("arguments")
"executable": _fix_path_sep(configuration['executable']),
"arguments": _fix_path_sep(configuration.get("arguments"))
}
gdbinit = None
@ -85,9 +88,9 @@ def dump_debug(env):
else:
gdbinit = [env['DEBUG_GDBINIT']]
link_settings = env.DebugLinkSettings()
if link_settings and not gdbinit:
gdbinit = link_settings.get("gdbinit")
tool_settings = env.DebugToolSettings()
if tool_settings and not gdbinit:
gdbinit = tool_settings.get("gdbinit")
env.AutodetectDebugPort()
@ -95,11 +98,11 @@ def dump_debug(env):
"gdb_path": util.where_is_program(
env.subst("$GDB"), env.subst("${ENV['PATH']}")),
"prog_path": env.subst("$PROG_PATH"),
"link": link_settings['name'] if link_settings else None,
"tool": tool_settings['name'] if tool_settings else None,
"gdbinit": [env.subst(cmd) for cmd in gdbinit] if gdbinit else None,
"port": env.subst("$DEBUG_PORT"),
"server": (_dump_server(link_settings['server'])
if link_settings and "server" in link_settings else None)
"server": (_dump_server(tool_settings['server'])
if tool_settings and "server" in tool_settings else None)
}

View File

@ -129,7 +129,7 @@ class EnvironmentProcessor(object):
"upload_port", "upload_protocol", "upload_speed", "upload_flags",
"upload_resetmethod", "lib_install", "lib_deps", "lib_force",
"lib_ignore", "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode",
"test_ignore", "test_port", "piotest", "debug_link", "debug_port",
"test_ignore", "test_port", "piotest", "debug_tool", "debug_port",
"debug_gdbinit")
REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"}

View File

@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager
CORE_PACKAGES = {
"pysite-pioplus": ">=0.3.0,<2",
"tool-pioplus": ">=0.7.1,<2",
"tool-pioplus": ">=0.7.3,<2",
"tool-unity": "~1.20302.1",
"tool-scons": "~3.20501.2"
}