text
stringlengths
9
39.2M
dir
stringlengths
25
226
lang
stringclasses
163 values
created_date
timestamp[s]
updated_date
timestamp[s]
repo_name
stringclasses
751 values
repo_full_name
stringclasses
752 values
star
int64
1.01k
183k
len_tokens
int64
1
18.5M
```python #!/usr/bin/env python3 # # """ Dictionary-based Logging Database Generator This takes the built Zephyr ELF binary and produces a JSON database file for dictionary-based logging. This database is used together with the parser to decode binary log messages. """ import argparse import logging import os import...
/content/code_sandbox/scripts/logging/dictionary/database_gen.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
4,239
```python #!/usr/bin/env python3 # # """ Class for Dictionary-based Logging Database """ import base64 import copy import json from .mipi_syst import gen_syst_xml_file from .utils import extract_one_string_in_section from .utils import find_string_in_mappings ARCHS = { "arc" : { "kconfig": "CONFIG_ARC"...
/content/code_sandbox/scripts/logging/dictionary/dictionary_parser/log_database.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,965
```python #!/usr/bin/env python3 # # """ Contains a class to describe data types used for dictionary logging. """ import struct class DataTypes(): """Class regarding data types, their alignments and sizes""" INT = 0 UINT = 1 LONG = 2 ULONG = 3 LONG_LONG = 4 ULONG_LONG = 5 PTR = 6 ...
/content/code_sandbox/scripts/logging/dictionary/dictionary_parser/data_types.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,175
```python #!/usr/bin/env python3 # # # Parsers are gonig to have very similar code. # So tell pylint not to care. # pylint: disable=duplicate-code """ Dictionary-based Logging Parser Version 3 This contains the implementation of the parser for version 3 databases. """ import logging import struct import colorama fr...
/content/code_sandbox/scripts/logging/dictionary/dictionary_parser/log_parser_v3.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,788
```python #!/usr/bin/env python3 # # """ Utilities for MIPI Sys-T Collateral XML data """ from xml.sax.saxutils import escape XML_HEADER = """ <?xml version="1.0" encoding="utf-8"?> <syst:Collateral xmlns:syst="path_to_url" xmlns:xsi="path_to_url" xsi:schemaLocation="path_to_url path...
/content/code_sandbox/scripts/logging/dictionary/dictionary_parser/mipi_syst.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
754
```yaml # # A pykwalify schema for basic validation of the snippet.yml format. schema;append-schema: # Sub-schema for appending onto CMake list variables. # See uses under 'append:' keys below. type: map mapping: EXTRA_DTC_OVERLAY_FILE: type: str EXTRA_CONF_FILE: type: str DTS_EXTRA_CP...
/content/code_sandbox/scripts/schemas/snippet-schema.yml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
227
```yaml # ## A pykwalify schema for basic validation of the structure of a ## arch metadata YAML file. ## # The archs.yml file is a simple list of key value pairs containing architectures # and their location which is used by the build system. type: map mapping: archs: required: true type: seq sequence: ...
/content/code_sandbox/scripts/schemas/arch-schema.yml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
162
```yaml # ## A pykwalify schema for basic validation of the structure of a SoC ## metadata YAML file. ## # The soc.yml file is a simple list of key value pairs containing SoCs # located and the current structure level. schema;cpucluster-schema: required: false type: seq sequence: - type: map mapping: ...
/content/code_sandbox/scripts/schemas/soc-schema.yml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
710
```yaml # ## A pykwalify schema for basic validation of the structure of a ## board metadata YAML file. ## # The board.yml file is a simple list of key value pairs containing board # information like: name, vendor, socs, variants. schema;variant-schema: required: false type: seq sequence: - type: map m...
/content/code_sandbox/scripts/schemas/board-schema.yml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
761
```python #!/usr/bin/env python3 # # """ Dictionary-based Logging Parser Version 1 This contains the implementation of the parser for version 1 databases. """ import logging import math import struct import colorama from colorama import Fore from .log_parser import (LogParser, get_log_level_str_color, formalize_fmt...
/content/code_sandbox/scripts/logging/dictionary/dictionary_parser/log_parser_v1.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,745
```yaml type: seq sequence: - type: map required: false mapping: "available": type: bool required: false "connected": type: bool required: true "id": type: str required: true "notes": type: str required: false "platf...
/content/code_sandbox/scripts/schemas/twister/hwmap-schema.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
318
```yaml # # Schema to validate a YAML file describing a Zephyr test configuration. # type: map mapping: "platforms": type: map required: false mapping: "override_default_platforms": type: bool required: false "increased_platform_scope": type: bool required: fal...
/content/code_sandbox/scripts/schemas/twister/test-config-schema.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
206
```yaml # # Schema to validate a YAML file describing a Zephyr test platform # # We load this with pykwalify # (path_to_url # a YAML structure validator, to validate the YAML files that describe # Zephyr test platforms # # The original spec comes from Zephyr's twister script # type: map mapping: "identifier": ty...
/content/code_sandbox/scripts/schemas/twister/platform-schema.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
535
```yaml # # Schema to validate a YAML file providing the list of configurations # under quarantine # # We load this with pykwalify # (path_to_url # a YAML structure validator, to validate the YAML files that provide # a list of configurations (scenarios + platforms) under quarantine # type: seq matching: all sequence: ...
/content/code_sandbox/scripts/schemas/twister/quarantine-schema.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
229
```yaml # # Schema to validate a YAML file describing a Zephyr test platform # # We load this with pykwalify # (path_to_url # a YAML structure validator, to validate the YAML files that describe # Zephyr test platforms # # The original spec comes from Zephyr's twister script # schema;scenario-schema: type: map # ha...
/content/code_sandbox/scripts/schemas/twister/testsuite-schema.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,328
```python """ Utility script to migrate Zephyr-based projects to the new <zephyr/...> include prefix. .. note:: The script will also migrate <zephyr.h> or <zephyr/zephyr.h> to <zephyr/kernel.h>. Usage:: python $ZEPHYR_BASE/scripts/utils/migrate_includes.py \ -p path/to/zephyr-based-project ""...
/content/code_sandbox/scripts/utils/migrate_includes.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
581
```python """ Utility script to migrate SYS_INIT() calls from the old signature ``int (*init_fn)(const struct device *dev)`` to ``int (*init_fn)(void)``. .. warning:: Review the output carefully! This script may not cover all cases! Usage:: python $ZEPHYR_BASE/scripts/utils/migrate_sys_init.py \ -...
/content/code_sandbox/scripts/utils/migrate_sys_init.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
613
```python """ Utility script to migrate Zephyr-based projects to normative POSIX Kconfig options. This script should be used for migrating from versions of Zephyr older than v3.7.0 to Zephyr version v3.7.0 or later. Usage:: python $ZEPHYR_BASE/scripts/utils/migrate_posix_kconfigs.py -r root_path The utility wil...
/content/code_sandbox/scripts/utils/migrate_posix_kconfigs.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,142
```python #!/usr/bin/env python3 """This script converting the Zephyr coding guideline rst file to a output file, or print the output to the console. Which than can be used by a tool which needs to have that information in a specific format (e.g. for cppcheck). Or simply use the rule list to generate a filter to supp...
/content/code_sandbox/scripts/utils/convert_guidelines.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,046
```python """ Utility script to migrate Zephyr-based projects to new MCUmgr Kconfig options Usage:: python $ZEPHYR_BASE/scripts/utils/migrate_mcumgr_kconfigs.py -r root_path The utility will process c, cpp, h, hpp, rst, conf, CMakeLists.txt, yml, yaml and Kconfig files. """ import argparse from pathlib import...
/content/code_sandbox/scripts/utils/migrate_mcumgr_kconfigs.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,329
```python #!/usr/bin/env python3 """ Zephyr's NTC Thermistor DTS Table generator ########################################### This script can be used to generate an NTC thermistor DTS node with a "zephyr,compensation-table" property. This uses the Beta Parameter Equation path_to_url#beta-parameter-equation Look-up ...
/content/code_sandbox/scripts/utils/ntc_thermistor_table.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
659
```python """ Utility script to generate headers for the following macros - Z_LISTIFY - Z_UTIL_INC - Z_UTIL_DEC - Z_UTIL_X2 - Z_IS_EQ .. note:: The script will simply create the header files in the current working directory, they should be copied manually to $ZEPHYR_BASE/include/zephyr/sys/ accordingly. Usage...
/content/code_sandbox/scripts/utils/gen_util_macros.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,509
```python #!/usr/bin/env python """ Utility script to assist in the migration of a board from hardware model v1 (HWMv1) to hardware model v2 (HWMv2). .. warning:: This script is not a complete migration tool. It is meant to assist in the migration process, but it does not handle all cases. This script require...
/content/code_sandbox/scripts/utils/board_v1_to_v2.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,608
```python #!/usr/bin/env python3 """ Pinctrl Migration Utility Script for nRF Boards ############################################### This script can be used to automatically migrate the Devicetree files of nRF-based boards using the old <signal>-pin properties to select peripheral pins. The script will parse a board...
/content/code_sandbox/scripts/utils/pinctrl_nrf_migrate.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
4,424
```python """ Utility script to migrate Twister configuration files from using string-based lists to native YAML lists. Usage:: python $ZEPHYR_BASE/scripts/utils/twister_to_list.py \ -p path/to/zephyr-based-project """ import argparse from pathlib import Path from ruamel.yaml import YAML FIELDS = ...
/content/code_sandbox/scripts/utils/twister_to_list.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
428
```python #!/usr/bin/env python3 # """Query the Top-Ten Bug Bashers This script will query the top-ten Bug Bashers in a specified date window. Usage: ./scripts/bug-bash.py -t ~/.ghtoken -b 2021-07-26 -e 2021-08-07 GITHUB_TOKEN="..." ./scripts/bug-bash.py -b 2021-07-26 -e 2021-08-07 """ import argparse from ...
/content/code_sandbox/scripts/release/bug_bash.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,353
```python #!/usr/bin/env python3 # """Query issues in a release branch This script searches for issues referenced via pull-requests in a release branch in order to simplify tracking changes such as automated backports, manual backports, security fixes, and stability fixes. A formatted report is printed to standard o...
/content/code_sandbox/scripts/release/list_backports.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,549
```python # import os import uuid from west.commands import WestCommand from west import log from zspdx.sbom import SBOMConfig, makeSPDX, setupCmakeQuery SPDX_DESCRIPTION = """\ This command creates an SPDX 2.2 tag-value bill of materials following the completion of a Zephyr build. Prior to the build, an empty fil...
/content/code_sandbox/scripts/west_commands/spdx.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
964
```python # from west.commands import WestCommand from run_common import add_parser_common, do_run_common EXPORT_DESCRIPTION = '''\ Run RobotFramework test suites with a runner of choice. ''' class Robot(WestCommand): def __init__(self): super(Robot, self).__init__( 'robot', # K...
/content/code_sandbox/scripts/west_commands/robot.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
159
```python #!/usr/bin/env python3 from collections import defaultdict from dataclasses import dataclass from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Set, Union import argparse import contextlib import glob import os import subprocess import sys import tempfile # TODO: include chang...
/content/code_sandbox/scripts/release/list_devicetree_bindings_changes.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
3,874
```python # import argparse import os from west import log from west.commands import WestCommand # Relative to the folder where this script lives COMPLETION_REL_PATH = 'completion/west-completion' COMP_DESCRIPTION = '''\ Output shell completion scripts for west. This command outputs completion scripts for differen...
/content/code_sandbox/scripts/west_commands/completion.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
502
```python # '''Common definitions for building Zephyr applications. This provides some default settings and convenience wrappers for building Zephyr applications needed by multiple commands. See build.py for the build command itself. ''' import zcmake import os import sys from pathlib import Path from west import l...
/content/code_sandbox/scripts/west_commands/build_helpers.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,292
```python # import argparse import os from pathlib import Path import re import sys import textwrap from west import log from west.commands import WestCommand from zephyr_ext_common import ZEPHYR_BASE sys.path.append(os.fspath(Path(__file__).parent.parent)) import list_boards import zephyr_module class Boards(West...
/content/code_sandbox/scripts/west_commands/boards.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
741
```python # import argparse from pathlib import Path from shutil import rmtree from west.commands import WestCommand from west import log from zcmake import run_cmake EXPORT_DESCRIPTION = '''\ This command registers the current Zephyr installation as a CMake config package in the CMake user package registry. In Wi...
/content/code_sandbox/scripts/west_commands/export.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
468
```python # import abc import argparse import os import pathlib import pickle import platform import shutil import shlex import subprocess import sys from west import log from west import manifest from west.util import quote_sh_list from build_helpers import find_build_dir, is_zephyr_build, \ FIND_BUILD_DIR_DESC...
/content/code_sandbox/scripts/west_commands/sign.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
5,696
```python # '''Common definitions for building Zephyr applications with CMake. This provides some default settings and convenience wrappers for building Zephyr applications needed by multiple commands. See build.py for the build command itself. ''' from collections import OrderedDict import os.path import re import ...
/content/code_sandbox/scripts/west_commands/zcmake.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,378
```python # from west.commands import WestCommand from run_common import add_parser_common, do_run_common EXPORT_DESCRIPTION = '''\ Simulate the board on a runner of choice using generated artifacts. ''' class Simulate(WestCommand): def __init__(self): super(Simulate, self).__init__( 'simul...
/content/code_sandbox/scripts/west_commands/simulate.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
160
```python # from textwrap import dedent import struct from west.commands import WestCommand from west import log try: from elftools.elf.elffile import ELFFile from intelhex import IntelHex MISSING_REQUIREMENTS = False except ImportError: MISSING_REQUIREMENTS = True # Based on scripts/build/uf2conv...
/content/code_sandbox/scripts/west_commands/bindesc.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,856
```python # import argparse import os from pathlib import Path import re import sys import textwrap from west import log from west.commands import WestCommand from zephyr_ext_common import ZEPHYR_BASE sys.path.append(os.fspath(Path(__file__).parent.parent)) import list_shields import zephyr_module class Shields(We...
/content/code_sandbox/scripts/west_commands/shields.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
541
```python # '''Common code used by commands which execute runners. ''' import re import argparse import logging from collections import defaultdict from os import close, getcwd, path, fspath from pathlib import Path from subprocess import CalledProcessError import sys import tempfile import textwrap import traceback ...
/content/code_sandbox/scripts/west_commands/run_common.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
6,429
```python #!/usr/bin/env python3 # # A convenience script provided for running tests on the runners # package. Runs mypy and pytest. Any extra arguments in sys.argv are # passed along to pytest. # # Using tox was considered, but rejected as overkill for now. # # We would have to configure tox to create the test virtu...
/content/code_sandbox/scripts/west_commands/run_tests.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
327
```ini [mypy] ignore_missing_imports=True ```
/content/code_sandbox/scripts/west_commands/mypy.ini
ini
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
10
```python # import argparse import os import pathlib import shlex import sys import yaml from west import log from west.configuration import config from zcmake import DEFAULT_CMAKE_GENERATOR, run_cmake, run_build, CMakeCache from build_helpers import is_zephyr_build, find_build_dir, load_domains, \ FIND_BUILD_DIR...
/content/code_sandbox/scripts/west_commands/build.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
5,830
```python # '''west "debug", "debugserver", and "attach" commands.''' from textwrap import dedent from west.commands import WestCommand from run_common import add_parser_common, do_run_common class Debug(WestCommand): def __init__(self): super(Debug, self).__init__( 'debug', #...
/content/code_sandbox/scripts/west_commands/debug.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
517
```python # '''west "flash" command''' from west.commands import WestCommand from run_common import add_parser_common, do_run_common, get_build_dir from pathlib import Path class Flash(WestCommand): def __init__(self): super(Flash, self).__init__( 'flash', # Keep this in sync ...
/content/code_sandbox/scripts/west_commands/flash.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
201
```python # import argparse import os import sys from west import log from west.commands import WestCommand from zephyr_ext_common import ZEPHYR_SCRIPTS # Resolve path to twister libs and add imports twister_path = ZEPHYR_SCRIPTS os.environ["ZEPHYR_BASE"] = str(twister_path.parent) sys.path.insert(0, str(twister_p...
/content/code_sandbox/scripts/west_commands/twister_cmd.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
422
```python # '''Helpers shared by multiple west extension command modules. Note that common helpers used by the flash and debug extension commands are in run_common -- that's for common code used by commands which specifically execute runners.''' import os from pathlib import Path from west import log from west.comm...
/content/code_sandbox/scripts/west_commands/zephyr_ext_common.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
388
```python # import argparse import os from pathlib import Path import sys import textwrap from urllib.parse import urlparse from west import log from west.commands import WestCommand from zephyr_ext_common import ZEPHYR_BASE sys.path.append(os.fspath(Path(__file__).parent.parent)) import zephyr_module class Blobs(...
/content/code_sandbox/scripts/west_commands/blobs.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,329
```python # import argparse import os from unittest.mock import patch, call import pytest from runners.canopen_program import CANopenBinaryRunner from conftest import RC_KERNEL_BIN # # Test values # TEST_DEF_CONTEXT = 'default' TEST_ALT_CONTEXT = 'alternate' # # Test cases # TEST_CASES = [(n, x, p, c, o, t, r, s...
/content/code_sandbox/scripts/west_commands/tests/test_canopen_program.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
886
```python # import argparse import os from unittest.mock import patch, call import pytest from runners.dfu import DfuUtilBinaryRunner, DfuSeConfig from conftest import RC_KERNEL_BIN DFU_UTIL = 'dfu-util' TEST_EXE = 'test-dfu-util' TEST_PID = '0000:9999' TEST_PID_RES = '-d,{}'.format(TEST_PID) TEST_ALT_INT = '1' TES...
/content/code_sandbox/scripts/west_commands/tests/test_dfu_util.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,480
```python # import argparse import platform from unittest.mock import patch, call import pytest from runners.dediprog import DediProgBinaryRunner from conftest import RC_KERNEL_BIN DPCMD_EXE = 'dpcmd.exe' if platform.system() == 'Windows' else 'dpcmd' EXPECTED_COMMAND = { (RC_KERNEL_BIN, None): [DPCMD_EXE,...
/content/code_sandbox/scripts/west_commands/tests/test_dediprog.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
605
```python # import argparse import os import platform from unittest.mock import patch, call import pytest from runners.stm32flash import Stm32flashBinaryRunner from conftest import RC_KERNEL_BIN TEST_CMD = 'stm32flash' TEST_DEVICE = '/dev/ttyUSB0' if platform.system() == 'Darwin': TEST_DEVICE = '/dev/tty.SLAB_...
/content/code_sandbox/scripts/west_commands/tests/test_stm32flash.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
923
```python # '''Common fixtures for use testing the runner package.''' import pytest from runners.core import RunnerConfig, FileType RC_BUILD_DIR = '/test/build-dir' RC_BOARD_DIR = '/test/zephyr/boards/test-arch/test-board' RC_KERNEL_ELF = 'test-zephyr.elf' RC_KERNEL_EXE = 'test-zephyr.exe' RC_KERNEL_HEX = 'test-zep...
/content/code_sandbox/scripts/west_commands/tests/conftest.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
217
```python # from argparse import Namespace from twister_cmd import Twister import pytest import argparse TEST_CASES = [ { "r": [], "c": False, "test_only": False, }, { "r": ["-c", "-T tests/ztest/base"], "c": True, "T": [" tests/ztest/base"], "test_...
/content/code_sandbox/scripts/west_commands/tests/test_twister.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
283
```python import argparse import os from pathlib import Path from unittest.mock import patch import pytest from conftest import RC_KERNEL_ELF from runners.nxp_s32dbg import NXPS32DebugProbeConfig, NXPS32DebugProbeRunner TEST_DEVICE = 's32dbg' TEST_SPEED = 16000 TEST_SERVER_PORT = 45000 TEST_REMOTE_TIMEOUT = 30 TEST_...
/content/code_sandbox/scripts/west_commands/tests/test_nxp_s32dbg.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,312
```python # import argparse import itertools from unittest.mock import patch import pytest from runners.pyocd import PyOcdBinaryRunner from conftest import RC_BUILD_DIR, RC_GDB, RC_KERNEL_HEX, RC_KERNEL_ELF # # Test values to provide as constructor arguments and command line # parameters, to verify they're respect...
/content/code_sandbox/scripts/west_commands/tests/test_pyocd.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,080
```python # from runners.core import ZephyrBinaryRunner def test_runner_imports(): # Ensure that all runner modules are imported and returned by # get_runners(). # # This is just a basic sanity check against errors introduced by # tree-wide refactorings for runners that don't have their own # ...
/content/code_sandbox/scripts/west_commands/tests/test_imports.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
330
```python # import argparse import functools import io import os from pathlib import Path import shlex import shutil import typing from unittest.mock import patch, call import pytest from runners.nrfjprog import NrfJprogBinaryRunner from runners.nrfutil import NrfUtilBinaryRunner from conftest import RC_KERNEL_HEX ...
/content/code_sandbox/scripts/west_commands/tests/test_nrf.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
8,113
```python # import argparse from pathlib import Path from unittest.mock import patch, call import pytest from runners.stm32cubeprogrammer import STM32CubeProgrammerBinaryRunner from conftest import RC_KERNEL_HEX, RC_KERNEL_ELF CLI_PATH = Path("STM32_Programmer_CLI") """Default CLI path used in tests.""" HOME_PATH...
/content/code_sandbox/scripts/west_commands/tests/test_stm32cubeprogrammer.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,705
```python # import argparse from unittest.mock import patch, call import os import pytest from runners import blackmagicprobe from runners.blackmagicprobe import BlackMagicProbeRunner from conftest import RC_KERNEL_ELF, RC_GDB import serial.tools.list_ports TEST_GDB_SERIAL = 'test-gdb-serial' # Expected subprocess...
/content/code_sandbox/scripts/west_commands/tests/test_blackmagicprobe.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,063
```python # from argparse import Namespace from build import Build import pytest TEST_CASES = [ {'r': [], 's': None, 'c': None}, {'r': ['source_dir'], 's': 'source_dir', 'c': None}, {'r': ['source_dir', '--'], 's': 'source_dir', 'c': None}, {'r': ['source_dir', '--', 'cmake_opt'], ...
/content/code_sandbox/scripts/west_commands/tests/test_build.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
647
```python # import argparse from os import path, fspath from unittest.mock import patch from unittest.mock import call import pytest from runners.mdb import MdbNsimBinaryRunner, MdbHwBinaryRunner from conftest import RC_KERNEL_ELF, RC_BOARD_DIR, RC_BUILD_DIR TEST_DRIVER_CMD = 'mdb64' TEST_NSIM_ARGS='test_nsim.args...
/content/code_sandbox/scripts/west_commands/tests/test_mdb.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
3,140
```python # import argparse import os import platform from unittest.mock import patch, call import pytest from runners.bossac import BossacBinaryRunner from conftest import RC_KERNEL_BIN if platform.system() != 'Linux': pytest.skip("skipping Linux-only bossac tests", allow_module_level=True) TEST_BOSSAC_PORT =...
/content/code_sandbox/scripts/west_commands/tests/test_bossac.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
4,239
```unknown :0100000001FE :00000001FF ```
/content/code_sandbox/scripts/west_commands/tests/nrf/nrf5340_app_only.hex
unknown
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
14
```unknown :020000040000FA :0100000001FE :020000040100F9 :0100000001FE :00000001FF ```
/content/code_sandbox/scripts/west_commands/tests/nrf/nrf5340_app_and_net.hex
unknown
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
36
```restructuredtext This directory contains test data files for test_nrf.py. ```
/content/code_sandbox/scripts/west_commands/tests/nrf/README.rst
restructuredtext
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
13
```unknown :020000040100F9 :0100000001FE :00000001FF ```
/content/code_sandbox/scripts/west_commands/tests/nrf/nrf5340_net_only.hex
unknown
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
22
```python import argparse import os import platform from unittest.mock import patch, call import pytest from runners.gd32isp import Gd32ispBinaryRunner from conftest import RC_KERNEL_BIN if platform.system() != 'Linux': pytest.skip("skipping Linux-only gd32isp tests", allow_module_level=True) TEST_GD32ISP_CLI ...
/content/code_sandbox/scripts/west_commands/tests/test_gd32isp.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
688
```python # import re def getSPDXIDSafeCharacter(c): """ Converts a character to an SPDX-ID-safe character. Arguments: - c: character to test Returns: c if it is SPDX-ID-safe (letter, number, '-' or '.'); '-' otherwise """ if c.isalpha() or c.isdigit() or c == "-" or c ==...
/content/code_sandbox/scripts/west_commands/zspdx/spdxids.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
475
```python # ```
/content/code_sandbox/scripts/west_commands/zspdx/__init__.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2
```python # import os from west import log from zspdx.walker import WalkerConfig, Walker from zspdx.scanner import ScannerConfig, scanDocument from zspdx.writer import writeSPDX # SBOMConfig contains settings that will be passed along to the various # SBOM maker subcomponents. class SBOMConfig: def __init__(sel...
/content/code_sandbox/scripts/west_commands/zspdx/sbom.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,031
```python # from enum import Enum class Codemodel: def __init__(self): super(Codemodel, self).__init__() self.paths_source = "" self.paths_build = "" self.configurations = [] def __repr__(self): return f"Codemodel: source {self.paths_source}, build {self.paths_build}...
/content/code_sandbox/scripts/west_commands/zspdx/cmakefileapi.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,706
```python # # from path_to_url LICENSE_LIST_VERSION = "3.12" LICENSES = [ "0BSD", "389-exception", "AAL", "ADSL", "AFL-1.1", "AFL-1.2", "AFL-2.0", "AFL-2.1", "AFL-3.0", "AGPL-1.0", "AGPL-1.0-only", "AGPL-1.0-or-later", "AGPL-3.0", "AGPL-3.0-only", "AGPL-3.0-or-later", "AMDPLPA", "AM...
/content/code_sandbox/scripts/west_commands/zspdx/licenses.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
4,412
```python # from enum import Enum # DocumentConfig contains settings used to configure how the SPDX Document # should be built. class DocumentConfig: def __init__(self): super(DocumentConfig, self).__init__() # name of document self.name = "" # namespace for this document ...
/content/code_sandbox/scripts/west_commands/zspdx/datatypes.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,676
```python # import hashlib from west import log def getHashes(filePath): """ Scan for and return hashes. Arguments: - filePath: path to file to scan. Returns: tuple of (SHA1, SHA256, MD5) hashes for filePath, or None if file is not found. """ hSHA1 = hashlib.sha1() h...
/content/code_sandbox/scripts/west_commands/zspdx/util.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
180
```python # import os import yaml import re from west import log from west.util import west_topdir, WestNotFound from zspdx.cmakecache import parseCMakeCacheFile from zspdx.cmakefileapijson import parseReply from zspdx.datatypes import DocumentConfig, Document, File, PackageConfig, Package, RelationshipDataElementTy...
/content/code_sandbox/scripts/west_commands/zspdx/walker.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
7,682
```python # from subprocess import run, PIPE from west import log # Given a path to the applicable C compiler, a C source file, and the # corresponding TargetCompileGroup, determine which include files would # be used. # Arguments: # 1) path to applicable C compiler # 2) C source file being analyzed # 3) Targe...
/content/code_sandbox/scripts/west_commands/zspdx/getincludes.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
554
```python # from west import log # Parse a CMakeCache file and return a dict of key:value (discarding # type hints). def parseCMakeCacheFile(filePath): log.dbg(f"parsing CMake cache file at {filePath}") kv = {} try: with open(filePath, "r") as f: # should be a short file, so we'll use ...
/content/code_sandbox/scripts/west_commands/zspdx/cmakecache.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
258
```python # import hashlib import os import re from west import log from zspdx.licenses import LICENSES from zspdx.util import getHashes # ScannerConfig contains settings used to configure how the SPDX # Document scanning should occur. class ScannerConfig: def __init__(self): super(ScannerConfig, self)....
/content/code_sandbox/scripts/west_commands/zspdx/scanner.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,400
```python # from datetime import datetime from west import log from zspdx.util import getHashes import re CPE23TYPE_REGEX = ( r'^cpe:2\.3:[aho\*\-](:(((\?*|\*?)([a-zA-Z0-9\-\._]|(\\[\\\*\?!"#$$%&\'\(\)\+,\/:;<=>@\[\]\^' r"`\{\|}~]))+(\?*|\*?))|[\*\-])){5}(:(([a-zA-Z]{2,3}(-([a-zA-Z]{2}|[0-9]{3}))?)|[\*\-])...
/content/code_sandbox/scripts/west_commands/zspdx/writer.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,795
```python # import importlib import logging import os from pathlib import Path from fetchers.core import ZephyrBlobFetcher _logger = logging.getLogger('fetchers') def _import_fetcher_module(fetcher_name): try: importlib.import_module(f'fetchers.{fetcher_name}') except ImportError as ie: # Fe...
/content/code_sandbox/scripts/west_commands/fetchers/__init__.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
356
```python # from abc import ABC, abstractmethod from pathlib import Path from typing import List, Type class ZephyrBlobFetcher(ABC): @staticmethod def get_fetchers() -> List[Type['ZephyrBlobFetcher']]: '''Get a list of all currently defined fetcher classes.''' return ZephyrBlobFetcher.__subcl...
/content/code_sandbox/scripts/west_commands/fetchers/core.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
130
```python # import requests from west import log from fetchers.core import ZephyrBlobFetcher class HTTPFetcher(ZephyrBlobFetcher): @classmethod def schemes(cls): return ['http', 'https'] def fetch(self, url, path): log.dbg(f'HTTPFetcher fetching {url} to {path}') resp = request...
/content/code_sandbox/scripts/west_commands/fetchers/http.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
90
```python # '''Runner stub for QEMU.''' from runners.core import ZephyrBinaryRunner, RunnerCaps class QemuBinaryRunner(ZephyrBinaryRunner): '''Place-holder for QEMU runner customizations.''' @classmethod def name(cls): return 'qemu' @classmethod def capabilities(cls): # This is...
/content/code_sandbox/scripts/west_commands/runners/qemu.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
141
```python # import json import os from west import log import zspdx.cmakefileapi def parseReply(replyIndexPath): replyDir, _ = os.path.split(replyIndexPath) # first we need to find the codemodel reply file try: with open(replyIndexPath, 'r') as indexFile: js = json.load(indexFile) ...
/content/code_sandbox/scripts/west_commands/zspdx/cmakefileapijson.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
3,781
```python # '''Runner for flashing with dfu-util.''' from collections import namedtuple import sys import time from runners.core import ZephyrBinaryRunner, RunnerCaps, \ BuildConfiguration DfuSeConfig = namedtuple('DfuSeConfig', ['address', 'options']) class DfuUtilBinaryRunner(ZephyrBinaryRunner): '''Ru...
/content/code_sandbox/scripts/west_commands/runners/dfu.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,017
```python # '''Runner for flashing ESP32 devices with esptool/espidf.''' from os import path from runners.core import ZephyrBinaryRunner, RunnerCaps import os import sys class Esp32BinaryRunner(ZephyrBinaryRunner): '''Runner front-end for espidf.''' def __init__(self, cfg, device, boot_address, part_table...
/content/code_sandbox/scripts/west_commands/runners/esp32.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,195
```python # '''Runner for pyOCD .''' import os from os import path from runners.core import ZephyrBinaryRunner, RunnerCaps, BuildConfiguration DEFAULT_PYOCD_GDB_PORT = 3333 DEFAULT_PYOCD_TELNET_PORT = 4444 class PyOcdBinaryRunner(ZephyrBinaryRunner): '''Runner front-end for pyOCD.''' def __init__(self, c...
/content/code_sandbox/scripts/west_commands/runners/pyocd.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,716
```python # '''Runner base class for flashing with nrf tools.''' import abc from collections import deque import os from pathlib import Path import shlex import subprocess import sys from re import fullmatch, escape from runners.core import ZephyrBinaryRunner, RunnerCaps try: from intelhex import IntelHex excep...
/content/code_sandbox/scripts/west_commands/runners/nrf_common.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
4,278
```python # '''Runner for NIOS II, based on quartus-flash.py and GDB.''' from runners.core import ZephyrBinaryRunner, NetworkPortHelper, RunnerCaps class Nios2BinaryRunner(ZephyrBinaryRunner): '''Runner front-end for NIOS II.''' # From the original shell script: # # "XXX [flash] only support[s]...
/content/code_sandbox/scripts/west_commands/runners/nios2.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
894
```python # import importlib import logging from runners.core import ZephyrBinaryRunner, MissingProgram _logger = logging.getLogger('runners') def _import_runner_module(runner_name): try: importlib.import_module(f'runners.{runner_name}') except ImportError as ie: # Runners are supposed to gr...
/content/code_sandbox/scripts/west_commands/runners/__init__.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
499
```python # '''Catch-all module for miscellaneous devices which can't use a generic or widely used tool like J-Link, OpenOCD, etc. Please use this sparingly and only when your setup is exotic and you're willing to handle requests for help. E.g. if your "board" is a core on a special-purpose SoC which requires a compl...
/content/code_sandbox/scripts/west_commands/runners/misc.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
363
```python # '''Dediprog (dpcmd) flash only runner for SPI chips.''' import platform import subprocess from runners.core import ZephyrBinaryRunner, RunnerCaps DPCMD_EXE = 'dpcmd.exe' if platform.system() == 'Windows' else 'dpcmd' DEFAULT_MAX_RETRIES = 3 class DediProgBinaryRunner(ZephyrBinaryRunner): '''Runner ...
/content/code_sandbox/scripts/west_commands/runners/dediprog.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
512
```python # '''ARC architecture-specific runners.''' from os import path from runners.core import ZephyrBinaryRunner, RunnerCaps DEFAULT_ARC_GDB_PORT = 3333 DEFAULT_PROPS_FILE = 'nsim_em.props' class NsimBinaryRunner(ZephyrBinaryRunner): '''Runner front-end for the ARC nSIM.''' # This unusual 'flash' imp...
/content/code_sandbox/scripts/west_commands/runners/nsim.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
710
```python # '''Modified openocd and gdb runner for Cyclone V SoC DevKit.''' import subprocess import re import os from os import path from pathlib import Path from runners.core import ZephyrBinaryRunner, RunnerCaps DEFAULT_OPENOCD_TCL_PORT = 6333 DEFAULT_OPENOCD_TELNET_PORT = 4444 DEFAULT_OPENOCD_GDB_PORT = 3333 D...
/content/code_sandbox/scripts/west_commands/runners/intel_cyclonev.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
3,161
```python #! /usr/bin/env python3 # """Zephyr binary runner core interfaces This provides the core ZephyrBinaryRunner class meant for public use, as well as some other helpers for concrete runner classes. """ import abc import argparse import errno import logging import os import platform import shlex import shutil...
/content/code_sandbox/scripts/west_commands/runners/core.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
7,035
```python # '''Runner for debugging with xt-gdb.''' from os import path from runners.core import ZephyrBinaryRunner, RunnerCaps class XtensaBinaryRunner(ZephyrBinaryRunner): '''Runner front-end for xt-gdb.''' @classmethod def name(cls): return 'xtensa' @classmethod def capabilities(cl...
/content/code_sandbox/scripts/west_commands/runners/xtensa.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
219
```python # '''Runner for flashing with the Intel ADSP boards.''' import argparse import os import sys import re import hashlib import random import shutil from runners.core import ZephyrBinaryRunner, RunnerCaps from zephyr_ext_common import ZEPHYR_BASE DEFAULT_CAVSTOOL='soc/intel/intel_adsp/tools/cavstool_client.py...
/content/code_sandbox/scripts/west_commands/runners/intel_adsp.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
975
```python # # # pylint: disable=duplicate-code '''Runner for openocd.''' import subprocess import re from os import path from pathlib import Path from zephyr_ext_common import ZEPHYR_BASE try: from elftools.elf.elffile import ELFFile except ImportError: pass from runners.core import ZephyrBinaryRunner, Run...
/content/code_sandbox/scripts/west_commands/runners/openocd.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
3,552
```python # '''Runner for flashing with nrfutil.''' import json import os from pathlib import Path import sys import subprocess from runners.core import _DRY_RUN from runners.nrf_common import NrfBinaryRunner class NrfUtilBinaryRunner(NrfBinaryRunner): '''Runner front-end for nrfutil.''' def __init__(self...
/content/code_sandbox/scripts/west_commands/runners/nrfutil.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
922