code stringlengths 3 6.57k |
|---|
openocd_serial(options) |
_get_nrf_device_args(options) |
subprocess.check_output(nrfjprog_args, encoding="utf-8") |
nrfjprog_ids.strip("\n") |
BoardAutodetectFailed(f'No attached boards recognized by {" ".join(nrfjprog_args) |
nrfjprog_ids.split("\n") |
len(boards) |
join(boards) |
str(options["nrfjprog_snr"]) |
nrfjprog_snr ({options['nrfjprog_snr']}) |
in (API_SERVER_DIR / "src") |
iterdir() |
d.is_dir() |
PROJECT_TYPES.append(d.name) |
tuple(PROJECT_TYPES) |
server.ProjectOption("verbose", help="Run build with verbose output.", choices=(True, False) |
server.ProjectOption("zephyr_base", help="Path to the zephyr base directory.") |
list(BOARD_PROPERTIES) |
Handler(server.ProjectAPIHandler) |
__init__(self) |
super(Handler, self) |
__init__() |
server_info_query(self, tvm_version) |
else (API_SERVER_DIR / MODEL_LIBRARY_FORMAT_RELPATH) |
_create_prj_conf(self, project_dir, options) |
open(project_dir / "prj.conf", "w") |
main() |
f.write("# For TVMPlatformAbort() |
f.write("# For RPC server C++ bindings.\n" "CONFIG_CPLUSPLUS=y\n" "\n") |
f.write("# For math routines\n" "CONFIG_NEWLIB_LIBC=y\n" "\n") |
self._has_fpu(options["zephyr_board"]) |
f.write("# For models with floating point.\n" "CONFIG_FPU=y\n" "\n") |
options.get("config_main_stack_size") |
f.write(f"CONFIG_MAIN_STACK_SIZE={options['config_main_stack_size']}\n") |
f.write("# For random number generation.\n" "CONFIG_TEST_RANDOM_GENERATOR=y\n") |
f.write("\n# Extra prj.conf directives\n") |
self.EXTRA_PRJ_CONF_DIRECTIVES.items() |
f.write(f"{line}\n") |
f.write("\n") |
generate_project(self, model_library_format_path, standalone_crt_dir, project_dir, options) |
pathlib.Path(project_dir) |
project_dir.mkdir() |
shutil.copy2(__file__, project_dir / os.path.basename(__file__) |
shutil.copy2(BOARDS, project_dir / BOARDS.name) |
shutil.copy2(model_library_format_path, project_model_library_format_tar_path) |
os.path.splitext(project_model_library_format_tar_path) |
tarfile.TarFile(project_model_library_format_tar_path) |
os.makedirs(extract_path) |
tf.extractall(path=extract_path) |
self._is_qemu(options) |
shutil.copytree(API_SERVER_DIR / "qemu-hack", project_dir / "qemu-hack") |
crt_path.mkdir() |
os.path.join(standalone_crt_dir, item) |
os.path.isdir(src_path) |
shutil.copytree(src_path, dst_path) |
shutil.copy2(src_path, dst_path) |
open(API_SERVER_DIR / "CMakeLists.txt.template", "r") |
open(project_dir / "CMakeLists.txt", "w") |
line.replace("<API_SERVER_CRT_LIBS>", crt_libs) |
cmake_f.write(line) |
self._create_prj_conf(project_dir, options) |
crt_config_dir.mkdir() |
shutil.copytree(API_SERVER_DIR / "src" / options["project_type"], src_dir) |
options.get("extra_files_tar") |
tarfile.open(options["extra_files_tar"], mode="r:*") |
tf.extractall(project_dir) |
build(self, options) |
BUILD_DIR.mkdir() |
options.get("verbose") |
cmake_args.append("-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE") |
options.get("zephyr_base") |
cmake_args.append(f"-DZEPHYR_BASE:STRING={options['zephyr_base']}") |
options.get("west_cmd") |
cmake_args.append(f"-DWEST={options['west_cmd']}") |
cmake_args.append(f"-DBOARD:STRING={options['zephyr_board']}") |
check_call(cmake_args, cwd=BUILD_DIR) |
options.get("verbose") |
args.append("VERBOSE=1") |
check_call(args, cwd=BUILD_DIR) |
_is_qemu(cls, options) |
_has_fpu(cls, zephyr_board) |
BOARD_PROPERTIES.items() |
flash(self, options) |
self._is_qemu(options) |
zephyr_board.startswith("nrf5340dk") |
_get_flash_runner() |
recover_args.extend(_get_nrf_device_args(options) |
check_call(recover_args, cwd=API_SERVER_DIR / "build") |
check_call(["make", "flash"], cwd=API_SERVER_DIR / "build") |
open_transport(self, options) |
self._is_qemu(options) |
ZephyrQemuTransport(options) |
ZephyrSerialTransport(options) |
transport.open() |
atexit.register(lambda: self.close_transport() |
close_transport(self) |
self._transport.close() |
read_transport(self, n, timeout_sec) |
server.TransportClosedError() |
self._transport.read(n, timeout_sec) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.