Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if s.name.startswith("_Z"):
mangled_names.append(s.name)
symbol_addrs.append(hex(symbol_addr))
symbols.append(symbol)
symbol_locations = _get_symbol_locations(env, elf_path, symbol_addrs)
demangled_names = _get_demangled_names(env, mangled_names)
for symbol in symbols:
if symbol["name"].startswith("_Z"):
symbol["demangled_name"] = demangled_names.get(symbol["name"])
location = symbol_locations.get(hex(symbol["addr"]))
if not location or "?" in location:
continue
if "windows" in get_systype():
drive, tail = splitdrive(location)
location = join(drive.upper(), tail)
symbol["file"] = location
symbol["line"] = 0
if ":" in location:
file_, line = location.rsplit(":", 1)
if line.isdigit():
symbol["file"] = file_
symbol["line"] = int(line)
return symbols
def _kill_previous_session(self):
assert self._session_id
pid = None
with app.ContentCache() as cc:
pid = cc.get(self._session_id)
cc.delete(self._session_id)
if not pid:
return
if "windows" in util.get_systype():
kill = ["Taskkill", "/PID", pid, "/F"]
else:
kill = ["kill", pid]
try:
proc.exec_command(kill)
except: # pylint: disable=bare-except
pass
def __init__(self):
if get_systype() == "linux_i686":
del self.PACKAGES['toolchain-gcclinux32']
BasePlatform.__init__(self)
self.packages["tool-dfuutil"]["optional"] = False
if board == "mxchip_az3166":
self.frameworks['arduino'][
'package'] = "framework-arduinostm32mxchip"
self.frameworks['arduino'][
'script'] = "builder/frameworks/arduino/mxchip.py"
self.packages['toolchain-gccarmnoneeabi']['version'] = "~1.60301.0"
if "zephyr" in variables.get("pioframework", []):
for p in self.packages:
if p.startswith("framework-zephyr-") or p in (
"tool-cmake", "tool-dtc", "tool-ninja"):
self.packages[p]["optional"] = False
self.packages['toolchain-gccarmnoneeabi']['version'] = "~1.80201.0"
if "windows" not in get_systype():
self.packages['tool-gperf']['optional'] = False
# configure J-LINK tool
jlink_conds = [
"jlink" in variables.get(option, "")
for option in ("upload_protocol", "debug_tool")
]
if variables.get("board"):
board_config = self.board_config(variables.get("board"))
jlink_conds.extend([
"jlink" in board_config.get(key, "")
for key in ("debug.default_tools", "upload.protocol")
])
jlink_pkgname = "tool-jlink"
if not any(jlink_conds) and jlink_pkgname in self.packages:
del self.packages[jlink_pkgname]
def configure_default_packages(self, envoptions, targets):
if (envoptions.get("framework") == "wiringpi" and
"linux_arm" not in util.get_systype()):
raise exception.PlatformioException(
"PlatformIO does not support temporary cross-compilation "
"for WiringPi framework. Please run PlatformIO directly on "
"Raspberry Pi"
)
return BasePlatform.configure_default_packages(
self, envoptions, targets)
click.secho(
"{name} @ {version} is already installed".format(
**self.load_manifest(package_dir)
),
fg="yellow",
)
return package_dir
if url:
pkg_dir = self._install_from_url(name, url, requirements, track=True)
else:
pkg_dir = self._install_from_piorepo(name, requirements)
if not pkg_dir or not self.manifest_exists(pkg_dir):
raise exception.PackageInstallError(
name, requirements or "*", util.get_systype()
)
manifest = self.load_manifest(pkg_dir)
assert manifest
click.secho(
"{name} @ {version} has been successfully installed!".format(
**manifest
),
fg="green",
)
return pkg_dir
def build_sc_idf():
if "windows" not in get_systype():
return
additional_packages = [
join(platform.get_package_dir("toolchain-xtensa-lx106-elf"), "bin"),
platform.get_package_dir("tool-ninja"),
join(platform.get_package_dir("tool-cmake"), "bin"),
]
if "windows" in get_systype():
additional_packages.append(platform.get_package_dir("tool-mconf"))
payload = """@rem This file was automatically generated
@set IDF_PATH={0}
@set PATH={1};%PATH%
@set CMAKE_ADD_SRC=1
python %IDF_PATH%/tools/idf.py build
@set CMAKE_ADD_SRC=
""".format(env.subst("$FRAMEWORK_DIR"),";".join([l for l in additional_packages]))
def _demangle_report(self, output_file):
converter_tool = os.path.join(
get_core_package_dir("tool-pvs-studio"),
"HtmlGenerator"
if "windows" in util.get_systype()
else os.path.join("bin", "plog-converter"),
)
cmd = (
converter_tool,
"-t",
"xml",
output_file,
"-m",
"cwe",
"-m",
"misra",
"--cerr",
)
result = proc.exec_command(cmd)
def configure_default_packages(self, variables, targets):
if "erase" in targets:
self.packages["tool-nrfjprog"]["optional"] = False
if "zephyr" in variables.get("pioframework", []):
for p in self.packages:
if p.startswith("framework-zephyr-") or p in (
"tool-cmake", "tool-dtc", "tool-ninja"):
self.packages[p]["optional"] = False
self.packages['toolchain-gccarmnoneeabi']['version'] = "~1.80201.0"
if "windows" not in get_systype():
self.packages['tool-gperf']['optional'] = False
# configure J-LINK tool
jlink_conds = [
"jlink" in variables.get(option, "")
for option in ("upload_protocol", "debug_tool")
]
if variables.get("board"):
board_config = self.board_config(variables.get("board"))
jlink_conds.extend([
"jlink" in board_config.get(key, "")
for key in ("debug.default_tools", "upload.protocol")
])
jlink_pkgname = "tool-jlink"
if not any(jlink_conds) and jlink_pkgname in self.packages:
del self.packages[jlink_pkgname]