Export path to SVD file for IDEs

This commit is contained in:
Ivan Kravets
2018-04-27 20:37:41 +03:00
parent f46072f769
commit b1caaa2208
2 changed files with 24 additions and 3 deletions

View File

@ -16,7 +16,7 @@ from __future__ import absolute_import
from glob import glob
from os import environ
from os.path import abspath, join
from os.path import abspath, dirname, join
from SCons.Defaults import processDefines
@ -107,6 +107,19 @@ def _dump_defines(env):
return defines
def _get_svd_path(env):
if "BOARD" not in env:
return None
try:
svd_path = env.BoardConfig().get("debug.svd_path")
except KeyError:
return None
if not svd_path:
return None
with util.cd(dirname(env.BoardConfig().manifest_path)):
return abspath(svd_path)
def DumpIDEData(env):
LINTCCOM = "$CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS"
LINTCXXCOM = "$CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS"
@ -130,6 +143,8 @@ def DumpIDEData(env):
util.where_is_program(env.subst("$GDB"), env.subst("${ENV['PATH']}")),
"prog_path":
env.subst("$PROG_PATH"),
"svd_path":
_get_svd_path(env),
"compiler_type":
env.GetCompilerType()
}

View File

@ -28,18 +28,24 @@
{
"type": "platformio-debug",
"request": "launch",
"name": "PlatformIO Debugger (Beta)",
"name": "PlatformIO Debugger (Dev)",
"executable": "{{ _escape_path(prog_path) }}",
"toolchainBinDir": "{{ _escape_path(dirname(gdb_path)) }}",
% if svd_path:
"svdPath": "{{ _escape_path(svd_path) }}",
% end
"preLaunchTask": "PlatformIO: Pre-Debug",
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "platformio-debug",
"request": "launch",
"name": "PlatformIO Debugger (Beta) (Quick)",
"name": "PlatformIO Debugger (Dev) (Quick)",
"executable": "{{ _escape_path(prog_path) }}",
"toolchainBinDir": "{{ _escape_path(dirname(gdb_path)) }}",
% if svd_path:
"svdPath": "{{ _escape_path(svd_path) }}",
% end
"internalConsoleOptions": "openOnSessionStart"
}
]