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
#
'''Runner for flashing with nrfjprog.'''
import subprocess
import sys
from runners.nrf_common import ErrNotAvailableBecauseProtection, ErrVerify, \
NrfBinaryRunner
# path_to_url
UnavailableOperationBecauseProtectionError = 16
VerifyError = 55
class NrfJprogBinaryRunner(Nr... | /content/code_sandbox/scripts/west_commands/runners/nrfjprog.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,012 |
```python
'''Runner for Lauterbach TRACE32.'''
import argparse
import os
import platform
import subprocess
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import List, Optional
from runners.core import BuildConfiguration, RunnerCaps, RunnerConfig, ZephyrBinaryRunner
DEFAULT_T32_CONFIG =... | /content/code_sandbox/scripts/west_commands/runners/trace32.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,244 |
```python
'''GigaDevice ISP tool (gd32isp) runner for serial boot ROM'''
from runners.core import ZephyrBinaryRunner, RunnerCaps
DEFAULT_GD32ISP_CLI = 'GD32_ISP_Console'
DEFAULT_GD32ISP_PORT = '/dev/ttyUSB0'
DEFAULT_GD32ISP_SPEED = '57600'
DEFAULT_GD32ISP_ADDR = '0x08000000'
class Gd32ispBinaryRunner(ZephyrBina... | /content/code_sandbox/scripts/west_commands/runners/gd32isp.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 558 |
```python
# Modified 2018 Tavish Naruka <tavishnaruka@gmail.com>
#
'''Runner for flashing with Black Magic Probe.'''
# path_to_url
import glob
import os
import signal
import sys
from pathlib import Path
from runners.core import ZephyrBinaryRunner, RunnerCaps
try:
import serial.tools.list_ports
MISSING_REQUIR... | /content/code_sandbox/scripts/west_commands/runners/blackmagicprobe.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,815 |
```python
#
'''Runner stub for renode-test.'''
import subprocess
from runners.core import ZephyrBinaryRunner, RunnerCaps
class RenodeRobotRunner(ZephyrBinaryRunner):
'''Place-holder for Renode runner customizations.'''
def __init__(self, cfg, args):
super().__init__(cfg)
self.testsuite = ar... | /content/code_sandbox/scripts/west_commands/runners/renode-robot.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 414 |
```python
'''Runner for probe-rs.'''
from runners.core import ZephyrBinaryRunner, RunnerCaps
class ProbeRsBinaryRunner(ZephyrBinaryRunner):
'''Runner front-end for probe-rs.'''
def __init__(self, cfg, chip,
probe_rs='probe-rs',
dev_id=None,
erase=False,
... | /content/code_sandbox/scripts/west_commands/runners/probe_rs.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 498 |
```python
"""This file provides a ZephyrBinaryRunner that launches GDB and enables
flashing (running) a native application."""
import argparse
from runners.core import ZephyrBinaryRunner, RunnerCaps, RunnerConfig
DEFAULT_GDB_PORT = 3333
class NativeSimBinaryRunner(ZephyrBinaryRunner):
"""Runs the ELF binary und... | /content/code_sandbox/scripts/west_commands/runners/native.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 612 |
```python
#
#
# Based on jlink.py
'''Runner for debugging with NXP's LinkServer.'''
import logging
import os
import shlex
import subprocess
import sys
from runners.core import ZephyrBinaryRunner, RunnerCaps
DEFAULT_LINKSERVER_EXE = 'Linkserver.exe' if sys.platform == 'win32' else 'LinkServer'
DEFAULT_LINKSERVER_GD... | /content/code_sandbox/scripts/west_commands/runners/linkserver.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,760 |
```python
#
import re
import os
import time
import subprocess
from runners.core import ZephyrBinaryRunner, RunnerCaps, BuildConfiguration
class SpiBurnBinaryRunner(ZephyrBinaryRunner):
'''Runner front-end for SPI_burn.'''
def __init__(self, cfg, addr, spiburn, iceman, timeout, gdb_port, gdb_ex, erase=False)... | /content/code_sandbox/scripts/west_commands/runners/spi_burn.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 939 |
```python
#
'''Runner for performing program download over CANopen (DSP 302-3).'''
import argparse
import os
import time
from runners.core import ZephyrBinaryRunner, RunnerCaps
try:
import canopen
from progress.bar import Bar
MISSING_REQUIREMENTS = False
except ImportError:
MISSING_REQUIREMENTS = Tr... | /content/code_sandbox/scripts/west_commands/runners/canopen_program.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 2,787 |
```python
#
'''Runner for flashing with stm32flash.'''
from os import path
import platform
from runners.core import ZephyrBinaryRunner, RunnerCaps
DEFAULT_DEVICE = '/dev/ttyUSB0'
if platform.system() == 'Darwin':
DEFAULT_DEVICE = '/dev/tty.SLAB_USBtoUART'
class Stm32flashBinaryRunner(ZephyrBinaryRunner):
'... | /content/code_sandbox/scripts/west_commands/runners/stm32flash.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,180 |
```python
#
# Based on J-Link runner
"""
Runner that implements flashing with SiLabs Simplicity Commander binary tool.
See SiLabs UG162: "Simplicity Commander Reference Guide" for more info.
"""
import os
import shlex
from runners.core import ZephyrBinaryRunner, RunnerCaps, FileType
DEFAULT_APP = 'commander'
clas... | /content/code_sandbox/scripts/west_commands/runners/silabs_commander.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 921 |
```python
#
'''Runner stub for Renode.'''
import subprocess
from runners.core import ZephyrBinaryRunner, RunnerCaps
class RenodeRunner(ZephyrBinaryRunner):
'''Place-holder for Renode runner customizations.'''
def __init__(self, cfg, args):
super().__init__(cfg)
self.renode_arg = args.renode... | /content/code_sandbox/scripts/west_commands/runners/renode.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 389 |
```python
#
'''Runners for Synopsys Metaware Debugger(mdb).'''
import shutil
import os
from os import path
from runners.core import ZephyrBinaryRunner, RunnerCaps
# normally we should create class with common functionality inherited from
# ZephyrBinaryRunner and inherit MdbNsimBinaryRunner and MdbHwBinaryRunner
#... | /content/code_sandbox/scripts/west_commands/runners/mdb.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,698 |
```python
#
'''Runner for debugging with J-Link.'''
import argparse
import ipaddress
import logging
import os
from pathlib import Path
import shlex
import subprocess
import sys
import tempfile
from runners.core import ZephyrBinaryRunner, RunnerCaps, FileType
try:
import pylink
from pylink.library import Lib... | /content/code_sandbox/scripts/west_commands/runners/jlink.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 3,382 |
```python
#
'''HiFive1-specific (flash only) runner.'''
from os import path
from runners.core import ZephyrBinaryRunner, RunnerCaps
class HiFive1BinaryRunner(ZephyrBinaryRunner):
'''Runner front-end for the HiFive1 board, using openocd.'''
def __init__(self, cfg):
super().__init__(cfg)
sel... | /content/code_sandbox/scripts/west_commands/runners/hifive1.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 316 |
```python
#
'''bossac-specific runner (flash only) for Atmel SAM microcontrollers.'''
import os
import pathlib
import pickle
import platform
import subprocess
import sys
import time
from runners.core import ZephyrBinaryRunner, RunnerCaps
if platform.system() == 'Darwin':
DEFAULT_BOSSAC_PORT = None
else:
DEF... | /content/code_sandbox/scripts/west_commands/runners/bossac.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 2,217 |
```python
#
"""Runner for flashing with STM32CubeProgrammer CLI, the official programming
utility from ST Microelectronics.
"""
import argparse
from pathlib import Path
import platform
import os
import shlex
import shutil
from typing import List, Optional, ClassVar, Dict
from runners.core import ZephyrBinaryRunne... | /content/code_sandbox/scripts/west_commands/runners/stm32cubeprogrammer.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,509 |
```python
#
'''UF2 runner (flash only) for UF2 compatible bootloaders.'''
from pathlib import Path
from shutil import copy
from runners.core import ZephyrBinaryRunner, RunnerCaps
try:
import psutil # pylint: disable=unused-import
MISSING_PSUTIL = False
except ImportError:
# This can happen when buildin... | /content/code_sandbox/scripts/west_commands/runners/uf2.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 748 |
```python
#
'''Runner for flashing with ezFlashCLI.'''
import shlex
from runners.core import ZephyrBinaryRunner, RunnerCaps
DEFAULT_EZFLASHCLI = "ezFlashCLI"
class EzFlashCliBinaryRunner(ZephyrBinaryRunner):
'''Runner front-end for ezFlashCLI'''
def __init__(self, cfg, tool, dev_id=None, tool_opt=[], erase... | /content/code_sandbox/scripts/west_commands/runners/ezflashcli.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 740 |
```python
#
'''Runner for teensy .'''
import os
import subprocess
from runners.core import ZephyrBinaryRunner
class TeensyBinaryRunner(ZephyrBinaryRunner):
'''Runner front-end for teensy.'''
def __init__(self, cfg, mcu, teensy_loader):
super().__init__(cfg)
self.mcu_args = ['--mcu', mcu]
... | /content/code_sandbox/scripts/west_commands/runners/teensy.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 386 |
```python
"""
Runner for NXP S32 Debug Probe.
"""
import argparse
import os
import platform
import re
import shlex
import subprocess
import sys
import tempfile
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, List, Optional, Union
from runners.core import (BuildConfiguration, Runner... | /content/code_sandbox/scripts/west_commands/runners/nxp_s32dbg.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 3,049 |
```shell
#compdef west
# Ensure this works also when being source-ed
compdef _west west
typeset -A -g _opt_args
_west_cmds() {
local -a builtin_cmds=(
'init[create a west workspace]'
'update[update projects described in west manifest]'
'list[print information about projects]'
'manifest[manage the west man... | /content/code_sandbox/scripts/west_commands/completion/west-completion.zsh | shell | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 3,110 |
```fish
# check if we are currently in a west workspace
# this is used to filter which command to show
#
# return 0 if in west workspace
# return 1 else
function __zephyr_west_check_if_in_workspace
west topdir &>/dev/null
if test $status = 0
return 0
else
return 1
end
end
# exclude the ... | /content/code_sandbox/scripts/west_commands/completion/west-completion.fish | fish | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 7,194 |
```unknown
#!/usr/bin/env python3
#
#
# diffconfig - a tool to compare .config files.
#
# originally written in 2006 by Matt Mackall
# (at least, this was in his bloatwatch source code)
# last worked on 2008 by Tim Bird
#
import sys, os
def usage():
print("""Usage: diffconfig [-h] [-m] [<config1> <config2>]
Dif... | /content/code_sandbox/scripts/kconfig/diffconfig | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 988 |
```shell
# Bash auto-completion for west subcommands and flags. To initialize, run
#
# source west-completion.bash
#
# To make it persistent, add it to e.g. your .bashrc.
__west_previous_extglob_setting=$(shopt -p extglob)
shopt -s extglob
# The following function is based on code from:
#
# bash_completion - pr... | /content/code_sandbox/scripts/west_commands/completion/west-completion.bash | shell | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 7,498 |
```python
#!/usr/bin/env python3
"""
Linter for the Zephyr Kconfig files. Pass --help to see
available checks. By default, all checks are enabled.
Some of the checks rely on heuristics and can get tripped up
by things like preprocessor magic, so manual checking is
still needed. 'git grep' is handy.
Requires west, b... | /content/code_sandbox/scripts/kconfig/lint.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 2,473 |
```python
#!/usr/bin/env python3
"""
Overview
========
A curses-based Python 2/3 menuconfig implementation. The interface should feel
familiar to people used to mconf ('make menuconfig').
Supports the same keys as mconf, and also supports a set of keybindings
inspired by Vi:
J/K : Down/Up
L : Enter m... | /content/code_sandbox/scripts/kconfig/menuconfig.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 25,423 |
```python
#!/usr/bin/env python3
# Originally modified from:
# path_to_url
# Writes/updates the zephyr/.config configuration file by merging configuration
# files passed as arguments, e.g. board *_defconfig and application prj.conf
# files.
#
# When fragments haven't changed, zephyr/.config is both the input and the... | /content/code_sandbox/scripts/kconfig/kconfig.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 2,842 |
```python
#!/usr/bin/env python3
import csv
import os
from kconfiglib import standard_kconfig
def hardenconfig(kconf):
kconf.load_config()
hardened_kconf_filename = os.path.join(os.environ['ZEPHYR_BASE'],
'scripts', 'kconfig', 'hardened.csv')
options = compa... | /content/code_sandbox/scripts/kconfig/hardenconfig.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 548 |
```python
#
import functools
import inspect
import operator
import os
import pickle
import re
import sys
from pathlib import Path
ZEPHYR_BASE = str(Path(__file__).resolve().parents[2])
sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts", "dts",
"python-devicetree", "src"))
# Types ... | /content/code_sandbox/scripts/kconfig/kconfigfunctions.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 9,889 |
```python
"""
Overview
========
Kconfiglib is a Python 2/3 library for scripting and extracting information
from Kconfig (path_to_url
configuration systems.
See the homepage at path_to_url for a longer
overview.
Since Kconfiglib 12.0.0, the library version is available in
kconfiglib.VERSION, which is a (<major>, <m... | /content/code_sandbox/scripts/kconfig/kconfiglib.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 56,926 |
```python
#!/usr/bin/env python3
# Copied from 27e322f of path_to_url
# pylint: skip-file
import sys
import struct
import subprocess
import re
import os
import os.path
import argparse
import json
from time import sleep
UF2_MAGIC_START0 = 0x0A324655 # "UF2\n"
UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected
UF2_MAGIC... | /content/code_sandbox/scripts/build/uf2conv.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 3,301 |
```python
#!/usr/bin/env python3
# _load_images() builds names dynamically to avoid having to give them twice
# (once for the variable and once for the filename). This forces consistency
# too.
#
# pylint: disable=undefined-variable
"""
Overview
========
A Tkinter-based menuconfig implementation, based around a tre... | /content/code_sandbox/scripts/kconfig/guiconfig.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 18,170 |
```python
#!/usr/bin/env python3
#
"""
Script to prepare the LLEXT exports table of a Zephyr ELF
This script performs compile-time processing of the LLEXT exports
table for usage at runtime by the LLEXT subsystem code. The table
is a special section filled with 'llext_const_symbol' structures
generated by the EXPORT_... | /content/code_sandbox/scripts/build/llext_prepare_exptab.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 3,314 |
```python
#!/usr/bin/env python3
#
#
#
import argparse
import sys
import os
import importlib
from elftools.elf.elffile import ELFFile
from elftools.elf.sections import SymbolTableSection
class gen_isr_log:
def __init__(self, debug = False):
self.__debug = debug
def debug(self, text):
"""Pri... | /content/code_sandbox/scripts/build/gen_isr_tables.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 2,954 |
```python
#!/usr/bin/env python3
#
#
#
import struct
class gen_isr_parser:
source_header = """
/* AUTO-GENERATED by gen_isr_tables.py, do not edit! */
#include <zephyr/toolchain.h>
#include <zephyr/linker/sections.h>
#include <zephyr/sw_isr_table.h>
#include <zephyr/arch/cpu.h>
typedef void (* ISR)(const void *... | /content/code_sandbox/scripts/build/gen_isr_tables_parser_carrays.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 2,517 |
```python
#!/usr/bin/env python3
#
#
"""Convert a file to a list of hex characters
The list of hex characters can then be included to a source file. Optionally,
the output can be compressed.
"""
import argparse
import codecs
import gzip
import io
def parse_args():
global args
parser = argparse.ArgumentP... | /content/code_sandbox/scripts/build/file2hex.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 586 |
```python
#!/usr/bin/env python3
#
#
"""
gperf C file post-processor
We use gperf to build up a perfect hashtable of pointer values. The way gperf
does this is to create a table 'wordlist' indexed by a string representation
of a pointer address, and then doing memcmp() on a string passed in for
comparison
We are exc... | /content/code_sandbox/scripts/build/process_gperf.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,150 |
```python
#!/usr/bin/env python3
#
#
"""
Script to generate a linker script organizing application memory partitions
Applications may declare build-time memory domain partitions with
K_APPMEM_PARTITION_DEFINE, and assign globals to them using K_APP_DMEM
or K_APP_BMEM macros. For each of these partitions, we need to
r... | /content/code_sandbox/scripts/build/gen_app_partitions.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 2,478 |
```python
#!/usr/bin/env python3
#
#
import argparse
import os
import re
def front_matter():
return f'''
/*
* This file is generated by {__file__}
*/
#include <zephyr/posix/signal.h>
'''
def gen_strsignal_table(input, output):
with open(input, 'r') as inf:
highest_signo = 0
symbols = []... | /content/code_sandbox/scripts/build/gen_strsignal_table.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 501 |
```python
#!/usr/bin/env python3
#
#
"""
Script to generate system call invocation macros
This script parses the system call metadata JSON file emitted by
parse_syscalls.py to create several files:
- A file containing weak aliases of any potentially unimplemented system calls,
as well as the system call dispatch t... | /content/code_sandbox/scripts/build/gen_syscalls.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 4,996 |
```python
#!/usr/bin/env python3
#
#
#
import struct
class gen_isr_parser:
source_header = """
/* AUTO-GENERATED by gen_isr_tables.py, do not edit! */
#include <zephyr/toolchain.h>
#include <zephyr/linker/sections.h>
#include <zephyr/sw_isr_table.h>
#include <zephyr/arch/cpu.h>
"""
shared_isr_table_header ... | /content/code_sandbox/scripts/build/gen_isr_tables_parser_local.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 3,582 |
```python
#!/usr/bin/env python3
#
#
#
"""
This script scans a specified object file and generates a header file
that defined macros for the offsets of various found structure members
(particularly symbols ending with ``_OFFSET`` or ``_SIZEOF``), primarily
intended for use in assembly code.
"""
from elftools.elf.elff... | /content/code_sandbox/scripts/build/gen_offset_header.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 501 |
```python
#!/usr/bin/env python3
"""
Tests for check_init_priorities
"""
import mock
import pathlib
import unittest
from elftools.elf.relocation import Section
from elftools.elf.sections import SymbolTableSection
import check_init_priorities
class TestPriority(unittest.TestCase):
"""Tests for the Priority clas... | /content/code_sandbox/scripts/build/check_init_priorities_test.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 4,160 |
```python
#!/usr/bin/env python3
#
#
"""Translate generic handles into ones optimized for the application.
Immutable device data includes information about dependencies,
e.g. that a particular sensor is controlled through a specific I2C bus
and that it signals event on a pin on a specific GPIO controller.
This informa... | /content/code_sandbox/scripts/build/gen_device_deps.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,548 |
```python
#!/usr/bin/env python3
#
#
import argparse
import sys
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
PRINTABLE_MIN = 32
PRINTABLE_MAX = 126
def generate_element(image, charcode):
"""Generate CFB font element for a given character code from an image"""
blackwhite = image.... | /content/code_sandbox/scripts/build/gen_cfb_font_header.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 2,198 |
```python
#!/usr/bin/env python3
#
#
"""
Script to scan Zephyr include directories and emit system call and subsystem metadata
System calls require a great deal of boilerplate code in order to implement
completely. This script is the first step in the build system's process of
auto-generating this code by doing a tex... | /content/code_sandbox/scripts/build/parse_syscalls.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,550 |
```python
#!/usr/bin/env python3
#
#
# This merges a set of input hex files into a single output hex file.
# Any conflicts will result in an error being reported.
from intelhex import IntelHex
from intelhex import AddressOverlapError
import argparse
def merge_hex_files(output, input_hex_files, overlap):
ih = I... | /content/code_sandbox/scripts/build/mergehex.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 350 |
```python
import os
import sys
def main():
is_writeable = os.access(sys.argv[1], os.W_OK)
return_code = int(not is_writeable)
sys.exit(return_code)
if __name__ == "__main__":
main()
``` | /content/code_sandbox/scripts/build/dir_is_writeable.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 53 |
```python
#!/usr/bin/env python3
#
#
import argparse
import sys
import os
import re
from elftools.elf.elffile import ELFFile
from elftools.elf.descriptions import (
describe_symbol_type,
)
class gen_symtab_log:
def __init__(self, debug=False):
self.__debug = debug
def debug(self, text):
... | /content/code_sandbox/scripts/build/gen_symtab.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,169 |
```python
#
import struct
import sys
def main():
print(struct.calcsize("P") * 8)
sys.exit(0)
if __name__ == "__main__":
main()
``` | /content/code_sandbox/scripts/build/user_wordsize.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 40 |
```python
#!/usr/bin/env python3
#
#
#
"""
This script will relocate .text, .rodata, .data and .bss sections from required files
and places it in the required memory region. This memory region and file
are given to this python script in the form of a string.
Example of such a string would be::
SRAM2:COPY:/home/xy... | /content/code_sandbox/scripts/build/gen_relocate_app.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 5,027 |
```python
#!/usr/bin/env python3
#
"""
This file implements the Symbol Link Identifer (SLID)
generation code, for use by the LLEXT subsystem.
SLID-based linking is enabled by the Kconfig
option 'CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID'.
When executed as a script, this file can be used as
an interactive prompt to calcula... | /content/code_sandbox/scripts/build/llext_slidlib.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 526 |
```python
#!/usr/bin/env python3
"""
Checks the initialization priorities
This script parses a Zephyr executable file, creates a list of known devices
and their effective initialization priorities and compares that with the device
dependencies inferred from the devicetree hierarchy.
This can be used to detect devic... | /content/code_sandbox/scripts/build/check_init_priorities.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 2,899 |
```python
#!/usr/bin/env python3
#
#
import struct
import sys
from packaging import version
import elftools
from elftools.elf.elffile import ELFFile
from elftools.elf.sections import SymbolTableSection
if version.parse(elftools.__version__) < version.parse('0.24'):
sys.exit("pyelftools is out of date, need versi... | /content/code_sandbox/scripts/build/elf_parser.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 2,253 |
```python
#!/usr/bin/env python3
#
#
"""
Process ELF file to generate placeholders for kobject
hash table and lookup functions produced by gperf,
since their sizes depend on how many kobjects have
been declared. The output header files will be used
during linking for intermediate output binaries so
that the addresses ... | /content/code_sandbox/scripts/build/gen_kobject_placeholders.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 953 |
```python
#!/usr/bin/env python3
#
"""Injects SLIDs in LLEXT ELFs' symbol tables.
When Kconfig option CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID is enabled,
all imports from the Zephyr kernel & application are resolved using
SLIDs instead of symbol names. This script stores the SLID of all
imported symbols in their associa... | /content/code_sandbox/scripts/build/llext_inject_slids.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,518 |
```python
#!/usr/bin/env python3
"""Write subfolder list to a file
This script will walk the specified directory and write the file specified with
the list of all sub-directories found. If the output file already exists, the
file will only be updated in case sub-directories have been added or removed
since the previo... | /content/code_sandbox/scripts/build/subfolder_list.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 765 |
```python
#!/usr/bin/env python3
#
#
"""
Script to generate gperf tables of kernel object metadata
User mode threads making system calls reference kernel objects by memory
address, as the kernel/driver APIs in Zephyr are the same for both user
and supervisor contexts. It is necessary for the kernel to be able to
valid... | /content/code_sandbox/scripts/build/gen_kobject_list.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 8,218 |
```python
#!/usr/bin/env python3
#
#
'''
Script to generate image information files.
This script creates a image information header which can be included by a
second build system.
This allows a second stage build system to use image information from a Zephyr
build by including the generated header.
Information inclu... | /content/code_sandbox/scripts/build/gen_image_info.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 609 |
```unknown
// Check violations for rule 14.4
// path_to_url
//
// Confidence: Moderate
//
virtual report
@initialize:python@
@@
@rule1_base@
identifier function, v;
type T1, T2;
parameter list[n] P1;
parameter list[n1] P2;
@@
(
T1 function(P1, T2 v, P2) {...}
|
T1 function(P1, T2 *v, P2) {...}
)
@ script:python @
... | /content/code_sandbox/scripts/coccinelle/boolean.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 442 |
```python
#!/usr/bin/env python3
#
#
import argparse
import os
import re
def front_matter(sys_nerr):
return f'''
/*
* This file generated by {__file__}
*/
#include <errno.h>
#include <stdint.h>
#include <string.h>
#include <zephyr/sys/util.h>
#define sys_nerr {sys_nerr}'''
def gen_strerror_table(input, ou... | /content/code_sandbox/scripts/build/gen_strerror_table.py | python | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 625 |
```objective-c
/*
*
*/
/* File to be specified by -macro-file in invocations of coccinelle
* to avoid parse errors that prevent application of rules.
*
* This is not exhaustive: only defines that have been proven to
* inhibit context recognition are listed. The structure of the file
* is expected to follow tha... | /content/code_sandbox/scripts/coccinelle/macros.h | objective-c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 123 |
```unknown
virtual report
@r_idlen@
type T;
identifier I;
constant C;
position p;
@@
(
T I@p (...);
|
I@p (...)
|
T I@p = C;
|
T I@p;
)
@script:python depends on report@
id << r_idlen.I;
pos << r_idlen.p;
@@
if (len(id) > 31):
msg="WARNING: Violation to rule 5.1 or 5.2 (Identifiers shall be distinct) %s... | /content/code_sandbox/scripts/coccinelle/identifier_length.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 143 |
```unknown
/// Cast void to memset to ignore its return value
///
//# The return of memset and memcpy is never checked and therefore
//# cast it to void to explicitly ignore while adhering to MISRA-C.
//
// Confidence: High
//
virtual patch
@depends on patch && !(file in "ext")@
expression e1,e2,e3;
@@
(
+ (void)
mem... | /content/code_sandbox/scripts/coccinelle/ignore_return.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 101 |
```unknown
/// Find cases where ztest string comparisons macros can be used
// Confidence: LOW
// Options: --no-includes --include-headers
virtual patch
virtual context
virtual org
virtual report
// Comparing result of strcmp with 0
@@ expression E1,E2; @@
- zassert_equal(strcmp(E1, E2), 0);
+ zassert_str_equal(E1, ... | /content/code_sandbox/scripts/coccinelle/ztest_strcmp.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 615 |
```unknown
///
/// A variable is dereferenced under a NULL test.
/// Even though it is known to be NULL.
///
// Confidence: Moderate
// URL: path_to_url
// Comments: -I ... -all_includes can give more complete results
// Options:
virtual context
virtual org
virtual report
// The following two rules are separate, beca... | /content/code_sandbox/scripts/coccinelle/deref_null.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,550 |
```unknown
// Enforce preservation of const qualifier on config_info casts
//
// Drivers cast the device config_info pointer to a driver-specific
// structure. The object is const-qualified; make sure the cast
// doesn't inadvertently remove that qualifier.
//
// Also add the qualifier to pointer definitions where it... | /content/code_sandbox/scripts/coccinelle/const_config_info.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 690 |
```unknown
///
/// Remove unneeded variable used to store return value.
///
// Confidence: Moderate
// URL: path_to_url
// Comments: Comments on code can be deleted if near code that is removed.
// "when strict" can be removed to get more hits, but adds false
// positives
virtual patch
virtual repo... | /content/code_sandbox/scripts/coccinelle/returnvar.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 374 |
```unknown
/// Use BIT() helper macro instead of hardcoding using bitshifting
///
// Confidence: High
//
virtual patch
@depends on patch && !(file in "ext")@
expression A;
@@
- (1 << A)
+ BIT(A)
``` | /content/code_sandbox/scripts/coccinelle/unsigned_shift.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 53 |
```unknown
// Check violations for rule 5.7
// path_to_url
//
// Confidence: Moderate
//
virtual report
@initialize:python@
@@
@common_case@
position p;
identifier t, v;
@@
(
struct t *v@p;
|
struct t v@p;
|
union t v@p;
)
@ script:python @
t << common_case.t;
v << common_case.v;
p << common_case.p;
@@
msg = "WARN... | /content/code_sandbox/scripts/coccinelle/same_identifier.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 368 |
```unknown
// Replace use of K_NO_WAIT and K_FOREVER in API that requires
// timeouts be specified as integral milliseconds.
//
// These constants used to have the values 0 and -1 respectively; they
// are now timeout values which are opaque non-integral values that
// can't be converted to integers automatically. Fo... | /content/code_sandbox/scripts/coccinelle/ms_timeout.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,010 |
```unknown
///
/// Remove unneeded semicolon.
///
// Confidence: Moderate
// URL: path_to_url
// Comments: Some false positives on empty default cases in switch statements.
// Options: --no-includes --include-headers
virtual patch
virtual report
virtual context
virtual org
@r_default depends on !(file in "ext")@
posi... | /content/code_sandbox/scripts/coccinelle/semicolon.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 342 |
```unknown
/// Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
///
//# This makes an effort to find cases where ARRAY_SIZE can be used such as
//# where there is a division of sizeof the array by the sizeof its first
//# element or by any indexed element or the element type. It replaces the
//# d... | /content/code_sandbox/scripts/coccinelle/array_size.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 409 |
```unknown
/// Find missing unlocks. This semantic match considers the specific case
/// where the unlock is missing from an if branch, and there is a lock
/// before the if and an unlock after the if. False positives are due to
/// cases where the if branch represents a case where the function is
/// supposed to exi... | /content/code_sandbox/scripts/coccinelle/mini_lock.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 570 |
```unknown
// Uses a python database (a dict) to find where const struct device
// variable are being used in zephyr functions and, if it's being in place
// of a void*, it will print an ERROR for loosing the const qualifier.
// If it's being used on an unknown functions from an external module such
// as a HAL, it wi... | /content/code_sandbox/scripts/coccinelle/find_dev_usage.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 428 |
```unknown
/// Find assignments to unsigned variables and add an 'U' to the value
// Confidence: High
virtual patch
virtual report
@r_unsigned@
typedef uint8_t, uint16_t, uint32_t, uint64_t, u8_t, u16_t, u32_t, u64_t;
{unsigned char, unsigned short, unsigned int, uint8_t, uint16_t, uint32_t, uint64_t, u8_t, u16_t, u3... | /content/code_sandbox/scripts/coccinelle/unsigned_suffix.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 510 |
```unknown
/// Use unsigned int as the return value for irq_lock()
///
// Confidence: High
//
virtual patch
@find depends on !(file in "ext")@
type T;
identifier i;
typedef uint32_t,uint32_t;
@@
(
uint32_t i = irq_lock();
|
unsigned int i = irq_lock();
|
uint32_t i = irq_lock();
|
- T
+ unsigned int
i = irq_loc... | /content/code_sandbox/scripts/coccinelle/irq_lock.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 149 |
```unknown
// Convert legacy integer timeouts to timeout API
//
// Some existing code assumes that timeout parameters are provided as
// integer milliseconds, when they were intended to be timeout values
// produced by specific constants and macros. Convert integer
// literals and parameters to the desired equivalent... | /content/code_sandbox/scripts/coccinelle/int_ms_to_timeout.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,611 |
```unknown
/// sizeof when applied to a pointer typed expression gives the size of
/// the pointer
///
// Confidence: High
// URL: path_to_url
// Comments:
// Options: --no-includes --include-headers
virtual org
virtual report
virtual context
virtual patch
@depends on patch && !(file in "ext")@
expression *x;
express... | /content/code_sandbox/scripts/coccinelle/noderef.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 370 |
```unknown
// Check violations for rule 5.7
// path_to_url
//
// Confidence: Moderate
//
virtual report
@initialize:python@
@@
@common_case@
position p;
identifier t, v;
expression E;
type T;
@@
(
struct t *v@p;
|
struct t v@p;
|
union t v@p;
|
T v@p;
|
T *v@p;
|
struct t *v@p = E;
|
struct t v@p = E;
|
union t v@p ... | /content/code_sandbox/scripts/coccinelle/reserved_names.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 482 |
```unknown
// In patch mode, patch all device instance to const (if not already).
// In report mode:
// Generate a q&d python database (a dict actually) of all the
// declared zephyr functions. It will store each function name in 2
// separate dicts: one storing all function having 1+ void* parameter
// and one for a... | /content/code_sandbox/scripts/coccinelle/find_functions.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 595 |
```unknown
/// Unsigned expressions cannot be lesser than zero. Presence of
/// comparisons 'unsigned (<|<=) 0' often indicates a bug,
/// usually wrong type of variable.
///
// Confidence: High
// URL: path_to_url
virtual org
virtual report
@r_cmp depends on !(file in "ext")@
position p;
typedef uint8_t, uint16_t, u... | /content/code_sandbox/scripts/coccinelle/unsigned_lesser_than_zero.cocci | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 223 |
```linker script
/*
*
*/
/**
* @file
* @brief Linker command/script file for the native simulator runner
*/
#define NSI_INIT_LEVEL(level) \
__nsi_##level##_tasks_start = .; \
KEEP(*(SORT(.nsi_##level[0-9]_task))); \
KEEP(*(SORT(.nsi_##level[1-9][0-9]_task))); \
KEEP(*(SORT(.nsi_##level[1-9][0-9][... | /content/code_sandbox/scripts/native_simulator/common/other/linker_script.pre.ld | linker script | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 343 |
```objective-c
/*
*
*/
#ifndef NSI_COMMON_SRC_NSI_CONFIG_H
#define NSI_COMMON_SRC_NSI_CONFIG_H
#ifndef NSI_N_CPUS
#define NSI_N_CPUS 1
#endif
#endif /* NSI_COMMON_SRC_NSI_CONFIG_H */
``` | /content/code_sandbox/scripts/native_simulator/common/src/nsi_config.h | objective-c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 53 |
```c
/*
*
*/
#include "nsi_cpu_if.h"
/*
* These trampolines forward a call from the runner into the corresponding embedded CPU hook
* for ex., nsif_cpun_boot(4) -> nsif_cpu4_boot()
*/
TRAMPOLINES(nsif_cpu, _pre_cmdline_hooks)
TRAMPOLINES(nsif_cpu, _pre_hw_init_hooks)
TRAMPOLINES(nsif_cpu, _boot)
TRAMPOLINES_i_(... | /content/code_sandbox/scripts/native_simulator/common/src/nsi_cpun_if.c | c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 146 |
```unknown
# Native Simulator (NSI) Makefile.
# It builds the simulator runner itself, and produces the final
# Linux executable by linking it to the embedded cpu library
# By default all the build output is placed under the _build folder, but the user can override it
# setting the NSI_BUILD_PATH
#
# The caller can p... | /content/code_sandbox/scripts/native_simulator/Makefile | unknown | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,846 |
```objective-c
/*
*
*/
#ifndef NSI_COMMON_SRC_NSI_TASKS_H
#define NSI_COMMON_SRC_NSI_TASKS_H
#include "nsi_utils.h"
#ifdef __cplusplus
extern "C" {
#endif
#define NSITASK_PRE_BOOT_1_LEVEL 0
#define NSITASK_PRE_BOOT_2_LEVEL 1
#define NSITASK_HW_INIT_LEVEL 2
#define NSITASK_PRE_BOOT_3_LEVEL 3
#define NSITASK_FIRST... | /content/code_sandbox/scripts/native_simulator/common/src/nsi_tasks.h | objective-c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 550 |
```objective-c
/*
*
*/
#ifndef NSI_COMMON_SRC_NSI_CPUN_IF_H
#define NSI_COMMON_SRC_NSI_CPUN_IF_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Equivalent interfaces to nsi_cpu<n>_* but for the native simulator internal use
*/
void nsif_cpun_pre_cmdline_hooks(int n);
void nsif_cpun_pre_hw_init_hooks(int n);
void n... | /content/code_sandbox/scripts/native_simulator/common/src/nsi_cpun_if.h | objective-c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 159 |
```c
/*
*
*/
#include <stdarg.h>
#include "nsi_tracing.h"
void nsi_print_error_and_exit(const char *format, ...)
{
va_list variable_args;
va_start(variable_args, format);
nsi_vprint_error_and_exit(format, variable_args);
va_end(variable_args);
}
void nsi_print_warning(const char *format, ...)
{
va_list varia... | /content/code_sandbox/scripts/native_simulator/common/src/nsi_trace_varg.c | c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 141 |
```c
/*
*
*
* See description in header
*/
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
void *nsi_host_calloc(unsigned long nmemb, unsigned long size)
{
return calloc(nmemb, size);
}
int nsi_host_close(int fd)
{
return close(fd);
}
void nsi_host_free(void *ptr)
{
free(ptr);
... | /content/code_sandbox/scripts/native_simulator/common/src/nsi_host_trampolines.c | c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 284 |
```objective-c
/*
*
*/
#ifndef NSI_COMMON_SRC_NSI_INTERNAL_H
#define NSI_COMMON_SRC_NSI_INTERNAL_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief find least significant bit set in a 32-bit word
*
* This routine finds the first bit set starting from the least significant bit
* in the a... | /content/code_sandbox/scripts/native_simulator/common/src/nsi_internal.h | objective-c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 302 |
```c
/*
*
*/
#include <stdbool.h>
#include "nsi_config.h"
#include "nsi_cpun_if.h"
#include "nsi_tracing.h"
static bool cpu_auto_start[NSI_N_CPUS] = {true}; /* Only the first core starts on its own */
static bool cpu_booted[NSI_N_CPUS];
#define CPU_N_RANGE_CHECK(cpu_n) \
if (cpu_n >= NSI_N_CPUS) { \
nsi_print_e... | /content/code_sandbox/scripts/native_simulator/common/src/nsi_cpu_ctrl.c | c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 334 |
```c
/*
*
*/
/*
* Native simulator CPU emulator,
* an *optional* module provided by the native simulator
* the hosted embedded OS / SW can use to emulate the CPU
* being started and stopped.
*
* Its mode of operation is that it step-locks the HW
* and SW operation, so that only one of them executes at
* a ti... | /content/code_sandbox/scripts/native_simulator/common/src/nce.c | c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 2,067 |
```c
/*
*
*/
/*
* Native simulator entry point (main)
*
* Documentation can be found starting in docs/README.md
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "nsi_cpun_if.h"
#include "nsi_tasks.h"
#include "nsi_cmdline_main_if.h"
#include "nsi_utils.h"
#include "nsi_hw_scheduler.h"
#in... | /content/code_sandbox/scripts/native_simulator/common/src/main.c | c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 836 |
```c
/*
*
*/
/**
* @brief Run the set of special NSI tasks corresponding to the given level
*
* @param level One of NSITASK_*_LEVEL as defined in nsi_tasks.h
*/
void nsi_run_tasks(int level)
{
extern void (*__nsi_PRE_BOOT_1_tasks_start[])(void);
extern void (*__nsi_PRE_BOOT_2_tasks_start[])(void);
extern void... | /content/code_sandbox/scripts/native_simulator/common/src/nsi_tasks.c | c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 334 |
```objective-c
/*
*
*/
#ifndef NSI_COMMON_SRC_NSI_SAFE_CALLL_H
#define NSI_COMMON_SRC_NSI_SAFE_CALLL_H
#include <stdbool.h>
#include "nsi_tracing.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef nsi_unlikely
#define nsi_unlikely(x) (__builtin_expect((bool)!!(x), false) != 0L)
#endif
#define NSI_SAFE_CALL(a) nsi... | /content/code_sandbox/scripts/native_simulator/common/src/nsi_safe_call.h | objective-c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 191 |
```c
/*
*
*/
/*
* Native simulator, CPU Thread emulation (nct)
*/
/**
* Native simulator single CPU threading emulation,
* an *optional* module provided by the Native simulator
* the hosted embedded OS / SW can use to emulate the threading
* context switching which would be handled by a OS CPU AL
*
* Princi... | /content/code_sandbox/scripts/native_simulator/common/src/nct.c | c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 5,506 |
```c
/*
*
*/
/**
* Overall HW models scheduler for the native simulator
*
* Models events are registered with NSI_HW_EVENT().
*/
#include <stdint.h>
#include <signal.h>
#include <stddef.h>
#include <inttypes.h>
#include "nsi_tracing.h"
#include "nsi_main.h"
#include "nsi_safe_call.h"
#include "nsi_hw_scheduler.... | /content/code_sandbox/scripts/native_simulator/common/src/nsi_hw_scheduler.c | c | 2016-05-26T17:54:19 | 2024-08-16T18:09:06 | zephyr | zephyrproject-rtos/zephyr | 10,307 | 1,087 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.