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 import sys
VERSION = (3, 4, "0a1") VERSION = (3, 4, "0a2")
__version__ = ".".join([str(s) for s in VERSION]) __version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio" __title__ = "platformio"

View File

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

View File

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

View File

@ -15,7 +15,7 @@
from __future__ import absolute_import from __future__ import absolute_import
from glob import glob from glob import glob
from os.path import join from os.path import join, sep
from SCons.Defaults import processDefines from SCons.Defaults import processDefines
@ -64,6 +64,9 @@ def dump_defines(env):
def dump_debug(env): def dump_debug(env):
def _fix_path_sep(path):
return path.replace("/", sep).replace("\\", sep)
def _dump_server(configuration): def _dump_server(configuration):
if not configuration: if not configuration:
return return
@ -74,8 +77,8 @@ def dump_debug(env):
return return
return { return {
"cwd": pkg_dir, "cwd": pkg_dir,
"executable": configuration['executable'], "executable": _fix_path_sep(configuration['executable']),
"arguments": configuration.get("arguments") "arguments": _fix_path_sep(configuration.get("arguments"))
} }
gdbinit = None gdbinit = None
@ -85,9 +88,9 @@ def dump_debug(env):
else: else:
gdbinit = [env['DEBUG_GDBINIT']] gdbinit = [env['DEBUG_GDBINIT']]
link_settings = env.DebugLinkSettings() tool_settings = env.DebugToolSettings()
if link_settings and not gdbinit: if tool_settings and not gdbinit:
gdbinit = link_settings.get("gdbinit") gdbinit = tool_settings.get("gdbinit")
env.AutodetectDebugPort() env.AutodetectDebugPort()
@ -95,11 +98,11 @@ def dump_debug(env):
"gdb_path": util.where_is_program( "gdb_path": util.where_is_program(
env.subst("$GDB"), env.subst("${ENV['PATH']}")), env.subst("$GDB"), env.subst("${ENV['PATH']}")),
"prog_path": env.subst("$PROG_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, "gdbinit": [env.subst(cmd) for cmd in gdbinit] if gdbinit else None,
"port": env.subst("$DEBUG_PORT"), "port": env.subst("$DEBUG_PORT"),
"server": (_dump_server(link_settings['server']) "server": (_dump_server(tool_settings['server'])
if link_settings and "server" in link_settings else None) 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_port", "upload_protocol", "upload_speed", "upload_flags",
"upload_resetmethod", "lib_install", "lib_deps", "lib_force", "upload_resetmethod", "lib_install", "lib_deps", "lib_force",
"lib_ignore", "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", "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") "debug_gdbinit")
REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"}

View File

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