An obsolete feature that is no longer being used due to the amount of
data that is needed per release and the fact it becomes stale very fast.
Instead, point to files directly for comparison.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Drop CSV generation which was the standard for sharing information since
the early days and instead use json with more content to share
information across sessions and for report generation.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Refine structure and accomodate more data, this report will serve as the
source for a testplan, reports and retries.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Specify why something was skipped (either filtered or through a ztest
case) and do not report testcases that are only being built as passed,
mark those tests as skipped with the reason specified as "Build only".
Keeping --no-skipped-report for now, although it has no impact.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Many option cancel out very already on,. so lets do this as part of the
option processing function first before we create workspace.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Cleanup main() and move logging code into own function.
This reduces clutter in main function and simplifies workflow.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Adding LOG_BACKEND_MOCK_OUTPUT_DEFAULT &
LOG_BACKEND_MOCK_OUTPUT_SYST to UNDEF_KCONFIG_WHITELIST as Kconfig
options generated by a template under testcases are not
identified by Compliance check by default.
Signed-off-by: Aastha Grover <aastha.grover@intel.com>
The hardware map feature can be used with serial pty mode in
this change. And also add an runner_params option for passing
more parameters from hardware map file to west runner. Note
that you need to create this map file manually because it
cannot be scanned out correctly due to pty is not a physical
HW device existing in system.
And also update doc/develop/test/twister.rst for the usage.
Signed-off-by: Enjia Mai <enjia.mai@intel.com>
All includes are now prefixed with <zephyr/...>, even though the old
include paths can still be used when CONFIG_LEGACY_INCLUDE_PATH=y, an
option still enabled by default. Migrating large projects can be tedious
and time consuming. This patch provides a script that can be used to
migrate any Zephyr-based project to the new include path. It is used
like this:
python $ZEPHYR_BASE/scripts/utils/migrate_includes.py \
-p path/to/zephyr-based-project
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Adjust get_mem_region to not return region when address == end
as there will be nothing to read there. Also, a subsequent region
may have that address as a start address and would be a more appropriate
selection.
Signed-off-by: Mark Holden <mholden@fb.com>
Add a runner to "flash" and "debug" Cyclone V SoC FPGA Development Kit
the runner is based on OpenOCD and GDB
Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
Twister should be partially usable even without West installed, however,
Twister unconditionally tries to import it when initializing to check
for west projects and crashes if it is not there.
This PR changes the behavior to return None if the west imports failed,
which appears to be more in line with what was intended. This allows
Twister to proceed and successfully run tests in a non-west environment.
There is no impact on environments that do have west installed.
Fixes#45355
Signed-off-by: Tristan Honscheid <honscheid@google.com>
This updates the MIPI Sys-T collateral generation to include log
modules in the XML file. This allows the parser to show where
each log message is coming from.
Note that the addition of Name propety in sys:Client is to clarify
that this collateral is from Zephyr.
Also note he addition of Mask property in syst:Guid is for parser
to match this collateral to any incoming messages, as the module
IDs are encoded in the set bits in the GUID. Without the mask,
the parser will discard any messages with non-zero module IDs.
This is based on the observation of the reference parser,
systprint, where pseudo GUIDs are generated from the module/unit
IDs (origin unit) in the incoming messages for matching with
collaterals.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Update the script so that it handles generates files using the
<zephyr/...> include prefix.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Update the script so that it handles generates files using the
<zephyr/...> include prefix.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
When doing global changes, like typo fixes or header changes, keep
default scope and do not build each test for each platform.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Twister allows us to control maximum execution time for each
test with timeout value in test .yaml configuration. This
helps us to prevent slow tests from stopping by timeout.
However it's hard to choose test timeout for all platforms
as some platforms are naturally slow. It could be a HW board with
power-efficient but slow CPU or simulation platform which
can perform instruction accurate simulation but does it slowly.
As we don't want to increase test timeout infinitely to meet
the needs of the slowest platform let's introduce
platform-specific test timeout management. It's implemented as
an optional 'timeout_multiplier' field in board .yaml
configuration. Setting it to some value multiplies each test
timeout by this value. By that we can increase timeouts only
for the platforms where it's required.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
CSV file is expanded to store run_id and the corresponding test
requires a modification.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
A unique run_id is now also added to the twister.csv file. This
file is used to store meta-data, in particular for `--test-only`
option. The run_id is then reused in `--test-only` calls to verify
if the id from readout matches the expected one.
fixes: #45278
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
Add a new gitlint user rule to block unwanted commit tags, and set it up
to block Gerrit Change-Id tags.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This reverts commit e61c534e52, which
enabled commit message checking via the checkpatch script.
The checkpatch commit message checking is currently causing more
problems that it fixes, for example:
1. the rules that are supposed to be specific to the "header" (commit
message) are being applied to the diffs.
2. there are some rules that do not fully make sense for the Zephyr
and the way we have been doing things.
Note that we currently have the 'gitlint' checking the commit messages,
so reverting this feature does not completely take away the commit
message checking in the CI.
If we are to ever re-introduce this feature, all of the aforementioned
issues need to be addressed, and the effects and ramifications of
enabling this feature must be thoroughly analysed.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Support new keyword in the testcase.yaml to allow filtering based on
enabled modules. This is useful when you only whitelist a limited set of
modules in your project and want to only run those samples that have
their dependencies satisfied and those modules available.
The option allows adding multiple modules, all of which need to be
enabled in the manifest.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Set the same encoding for collected CMake output and file where this
output will be saved.
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
Instead of resizing all devices handles, we just resize devices that are
power domains. This means that a power domain has to be declared as
compatbile with "power-domain" in device tree node.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Add API to add devices to a power domain in runtime. The number of
devices that can be added is defined in build time.
The script gen_handles.py will check the number defined in
`CONFIG_PM_DEVICE_POWER_DOMAIN_DYNAMIC` to resize the handles vector,
adding empty slots in the supported sector to be used later.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Change CheckPatch() compliance test to call checkpatch.pl directly
rather than through git diff. This has the advantage of including the
commit message in what is being checked, which is useful to catch stuff
like spurious Gerrit commit ids.
The --mailback does not seem to work correctly in this mode, but since
the output is filtered by checking the command exit code anyway, that
option is redundant, so drop that as well.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Set run id (md5 of instance and a random number) for each test and match
what was set during build with the output on the screen. This will
verify that we are evaluating the same test we have uploaded and not
some previous output on the screen.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The function in its current form is confusing because unlike other
similarly named functions (dt_nodelabel_has_prop(), dt_node_has_prop())
or devicetree macros (DT_NODE_HAS_COMPAT(), DT_NODE_HAS_PROP()), this
function takes into account the status of the checked node and returns
"y" only when the node is enabled.
This commit redefines dt_nodelabel_has_compat() so that it no longer
checks the node status, and for cases where the previous functionality
is needed, a new function named dt_nodelabel_enabled_with_compat()
is introduced as a replacement.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Add a function for checking if any node with a given compatible exists,
no matter if its status is "okay" or not.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
an area without maintainer is still considered active, calling it orphan
is a bit extreme. We have some areas that can be considered "orphaned",
those now will be covered with 'odd fixes' status, meaning that they
might have one or more collaborator and getting some changes from time
to time, but nothing beyond fixes and nobody driving the area beyond
where it is right now.
Even an area with a dedicated maintainer can be have the status of 'odd
fixes', i.e. there is a maintainer but the area is stale and no further
development is happening.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Each board needs to have a maintainer to allow automatic assignment and
adding reviewers when pull requests concerning the platform are being
submitted.
This is now a placeholder so we can start adding maintainers early, the
data is not being used anywhere yet.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This adds the ability to the dictionary logging database
generation script to output MIPI Sys-T collateral in XML.
This will allow usage of catalog logging under Sys-T, which
is similar to dictionary logging.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This changes the script to allow output format to be specified.
Currently, only JSON is support. This will allow supporting
other formats in the future.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This changes the database generation to actually extracting
individual strings instead of stuffing the whole binary sections
into the database. This allows the generation script to be
extended to accommodate more output formats.
Note that if CONFIG_LOG2_FMT_SECTION is enabled, the format
strings are in log_strings_sections, and also have associated
debug symbols in DWARF. So there is no need to manually
extract them.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
With the new structure of the cbpprintf packages, the Python
parser needs to be updated to skip extra bytes before reaching
the string table.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Decision about whether test should be considered as ztest should be made
after detection ztest testcase - not after detection ztest test suite.
Fixes: #44397
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
The sphinx-copybutton extension adds a button to every code snippet
that, when clicked, copies the code to the clipboard.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This is a follow up to commit a1ab8da862.
Handle the case when a node with the specified label does not exist.
Unlike edt.get_node(), edt.label2node.get() retuns None then, it does
not raise edtlib.EDTError.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
The list of files which are included in the `build.spdx` SPDX SBOM document
is based on the files recorded as build artifacts based on the CMake
file-based API metadata response.
In some situations, such as the case indicated in #42072, a build artifact
may be reported by CMake but no such file is present on the system
following the build. This results in the `build.spdx` SPDX SBOM being
invalid, as a result of trying to provide metadata for a non-existent
file (and specifically being unable to provide its checksum).
This commit fixes this bug by omitting files from `build.spdx` if they
do not exist on disk after the build is complete, even if the CMake
metadata claims that they should. The resulting SPDX document should
then be valid.
Fixes#42072
Signed-off-by: Steve Winslow <steve@swinslow.net>
New ztest API is available in those places:
subsys/testsuite/ztest/src/ztest_new.c
subsys/testsuite/ztest/include/ztest_test_new.h
This requires also changes in Twister code during parsing c files to
find properly test suites and testcases.
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
Extend scope of searching src directory with defined test source code.
In some cases for optimization reason src direcotry is placed in parent
directory (in relation to testcase.yaml file placement). This changes
allow to detect such situations.
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
Test wirtten in ztest framework should print in output information about
test suite name defined in test's source code (as a first argument of
ztest_test_suite() function). This changes make it possible to find such
test names in c files. Next they are used during test execution to
verify if performed test was performed properly (verification can base
not only on existance of "PROJECT EXECUTION SUCCESSFUL" info).
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
Modify serial and serial_pty option availability verification in DTU
object in device_is_available method to avoid situation when empty string
passed as serial in hardware_map.yaml cause hang up Twister in this
place.
Fixes: #41169
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
These expose every node's index in its parent's list of children to C.
The root node has no parent, so no _CHILD_IDX macro is generated for
it.
Keep macros.bnf up to date with the new generated macros.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
It can be useful to know what the index of a particular child is in
the list of nodes. Add a a helper for computing that and some test
cases.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Replaced hard-coded delay by wait for response during ICEman
connection.
Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
Signed-off-by: Alex Kolosov <rikorsev@gmail.com>
falures found during valgrind execution were treated as normal test
failures, so the logger would display a link to handler.log and not to
valgrind.log, leading to some confusion.
the return code is now handled in a correct sequence.
Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
if --enable-valgrind is selected but no valgrind executable can be
found in PATH, exit with an error
Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
The Kconfig function "dt_node_has_prop" was using label as its
parameter, where other functions use either chosen or path.
The documentation says that the parameter is path, so this patch
makes the function as documentation says and as other functions
in the file.
The additional nodelabel functions were added as counterparts that
are using nodes labels instead of paths.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
Allow retries on build errors, this is now done using
--retry-build-errors. This option is useful when for example build
failures are caused by licensing issues or intermittent network issues.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Do not wait till the end to update counters, do the counting at
realitime and reuse data for on-screen reporting.
Add a counter summary function for debugging.
This patch changes how we count and report skipped tests and the total
now has the skipped tests included.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
COPY/NOCOPY flag was added to the end of the string with ':'
as separators. The python script then split the line on ':'
which breaks on Windows build because the string was
[MEM]:[FILE]:[COPY]
In windows you will have 'c:\' in the file path so the
line.split() in script will split on the 'c:'.
Move the COPY/NOCOPY to:
[MEM]:[COPY/NOCOPY]:[FILE]
Note that the comments at top of gen_relocate_app.py also
indicates this format.
Fixes#43950
Signed-off-by: David Leach <david.leach@nxp.com>
Add a derogation to checkpatch's 'SPACING' rule, which randomly returns
the following type of issue when STM32Cube HAL *_TypeDef are used:
-:10: ERROR:SPACING: need consistent spacing around '*' (ctx:WxV)
#10: FILE: drivers/adc/adc_stm32.c:806:
+ ADC_TypeDef *adc = config->base;
This derogation applies to all _TypDef structures defined in STM32Cube
CMSIS descriptions:
FMC_Bank1E_6_TypeDef
DMA_Channel_TypeDef
ADC_TypeDef
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Currently when a node has a 'zephyr,memory-region' compatible and a
'zephyr,memory-region' string property, a new memory region is created
in the linker script.
Having a memory region without a section to place variables in could be
not that useful. With this patch we extend the memory-region mechanism
to also create sections.
The user can then place variables in the sections as usual by using for
example the GCC attributes.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Adds operation "gather_footprint" after the build stage
with minor refactoring. Before footprints were collected
only at the very end of the twister workflow
and there were situations were elf files were not available any more
(for qemu and --runtime-artifact-cleanup used).
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
In some circumstances, _thread_idx_map[] is all zero and the linker
decides to put it into BSS instead of DATA section. This results in
kernel objects being pushed away so the hash table is no longer
valid. This forces _thread_idx_map to be in the data section inside
the intermediate object file so it will be placed in the data
section in final binary.
Fixes#43618
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Git describe should work in eg. shallow clones when there are no tags.
Has been fixed in cmake previously, but not in twister.
Signed-off-by: Andreas Pettersson <andreaspettersson95@gmail.com>
When running twister with --only-failed option, based on last xml
result, the new skipped count should be the last skipped count
plus current skipped count.
Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
Passing the zephyr build directory to the script run by
--device-serial-pty, it makes the feature of the device serial
pty more flexible.
Signed-off-by: Enjia Mai <enjia.mai@intel.com>
Although CMake scripts already support duplicated module
names, if two modules with the same name provide different
Kconfig files, then both files will be loaded leading to
potential conflicts.
Modify zephyr_module.py to enforce that all modules are
uniquely named so that it is possbile to override some of
the built-in modules using ZEPHYR_EXTRA_MODULES variable.
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
Some macros, e.g., FOR_EACH_FIXED_ARG, require a separator argument that
needs to be in parentheses, e.g., (||). This should not trigger a
checkpatch warning.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Let's consider this (simplified) compilation result of a debug build
using -O0 for riscv64:
|__pinned_func
|static inline int k_sem_init(struct k_sem * sem,
| unsigned int initial_count,
| unsigned int limit)
|{
| 80000ad0: 6105 addi sp,sp,32
| 80000ad2: ec06 sd ra,24(sp)
| 80000ad4: e42a sd a0,8(sp)
| 80000ad6: c22e sw a1,4(sp)
| 80000ad8: c032 sw a2,0(sp)
| ret = arch_is_user_context();
| 80000ada: b39ff0ef jal ra,80000612
| if (z_syscall_trap()) {
| 80000ade: c911 beqz a0,80000af2
| return (int) arch_syscall_invoke3(*(uintptr_t *)&sem,
| *(uintptr_t *)&initial_count,
| *(uintptr_t *)&limit,
| K_SYSCALL_K_SEM_INIT);
| 80000ae0: 6522 ld a0,8(sp)
| 80000ae2: 00413583 ld a1,4(sp)
| 80000ae6: 6602 ld a2,0(sp)
| 80000ae8: 0b700693 li a3,183
| [...]
We clearly see the 32-bit values `initial_count` (a1) and `limit` (a2)
being stored in memory with the `sw` (store word) instruction. Then,
according to the source code, the address of those values is casted
as a pointer to uintptr_t values, and that pointer is dereferenced to
get back those values with the `ld` (load double) instruction this time.
In other words, the assembly does exactly what the C code indicates.
This is wrong for 2 reasons:
- The top half of a1 and a2 will contain garbage due to the `ld` used
to retrieve them. Whether or not the top bits will be cleared
eventually depends on the architecture and compiler.
- Regardless of the above, a1 and a2 would be plain wrong on a big
endian system.
- The load of a1 will cause a misaligned trap as it is 4-byte aligned
while `ld` expects a 8-byte alignment.
The above code happens to work properly when compiling with
optimizations enabled as the compiler simplifies the cast and
dereference away, and register content is used as is in that case.
That doesn't make the code any more "correct" though.
The reason for taking the address of an argument and dereference it as an
uintptr_t pointer is most likely done to work around the fact that the
compiler refuses to cast an aggregate value to an integer, even if that
aggregate value is in fact a simple structure wrapping an integer.
So let's fix this code by:
- Removing the pointer dereference roundtrip and associated casts. This
gets rid of all the issues listed above.
- Using a union to perform the type transition which deals with
aggregates perfectly well. The compiler does optimize things to the
same assembly output in the end.
This also makes the compiler happier as those pragmas to shut up warnings
are no longer needed. It should be the same about coverity.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Even though bash is commonly available as /bin/bash there are
exceptions (e.g NixOS). This commit allow the use of the scripts in my
environment and is generic.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
With --no-skipped-report, twister will skip over all tests marked as
skipped (filtered) in the junit report.
This is useful for CI where have 1000s of filtered tests that appear in
the report and in some cases cause tools parsing the output to fail or
provide incomplete results.
Fixes#38179
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Commit 28b2e55321 introduced a regression
into twister workflow, breaking memory footprint calculation.
The commit changed name of produced .elf files.
There is no more zephyr_prebuilt.elf and instead we have
zephyr_pre0.elf and zephyr_pre1.elf. This commit fixes a filter
telling which files to exclude when calculating memory footprints,
to match the current status.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
nrfjprog prints out a warning if a device is programed without the
--verify option, which can be confusing.
So added the option when programming with nrfjprog.
Then west flash can be used without getting a warning.
Also changed the tests to only accept programming with --verify
option.
Signed-off-by: Markus Swarowsky <markus.swarowsky@nordicsemi.no>
Use the common code in scripts/list_boards.py for finding matching
boards in scripts/ci/test_plan.py. This has the benefit of not trying to
use board revisions files as board names.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
west build supports specifying the board revision using @revision, but
it's not mentioned in the help text. This commit updates the help text
to describe how to specify the board revision.
Signed-off-by: Gregers Gram Rygg <gregers.gram.rygg@nordicsemi.no>
Sometimes custom script fails, but we can't see the
error information in twister log, because the twister
uses _ to ignore the stderr.
Signed-off-by: Jingru Wang <jingru@synopsys.com>
The -c option points rimage at its main and mandatory configuration
file ("signing schema"). The -c option passed by sign.py to rimage comes
from _two_ different places:
A. From the command line, example:
west sign -t rimage -- OTHER_ARGS_FOR_RIMAGE -c foo.toml
However passing -- -c signing_schema.toml on the west sign command line
has always been optional because:
B. west sign systematically adds another `-c bar.toml` option. The name
'bar' is found in the CMakeCache. Right now 'bar' comes from
a product specific `board.cmake` file.
There were two problems fixed by this commit:
1. The -c option from the command line was passed _first_ but the last
-c wins with rimage. The command line should have precedence.
2. The "last -c wins" behavior is not documented/official, it's an
rimage implementation deteail.
To fix both, simply scan the command line for a '-c' option. If any is
found then it takes precedence over the CMakeCache-based value which is
dropped.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Create a cmake/modules folder containing all Zephyr CMake modules.
All Zephyr cmake files that are included from boilerplate are now
converted into CMake modules which can be individually loaded.
The Zephyr CMake package is updated to support loading of individual
CMake modules using the COMPONENTS argument to `find_package(Zephyr)`.
If the COMPONENTS argument is not specified, the default Zephyr build
system will load.
If COMPONENTS is specified then, only those components and the
dependencies will be loaded.
If a Zephyr CMake module depends on another CMake module which has not
been loaded, it will automatically be loaded.
This allows us to modularize and reuse individual parts of the Zephyr
CMake build system in a more flexible way in future.
Such usage could be:
- Higher livel multi image build system
- Invocation of individual components, for example dts processing by
twister without loading all build code
- Doc build
- Unittesting
With this new CMake package and CMake module scheme then direct
sourcing of boilerplate.cmake has been deprecated.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
* Use case of interest:
Some platforms are shipping in parallel to the internal FLASH some other
storage / external FLASH (usually a QSPI FLASH) that can be used to
execute (XIP) code from.
The content of this external FLASH can usually be written at flash time
using proper tools (see for example the case of the external FLASH on
the nRF5340DK that can be written at flash time using nrfjprog).
The external FLASH is a nice addition that is extremely useful when a
large application code doesn't entirely fit on the internal FLASH so
that we could want to move part of it in the auxiliary FLASH to XIP the
code from there.
* The problem:
Right now Zephyr doesn't have a formal and generic way to move at build
time part of the code to a different memory region.
* The current status:
Zephyr is indeed shipping a code_relocation feature but that doesn't
entirely match our needs.
When XIP is enabled, the code_relocation feature is used in Zephyr to
move the selected code (that is to copy text section, to initialize data
and zero bss) from FLASH to SRAM at run time and execute code from SRAM.
The relocation is done by a generated snippet of code that is
memcpy()-ing the right content to the destination region also using some
build-time generated portions of linker script to retrieve start and
destination addresses and regions.
* This patch:
This patch is leveraging the code_relocation code and adding a NOCOPY
feature. This feature is using the code_relocation feature to
dynamically build the linker script snippets but entirely skipping the
run-time code relocation so that the code can be XIP-ed from the
destination region.
* Example:
Let's say that we have a big file called `huge_file.c` that we want to
XIP from the external FLASH that is mapped in an EXTFLASH region.
In this case we should enable `CONFIG_XIP` and
`CONFIG_CODE_DATA_RELOCATION` and instruct cmake as follows:
zephyr_code_relocate(src/huge_file.c EXTFLASH_TEXT NOCOPY)
zephyr_code_relocate(src/huge_file.c SRAM_DATA)
this means that:
- The .text section of the `huge_file.c` must reside in the EXTFLASH
memory region and we do not need to copy the section there because we
are going to XIP it (and we assume that the file is going to be placed
in the external FLASH at flash time).
- The .data section of the `huge_file.c` must still reside in the SRAM
memory region.
* TODOs:
It's desirable to have the possibility to relocate libraries and
pre-build files instead of source code files.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Add a new cmake extension function:
dt_comp_path(<var> COMPATIBLE <compatible> [INDEX <idx>])
to get a list of paths for the nodes with the given <compatible>. This
is useful when we have to cycle through several nodes with the same
compatible.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
fixtures could also be given by twister command with --fixture option
explicitly, not only hardware map file. In this case, we should
assign those fixtures to each devices too.
Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
Zeroing the BSS and copying data to RAM with regular memset/memcpy may
cause problems when those functions are assuming a fully initialized
system for their optimizations to work e.g. some instructions require
an active MMU, but turning the MMU on needs the .bss section to be
cleared first, etc.
Commit c5b898743a ("aarch64: Fix alignment fault on z_bss_zero()")
provides a detailed explanation of such a case.
Replacing z_bss_zero() with an architecture specific one is problematic
as the former may see new sections added to it that would be missed by
the later. The same reasoning goes for z_data_copy().
Let's make maintenance much easier by providing weak versions of
memset/memcpy that can be overridden by architecture-specific safe
versions when needed.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Add possibility to create shorter build paths when --short-build-path
option is enabled. This can help during run Twister on Windows OS and
building programs by CMake which has a problem when paths with building
files are too long. The solution based on symbolic links which help to
connect "traditional" long paths with shorter one like:
"twister_links/test_0".
Fixes#41929
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
Kconfig symbols must not be defined in Kconfig.defconfig.* files. Such
files are meant to change the default value of certain options.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The problem with append is that when doing incremental (non-clean)
build, the content of these files are appended each time to the previous
leftover content.
Example:
# west build -p -b qemu_cortex_m3 \
samples/application_development/code_relocation/
# // disable for example CONFIG_XIP
# west build -b qemu_cortex_m3 \
samples/application_development/code_relocation/
at this point the content of the generated files (i.e.
linker_relocate.ld) is wrong.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Looks like the 4.33 release has some more issues, so let's wait until
everything gets fixed before allowing future versions.
Ref. https://github.com/michaeljones/breathe/issues/805
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Sphinx 4.33.0 introduces Graphviz support, but the Graphviz
configuration value names clash with the Sphinx built-in Graphviz
extension.
Issue: https://github.com/michaeljones/breathe/issues/803
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
When testcase written in ztest is skipped by ztest_test_skip() function,
then "SKIP" information is printed in output data. This "SKIP" result is
set as result of performed testcase, but the information about reason is
still "Unknown". This patch fix this problem and if all test scenario
has state "passed" (so testcases have result "PASS" or "SKIP"), reason
is still set as "Unknown" and if any of testcase has result "SKIP" then
set reason as "ztest skip".
Fixes#42414
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
Fixes: #39503Fixes: #40167
This commit moves `BUILD_VERSION` CMake variable from a compile
definition to be a define inside version.h.
Besides the benefit of having related settings grouped in a common
header, it also means that an updated `BUILD_VERSION` value does not
need to trigger re-compilation of all source files.
When using compile definitions, CMake cannot tell whether a given source
files uses the definition or not, and hence all sources must be
recompiled to be sure they are up-to-date.
Placing `BUILD_VERSION` in version.h, the source dependencies ensures
that only source files including `version.h` gets recompiled.
As part of this, version.h generation is moved so that it is now done
at build time.
This means that re-generation of version.h is no longer depending on a
CMake re-run but can have it's own dependency in `.git/index` when git
described is used to obtain `BUILD_VERSION` information.
Generation of logging dictionary database has been updated to support
BUILD_VERSION from header file instead of CMake configure time variable.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Need a better way or tagging for this area, we have been introducing
regressions that were undetected due to those filters.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When using the west spdx functionality to create an SPDX SBOM
during a build, several SPDX Documents are created. In some
instances, the SPDX metadata field PackageLicenseInfoFromFiles
is required to be present according to the SPDX 2.2 spec, but is
being omitted from the build.spdx Document if no licenses were
detected.
This commit fixes this bug so that a NOASSERTION value is written
for this field for Packages that do not contain any detected
licenses.
Additionally, this ensures that Packages with a FilesAnalyzed
value of false do not have this field written, also in accordance
with the spec.
Fixes#42070
Signed-off-by: Steve Winslow <steve@swinslow.net>
sometimes there are some unencodable unicode chars from output
of west flash command, need to ignore them rather than reporting
an error.
Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
CONFIG_OPENOCD_SUPPORT was deprecated in favor of
CONFIG_DEBUG_THREAD_INFO in Zephyr v2.6.0 and can now be removed.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
This commit adds support for adjust the addresses of the final image.
This is useful when the image is to be flashed at a location different
from the LMA address encoded in the ELF file by the linker.
An example use-case is multicore systems where core A might load image
from a flash partition into RAM in order for core B to execute and load,
but where the image itself is build with the RAM addresses as LMA.
It updates the zephyr_image_info.h header with information of adjustment
value.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit adds the `gen_image_info.py` script which supports creation
of a header file with image information from the EFL file.
This version populates the header file with:
- Number of segments in the image
- LMA address of each segment
- VMA address of each segment
- Size of each segment
The header file can be used by a secondary build system which needs this
information.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
MIPS (Microprocessor without Interlocked Pipelined Stages) is a
instruction set architecture (ISA) developed by MIPS Computer
Systems, now MIPS Technologies.
This commit provides MIPS architecture support to Zephyr. It is
compatible with the MIPS32 Release 1 specification.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
When strings are not in the dictionary, the parser would crash.
This works around the issue by indcating an unknown string
as "string@<addr>".
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This reports the warning fixed in commit 61fe69dded ("sys:
device_mmio.h replace <toolchain/common.h> with <toolchain.h>")
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Testing shows cmake is invoked directly, not through a shell.
Fixes commit 5092541e2b ("sanitycheck: disable erroring on warnings").
Note EXTRA_AFLAGS was quoted only on the left side!
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Changes will raise error and break program in following three situations:
1. Platform name pass in --platform option does not exist.
2. During using --all option, platform from platform_allow list does not
exist.
3. During using --integration option, platform from
integration_platforms list does not exist.
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
When some testcase is skip in their source code by ztest_test_skip()
function in final json report it is marked as pass what is wrong. Due to
the changes in this commit those skips can be marked properly.
Fixes: #41440
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
This print() call was introduced as part of commit 16571db029 ("soc:
esp32: add support to mcuboot build") probably as a leftover from
debugging stage. Remove that, so flash command is not printed by
default. Those commmands can be easily printed by passing -v flag to
`west -v flash ...` command.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
breathe: for simplicity, require versions > 4.30 (lower versions have
known issues, so do not take risks).
Sphinx: start requiring versions >=4.x. Keep with compatible versions,
since Sphinx major updrages can easily break extensions, themes, etc.
sphinx_rtd_theme: upgrade to >=1.x. Again, keep with compatible versions
since we have style customizations that can likely break on major
upgrades.
pygments: Allow any version >=2.9 (version that introduced DT support).
We do not have strong compatibility requirements here.
sphinx-notfound-page: Remove any requirements, we do not have strong
requirements for this one.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Whenever build/zephyr/runners.yaml does not specify the location of the
openocd executable we seemd to be leaving the executable variable as
None. Instead, use its executable name.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Select configuration when mcuboot is enabled.
At this moment, only UNSIGNED image is supported as per
Espressif's mcuboot porting.
This also updates esp32 runner to use proper bin_file name
and updates default bootloader check.
Move CMakeLists.txt content from board to soc directory
as this support is for esp32 architecture and not board
specific.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
IDF bootloader requires partition table which is not a requirement for
MCUboot. Hence, esp32.py is updated to flash partition table only if it
exists.
Current implementation only allows flashing zephyr.bin. This commit adds
capability to flash binaries with other names as well
(e.g. - zephyr.signed.bin)
Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
When generating new map we store serial_baud, but the schema has 'baud'
only, so call this baud in the class and resolve the issue of creating
new maps.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Changes will log error message in following three situations:
1. Platform name pass in --platform option does not exist.
2. During using --all option, platform from platform_allow list does not
exist.
3. During using --integration option, platform from
integration_platforms list does not exist.
Fixes#31868
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
The presence of a separate build for the bootloader code has always
been a wart with this platform. Sharing of code between the two has
required great care. We've had bugs with mismatched include paths,
macro definitions and compiler flags, etc... And of course it's not
possible for one to see the other; in theory we'd like the ability to
call back into IMR code after startup, to use the space for temporary
storage, etc...
So let's finally do it. This really isn't that complicated when you
see it in isolation:
+ Move the module manifest metadata into an "rimage_modules.c", and
put them in their own NOLOAD section where we can grab them later
with objcopy.
+ Make a new "imr" memory region in the main linker and just paste the
bootloader linkage (which is now using its own specific sections) in
there.
+ After zephyr.elf is built and cache-remapped, we can extract the imr
sections and the appropriate manifest for the bootloader rimage
module, and then do the converse by excluding them for the main
image module.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
GDB server dummies WINDOWBASE to 0 and WINDOWSTART to 1
for both arches and sends An as corresponding ARn for ESP32
to get around packet size limitation. Fixes backtrace and
other issues causing GDB client to crash.
Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
The PR #39382 raised a discussion on build reproducibility and knowledge
of west projects being out of sync with the west manifest.
Similar to how `git submodules` will report the working tree dirty if
any of the submodules HEAD points to a SHA different than the one
recorded in the super project.
Based on this discussion this commit extends the Zephyr and manifest
repo (when `west` is used) revisions to include the concatenated states
of the workspace.
The workspace states are:
> dirty: false / true
> extra: false / true
> off: false / true
the final revision will become: <SHA>-<state1>-<state2>-<state3>
For example:
> zephyr:
> path: /.../zephyr
> revision: <SHA>-dirty-extra-off
or
> zephyr:
> path: /.../zephyr
> revision: <SHA>-extra
The `BUILD_OUTPUT_META_STATE_PROPAGATE` Kconfig setting is introduced
to provide user control of this behavior.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The PR #39382 raised a discussion on build reproducibility and knowledge
of west projects being out of sync with the west manifest.
Similar to how `git submodules` will report the working tree dirty if
any of the submodules HEAD points to a SHA different than the one
recorded in the super project.
Based on this discussion this commit extends the Zephyr build meta file
with overall workspace status included in the meta file.
It adds the following meta info to the build meta file:
> workspace:
> dirty: false / true
> extra: false / true
> off: false / true
A project using west and having an extra Zephyr module loaded not
controlled using git and a west project at a SHA different than the
SHA referenced by the manifest can look like:
zephyr:
path: /.../zephyr
revision: 863600cd0e
modules:
- name: mcuboot
path: /.../bootloader/mcuboot
revision: c61538748ead773ea75a551a7beee299228bdcaf
- name: local_module
path: /.../local_module
revision: null
west:
manifest: /.../zephyr/west.yml
projects:
- path: /.../zephyr
revision: 863600cd0e
- path: /.../bootloader/mcuboot
revision: c61538748ead773ea75a551a7beee299228bdcaf-off
- path: /.../tools/net-tools
revision: f49bd1354616fae4093bf36e5eaee43c51a55127
workspace:
dirty: false
extra: true
'off': true
And without west:
zephyr:
path: /.../zephyr
revision: 863600cd0e
modules:
- name: hal_nordic
path: /.../modules/hal/nordic
revision: a6e5299041f152da5ae0ab17b2e44e088bb96d6d
- name: local_module
path: /.../local_module
revision: null
workspace:
dirty: false
extra: true
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
In order to enable use of stm32cubeprogrammer runner with twister,
add "sn" tool specific option which allows to provide target serial
number and hence select the target to flash when multiple ones are
connected to the host.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
If we are invoking testplan for only one board, do not bother with other
board related changes, just generate plan for the specified platform.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add checks to ensure that `zephyr,linker-region` property values are
always globally unique.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Don't let a malformed devicetree escape as a DTError. Wrap it in an
EDTError instead, so callers can just rely on the edtlib APIs as is
generally expected.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
A GCC linemarker of the form:
# 1 "filename" 2 3 4
or so is not currently being handled, because the current regular
expression assumes the "flags" values (the numbers after "filename")
are limited to a single value. Tweak the regular expression to allow
for up to 4 flags, which is what GCC documents it may emit:
https://gcc.gnu.org/onlinedocs/gcc-10.2.0/cpp/Preprocessor-Output.html
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This enables cmake extensions that can look up the path for any
devicetree alias, or check if the alias is missing, etc.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Using edt.chosen_nodes looks like a simple attribute lookup, but it's
actually calling a property that will create a new list of chosen
nodes every time. Apply a small optimization by only creating the list
once.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit implements west flash command for Telink B91 platform.
west flash command uses ICEman and SPI burn from AndeSight for flashing.
Signed-off-by: Alex Kolosov <rikorsev@gmail.com>
We were missing smaller sets and skipping tests when the set is smaller
than the allowed number of tests per node.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Checkpatch was checking for macro concats (##), however
we often use UTIL_CAT to allow for multiple macro expansion passes
to succeed.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
kconfiglib doesn't render backslashes in menu strings, and the prompts
in the module menu will be unintelligible on Windows. Print these
menus as posix paths on Windows as well, so they don't look broken in
menuconfig.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
The pinctrl_soc_pin_t is used as an opaque type in pinctrl to store pin
configurations which are SoC dependent.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Improve calculation of matrix and move calculations from workflow to the
testplan script. We now generate a file that can be parsed by the action
with the data needed to start twister with the right number of nodes.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Do not invoke --integration when dealing with one platform only and
generate testplan only for the needed platforms.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add yet another option, --verify-only, to west flash. This option
runs openocd with verify_image but without load_image.
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
OpenOCD has verify_image command. Add `--verify` option to west flash
so that openocd can do vierfy_image right after load_image.
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
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 Devicetree file and will
first adjust that file by removing old pin-related properties replacing
them with pinctrl states. A board-pinctrl.dtsi file will be generated
containing the configuration for all pinctrl states. Note that script
will also work on files that have been partially ported.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The -DCMAKE_EXPORT_COMPILE_COMMANDS=1 is removed from twisterlib.py as
it is now always set by the Zephyr build system.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: #40590
This commit updates gen_app_partitions.py to include only files present
in the current build by extracting the information from the CMake
generated `compile_commands.json` file.
This ensures that object files in sub-projects, such as `empty_cpu0`,
will not be considered by the script.
Using the compile_commands.json instead of walking the whole build tree
for finding object files also improves performance:
Time of executing `gen_app_partitions.py` (Old):
__________________________
Executed in 480.06 millis
usr time 425.83 millis
sys time 49.55 millis
Time of executing `gen_app_partitions.py` (New):
________________________________________________________
Executed in 76.22 millis
usr time 49.00 millis
sys time 24.59 millis
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Merged 3 files used to generate the test plan per PR based on the
changes. 2 python scripts and a shell script are now all merged into 1
python script that generates the input file for twister based on a list
of changed files by the PR.
This remove lots of old and obsolete code and simplifies things a bit,
no need anymore for an intermediate script to call twister, we call it
directly in the workflow and use the new test_plan script to generate
the test plan.
This also reenables the recently disabled tag based filtering which had
a bug, bug is resolved in this new implementation.
On push events, we now run twister without the --integration option to
catch any issues in the main branch that were not caught in PRs. PRs
continue to run with --integration enabled. This event (push) is now run
on 15 builders due to the increased size.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add function to check if a property of a node
is equal to a passed string.
The motivation is that in current USB device support
the sizes of bulk endpoints are configured in Kconfig.
The information if a USB device controller supports
high-speed comes from devicetree. This information must be
mapped in controller driver Kconfig and corresponding options
in USB device stack configured must be adjusted.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This action replaces current buildkite workflow and uses github actions
to build and run tests in the zephyr tree using twister. The main
differences to current builtkite workflow:
- the action handles all 3 events: pull requests, push and schedule
- the action determines size of matrix (number of build hosts) based on
the change with a minimum of 1 builder. If more tests are built/run
due to changes to boards or tests/samples, the matrix size is
increased. This will avoid timeouts when running over capacity due to
board/test changes.
- We use ccache and store cache files on amazon S3 for more flexibility
- Results are collected per build host and merged in the final step and
failures are posted into github action check runs.
- It runs on more powerful instances that can handle more load.
Currently we have 10 build hosts per run (that can increase depending
on number of tests run) and can deliver results within 1 hour.
- the action can deal with non code changes and will not allocate more
than required to deal with changes to documentation and other files
that do not require running twister
The goal long-term is better integrate this workflow with other actions
and not run unncessarily if other workflows have failed, for example, if
commit message is bogus, we should stop at that check, to avoid wasting
resources given that the commit message will have to be fixed anyways
which would later trigger another run on the same code.
Currently there is 1 open issue with this action related to a github
workflow bug where the final results are not posted to the same workflow
and might appear under other workflows. Github is working on this bug.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Do not load empty files through the ELF parser and raise exception when
magic number of ELF is not matched.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add supported device information to the device `handles` array. This
enables API's to iterate over supported devices for power management
purposes.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Black Magic Probe supports a "monitor connect_srst" command [1] to
configure whether to assert reset when connecting to the target. This is
useful to reprogram a target that may be idling in a low power state,
with an otherwise unresponsive debug core.
Adding a --connect-srst runner option for enabling this for "flash" and
"debug" operations to ensure that programming works in that case, but
also explicitly disabling it for "attach", to allow attaching to a
running target without changing its state.
Not turning this on by default since apparently some MCUs disable the
SWD interface while in reset.
[1] https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands
Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
replace with version.parse from packaging module.
prevent this warning message:
DeprecationWarning: The distutils package is deprecated
and slated for removal in Python 3.12. Use setuptools or
check PEP 632 for potential alternatives
Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Change the "yes/no" value to "true/false".
Otherwise pykwalify 1.8.0 will report below errors:
- Value: 'no' for required keyword must be a boolean:
Path: '/mapping/common'>
- Value: 'yes' for required keyword must be a boolean:
Path: '/mapping/sample/mapping/name'>
Signed-off-by: Shao Ming <ming.shao@intel.com>
Added a unit divisor option to the dt_node_int_prop_int and
dt_node_int_prop_hex functions to allow retrieval of DTS items as
a size value of K, M, or G divisor similar to the dt_node_reg_size_int
function.
Signed-off-by: David Leach <david.leach@nxp.com>
Removes hardcoded logic in the west signing script that translates
Zephyr board names to rimage target names. Instead, use a cached CMake
variable set at the board level to define its respective rimage target
name. This eliminates the need to modify the west signing script when
new SOF-supported boards are introduced to Zephyr.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
With `gen_handles.py` now running on the first pre-built image,
`zephyr_pre0.elf` there is no requirement for the device handle arrays
to remain the same size after processing.
Remove the padding generated in `gen_handles.py`, as well as the
temporary option `CONFIG_DEVICE_HANDLE_PADDING` which was added to work
around this issue.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is motivated by the west discussion in:
https://github.com/zephyrproject-rtos/west/issues/548
The commit provides the ability to generate a build meta info file
containing lists of:
- Zephyr: path and revision
- Zephyr modules: name, path, and revision
- West: manifest path
path and revision for each project
For Zephyr or Zephyr modules the revision will be `null` if it is not
under git version control.
If Zephyr, a modules, or a project has uncommitted changes, the revision
will be marked dirty.
If west is not installed or used for the build process, the
west-projects list will be empty.
If a project is both a Zephyr module and a west project it will show up
in both lists.
Similar to Zephyr, which is independently referred as the Zephyr in use
but also listed as west project when west is used.
This is important in case ZEPHYR_BASE was manually set and pointing to
a different Zephyr repository.
The build meta file is not created per default but can be enabled with
the BUILD_OUTPUT_META Kconfig setting.
A project using west and having an extra Zephyr module loaded not
controlled using git can look like:
zephyr:
path: /.../zephyr
revision: 863600cd0e3c0a271e86629c5089821e5e4380cc-dirty
modules:
- name: mcuboot
path: /.../bootloader/mcuboot
revision: c61538748ead773ea75a551a7beee299228bdcaf
- name: local_module
path: /.../local_module
revision: null
west:
manifest: /.../zephyr/west.yml
projects:
- path: /.../zephyr
revision: 863600cd0e3c0a271e86629c5089821e5e4380cc-dirty
- path: /.../bootloader/mcuboot
revision: c61538748ead773ea75a551a7beee299228bdcaf
- path: /.../tools/net-tools
revision: f49bd1354616fae4093bf36e5eaee43c51a55127
And without west:
zephyr:
path: /.../zephyr
revision: 863600cd0e3c0a271e86629c5089821e5e4380cc-dirty
modules:
- name: hal_nordic
path: /.../modules/hal/nordic
revision: a6e5299041f152da5ae0ab17b2e44e088bb96d6d
west: null
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Many tests and CI activties are being missed by excluding tests
mistakingly when running twister.
This is visibile when you change one or more tests in kernel/ for
example, twister does not run those tests that have changed at all and
marking the PR as tested and ready to be merged.
Temporary fix for #40235.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Fixes the following error:
ERROR: Build directory "<whatever>" is for application "<symbolic source
dir in CMakeCache.txt>", but source directory "<resolved source dir>"
was specified; please clean it, use --pristine, or use --build-dir to
set another build directory
FATAL ERROR: refusing to proceed without --force due to above error
Fixes initial commit ab82264ace ("scripts: add west build, flash, and
debug commands")
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
As described in IEEE Std 1275-1994, the PCIe bindings uses the ranges
property to describe the PCI I/O and memory regions.
Write _RANGES_ defines that will be used to determines the I/O and
memory regions from PCIe Controller drivers.
Also exclude "ranges" & "dma-ranges" property's length generation
alogn "reg" and "interrupt".
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This adds some tests in test_edtlib.py and test.dts to check all
common possible combination of ranges property usage and handling
by edtlib.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
As described in IEEE Std 1275-1994, the PCIe bindings uses the ranges
property to describe the PCI I/O and memory regions.
Add parsing of this property in edtlib.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Add a few Bluetooth samples to track their footprint as part of the
effort to contain firmware bloat.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add GigaDevice ISP console flash runner. This tool enable uses ROM
bootloader to flash devices using serial port.
The GD32_ISP_Console tool can be found at
http://www.gd32mcu.com/download/down/document_id/175/path_type/1
Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
Fix few limitation which do not allow to run Twister on Windows OS.
Especially turn off "import pty" module, due to the fact, that this
module can be used only on POSIX OS.
Fixes#40007
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
Check each line whether contains the correct pattern
${location}:${file} before splitting because it
turns out that script passes also compile
definitions added in project CMakeLists.txt such as:
add_compile_definitions(ABCD="XYZ")
which results in the build failure.
Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
As pylint says "Consider iterating the dictionary directly
instead of calling .keys()" don't use .keys() method.
Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
Introduce a weak implementation of test_main() which calls:
* ztest_run_registered_test_suites(NULL);
* ztest_verify_all_registered_test_suites_ran();
This will attempt to run all registered test suites and verify that
they each ran.
Signed-off-by: Yuval Peress <peress@chromium.org>
Add new functionality to ztest to improve test modularity. The two
primary new entry points are:
* ztest_register_test_suite
* ztest_run_registered_test_suites
When registering a new test suite, users provide the name as well as
an optional predicate used to filter the tests for each run. Using NULL
as the predicate ensures that the test is run exactly once (after which
it is automatically filtered from future runs).
Calls to ztest_run_registered_test_suites take a state pointer as an
argument. This allows the the pragma functions to decide whether the
test should be run.
The biggest benefit of this system (other than the ability to filter
tests and maintain a larger test state) is the ability to better
modularize the test source code. Instead of all the various tests
having to coordinate and the main function having to know which tests
to run, each source file manages registering its own test
suite and handling the conditions for running the suite.
Signed-off-by: Yuval Peress <peress@chromium.org>
Add "ExitOnError 1" argument that treats any command-error
as fatal thus in the case of a programming error the "west flash"
command will return the correct error code instead of the default 0. It
fixes the false positive return codes when e.g we call west flash
command without a connected programmer or with the disconnected board.
Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
Added check to respect the TRACING_SYSCALL tracing option
when generating syscall tracing overrides in
gen_syscalls.py.
Signed-off-by: Torbjörn Leksell <torbjorn.leksell@percepio.com>
Some architectures (e.g. RISC-V) has .sdata/.sbss section for small
data/bss. Memory partition should also manage the permission of these
sections in library so they should be put into app_smem.
(For example, newlib _impure_ptr is in .sdata section and
__malloc_top_pad is in .sbss section in RISC-V.)
Signed-off-by: Jim Shu <cwshu@andestech.com>
When generating syscall wrappers, call a tracing macro with the id,
name, and all parameters of the syscall as params when entering and
leaving the syscall. This can be disabled in certain call sites
by defining DISABLE_SYSCALL_TRACING which is useful for certain
tracing implementations which require syscalls themselves to work.
Notably some syscalls *cannot* be automatically traced this way and
headers where exclusions are set are in the gen_syscall.py as notracing.
Includes a systemview and test format implementation.
Tested with systemview, usb, and uart backends with the string
formatter using the tracing sample app.
Debugging the trace wrapper can be aided by setting the TRACE_DIAGNOSTIC
env var and rebuilding from scratch, a warning is issued for every
instance a syscall is traced.
Automatically generating a name mapping for SYSVIEW_Zephyr.txt is a
future item as is documenting how to capture and use the tracing data
generated.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
This adds two new Kconfig settings.
The first setting `EXPERIMENTAL` which is a promptless symbol.
This symbol must be selected by any setting which is used to enable
an experimental feature.
The second setting is `WARN_EXPERIMENTAL` which is a user controlled
setting that configures the build system to print a warning when
experimental features are enabled.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes a bug causing tests with error status get silently skipped
when --subset is used.
Fixes: #39619
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
Always add the boards/<arch>/<board>/support directory to the OpenOCD
runner search path if the directory exists.
This simplifies using custom --config <partial-board.cfg> runner
arguments without having to use the full path to the cfg file.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Currently, west spdx --init uses os.mknod to create an empty file
to enable the Cmake file-based API system. As reported in #39311,
Python on Windows does not implement os.mknod.
This commit switches to using open()/close() instead of os.mknod()
to address this issue.
Signed-off-by: Steve Winslow <steve@swinslow.net>
For looking at statistics over time, it is helpful to be able to
quickly query the number of unique maintainers, collaborators,
areas, and the number of orphaned areas (without a maintainer).
This change adds the `count` subcommand to
`scripts/get_maintainer.py`.
```
% python3 ./scripts/get_maintainer.py count -h
usage: get_maintainer.py count [-h] [-a] [-c] [-n] [-o]
optional arguments:
-h, --help show this help message and exit
-a, --count-areas Count the number of areas
-c, --count-collaborators
Count the number of unique collaborators
-n, --count-maintainers
Count the number of unique maintainers
-o, --count-orphaned Count the number of orphaned areas
% python3 ./scripts/get_maintainer.py count
areas: 113
maintainers: 49
collaborators: 81
orphaned: 21
% python3 ./scripts/get_maintainer.py count -o
orphaned: 21
```
Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
#38557 Reordered the argument for openocd, but we should not try
to call the init command before giving the board configuration
file stored in 'self.cfg_cmd'.
Move back this variable to it's original position.
Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Commits 49bcc08033 introduced
a possible None object 'gdb_init', do not try to iterate over
this variable if it is a None object.
Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Threads may wait on an event object such that any events posted to
that event object may wake a waiting thread if the posting satisfies
the waiting threads' event conditions.
The configuration option CONFIG_EVENTS is used to control the inclusion
of events in a system as their use increases the size of
'struct k_thread'.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Fixes#38046
Document the changes in twister.rst
Add baud rate to debug message in twister
Add baud parameter to twister's add_device function
Set the twister baud rate from input parameters
Use 115200 as the default baud rate if not specified
Add baud to the hwmap-schema.yaml file
Add --device-serial-baud to twister arguments
Fix compliance issues
Fix mistake in parameter name from device-baud to device-serial-baud
Refactoring of the code in orded to simplify the logic
and clear multiple definitions of the default baud rate.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
Signed-off-by: Dennis Ruffer <daruffer@gmail.com>
Poll the flash status instead of just reading the flash status once. Add
support for controlling the number of SDO retries and the SDO timeouts.
These changes allows for greater control of the CANopen program
download, which is especially useful on noisy or congested CAN networks
and on devices with slower flash access.
Fixes: #39409
Signed-off-by: Klaus H. Sorensen <khso@vestas.com>
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Currently all the *-names and *-cells properties are derived from the
name of the base <name>s property. This is a limitation because:
- It forces the base property name to be plural ending in -s
- It doesn't allow the english exception of plural words ending in -es
With this patch we add one additional property 'specifier-space' that
can be used to explicitly specify the base property name.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Suggested-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
In order to allow for further options to be deprecated with minimal
impact, add a deprecation argparse Action and a callable instantiator
that can be used to deprecate options in favor of new ones.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
In an effort to standardize the way that a particular debugger or device
instance is identified when there are multiple present, introduce a new
-i/--dev-id option common to all runners that allows the user to specify
which device to interact with when there are multiple connected.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Debugging ESP32 SoCs is not possible if the commands
halt, target and load are enabled by default.
This MR allows this configs to be used as input parameters.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
The size percentage was doing "xx.xx%" so 100% would not be
aligned correctly when printed. So add a space for percentage
printing.
Also change the coloring of "(hidden)" node so it would not
have the same color as files or symbols.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
If --no-manifest is specified, '-e' is still being passed
to rimage to build the extended manifest. Fix this so
that when --no-manifest is specified, '-e' is no longer
passed to rimage.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
When CONFIG_USERSPACE is enabled, the ELF file from linker pass 1 is
used to create a hash table that identifies kernel objects by address.
We therefore can't allow the size of any object in the pass 2 ELF to
change in a way that would change those addresses, or we would create
a garbage hash table.
Simultaneously (and regardless of CONFIG_USERSPACE's value),
gen_handles.py must transform arrays of handles from their pass 1
values to their pass 2 values; see the file's docstring for more
details on that transformation.
The way this works is that gen_handles.py just pads out each pass 2
array so its length is the same as its pass 1 value. The padding value
is a repeated run of DEVICE_HANDLE_ENDS values. This value is the
terminator which we look for at runtime in places like
device_required_handles_get(), so there must be at least one, and we
error out in gen_handles.py if there's no room in the pass 2 array for
at least one such value. (If there is extra room, we just keep
inserting extra DEVICE_HANDLE_ENDS values to pad the array to its
original length.)
However, it is possible that a device has more direct dependencies in
the pass 2 handles array than its corresponding devicetree node had in
the pass 1 array. When this happens, users have no recourse, so that's
a potential showstopper.
To work around this possibility for now, add a new config option,
CONFIG_DEVICE_HANDLE_PADDING, whose value defaults to 0.
When nonzero, it is a count of padding handles that are inserted into
each device handles array. When gen_handles.py errors out due to lack
of room, its error message now tells the user how much to increase
CONFIG_DEVICE_HANDLE_PADDING by to work around the problem.
It looks like a real fix for this is to allocate kernel objects whose
addresses are required for hash tables in CONFIG_USERSPACE=y
configurations *before* the handle arrays. The handle arrays could
then be resized as needed in pass 2, which saves ROM by avoiding
unnecessary padding, and would avoid the need for
CONFIG_DEVICE_HANDLE_PADDING altogether.
However, this 'real fix' is not available and we are facing a deadline
to get a temporary solution in for Zephyr v2.7.0, so this is a good
enough workaround for now.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This reverts commit ec331c6fe2.
Although it's a valid simplification under the assumption that we're
going to be padding the array out anyway, it would use extra ROM if we
fix the build system issues that are currently forcing gen_handles.py
to introduce extra padding in the handles arrays for linker pass 2.
On the (perhaps optimistic) assumption that we're going to fix the
build system, let's get rid of a commit that would get in the way. The
extra "complexity" in device_required_handles_get() is trivial.
This gets rid of a comment describing the linker passes, but the
structure of the comment is a bit misleading (and it contains
incorrect information for the results of pass 2: the terminator at the
end is DEVICE_HANDLE_ENDS, not DEVICE_HANDLE_NULL).
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This reverts commit 0c6588ff47.
It's not clear that the supported devices are being properly computed,
so let's revert this for v2.7.0 until we've had more time to think
it through.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
If timeout error was occured during performing testsuite on QEMU or
other simulator (e.g. Renode), information about this error will be not
placed in final report. It can be fixed, by set status of testcases,
which were not performed due to this error as "BLOCK".
Simmilar solution is alredy used in DeviceHandler when Twister works
with real platform. So I think that it is resonable to use the same
approach, when tests are performed on simulators.
I move loop which iterate through all testcases and set their tests
status as BLOCK into the parent Handler class, because the same
activity is performed in each children class (BinaryHandler,
DeviceHandler and QEMUHandler).
Fixes#38756
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
When _app_smem region is empty, alignment is also needed. If there
is no alignment, the _app_smem_start used by arm mpu can be lower
than __rodata_region_end, and this two regions can overlap.
The Armv8-R aarch64 MPU does not allow overlapped regions.
Signed-off-by: Jaxson Han <jaxson.han@arm.com>
As per #38352, we would like to start building out PTP (IEEE 1588)
support for superset of gPTP functionality in Zephyr. This is the first
step to abstract away some key interfaces from NET_GPTP umbrella to
NET_L2_PTP.
Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
Fixes: #38924
When the `verify-toolchain.cmake` script fails, then twister will print
a standard message to the user regardless of the reason.
> E: Variable ZEPHYR_TOOLCHAIN_VARIANT is not defined
The `verify-toolchain.cmake` already prints detailed information
regarding the cause of the failure, so twister should just pass that
message as-is.
For example, the message that is provided by verify-toolchain.cmake
when Zephyr SDK 0.13.0 is installed but 0.13.1 is required looks like:
> CMake Error at cmake/verify-toolchain.cmake:75 (find_package):
> Could not find a configuration file for package "Zephyr-sdk" that is
> compatible with requested version "0.13.1".
>
> The following configuration files were considered but not accepted:
>
> /opt/zephyr-sdk-0.13.0/cmake/Zephyr-sdkConfig.cmake, version: 0.13.0
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add support for signing i.MX8QXP SOF with Zephyr images with rimage.
i.MX8QXP and i.MX8QM have the same board-level definitions,
so we use the generic imx8.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Fixes: #38463
With 6be1b2af9b then Zephyr shields and
soc Kconfig are always sourced from Kconfig directly.
However, check_compliance.py generates Kconfig files for sourcing the
same files thus sourcing the same files twice.
The end result is a lot of Kconfig warnings as described in #38463.
Removing the generated Kconfig files as this is no longer needed after
6be1b2af9b has been introduced.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Tests are reported as skipped if they are only being built. Fix this by
checking for the correct status.
Fixes#37475
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
In the case of native_posix (and other "host" toolchain based
platforms) Twister shouldn't filter tests by ZEPHYR_TOOLCHAIN_VARIANT.
The PR replaces `- zephyr` with `- host` in native_posix(_64).yaml
and modify the filter in twisterlib.py to not block building
if "host" is under the platform supported toolchains.
Fixes: #38418
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
When enable thread awareness feature for OpenOCD the search path was
converted to a list. In some environments OPENOCD_DEFAULT_PATH may
not be defined. That create an empty search path list system fails.
This add a test to skips fill search_args with openocd_search values
when list is empty.
Fixes#38272.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
For twister, when simulation is mdb-nsim, the platform is
nsim_hs_smp. Before the twister will call west falsh
when platform is nsim_hs_smp, because twister can't kill
cld process, now this problem has been fixed
Signed-off-by: Jingru Wang <jingru@synopsys.com>
New docs for cavs_v25 describe building a Linux kernel for a
Chromebook and need to talk about these kconfigs.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This script allows us to programmatically query bug-bashers within
a user-supplied time-window.
For example, we held a "Bug Bash Week" August 1-7, 2021 (it was
announced a week early though). The output of the script prints
the "top ten" bug bashers in tab-separated columns in descending
order. The first column is the number of bugs squashed and the
second column is the github user id.
Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
When run by a makefile twister might fail to decode the text results of
commands, based upon the environment settings of the system. With this
change escape characters are removed before the string is passed to the
json decoder.
Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
Node names are subject to the rules in table 2.1 of the devicetree
specification v0.3, while properties are subject to rules in table
2.2. These rules mean that some property names are invalid node names.
However, the same regular expression is being used to validate the
names of nodes and properties in dtlib. This leads to invalid node
names being allowed to pass. Fix this issue by moving the node name
handling code to the Node constructor and checking against the
characters in table 2.1.
The test cases claim that the existing behavior matches dtc. I can't
reproduce that. I get errors when I use invalid characters (like "?")
in a node name. For example:
foo.dts:3.8-11: ERROR (node_name_chars): /node?: Bad character '?' in
node name
Try to make the dtlib error message reminiscent of that.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This is unused since the very beginning of the module's introduction.
It looks like it was abandoned in favor of the approach where each
token can have only one capturing group.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Support for ARM Compiler C library.
This commit add support for the ARM Compiler C libary in:
- Kconfig
- libc/armstdc
A new Kconfig symbol is added to allow a toolchain to specify if they
support linking with the minimal C library.
Also the CMake variable `TOOLCHAIN_HAS_NEWLIB` is exported to Kconfig
so that CONFIG_NEWLIB_LIBS can only be enabled if the toolchain has
newlib.
The armclang toolchain selects the CMake scatter file generator and
disables support for the LD linker template which is not supported by
armlink.
For the ARM Compiler C library, a corresponding lib/libc/armstc/ folder
with a minimal implementation to work with the ARM Compiler C library
is added.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The current gen_handles.py script uses linker defined symbols.
As preparation for support of more linkers the gen_tables.py now takes
the device start symbol as argument.
For example, armlink and ld uses different symbols.
With ld those can be named explicitly, but for armlink the linker
decides the names.
For ld, Zephyr defines: __device_start
For armlink, the symbol is defined as: Image$$<section name>$$Base
Therefore knowledge of the linker symbol to be used must be passed to
gen_handles.py so that the correct symbol can be used for locating
devices.
To support this change, the creation of the asm, compiler, compiler-cpp,
linker targets has been moved from target_toolchain_flags.cmake to
target_toolchain.cmake.
All linkers has been updated to support the use of the
device_start_symbol on the linker target.
List of linkers updated:
- ld
- lld
- arcmwdt
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add support for signing i.MX SOF with Zephyr images with rimage.
Note that, for i.MX, we don't need a bootloader nor the .elf.mod files
since there is no need to change the VMA/LMA of each uncached section
to the equivalent address in the cached area of memory.
For the above reasons, I've updated the arguments given to "west sign"
command.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Add support for specifying a custom OpenOCD command to be used for
resetting and halting a target.
As noted in the OpenOCD documentation, not all targets support the
"reset halt" command for halt-on-reset.
Some targets support a software emulation via the "soft_reset_halt"
command. Other targets may require a custom command (e.g. a command
defined in the target configuration file).
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Zephyr thread awareness is available for openocd but boards don't
have debuggers configuration. This configure OpenOCD runner
automatically to complete configuration.
User still require enable CONFIG_DEBUG_THREAD_INFO=y to visualize
thread debug information.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Although they are marked as an inline functions, the compiler
may decide not to inline them which would result in them being
outside the pinned text section. Since these functions are
required for userspace to work correctly, pin them in physical
memory. This also applies to k_is_user_context().
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This allows memory partitions to be put into the pinned
section so they are available during boot. For example,
the stack guard (in libc partition) is needed during boot
but before the paging mechanism is initialized. Without
pinning it in physical memory, it would fault in early
boot process.
A new cmake property app_smem,pinned_partitions is
introduced so that additional partitions can be pinned
if needed.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Some targets require no 'halt' to be issued i the gdb server command.
Add a --no-halt option to make it possible.
Keep use of halt as the default case.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit introduces devicetree API in CMake so that devicetree
properties and register block can be used in the CMake build system.
The script scripts/dts/gen_dts_cmake.py processes the edt.pickle and
generates a corresponding devicetree property map in a devicetree_target
that is then used in CMake.
The following devicetree API has been made available in Zephyr CMake:
- dt_nodelabel(<var> NODELABEL <label>)
- dt_node_exists(<var> PATH <path>)
- dt_node_has_status(<var> PATH <path> STATUS <status>)
- dt_prop(<var> PATH <path> PROPERTY <prop>)
- dt_prop(<var> PATH <path> INDEX <idx> PROPERTY <prop>)
- dt_num_regs(<var> PATH <path>)
- dt_reg_addr(<var> PATH <path> [INDEX <idx>])
- dt_reg_size(<var> PATH <path> [INDEX <idx>])
- dt_has_chosen(<var> PROPERTY <prop>)
- dt_chosen(<var> PROPERTY <prop>)
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add supported device information to the device `handles` array. This
enables API's to iterate over supported devices for power management
purposes.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Force the inclusion of a `DEVICE_HANDLE_SEP` at the end of the
devicetree dependency section of the array. This lets us simplify the
implementation of `device_required_handles_get`, as there is only one
symbol the section ends with.
This does not use any extra ROM as the array is padded out to the
original size with `DEVICE_HANDLE_ENDS` anyway.
Also adds a description of the array format where the array is
instantiated.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Optimize the handles array by making the following observations:
* The devicetree ordinal at index 0 in pass1 is discarded by
gen_handles.py, and therefore does not appear in the pass2 array.
* gen_handles.py does not need `DEVICE_HANDLE_ENDS` to determine the
end of the handle array, as that information is present in the .elf.
Therefore, instead of replacing the devicetree ordinal with an
additional `DEVICE_HANDLE_ENDS` at the end (to preserve lengths), we
can simply move the ordinal to the end and have it be the original
`DEVICE_HANDLE_ENDS` symbol. This reduces the size of the array by
one handle per device (2 bytes).
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
We need to be able to access pinctrl-<index> property contents by
name, convert names to indexes, convert indexes to names, and perform
existence checks by name and by index.
This is currently not possible because we don't track these properties
the same way we do other named properties. That in turn is because
they are different then the usual named properties.
The usual case looks like this, picking DMAs just for the sake of
example:
dmas = <&dma0 ...>, <&dma1 ...>;
dma-names = "tx", "rx";
So "tx" is the name for the <&dma0 ...> element, and "rx" is the name
for the <&dma1 ...> element, all in a single "dmas" property.
By contrast, pinctrl properties look like this:
pinctrl-0 = <&foo &bar ...>;
pinctrl-1 = <&baz &blub ...>;
pinctrl-names = "default", "sleep";
Here, "default" is the name for the entire pinctrl-0 property.
Similarly, "sleep" is the name of the pinctrl-1 property. It's a
strange situation where the node itself is kind of a container for an
array of pin control properties, which Zephyr's bindings language
can't really capture and has some special case handling in edtlib.
This is easiest to handle with ad-hoc code. Add special case macros
for pinctrls.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Move the partition handling code into its own function and rework the
comment. This is prep work for adding additional generated macros to
this function.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This became useless when _init_tokens() was refactored not to use
global variables (in "dtlib: use IntEnum for token IDs"), and the
linter is complaining about it now.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Similarly to what was done for dtlib, use f-strings in places where it
improves readability. Some places, e.g. __repr__ methods that
construct a string using something like
"<SomeType, {}>".format(", ".join(...))
are better left off as-is.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The library was originally developed before Python 3.6 was the minimum
supported version. Use f-strings now that we can do that, as they tend
to be easier to read.
There are a few places where str.format() makes sense to preserve,
specifically where the same argument is used multiple times; leave
those alone.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
When using both test-only and retry-failed flags, all tests would be
added to the test queue regardless if they failed or not. This commit
updates the logic to process test-only runs similar as other runs,
by adding tests to the queue with the 'run' operation directly.
Signed-off-by: Andreas Vibeto <andreas.vibeto@nordicsemi.no>
Allowing multiple such files will let higher layers take inputs from
multiple DTS_ROOT directories. This in turn will allow out of tree
bindings to manage their own sets of prefixes without patching
upstream Zephyr's file or doing other similar hacks.
Parse each file into a dict, and merge those dicts into a single
dictionary for the EDT constructor.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
If the user passes None, set the internal attribute to an empty dict
instead. This lets us avoid some None checking and simplifies things
without changing semantics -- if the user *does* pass an empty dict,
the results are the same.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This is a common extension for YAML files. We don't have to allow it
in upstream zephyr, but we should allow downstream DTS_ROOTs to have
this ability.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add support for passing the --config argument to the openocd west runner
multiple times.
This allows for using modular openocd configuration files (e.g. CPU core
configuration in one file, independent of the selected JTAG interface
type).
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Commit c4079e4be2
("scripts: rework edtlib warnings-turned-errors") was trying to abort
on unknown vendor prefix, but the error log is not fatal.
Fix it by using the same error handling function we use when aborting
due to deprecated property usage.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
There are way too many one-off vendor prefixes set up for individual
boards to bother tracking them in vendor-prefixes.txt. As a practical
matter, the compatible for the root node doesn't matter anyway. So
just relax our check for that node.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
DT_PROP for a phandle property should return the node that phandle
points to (similar for DT_PROP_BY_IDX for phandles) and this wasn't
working as the define generator didn't create the proper defines for
phandle(s).
Fix the generator and add some tests to make sure this continues to
work correctly.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
I saw a user wondering what this is for and and where it comes from.
Provide a comment header with some explanation and a pointer to where
to find out more.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add some helper macros that work similarly to the
'DT_FOREACH_OKAY_INST_<compat>(fn)' macros, except they give 'fn'
node identifiers in their expansion instead of instance numbers.
This makes it possible to add for-each APIs to devicetree.h that work
on an arbitrary compatible, not just DT_DRV_COMPAT.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The filter_py() function is handed a bunch of file names and is
expected to give back just the python files.
Its input is the output from a 'git diff' command which normally when
used in the vanilla zephyr repository just prints regular files.
In situations where we're checking compliance on a repository with
submodules, however, filter_py() can be given directories in the
'fnames' list from the git output.
In the interests of being defensive and sharing infrastructure, just
handle this case in filter_py().
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Create a "global" gen_defines.py option and edtlib.EDT constructor
kwarg that turns edtlib-specific warnings into errors. This applies to
edtlib-specific warnings only. Warnings that are just dupes of dtc
warnings are not affected.
Use it from twister to increase DT testing coverage in upstream zephyr.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
An unknown vendor prefix is now a warning. We augment the list of
vendor prefixes passed by the user with a grandfathered-in bunch from
Linux.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Handle serial numbers provided from the command-line instead of forcing
the user to provide 'tool-opt' manually.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Current default serial port used for flashing is
/dev/ttyUSB0. This changes that to automatically detect the device
serial port or uses the one exported to the environment.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Extends memory footprint tracking to include echo_client and echo_server
networking samples on the frdm_k64f board.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Make correction on the terms "intput" appearing
in sciripts/pylib/twister/twisterlib.py to "input" for all.
This type of misspellings may cause another unnoticeable misspellings,
when propagated by code completions.
(assuming that the "intput" was intended
to have the opposite meaning of "output",
which also appear on the same areas)
Signed-off-by: Kentaro Sugimoto <tarotene@gmail.com>
This function takes a node label (not a label property) and returns
true if a node with such label exists and the node is enabled.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
When integration mode is on, any skips on integration_platforms are
treated as errors. This patch adds an exemption for quarantined tests.
They will stay as skipped.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
If "Cmake build failure" is detected test instance get status "error".
Despite this in final report this error is counted as failure. It can
be fix, by set proper results of each testcase in instance from None
to "BLOCK" after found Cmake error. After this fix, error is counted
properly in final report.
Fixes#37140
Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
XCC doesn't recognize GCC pragma to ignore -Warray-bounds. So #if
it out, or else XCC would complain about unknown option for all
syscall generated header files.
Fixes#36661
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Very simple script to diff between two ram or rom reports generated by
size_report. When you call call the ram_report or rom_report targets you
end up with a json file in the build directory that can be used as input
for this script.
The output shows which symbols insreased and which decreased in size and
also tracked added/remove symbols as well.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The parser module name collides with builtin parser module in python.
This seems to break the import in windows.
Signed-off-by: Elliot Revell-Nash <elliot.revell-nash@wdtl.com>
So far only upstream boards were listed. Use just introduced
zephyr_module.parse_modules() function to get information about
out-of-tree board roots. Append them to user provided args.board_roots,
so out-of-tree boards from west modules are listed as well.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Add parse_modules() function, which will offload most of the work in
main() and additionally allow external Python code to use that function.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
To be able to get a tokenize DT string without the quotes. Deprecate
also DT_ENUM_TOKEN and DT_ENUM_UPPER_TOKEN.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
As a first step towards being more forgiving on invalid inputs, allow
string-valued aliases properties that do not point to valid nodes when
the user requests permissiveness.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Modeled after dtc's --force option, the idea is this will try harder
and harder over time to produce an object despite malformed input.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
`_FOREACH_` macros do not allow the caller to pass additional arguments
to the `fn`. A series of `_VARGS` variants have been added that allow
the caller to pass arbitrary number of arguments to the `fn`:
```
DT_FOREACH_CHILD_VARGS
DT_FOREACH_CHILD_STATUS_OKAY_VARGS
DT_FOREACH_PROP_ELEM_VARGS
DT_INST_FOREACH_CHILD_VARGS
DT_INST_FOREACH_STATUS_OKAY_VARGS
DT_INST_FOREACH_PROP_ELEM_VARGS
```
Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
by adding the soc specific files such: soc initialization code,
linker scripts and support for esp32c3 devkitm
Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
The ARConnect Inter-core Debug Unit (ICD) provides
additional debug assist features in multi-core scenarios.
In master core(core 0) initial stage, we will program ICD to halt
all other cores based on a halt occurring in one ore more core.
And all cores are in halt mode on reset, so we need to make
sure other slave cores have launched and in running mode
before we enable ICD in master core.
Currently we launch master first, Let's reverse the launch
order, launch master last, to make sure slave cores have
launched before we program and enable ICD.
Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
Take the int-pin information (i.e. what pin between INT1
and INT2 the drdy is attached to) directly from DT.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Remove includes from the tag file. If we have a change to an include
that implies some API change which may show up somewhere else so we
want to build as many tests/samples as possible in that case.
Also added a comment about keeing entries sorted alphabetically.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
In dt_label_with_parent_compat_enabled, it maybe that there is
no node matching expected label.
In this case don't generate error, but return False.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
The parser module collides with a module in python called parser.
Doesn't seem to be a problem in Linux but for some reason the
search/include order in Windows causes python to import the wrong
parser. The change is to rename the module to dictionary_parser
to avoid the name space collision.
fixes: #36339
Signed-off-by: David Leach <david.leach@nxp.com>
sometimes ninja fails to launch qemu, the sub-thread
can't read anything from qemu pipeline, then the
corresponding testcase will timeout. Then the
sub-thread will get blocked if it call join()
set terminate as the Handler's method, then
Handler's children class can call it
Signed-off-by: Jingru Wang <jingru@synopsys.com>
Function used for filtering "dt_compat_enabled_with_label" was not
working as expected as it was not taking into account that we're
looking for a children/parent combination:
Provided "compat" with enabled status should be the one of the parent
of the node matching given label.
Function is then reworked to take this into account.
And to make it's usage clear:
- function name is changed to be clearer on the intention
- args order is reversed to be more logical wrt the intention
Users of the function are also updated to take the change into
account.
Fixes#36093
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
We were testing modified_tags.args before we called get_twister_opt.py
so it would never have been created and thus twister_exclude_tag_opt
would never get set correctly. Move the check to after we call
get_twister_opt.py
Also we need to remove modified_tags.args once we are done with it.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This means a light requirements-doc.txt is enough for doc writers. See
previous discussions in PR #31199 and PR #31239
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
So when for instance adding some `import wrong_module` line to a sample
runner like bossac.py this adds the text between parentheses ( ) below:
The module for runner "bossac" could not be imported (No module named
'wrong_module'). This most likely means it is not handling its
dependencies properly. Please report this to the zephyr developers.
Test tip: changes to bossac.py do not trigger a fast, incremental doc
build. touch doc/guides/west/build-flash-debug.rst does it instead.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Add the ability to map file/dir paths of a PR to twister TAG. We
introduce scripts/ci/tags.yaml to conveys which files are associated
with which tag.
Since not all file/tags will be specified in tags.yaml we use the
combination of the files modified list and the tags.yaml information to
determine which tags can be excluded (ie if the file list doesn't match
any file in tags.yaml for a given tag listed there, we can that exclude
it).
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
I made an alignment error in a dts binding, but the build was
successful. After some debugging I found the following warning
explaining the problem:
'/home/casper/src/zephyrproject/zephyr/dts/bindings/gpio/
gpio-keys.yaml' appears in binding directories but isn't valid
YAML: while parsing a block mapping
in "<unicode string>", line 11, column 8
did not find expected key
in "<unicode string>", line 18, column 9
I think this should be an error as there shouldn't be any invalid yaml.
Signed-off-by: Casper Meijn <casper@meijn.net>
Allow the use of build configurations from testcase/sample yaml files.
This addition makes it easy to build a sample or a test with the options
provided in the test file by pointing to the test section to be built on
the command line of `west build`.
Fixes#31993
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Out-of-tree boards directory is likely to have boards within subset of
architectures (e.g. only 'arm' boards) that are supported by Zephyr.
Currently script iterates over all architectures and tries to list
contents of boards/<arch>/, which might not be existing. This results in
'FileNotFoundError' exception:
Traceback (most recent call last):
File "/project/zephyr/scripts/list_boards.py", line 113, in <module>
dump_boards(find_arch2boards(parse_args()))
File "/project/zephyr/scripts/list_boards.py", line 32, in \
find_arch2boards
arch2board_set = find_arch2board_set(args)
File "/project/zephyr/scripts/list_boards.py", line 45, in \
find_arch2board_set
for arch, boards in find_arch2board_set_in(root, arches).items():
File "/project/zephyr/scripts/list_boards.py", line 78, in \
find_arch2board_set_in
for maybe_board in (boards / arch).iterdir():
File "/usr/lib/python3.9/pathlib.py", line 1149, in iterdir
for name in self._accessor.listdir(self):
FileNotFoundError: [Errno 2] No such file or directory: \
'/project/app/boards/arc'
Simply ignore missing boards/<arch>/ directories and skip to the next
arch.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
We now get toolchain from cmake and can operate even if the toolchain
variant is not set in the envrionment, this test was verifying the old
behavior, so remove. There is not much twister related here to test and
the environment is not setup correctly to run all of this cmake code. We
are testing twister after all.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Treat all test_file_* files the same and just explicitly set the header
in the final test_file.txt. This makes the logic the same regardless of
what paths tests are coming from.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
If the local option (-l) was specified we were ignoring the results
of what_changed.py and always setting a "FULL" build. Only explicitly
set a FULL run if we are building for a commit to the tree (local and
PR builds should respect the output of what_changed.py).
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Since we use 'main' now, rename the example comment usage to use
that branch name instead of 'master'.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Recent versions of mypy have learned that the yaml module has type
stubs and the tool is now erroring out when it discovers we import
yaml since the stubs are not involved.
This is breaking CI on unrelated patches; fix it following the
instructions here:
https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Compilers and static code analyzers do not understand Zephyr's
syscall mechanism so they always complain about out of bound
array access inside the generated syscall header functions.
So add a flag for GCC to ignore this type of warning for these
functions.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Coverity does not understand syscall mechanism and will already
complain when any function argument is not of exact size as
uintptr_t. So tell Coverity to ignore this particular rule here.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Following master branch renaming to "main", update this script
to use $remote/main as base comparison branch
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Add a tree node to group files under WORKSPACE so that
they won't be shown with full path. The WORKSPACE is
usually the same as WEST_TOPDIR unless ZEPHYR_WORKSPACE
is defined during build.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The list of symbols only contain visible symbols that can be
obtained through ELF file. There are code and data where
the toolchain never emits symbols for them and thus are not
visible in the list. So add a "(hidden)" node to the tree
to show they are there.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This changes how the tree is generated. Symbols with no paths
are now grouped together instead of scattering throughout
the tree. If paths in ELF file are not all under ZEPHYR_BASE,
it will create additional node groups as 2nd level. This is
useful when not all source files are under ZEPHYR_BASE, and
provides a better indications of where they are.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This changes how paths are stored in intermediate structures
so that full paths are stored. This makes it more consistent
with those structures to avoid an issue where some paths are
full paths, some are relateive to ZEPHYR_BASE.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds some common C++ file extensions so the script
can recognize those as source file, and display them in
different color.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This fixes the issues on import statements identified by pylint.
Also add docstrings for method and classes. Most of them are
already there as comments, so simply move them as docstrings.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Add compatibility mode with old sam-ba flash bootloaders that don't have
offset capabilities. These bootloaders flash to a pre-defined flash
region. At end, bossac will suppress --offset parameter.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Error out on compatible properties with invalid values. The regular
expression used to validate them matches what's used in dt-schema.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Sphinx handling of 404 page is not that easy when using theme
customizations. Enabled the `sphinx-notfound-page` extension (maintained
by readthedocs) to fix its displaying.
Also adjusted Zephyr logo (was causing some Sphinx processing errors
when trying to scale it).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
We are in the process of changing the HEAD branch in the zephyr
repository from 'master' to 'main'. Users will need west version at
least 0.10.1 for the plain 'west init' line in the getting started
guide to still work after that change.
To avoid problems:
- add -U to the macOS and Windows lines for installing west (this
option is already there for Ubuntu). Upgrading west will make
the guide 'just work' for users who have an old version.
- bump the minimum version in the relevant requirements file,
in case anybody is doing something like basing a CI setup
on those versions.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
when generating a new map, set the status of the device and whether it
is connected or now. The available key is runtime only and is not part
of the map anymore.
Adapt documentation and remove available as a key in the generated map.
Fixes#35341
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a very simple check that verifies that new error numbers are added
according to the errno.h file in newlib, in order to maintain
compatibility with it.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fixes compatibility with the Arduino bootloader reset mechanism when
using `west flash` on Darwin hosts.
stty is used to set the serial port in the bossac runner to 1200 baud on
Arduino ATSAMD21 bootloaders. The `-F` argument to stty is a GNU
coreutils addition, and thus it is missing from Darwin's BSD stty, so
change the flag to `-f` when we're not running on Linux.
On Darwin, set DEFAULT_BOSSAC_PORT to None and ask the user to select
one from a list of IOCalloutDevices reported by ioreg, modelled on the
get_board_snr from the nrfjprog runner. This is because serial port TTYs
are generated by the device driver, and therefore there is no safe
default.
Tested with an Arduino Nano 33 IoT board.
Signed-off-by: George White <me@galexite.uk>
On ARC some platforms utilize ICCM/DCCM for their "flash" and "ram"
storage. So we might get errors about overflowing one of these regions.
So treat them similar to how we treat FLASH and SRAM.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Remove this intrusive tracing feature in favor of the new object tracing
using the main tracing feature in zephyr. See #33603 for the new tracing
coverage for all objects.
This will allow for support in more tools and less reliance on GDB for
tracing objects.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Fix bug where if `CONFIG_BOOTLOADER_MCUBOOT` is set sign.py incorrectly
shows warning `CONFIG_BOOTLOADER_MCUBOOT is not set to y...`.
Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
Added SAMPLE_MODULE_LOG_LEVEL_DBG as an exception. Define is used
in the log_api test suite.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Extend the steps taken in tox.ini by type checking the 'devicetree'
package. This will make it easier for callers to type-check code that
uses the low level DT module's public APIs, since they can rely on
the type checker a bit more.
It will also help avoid bugs by adding some type checking for future
changes to this module.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Mypy is complaining about this line for some reason I didn't have time
to figure out. Just shut it up for now; I'll look into this when I get
around to type annotating edtlib.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Now that all the other code it depends on is annotated, we can finish
up the type annotation of this module in the main DT class.
It's not worth it to try to annotate the private methods (the ones
that begin with '_'). Most of these are low level lexing helpers that
aren't particularly amenable to static type checking, because the type
of a token's value is often dependent on the token ID in ways that
static type annotations are not well equipped to capture.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
We'd like users of this API to know that DT.root is always a Node,
and not an Optional[Node].
However, although DT.__init__ throws an exception if the resulting DT
object would have no root node, static analysis can't tell that since
the root instance attribute starts out as None during initialization,
so checkers like mypy are convinced it's Optional[Node].
Since this is really OK, we'll quiet the type checker down by stashing
the instance attribute in self._root instead, and providing a root
property accessor that is annotated to return Node instead of
Optional[Node]. We can tell mypy to ignore what looks like a potential
None here to allow callers to treat the result as a Node.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The documentation says DT.__init__ takes any iterable for the
include_path, but this leads to bad results when you pass it something
other than a 'real' sequence (list/tuple/etc), like a generator:
>>> dt = DT('/tmp/foo.dts', (x for x in ['a', 'b', 'c']))
>>> repr(dt)
"DT(filename='/tmp/foo.dts', include_path=<generator object ...>)"
Make a copy in list form just to avoid things like this.
Add a test for this and relax the regular expression in the existing
test case related to this.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Some of these are also tripping up a python 2 / python 3 warning
in mypy in the way that '{}'.format(b'foo') works, which we silence by
explicitly requesting the python 3 behavior.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The way that _init_tokens() is manipulating globals() defeats static
analyses of the file that are trying to infer a type for the 'tok_id'
variable in assignment expressions like 'tok_id = _T_INCLUDE'.
To make it easier on the analyser, define the token types as an
enum.IntEnum named _T. This means we can write e.g. '_T.INCLUDE'
instead of '_T_INCLUDE', avoiding line length increases in the lexing
code.
While we're here, use '==' and '!=' instead of 'is' and 'is not'
when comparing a tok_id that is obtained from an re.Match.lastindex
with a _T.FOO value.
This is now necessary since an int object and a _T object definitely
don't point to the same memory. It worked previously because CPython
interns all integer instances from -5 to 256, but that's an
implementation detail and not a language feature. Since we're getting
the ints from an re.Match.lastindex instead of putting the exact
_T_FOO values into some list, this code probably should not strictly
speaking have been using 'is'.
Explicitly initialize the global _token_re also, to make it more
visible for static analysis.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Continue annotating the module. In some cases mypy will miss that
_err() calls means the function will not return, so we return an
unnecessary local variable to appease it.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add a _MarkerType enum. A subsequent commit will use it for type
annotations in the Property class.
Fix an incorrect type in a comment while we're here.
We continue to use 'marker_type is _MarkerType.FOO' instead of
'marker_type == _MarkerType.FOO' because we are adding those actual
_MarkerType.FOO objects to each property, so 'is' comparison
is legitimate.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
A step along the way towards typing the whole module.
Fix an incorrect (or at best misleading) comment while we're here,
which was noticed by the type checker when I originally annotated
'props' as a Dict[str, bytes].
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Marking this NoReturn helps the type checker figure out that functions
which call it are only returning valid values or failing to
return. (It unfortunately doesn't always work as mypy's control flow
analysis seems to treat a direct 'raise DTError(...)' differently than
calling _err() in some situations, but it helps.)
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Move the DTError, Node, Type, and Property definitions to the top.
This way, class definitions occur before methods which use those
classes. This will be useful to avoid string literals in type
annotations that will be added later. Some can't be avoided due to
circular dependencies, but this will help.
Adjust whitespace.
No functional changes expected.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This adds support to generate SPDX 2.2 tag-value documents via the
new west spdx command. The CMake file-based APIs are leveraged to
create relationships from source files to the corresponding
generated build files. SPDX-License-Identifier comments in source
files are scanned and filled into the SPDX documents.
Before `west build` is run, a specific file must be created in the
build directory so that the CMake API reply will run. This can be
done by running:
west spdx --init -d BUILD_DIR
After `west build` is run, SPDX generation is then activated by
calling `west spdx`; currently this requires passing the build
directory as a parameter again:
west spdx -d BUILD_DIR
This will generate three SPDX documents in `BUILD_DIR/spdx/`:
1) `app.spdx`: This contains the bill-of-materials for the
application source files used for the build.
2) `zephyr.spdx`: This contains the bill-of-materials for the
specific Zephyr source code files that are used for the build.
3) `build.spdx`: This contains the bill-of-materials for the built
output files.
Each file in the bill-of-materials is scanned, so that its hashes
(SHA256 and SHA1) can be recorded, along with any detected licenses
if an `SPDX-License-Identifier` appears in the file.
SPDX Relationships are created to indicate dependencies between
CMake build targets; build targets that are linked together; and
source files that are compiled to generate the built library files.
`west spdx` can be called with optional parameters for further
configuration:
* `-n PREFIX`: specifies a prefix for the Document Namespaces that
will be included in the generated SPDX documents. See SPDX spec 2.2
section 2.5 at
https://spdx.github.io/spdx-spec/2-document-creation-information/.
If -n is omitted, a default namespace will be generated according
to the default format described in section 2.5 using a random UUID.
* `-s SPDX_DIR`: specifies an alternate directory where the SPDX
documents should be written. If not specified, they will be saved
in `BUILD_DIR/spdx/`.
* `--analyze-includes`: in addition to recording the compiled
source code files (e.g. `.c`, `.S`) in the bills-of-materials, if
this flag is specified, `west spdx` will attempt to determine the
specific header files that are included for each `.c` file. This
will take longer, as it performs a dry run using the C compiler
for each `.c` file (using the same arguments that were passed to it
for the actual build).
* `--include-sdk`: if `--analyze-includes` is used, then adding
`--include-sdk` will create a fourth SPDX document, `sdk.spdx`,
which will list any header files included from the SDK.
Signed-off-by: Steve Winslow <steve@swinslow.net>
Since Pygments 2.7.0 devicetree syntax is supported, so there is no need
to use a custom lexer. Version 2.9.0 introduces a fix that is required
for some devicetree snippets.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
1. Add a class of Pytest(Harness) which can handle pytest script
in harness.py
2. Use running_dir to store current test directory which be
used in pytest scrpt.
3. Add usage of this feature into zephyr doc.
Signed-off-by: YouhuaX Zhu <youhuax.zhu@intel.com>
Support this when debugging also.
Tweak the style for brevity also while we're here by propertizing the
supports_nogui method, etc.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This makes it easier for runners to check if the binary has thread
info support turned on, allowing automatic configuration of the
underlying tool to support threads, if possible.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Set options that are definitely true or false to True or False in the
options dict. Add a 'getboolean' method that also allows a fallback to
False in case the option is not mentioned in .config due to unmet
dependencies. This allows calling code to just ask about the option
they are interested in, even if the .config file doesn't mention the
option at all.
Propagate this to users within the runners package and 'west sign',
taking advantage of the new build_conf property.
Rename the 'bcfg' internal variable in sign.py to 'build_conf' to
match other source files that use BuildConfiguration instances, to
make it easier to grep for users.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Instead of mocking out the BuildConfiguration class, just create its
input file and let the real class do the work.
This in turn exposes a bug in the way the board name is being pulled
out of the BuildConfiguration, which we fix to keep the tests passing.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This is really verbose, and I doubt anyone cares unless there is a
problem. Keep it around when run as 'west -v flash' to allow for
debugging, though.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Defer loading .config until we really need it, when we are flashing a
binary. Pre-emptively loading it is wasted effort if we're flashing a
.hex, which has been the default behavior when possible since
dcaabb860f ("west: runners: jlink: prefer .hex over .bin").
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Put it all in one log message rather than splitting it up.
This makes it look cleaner now that each log message is prefixed with
'runners.link:'.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
JLink versions like 'V7.0a' do not conform to PEP 440 version
conventions; the 'a' part is used by PEP 440 compliant versions for
alphas. It gets parsed to a legacy type by the packaging library,
which always is treated as a lower value when compared with a
conforming version string.
To fix, get the version from the shared library distributed with the
JLink tools. This has the side benefit of making the code work on
Windows. That's merely a nice to have for -nogui 1 detection for now,
but will be essential in the next commit.
Reported-by: Jake Mercer <jake.mercer@civica.co.uk>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This will be used to deal with the Segger shared library in a portable
way in the jlink runner.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Make it easier to get a BuildConfiguration from runner code.
Stash the result so it only has to be computed once.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This option has existed since the beginning of the runners package,
which greatly predates the way DT is used in zephyr right now. It
never really worked the way I wanted it to but it's too much work to
fix it now. Try to improve the help a bit at least while I'm looking
at it again.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Copy a fix from test_nrfjprog.py to the other runner test suites. The
current code will enter an infinite recursion if you hit the path
where os.path.isfile is called, since it's been patched to
os_path_isfile_patch in the calling context. The fix is to cache the
'real' version in the parent scope and call it directly as a fallback.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Initialize `handle.device` to `None` so that the assert after the
matching has a chance to catch errors. Without this, a failed match will
raise an exception on the line above as it attempts to get a property
that doesn't exist.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This adds dictionary based logging support. Dictionary based
logging is binary based where one big difference is that
static strings are stored as pointers instead of the whole
string. This results in reduced space requirements for
storing log messages in certain scenairos.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Breathe project has released version 4.29.1, a fix release for the
issues found in 4.29.0. Relax version requirements by just skipping the
buggy version and staying to compatible releases.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Due to the use of gperf to generate hash table for kobjects,
the addresses of these kobjects cannot change during the last
few phases of linking (especially between zephyr_prebuilt.elf
and zephyr.elf). Because of this, the gperf generated data
needs to be placed at the end of memory to avoid pushing symbols
around in memory. This prevents moving these generated blocks
to earlier sections, for example, pinned data section needed
for demand paging. So create placeholders for use in
intermediate linking to reserve space for these generated blocks.
Due to uncertainty on the size of these blocks, more space is
being reserved which could result in wasted space. Though, this
retains the use of hash table for faster lookup.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
There is no need to specify linker section for variables in
the output. The compiled object file from the produced
source file will be further processed to have them renamed
anyway.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
It's easier and safer to parse json file rather than extract
total size from stdout
Now the .json file has two keys:
{
"symbols": {
"children": [
...
],
"identifier": ":",
"name": "root",
"size": 2220
},
"total_size": 34272
}
Signed-off-by: Jingru Wang <jingru@synopsys.com>
Do calculation based on what is actually going to be run and evaluated
at runtime, ignore the cases we already know going to be skipped.
This fixes an issue where some sets would get majority of skips and
basically run nothing beside filtering.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
All skips for platforms listed in the .yaml's integration_platforms
will be treated as errors in the integration mode ('-G/--integration').
This feature serves to guarantee a proper testing scope in CI as no
integration platform will be skipped silently.
Fixes#33874
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
It can be convenient to "iterate" over the elements of a property, in
the same way it is convenient to "iterate" over enabled instances.
Add a new macro for doing this, along with a DT_INST_FOREACH_PROP_ELEM
variant.
This is likely to be more convenient than UTIL_LISTIFY or FOR_EACH in
some situations because:
- it handles inputs of any length
- compiler error messages will be shorter and more self-contained
- it is easier to use with phandle-array type properties, which
require more complicated macro boilerplate when used with
util_macro.h APIs
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
We already have support for handling the Zephyr binding "path" type in
edtlib.Node._prop_val(), but the binding inference code isn't making
use of that. Handle this type as well, as it is just as convenient as
Type.PHANDLE and can be more idiomatic depending on the situation.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Instead of hard-coding constants, use an IntEnum.
These is still a subclass of 'int', but is both easier to import and
easier to read during debugging.
For example, compare:
>>> Type.BYTES
<Type.BYTES: 1>
with:
>>> TYPE_BYTES
1
However, 'Type.BYTES == 1' is still True, and the enum values
otherwise behave like you would expect.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add the ability to define architecture specific structures, notably
the ability to extend struct _cpu with per-CPU arch-specific stuff that
can be accessed with _current_cpu->arch.* similarly to _current->arch.*
for per-thead architecture data.
This is opt-in for architectures that want to benefit from this,
otherwise empty defaults are provided. A placeholder for ARM64 is
included to show the pattern.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Today, there is a build target is added for each runner: flash, debug,
debugserver, attach.
And those runners will have a dependency to Zephyr logical target that
is built before invoking `west <runner>`.
This design has some flaws, mainly that additional dependencies directly
on the target will not be built when running `west <runner>` directly.
That generator expressions cannot be used for the DEPENDS argument.
Instead, the build target `<runner>` will not have any dependencies, and
will raise a build error if a dependency is added to the target.
Due to how `add_dependencies()` work, this must be done as a build time
check, and not configure time check.
`west <runner>` will invoke a build before executing the runner, and
this way ensure the build target is up-to-date, which again removes the
need for a dedicated `west_<runner>_target`.
It also minimizes the risk of developer errors, as developers no longer
need to consider the need for adding additional dependencies.
If a custom target is part of the default `all` build, then it's ensured
to be up-to-date.
Fixes: Issue reported on slack.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
With the previous logic memory footprint can only be saved in a report
if a given test/sample was fully executed and passed (built and run),
hence build-only tests were not providing these metrics. This commit
modifies the logic so that it is enough to have the build successful
to be able to get the memory footprint.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
The info of rom/ram usage by an application was lost along the
way of data processing in twister. The commit add a line which
pass further these metrices as well.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
With the addition of #34185, it is not longer gauranteed that for a
memory region `NAME` there exists a symbol `NAME_ADDR`. Use the linker
builtin function `ORIGIN` to instead directly get the start address of
the selected memory region.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Removing CONFIG_TRACING_CPU_STATS in favor of
CONFIG_THREAD_RUNTIME_STATS which provides per thread stats. The same
functionality is also available when Thread analyzer is enabled with the
runtime stats enabled.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Upon discovery of a sample/testcase.yaml file, twister will disregard
further subfolders. Given the folder structure below, the testcase.yaml
will currently not be discovered:
samples/sample1/
samples/sample1/sample.yaml
samples/sample1/tests/
samples/sample1/tests/testcase.yaml
This is desirable to allow placing test code closer to sample code.
Signed-off-by: Jorgen Kvalvaag <jorgen.kvalvaag@nordicsemi.no>
The commit coccinelle/coccinelle@47bd4cae52 changed a behavior of
parsing right before coccinelle v1.1.0. With the commit, the current
scripts under scripts/coccinelle/ errors out with:
minus: parse error:
File ".../zephyr/scripts/coccinelle/deref_null.cocci",
line 25, column 42, charpos = 666
around = '...',
whole content = (E != NULL && ...) ? <+...E->f@p1...+> : ...
I've already raised an issue upstream coccinelle/coccinelle#257. But
Debian is already shipping v1.1.0 and we need a fix.
The proposed fix doesn't change the semantics, it just explicitly
states that the rule is an expression.
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
The script already accepts a depth parameter to configure the output,
but that parameter was not used at all. This commit adds the correct
handling by passing it to anytrees RenderTree iterator.
Signed-off-by: Detlev Zundel <dzu@member.fsf.org>
Add arm fvp emulator in order to use ninja run or west build -t run.
Add armfvp in order to run twister.
Set env ARMFVP_BIN_PATH before using it,
e.g. export ARMFVP_BIN_PATH=<path/to/fvp/dir>
NOTE: ARMFVP_BIN_PATH is the dir path.
Signed-off-by: Jaxson Han <jaxson.han@arm.com>
When printing the unassigned values the 'sym' variable is
used as a dict from which we try to get the 'name' value.
However, 'symbols['unassigned']' gives a list of keys, so
we get an 'TypeError' when trying to access ['name'] of
a string (the key).
Fix this issue by iterating over the values from
the 'symbols['unassigned']' dict instead.
Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
Adds feature allowing to use yaml file with dictionaries defining
tests to be quarantined (extra arg "--quarantine-list FILENAME").
The dictionaries are validated according to the proper schema
and loaded.
A flat list is created containing quarantined configurations
(configuration = platform + scenario). Configurations under quarantine
are skipped and get "Quarantine" as a reason in the results reports.
A "comment" can be added to a quarantine entry in the quarantine yaml
with more details (e.g. issue #) and it will be also added to
the report.
The status of tests under quarantine can be verify if
`--quarantine-verify` is used in addition to
"--quarantine-list FILENAME". Using these args will make twister skip
all tests which are not on the quarantine list.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
In CI we typically build for "default" platforms. However some
testcases that set "platform_allow" may have no overlap with the default
platforms and thus thoses testcases will not get built.
Change the platform selection logic in these cases to set the platforms
to the list of allowed platforms ("platform_allow") in the testcase.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The commit fixes problem with nrfjprog runner for west flash,
that has been introduced with latest changes to BuildConfiguration
class.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The ImgtoolSigner.sign() is passed a BuildConfiguration object instance
that holds all of Kconfig options that have been defined for a build;
yet it has been reading the .config file once again, with the
load_dot_config, to check some of these options.
The commit replaces the code that has been using the load_dot_config
obtained data with the code that uses the BuildConfiguration object.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The body of load_dot_config method has been reimplemented in
BuildConfiguration.get(), replacing the previous code.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The BuildConfiguration.path attribute has been added that stores path
to .config file which has been used as source for options collected to
BuildCOnfiguration object.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
docutils is a core dependency of Sphinx. It is only used by some of our
custom Sphinx extensions.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Add the nanopb library and generator tools as a module.
Nanopb is a small code-size Protocol Buffers implementation in ansi C.
It is especially suitable for use in microcontrollers,
but fits any memory restricted system.
Nanopb home: https://jpa.kapsi.fi/nanopb/
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This scripts receives the same parameter of what_changed.py. And run
coccinelle scripts for code guideline compliance in the given git
commits. e.g: ./guideline_check.py --commits origin/master..HEAD
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This coccinelle script can check some violations for rule 21.2.
Currently it is checking the follow reserved names:
"remove", "rewind", "malloc", "free", "exp", "signal"
It can easily be extended in the future though.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Rebnase
This coccinelle script can check some violations for rule 5.7.
It can identify things like:
struct device *device
But it is not capable to identify:
struct test { ... }
...
int test;
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Allow versions starting from 0.5.2 up to < 1.0, be the next major
releases. Major releases tend to include breaking changes, so better
restrict such releases until they are manually tested for potential
regressions.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
We have recently been hit by an issue between docutils and
sphinx_rtd_theme. The problem is fixed since release 0.5.2. In order to
avoid similar problems in the future, pin the theme version.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Add the ability to filter which properties get imported when we do an
include. We add a new YAML form for this:
include:
- name: other.yaml
property-blocklist:
- prop-to-block
or
include:
- name: other.yaml
property-allowlist:
- prop-to-allow
These lists can intermix simple file names with maps, like:
include:
- foo.yaml
- name: bar.yaml
property-allowlist:
- prop-to-allow
And you can filter from child bindings like this:
include:
- name: bar.yaml
child-binding:
property-allowlist:
- child-prop-to-allow
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Replace current filter setup with the warnings_filter Sphinx extension.
Note that current regexes have been simplified to make them more
readable while keeping the most relevant information.
Sphinx warnings are now treated as errors (-W).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Fixes: #33212
Upstream PR: https://github.com/ulfalizer/Kconfiglib/pull/103
Ignoring when user inputs NULL in a text field.
menuconfig exits with a python stack trace if NULL is provided as input
character, therefore ignore NULL as an input character to prevent this
behaviour.
A NULL character may be given accidentally by the user through the
following ways:
- Pressing `Win` key on keyboard (Windows only)
- Pressing `<CTRL>-@` / `<CTRL>-2`.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
PR #33746 introduced changes to the devicetree python file
that requires changes in the python code that imports the
devicetree module.
This was omitted in the west sign command implementation.
Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@prevas.dk>
We are now in the process of extracting edtlib and dtlib into a
standalone source code library that we intend to share with other
projects.
Links related to the work making this standalone:
https://pypi.org/project/devicetree/https://python-devicetree.readthedocs.io/en/latest/https://github.com/zephyrproject-rtos/python-devicetree
This standalone repo includes the same features as what we have in
Zephyr, but in its own 'devicetree' python package with PyPI
integration, etc.
To avoid making this a hard fork, move the code that's being made
standalone around in Zephyr into a new scripts/dts/python-devicetree
subdirectory, and handle the package and sys.path changes in the
various places in the tree that use it.
From now on, it will be possible to update the standalone repository
by just recursively copying scripts/dts/python-devicetree's contents
into it and committing the results.
This is an interim step; do NOT 'pip install devicetree' yet.
The code in the zephyr repository is still the canonical location.
(In the long term, people will get the devicetree package from PyPI
just like they do the 'yaml' package today, but that won't happen for
the foreseeable future.)
This commit is purely intended to avoid a hard fork for the standalone
code, and no functional changes besides the package structure and
location of the code itself are expected.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Remove dead code from twisterlib.py which is a copy of code
from twister script. This redundancy causes pylint errors in
compliance checks.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
The jlink runner performs a version check which is skipped on
Windows. If running inside WSL we also need to skip.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Allow a custom (remote) gdb host passed as a debug argument
which tries to connect to an existing one instead of creating one.
This also allows to run the gdb server outside of a WSL
in Windows and the debugger inside of the WSL environment.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
checkpatch requires a Makefile to be present at the top-level directory.
Remove this requirement.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Whenever a child-binding: dict has a compatible, we ought to make
that available in EDT._compat2binding. If we don't, we can't look it
up later.
This has adverse effects like missing child bindings which describe
buses.
Fixes: #32071
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Currently the python script is assuming we only have objects on 32-bit
addresses. This is obviously wrong for 64-bit platforms. Fix this.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
The nrfjprog utility is not capable of flashing a hex file which
affects the flash memories of both coprocessors of the nRF53 family of
SoCs.
However, the user is capable of creating such a hex file using the
HEX_FILES_TO_MERGE build system variable.
An example use case is to build a bluetooth controller application for
the network core, then use the zephyr.hex file in that build directory
as the HEX_FILES_TO_MERGE argument for a separate Bluetooth
application build targeting the app core.
Work around this by detecting the situation and doing the right thing
by splitting the hex file back up again, even if thats a bit awkward.
Splitting the hex into app and network core components allows them to
be flashed separately. This is the only way we can get the job done
with nrfjprog.
This is arguably nicer since there's just one 'west flash' invocation.
At least in the use case named above, you wouldn't need to rebuild the
controller application very often, so this is a simpler user workflow.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The exported structures that were originally introduced for OpenOCD have
since then been reused for other debugger plugins, including PyOCD and
Segger J-Link.
Rename the Kconfig option and the implementation from openocd to debug
thread info, so that it reflects the fact that this is no longer
specifically tied to OpenOCD.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The function `handle()` from class `Test(Harness)` had most of its
code being the direct copy of the code from
`Harness.process_test(line)`. This patch replaces the copied code
with the call for `process_test(line)` and removes repetition of
this function call.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
We need all available runners to be defined as subclasses of
runners.core.ZephyrBinaryRunner in order to be able to look them up by
name at runtime. We do this by importing them from runners.__init__.
This process periodically fails when some runner or other cannot be
imported, usually because it is trying to import something outside of
stdlib and not handling ImportError.
Rather than letting this bring down the entire Python process, catch
and log the error. Sort the list again while we're here.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Runners may not import anything outside of stdlib unless they handle
the possible ImportError.
Apply this rule to the bossac runner. The general pattern is to have a
MISSING_REQUIREMENTS global that we handle at the beginning of
do_run(), but in this case this isn't a missing pip package, but a
misconfiguration. Just log a warning; it won't happen in practice.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Runners can (and many should) depend on the devicetree to decide what
to do, especially as it relates to the flash layout. Make it so that
they do not have to manipulate sys.path to get a hold of the edtlib
directory by doing it in one place, before importing any of them.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add support for including a board-specific config.yaml file
in the pyocd flash command. Similary to openOCD, the config
file is placed in the board directory under support/.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Use edt.label2node in dt_compat_enabled_with_label DT filter.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Co-authored-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The patch improves handling runners errors from flashing. It
add thread termination in case of process returning non 0 exit
code. Before, even though the error was returned,
a thread was not terminated and test ended
only after timeout termination. The patch also adds information about
the failure reason to the reports
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
Update test to account for new default parameters that allow
use image smaller than flash device capacity.
Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
The function returns true if the node with the referenced
node label is compatible and enabled.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The script gen_handles.py was introduce in #32127 but relies on
ZEPHYR_BASE being set in environment.
However, it is not a requirement to set Zephyr base in the users
environment, therefore this is changed to an argument `-z` or
`--zephyr-base` which will be passed from the build system to the
script.
If `-z` or `--zephyr-base` is not provided, the environment will be
checked for a ZEPHYR_BASE setting there.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
BabbleSim execution was (AFAICT mistakenly) disabled in
dda6a5ee90d0f5b31e7d269761dc2ab1a2f8510c. Re-enable it so we run them in
CI again.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add execution time for testing result of each ztest testcase as:
START - test_sem_multi_take_timeout_diff_sem
PASS - test_sem_multi_take_timeout_diff_sem in 2.54 seconds
Fix#32137.
Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
Logic for selecting non-default platforms listed in
integration_platforms did not work. Functionality is restored in this
change.
Fixes#32835
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Commit 0d4dca10b2 ("scripts: edtlib:
child binding compatibles match parents") was a hack meant to keep the
edtlib.Binding class in place without modifying some twister behavior
that needed further changes to work properly with first-class binding
objects.
This is a hack and is no longer necessary, so back out of this change.
Child Binding objects now have None compatible properties unless the
binding YAML explicitly sets a compatible.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Originally added in 7733b94224.
This filter is not well-formed. It's meant to match nodes like
/leds/led_0 in this DTS:
/ {
aliases {
led0 = &led0;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <...>;
label = "LED 0";
};
};
};
Uses look like this:
filter: dt_compat_enabled_with_alias("gpio-leds", "led0")
But notice how the led_0 node doesn't have compatible "gpio-leds";
it's actually the *parent* node that has that compatible.
Replace this with a new filter, dt_enabled_alias_with_parent_compat(),
which is used like this:
filter: dt_enabled_alias_with_parent_compat("led0", "gpio-leds")
This has a name and argument order that makes the meaning of the
filter clearer.
Replace in-tree users with the new filter.
Deprecate the old filter and warn about its use using the standard
logging module.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
In C, `void foo(void);` and `void foo();` mean subtly different things.
The former means "foo takes zero arguments"; the latter means
"foo takes an unspecified number of arguments". This can result in
calling convention mismatches in exceptional cases.
Change to emitting `(void)` instead of `()` for a syscall with
zero arguments.
Signed-off-by: James Harris <james.harris@intel.com>
CPython is sometimes described as "single threaded" due to the GIL,
but the interpreter will still "preemptively" switch between threads
(the details seem poorly documented).
So the time between checking whether acquire is 1 and decrementing the
count could result in more than one thread seeing an "available"
device, and more than one test being run (simultaneously, on the same
physical device!). We have a big herd of threads all polling for
this, so in a large test run this would happen maybe one time out of
20-30 tries.
Use a lock. Also remove the very similar looking
DUT.get_available_device() method, which had the same bug but appears
to be dead code.
Fixes#32679
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
If files are changed for architecture code, then only run CI on those
architectures.
Combine all scripts into one and make it simpler.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Log the security keys that the sniffer needs in order to sucessfully
decrypt the connection.
This option allows the sniffer to work in the cases where enabling
using the SMP debug keys is not wanted, either because it changes the
way the peer behaves or is denied by the peer.
It also enables the sniffer to decrypt a connection where the bond
already exists.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Use EXTRA_GEN_DEFINES_ARGS to error out on deprecated devicetree
properties when warnings are treated as errors.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Allow users to set the new EDT constructor argument which errors out
on deprecated properties via a command line argument.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
We'd like to start eliminating deprecated properties from upstream
Zephyr devicetrees. To make that possible in the build system, add an
EDT kwarg that does just that.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Commit 6bf761fc0a ("dts: Remove support
for deprecated DTS binding syntax") removed most of the support for
the 'legacy' bindings syntax.
A few straggler keys are still around in the bindings check code,
though. This allows some legacy keys which should cause errors to pass
silently instead.
Fix the error handling and print good errors for cases which are
removed, just in case someone is still using them somewhere.
Clean up some other error messages in the same function while we're
here.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This macro returns a node's name with unit-adddress, given its node
identifier.
The node name is useful information for the user to utilize for debug
information, similar to DT_NODE_PATH, or DT_LABEL.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Change the use of a f-string to a normal string as there is nothing
that needs formatting in the particular instance.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Update the jlink runner to prefer flashing .hex files instead of .bin.
This can increase programming speed in cases where there are large
amounts of padding in an application.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
sometimes a test instance hasn't been boot up to execute successfully,
so the results is an empty dictionary, it will not be added into final
twister_report.xml file.
in order to include it, fill the results as BLOCK.
Signed-off-by: peng1 chen <peng1.chen@intel.com>
Add ability to build a UF2 (https://github.com/Microsoft/uf2)
image as an additional output type. This leverages the code
partition offset for the UF2 base address, and a configurable
UF2 family ID.
Includes an unmodified (except for headers for licensing, pylit
disabling) version of the uf2conv.py script copied the UF2
format specification repository, used to convert the bin to UF2.
Origin: UF2 file format specification reference utilies
License: MIT
URL: https://github.com/microsoft/uf2/blob/master/utils/uf2conv.py
commit: 587abb8b909266e9b468d6284f2fbd425235d1b5
Signed-off-by: Pete Johanson <peter@peterjohanson.com>
Currently duplicated testcases are only determined by the classname.
This results in testcases not beeing added to the twister.xml if the
testcases are from the same class (e.g. sample.yaml), but with different
names.
The changed check if the combination of classname and testname
already exists.
Signed-off-by: Sebastian Wezel <sebastian.wezel@nordicsemi.no>
Following the idiom used for system calls, add script support to read
the initial application binary to identify which devices are defined,
and to use their offset in the device array as their unique handle
rather than the externally-defined ordinal from devicetree. The
device dependency arrays are updated to use these handles.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Include coverage support for device testing. It works by switching
capture_coverage to True (as it would meet coverage data start
pattern). Then we continue tot read coverage data until we get
coverage data end pattern. Otherwise, after receiving test result
pattern, we close serial console and do not get time to find start
coverage data pattern.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Zephyr testcases(not SOF case) not use kernel DSP driver to load image
on ADSP board, thus do not need signing with xman. So add a input
'--no-manifest' to specify signing without xman in image. If use DSP
driver load image, we should not specify this.
Signed-off-by: Jian Kang <jianx.kang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Check if a given 'compat' is a key in edt.compat2okay before accessing
its entry in dt_compat_on_bus() and dt_nodelabel_has_compat(), as for
a non-existing key a new entry with an empty list would be created,
and dt_compat_enabled() would then incorrectly return "y" when called
for the same 'compat'.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Handle a semantic versioning case used by Kitware that is not
supported by the packaging module we're using for version comparisons.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Fix twister output. "Test suite" used previously did not correspond
to what was counted (test scenarios). A test scenario is an entry from
testcase/sample.yaml under "tests:", which specify configuration used to
build a test. Changes in docs will follow later on. Also replace the
amount of preselectd platforms with the amount of platforms that
were not filtered out and actually tested.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
The _update_jump_to_matches() function used when searching from the
jump dialog is using the re module without importing it. Fix that.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Followup commit on comment in #32003.
Using pathlib to avoid mixing of `/` and `\` if twister someday will be
able to run on Windows.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fix possible race when determining available devices. Find available
device and return it in the same operation to avoid the race.
Fixes#31769
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Fixes: #30713
Now using the common script `verify-toolchain.cmake` for verifying
toolchain settings.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
There are use cases where --use-elf is given and the hex file does not
exist. Handle them.
Fixes: #31944
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Commit 3204554841 (" scripts: runners: error on missing
non-elf outputs") created the possibility of None bin_file and
hex_file attributes in the RunnerConfig without updating pyocd
appropriately. Fix that.
Fixes: #31921
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
As of today we unconditionally call 'stty sane' that leads to
lots of error messages
'stty: standard input: Inappropriate ioctl for device'
when output isn't connected to tty (for example when we launch
twister in Jenkins)
Fix that by check if output is really connected to tty before
'stty sane' call.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
We can't trust that a python file is executable on Windows, regardless
of what the mode bits say.
When we find that imgtool is a .py file, run 'python imgtool.py'
instead of 'imgtool.py' on that platform.
Fixes: #31876
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Have it return a list, which is prepended to the final arguments list
passed to subprocess. No behavioral changes expected, but this enables
making it contain multiple strings instead of just one.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The RunnerConfig class stores the locations of the Zephyr output files
in various formats (elf, hex, bin). A longstanding issue with the
representation is that these might not exist if the corresponding
Kconfig options are not set. For example, if
CONFIG_BUILD_OUTPUT_BIN=n, there is no .bin file.
Change this so the type system knows these are Optional[str], not str.
Fix the runners that use non-ELF outputs so they check for the
existence of the relevant file before using it, mostly using a new
ZephyrBinaryRunner.ensure_output helper.
I'm not going to bother with checking for the ELF file itself; that's
always there as far as I can tell.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Mark the option BT_FIXED_PASSKEY as an insecure option.
During Legacy pairing the passkey is used as encryption key, and
brute-forcing this is easy.
During LE Secure Connections the passkey is checked one bit at a time,
so when it is fixed the passkey can be deduced with series of pairing
attempts.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit lets the Kconfig compliance check run from top of current
git repo instead of only executing inside ZEPHYR_BASE.
This extends the usability of the Kconfig compliance check.
Together with this possibility, a KconfigBasic mode has been added which
will execute the same verification for symbols in the Kconfig tree but
will not check for undefined symbols outside Kconfig.
This is needed as running Kconfig undef check outside the tree in
non-Zephyr repos might pickup `CONFIG_` named symbols in other code.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Change the sorting of test instances if --device-testing is used
within subsets. Test instances are sored depending on the context.
For CI runs the execution order is: "platform1-testA, platform1-testB,
..., platform1-testZ, platform2-testA, ...". For hardware tests, were
multiple platforms can run the tests in parallel, it is more efficient
to run in the order: "platform1-testA, platform2-testA, ...,
platform1-testB, platform2-testB, ..."
This can significantly reduce the tests execution time
for setups with multiple different platforms connected.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
Changes to .buildkite/daily.yml don't make any sense to run twister
for since issues will only be seen when the daily builds run so add
it to the twister_ignore.txt list.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
West has introduced support for group tags in:
https://github.com/zephyrproject-rtos/west/pull/454
This means that manifest files might start containing groups.
Zephyr itself only requires west>=0.7.2 where groups are not supported
but other Zephyr based projects might start using the group feature.
When using a west version with group support, then only active projects
will be processed as Zephyr modules.
West versions without group support will consider all projects active.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The _save_old() to return early if <filename> is not file (or symlink
to a file).
This is simplest alternative to avoid attempt to rename /dev/null
(which could succeed).
This also keeps fifos (perhaps nonexistent potential usage but
this is nicer).
If <filename> were directory or socket, after shutil.copyfile(),
writing to the file (by caller, _write_config()), would fail.
Fixes#31362
Co-authored-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Signed-off-by: Tomi Ollila <tomi.ollila@iki.fi>
If we do not have the configuration path via cmake, then check if the
configuration path was provided on the command line and use it instead,
if both fail, bail out and die.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
rimage signing tool requires the path to the configuration directory.
This can be fetched using cmake cache if we are building with a module
that has rimage integrated like the sof module, however, we should be
able to sign images that were built standalone and without SOF, so
support this new option to provide the location of the configuration
files for the tool.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
While using the encoded path to a device tree node guarantees a unique
identifier for the corresponding device there is a limit on the number
of characters of that name that can be captured when looking up a
device by name from user mode, and the path can exceed that limit.
Synthesize a unique name from the node dependency ordinal instead, and
update the gen_defines script to record the name associated with the
full path in the extern declaration.
Add a build-time check that no device is created with a name that
violates the user mode requirement.
Also update the network device DTS helper functions to use the same
inference for dev_name and label that the real one does, since they
bypass the real one.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Calling cmake/pristine.cmake now requires SOURCE_DIR and BINARY_DIR as
arguments.
This ensures that pristine.cmake can evaluate if pristine is requested
on in-source builds, and bail out in such case with an error message.
All uses of `pristine.cmake` has been updated to use the new arguments.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This removes the z_ prefix those (functions, enums, etc.) that
are being used outside the coredump subsys. This aligns better
with the naming convention.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
get_mem_region() may return None for a non-existent memory region
so we need to check first before looking at its properties.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Following the idiom used for system calls, add script support to read
the initial application binary to identify which devices are defined,
and to use their offset in the device array as their unique handle
rather than the externally-defined ordinal from devicetree. The
device dependency arrays are updated to use these handles.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The introduction of Zephyr module glue code in the Zephyr repository
introduces a Kconfig variable in the form of:
`config ZEPHYR_<MODULE_NAME>_MODULE`.
All Kconfig variables go into `autoconf.h`, therefore it is necessary
to sanitize the Kconfig variable, so that it does not contain special
characters. To ensure consistent variable name, then the module name
will be sanitized in all variable use in both Kconfig and CMake.
The sanitization is done be replacing all special characters with an
underscore, `_`.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: #28847
This commit fixes two places that was causing gen_relocate_app to fail
in windows.
gen_relocate_app.py now splits only on first `:` in
`<MEM_REGION>:<file>`.
Windows contains `:` in path, thus only first `:` is valid for splitting
mem region and file path.
Second part of the issue is fixed in CMake where `'` was used for
quoting of command arguments.
This causes a file not found on Windows because the final `'` would be
treated as part of the filename. Similar the first `'` would be treated
as path of the mem region name.
This is fixed by using `"` for quoting, which works correctly on all
platforms.
gen_relocate_app.py:403: UserWarning: File: .../kernel/sem.c' Not found
Note the stray `'` ^^^
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: #31436
This fix adds ZEPHYR_<MODULE_NAME>_KCONFIG variable to compliance check.
This ensures that Zephyr Kconfig glue code is included in the
compliance check, and thus remove the issue reported in #31436.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The folder name of a Zephyr module is also used as its module name
when integrating it into the build system.
This means that a Zephyr module, BAR, located in:
<workspace>/modules/foo
|--- zephyr
|--- CMakeLists.txt
|--- Kconfig
will be referred to as FOO in the build system, that is:
ZEPHYR_FOO_MODULE_DIR==<workspace>/modules/foo
ZEPHYR_FOO_CMAKE_DIR==<workspace>/modules/foo/zephyr
The `name` field allows the module to specify its module name,
independent of its location like:
<workspace>/modules/foo/zephyr/module.yml
```
name: bar
build:
cmake: zephyr
```
will instead be referred to as BAR in the build system, that is:
ZEPHYR_BAR_MODULE_DIR==<workspace>/modules/foo
ZEPHYR_BAR_CMAKE_DIR==<workspace>/modules/foo/zephyr
This allows for greater flexibility of relocating Zephyr modules in
other folders and at the same time be guaranteed that other modules
depending on `ZEPHYR_BAR_MODULE_DIR` is still working.
If `name` field is not specified in `module.yml`, then the existing
behavior of using the folder name will be used.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit introduces MODULE_EXT_ROOT which allows CMake and Kconfig
glue code to be placed outside of the Zephyr module repository.
This allows for placing glue code in Zephyr, but also allows users to
specify custom MODULE_EXT_ROOTs for glue code using either
`-DMODULE_EXT_ROOT` or `zephyr/module.yml` with
`build:settings:module_ext_root` settings.
MODULE_EXT_ROOT' is a list of directories, similar to other roots such
as BOARD_ROOT, DTS_ROOT, etc.
The Zephyr repo folder ${ZEPHYR_BASE} is always to the MODULE_EXT_ROOT
list as lowest priority.
For each MODULE_EXT_ROOT, the file
`<module_ext_root>/modules/modules.cmake` will be processed.
In Zephyr repo, the folder `modules/<module>/` contains CMakeLists.txt
and Kconfig glue code for the Zephyr module.
A Zephyr module can specify that CMakeLists.txt and Kconfig glue code is
placed in an external module root by specifying:
```
build:
cmake-ext: True
kconfig-ext: True
```
It is still possible to place the CMakeLists.txt and Kconfig files
directly in the Zephyr module using the existing:
```
build:
cmake: <path>
kconfig: <file>
```.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This is always the same, so we might as well just remove it for now and
save some space since it is the default anyways. Type can be added later
when it provides more value.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Before we had a bindings index in the documentation, the generated
header file was (somewhat unfortunately) often our best reference for
what a particular binding or property within a binding ends up doing,
so it made good sense to put the description in the generated file.
Now that we have HTML documentation that's a bit more digestible than
the generated file, though, we can just point users at that. Do that
and remove the inline description from the generated file.
This makes it possible to put C-style multiline comments in the
descriptions themselves, which will be done in subsequent patches.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This macro returns a node's full path, given its node identifier.
The entire path to a node is useful information for the user which can
be added to build-time error messages.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Remove the boards and shields lists from the 'usage' target output.
That might have been readable at some point long ago in Zephyr's
history, when only a few boards were available, but right now it's
obscuring the high level targets we really want 'usage' to print.
Instead, add 'boards' and 'shields' targets which the user can run to
get those lists, and reference them from the 'usage' output. This
makes 'usage' squintable again. We use the new list_boards.py script
from the 'boards' target.
Reference the 'help' target from 'usage' as well, and drop the
recommendation that people run '--target help' from the 'west build
--help' output for the 'west build --target' option. The canonical
place to look is 'usage' now.
Use the new list_boards.py code from 'west boards' as well, which
allows us to add the board's directory as a format string key, in
addition to its name and architecture.
Keep west-completion.bash up to date. While doing that, I noticed that
a bunch of references to this file refer to a stale location, so fix
those too.
Finally, the 'usage' output is what we print for a failed board or
shield lookup, so that needs to be updated also. Handle that by
invoking boards.cmake and a new shields.cmake in CMake script mode to
print the relevant output.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This script is essentially a Python rewrite of the CMake code we're
using to print boards in cmake/boards.cmake, plus some extra features.
Having this in Python will simplify some later adjustments to our
'usage' build system target in ways that will make its output easier
to read, while simultaneously making 'west boards' more useful.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Generate a header (device_extern.h) that handles extern of possible
device structs that would come from devicetree. This removes the need
for DEVICE_DT_DECLARE and DEVICE_DT_INST_DECLARE which we can remove.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Logic for scope of platforms to be checked was changed and this options
now only applies to limited scope, fix this and reset scope when a
testcase declares it needs to build on available platforms.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
junitparser version 2 is incompatible with check_compliance.py, it fails
like this:
File "./scripts/ci/check_compliance.py", line 295, in parse_kconfig
self.skip("Not a Zephyr tree (ZEPHYR_BASE unset)")
File "./scripts/ci/check_compliance.py", line 141, in skip
self.case.result = Skipped(msg, "skipped")
File "/usr/local/lib/python3.9/site-packages/junitparser/junitparser.py"
line 682, in result
for entry in value:
TypeError: 'Skipped' object is not iterable
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Likely an accident when commit 288ae28c13 moved the script to the main
repo. Stayed unnoticed because this handler rarely ever runs.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
rimage dropped its "-m" parameter and switched over to using "-c"
for a configuration file, including a target name.
Add support for extended manifest for all cAVS versions.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
The commit
531fe89e80 (sanitycheck: use multiprcoessing instead of threads)
introduce regression for ARC nsim_hs_smp platform.
The regression is that verification on nsim_hs_smp hangs. That
happens because now we don't call try_kill_process_by_pid()
in the 'with' scope of the 'subprocess.Popen' when we spawning
BinaryHandler thread. Previously it was called via `terminate`
method of `BinaryHandler` but it was changed in 531fe89e80.
So if we can't terminate the simulator in a normal way
(which is expected for 'mdb' which is used for nsim_hs_smp
simulation) we will hang forever - we will never return from
'with' scope of the 'subprocess.Popen' as we are waiting for
process termination but the try_kill_process_by_pid() is located
latter and we never reach it.
Fix that.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
There are some drivers in the tree that support devices on multiple
different buses, although so far this has not been represented in
device tree using the bus concept. In order to convert these drivers &
bindings to refer to a formal bus in device tree we need to be able to
match bindings which lack an explicit "on-bus: ..." value against any
parent bus. This will also be needed for any external bindings, since
those would not be aware of on-bus (as it's a Zephyhr-specific
extension).
The two drivers I'm particularly targeting is the ns16550 UART driver
(drivers/serial/uart_ns16550.c) and the DW I2C driver
(drivers/i2c/i2c_dw.c). They both support devices with a fixed MMIO
address as well as devices connected and discovered over PCIe. The
only issue is that instead of encoding the bus information the proper
DT way these bindings use a special "pcie" property in the DT node
entries to indicate whether the node is on the PCIe bus or not.
Being able to convert the above two drivers to use the DT bus concept
allow the removal of "hacks" like this:
if DT_INST_PROP(0, pcie) || \
DT_INST_PROP(1, pcie) || \
DT_INST_PROP(2, pcie) || \
DT_INST_PROP(3, pcie)
to the more intuitive:
if DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie)
This also has the benefit that the driver doesn't need to make any
arbitrary assumptions of how many matching devices there may be but
works for any number of matches. This is already a problem now since
e.g. the ns16550 driver assumes a maximum of 4 nodes, whereas
dts/x86/elkhart_lake.dtsi defines up to 9 different ns16550 nodes.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
It's fine to flash an image with UICR data as long as the user has
given any of the --erase, --recover, or --force options. Silence the
error correctly.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
With the earlier version of Git, git describe command will
use the default 7 hexadecimal digits as the abbreviated
object name. But currently the Linux kernel project needs
11 to 12 hexdigits to stay unique.So it's necessary to add
--abbrev=12 to ensure twister always generate the same tags.
In https://testing.zephyrproject.org/daily_tests/versions.json,
all tags have 10 hexadecimal digits.
Signed-off-by: Jingru Wang <jingru@synopsys.com>
Require Sphinx<3.4.0 to avoid the issue described in:
https://github.com/sphinx-doc/sphinx/issues/8603
This requirement can be relaxed once a new sphinx-rtd-theme is
released.
Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
As of today we check for gdb presence in 'do_create' method and
raise an exception in case of gdb is missing. That makes nsim
runner unusable without gdb even for the commands which don't use
it (like 'flash' command).
Fix that.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
The DTS language permits zeroing out phandles in a phandle array to
say "there's nothing at this index", and dtlib manages that correctly,
but edtlib and gen_defines.py aren't equipped to do so.
Fix this by allowing None elements in the lists of ControllerAndData
values returned by edtlib for such properties.
Handle that in gen_defines.py by setting the generated
DT_N_<node>_P_<prop>_IDX_<i>_EXISTS macro to 0 in such cases.
The DT_N_<node>_P_<prop>_LEN macro still accounts for the entire
length of the phandle-array; it's just that some indexes may be
missing data.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Do not store shared memory variables into yaml and check for validity of
imported hardware map before attempting to modify it.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add exception check for psutil when running CI with nSIM
Sometimes nSIM random failures may turn nsimdrv process into zombie
process, parent process can't terminate it by calling proc.wait(0.1)
and kill command doesn't apply to zombie process
Signed-off-by: Jingru Wang <jingru@synopsys.com>
These are likely enough defined by mistake to emit a warning for.
Adjust tests to match, tweaking the test_warnings() setup: now that
we've got several test cases, it's a bit cleaner not to have to
copy/paste the ('edtlib', WARNING, ...) part of every expected log
record tuple.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The edtlib strategy for emitting warnings is to print directly to
standard error. This in turn requires hacks to drop stored references
to stderr in various _warn_file attributes so the EDT objects can be
pickled.
In general, I think it's not really appropriate for library modules
like edtlib to be printing to stderr directly. The user should be able
to configure logging for general utility data munging modules like
this as they please, and not just deciding what file to print to.
Move this around so the standard logging module is used instead. We
can preserve backwards compatibility in gen_defines by customizing the
'edtlib' logging module behavior so it prints the exact same thing it
always has.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Whenever a devicetree binding defines a string property whose
enumerated values are all tokenizable, generate C macros for each
property value that are the corresponding tokens.
Note that "token" is distinct from "identifier": both 'foo' and '123'
are valid tokens, but only 'foo' is a valid identifier. We permit some
strings which are not valid identifiers in anticipation that the
generalization may be useful, e.g. when defining macros that paste the
token onto a prefix that makes the whole thing an identifier.
Fixes: #21273
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add enum_tokenizable and enum_upper_tokenizable to PropertySpec. These
allow a PropertySpec to declare that it both has an enumeration of
values and all of them are strings which are "tokenizable". Don't
bother extending Property with these; the user can access the
information through Property.spec now, so the extra delegation is
unnecessary.
See the docstrings for details on what "tokenizable" means. The basic
idea is that we should be able to use the DT binding's enum values as
C 'enum' enumerators in a "reasonable way".
Add val_as_token to Property. This produces a canonical token for the
property value.
Add tests for this feature in particular and property enumerations in
general.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
In the 'normal' case of a property whose definition is taken from a
binding YAML file, a fair number (three at present) of the attributes
available on Property objects are directly taken from the
corresponding PropertySpec object.
Refactor the internals of how a Property gets initialized so that it
has a direct reference to its PropertySpec, and make those attributes
properties which just delegate to the PropertySpec (which in turn just
delegate to the binding). Additionally, expose the PropertySpec
directly.
This will make it easier to extend the Property class with additional
attributes that normally come from the PropertySpec without having to
touch all the locations where Property.__init__ is called.
In the case of the 'default' properties, we handle this by dummying
out some PropertySpec objects. These dummy PropertySpecs in turn
require a dummy Binding.
This change has the advantage that it improves the degree to which
these defaults are checked, e.g. it makes sure that 'status' is one of
the permitted values.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Now we create plaform reports for each enabled platform, this is time
consuming, especially if you are not using those reports for anything.
Make this an option and enable only if the generated reports are going
to be used.
Individual reports can also be generated from the JSON file if needed.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Runner implementations are only allowed to unconditionally import
modules in the python standard library. They are not allowed to import
anything that comes from pip or other third party sources unless they
catch the ImportError and gracefully do nothing.
Fix the imports in the mdb runner accordingly, sorting the imports
into sections to make it clearer what's stdlib, what's runners, and
what's third party while we're here.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add a simpel wrapper script called 'sanitycheck' to be removed after
Zephyr 2.5.
This script has a warning and a 5 sec delay to get the attention of the
caller.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move the "module" classes used by sanitycheck into a new location under
pylib, where we can have other python libraries reside instead of having
them all over the place.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move the CSV files with release related data out of the python directory
into scripts/releases, which is more appropriate.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move yaml schemas into one single location. We have quite a few schema
used across the tree, one common place will make them easier to find and
reference.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Rework the runner to improve various issues.
Every board.cmake file for an nRF SoC target is repeating boilerplate
needed for the nrfjprog runner's --nrf-family argument. The
information we need to decide the --nrf-family is already available in
Kconfig, so just get it from there instead. Keep the --nrf-family
argument around for compatibility, though.
This cuts boilerplate burden for board maintainers.
We also need to revisit how this runner handles recovery to fix it
in nRF53 and keep things consistent everywhere else.
To cleanly handle additional readback protection features in nRF53,
add a --recover option that does an 'nrfjprog --recover' before
flashing. Keep the behavior consistent across SoCs by supporting it on
those too. Because this is expected to be a bit tricky for users to
understand, check if a --recover is needed if the 'nrfjprog --program'
fails because of protection, and tell the user how to fix it.
Finally, instead of performing a separate 'nrfjprog --eraseall', just
give --chiperase to 'nrfjprog --program' process's arguments instead
of --sectorerase. This is cleaner, resulting in fewer subprocesses and
avoiding an extra chip reset.
Having a separate 'west flash --recover' option doubles the number of
test cases if we want to keep exhaustively enumerating them. That
doesn't feel worthwhile, so update the test cases by picking a
representative subset of the possibilities. Each test now has enough
state that it's worth wrapping it up in a named tuple for readability.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
script was failing during a run with -f, the status key was not in the
dictionary and the check would cause an exception. Fix that using
.get().
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The current bossac runner have multiple entries for flash offset
parameter. Remove offset parameter from command line and rework
all infraestructure to get offset from device tree. Add proper
verification routines to validate configurations on board and
device tree entries to fix SDK compatibility checks.
Fixes#29312.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Add is_extended_samba_protocol method to verify if board is using SAM-BA
extended protocol (Arduino/Adafruit UF2). It allows enforce serial line
speed to 1200 baud automatically. This avoid add entries on board.cmake
file.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Add a dt_chosen_enabled(chosen) filter function to sanitycheck. The
function returns true if the devicetree /chosen node contains 'chosen'
and the referenced node is enabled.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
mdb binary starts several subproceses and one of them is cld process.
In runners/mdb.py we record process id of cld on each mdb launch
to terminate simulator correctly later. However we can finish test
and terminate mdb before the cld process was found (so cld won't
be terminated correctly by sanitycheck infrastructure). It may happen
if we launch mdb on fast host machine.
That leads to several issues. First of all we get ugly error in
sanitycheck output:
------------------------>8--------------------------------
FileNotFoundError: [Errno 2] No such file or directory: '/xxxx/mdb.pid'
------------------------>8--------------------------------
Secondly (and it's more important) we terminate simulator incorrectly.
We terminate mdb leaving cld process alive, running and consuming one
cpu core permanently (until we kill it manually)
So, let's increase granularity of lookups and don't wait extra 0.5
seconds before the first lookup.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Add a new option that will enable treating RAM/SRAM overflows as errors
instead of skipping them, which is the default.
Fixes#27583
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
We were setting all devices as connected, now do that based on serial
availability.
Rename internal variables and make them shorter:
connected_hardware -> duts
ConnectedDevice = DUT
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
use a loop instead of all() to make the test easier to debug.
remove the default platform test, as this is now being filtered
differently in the code.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The available key is a runtime variable, it does not need to be in the
hardware map. Make it optional to keep the file format compatible for
now.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Try and keep terminilogy consistent, a test application with multiple
test cases is now a 'test suite'.
Also fix accounting when retrying failed.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If we provide arch on command line, do not check for all platforms of
architectures not specified.
Fixes#30099
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Show in debug mode what files are being written. In some cases this
takes a while and it is good to see what is going on.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
With python threading we have multiple issues with performance and
leakage. Use the python Process and implement locking using
multiprocessing library. This change improves performance and fixes
various issues with logging, concurrency and reliability of the output.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Running sanitycheck for multiple platforms but only request coverage
on a single platform fails, example:
sanitycheck --enable-coverage --coverage-platform nrf52840dk_nrf52840
-p nrf52840dk_nrf52840 -p nrf52dk_nrf52832 -T <sample>
This happens because `testcase_extra.conf` will only be created if the
current platform is included in the list of coverage platforms.
The error in the example above that would be seen is:
File not found:
<...>/sanitycheck/testcase_extra.conf
This commit now uses the existence of `testcase_extra.conf` which is
created in the method `create_overlay()` before appending
the conf file to the list of overlay files.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Get list of connected hardware and filter tests to only be run on
connected hardware in cases where no platform was specified when runn
the tests. If the platform does not exist in the hardware map, just
skip it.
Fixes#29166
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
We made a similar change for the nightly builds, but the PR builds
invoke run_ci.sh, so we need the same change here.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Generating JSON report format without changing
the existing report formats.
JSON report is divided into three sections
environment tests are run
test cases basic info and discarded tests
after applying filters
Added the complete debug log to the report
Fixes: #26443
Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
Move actual test cases from the run-sample-tests.sh script to
the network samples directory that are supported by Docker based
testing. Each network sample directory that supports Docker testing,
will contain docker-test.sh script that is sourced by the runner
script. The docker-test.sh script will run the test as needed and
then return return value to the runner script.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
I keep seeing people miss the --context option in the "west flash
--help" output.
This option is very important for understanding the runner-specific
options and state, and missing it means people get confused about what
west flash, debug, etc. can do and are doing.
Try to avoid this problem by adding a big fat banner about the
omission of runner-specific options in the main help output, and
provide more hints about how to use --context.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
When running sanitycheck without any platform filters (-p option), we
take the default platforms and run on those only. When the -G options is
used for integration testing, the platforms listed as integration
platforms are not being added on top of default platforms.
This change adds integration platforms to the list an treats
integration_platforms as a positive filter, so that
integration_platforms are always being considered.
Fixes#29829
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a way to run dumb_http_server_mt sample application against
HTTP get script (using curl) running in Docker.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Allow gPTP sample to be run via run-sample-tests.sh script.
This makes it possible to do simple smoke testing and verify that
gPTP stack is not broken.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
We have a use case for checking the results of a DT_PROP_HAS_IDX()
call with COND_CODE_1(). That won't work because its expansion is an
integer comparison; COND_CODE_1() expects a literal 1 or 0.
Adjust the macro implementation so it expands to a literal 1 or 0.
Make this work even when the index argument needs an expansion while
we're at it.
Fixes: #29833
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
TSIM3 is a LEON processor and system simulator.
This commit allows using TSIM sanitycheck and the make run target.
TSIM parameters can be further specified in the board configuration
using TSIM and TSIM_SYS.
Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
Fixes: #28462
This commit allows shields to be defined in other BOARD_ROOTs, either
using `-DBOARD_ROOT=<path>` or a Zephyr module defined BOARD_ROOT.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add missing infrastructure for simulation run on mdb-nsim.
When the nSIM via mdb simulation support was added to Zephyr
scripts the handler call was lost. So nSIM via mdb simulation
was broken from the beginning.
Fix that bu adding missing handler call fro mdb-nsim.
Note that we use BinaryHandler which call west flash. It's
required in case of nSIM via mdb as we create mdb.pid file with
mdb-nsim runner help.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
ARC nSIM boards (starting with nsim_ prefix) allow to run
tests in simulator (nSIM). However with proper west runner
the tests can be run on real HW (FPGA based).
So check device_testing flag firstly and rollback to nSIM
simulation run in case of device_testing is not set.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Record MDB's CLD process pid to file so this process can be
terminated by sanitycheck infrastructure.
Update mdb runners test to be able to handle changes.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
mdb runner is quite special as it can be used to run Zephyr on
both simulator (nSIM) and real hardware.
However it is really misleading as same command (west flash)
will run Zephyr in simulation for one board and try to run it
on HW for another board. Things are getting worse for boards
supporting both runs in simulation and on real hardware.
Let's split mdb runner for mdb-hw (for runs on HW) and mdb-nsim
(for runs in simulation) runners.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
The zeth interface was left hanging around when the test
finished but we can remove it here as it is not needed.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The current stty command uses a hard code value of 1200. This is not
compliant with SAM-BA specs and may create compatibility problems. Add
an optional speed argument with 115200 as default value following SAM-BA
specifications. All boards that needs a different speed should define
board_runner_args(bossac "--speed=<value>") with value as required
speed.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Introduce TagoIO IoT Cloud HTTP post client example. This explorer
Zephyr network resources to demonstrate an end to end application.
The TagoIO allows that any user can test on a easy way Ethernet, WIFI
and Modem (PPP) with BSD sockets. The example provides overlays to
configure WIFI and Modem.
The application consists an a pseudo temperature sensor that sends
periodically data to TagoIO IoT Cloud platform. The data can be
visualized on a web browser dashboard, cellphone or tablet. The
steps to configure TagoIO are described on the example documentation.
Special Variables:
- CONFIG_TAGOIO_DEVICE_TOKEN DEVID token generated by TagoIO
- CONFIG_TAGOIO_HTTP_WIFI_SSID SSID when using WIFI
- CONFIG_TAGOIO_HTTP_WIFI_PSK PASSWD when using WIFI
- CONFIG_MODEM_GSM_UART_NAME UART label when using MODEM
- CONFIG_MODEM_GSM_APN APN when using MODEM
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Fixes: #29758
Commit 7165b77a81 ("scripts: edtlib:
refactor for first class bindings") introduced a Binding class.
Its child_binding instance attribute has a compatible which can be
None. Adjust this behavior so the child Binding object has the same
compatible as the parent binding which ultimately has a compatible.
Without this, sanitycheck's expr_parser is doing some matching on
compatibles in child nodes that is producing unexpected results.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The child_binding object should default to having a path and
compatible that matches the parent's. Mark it as xfail because the
compatible part is failing.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The filters were updated to match the 3.3.0 generated text, so update
the sphinx requirement to exclude versions that use different text.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This is a convenience function for creating a bunch of Binding objects
from files in a directory.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
skips due to ram/rom overflow were captured as failures. Fix this and
count them correctly as skips.
Fixes#29412
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add date and if a commit should be considered for weekly testing.
This will still work with the old format.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add the ability to mark a property as 'deprecated' to get a warning that
it will be removed in the future.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Breathe>=4.23.0 brings in basic xrefitem rendering support and fixes
issues parsing anonymous struct/unions. This version also adds a config
knob for showing or hiding enumerator values, so set it to generate
documentation compatible with previous versions.
Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
This commit adds posibility to save zephyr version in the xml reports.
It adds 'properties' attribute to testsuite attribute. 'properties'
can contain multiple 'property' attributes. Zephyr version is added
as such 'property'.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
It's not clear why this error is here. The "formats" array seems to
be limited to "bin" and "hex" only, but every signing tool is going to
have its own idea of what format to emit and what ingredients need to
be used to do that.
In particular, rimage (used for the Intel Audio DSPs) doesn't use nor
generate zephyr.bin (it's very large), so it trips over this failure.
Just present the possibly-empty list of output formats to the Signer
object and let it make the decision about whether an empty formats
list is an error.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Avoids parsing the whole "before to now" commits after rebase.
Now, we just parse all commits since first commit of the branch
compared to master, each timer either at first push, forced push,
forced push after rebase.
Fixes#28509
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
_prop_val comment referred to one of the arguments called "optional"
however the code has changed to call that argument "required" now. Fix
up the comment block to use the correct argument name and semantics of
that argument.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add two new types: Binding and PropertySpec.
- Binding is a first-class abstraction for a devicetree binding
file as defined by a YAML file in the Zephyr syntax.
- PropertySpec is a helper type which represents a property
definition within a Binding.
Make the Binding constructor a new entry point to the library. This
enables users to deal with bindings as standalone entities, apart from
how they characterize a particular devicetree.
Rework the EDT and Node internals that deal with bindings as dict
values to use the Binding type instead. To make this less ambiguous,
use the variable name 'raw' when we're dealing with a binding as it's
parsed from YAML, and 'binding' when we're dealing with a Python
Binding object.
This commit drops support for the following legacy bindings keys
- '#cells': use '*-cells' instead (e.g. 'gpio-cells', 'pwm-cells')
- "child-bus: foo" and "child: bus: foo": use "bus:" instead
- "parent-bus" and "parent: bus: ": use "on-bus:" instead
Officially, legacy bindings have been gone since
6bf761fc0a ("dts: Remove support for deprecated DTS binding
syntax"), so this is vestigial code, and I couldn't find any in-tree
users.
It also drops the convention in this file that ""-strings are
preferred.
I honestly don't understand why this was ever enforced; the file
itself admits single quotes are common in Python and we use them
elsewhere in Zephyr's Python code.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
If we get a build failure with the -M option we get the following:
TypeError: 'NoneType' object is not iterable
This was due to having the default value of additional_keep in
cleanup_artifacts being None instead of an empty array.
Fixes#29376
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
To make the artifacts we keep around for --device-testing -M re-usable
we need to sanitize any aboslute build paths that might exist in
CMakeCache.txt or zephyr/runners.yaml.
This allows us to build the tests to run on one CI system and run the
tests on another system that has the board(s) connected to it.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
If we specify --device-testing and -M make it so that the resulting
artifacts are usable to run with device-testing again. This means
keeping around the zephyr binary images (zephyr.{bin, hex, elf}) and
a few files so 'west' can function for flashing (CMakeCache.txt and
zephyr/runners.yaml).
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
According to west-flash option description it's allowed to use
west-flash without parameter:
> There are three ways this option is used.
> 1) bare: --west-flash
> 2) with a value: --west-flash="--board-id=42"
> 3) Multiple values: --west-flash="--board-id=42,--erase"
However, we don't allow to west-flash to be without parameter
when we verify sanitycheck arguments. Fix that.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Fixes: #29235
This commit ensures that roots are being converted to posix paths.
This fixes the issue where windows style path (containing `\`) would
result in DTS dependency file to contain mixed style path separator and
thus causing Ninja to re-invoke CMake in an endless loop.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add the first API functions that directly deal with node dependency
ordinals as determined by edtlib:
- DT_DEP_ORD(node_id): node_id's ordinal
- DT_REQUIRES_DEP_ORDS(node_id): list of dep ordinals for node_id's
direct dependencies
- DT_SUPPORTS_DEP_ORDS(node_id): list of dep ordinals for nodes
depending directly on node_id
- DT_INST_ equivalents
This is not meant to be an exhaustive set of macros related to
dependency ordinals; rather, it's a starting out point meant to enable
initial struct device dependency tracking work. We can add more if
needed.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The west build command has historically tried not to rm -rf
directories that don't look like zephyr build directories. The way it
does this is by checking for the presence of a CMake cache
with a Zephyr-specific variable (ZEPHYR_TOOLCHAIN_VARIANT) in it.
The problem with this approach is that if the build system fails
before this cache variable is set, the directory doesn't look like a
zephyr build directory, and therefore west build won't make it
pristine even with --pristine=always, even though build directories
resulting from failed runs like that are almost certainly
irrecoverably broken and need to be made pristine before anything will
work.
This leads to users having to rm -rf their directories manually, which
is not so nice.
To avoid this from happening, just check for ZEPHYR_BASE, which is
set early on in ZephyrConfig.cmake in 'modern' zephyr build systems.
Keep the ZEPHYR_TOOLCHAIN_VARIANT check in place for compatibility.
We could consider being less selective and just using shutil.rmtree()
whenever we have --pristine=always, but that would be a bigger
behavioral change than I'm comfortable doing without a good reason.
Fixes: #28876
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
If we run with --cmake-only we get the following:
`ERROR - Unknown status None`
Fix this by treating no status set as "passed" for the --cmake-only
case.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The legacy macros were first deprecated in Zephyr v2.3. Now that
Zephyr v2.4 has been released, that makes two releases where these
macros have been deprecated, so it's OK to remove them.
This leaves support for legacy binding syntax in place. Removing that
is left to future work.
We need to update various pieces of documentation related to flash
partitions that never got updated when the new API was introduced.
Consolidate this information in the flash_map.h API reference page,
since that's really where users will run into it. This also gives us
the opportunity to improve this documentation.
Adjust a couple of kconfigfunctions.py and sanitycheck bits to use
non-legacy edtlib APIs.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
BOSSA takes the offset within flash memory, not the absolute address.
This doesn't matter on most boards as the flash starts at zero but
does matter on the Due as the flash starts at +512 KiB.
Signed-off-by: Michael Hope <mlhx@google.com>
Each controller node in a phandle-array may set the number of cells in
a specifier as any nonnegative integer. Currently, we don't allow
this in edtlib in the case where there are multiple controllers in a
phandle-array property all of which have 0 cells in the relevant
specifier, which is not correct. Fix this, add a regression test, and
improve the error message while we are here.
Fixes: #28709
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add a lookup table for finding a node by its dependency ordinal.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Make the scc_order method a property instead. This is in keeping with
the "General biased advice" at the top of file.
The actual order is therefore lazily initialized in this commit and
the order is not computed by the time __init__() returns. The next
commit will invoke scc_order by the time the constructor returns.
This is preparation work for adding a lookup table from dependency
ordinals to nodes. The combination of these two changes will make
intializing that lookup table a bit easier.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
We don't want to support cyclic dependency structures, because it
means that Node objects cannot have dep_ordinal attributes as they are
currently documented to possess unconditionally.
Nevertheless, we have some in our tests. Remove them by extracting the
/props/ctrl-X nodes to the same level as the /props nodes. This breaks
a cycle caused by:
- /props/ctrl-X nodes depend on /props because of the parent/child
relationship
- /props depends on /props/ctrl-X because it refers to them by phandle
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This patch fixes the ZeroDivisionError which can
occur during percantage of test execution reporting.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
Use the pytest test framework in the dtlib.py and edtlib.py test
suites (testdtlib.py and testedtlib.py respectively).
The goal here is not to change what is being tested. The existing test
suite is excellent and very thorough.
However, it is made up of executable scripts where all of the tests
are run using a hand-rolled framework in a single function per file.
This is a bit all-or-nothing and prevents various nice features
available in the de-facto standard pytest test framework from being
used.
In particular, pytest can:
- drop into a debugger (pdb) when there is a problem
- accept a pattern which specifies a subset of tests to run
- print very detailed error messages about the actual and expected
results in various traceback formats from brief to very verbose
- gather coverage data for the python scripts being tested (via plugin)
- run tests in parallel (via plugin)
- It's easy in pytest to run tests with temporary directories
using the tmp_path and other fixtures. This us avoid
temporarily dirtying the working tree as is done now.
Moving to pytest lets us leverage all of these things without any loss
in ease of use (in fact, some things are nicer in pytest):
- Any function that starts with "test_" is automatically picked up and
run. No need for rolling up lists of functions into a test suite.
- Tests are written using ordinary Python 'assert'
statements.
- Pytest magic unpacks the AST of failed asserts to print details on
what went wrong in really nice ways. For example, it will show you
exactly what parts of two strings that are expected to be equal
differ.
For the most part, this is a pretty mechanical conversion:
- extract helpers and test cases into separate functions
- insert temporary paths and adjust tests accordingly to not match
file names exactly
- use 'assert CONDITION' instead of 'if not CONDITION: fail()'
There are a few cases where making this happen required slightly
larger changes than that, but they are limited.
Move the checks from check_compliance.py to a new GitHub workflow,
removing hacks that are no longer needed.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
So far 'tests' and 'samples' directories were matched only when they
were first directories in path hierarchy. This doesn't work when running
sanitycheck from directory other than Zephyr source code root.
Match any directory in path hierarchy, similar how file is matched
currently. That way sanitycheck can be executed from outside of Zephyr
source code directory.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Add '--coverage-basedir BASEDIR' argument, which can be used to specify
source code base directory other than default Zephyr root directory.
This is mainly useful for projects built on top of Zephyr, where
sanitycheck is used for unit testing application code.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Use --filter=runnable for example to limit the tests being built to
those which actually can run on a device or a emulation platform.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
build_only was being used in different contexts and was confusing, so
clean this up and in some places just set if a test is runnable, a
testcase should always be buildable if the filters are matching.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Inspect the hex file with intelhex, and fail if the hex file has any
contents in the UICR area(s).
family == 'NRF52' still always does --sectoranduicrerase, but this
option is not available on other families.
Add --force command line option to proceed with flashing instead of
failing.
Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
Only create the dir and file if we have actual "content" that will
exist in testcase_extra.conf. This is to reduce a bit of
noise/footprint in the sanitycheck output dir.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
If we kill qemu because of a timeout, capture this as the reason instead
of reporting the exit code.
Fixes#28040
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Breathe 4.21.0 brings a few interesting features that improve the
generated documentation:
* A new `separate_member_pages` config option that patches issues in the
Doxygen XML generated when SEPARATE_MEMBER_PAGES option is YES.
* A new rST verbatim mode that allows producing inline elements.
Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
This undo's commit dd65f7c38a that changed how we sorted tests to get
better distribution from a qemu running point of view. However we now
have some tests that take a long time to build and we end up loading
build machines we all the long running tests.
Lets try going back to sorting by platform and see how that behaves with
the new CI environment.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Commit 3124c02 ("cmake: flash/debug: refactor runner configuration")
changed the way the hex_file and elf_file inputs in the RunnerConfig
object are created. In particular, they are now host-style paths.
This breaks flashing with openocd on Windows, which doesn't handle that
properly. Fix that by "casting" the internal hex_file and elf_file
attributes to POSIX paths.
Fixes: #28138
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This code had one purpose only, feed timing information into a test and
was not used by anything else. The custom trace points unfortunatly were
not accurate and this test was delivering informatin that conflicted
with other tests we have due to placement of such trace points in the
architecture and kernel code.
For such measurements we are planning to use the tracing functionality
in a special mode that would be used for metrics without polluting the
architecture and kernel code with additional tracing and timing code.
Furthermore, much of the assembly code used had issues.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
MWDT toolchain adds additional suffix to sections name in case of
ffunction-sections / fdata-sections are enabled.
As proposed by Andy Ross let's pick a single set of rules
and syntax that work.
Suggested-by: Andy Ross <andy@plausible.org>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
I've repeatedly seen that people are not aware of the existence of
this configuration option.
I've been using build.pristine=auto daily for years and never had any
problems. I've also asked around on Slack a couple of times over
various points to see if anybody objects to making this change. Nobody
has, so let's just turn it on by default.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Tell the EDT instance that properties of the /zephyr,user node should
be generated based on the binding types inferred from the property
content.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Clean up of devicetree tooling removed generation of information
present in devicetree in nodes that have no compatible, or for extra
properties not defined by a binding. Discussion proposed that these
properties should be allowed, but only in a defined node /zephyr,user.
For that node infer bindings based on the presence of properties.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
By default, subprocess.Popen commands are supplied as a list of strings.
Using split() allows to use command with arguments, for example it is
possible to use following:
sanitycheck ... \
--device-serial-pty="set_ambient read_terminal.py" \
...
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit message is a bit of a novel mostly:
- because the issues involved are longstanding
- as evidence this is not a capricious refactoring
The runners.core.RunnerConfig Python class holds common configuration
values used by multiple runners, such as the location of the build
outputs and board directory.
The runners code, first written in 2017-ish, replaced various shell
scripts that got this information from the environment. Avoiding
environment variables was a requirement, however. It's ghastly to set
environment variables for a single command invocation on Windows, and
the whole thing was part of a larger push to make Zephyr development
on Windows better.
I had a hammer (the argparse module). Finding a replacement naturally
looked like a nail, so the information that ends up in RunnerConfig
got shunted from the build system to Python in the form of 'west
flash' / 'west debug' command line options like '--board-dir',
'--elf-file', etc.
I initially stored the options and their values in the CMake cache.
This was chosen in hopes the build system maintainer would like
the strategy (which worked).
I knew the command line arguments approach was a bit hacky (this
wasn't a nail), but I also honestly didn't have a better idea at the
time.
It did indeed cause issues:
- users don't know that just because they specify --bin-file on the
command line doesn't mean that their runner respects the option, and
have gotten confused trying to flash alternate files, usually for
chain-loading by MCUboot (for example, see #15961)
- common options weren't possible to pass via board.cmake files
(#22563, fixed partly via introduction of runners.yaml and the west
flash/debug commands no longer relying on the cache)
- it is confusing that "west flash --help" prints information about
openocd related options even when the user's board has no openocd
support. The same could be said about gdb in potential future use
cases where debugging occurs via some other tool.
Over time, they've caused enough users enough problems that
improvements are a priority.
To work towards this, put these values into runners.yaml using a new
'config: ...' key/value instead of command line options.
For example, instead of this in the generated runners.yaml file:
args:
common:
- --hex-file=.../zephyr.hex
we now have:
config:
hex_file: zephyr.hex
and similarly for other values.
In Python, we still support the command line options, but they are not
generated by the build system for any in-tree boards. Further work is
needed to deprecate the confusing ones (like --hex-file) and move the
runner-specific host tool related options (like --openocd) to the
runners that need them.
Individual board.cmake files should now influence these values by
overriding the relevant target properties of the
runners_yaml_props_target.
For example, instead of:
board_runner_args(foo "--hex-file=bar.hex")
Do this:
set_target_properties(runners_yaml_props_target PROPERTIES
hex_file bar.hex)
This change additionally allows us to stitch cmake/mcuboot.cmake and
the runners together easily by having mcuboot.cmake override the
properties that set the hex or bin file to flash. (The command line
arguments are still supported as-is.)
Combined with 98e0c95d91ae16f14e4997fb64ccdf0956595712 ("build:
auto-generate signed mcuboot binaries"), this will allow users to
build and flash images to be chain loaded by mcuboot in a way that
avoids calling 'west sign' and passing 'west flash' its output files
entirely.
While we are here, rename runner_yml_write to runners_yaml_append().
This function doesn't actually write anything, and we're here
refactoring this file anyway, so we might as well improve the
situation while we're at it.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The 'runner_config' variable name is particularly misleading because
there is a class called RunnerConfig, and that variable does not
contain one.
Rename it to 'runners_yaml' since it contains the parsed contents of
the runners.yaml file. Rename the variable that refers to the path
itself to 'runners_yaml_path'. No functional changes expected.
This is prep work for redoing how actual RunnerConfig objects get
made.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Before venturing off into refactoring land, let's make sure we have a
type checker running on the main APIs used by the various runners so
we don't miss anything obvious.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Use mypy to type check the runners package.
The test procedure is now annoying enough to replicate locally that
I'm going to wrap it in a script. Do this for both UNIX and Windows
environments by writing that script in Python.
Keep the GitHub workflow up to date so we now get mypy results in CI.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Colorama needs to be initialized, and for colors to display correctly on
Windows one needs to use the `USES_TERMINAL` option in CMake.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Certain symbols do not contain a valid path, instead showing
`<built-in>` in the filename attribute. This leads to the resolve() call
failing on Windows, since the `<>` characters are not allowed in
filenames there. Fix this by catching the exception and skipping the
call in that case.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2 scripts are provided.
- find_functions.cocci (name probably sucks...)
- find_dev_usage.cocci (ditto...)
find_functions.cocci can patch files where device instance are not
const.
Then it is used to generate the function database:
./scripts/coccicheck --mode=report --jobs=1 \
--cocci=scripts/coccinelle/find_functions.cocci \
--sp-flag="--include-headers" ./
Then, find_dev_usage.cocci will check if the const qualifier is, or
might be lost in a function call.
For instance:
./scripts/coccicheck --mode=report --jobs=1 \
--cocci=scripts/coccinelle/find_dev_usage.cocci \
--sp-flag="--include-headers" drivers/i2c
Which will output a WARNING on non-zephyr functions calls with a device:
./drivers/i2c/i2c_cc13xx_cc26xx.c:393:5-8: WARNING: in i2c_cc13xx_cc26xx_pm_control calling cb param with dev, check if const qualifier is not lost
./drivers/i2c/i2c_mcux_lpi2c.c:205:40-43: WARNING: in mcux_lpi2c_init calling LPI2C_MasterTransferCreateHandle param with dev, check if const qualifier is not lost
./drivers/i2c/i2c_nrfx_twi.c:258:5-8: WARNING: in twi_nrfx_pm_control calling cb param with dev, check if const qualifier is not lost
./drivers/i2c/i2c_nrfx_twi.c:202:22-25: WARNING: in init_twi calling nrfx_twi_init param with dev, check if const qualifier is not lost
./drivers/i2c/i2c_mcux.c:187:38-41: WARNING: in i2c_mcux_init calling I2C_MasterTransferCreateHandle param with dev, check if const qualifier is not lost
./drivers/i2c/i2c_mcux_flexcomm.c:184:43-46: WARNING: in mcux_flexcomm_init calling I2C_MasterTransferCreateHandle param with dev, check if const qualifier is not lost
./drivers/i2c/i2c_nrfx_twim.c:232:5-8: WARNING: in twim_nrfx_pm_control calling cb param with dev, check if const qualifier is not lost
./drivers/i2c/i2c_nrfx_twim.c:174:8-11: WARNING: in init_twim calling nrfx_twim_init param with dev, check if const qualifier is not lost
./drivers/i2c/i2c_rv32m1_lpi2c.c:246:6-9: WARNING: in rv32m1_lpi2c_init calling LPI2C_MasterTransferCreateHandle param with dev, check if const qualifier is not lost
Or:
./scripts/coccicheck --mode=report --jobs=1 \
--cocci=scripts/coccinelle/find_dev_usage.cocci \
--sp-flag="--include-headers" drivers/ieee802154
Which will output an ERROR on using a zephyr function that looses the
const qualifier:
drivers/ieee802154/ieee802154_rf2xx.c:778:3-6: ERROR: in rf2xx_init calling k_thread_create param with dev, loosing const qualifier, please wrap
drivers/ieee802154/ieee802154_nrf5.c:477:19-22: ERROR: in nrf5_init calling k_thread_create param with dev, loosing const qualifier, please wrap
drivers/ieee802154/ieee802154_cc1200.c:819:3-6: ERROR: in cc1200_init calling k_thread_create param with dev, loosing const qualifier, please wrap
drivers/ieee802154/ieee802154_mcr20a.c:1443:3-6: ERROR: in mcr20a_init calling k_thread_create param with dev, loosing const qualifier, please wrap
drivers/ieee802154/ieee802154_cc2520.c:1116:3-6: ERROR: in cc2520_init calling k_thread_create param with dev, loosing const qualifier, please wrap
drivers/ieee802154/ieee802154_cc13xx_cc26xx.c:439:32-35: ERROR: in ieee802154_cc13xx_cc26xx_data_init calling k_thread_create param with dev, loosing const qualifier, please wrap
ISSUE:
- Is it possible to run a set of rules first on all the code, and then
another set, both sets being in the same .cocci file?
Would be nice to have all at once.
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The k_object API associates mutable state structures with known kernel
objects to support userspace. The kernel objects themselves are not
modified by the API, and in some cases (e.g. device structures) may be
const-qualified. Update the API so that pointers to these const
kernel objects can be passed without casting away the const qualifier.
Fixes#27399
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Fix the case where we have no ztest test_* testcases and reports were
missed. This now makes sure we do not report the parent testcase when
there are individual test_* results.
Fixes#27765
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
add argument --pre-script to specify a pre script. This will be
executed before device handler open serial port and invoke runner.
Currently, pre_script can only get from hardware.map file. just like:
./scripts/sanitycheck --hardware-map xxx.map
and set pre_script in xxx.map file.
Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
In some cases it might be a good idea to reset the board for real to
make sure it is completely recovered from some failed state (simple
re-loading of the application binary or even Elf file contents doesn't
affect most of internal CPU states so doesn't help in recovery,
see https://github.com/zephyrproject-rtos/zephyr/issues/25022 &
https://github.com/zephyrproject-rtos/zephyr/issues/26665).
And so we may want to utilize some external utility which triggers the
hard reset (in case of ARC boards it is
https://github.com/foss-for-synopsys-dwc-arc-processors/rff-ftdi-reset).
So we need to have a way to execute an external command before each and
every test.
Now given we already have quite some call-backs we try to use them
before re-inventing the wheel. And pre_script seem to be a good option
with just on minor note - it is called after serial port gets open.
And while in some cases it might be OK if serial port on the board is
not affected by the board's reset, if it is affected we'll be losing
connection on reset (and that's the case with ARC boards BTW as the
FTDI USB-to-Serial IC is also wired to the reset signal on most of
the boards). That said we just move invocation of pre_script before
opening the serial port and everything should be good now.
Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
By default show reports based on last release. Fix a few other issues
where we had 0 values and were dividing by zero.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit improves Zephyr modules support in CMake.
All Zephyr modules will now have a corresponding
`ZEPHYR_${module_name}_MODULE_DIR` set, regardless of whether they
define a cmake folder in module.yml.
This results in:
`ZEPHYR_${module_name}_MODULE_DIR` defined for all modules and refers to
the root of the modle.
`ZEPHYR_${module_name}_CMAKE_DIR` defined for modules that specifies
cmake in module.yml, or is having both a CMakeLists.txt and Kconfig file
in the zephyr folder.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit has no functional changes but is simply a cleanup so that
flake8 will pass without warnings.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This will only build/run on emulation platforms.
The decision is made based on the value of the 'simulation' key in the
platform yaml file.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This is needed for sanitycheck hardware maps which take the serial
number directly from USB metadata.
Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
Adds some code to allow QEMU to crash without failing the test.
This is required for testing coredump code as it will certainly
cause QEMU to crash.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
There is a potential that QEMUHandler.handle() returns before
the testing harness finishes processing all the output from QEMU.
Simply wait for the harness thread to finish before returning.
Also, fix the return code in the debug message as it should be
the return code from Popen().
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds the necessary bits in arch code, and Python scripts
to enable coredump support for ARM Cortex-M.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds a very primitive coredump mechanism under subsys/debug
where during fatal error, register and memory content can be
dumped to coredump backend. One such backend utilizing log
module for output is included. Once the coredump log is converted
to a binary file, it can be used with the ELF output file as
inputs to an overly simplified implementation of a GDB server.
This GDB server can be attached via the target remote command of
GDB and will be serving register and memory content. This allows
using GDB to examine stack and memory where the fatal error
occurred.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Commit 8d7bb8ffd8 refactored
device structures which changed some of the linker sections:
"devconfig" was removed, and "devices" was added. However,
the list in sanitycheck's size calculator was not updated,
which results in sanitycheck complaining about unrecognized
sections when doing footprint.
Also, a few sections have been renamed (with added suffix
"_area") due to introduction of Z_ITERABLE_SECTION_RAM/ROM
macros. There are also some missing section names.
Fixes the issue by adding the missing sections names, and
updating existing ones.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
When MCUBoot is built using the swap-move strategy, the secondary slot
can be one sector smaller than the primary slot, because the primary
slot's last "useful" image sector must be "reserved" for the move
operation; this impacts the generation of padded images, so when
signing an image, the proper size to use is the secondary slot's,
unless a secondary image is not defined which is the case when using
single image DFU.
Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
The extra empty line broke the "ninja hardenconfig" on my machine with
Python 3.7.5, it complains:
"
... ...
File "/home/zephyrproject/zephyr/scripts/kconfig/hardenconfig.py",
line 46, in compare_with_hardened_conf
name = row[0]
IndexError: list index out of range
FAILED: CMakeFiles/hardenconfig
"
The csv.reader reads this empty line and gets an empty list which will
not be successfully "de-referenced". Removing it to improve the
out-of-box experience when pepople try out the hardening options.
Signed-off-by: Wenbo Yang <wenbo.yangcn@gmail.com>
This squashes and applies the Linux diffs to scripts/checkpatch.pl
between Linux commit 16fbf79b0f83bc75 ("Linux 5.6-rc7") and
9123e3a74ec7b93 ("Linux 5.9-rc1") except for commits identified below.
The last 1000 commits to Zephyr master were compared for checkpatch
output differences between the previous Zephyr version and this
version. One new diagnostic about function declarations with an empty
parameter-list was introduced (FUNCTION_WITHOUT_ARGS). The text of an
existing diagnostic was changed (DT_SPLIT_BINDING_PATCH). The text of
LONG_LINE diagnostics was enhanced to provide the actual line length.
Linux commit dfa05c28ca7ffc0a ("checkpatch: remove email address
comment from email address comparisons") was removed because
differences in the scripts resulted in false signed-off-by check
diagnostics when a full name included characters not in Basic Latin,
due to changes in how the author name was extracted. Earlier upstream
changes not integrated into Zephyr may be required.
Linux commit b95692f8b3000166 ("checkpatch: prefer fallthrough; over
fallthrough comments") was removed because Zephyr doesn't support the
upstream pseudo keyword.
Linux commit bdc48fa11e46f867 ("checkpatch/coding-style: deprecate
80-column warning") was edited to not actually change the 80-column
maximum line limit as this change has not been mooted for Zephyr.
Linux commit ced69da1db0b57bb ("checkpatch: fix CONST_STRUCT when
const_structs.checkpatch is missing") was edited to the CONST_STRUCT
file as that's not supported in Zephyr.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Add support for the J-Link Commander "-NoGui 1" command line parameter
in the West J-Link runner.
This command line parameter suppresses GUI dialogs (except for license
dialogs) in J-Link Commander starting from v6.80.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
If a runner supports the --erase option, make it so that the user can
add --no-erase to the command line to explicitly disable it.
Add a diagnostic at info() level whenever this option is requested.
The intent of this commit is to make it more obvious when a mass erase
was requested, especially in situations (like MCUboot with
CONFIG_MCUBOOT_TRY_MASS_ERASE=y) where this option may be turned on by
default.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Fixes: #27375
This is a cleanup of the Zephyr CMake package export.
The code has been simplified so that the export now happens through a
CMake script. This avoids several generated CMake build files compared
to previous export mode, and thus removes the need for a CMake pristine
script.
A benefit of this cleanup is that it also fixes#27375.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This patch should improve couting and reporting of the number
of passed/skipped tests.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
Avoid use of the cached_runner_config() helper, which we have a TODO
item to get rid of. Adjust the output and do some other minor
improvements.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Rolling yet another parser turns out to be the best way to let west
extensions respond to Kconfig values. See source code comments in the
patch for details.
The sanitylib library has some similar functionality but it isn't
exactly the same, and it gets strings wrong. For example, that parser
can't handle this option:
CONFIG_FOO="he said \"no\" to me"
This one can, and it has a couple of other features we'll find useful
for west extensions eventually besides.
(Not to mention that sanitylib also rolled its own CMake cache parser,
which also exists in west_commands.)
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Use anytree module to display tree and to allow easy exporting into
json.
Add option to export results into a json file.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
In DWARF 4, e.g. ARC Metaware toolchain, DW_AT_count is
used not DW_AT_upper_bound. We should consider this corner
case.
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
When running with --test-only we get:
Traceback (most recent call last):
File "./scripts/sanitycheck", line 1168, in <module>
main()
File "./scripts/sanitycheck", line 1160, in main
options.only_failed)
File "scripts/sanity_chk/sanitylib.py", line 2543, in save_reports
self.xunit_report(filename + ".xml", full_report=False, append=only_failed)
File "scripts/sanity_chk/sanitylib.py", line 3220, in xunit_report
return fails, passes, errors, skips
UnboundLocalError: local variable 'fails' referenced before assignment
This is due to the fact that selected_platforms was not set.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
In the junit output the attribute containing the number of skipped tests
must be named "skipped" instead of "skip".
See e.g. https://github.com/junit-team/junit5/blob/main/platform-tests/
src/test/resources/jenkins-junit.xsd#L95
Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
The extra empty line broke the "ninja hardenconfig" on my machine with
Python 3.7.5, it complains:
"
... ...
File "/home/zephyrproject/zephyr/scripts/kconfig/hardenconfig.py",
line 46, in compare_with_hardened_conf
name = row[0]
IndexError: list index out of range
FAILED: CMakeFiles/hardenconfig
"
The csv.reader reads this empty line and gets an empty list which will
not be successfully "de-referenced". Adding extra check to skip the
empty lines.
Signed-off-by: Wenbo Yang <wenbo.yangcn@gmail.com>
Running check_compliance on a PR before submitting it can avert
embarrassing mistakes. Ensure the packages needed to do so are
installed along with all the others.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Currently '--coverage-tool gcovr' results in using lcov. Fix that to use
gcovr, as requested by user.
Fixes: f6462a3a8c ("sanitycheck: get rid of global VERBOSE")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Sanitycheck discards test instances if a set of given coditions
is not fulfilled. This leads to empty test results for these
instances. This can introduce ambiguity with results that are
missing due to some bugs in the framework. This commit fills
the results for skipped tests with 'skipped' states and provides
the reason for filtering them out in the msg field. The commit
also fixes the way sanitycheck counts and reports tests/test cases
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
Fixes: #25215
This commit introduces the possibility of defining ROOTs in a Zephyr
module and have it automatically appended to list of other ROOTs.
Supported with this commit:
- BOARD_ROOT
- SOC_ROOT
- DTS_ROOT
- ARCH_ROOT
In order to support this in Zephyr module files, the detection of west
has been moved to dedicated west.cmake file and included immediately
after python.cmake.
Also the inclusion of zephyr_modules.cmake has moved before first use
of BOARD_ROOT.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit introduces support for multiple SOC_ROOT.
This means that additional SOC_ROOTs specified using -DSOC_ROOT as
argument to CMake will be forming a list together with ${ZEPHYR_BASE}.
This allows for greater flexibility, as developers can now specify
multiple out-of-tree SoCs and not worry about the SoC used for the
board they compile for.
Also it avoid code, such as:
if(BOARD STREQUAL my_board_using_out_of_tree_soc)
set(SOC_ROOT some/out/of/tree/soc/path)
endif()
in application CMakeLists.txt.
Finally, allowing multiple SOC_ROOTs prepares for specifying SOC_ROOTs
in Zephyr modules.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
When passing a using --hardware-map, sanitycheck would ignore extra
args passed via --west-flash, such as --west-flash="--erase".
This is because the command with the extra args was overwritten by the
command with the runner info from the hardware map.
This patch merges those code paths so they are aware of each other and
of --west-runner.
Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
Before sanitycehck was removing all `test_` chars in test cases'
names. This test has to be modify to work with the improved behavior
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
This commit limits the removal of `test_` from test case name
to only the first occurance. There are test cases with `test_`
also in the middle of their names and removing it couses mismatches
between extracted testcases and the names obtained when passing
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
These stacks are appropriate for threads that run purely in
supervisor mode, and also as stacks for interrupt and exception
handling.
Two new arch defines are introduced:
- ARCH_KERNEL_STACK_GUARD_SIZE
- ARCH_KERNEL_STACK_OBJ_ALIGN
New public declaration macros:
- K_KERNEL_STACK_RESERVED
- K_KERNEL_STACK_EXTERN
- K_KERNEL_STACK_DEFINE
- K_KERNEL_STACK_ARRAY_DEFINE
- K_KERNEL_STACK_MEMBER
- K_KERNEL_STACK_SIZEOF
If user mode is not enabled, K_KERNEL_STACK_* and K_THREAD_STACK_*
are equivalent.
Separately generated privilege elevation stacks are now declared
like kernel stacks, removing the need for K_PRIVILEGE_STACK_ALIGN.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
We have been doing an AND comparison instead of an OR. AND does exclude
way to many testcases where multiple tags are being used.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Use --integration testing for CI to limit execution and builds on
platforms that actually provide most of the coverage instead of blindly
building/running on all available platforms.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
On some NXP LPC MCUs (such as LPC11U6x), a valid firmware image must
include a checksum in the 7th entry of the ARM Cortex-M0 exception
vector table. This checksum is verified by the bootloader.
The lpc_checksum.py python script allows to insert this checksum into
the firmware images (BIN and HEX formats).
Project page: https://github.com/basilfx/lpc_checksum
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
Make net_if a kernel object with type K_OBJ_NET_IF so that we
can restrict access to it.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
instances that do not run will have no results (beside the fact they
built successfully), so log those as such.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This is a cargo-culted attempt to make an error observed in poorly
understood CI circumstances go away when loading edt.pickle, by making
edtlib visible in sys.modules before loading the pickle file.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Adding the get_maintainer.py script
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Consolidate creation of edtlib.EDT objects from a build directory's
devicetree into one place by loading it from build/zephyr/edt.pickle
everywhere. A previous commit creates edt.pickle from gen_defines.py.
In addition to probably speeding things up slightly by not reparsing
the devicetree, the main benefit of this approach is creating a single
point of truth for the bindings directories and warnings
configuration, meaning we don't have to worry about them getting out
of sync while being passed around between devicetree creation and
usage time.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Increased minimal pyelftools version to 0.26 else
scripts/footprint/size_report will fail to import LocationExpr from
elftools.dwarf.locationlists
Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
I can never remember what the contents of the kconfigfunctions dict is
and have to look it up every time. I suspect I'm not alone, and not
everyone who uses these will know how to look up the answer. Add a
comment explaining the value.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
There is already a way to check if a node is enabled based on its node
label, but we don't have an equivalent way to do that for a path or an
alias. Add them. These rely on the same underlying edtlib machinery to
get their jobs done, but are being treated differently within Kconfig
in order to match distinctions between paths and aliases made in the
devicetree.h API.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This adds CONFIG_BT_CONN_DISABLE_SECURITY which can be used to disable
security checks for incoming requests enabling to test accessing GATT
attributes and L2CAP channels that would otherwise require
encryption/authentication in order to be accessed.
It depends on BT_TESTING to indicate to the users that this is a
testing feature which shall not be used in production.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
serial-pty is an extension that is not supported in the hardware map, so
we need to work around the fact that it is not part of the map when
dealing with normal serial.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add option to provide to sanitycheck argument for creating
pseudoterminal. Used with hardware without serial console connected.
A pseudoterminal is used to make a sanitycheck believe that it
interacts with a terminal although it actually interacts with the
script.
E.g "sanitycheck --device-testing --device-serial-pty <script>"
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Support running/building only specific tags and ignoring everything
else.
Adding this to a platform yaml file will enable tests with one of of
tags listed to be executed on the platform.
This is useful for special platform configurations used for testing
specific features for example.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Refactor subfolder_list.py to enable unit testing. This means split the
implementation into separate logical functions. Additionally, modify the
code to improve PEP 8 compatibility and pylint result.
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
The projects variable needs to be initialized with the list of modules
provided via cmd-line arguments.
This is a regression introduced by
ef3c5e5516.
Fixes#26948.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
--warnings-as-errors was basically doing nothing, it is the default.
Replace this with an option to disable erroring on warning:
-W, --disable-warnings-as-errors
Fixes#26910
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
We still have cases where qemu crashes are not being correctly captured
in the on-screen summary, however they are captured in the final
generated report.
Fixes#26679
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
...instead of GNU binutils to extract DWARF information.
This is now a bit more portable across OS and toolchain.
One bouns is that this nows with on qemu_x86_64.
A few differences are:
() z_mrsh_* which are aliases to handler_no_syscalls() are now
dropped as they are mapped to the same address, so that they
are not counted multiple times.
() Static functions and variables with same names should now be
attributed to the correct source files instead of being
accumulated into the same symbol of one file (e.g. multiple
thread_entry() in kernel tests).
() The totals for ROM and RAM are calculated from the
corresponding sections. Previous script includes the debug
sections as total ROM size which is not entirely correct.
Fixes#22996
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
restore how --only-failed works by allow rebuilds in case of build
errors, however, do not rebuild when --retry-failed is used, which is a
CI usecase and nothing would change in the second iteration.
Fixes#26685
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The `TEXT_SECTION_OFFSET` symbol is used to specify the offset between
the beginning of the ROM area and the address of the first ROM section.
This commit renames `TEXT_SECTION_OFFSET` to `ROM_START_OFFSET` because
the first ROM section is not always the `.text` section.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Updating mock module version to >=4.0.1 as sanitycheck testsuite
might fail in some systems due to old version.
Signed-off-by: Aastha Grover <aastha.grover@intel.com>
When running CMake, then Python3 will be used.
This is detected through FindPython3, with a preference for using the
python or python3 in path, if any of those matches the required Python
minimal version in Zephyr.
It is also possible for users to specify a different Python, as example
by using:
`cmake -DPYTHON_PREFER=/usr/bin/python3.x`
However, when running `west` as native command, then west will be
invoked on linux based on the python defined in:
`west` launcher, which could be: `#!/usr/bin/python3.y`
Thus there could be mismatch in Pythons used for `west` and the python
used for other scripts.
This is even worse on windows, where a user might experience:
```
>.\opt\bin\Scripts\west.exe --version
Traceback (most recent call last):
File "C:\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
...
File "C:\Python37\lib\socket.py", line 49, in <module>
import _socket
ImportError: Module use of python38.dll conflicts with this version of
Python.
```
when testing out a newer Python, but the python in path is still a 3.7.
By importing `west` into zephyr_module.py and by using, as example
`python -c "from west.util import west_topdir; print(topdir())"`
we ensure the same python is used in all python scripts.
Also it allows the user to control the python to use for west.
It also ensures that the west version being tested, is also the version
being used, where old code would test the version imported by python,
but using the west in path (which could be a different version)
If the west version installed in the current Python, and west invocation
is using a different Python interpreter, then an additional help text
is printed, to easier assist users with debugging.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
We only have one use of _binding_compat and it doesn't need self, so
just fold it into _init_compat2binding.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
We deprecated a number of aspects of the DTS binding syntax in Zephyr
2.1. Remove the support for the deprecated syntax. Remove from docs
about the deprecated syntax as well.
Removed reference in release-notes-2.1.rst to legacy_binding_syntax
since that anchor doesn't exist anymore.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
According to our compliance checks, we have 'useless-suppression'
and 'unused-import' on our hands:
W0611: Unused CLoader imported from yaml as Loader
W0611: Unused Loader imported from yaml
I0021: Useless suppression of 'unsubscriptable-object'
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Now that kconfigfunctions.py is loading the EDT object from a pickle
file, I can't find any other reads of the environment variables it was
previously using to do that.
(The CMake variables with the same names are read in different places;
I'm specifically talking about environment variables here.)
Remove the dead stores.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This saves time and avoids the need to pass additional state around in
the environment to recreate the edt exactly.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
We need to save and restore the devicetree data to generate optimized
dependency information later on in the build, in particular during the
final application link.
Make this happen by pickling the EDT object in BUILD_DIR/edt.pickle.
The existence of this file is an implementation detail, so do not add
it to the documentation.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
We have a use case for saving the EDT object to be able to open it up
again later. It would be convenient to be able to do this with the
pickle module from stdlib.
The only thing stopping us from doing that appears to be the open
reference to sys.stderr that's held the edt object even after
EDT.__init__ exits. However, there doesn't seem to be a need to keep
holding on to this object, and in fact it would be a little bit nicer
to drop the reference in case something else (even in the same Python
process that created it originally) wants the EDT object around, but
might want the warn file closed if its refcount zeroes out.
Just drop the reference at the end of __init__ and make EDT._warn()
throw an exception if it's attempted to be used after the constructor
exits.
Make pickle-ability an API guarantee so we can treat any regressions
as bugs going forward.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
I can't see a good reason to be doing this in the Node class's
unit_addr accessor. Move it up to the edtlib initialization so it only
happens once.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Use the C LibYAML parser if available, rather than the Python parser. It
is much faster.
This is a clean and rebased version of PR #20210 by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Co-authored-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Deal with qemu crashes and do not register pass status as the default.
In case we do not have a status, report unknown.
This now captures different states from qemu that were not captured
before.
Fixes#26679
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Recent ST boards embed the new ST-Link probe V3.
It is advertised as "STLINK-V3", update sanitylmib to take it
into account.
In handle function, it is proposed to treat it separately as current
"STM32 STLink" as processing might differ in next future (hla_serial
deprecation).
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Some devices have multiple serial ports, which show as duplicates in the
hardware map. This doesn't work well when using --generate-hardware-map
to regenerate an existing map. E.g. nrf5340pdk_nrf5340_cpuapp by default
prints to the 3rd of 3 devices. If it shows up on /dev/ttyACM0,
/dev/ttyACM1, and /dev/ttyACM2, printout will come on /dev/ttyACM2.
nrf9160dk_nrf9160 also provides 3 devices, but prints to the 1st.
This patch sorts the devices by the serial port and matches multiple
duplicate entries one-to-one to retain the ordering. This way, the
correct device can be given the platform name and the others can be kept
as "unknown" so that --device-testing understands correctly
1) that there is only one device (not 3)
2) where the serial output will come.
Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
test_reporting_testsuite.py: Adding testcases for reporting
functions of Class testSuite.
test_testsuite_class.py: Testcase for add_instances function
conftest.py: Added fixture for instances_fixture
Signed-off-by: Aastha Grover <aastha.grover@intel.com>
Modifying discard_report function to fix the check for
self.discards dictionary in try block. self.discards
is None is dead code which didnot check if the dictionary was
empty. Changed it to if not self.discards.
Signed-off-by: Aastha Grover <aastha.grover@intel.com>
- Report build errors as errors, not test failures
- Do not try and build/run tests with build failures
- Fix issue with empty reports when running --only-failed
- Report build errors in the detailed and target reports
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
BOSSAC uses a bootloader, so pull the flash address from DeviceTree or
the config and use if the version of BOSSAC supports offsets.
Signed-off-by: Michael Hope <mlhx@google.com>
BOSSA 1.7 has built-in bootloader offset handling while 1.9.1
requires the user to supply the offset. Add support for both by
sniffing the help output and warn the user if the flags needs adding.
Related to #22062
Signed-off-by: Michael Hope <mlhx@google.com>
This commit creates a list of a phony targets for each runner, that is:
`west_flash_depends`, `west_debug_depends`, and so on.
Those targets has identical dependencies as CMake runner target.
flash, debug, debugserver, attach targets.
As example `ninja flash` correctly ensures dependencies are taken into
consideration before calling `west flash`.
Unfortunately, calling `west flash` directly would not re-run the flash
dependencies, cause `west flash` would only build the default CMake
target.
Now, `west flash` calls the phony `west_flash_depends` target, ensuring
all deps are up-to-date before flashing (unless --skip-rebuild is given)
The same is true for the other mentioned runners.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Missed the case we use in CI where we pre-generate the testcase list and
load it, this was resulting in empty test reports in CI.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
test_testinstance.py: Add testcases to scan file and path for
sub testcases
test_data/testcases: Also added the ztest test files
test_testsuite_class.py: changed get_all_tests() to match
count of sub testcases in ztest files
Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
While testing the warnings in scan_file() format is not the same
everytime we run tests
Added sorted with reverse flag so that warnings are same for
every run
Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
BT simulator tests run standalone and independent of sanitycheck and
might be triggered by tests that are not managed by sanitycheck, so
leave it alone.
Fixes#26508
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Just changes to the west help output; no functional changes expected.
Make option descriptions lowercase to match the argparse module's
conventions. When multiple sentences are required, move them to parser
prolog/epilog or argument group description sections.
Clarify some points that have confused multiple people.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
If we pass --west-flash with no additional argument that was getting
treated the same as if it wasn't passed at all.
Change the check to be based on 'None' to handle the bare --west-flash
case properly.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
classname in the junit report was not being used correctly since the
beginning. We had the targetname in the classname and put all results in
1 single testsuite.
The new output add 1 single testsuite for each platform and simplifies
the classname so that tests of the same classname can be grouped in
output, producing readable reports.
The current output can be seen here:
https://testing.zephyrproject.org/daily_tests/zephyr-v2.2.0-2533-gdbbf834605/report/index.html
This should much better once we have this change in.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
In some cases we were not handling return code correctly and evaluating
timeouts as a pass. Report failure correctly.
Fixes#26065
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Move the --erase option to core.py from nrfjprog.py and jlink.py,
where it is currently supported.
Using the RunnerCaps option enforcement mechanism introduced earlier,
enforce that it will only be given to runners that support it.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Require all implementations to provide a do_create(), a new
ZephyrBinaryRunner abstract class method, and make create() itself
concrete.
This allows us to enforce common conventions related to individual
runner capabilities as each runner provides to the core via
RunnerCaps.
For now, just enforce that:
- common options related to capabilities are always added, so runners
can't reuse them for different ends
- common options provided for runners which don't support them emit
sensible error messages that should be easy to diagnose and support
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
We can just call super() instead of super(MyClassName, self). The
original extra verbosity is likely due to old habits of mine from
Python 2 which are no longer necessary, but got copy/pasted around.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
For iterable areas defined with Z_STRUCT_SECTION_ITERABLE(),
the corresponding output section in the linker script is just
boilerplate. Add macros to make these definitions simpler.
Unfortunately, we have a fair number of iterable sections not
defined with Z_STRUCT_SECTION_ITERABLE(), this patch does not
address this.
The output sections are all named <struct name>_area, update
sanitylib.py with this.
sys_sem with no userspace, and k_lifo/k_fifo are special cases
where different data types that are all equivalent need to be
put in the same iterable area. Add
Z_STRUCT_SECTION_ITERABLE_ALTERNATE() for this special case.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The argparse module, by default, complains about non-defined
arguments. This prevents passing arguments prefixed with '-'
or '--' to the target script (e.g. calling another Python
script using argparse). This changes the misc-flasher script
so that any arguments not recognized by west will be passed
to the target script.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The start_addr attribute of Stm32flashBinaryRunner is an integer. It
must be converted to a string before being concatenated with a colon and
the (already converted to a string) size to erase or write.
Signed-off-by: Grzegorz Szymaszek <gszymaszek@short.pl>
Disables the Debug-Access-Port of the microcontroller after flashing.
If not disabled, the DAP consumes ~1.6mA until the debugger disables it
or a hard power cycle is applied.
The DAP is typically automatically disabled after flashing, but if other
instances of JLink software are running (not connected), it will not be.
The added command resets the value of the CTRL/STAT register of the DAP.
This clears the CSYSPWRUPREQ and CDBGPRWUPREQ bits, leaving the debug
hardware free to power off the appropriate hardware. In no way does it
hinder the ability to later connect to the device for debugging.
This resolves the jlink portion of #26139
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add warning about enabling the options below so that users are
aware that this is a security risk.
- CONFIG_BT_DEBUG_SMP
- CONFIG_BT_DEBUG_KEYS
- CONFIG_BT_OOB_DATA_FIXED
- CONFIG_BT_USE_DEBUG_KEYS
- CONFIG_BT_STORE_DEBUG_KEYS
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
test_testsuite_class.py: Added testcases for load_From_file and
apply_filters functions of Class Testsuite.
conftest.py: Modified class_testsuite fixture to create the
outdir as temporary directory which gets deleted after execution
of testcases.
test_data/sanitycheck.csv: load_from_file function uses this
customized file to load the failed or last run testcases.
test_data/sanitycheck_keyerror.csv: file used by
test_load_from_file function to raise the appropriate error
if there is a keyerror.
scripts/requirements-build-test.txt: added mock & csv python libraries
Signed-off-by: Aastha Grover <aastha.grover@intel.com>
test_testsuite_class.py: Added testcases for add_configurations(),
get_all_testcases(), get_toolchain() and get_platforms() functions
test_data/board_config: board root directory for all board
configurations. This is also to add the platform configurations
in a list which is used for further testing.
conftest.py: Added fixtures for all_testcases_dict (returns a
dictionary of testcases) and platforms_list (returns a list of
all platforms using add_configurations function).
Signed-off-by: Aastha Grover <aastha.grover@intel.com>
Convert the description comment at the top of the file to a
documentation string. That string then maybe viewed with the --help
argument. Also, rework a bit the documentation string: remove usage,
since that is provided by the help message of the argparse module.
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
MCMUMGR file system management is discouraged in production, just
adding it to the recommendation list.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Remove Kconfig, linker script, and related bits associated with
CUSTOM_RODATA_LD, CUSTOM_RWDATA_LD, CUSTOM_SECTIONS_LD,
SOC_NOINIT_LD, SOC_RODATA_LD, and SOC_RWDATA_LD options that have been
deprecated since Zephyr 2.2.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Convert the description comment at the top of the file to a
documentation string. That string then maybe viewed with the --help
argument. Also, rework a bit the documentation string.
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
This commit introduces the possibility of adding dependencies between
Zephyr modules to ensure that a Zephyr module on which other modules
depends is processed first.
The dependency chain is ordered using a topological sort.
This allows to add dependencies to a zephyr/module.yml as:
build:
cmake: .
depends:
- fatfs
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
* add the runner script for metaware debugger(mdb).
* mdb is required for SMP case
* mdb also can provides a GUI interface
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
Prior to addition of schema validation running sanitycheck
--generate-hw-map would preserve the value of any field in an existing
map that it didn't update. These fields now cause a parsing error.
Add notes as an optional key where information relevant to the board
can be added to provide useful context (such as which serial port
corresponds to the console, or why a non-standard runner is required).
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
probe_id is used as an optional key that overrides id as the source
of board_id when configured to use a runner that is not the default.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
* Tweak west_setup:
- log `west update` to a file to reduce noise in log
- use `west forall` + `git reset` to make sure files are checked out
(this is to handle a possible module cache)
* Output when we start sanity_check. Add a banner for when we run
sanity_check so it's a bit easier to find in console logs
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
test_testinstance.py: Add testcases for check_build_or_run()
create_overlay() and calculate_sizes()
conftest.py: Module for common pytest fixtures
test_data/board_config: Adding test data for board configurations
Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
Now that we are standardizing C99 integer types we can revert the commit
that warned about C99 type usage.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
We now have a low-level function z_dynamic_object_create()
which is not a system call and is used for installing
kernel objects that are not supported by k_object_alloc().
Checking for valid object type enumeration values moved
completely to the implementation function.
A few debug messages and comments were improved.
Futexes and sys_mutexes are now properly excluded from
dynamic generation.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Any data structure declaration tagged with __net_socket will end up
in the kernel object table with type K_OBJ_NET_SOCKET. These all
correspond to objects which are associated with socket file
descriptors and can handle the socket vtable API.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Now we can build up lists of data structures matching a list
of particular tags, with __subsystem being just one case.
Relax searches to also look inside C files, since struct
prototypes may be declared there as well.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Certain types of system call validation may need to be pushed
deeper in the implementation and not performed in the verification
function. If such checks are only pertinent when the caller was
from user mode, we need an API to detect this situation.
This is implemented by having thread->syscall_frame be non-NULL
only while a user system call is in progress. The template for the
system call marshalling functions is changed to clear this value
on exit.
A test is added to prove that this works.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Add test cases that verify various bits and pieces of the legacy
devicetree macros match the new APIs.
Writing these test cases without giving rise to deprecated macro
warnings which might break people's CI if they build with -Werror
requires turning off the __WARN() generation in
devicetree_legacy_unfixed.h. The entire file is deprecated at this
point and must be explicitly enabled with an opt-in Kconfig option, so
there isn't any harm in doing this.
Nevertheless, take a minimally invasive approach to avoiding __WARN()
generation in gen_legacy_defines.py, to avoid the possibility of
breakage. This code is basically frozen anyway, so hacks like this
won't cause maintainability problems since it isn't being actively
maintained.
Use the new tests as fodder for a migration guide from the old API in
the documentation.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Some updates to the reference page for the "core" APIs, and associated
follow-ups in the guides:
- centralize documentation of chosen zephyr nodes in a non-legacy
file, provide a reference to them from the intro page in the guide
- review doxygen docstrings and correct errors for generic APIs
- add introductory text to each section in the API reference
- add missing hardware-specific pages
Documentation for layers built on top of these is mostly left to future
commits, but I do have a smattering of fixes in the guides that I
noticed while I was doing this.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
In step 4 of find_kobjects, use func debug instead of debug_die
to dump debug info to avoid dump wrong info.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
If a test instance from .yaml file was skipped due to being on
a filtered list then there are no entries about it in the
sanitycheck_report.xml for a given platform. This commit fills
instance.results with skipped test cases also for skipped instances so
those test cases are visible when the full report is generated. Tested
for ./tests/kernel/mem_protect/userspace on nrf52dk_nrf52832 where
userspace.gap_filling is filtered out.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
It is now possible to add a list of fixture a platform supports which is
matched to testcases requesting fixtures to be avaiable to be able to
run.
For example:
- available: true
connected: true
id: 0240000026334e450015400f5e0e000b4eb1000097969900
platform: frdm_k64f
product: DAPLink CMSIS-DAP
runner: pyocd
serial: /dev/ttyACM9
fixtures:
- gpio_loopback
Fixes#24943
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Cleanup fixture processing and allow ztest testcases to support
harness_config with fixture definition.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If environment variables ZEPHYR_BASE or NET_TOOLS_BASE are unset, an
incorrect message is printed saying that "it is set, but it is not a
directory":
$ZEPHYR_BASE is unset
$ZEPHYR_BASE is set, but it is not a directory
$NET_TOOLS_BASE is unset, no net-tools found
$NET_TOOLS_BASE set, but it is not a directory
This patch fixes that issue.
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
test_testsuite_class.py: Add testcases for add_testcases function
of testsuite class in sanitycheck.
test_data/testcases/tests & /samples : Testcase root directory
to add all the testcases & to test add_testcases function.
conftest.py: Module for common pytest fixtures, also used for
passing data from one testcase to another.
Note: conftest.py has a class_testsuite fixture where board_root is
defined as the directory which will be added in a separate PR.
Signed-off-by: Aastha Grover <aastha.grover@intel.com>
According to below rule which's from DWARF5 sepc, if the
attribute can't be founded in given DIE, check more entry
associated by DW_AT_abstract_origin.
For the purposes of determining whether a debugging information
entry has a particular attribute (such as DW_AT_name), if
debugging information entry A has a DW_AT_specification or
DW_AT_abstract_origin attribute pointing to another debugging
information entry B, any attributes of B are considered to be
part of A.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
This fix creates class variables SAMPLE_FILENAME & TESTCASE_FILENAME
in Class TestSuite and remove the hardcoded sample.yaml & testcase.yaml
from add_testcases function. This makes testing for sanitylib script
easier so that shippable do not detect the test_data for sanitylib
as actual zephyr testcases.
Signed-off-by: Aastha Grover <aastha.grover@intel.com>
Add cpu time for QEMUHandler because the guest virtual time
in QEMU icount mode isn't host time and it's maintained by
counting guest instructions, we use QEMU process CPU time to
mostly simulate the time of guest OS.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Sometimes QEMU can't handle SIGTERM signal correctly and just
run as normal, in that case kill -9 QEMU process directly and
leave sanitycheck judge the testing result by console output.
For failures caused by other reasons, terminate all releated
processes to avoid CI waits 2 hours and reports timeout.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Add DT_NODE_BY_FIXED_PARTITION_LABEL that given a "label" in any
fixed-partitions map will return the node_id for that partition node.
Add DT_NODE_HAS_FIXED_PARTITION_LABEL that will test if a given
fixed-partitions "label" is valid.
Add DT_FIXED_PARTITION_ID that will return an unique ordinal value for
the partition give a node_id to the partition.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
If we have a fixed-partition on a flash device that is for example on
a spi controller we will not get a binding match currently. This is
because we expect a match between both the compatible and the fact that
fixed-partition node is a decendant of the spi bus.
To address this we treat fixed-partitions as if they are on no bus.
This has the effect of causing a binding match as well as ensuring that
when we process the fixed-partition node we will do anything special to
it because of the bus it happens to be under (for example SPI CS_GPIO
processing).
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Setup node.compats right after we create the Node. This allows access
to the compats information in _bus_node.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Drivers cast the device config_info pointer to a driver-specific
structure. The referenced object is const-qualified; make sure the
cast doesn't inadvertently remove that qualifier.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Catch ImportError whenever a non-standard module import fails from any
runners that do one. Complain at runtime about it if the user actually
needs the runner.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This change enables specific compiler and linker options to be used in
the case that an arch/posix/os.arch.cmake file exists.
Note: os and arch in the above case are evaluations of
CMAKE_HOST_SYSTEM_NAME and CMAKE_HOST_SYSTEM_PROCESSOR.
Otherwise, the existing "generic" compiler and linker flags in
arch/posix/CMakeLists.txt are used.
Additional flags and checks are provided in
arch/posix/Linux.aarch64.cmake.
Added scripts/user_wordsize.py to detect if userspace is 64-bit or
32-bit, which should be consistent with the value of CONFIG_64BIT
for Aarch64 on Linux.
Fixes#24842
Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
We don't need sanitycheck's use of EDT to report warnings, we'll get
them from the build system. So the warnings are just duplication and
noise, thus lets always suppress them.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Usually, we want to operate only on "available" device
nodes ("available" means "status is okay and a matching binding is
found"), but that's not true in all cases.
Sometimes we want to operate on special nodes without matching
bindings, such as those describing memory.
To handle the distinction, change various additional devicetree APIs
making it clear that they operate only on available device nodes,
adjusting gen_defines and devicetree.h implementation details
accordingly:
- emit macros for all existing nodes in gen_defines.py, regardless
of status or matching binding
- rename DT_NUM_INST to DT_NUM_INST_STATUS_OKAY
- rename DT_NODE_HAS_COMPAT to DT_NODE_HAS_COMPAT_STATUS_OKAY
- rename DT_INST_FOREACH to DT_INST_FOREACH_STATUS_OKAY
- rename DT_ANY_INST_ON_BUS to DT_ANY_INST_ON_BUS_STATUS_OKAY
- rewrite DT_HAS_NODE_STATUS_OKAY in terms of a new DT_NODE_HAS_STATUS
- resurrect DT_HAS_NODE in the form of DT_NODE_EXISTS
- remove DT_COMPAT_ON_BUS as a public API
- use the new default_prop_types edtlib parameter
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Even though it is about to be done for sound technical reasons, a
subsequent patch adding access to all device nodes at the last minute
in the 2.3 release is going to be playing a bit of a fast one on
the Zephyr community, especially users of DT_INST APIs.
In particular, instance numbers are currently allocated only to
enabled nodes, but that will not be true soon: *every* node of a
compatible will be allocated an instance number, even disabled ones.
This is especially unfortunate for drivers and applications that
expect singletons of their compatibles, and use DT_INST(0, ...) to
mean "the one enabled instance of my compatible".
To avoid gratuitous breakage, let's prepare for that by sorting each
edt.compat2nodes sub-list so that enabled instances always come before
disabled ones.
This doesn't break any API guarantees, because there basically *are*
no ordering guarantees, in part precisely to give us the flexibility
to do things like this. And it does help patterns that use instances 0
through N-1, including the important singleton case.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
device_api attribute is not at offset 4 but 8 now as name and
config_info has been directly imported into struct device.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The macro iterates through the list of child nodes and invokes provided
macro for each node.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Remove semicolon between instance invocations of DT_FOREACH_IMPL_ and
thus DT_INST_FOREACH. This provides more flexibility to the user. This
requires we fixup in tree users to add semicolon where needed.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Abort if we find tests that are being skipped incorrectly. Tests should
be skipped using ztest_test_skip().
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Originally this only dealt with constant timeouts. Add the ability to
recognize integer parameters and convert them as well.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
These look up tables generalize the compat2enabled map in a way we
will need to make the API more flexible in Zephyr.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Let's get the actual node status, instead of relying on enabled.
Leave enabled in place for gen_legacy_defines.py's sake.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
If a devicetree node doesn't have a matching binding we will at least
populate a common standard set of properties for that node. The list of
standard properties is:
compatible
status
reg
reg-names
label
interrupt
interrupts-extended
interrupt-names
interrupt-controller
This allows us to handle cases like memory nodes that don't have any
compatible property, we can still generate the reg values.
We limit this to known properties as for any other property we can not
fully determine the property type without a binding and thus we can't
ensure the generation for that property is correct or may not change.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit reverts the device tree binding vendor prefix check regular
expression change that was introduced by the following commit:
5b10fac97e
The changed regular expression fails to detect the correctly specified
vendor prefixes in the `vendor-prefixes.txt`.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
While testing sanitycheck classes, found some wrongly initialisized
variables which caused issues, fixed those..
All Test* classes should now be ignored by pytest and should not be
treated as pytest code.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Zephyr uses some defines to provide additional information about the
item being declared. When unrecognized these can confuse the
Coccinelle parser so that it does not apply semantic patches in
situations where they should be applied.
Add a macro file that extends the Coccinelle builtin macro file with
some identifiers that are specific to Zephyr.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
When files were added, matching did not work and we were counting added
files twice. Use sets to make sure we have a unique list of files.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Linux uses for_each in macros that produce loops; Zephyr uses
FOR_EACH. Update the corresponding checks to match Zephyr's spelling.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This takes the linux diffs between
a8c964eacb21288b2dbfa9d80cee5968a3b8fb21 and
16fbf79b0f83bc752cee8589279f1ebfe57b3b6e and applies them to the
Zephyr copy. Three changes did not apply cleanly:
* linux added a comment to the line that enables C99 comments;
Zephyr disallows them.
* linux uses vendor-prefixes.yaml; zephyr uses the older .txt file
* manual addition of colon in a check before BRACKET_SPACE error
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Some API that takes timeouts represented by integral milliseconds
recommended using the K_NO_WAIT and K_FOREVER constants, which are no
longer integers. This script replaces the incorrect arguments with
the corresponding legacy integral value.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
OSX compatibility added bossac runner.
Linux behvaiour is unchanged.
Window is now explicity mentioned as incompatible
Signed-off-by: Brendon Le Comte <brendon.lecomte@gmail.com>
This helper allows setting default Kconfig values based on devicetree
node properties without giving the full path to the node.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This helper allows setting default Kconfig values based on devicetree
node properties without giving the full path to the node.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Use the compat2enabled and label2node maps in the global edt object to
speed up some functions.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
It's a common operation to want to find a node based on its label. Add
a lookup table to make this easier.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
In some cases terminate (SIGTERM) is not enough and we have to kill the
proces (SIGKILL), otherwise the process is stuck forever and taking
hours to complete and finally timeout in CI.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
In some cases we were missing the reason and reporting 'Unknown',
check for failure and set the reason.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Start SOCKS5 proxy in the net-tools Docker image and run MQTT TLS
tests with SOCKS enabled. Since the MQTT TLS server is already
running as of the previous test, start only the danted daemon.
Rely on mosquitto MQTT port being handled by the Docker image
configuration file instead of specifying it on the command line.
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
The default vertical tiling is designed for displays that are rotated 90
or 270 degrees from normal orientation. Devices where pixel data
advances first horizontally then vertically requires horizontally-tiled
data.
Similarly when generating upright text on a row-major-order monochrome
display the most significant bit may encode the pixel at the lowest
horizontal position.
Add options to control horizontal vs vertical tiling, and msb vs lsb
pixel order.
The commit also generates the representation of the glyph in comments at
each row.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Rename internal macros to use Z_ prefix instead of _K..
Those macros were missed when we did the global renaming activities.
Fixes#24645
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
In case of flashing (which is typically used with OpenOCD)
we do reset of the target after programming application binary
in the non-volatile memory.
In case of Elf execution we need to reset the target before
loading Elf sections so that we might be sure our target
is in sane & expected state before we start execution.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Add option --report-suffix to append custom string to all generated
files. This is going to be useful for generating results for a specific
version, i.e. --report-suffix zephyr-v2.2.0-1814-ge737761d23
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Fixes: #24576
The name of the symbolic link would be constructed using the full path
name to the target folder.
This is not needed and caused the issue raised in #24576.
This has been fixed by no longer using the toplevel target directory
in the link name, for example:
Old style: _project_zephyr_workspace_zephyr_include_sys
New style: include_sys
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add a __WARN("Macro is deprecated") to all DT_<COMPAT>_BUS_<BUS> macros
now that all in tree users should have been converted to the new macros.
This is intended to make sure any PRs don't introduce new usages of
these macros.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add a __WARN("Macro is deprecated") to all DT_INST macros now that all
in tree users should have been converted to the new macros.
This is intended to make sure any PRs don't introduce new usages of
these macros.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The variables with the STATIC type aren't read.
The commit 877fc59e30 introduce the read of CMAKE_PROJECT_NAME
which could be defined in CMakeCache.txt file like that:
CMAKE_PROJECT_NAME:STATIC=MyProject
If STATIC type is not managed, the CMAKE_PROJECT_NAME isn't set and
CMake is always force to run again
Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
This option prefers serial device names which are stable
across device plug/un-plug on platforms that support it (currently
just Linux, via /dev/serial/by-id).
This feature is opt-in as not all manufacturers include the
appropriate metadata for udev to generate unique names for their
devices.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Create support for muxed UARTs which are attached to a real
UART and which use GSM 07.10 muxing protocol to create virtual
channels that can be run on top of the real UART.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Fix two issues:
1. The script assumes the default CMake generator build tool
platform is installed. On Linux at least, that's Make instead
of Ninja, but Make might not be installed since Zephyr recommends
Ninja. On Windows, that might be VS Code or nmake.
Calling `cmake -P pristine` instead of `cmake --build <path>
--target pristine` has the benefit of removing the dependency on a
build command, and hence the default generator is not relevant.
2. It also assumes run_cmake() returns control, and therefore pristine
can be run.
However, if the cmake command fails hard (say, due to issue #1
before this patch), run_cmake() throws an exception instead.
Fix that by trying to run the pristine target in a finally block
instead, and adding some manual cleanup steps in case the build
system is in a bad state and pristine fails too.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>
Pass EXTRA_DTC_FLAGS to kconfig so the EDT object we have in
kconfigfunctions can use that to set warn_reg_unit_address_mismatch
properly.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Now that the main Zephyr build system (and the documentation's) no
longer require ZEPHYR_BASE in the environment, the sanitycheck
script's continuing to require this makes less sense.
We can easily find ZEPHYR_BASE starting from a given sanitycheck
script, so let's just do that. Preserve the ability for a user to
override the ZEPHYR_BASE location in the environment as usual for
compatibility.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The patch specification should not be conditional on failing to match
an identifier, as some replaced values are identifiers.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Always generate the comment text specifying a node's path identifier.
Add the DT_ prefix so it matches the actual macro usable from C. This
will make a following patch which adds support for accessing a node's
parent result in a generated header file which is easier to read.
Put the node's path right after "Devicetree node:" in the comment.
This makes the section for that node easier to grep for.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The root node's z_path_id value for the duration of this script
doesn't match the value DT_ROOT is defined to in devicetree.h.
I didn't notice this because the root node's compatible doesn't have a
matching binding in practice, so no macros are generated for it, but
we're about to start looking at node parents explicitly and this is an
issue for that. Fix it so the root node's z_path_id is "N", since
DT_ROOT is the token "DT_N".
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add generation of the following macros:
DT_N_<node-id>_REG_IDX_<idx>_EXISTS 1
DT_N_<node-id>_IRQ_IDX_<idx>_EXISTS 1
This will allow us to use IS_ENABLED() in DT_REG_HAS_IDX and
DT_IRQ_HAS_IDX which matches behavior of other DT_*_HAS_* macros as
well as lets use these with COND_CODE_1.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
When retrying failed tests, make sure we keep old results and only
update those tests that were retried.
Also, remove duplication of code for creating the reports and make the
report function a bit more generic.
sanitycheck.xml is now listing or tests, not only the test application.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This can be used from Kconfig to detect if any enabled nodes of a
compatible are on a bus. This can be useful if a compatible might
appear on multiple buses, to enable them by default from application
code without having to change prj.conf settings depending on what's in
the devicetree.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add generation of the following macros:
DT_N_<node-id>_P_<prop-id>_NAME_<NAME>_EXISTS
DT_N_<node-id>_P_<prop-id>_IDX_<idx>_EXISTS
This will be useful to check availability of named or indexed
property like dmas/dma-names.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
The last user of the .conf file format DTS data has been removed. We
can now remove the generation and associated support for the .conf file.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
If there is an error in the CMake configuration phase (this can happen
if a script run using execute_process() fails, for instance), the
build system is incompletely generated and future attempts to run
'west build' will fail. This manifests in the following error:
Error: could not find CMAKE_PROJECT_NAME in Cache
Whenever we see that the cache exists but this variable is missing,
let's just force CMake to run again. This avoids the error in my
testing and is a bit more user friendly. I've seen multiple users
asking what to do in this situation; the answer is always "just build
it again", so we might as well do it for them.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Due to the use of UTIL_EVAL*() macros, the UTIL_LISTIFY() macro used
by DT_INST_FOREACH(foo) can cause long build errors when there is a
build error in the expansion for "foo". More than a thousand lines of
build error output have been observed for an error in a single line of
faulty C.
To improve the situation, re-work the implementation details so the
errors are a bit shorter and easier to read. The use of COND_CODE_1
still makes the error messages quite long, due to GCC generating notes
for various intermediate expansions (__DEBRACKET,
__GET_ARG_2_DEBRACKET, __COND_CODE, Z_COND_CODE_1, COND_CODE1), but
it's better than the long list of UTIL_EVAL notes.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
breathe v4.15.0 was just released and fixes some compatibility issues
with latest sphinx, the combo works, however with many warnings that we
still need to either fix or whitelist. This is temporary until we are
able to use those new versions.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
dt_int_val, dt_hex_val, and dt_str_val have been deprecated for two
releases and thus are meant to be removed.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add kconfigfunctions that given the property name to an integer type
property will return its value as either an string int or string hex
value.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The board name for the nRF52 DK, so far known as nrf52_pca10040, is
renamed to nrf52dk_nrf52832. Its documentation and all references
to its name in the tree are updated accordingly. Overlay and
configuration files specific to this board are also renamed, to
match the new board name.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Version 3.0.0 release recently break doc build, lock version of sphinx
to something compatible while we upgrade dependencies...
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This function takes a 'label' and returns "y" if an "enabled" node with
such label can be found in the EDT and that node is compatible with the
provided 'compat', otherwise it returns "n".
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Replace timeout parameters that are multiples of MSEC_PER_SEC, or such
a value passed through K_MSEC, with the normalized timeout expression
using whole seconds.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Recent timeout rework reverted the interpretation of the delay
parameter to K_THREAD_DEFINE from a timeout to a count in
milliseconds, although the corresponding parameter in the
k_thread_create() function remains a timeout. Convert timeout
expressions to millisecond durations where necessary.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
if we are changing a test or a sample, there is not need to run
everything, it is enough to just build/run the changed test/sample.
Also, some files have impact on the code and if they are being changed,
do not run fully sanitycheck.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Script to detect if full sanitycheck should run or if we can skip it and
just run the code that actuallt changed (in samples/tests).
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The "net stacks" shell command support was just removed, but
the net_stacks linker section was left around.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
And implement DT_ANY_INST_ON_BUS() in terms of it.
This makes some error messages quite a bit shorter by avoiding
UTIL_LISTIFY(), which has a nasty temper and tends to explode if not
treated gently.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
We are not propagting those options all the way to the device handler
now, fix this by using the suite member in the handler which has those
already.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Fixes: #23872
Relocating Zephyr Unittest CMake package to ensure that
HINTS ${ZEPHYR_BASE} in
find_package(ZephyrUnittest HINTS ${ZEPHYR_BASE}) works correctly when
the package has not been exported to CMake user package registry.
This ensure that the new package functionality is fully backwards
compatible on systems where the package is not exported and ZEPHYR_BASE
is set.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Include build assert macros rework.
Update pip requirements by cbor package required by MCUBoot since
https://github.com/JuulLabs-OSS/mcuboot/pull/674 was merge.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Do not declare VERBOSE as global, instead pass verbosity as argument.
Also get rid of options as global and fix coverage class to not use
global option variable.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
We do not use those arg files anymore, so remove them to avoid
confusion and for the sake of cleanup.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Reorder classes to be on top of loose functions. Move a few globals into
the related classes where they are being used.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This will make it easier for us to test classes and functions without
having arg options in the middle.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
CMake is not returning any error codes on build failures so those go
undetected in some cases. Handle the case where we get no output at all
from cmake and deal with that as a failure.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit includes the following fixes in order to remove environment
setting of ZEPHYR_BASE is west extension commands.
- Build command
west build --pristine will now use the ZEPHYR_BASE variable found
in CMakeCache.txt in the build folder.
This ensures that the pristine command is executed from the same
Zephyr that was used for compilation.
- Board command
The west boards command no longer sets Zephyr base before invoking
cmake -P cmake/boards.cmake
Instead boards.cmake uses find_package(Zephyr) to ensure consistent
behavior with Zephyr samples, so that the detection of Zephyr base is
uniform across CMake commands.
It also changes BOARD_ROOT_SPACE_SEPARATED to BOARD_ROOT in order to
be consistent with existing user documentation.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This command make it possible to use west for first time registration
of a Zephyr config package in CMake.
To register Zephyr as a CMake config package, invoke:
west zephyr-export
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
West utilizes Zephyr base when invoked out-of-tree in order to determine
west topdir.
This commit ensures that zephyr base when invoking west from CMake is
set to current zephyr base.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
With the introduction of ZephyrConfig.cmake all parts of CMake code
should rely on the CMake ZEPHYR_BASE variable instead of the environment
setting.
This ensures that after the first CMake invocation, then all subsequent
invocation in same build folder will use same zephyr base.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
We get the following error:
ValueError: max() arg is an empty sequence
if the compatiable section of the device tree is empty or doesn't exist.
Fix this by havingin max_len get a default value of 0.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Originally reported in #23539 (though that seems to have been another
problem), west flash and friends are dumping stack when used with an
unconfigured runner.
Let's just promote the warning about this to an error. The idea that
this ever could have worked without explicit support has not worked
out in practice, to my knowledge.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
In addition to the existing plain TCP MQTT test, add the same test
with TLS applied. Robert Lubos provided the updated test_cert.h, which
contains the same certificate as in the echo samples.
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
This commit adds basic testcases for sanitycheck tool using pytest.
Coverage for the sanitycheck tool is obtained using coverage tool.
Instructions are included in the README.md in
scripts/tests/sanitycheck directory.
Signed-off-by: Aastha Grover <aastha.grover@intel.com>
When merging files, make sure to remove header rows from each file and
just keep one header. This will stop us from parsing header rows as
tests.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add named exceptions instead of a generic one. Should help point to the
right issue when something goes wrong.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This is joint work with Kumar Gala (see signed-off-by).
This supports a new devicetree macro syntax coming. It's not really
worth mixing up the old and the new generation scripts into one file,
because:
- we aim to remove support for the old macros at some point, so it
will be cleaner to start fresh with a new script based on the old one
that only generates the new syntax
- it will avoid regressions to leave the existing code alone while
we're moving users to the new names
Keep the existing script by moving it to gen_legacy_defines.py and
changing a few comments and strings around. It's responsible for
generating:
- devicetree.conf: only needed by deprecated kconfigfunctions
- devicetree_legacy_unfixed.h: "old" devicetree_unfixed.h macros
Put a new gen_defines.py in its place. It generates:
- zephyr.dts
- devicetree_unfixed.h in the new syntax
Include devicetree_legacy_unfixed.h from devicetree.h so no DT users
are affected by this change.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
If the #address-cells property for a register is 0 than we set the addr
value of the reg to None. Similar, if #size-cells is 0 than we set the
size value to None for the reg.
Fixup kconfigfunctions.py to handle reg.size and reg.addr being None.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This rename is mostly to easy git managment and review so any changes or
the addition of the new gen_defines.py doesn't look like a diff against
the old code if you look at just that commit.
We keep changes to a minimum to just keep things building with the
renamed gen_legacy_defines.py.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This returns the entire logical {name: Node} dictionary which is
currently being accessed element by element via chosen_node(name).
It will be used in a new gen_defines.py for moving the handling of
chosen nodes into C from Python.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
We used the column 'passed' as a boolean to signify pass or fail,
however we do have other states that need to be tracked.
Remove the boolean and use a text field instead that has the status as a
string.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When running 1 specific test, counting was off. Combine functions adding
tests into one and optimize filtering.
Fixes#22270
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
We rename the nRF51 Dev Kit board target (nrf51_pca10028)
to nrf51dk_nrf51422. We update all associated references
in the supportive documentation and all nRF51-related
cofigurations and overlay files in the samples and tests
in the tree.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Split up requirements.txt into several files so that CI tools can
utilize/reference the specific requirements-<FOO>.txt they may need
while keep things in sync with the development. This is to reduce
both time and amount of work CI actions due to python package install.
Create the following groupings:
1. BASE - needed to build or create zephyr images
2. BUILD-TEST - need to run compile/build tests
3. DOC - need to build the docs
4. RUN-TEST - need for runtime testing
5. EXTRAS - optional or useful for development/developers workflow
Also tried to add a comment about what or why a given package is being
pulled in for.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This never needed to be put in a separate gperf table.
Privilege mode stacks can be generated by the main
gen_kobject_list.py logic, which we do here.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Private type, internal to the kernel, not directly associated
with any k_object_* APIs. Is the return value of z_object_find().
Rename to struct z_object.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Rather than stuffing various values in a uintptr_t based on
type using casts, use a union for this instead.
No functional difference, but the semantics of the data member
are now much clearer to the casual observer since it is now
formally defined by this union.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
add lstrip function to delete the '\r' char in front of the
serial output from serail readline, because this '\r'
will influence the result match function in harness.py.
Signed-off-by: peng1 chen <peng1.chen@intel.com>
The README file was in need of clarification how to set up the
net-tools Docker image and how the IP addresses were assigned.
mqtt_publisher is also mentioned.
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
With net-tools and the mqtt_publisher sample updated, add support
for running the sample with the network sample test script.
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
This change removes the hardcoded subsystem list in gen_kobject_list.py
favor of marking the relevant driver API structs with the _subsystem
sentinel.
Signed-off-by: Corey Wharton <coreyw7@fb.com>
This change extends the parse_syscalls.py script to scan for a
__subsystem sentinal added to driver api declarations. It thens
generates a list that is passed into gen_kobject_list.py to extend
the subsystems list. This allows subsystems to be declared in the
code instead of a separate python list and provides a mechanism for
defining out-of-tree subsystems.
Signed-off-by: Corey Wharton <coreyw7@fb.com>
Add a function takes a 'label' and returns "y" if we find an
"enabled" node that has a 'nodelabel' of 'label' in the EDT
otherwise we return "n"
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Pad node identifiers to 60 characters. This results in better
alignment in practice than the current value of 40, which is a bit
low.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This too is an attempt to reimplement the previous behavior exactly,
modulo the order in which things are defined.
This is the last function which is calling into the previous
implementation's out_node and node_*_alias() functions, so these can
be removed now.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This is similar to the work already done for regs.
Other than the order in which they appear and comments, the output
before and after this patch should be exactly the same.
We're intentionally leaving some of the helpers in module scope here
to use some of the subroutines elsewhere later on when reworking
write_spi_dev().
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Mirror the change already done to write_regs().
Other than the order in which they appear and comments, the output
before and after this patch should be exactly the same.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Use augmented nodes to print macros grouped by namespace.
Other than the order in which they appear and comments, the output
before and after this patch should be exactly the same.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Group the macros together by namespace rather than putting all the
BASE_ADDRESS macros together and all the SIZE macros together. E.g.,
all the DT_INST_<x> namespace macros for each node now appear
consecutively.
Add a comment making it clear that this output comes from "regs",
since "BASE_ADDRESS" and "SIZE" are not property names.
Other than the order in which they appear and comments, the output
before and after this patch should be exactly the same.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add additional attributes to each edtlib.Node we process, before
calling into the write_foo() routines.
This includes the identifier returned by node_ident(), which is used
as the primary identifier for the node, as well as lists for instance
and aliases nodes, and a catchall list that contains all the other
identifiers in addition to the primary one.
Use this information in a new for_each_ident(node, ident) def that
will be put to use in the various write_foo() routines.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
spi_dev_cs_gpio() takes a Node and returns the chip select GPIO for it.
Having that information available directly from Node is neater, so turn
it into a Node.spi_cs_gpio property instead.
That gets rid of the only public global function in edtlib, which might
make the API design clearer too.
Tested with the sensortile_box board, which uses SPI chip select.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
It's better to allow per-instance EDT configuration than to set a global
variable on the edtlib module. Enable/disable the warning for reg/unit
address mismatches via a flag to EDT.__init__(), instead of via a global
variable. That makes it consistent too.
Another option would be to pass the 'dtc' flags to EDT.__init__(), but
it makes the interface a bit ugly. Maybe if it needs to emulate lots of
other flags later.
Clarify that edtlib itself isn't meant to have any state in the comment
at the top of the module.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Enhance error reporting by returning immediately when the calling
function reports an error.
Signed-off-by: Andrei Laperie <andrei.laperie@intel.com>
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
Return the final return value from Docker script when running echo
client in the container, first for UDP and then TCP, for both IPv4
and IPv6.
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
The header printed at the beginning of every west build is kind of
annoying. Let's remove it and just print the application source
directory at cmake time instead. The build directory and board are
already printed there, anyway, and that's all IDE users will see.
Let's clean up the BOARD to make it say "board" instead. That matches
the west build --board option name a bit more closely and is still
legible.
Likewise, let's not print any west build messages if we're just
incrementally recompiling. That's noisy.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
When checking build directory against cache on windows, certain
corner cases can end up failing the comparison because of case
difference on an otherwise identical path. This can be avoided
by ignoring case on windows.
Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@prevas.dk>
The 'command' command line argument for this flasher is now being
overridden by common code, which attaches the west subcommand name to
this.
Let's just hotfix this by renaming the argument in misc-flasher.
We can revisit the boundary between run_common.py arguments and
runners package arguments after the release.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Try to make it clearer what's going on here.
Suggested-by: Lucian Copeland <hierophect@gmail.com>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This is yet another bug introduced by the move to runners.yaml.
Sigh. I should have tested this better.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This will also make the reason for a following bug fix easier to see.
Update a comment block to include all the work that needs doing.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This makes its true value clearer, and will make a later bug fix patch
easier to understand.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Due to cleanups in west targeted at getting rid of zephyr-specific
code, extension commands can no longer rely on ZEPHYR_BASE being set
in the calling environment at import time (it's still set at run()
time for now, though, to keep west build working).
Add a new helper to make dealing with this easier from west sign.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Refactor the code to support the new runners.yaml file created by the
build system.
Compared to fishing around in the CMake cache, this makes it trivial
to put all the command line arguments to a runner-based command on
equal footing, regardless of if they're defined in the runners package
proper or defined in run_common.py.
This allows board.cmake files to do things like this:
board_set_runner_args(foo
--bin-file=${PROJECT_BINARY_DIR}/my-signed.bin)
While at it, make some other cleanups:
- Stop using the obsolete and deprecated west.cmake module while we're
here in favor of the zcmake.py module which was added to Zephyr a long
time ago. Yikes. I had forgotten this was still here.
- Stop using west.util's wrap function in favor of raw use of
textwrap. The west function splits on hyphens, which is breaking
runner names like "em-starterkit".
- Clean up the --context output a bit
Fixes: #22563
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit updates the section names for memory size calculation in
the sanitycheck script as follows:
1. Remove `_TEXT_SECTION_NAME_2` section, which no longer exists, from
the `rw_sections`.
2. Add `rom_start` section, which mostly contains read-only data such
as the exception vector table, to the `ro_sections`.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
We used to use "em-starterkit" runner for ARC which is
basically heavy-modified "openocd" runner tweaked to
use GDB for loading and starting Elf files.
Now when loading and running Elf files is possible with generic
"openocd" runner we may us it. So we switch and get rid of
"em-starterkit" as well since we no longer need it.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
In some cases especially for on-going development & debugging of real
application it might be useful to load and run not from flash but
from RAM in that case there's one catch: we cannot reset the board
after loading memory with our app.
That's because:
a) RAM we use might be either cleared on reset or might enter
unpredictable state with portion of previously loaded data
being corrupted.
b) Reset vector most probably still point to ROM/flash and so
our current application won't be executed on reset.
So instead of "run reset" command of OpenOCD we'll use
"resume 0x12345678". Where 0x12345678 is our application's
entry-point (which BTW may very well not match beginning of
the .text section or link base).
Now to extract the entry-point we need our application's zephyr.elf
and since we already have a requirement for Elf we may use it for
loading because OpenOCD does it perfectly fine moreover automatically
detecting loaded image type (binary, hex, Elf etc).
And to use that nice feature just add "--use-elf" to west's
command-line for boards that use "openocd" runner. Like that:
----------->8--------------
west flash --use-elf
----------->8--------------
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
To be used in setups with multiple boards attached to the same one
host we need to have an ability to specify precisely which JTAG probe
to use for a particular board.
This is done by passing "ftdi_serial XXX" command to OpenOCD.
And the serial ("XXX") is supposed to be passed from higher level,
typically via west's options. And exactly for that we add another
"openocd" runner option "--serial=XXX" which sets
a Tcl's "_ZEPHYR_BOARD_SERIAL" variable that later gets passed
to OpenOCD's "ftdi_serial" command.
See more discussions on the matter here:
https://github.com/zephyrproject-rtos/zephyr/issues/22543
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Remove 'git-spindle' as there are not users in any scripts or build
system and not references in any of our docs.
Remove 'wheel' as nothing seems to use or need it directly.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The west command line output is not stable and has changed for 0.7.
Match it in zephyr_module.py's check for whether we are in a
workspace.
The real fix is to start using 'west topdir' whenever the west version
is at least 0.7.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The syscall exception frame was stored on the CPU struct during
syscall execution, but that's not right. System calls might "feel
like" exceptions, but they're actually perfectly normal kernel mode
code and can be preempted and migrated between CPUs at any time.
Put the field on the thread struct.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
We only need pyserial python module if we are doing device testing.
Treat it similar to how we treat tabulate module.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The SDK has a new path for x86 gcov, point to the new binary. Also, do
not clean artifacts when running coverage.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The 'command' variable points at a python command object, not a
string. Take its name so the help text for west flash -h correctly
says 'flash' instead of 'debug'.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add a 'deprecation_msg' string/flag to out_dev(). When 'deprecation_msg'
is passed, all generated macros include
__WARN(<deprecation_msg>)
which prints a custom warning if the macro is used.
Meant to be used when improving the output format.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Replace running west command tests in run_ci.sh with a github workflow.
This provides some benefits in that we can run the west command tests on
multiple python versions and host OSes (linux, mac and windows).
Also have the benefit that the tests are only run on modifications to
files in scripts/west_commands/ or scripts/west-commands.yml.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add script for usb backend to receive tracing stream data. This
script, trace_capture_usb.py, is based on pyusb, so install it
correctly before using the script.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Add script to capture tracing stream data with UART backend. This
script is developed based on pyserial, so install it correctly
before using the script.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Since we do interger division to determine how many items are in each
set, its possible we can have bad rounding error and the last set having
a much larger amount of items compared to all other sets.
For example, total = 3740, sets = 300:
per_set = 3740 / 300 = 12.466 = 12
last_set = 3740 - 299 * 12 = 152
So instead of doing simple division, we add on extra item to the early
sets and we've exhausted the rounding error:
num_extra_sets = total - per_set * sets
140 = 3740 - 12 * 300
So the first 140 subsets will have 13 per_set, and the last 160 will
have 12 per_set.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Single-bus warning in python parsing of device tree is suppressed if
this is also suppresed in the device tree compiler.
Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
Change the key function used to sort nodes so that unit addresses, if
present, break ties between sibling nodes. This orders siblings in
increasing order by unit-address in any gen_defines output that is
sorted by ordinal.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This makes the results easier to read, since node output appears in
the same order as the top level comment summarizing the tree.
Reorganize how flash partitions are emitted so they also appear in
dependency order, allowing us to extend the comment at the top of the
file to say that nodes are emitted in that order, along with other
useful information.
Print comments even for nodes that are disabled or have no binding,
to make it clearer that the script considered them and decided not to
output anything for them.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add a script that sets up Docker networking and starts the net-tools
Docker container. If successful, run Zephyr with native_posix and
execute the appropriate net-tools container executable. The proper
net-tools executable and arguments is selected depending on the
basename of the sample directory. This script needs to be updated
if the net-tools Docker image is updated in some incompatible way.
The net-tools directory is assumed to exist at the same level as
the Zephyr base directory, but its location can be set using the
'-N' command line argument. Likewise, '-Z' sets the Zephyr top level
directory.
When stopping Zephyr, go through all child processes since running a
native posix or other variant of Zephyr may cause a hierarchy of
processes to be created.
Fixes: #19540
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
Overlay files were concatenated into single string with no whitespace
between them. If '--extra-args OVERLAY_CONFIG="overlay-1.conf"
--extra-args OVERLAY_CONFIG="overlay-2.conf"' was used, then the result
was OVERLAY_CONFIG="overlay-1.confoverlay-2.conf".
Another thing was that overlay extra args were not properly removed from
the list of regular arguments. As a result we had incorrect list of
overlays and incorrect list of other arguments.
Rework code to extract overlays in loop in a safe manner. Use for that a
list of strings instead of string directly. Join those strings and form
a single OVERLAY_CONFIG argument just before running cmake.
Tested with following testcase.yaml line:
extra_args: ARG1 OVERLAY_CONFIG="overlay-1.conf"
ARG2 OVERLAY_CONFIG="overlay-2.conf"
Before this patch we got:
args = ['OVERLAY_CONFIG="overlay-1.conf"',
'OVERLAY_CONFIG="overlay-2.conf"']
After this patch we get:
args = ['ARG1', 'ARG2',
'OVERLAY_CONFIG="overlay-1.conf overlay-2.conf"']
While at it, fix also regex pattern by removing requirement of double
quotes around value. Match any option value instead and strip both
single and double quotes when match is positive. Tested with:
$ ./scripts/sanitycheck -T samples/hello_world/ -p qemu_x86 \
--extra-args OVERLAY_CONFIG=overlay1.conf '
--extra-args OVERLAY_CONFIG=\"overlay2.conf\" '
--extra-args OVERLAY_CONFIG=\'overlay3.conf\'
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Change the output during CMake configure from
Devicetree configuration written to .../devicetree.conf
Parsing /home/ulf/z/z/Kconfig
Loaded configuration '.../frdm_kw41z_defconfig'
Merged configuration '.../prj.conf'
Configuration saved to '.../.config'
to
Devicetree header saved to '.../devicetree_unfixed.h'
Parsing /home/ulf/z/z/Kconfig
Loaded configuration '.../frdm_kw41z_defconfig'
Merged configuration '.../prj.conf'
Configuration saved to '.../.config'
Kconfig header saved to '.../autoconf.h'
devicetree_unfixed.h is more useful to be aware of than devicetree.conf
(still hoping we can get rid of it at some point), and seeing the
Kconfig header clarifies things to.
"Saved" instead of "written" for consistency. Maybe it could say
"Kconfig configuration" instead of "configuration" too, though it gets a
bit spammy in other contexts where the message shows up.
Updates Kconfiglib (and menuconfig/guiconfig, just to sync) to upstream
revision 061e71f7d7, to get this commit in, which is used to print the
header path:
Return a message from Kconfig.write_autoconf()
Like for Kconfig.write_config() and Kconfig.write_min_config(),
return a string from Kconfig.write_autoconf() with a message saying
that the header got saved, or that there were no changes to it. Can
be handy in tools.
Also make the "no change" message for the various files more
specific, by mentioning what type of file it is (configuration,
header, etc.)
Return True/False from Kconfig._write_if_changed() to indicate if
the file was updated. This also allows it to be reused in
Kconfig.write_min_config().
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Add error checking in zephyr_module.py so that if the user manually
specifies ZEPHYR_EXTRA_MODULES and the list contains something that
isn't in fact a valid module, we scream and die.
This should help with diagnosing module errors.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add a new --check-missing-config-prefix check that looks for references
like
#if MACRO
#if(n)def MACRO
defined(MACRO)
IS_ENABLED(MACRO)
where MACRO is the name of a defined Kconfig symbol but doesn't have a
CONFIG_ prefix. Could be a typo.
Skip MACRO if it is #define'd somewhere, even if it looks like a Kconfig
symbol.
Found e.g. https://github.com/zephyrproject-rtos/zephyr/pull/22195.
Piggyback skipping binary files when grepping for Kconfig symbol
references.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
So that the EDTT tool could be used by this script,
set its path so other scripts could find it
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Only dump data when we are interested in the analysing coverage. By
default just collect the data.
CONFIG_COVERAGE_DUMP is used to control this behaviour.
This will help speed up sanitycheck and will avoid lots of noise in the
log when some tests with coverage enabled failed. Dumping data to
console is also suspected to be one of the reason why qemu hangs in CI.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If 'imgtool' is not found in PATH look for 'imgtool.py' before bailing
out.
This allows adding the mcuboot/scripts directory to PATH and have
'west sign -t imgtool' automatically locate the 'imgtool.py' script.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Add a '--dts-out <file>' flag to gen_defines.py that saves the final
devicetree to <file>, in DTS format, using the new EDT.dts_source
attribute.
Handy to have available as a debugging aid. Unused otherwise.
Also write a dummy <BOARD>.dts_compiled file that tells people to look
at zephyr.dts, for people that might be used to that file. It was
removed in commit 8d8b06978c ("dts: Remove generation of
<BOARD>.dts_compiled").
Fixes: #22272
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Include the "warning: "/"error: " part of the string when wrapping
lines, and consistenly start messages with a capital letter.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Turn the warning for selecting a symbol with unsatisfied dependencies
into an error. The last instance has been fixed (that triggers in CI at
least).
Also remove the warning whitelisting functionality, which was only used
to whitelist that warning. It hasn't been used for anything else in over
a year, so it probably wouldn't be useful to keep. Getting rid of it
makes the script easier to read.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Add an EDT.compat2enabled attribute that maps compatibles to enabled
devicetree nodes that implement them. For example,
EDT.compat2enabled["foo"] is a list of all enabled nodes with "foo" in
the 'compatible' property.
The old Node.instance_no functionality can be implemented in terms of
EDT.compat2enabled, so remove Node.instance_no. EDT.compat2enabled is
more flexible and easier to understand.
Simplify main() in gen_defines.py by using EDT.compat2enabled to
generate the DT_COMPAT_<compatible> existence macros. The behavior is
slightly different now, as DT_COMPAT_<compatible> is generated for
enabled nodes that don't have a binding as well, but that might be an
improvement overall. It probably doesn't hurt at least.
EDT.compat2enabled simplifies the implementation of the new
$(dt_compat_get_str) preprocessor function in
https://github.com/zephyrproject-rtos/zephyr/pull/21560. That was the
original motivation.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This fixes a problem which appeared after bossac version was downgraded
to 1.7 which no longer accepts the -o/--offset parameter. Now the offset
is fed to bossac executable only if it's explicitly provided and not by
default.
Signed-off-by: Kuba Sanak <contact@kuba.fyi>
'type: path' was added to edtlib for completeness in commit 23a5b4963b
("dts: edtlib: Add 'type: path' for path references"). gen_defines.py
crashes if it's ever used though, because it gets confused for a
'type: phandle-array'.
Ignore 'type: path' properties in gen_defines.py, like how
'type: phandle' and 'type: phandles' are currently ignored too.
(Note that gen_defines.py is only one possible user of edtlib.)
Fixes: #22197
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The terminal configuration should not be reset on exit if
sanitycheck's output is being directed to something that mediates the
terminal control, such as a pager. Only do the reset if stdout is
interactive.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Use f-strings instead of .format() to makes all the macro identifier and
multiline comment building easier to read.
f-strings were added in Python 3.6, which is required by Zephyr now.
Convert some
... + "_" + ...
string building to f-strings as well.
f-strings are a bit faster too (because they avoid format()/str()
lookups), though it's not likely to be noticeable here.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Use f-strings instead of .format() to make things more readable. They
were added in Python 3.6, which Zephyr requires now.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Show which dependencies are unsatisfied when symbols don't get their
assigned value.
For example, assume that FOO below is assigned with CONFIG_FOO=y. Note
that BAR, BAZ, and STR = "hmm" are 'n'.
config FOO
bool "foo"
depends on BAR && BAZ && QAZ && STR = "hmm"
config BAR
def_bool n
config BAZ
def_bool n
config QAZ
def_bool y
config STR
def_string "zmh"
This now prints this warning:
warning: FOO (defined at /home/ulf/z/z/Kconfig:10) was assigned the
value 'y' but got the value 'n'. Check these unsatisfied
dependencies: BAR (=n), BAZ (=n), STR = "hmm" (=n). See ...
Fixes: #21888
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Sort by testcase name and path and not by platforms. This way we do not
have the same platform executing on CI system causing failures to
overload.
Right now we have almost all qemu targets executing on 1 or 2 nodes,
causing those systems to be overloaded. Instead of taking the default
sorting by platforms, we now sort by testcases, so the distribution is
more "random", but still reproducible.
Remove the ordering function that would put native_posix in the first
set, it is not being used anymore.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
In some cases the config is already provided for us e.g. when setting
OPENOCD_NRF5_SUBFAMILY. Also it looks like config was always supposed to
be optional (there are checks for it on do_run()).
Signed-off-by: Rihards Skuja <rihardssk@mikrotik.com>
Outer if is checking if the variable is in a list with two options
which means that we can just do an if / else and remove an assignment.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
There are some issues with the behavior when rerunning CMake in an
already initialized build directory:
1. The check for assignments to promptless symbols in configuration
fragments isn't run when reconfiguring, because it only runs if
zephyr/.config doesn't exist
2. As outlined in
https://github.com/zephyrproject-rtos/zephyr/issues/9573, you can
get into situations where zephyr/.config is invalid (e.g. due to
being outdated), but menuconfig/guiconfig can't be run to fix it
3. If kconfig.py fails while merging fragments during reconfiguration,
it will ignore the fragments during the next reconfiguration and use
the existing zephyr/.config instead, because the fragment checksum
is calculated and saved before running kconfig.py
(Footnote: The input configuration file(s) to kconfig.py can be either a
list of configuration fragments, when merging fragments, or just
zephyr/.config, if the merged configuration is up-to-date. The output
configuration file is always zephyr/.config.)
To fix the first two issues, explicitly tell kconfig.py when it's
dealing with handwritten configuration input (fragments), via a new
--handwritten-input-configs flag. This is more robust than checking
whether zephyr/.config exists, which was the old logic.
When dealing with handwritten input, there should be no assignments to
promptless symbols. Assignments to promptless symbols is expected in
zephyr/.config however, because it doubles as configuration output.
When running menuconfig/guiconfig, the input configuration is
zephyr/.config rather than configuration fragments, so this change also
makes sure that menuconfig can always be run as long as zephyr/.config
exists and is up-to-date.
To fix the last issue, only write the checksum for the configuration
fragments if kconfig.py succeeds (which means it wrote a
zephyr/.config).
Also improve naming a bit, add help texts for the command-line
parameters to kconfig.py, and simplify write_kconfig_filenames() by
moving logic into it.
Partial fix for
https://github.com/zephyrproject-rtos/zephyr/issues/9573, without the
part in #issuecomment-469701831. Can still run into issues when e.g.
when CMake files can't make sense of settings.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Timeouts were not reported correctly in the XML file as failures,
causing some confusion in the shippable results.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
It is often needed to run sanitycheck and exclude a specific platform or
multiple platforms. Add an option to provide this using
--exclude-platform. The option can be used multiple times to exclude
multiple platforms at the same time.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Assigning to promptless symbols has no effect.
Previously, the only check was for whether the value assigned to a
symbol matched its final value. This misses cases where a promptless
symbol is assigned to and just happens to get the assigned-to value as
its final value.
Instead, detect whether configuration files are being merged (by
checking if zephyr/.config already exists), and explicitly check for
assignments to promptless symbols in that case. We can't do it when
zephyr/.config already exists (and is being loaded), because it includes
values for promptless symbols as well.
With the no-prompt check moved out, also use a more specific message for
it, and remove stuff related to prompts elsewhere. Shorten messages a
bit at the same time, and add two warn() and err() helpers.
Fixes: #20697
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
generated_dts_board.h is pretty redundant and confusing as a name. Call
it devicetree.h instead.
dts.h would be another option, but DTS stands for "devicetree source"
and is the source code format, so it's a bit confusing too.
The replacement was done by grepping for 'generated_dts_board' and
'GENERATED_DTS_BOARD'.
Two build diagram and input-output SVG files were updated as well, along
with misc. documentation.
hal_ti, mcuboot, and ci-tools updates are included too, in the west.yml
update.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
With timestamps enabled, the log in shippable is very difficult to read,
so remove those and enable them when needed for debugging only.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Using --runtime-artifact-cleanup, the script will now remove all
artifacts of passing tests. This is useful for running sanitycheck on
systems with little disk space.
Fixes#21922
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
out_dev(), etc., as a name is a holdover from before commit 73ac1466fb
("scripts: edtlib: Call nodes "nodes" instead of "devices""). It's
confusing for the same reasons as mentioned in that commit.
Renamings:
- dev_ident() -> node_ident()
- out_dev() -> out_node()
- out_dev_s() -> out_node_s()
- dev_aliases() -> node_aliases()
- dev_path_aliases() -> node_path_aliases()
- dev_instance_aliases() -> node_instance_aliases()
Also clean up comments to talk about nodes instead of devices where it
makes sense.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This guarantees muscle memory will work over multiple runs when the
same boards are connected. (The "nrfjprog --help" output for --ids
does not guarantee an order.)
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Right now, the nrfjprog runner will prompt the user for which board to
use if there are multiple possibilities and the --snr command line was
not given to specify one ahead of time.
Tweak this so it only happens if standard input is connected to a
terminal. This should avoid stalling the process on board farms when
this runner is used in automation.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The create() classmethod should not be doing any I/O -- its only job
is to create the ZephyrBinaryRunner instance. It's currently trying to
figure out what the serial number of the board is, though. Let's defer
that work to do_run(), so it gets handled by run_common's exception
handler.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Catch RuntimeError when calling runner.run() and print a message
instead of dumping stack unless in verbose mode.
This improves the command line interface when runners raise exceptions.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Show how many tests passed out of those that were actually
performed, not including skipped tests (which we also report
a count of)
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
should_write() returns False for properties that are skipped in
write_properties(). Shortens write_properties() a bit.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update menuconfig (and kconfiglib and guiconfig, just to sync) to
upstream revision 424d0d38e7, to get this commit in, which works around
a crash on some macOS Python installations.
menuconfig: Work around crash on resize on some macOS systems
get_wch() has started raising curses.error when resizing the
terminal on some macOS Python installations. Work around for now by
falling back on getch(), which still works.
See https://github.com/ulfalizer/Kconfiglib/issues/84. Needs more
investigation, but I don't have a Mac handy.
Based on https://github.com/ulfalizer/Kconfiglib/pull/85, but with
some more comments.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The
"{" + ", ".join(...) + "}"
pattern is in a bunch of places now. Add an out_dev_init() helper for
it, with the same parameters as out_dev().
Also makes "{" vs. "{ " consistent, picking the first one.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Add a helper function verify_error() to testedtlib.py that takes a DTS
source and verifies that it generates a particular EDTError.
Use it to test the hints that the previous commit added to errors
generated by _slice().
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Show how the element size was calculated in the error message when a
'reg', 'ranges', or 'interrupts' property has the wrong size. This
should help with debugging. Also mention that #*-cells properties come
from the parent node, which can be subtle.
Came up in https://github.com/zephyrproject-rtos/zephyr/issues/21607
(though it seems the comment disappeared).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
dt_chosen_reg() and dt_node_reg() take between 1 and 3 arguments, not
between 1 and 4 arguments. The implicit name argument isn't included in
the count.
These functions implement $(dt_chosen_reg_*) and $(dt_node_reg_*).
Giving the right max argument count makes Kconfiglib generate error
messages that give the location of the call, instead of getting a
cryptic generic Python error.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
pyocd 0.24.0 provides support for more user options.
This enables flashing of additional boards using pyocd.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
stderr from the binary handler (native_posix for example) was redirected
to the logger as errors, this is confusing the console and users, so
remove this.
Fixes#21784
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The _thread_idx_map bitfield which has '1' set for free
thread indexes really needs to live in the
data section reserved for kernel object metadata, as this
is a part of memory that is allowed to shift addresses
between zephyr_prebuilt.elf and zephyr.elf.
However, if an application defines enough static threads
that there are no free indexes, the entire bitfield will
be zeroed and the bitfield will end up in the main BSS
section.
Force this data to always be in the .kobject_data.data
section regardless of its contents.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
If the working directory for a command was missing (usually due to
forgetting to run 'west update'), you'd get a FileNotFoundError
exception along with a cryptic error like
'git' not found
Only catch OSError instead (which is a base class of FileNotFoundError),
and always show the exception message. It makes it clear that it's the
working directory that's missing.
Add some other misc. improvements too:
- Turn stderr output from external commands into a warning instead of
an error
- Add err() and warn() helpers
- Include the command name in messages
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Add binding support for a 'path' property type, for properties that are
assigned node paths. Usually, paths are assigned with path references
like 'foo = &label' (common in /chosen), but plain strings are accepted
as well as long as they're valid paths.
The 'path' type is mostly for completeness at this point, but might be
useful for https://github.com/zephyrproject-rtos/zephyr/issues/21623.
The support is there already in dtlib.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
In some cases, we've seen the output files be truncated when the
python script has been rebuilt into a .pex before running it --
likely due to buffering.
Closing files explicitly is the right thing to do anyway, so let's
do it.
Signed-off-by: Olof Johansson <olof@lixom.net>
The SRAM address and size are currently available as both
DT_SRAM_{BASE_ADDRESS,SIZE} and as CONFIG_SRAM_{BASE_ADDRESS,SIZE} (via
the Kconfig preprocessor).
Use the CONFIG_SRAM_* versions everywhere, and remove generation of the
DT_SRAM_* versions from gen_defines.py.
The Kconfig symbols currently depend on 'ARC || ARM || NIOS2 || X86'.
Not sure why, so I removed it.
It looks like no configuration files set CONFIG_SRAM_* at the moment, so
another option might be to use the DT_* symbols everywhere instead. Some
Kconfig.defconfig.series files add defaults to them though.
Also improve the help texts for CONFIG_SRAM_* to say that they normally
come from devicetree rather than configuration files.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Reorganize write_regs() to reuse more code for *_BASE_ADDRESS and
*_SIZE, and get rid of reg_addr_ident() and reg_size_ident().
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Make sure we close the pipe file handles after we are done, otherwise we
will end up with too many open file descriptors and crash...
Fixes#20974Fixes#21637
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Makes it much easier to inspect them in a different terminal
from where the test was run. These paths tend to be long
anyway, even if relative.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Sanitycheck used to delete the output directory if -n
wasn't used, but now it renamed it. Add a new flag to
enable the old behavior.
Do not use logging for these early messages, logger
hasn't been set up yet.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The code has a lot of sys.exit() calls, but internally these
just raise a special exception. Add a try...finally block
to ensure 'stty sane' is run before leaving the script.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Prior to this all hex files included in a merge would
be printed on every invokation of cmake.
Allow the user to explicitly require this information
by moving the print to a VERBOSE-only cmake message.
Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
We have a collection of python scripts that are part of our build
system. This PR collects docstring comments added to these scripts into
a summary document. Previous references to just the script name in
other documentation are updated to point to this build tool
documentation.
Some of the scripts needed an update to be processed (via include
directives) consistently.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add shields_list_contains Kconfig function which return bool based on
check of shield presence in cmake SHIELD_AS_LIST.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Update Kconfiglib to upstream revision 9c0b562c94 to get this commit in:
Add Kconfig.__init__() helper flag for suppressing tracebacks
Tools that don't use standard_kconfig() currently generate spammy
tracebacks for e.g. syntax errors.
Add a suppress_traceback flag to Kconfig.__init__() for catching
"expected" exceptions and printing them to stderr and exiting with
status 1. Use it to make all tools consistently hide tracebacks.
Use the new flag to hide tracebacks for expected exceptions in
kconfig.py, lint.py, and genrest.py.
Some menuconfig robustness tweaks for wonky terminals are included as
well, and a new feature for customizing .config and autoconf.h header
comments via environment variables.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This is needed when a board needs to be reset using an external commands
or tools that are not part of the flash command. For example, power
reset or by poking a GPIO header on the board using external wiring.
add post_flash/pre_flash to the platform section in the hardware map.
For example:
- available: true
connected: true
id: OSHW000032254e4500128002ab98002784d1000097969900
platform: reel_board
post_script: /tmp/post_flash.sh
pre_script: /tmp/pre_flash.sh
product: DAPLink CMSIS-DAP
runner: pyocd
serial: /dev/ttyACM11
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
It is supported to have a zephyr module that does not have a
module.yml, but zephyr_module.py does not support it and will drop
such modules.
To fix this we add support in zephyr_module.py.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
We have an open request to make the help for the -t option a little
easier. Try to do that without adding too much length to the short
help.
Fixes: #16202
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
For the following devicetree, view 'nested' as being on the bus.
Previously, only 'node' was considered to be on the bus.
some-bus {
compatible = "foo,bus-controller";
node {
nested {
compatible = "foo,device-on-bus";
};
};
};
In practice, this means that a 'bus:' key in the binding for
'foo,bus-controller' will now get matched up to an 'on-bus:' key in the
binding for 'foo,device-on-bus'.
Change the meaning of Node.bus and add two new attributes Node.on_bus
and Node.bus_node, with these meanings:
Node.bus:
The bus type (as a string) if the node is a bus controller, and
None otherwise
Node.on_bus:
The bus type (as a string) if the node appears on a bus, and None
otherwise. The bus type is determined from the closest parent
that's a bus controller.
Node.bus_node:
The node for the bus controller if the node appears on a bus, and
None otherwise
It's a bit redundant to have both Node.bus_node and Node.on_bus, since
Node.on_bus is the same as Node.bus_node.bus, but Node.on_bus is pretty
handy to save some None checks.
Also update gen_defines.py to use Node.on_bus and Node.bus_node instead
of Node.parent wherever the code deals with buses.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
I keep mixing these up, so that's probably a sign that the names are
bad. The root of the problem is that "parent-bus" can be read as both
"this is the parent bus" and as "the parent bus is this".
Use 'bus:' for the bus "provider" and 'on-bus:' for nodes on the bus
instead, which is less confusing.
Support the old keys for backwards compatibility, along with a
deprecation warning.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Add a static method for dumping hardware map and reuse it across the
script reducing duplicated code.
Fixes#21475
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
wdt_install_timeout() was skipped as it installs an ISR-context
callback handler function. The rest are simple wrappers.
Added myself as the maintainer of the syscall handlers. WDT
subsystem appears to not currently have an owner.
Fixes: #21432
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Added support of the Microchip with FTDI serial devices to be able
create a hardware map for them. In the future that hardware map
for the Microchip board will let run automatic Sanitycheck tests on it.
Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
Most bindings look something like this:
title: Foo
description: This binding provides a base representation of Foo
That kind of description doesn't add any useful information, as it's
just the title along with some copy-pasted text. I'm not sure what "base
representation" was supposed to mean originally either.
Many bindings also put something that's closer to a description in the
title, because it's not clear what's expected or how the title is used.
In reality, the title isn't used anywhere. 'description:' on the other
hand shows up as a comment in the generated header.
Deprecate 'title:' and generate a long informative warning if it shows
up in a binding.
Next commits will clean up the 'description:' strings (bringing them
closer to 'title:' in most cases) and remove 'title:' from all bindings.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
timeouts were not reported correctly and we were getting the default
'N/A' in case of a timeout.
Fixes#21438
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When testing with one device and without a hardware map, make sure we
load the temporary map into the suite.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
More changes moving away from using global options and instead using
class variables and parameters.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This function is not used anywhere else now that we use logging module,
so push this into the class where it is being used.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The use of a global options variable is making it very difficult to
create a testsuite for this script, so reduce and push options into
arguments instead.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Drop custom output functions and use logging mode for almost all
reporting. Also log everything into sanitycheck.log so detailed run
information can be inspected later, even if we did not run with
--verbose mode on the console.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Stop using global options and instead use propagated variable.
This is to make testing of sanitycheck easier.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
tabulate: Needed to show list of devices in a well formatted table.
anytree: needed to list testsuite in a tree form.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When something goes bad during the flashing process set the reason
correctly and put the error messages from the flasher into device.log
and display the location of that file instead of an empty handler.log
right now.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move all hardware map generation/usage to a seperate class. This will
make it easier to extend the supported hardware in the future.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If modules announce they have tests, run sanitycheck on those modules.
This will run on first matrix node and as the last step after running
regular testsuite.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Generate options for sanitycheck to run tests and samples in modules.
Use the --sanitycheck-out <file> to generate a file that can be supplied
to sanitycheck on the commandline which will add additional testroots
and boards if the module does contain out of tree boards.
the module.yaml file now accepts the following:
samples:
- path/to/samples
tests:
- path/to/tests
boards:
- path/to/boards
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Now using only Path and PurePath in zephyr_modules.py to handle module
processing.
This make the code cleaner as well as remove an issue where a module
name would become an empty string when module path contained trailing
path separators.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
We need a format code for struct packing that fits in
a pointer value, "I" is fixed at 32-bit.
The conversion of string to pointer value now prints
8 bytes. This works for 32-bit since the leading
4 digits are always zero.
The replaced length check uses sizeof(void *) and not 4.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
It appears that ninja 1.6.0 or greater don't seem to send SIGTERM down
to the child processes and thus we don't terminate correctly. This
causes a hang with renode simulations.
Change terminate call to 'self.try_kill_process_by_pid()' when test
state is updated (i.e. done running with either passed or failed), in
order to explicitly send a SIGTERM to the simulator process before
sending a SIGTERM to ninja.
Refactor the terminate code so we encapsulate the behavior in one place
for a BinaryHandler.
Based on change from Stephanos Ioannidis <root@stephanos.io>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
A property may be optional with a default in a base yaml, then
overridden to be required in a subordinate file. Don't prevent this
by complaining about having a default on a required property.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.
Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.
Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
export compile commands when running with --cmake-only, this can be used
for analysis and coverage statistics.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Fetch HW models from a new west module.
And, remove all pre-west glue which was used to:
* Fetch them in CI
* Validate their vesion
* Modify the include path and link to them
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
This option, if set, will add arguments to CMake whenever a new build
system is being generated.
It doesn't affect other invocations of CMake, such as when cmake(1) is
run in build tool mode to actually compile the application.
See the documentation changes for details.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The ARM Generic Interrupt Controller (GIC) supports multiple interrupt
types whose linear IRQ numbers are offset by a type-specific base
number.
This commit adds a function to automatically fix up ARM GIC interrupts
in order to output a linear IRQ number that is offset by the interrupt
type-specific base number.
For more details, refer to the issue #19860.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Make sure we do enable size tracking with options that depend on the
size of generated binaries to be available.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Shortens main() a bit and makes it easier to read.
Rename write_flash() to write_flash_node(), and let write_flash() be the
top-level function. Also move the looking-up of the /chosen properties
into the the various helper functions themselves, and shorten some names
that are clear in context.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Make the node/ordinal list a part of the header comment to make the
output prettier.
Before:
/*
* Generated by gen_defines.py
*
* DTS input file:
* rv32m1_vega_ri5cy.dts.pre.tmp
*
* Directories with bindings:
* $ZEPHYR_BASE/dts/bindings
*/
/* Nodes in dependency order (ordinal : path): */
/* 0 : / */
/* 1 : /aliases */
/* 2 : /chosen */
/* 3 : /connector */
/* 4 : /cpus */
/* 5 : /cpus/cpu@0 */
/* 6 : /gpio_keys */
/* 7 : /soc */
...
After:
/*
* Generated by gen_defines.py
*
* DTS input file:
* rv32m1_vega_ri5cy.dts.pre.tmp
*
* Directories with bindings:
* $ZEPHYR_BASE/dts/bindings
*
* Nodes in dependency order (ordinal and path):
* 0 /
* 1 /aliases
* 2 /chosen
* 3 /connector
* 4 /cpus
* 5 /cpus/cpu@0
* 6 /gpio_keys
* 7 /soc
* ...
*/
Also move the writing of the top comment and the node comments into
separate functions, to shorten main() and make it easier to follow.
Piggyback some minor comment-related simplifications.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
gcovr is already a dependency in scripts/requirements.txt. The
visualization is different, but the functionality should be the same.
Tested with gcovr 4.2.
Relates to #17626.
Signed-off-by: Christian Taedcke <hacking@taedcke.com>
We now use EDTS and gen_defines.py to generate DTS defines. We
deprecated the old script and defines several releases ago, so lets now
remove them.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Print all tests using a tree structure (depends on anytree module). This
now can be done using --test-tree option.
sanitycheck --test-tree -T tests/kernel/
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Basic tool to help checking Kconfig options against a list of
hardening preferences.
This tool is available as a kconfig target, so to run it:
make/ninja hardenconfig
[Flavio Ceolin: Simplify logic and fix python lint issues]
Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Erroring out for 'status = "ok"' broke backwards compatibility for a
downstream project. Accept it instead.
Maybe the error could be selectively re-enabled later.
The rest of the code only checks for 'status = "disabled"' (like the old
scripts), so no other updates are needed.
(It's a bit weird that we duplicate the property check in base.yaml.
Thinking of including base.yaml implicitly. Could clean things up then.)
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
There is no code to handle __syscall_inline so it is better removing
it from doxygen and checkpatch.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Use the folder the config file is in as an additional search directory
for openocd. This way additional files, like custom debug interface
files can be put in the support folder of a board and the openocd.cfg
can use them.
Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
We were parsing random FAIL messages from the output of test runs ad
testcases and capturing them in the xml output. Now we only parse the
name if it starts with test_.
Fixes#21162
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
gen_syscall_header.py is not longer necessary, it was just creating a
file including syscall.h. This header is now included directly by
gen_syscalls.py.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The blackmagicprobe runner's Python process fails to ignore SIGINT
when it runs GDB from the debug and flash callbacks, which is wrong.
The other runners tend to use run_server_and_client() to properly
handle this, since they start a GDB server and connect to it with a
client. The BMP USB device presents itself as a serial device which
speaks the GDB serial protocol instead, so there's no server/client,
and thus no call to run_server_and_client().
The problem is that blackmagicprobe essentially uses
subprocess.check_call() to start GDB directly, without ignoring SIGINT
in the python process. Easy fix.
Fixes: #21139
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Fixed bug in parsing testnames from source files. We added 1cpu testing
but did not update the regex and we have been passing wrong path to the
glob as well, meaning tests were not parsed at all.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When storing an updated hardware list remove the serial property value
from entries that are not connected, to reduce confusion about exactly
what ttyACM0 is connected to.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Confirm to the user what devices were found and where they are before
starting a long run that might not have found everything it was supposed
to test.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Boards like mimxrt1060_evk are recognized by the scanner through their
USB device which has an ID, but in some cases the board may be
programmed using an external J-Link probe. Support this by adding a
probe_id key that can be added to the yaml dictionary to override the
use of id for this purpose.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Add manufacturer and product identifiers to produce board information
for SiLabs and NXP hardware when using --generate-hardware-map.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit fixes the issue, that --enable-coverage alone did not create
coverage information. It also required to give --coverage-platform.
Now the fallback for coverage-platform to platform works as documented
also for enable-coverage, not only for coverage option.
Signed-off-by: Christian Taedcke <hacking@taedcke.com>
The discard report is now generated for every run as
sanity-out/sanitycheck_discard.csv, the option --discard-report was
dropped.
Fixes#20804
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The interprocessor communication can be based on shared memory.
Allow to declare this memory as with a generic name derived from
chosen declaration.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
This command needs access to DT configuration, but can no longer
access it through BuildConfiguration since
9da1d41a12.
Import edtlib and use that instead.
Fix up some other error handling and output issues while we're here to
make the script's behavior easier to inspect and debug.
Fixes: #20545
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add support for boards that utilize the TI XDS110 like the CC3220SF,
CC3235SF, CC1352R1 and CC26x2R1 LaunchXL boards. The XDS110 can expose
multiple serial endpoints one for the uart device, but another for a
trace buffer. We assume that endpoint 0 will be the UART device.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add setting runner type to jlink for 'J-Link' and openocd for
'STM32 STLink' when generating the hardware map.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This makes the misc-flasher runner usable by passing the build
directory to the underlying tool.
Fixes: #20658
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit relocates the QEMU-specific code that currently resides in
ProjectBuilder.run to QEMUHandler.handle, in order to align with what
other handlers are doing.
For more details, refer to the PR #20573.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
The current QEMUHandler implementation in sanitycheck does not check
for the process exit code and reports "PASS" even when either the QEMU
executable cannot be launched or exited immediately due to an error
(e.g. unsupported machine type, missing file, ...).
This commit adds QEMU process exit code check and error reporting when
the exit code is a non-zero value.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Python 3.5 and earlier do not preserve dictionary insertion order when
iterating over dictionaries, and do not give the same order between
runs. This broke the dtlib and edtlib test suites and made the output
jump around randomly between runs. It also made device INST_<n> numbers
non-deterministic, which broke some code on Python 3.5 (though
hardcoding device instance numbers in the code might be a bit shaky).
Fix it by using collections.OrderedDict instead of plain dict wherever
order matters. This makes the output identical on all supported Python
versions. It also allows testdtlib.py and testedtlib.py to run in CI,
which uses Python 3.5.
Fixes: #20571
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
edtlib is a library, and modifying yaml.(C)Loader directly interferes
with any binding loading in edtlib clients. To avoid that, add a custom
loader for bindings.
Internally, PyYAML does this, which is why defining a separate class
works:
@classmethod
def add_constructor(cls, tag, constructor):
if not 'yaml_constructors' in cls.__dict__:
cls.yaml_constructors = cls.yaml_constructors.copy()
cls.yaml_constructors[tag] = constructor
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
commit 0df4a53107 changed the behavior of
how openocd commands are passed to openocd. We used to add -c to each
command, now the commands are being added without -c causing an error.
This adds "-c" to all commands instead of just passing a list.
Also fixes#20449.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit extends the nrfjprog.py runner script so it adds
support for nRF53. In the wake of the changes done in the
runner script, we extend the testing done in test_nrfjprog.py,
adding the required coverage for the nRF53.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Promote the private z_arch_* namespace, which specifies
the interface between the core kernel and the
architecture code, to a new top-level namespace named
arch_*.
This allows our documentation generation to create
online documentation for this set of interfaces,
and this set of interfaces is worth treating in a
more formal way anyway.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Add API for accessing Electrically Erasable Programmable Read-Only
Memory (EEPROM) devices.
EEPROMs have an erase block size of 1 byte, a long lifetime, and allows
overwriting data on byte-by-byte access.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Update Kconfiglib, menuconfig, and guiconfig to upstream revision
faa1d21998, mostly to get this commit in:
Add public helpers for generating "<name> (defined at ...)" strings
Have Symbol/Choice.name_and_loc return strings like
"MY_SYM (defined at foo:1, bar:2)"
"<choice> (defined at foo:4)"
I've added a function like that in at least four different scripts
now, so that's probably a sign that it's a worthwhile helper.
Clean up the tests/Klocation tests a bit while adding tests.
Use the new helper to simplify kconfig.py a bit. Also clean it up a bit
by removing some unused stuff.
Some other minor improvements are included as well, e.g. to make
menuconfig/guiconfig give more helpful errors on invalid arguments.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Add a cleaned-up version of a script I used to find a bunch of unused
symbols and some other Kconfig issues. It's set up to be run directly,
with few environment dependencies.
West is required, because the checks need to see Kconfig files and
source code from all modules.
Checks so far:
- Symbols that can never be anything but n/empty
- Symbols that look unused
- menuconfig symbols with empty menus
- Symbols only defined in Kconfig.defconfig files
See the help strings for the command-line flags for more information.
Some of these checks could probably be checked in CI later, though the
always-n and unused-symbol checks are a bit heuristic and might need a
lot of whitelisting.
Another reason I want to get this in is to have a clean standalone
reference for how to set up the environment for parsing the Kconfig
files. It's gotten trickier over time.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Turns
edt.required_by(node)
edt.depends_on(node)
into
node.required_by
node.depends_on
which might be a bit more readable.
One drawback is that @property hides that there's some slight overhead
in accessing them, but I suspect it won't be meaningful. Caching could
be added if it ever turns out to be.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Some boards require specific sequences of commands to run which aren't
generally useful for other boards. Add a catch-all runner to handle
these cases.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit refactors kernel and arch headers to establish a boundary
between private and public interface headers.
The refactoring strategy used in this commit is detailed in the issue
This commit introduces the following major changes:
1. Establish a clear boundary between private and public headers by
removing "kernel/include" and "arch/*/include" from the global
include paths. Ideally, only kernel/ and arch/*/ source files should
reference the headers in these directories. If these headers must be
used by a component, these include paths shall be manually added to
the CMakeLists.txt file of the component. This is intended to
discourage applications from including private kernel and arch
headers either knowingly and unknowingly.
- kernel/include/ (PRIVATE)
This directory contains the private headers that provide private
kernel definitions which should not be visible outside the kernel
and arch source code. All public kernel definitions must be added
to an appropriate header located under include/.
- arch/*/include/ (PRIVATE)
This directory contains the private headers that provide private
architecture-specific definitions which should not be visible
outside the arch and kernel source code. All public architecture-
specific definitions must be added to an appropriate header located
under include/arch/*/.
- include/ AND include/sys/ (PUBLIC)
This directory contains the public headers that provide public
kernel definitions which can be referenced by both kernel and
application code.
- include/arch/*/ (PUBLIC)
This directory contains the public headers that provide public
architecture-specific definitions which can be referenced by both
kernel and application code.
2. Split arch_interface.h into "kernel-to-arch interface" and "public
arch interface" divisions.
- kernel/include/kernel_arch_interface.h
* provides private "kernel-to-arch interface" definition.
* includes arch/*/include/kernel_arch_func.h to ensure that the
interface function implementations are always available.
* includes sys/arch_interface.h so that public arch interface
definitions are automatically included when including this file.
- arch/*/include/kernel_arch_func.h
* provides architecture-specific "kernel-to-arch interface"
implementation.
* only the functions that will be used in kernel and arch source
files are defined here.
- include/sys/arch_interface.h
* provides "public arch interface" definition.
* includes include/arch/arch_inlines.h to ensure that the
architecture-specific public inline interface function
implementations are always available.
- include/arch/arch_inlines.h
* includes architecture-specific arch_inlines.h in
include/arch/*/arch_inline.h.
- include/arch/*/arch_inline.h
* provides architecture-specific "public arch interface" inline
function implementation.
* supersedes include/sys/arch_inline.h.
3. Refactor kernel and the existing architecture implementations.
- Remove circular dependency of kernel and arch headers. The
following general rules should be observed:
* Never include any private headers from public headers
* Never include kernel_internal.h in kernel_arch_data.h
* Always include kernel_arch_data.h from kernel_arch_func.h
* Never include kernel.h from kernel_struct.h either directly or
indirectly. Only add the kernel structures that must be referenced
from public arch headers in this file.
- Relocate syscall_handler.h to include/ so it can be used in the
public code. This is necessary because many user-mode public codes
reference the functions defined in this header.
- Relocate kernel_arch_thread.h to include/arch/*/thread.h. This is
necessary to provide architecture-specific thread definition for
'struct k_thread' in kernel.h.
- Remove any private header dependencies from public headers using
the following methods:
* If dependency is not required, simply omit
* If dependency is required,
- Relocate a portion of the required dependencies from the
private header to an appropriate public header OR
- Relocate the required private header to make it public.
This commit supersedes #20047, addresses #19666, and fixes#3056.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(pinctrl-<index> is documented in
Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt in
Linux.)
Add a new Node.pin_states property, derived from any pinctrl-<index>
properties on the node. Node.pin_states holds a list of PinState
objects, where each PinState represents a single pinctrl-<index>
property.
For example, Node.pin_states will have two elements for the 'device'
node below:
device {
pinctrl-0 = <&state_0>;
pinctrl-1 = <&state_1 &state_2>;
pinctrl-names = "default", "sleep";
};
pincontroller {
state_0: state_0 {
...
};
state_1: state_1 {
...
};
state_2: state_2 {
...
};
};
Each PinState holds the list of configurations nodes in
PinState.conf_nodes. For the node above, node.pin_states[1].conf_nodes
will contain the pincontroller/state_1 and pincontroller/state_2 nodes,
for example.
The new functionality isn't used by gen_defines.py yet, so this change
is a no-op in itself, except it adds some error checking for
pinctrl-<index> properties.
If needed, support for #pinctrl-cells and 'pinmux' (not the same thing
as the 'pinmux' properties in Zephyr I think) could be added separately
later. Not sure what belongs in edtlib.py there yet.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Let the user specify these arguments as many times as they want:
--cmd-pre-init
--cmd-pre-load
--cmd-post-verify
This makes it a bit easier to handle scripts that need to do a few
things in a row depending on conditions.
Handle --cmd-pre-init and the port arguments properly in the debug
related targets.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
I'd like to support nRF boards in a more generic way, so make it
optional. We can clean up the STM32 files later if there's a lot of
overlap in their .cfg files.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
None of the splitting logic is needed if 64-bit return
values or parameters fit inside a register.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
We need to pass system call args using a register-width
data type and not hard-code this to u32_t.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit fixes an issue in windows where zephyr_modules.txt contains
a \ as path separator.
This causes issues later when using the path generated by
zephyr_module.txt are used as variables in CMake on windows.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
If we don't have a DTS (like nrf52_bsim) we shouldn't try and create an
EDT, but we still need to call expr_parser.parse to filter testcases.
So move the os.path.exists(dts_path) around the creation of the EDT.
Fixes: #20371
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
If we have something like dma-names we should ended up generating
something like:
DT_ST_STM32_I2S_40015000_RX_DMAS_CONTROLLER_1
This isn't quite what we expect. We should instead get:
DT_ST_STM32_I2S_40015000_RX_DMAS_CONTROLLER
DT_ST_STM32_I2S_40015000_DMAS_CONTROLLER_1
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
nrf52_bsim does not generate any DTS data to be processed by
sanitycheck, skip filtering if we have no dts data.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Device tree nodes have a dependency on their parents, as well as other
nodes. To ensure driver instances are initialized in the proper we
need to identify these dependencies and construct a total order on
nodes that ensures no node is initialized before something it depends
on.
Add a Graph class that calculates a partial order on nodes, taking
into account the potential for cycles in the dependency graph.
When generating devicetree value headers calculate the dependency
graph and document the order and dependencies in the derived files.
In the future these dependencies may be expressed in binding data.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
environment is passed to execution thread and should be available
regardless of SAN being enabled or not.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
sanitycheck now requires yaml.FullLoader to support generating
hardware maps. This feature was introduced in PyYAML 5.1.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Add function that will return 'y' or 'n' if a node pointed to by a
chosen property exists and is enabled.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
All users of dt kconfig symbols for tests and samples are using dt
functions instead so we can remove the support for parsing the
generated file.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add the following functions to allow filtering based on device tree
dt_compat_enabled(compat) - Returns true if a device tree node
compatible matches 'compat' and the node is enabled.
dt_alias_exists(alias) - Returns true if a device tree node exists with
'alias' and the node is enabled.
dt_compat_enabled_with_alias - Returns true if a device tree node
compatible matches 'compat' and the node has 'alias' and the node is
enabled.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Just calls through to concurrent.futures.Executor.shutdown() in the base
class, which has the same signature. Removing it means the base class
version will get used directly.
Fixes this pylint warning:
W0235: Useless super delegation in method 'shutdown'
(useless-super-delegation)
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Fixes this pylint warning:
R0201: Method could be a function (no-self-use)
Could also make it a class method.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
We try to demonstrate some concepts for user mode:
- Multiple logical applications, each with their own memory
domain
- Creation of a sys_mem_pool and assignment to a memory
partition
- Use of APIs like k_queue_alloc_append() which require
thread resource pools to be configured
- Management of permissions for kernel objects and drivers
- Show how application-specific system calls are defined
- Show IPC between ISR and application (using k_msgq) and
application-to-application IPC (using k_queue)
Fixes: #14683
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Multi-line comments were stuck as-is between /* and */ in the generated
header, which looks ugly and confusing e.g. for multi-line
binding/property descriptions.
Use this format for multi-line comments in the header instead:
/*
* First line
* Second line
*
* Line after blank line
*/
Also clean up the output a bit by turning some things that were separate
comments into a single multi-line comment. Add some air and reduce line
lengths too.
Before:
/* Generated by gen_defines.py */
/* DTS input file: hifive1.dts.pre.tmp */
/* Directories with bindings: $ZEPHYR_BASE/dts/bindings */
/* Devicetree node: /cpus/cpu@0/interrupt-controller */
/* Binding (compatible = riscv,cpu-intc): $ZEPHYR_BASE/... */
/* Binding description: This binding describes the RISC-V ...
Some extra lines
for testing */
#define DT_INST_0_RISCV_CPU_INTC 1
After:
/*
* Generated by gen_defines.py
*
* DTS input file:
* hifive1.dts.pre.tmp
*
* Directories with bindings:
* $ZEPHYR_BASE/dts/bindings
*/
/*
* Devicetree node:
* /cpus/cpu@0/interrupt-controller
*
* Binding (compatible = riscv,cpu-intc):
* $ZEPHYR_BASE/dts/bindings/interrupt-controller/...
*
* Description:
* This binding describes the RISC-V CPU Interrupt Controller
*
* Some extra lines
* for testing
*/
#define DT_INST_0_RISCV_CPU_INTC 1
Also tweak Node.description and Property.description in edtlib to be
strip()ed instead of rstrip()ed. There's probably no reason to
preserving leading whitespace in them either.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Use the LibYAML-based yaml.CLoader if available instead of yaml.Loader,
which is written in Python and slow. See
https://pyyaml.org/wiki/PyYAMLDocumentation.
This speeds up gen_defines.py from 0.2s to 0.07s on my system, for
-DBOARD=hifive1. It should also make scripts/kconfig/kconfig.py faster,
because it indirectly uses edtlib via
scripts/kconfig/kconfigfunctions.py.
yaml.CLoader seems to be available out of the box when installing with
pip on Ubuntu at least.
Helps with https://github.com/zephyrproject-rtos/zephyr/issues/20104.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Simplify use of property values that have multiple elements by
providing all of them in an initializer list, in addition to each one
as an enumerated value.
For example if a driver requires a sequence of operations with
instance-specific delays between stages the durations can be specified
with:
delays = <30000 20 45000>;
and the driver can use:
static u32_t delays[] = DT_INST_0_COMPAT_DELAYS;
rather than enumerating the instances. This is particularly useful
when the number of entries in the array varies per instance, in which
case such an initialization is not easily expressed in code.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Replace:
dt_chosen_reg_addr
dt_chosen_reg_size
dt_node_reg_addr
dt_node_reg_size
with:
dt_chosen_reg_addr_int
dt_chosen_reg_size_int
dt_chosen_reg_addr_hex
dt_chosen_reg_size_hex
dt_node_reg_addr_int
dt_node_reg_size_int
dt_node_reg_addr_hex
dt_node_reg_size_hex
So that we get the proper formatted string for the type of symbol.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
save_reports should be one of the last tasks executed because it
closes the log file. Withouth it, other functions that use debug
functions like info and error will try to write into a close file.
This fixes the following problem:
sanitycheck -x=USE_CCACHE=0 -p native_posix -T samples/hello_world/ -b
-N --log-file sanity.log
JOBS: 8
Building initial testcase list...
1 test configurations selected, 0 configurations discarded due to filters.
Adding tasks to the queue...
total complete: 1/ 1 100% skipped: 0, failed: 0
1 of 1 tests passed (100.00%), 0 failed, 0 skipped with 0 warnings in
2.91 seconds
Traceback (most recent call last):
File "./zephyr/scripts/sanitycheck", line 3866, in <module>
main()
File "./zephyr/scripts/sanitycheck", line 3854, in main
suite.summary(options.disable_unrecognized_section_test)
File "./zephyr/scripts/sanitycheck", line 2306, in summary
self.duration))
File "./zephyr/scripts/sanitycheck", line 432, in info
log_file.write(what + "\n")
ValueError: I/O operation on closed file.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Using exact versions for our PyPI dependencies (i.e. requirements.txt
lines that look like "dependency==X.Y.Z") is rude since we're asking
users to install these dependencies outside of any virtual
environment. This causes conflicts with other packages which may
depend on the same things as us.
Use inclusive ordered comparison (>=) release specifiers instead:
https://www.python.org/dev/peps/pep-0440/#inclusive-ordered-comparison
If this causes problems for individual packages, we can refine them
using compatible release specifiers (~=):
https://www.python.org/dev/peps/pep-0440/#compatible-release
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Script to be used when creating a release. For regular releases this can
be called this way:
$ list_issues.py -f issues.md -s 2019-09-01
Will list all closed issues since september 1st, 2019 and will create a
markdown file with all issues that can be added as is to the release
notes.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The lvgl library is configured in some tests to use
the libC malloc to allocate heap. In native_posix this
ends up in the underlying OS heap, which cannot be safely
freed in general when the program finnishes, and
ends up being reported by valgrind as leaked on exit. See
https://github.com/zephyrproject-rtos/zephyr/pull/18471
for a longer discussion.
Instead of trying to fix the leak, let's just accept it
but suppress the errors so it does not confuse other
developers
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Failed unit tests were setting wrong fail string (error instead of
failed) which made unit tests always pass.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Set threads spawned by BinaryHandler dameon, so when the main thread
exits for some unusual reason (e.g SIGINT) the child threads are
automatically killed.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
os.mkdir() is not suitable to create arbitrary directory path (can
create only a subdir of an existing dir, will error out if already
exists), os.makedirs() should be always used in such cases.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Previously, if two bindings had the same 'compatible:'/'parent-bus:'
values, the binding that happened to be loaded last would get used.
Turn it into an error instead. This avoids tricking people into thinking
that bindings get loaded in a defined order.
Maybe overriding bindings could be allowed later, if we need it.
Fixes: #19536
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Simplifies the code a bit.
Looks like the description wasn't rstrip()ed when it came from a
'child-binding:' either. This also indirectly fixes that.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Make sure we cleanup the manifest files at the right spot of the CI
process. When not building a PR, behavior is different.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
A complete overhaul of the sanitycheck script and how we build and run
tests. This new version of sanitycheck uses python for job distribution
and drop use of Make.
In addition to the move to python threading library, the following has
been changed:
- All handlers now run in parallel, meaning that any simulator will run
in parallel and when testing on multiple devices (using
--device-testing) the tests are run in parallel.
- Lexicial filtering (using the filter keyword in yaml files) is now
evaluated at runtime and is no long being pre-processed. This will allow
us to immediately start executing tests and skip the wait time that was
needed for filtering.
- Device testing now supports multiple devices connected at the same
time and is managed using a hardware map that needs to be generated and
maintained for every test environment. (using --generate-hardware-map
option).
- Reports are not long stored in the Zephyr tree and instead stored in
the output directory where all build artifacts are generated.
- Each tested target now has a junit report in the output directory.
- Recording option for performance data and other metrics is now
available. This will allow us to record the output from the console and
store the data for later processing. For example benchmark data can be
captured and uploaded to a tracking server.
- Test configurations (or instances) are no longer being sorted, this
will help with balancing the load when we run sanitycheck on multiple
hosts (as we do in CI).
And many other cleanups and improvements...
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
k_thread_create and K_THREAD_DEFINE both take a delay as the final
parameter. Most uses of K_THREAD_DEFINE pass either `K_NO_WAIT` or
`K_FOREVER`. Ensure that all uses of K_THREAD_DEFINE follow that
practice, and that the runtime k_thread_create calls do so as well.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
k_sleep uses the same underlying thread infrastructure as the other
functions that take timeouts, so the delay should be specified as a
timeout rather than milliseconds.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Sort the functions within the regular expression so they can be
checked more easily.
Remove k_thread_deadline_set as it takes an argument in cycles. (The
one in-tree call to this function was not affected by this error.)
Add missed k_mbox_data_block_get.
Fix an overly ambitious multi-match disjunct that covered some
non-existent functions.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Add support for the report and patch modes so this can be invoked by
coccicheck.
Use PCRE options to make the kernel timeout API identifier rule more
readable. Extend the pattern to new API.
Use rule extends and depends clauses, and pattern disjunction, to
avoid replicating metavariable content.
Hint that using --include-headers may be helpful (some patterns can be
found in static inline functions).
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
With multiple debug probes attached, attempting to launch multiple debug
servers resulted in "OSError: [Errno 98] Address already in use" despite
explicitly setting --gdb-port to unique values.
The issue was caused by the default telnet port: 4444. Adding
--telnet-port parameter allows to explicitly define the address to a
unique value and avoid the socket exception.
Signed-off-by: Rihards Skuja <rihardssk@mikrotik.com>
Node._prop_val() returned too early for non-existent booleans, letting
missing 'required: true' booleans slip through without an error.
Fix it by rearranging the code to always do the 'required' check before
returning.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Requested by Marc Herbert. Makes the output deterministic as long as all
binding directories are within $ZEPHYR_BASE (and a bit less spammy too).
Example output for header:
Before:
/* Directories with bindings: /home/ulf/z/z/dts/bindings */
...
/* Binding (...): /home/ulf/.../arm,v7m-nvic.yaml */
After:
/* Directories with bindings: $ZEPHYR_BASE/dts/bindings */
...
/* Binding (...): $ZEPHYR_BASE/dts/.../arm,v7m-nvic.yaml */
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Some legacy code still passes integer literals in milliseconds as the
value to functions that take a timeout. This usage interferes with
plans to replace the millisecond representation with a more generic
k_timeout_t value. Add a Coccinelle script to convert call sites to
use the proper constants and macros.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
verify_eq() can be used instead of verify_streq(), since
warnings.getvalue() already returns a string.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
With ST boards it is possible to specify the board ID when flashing using
openocd. This is very useful when having multiple devices connected.
This change allows us to address a device directly:
west flash -- --cmd-pre-init "hla_serial 066BFF535254887767174558"
This needs to be called before init, hence the new option.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a 'warn_file' parameter to EDT.__init__() that gives a 'file' object
to write warnings to. Use it to capture and verify warnings generated
for deprecated features in testedtlib.py. This indirectly gets rid of
possibly broken-looking output when running it.
Because any function that writes warnings now needs to use EDT._warn()
(as self._warn()), some functions were moved into the EDT class.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Implement a nice generalization suggested by Bobby Noelte.
Instead of having a generic #cells key in bindings, have source-specific
*-cells keys. Some examples:
interrupt-cells:
- irq
- priority
- flags
gpio-cells:
- pin
- flags
pwm-cells:
- channel
- period
This makes bindings a bit easier to read, and allows a node to be a
controller for many different 'phandle-array' properties.
The prefix before *-cells is derived from the property name, meaning
there's no fixed set of *-cells keys. This is possible because of the
earlier 'phandle-array' generalization.
The older #cells key is supported for backwards compatibility, but
generates a deprecation warning.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Fix a bug where DTS_BINDINGS_DIRS could only have one entry. When
there were more than one entry the command for invoking menuconfig
became corrupted.
This changes the separator of DTS_BINDINGS_DIR from a space to ? so
that the shell does not interpret the space as an argument separator.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit addresses the following portability issues:
1. gen_syscalls incorrectly assumes that the compiler is always GCC.
2. pragma GCC diagnostic push and pop are not supported in GCC < 4.6.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Prompted by an upstream bug report. Nothing in Zephyr triggers this at
the moment, but might as well fix it.
Update Kconfiglib to upstream revision 7d05084b7e, to get this commit
in:
Fix handling of parentheses in macro argument values
As an oversight, there was no check for nested parentheses in macro
arguments, making the preprocessor think the call ended after
'void)' in
def_bool $(success,echo 'void foo(void) { asm inline (""); }' \
| $(CC) -x c - -c -o /dev/null)
This broke the latest linux-next kernels (with a Kconfig error),
starting with commit eb111869301e1 ("compiler-types.h: add
asm_inline definition").
I remember seeing this when going through the C code, but somehow
forgot to put it in. Fix it, and clean up _expand_macro() a bit at
the same time.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Generating generic information for 'type: phandle-array' properties in
edtlib was difficult due to defining phandle-array as just a list of
phandles and numbers. To make sense of a phandle-array property like
'pwms', you have to know that #pwm-cells is expected to appear on
each referenced controller, and that the binding for the controller has
a #cells.
Because of this, handling of various 'type: phandle-array' properties
was previously hardcoded in edtlib and exposed through properties like
Node.pwms, instead of through the generic Node.props (though with a lot
of shared code).
In practice, it turns out that all 'type: phandle-array' properties in
Zephyr work exactly the same way: They all have names that end in -s,
the 's' is removed to derive the name of related properties, and they
all look up #cells in the binding for the controller, which gives names
to the data values.
Strengthen the definition of 'type: phandle-array' to mean a property
that works exactly like the existing phandle-array properties (which
also means requiring that the name ends in -s). This removes a ton of
hardcoding from edtlib and allows new 'type: phandle-array' properties
to be added without making any code changes.
If we ever need a property type that's a list of phandles and numbers
but that doesn't follow this scheme, then we could add a separate type
for it. We should check if the standard scheme is fine first though.
The only property type for which no information is generated is now
'compound'.
There's some inconsistency in how we generate identifiers for clocks
compared to other 'type: phandle-array' properties, so keep
special-casing them for now in gen_defines.py (see the comment in
write_clocks()).
This change also enabled a bunch of other simplifications, like reusing
the ControllerAndData class for interrupts.
Piggyback generalization of *-map properties so that they work for any
phandle-array properties. It's now possible to have things like
'io-channel-map', if you need to.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
'Specifier' is devicetree specalese for data associated with interrupts,
GPIOs, etc., e.g. <1 2> and <3 4> in
pwms = <&ctrl-1 1 2 &ctrl-2 3 4>;
It's probably unnecessarily confusing to call it that. Call it 'data'
instead, which is a bit more straightforward.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
edtlib.Device is just a devicetree node augmented with binding
information and some interpretation of properties. Rename it to
edtlib.Node to make that clearer. That also avoids calling things like
flash partition nodes "devices", which is a bit confusing.
I called it edtlib.Device instead of edtlib.Node originally to avoid
confusion with dtlib.Node, but in retrospect it probably makes it more
confusing on the whole. Something like edtlib.ENode might work too, but
it's probably overkill. Clients of edtlib.py only interact with
edtlib.Node, so the only potential for confusion is within edtlib.py
itself, and it doesn't get too bad there either.
Piggyback some documentation nits, and consistently write it
"devicetree" instead of "device tree", to match the spec.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The ESP tool is being executed directly in the esp32 runner,
assuming the tool is executable by itself. However, it would
fail under Windows as subprocess.check_call() cannot execute
Python scripts directly. The fix is to execute the Python
interpreter and passing the script path as a command line
parameter.
Fixes#19098
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
As a slightly hairy but important optimization inherited from the old
scripts, the binding loading code only looks at binding files whose raw
text contains one of the compatible strings from the devicetree. For
such files, a second pass parses the file as YAML and tries to extract a
compatible string, and skips the file if it fails (e.g. due to spurious
text matches in 'include'd binding fragments).
Until now, the binding would always get fully loaded (have 'include'd
files merged in, checks run, etc.) if the second pass managed to extract
a compatible.
Do slightly better by only fully loading the binding if the extracted
compatible from the second pass appears in the devicetree. This gets rid
of unnecessary binding loading in rare cases.
Discovered by test-bindings/deprecated.yaml getting loaded even when
everything that referenced it in test.dts was commented out, because it
happened to mention 'child-binding' in a comment.
Also add a check for YAML errors in the second pass, to be slightly more
robust. Print a warning if a file that isn't valid YAML is found.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
API oversight. This was meant to be there all along together with
Device.parent, for navigating the devicetree, but since a need for it
never came up in gen_defines.py, it got overlooked.
Devices are just devicetree nodes augmented with binding information and
some interpretation of devicetree properties. I wonder if the name
should be changed to something like edtlib.Node to make that clearer.
Calling something like a flash partition a "device" is a bit weird, as
Galak pointed out.
I think I went with Device originally to avoid confusion with
dtlib.Node, but since edtlib users don't directly interact with dtlib,
it might not be that confusing in practice.
Piggyback some documentation clarifications.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The devicetree check in check_compliance.py in ci-tools expects the
dtlib/edtlib test suites to exit with sys.exit() (which raises
SystemExit) on test failures, and interprets Exception as an internal
error in the test suite.
testedtlib.py accidentally raised Exception on test failures, making
check_compliance.py error out and skipping the rest of the tests when
there were failures. Fix it.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Python's Sets are not deterministic. This causes the following lines to
be emitted in random order in generated/syscall_dispatch.c
extern u32_t z_mrsh_k_object_release(u32_t arg1, ...
extern u32_t z_mrsh_k_object_access_grant(u32_t arg1, ...
extern u32_t z_mrsh_k_object_alloc(u32_t arg1, ...
Change noweak to a basic list.
Reproducibility regression introduced by commit 6564974bae
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Deprecate 'sub-node:' and add a more general 'child-binding:' mechanism
to bindings. Keep supporting 'sub-node:', but print a deprecation
warning when it's used.
Like 'sub-node:', 'child-binding:' gives a binding to child nodes, but
the binding is required to be a complete binding, and is treated (and
checked) like a normal binding.
'child-binding:' can in turn contain another 'child-binding:', up to any
number of levels. This is automatic from treating it like a normal
binding, and from the code initializing parent Devices before child
Devices.
This lets nodes give bindings to grandchildren.
For example, take this devicetree fragment:
parent {
compatible = "foo";
child-1 {
grandchild-1 {
...
};
grandchild-2 {
...
};
};
child-2 {
grandchild-3 {
...
};
};
};
The binding for 'foo' could provide bindings for grandchild-1/2/3 like
this:
compatible: "foo"
# Binding for children
child-binding:
title: ...
description: ...
...
# Binding for grandchildren
child-binding:
title: ...
description: ...
properties:
...
Due to implementation issues with the old devicetree scripts, only two
levels of 'child-binding:' is supported for now. This limitation will go
away in Zephyr 2.2.
Piggyback shortening 'description:' and 'title:' in some bindings that
provide child bindings. This makes the generated header a bit neater.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Currently, string values comming from "common" test definition section
and from test-specific section are just concatenated. Suppose, we want
to define some common filter condition, and also per-test additional
criteria. Currently, that leads to following syntax:
common:
filter: TOOLCHAIN_FOO == 1
tests:
sample.net.sockets.http_get.posix:
filter: and not CONFIG_BAR
That's arguable quite adhoc, and the only way to figure it out for
most people will be to add debug logging.
This patch proposes to use the expected syntax (i.e.
"filter: not CONFIG_BAR"), and combine conditions properly based on
their semantic meaning (which also includes parans for proper
evaluation order).
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
For cases like zephyr-test or for other reasons the repo dir might not
be called zephyr. Just use the basename of the dir instead of assuming
its called zephyr.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Instead of
child:
bus: foo
parent:
bus: bar
, have
child-bus: foo
parent-bus: bar
'bus' is the only key that ever appears under 'child' and 'parent'.
Support the old keys for backwards compatibility, with a deprecation
warning if they're used.
Also add 'child/parent-bus' tests to the edtlib test suite. It was
untested before.
I also considered putting more stuff under 'child' and 'parent', but
there's not much point when there's just a few keys I think. Top-level
stuff is cleaner and easier to read.
I'm planning to add a 'child-binding' key a bit later (like 'sub-node',
but more flexible), and child-* is consistent with that.
Also add an unrelated test-bindings/grandchild-3.yaml that was
accidentally left out earlier.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Some DWARF symbols for members of template classes members such as
numeric_limits<unsigned int> reference are static constexpr values
that do not have a data member location. Avoid attempting to
dereference the value for that attribute when it isn't present.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Removed redundant linker flag --coverage from native posix
EXTRA_LDFLAGS.
The correct linker flags will be set by defining the Kconfig flag
CONFIG_COVERAGE, either by sanitcheck it self or via the test/sample
prj.conf.
Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
Some confluence of recent changes resulted in builds with
application-specific bindings being unable to find bindings present in
the system directory. Add quotes and splits as necessary to propagate
multiple directories through the system.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
- Remove unused variables and an unused 'sys' import
- Simplify 'if len(foo) != 0' to 'if foo'. Non-empty lists/dicts/etc.
are truthy in Python.
- Use a raw string to fix this warning:
scripts/footprint/size_report:270:0: W1401: Anomalous backslash
in string: '\.'. String constant might be missing an r prefix.
(anomalous-backslash-in-string)
The issue is that '\.' just happens to work due to not being
recognized as an escape sequence.
Escape sequences are not interpreted in raw strings, so they're safer
for regexes.
- Replace 'is 0' with '== 0'. 'is' is for testing object identity, and
0 isn't guaranteed to be a unique object (but always is in practice).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
As we work on removing the .conf file that is generated by the dt
scripts, mark dt_{int,hex,str}_val functions as deprecated.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Convert how we get the various chosen properties like "zephyr,console"
to use the new kconfig functions like dt_chosen_to_label.
Because of how kconfig parses things we define a set of variables of the
form DT_CHOSEN_Z_<PROP> since comma's are parsed as field seperators in
macros.
This conversion allows us to remove code in gen_defines.py for the
following chosen properties:
zephyr,console
zephyr,shell-uart
zephyr,bt-uart
zephyr,uart-pipe
zephyr,bt-mon-uart
zephyr,uart-mcumgr
zephyr,bt-c2h-uart
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Things that parse generated_dts_board.conf can't deal with entries
like:
DT_GPIO_KEYS_BUTTON_1_GPIOS={"GPIO_0", 14, 256}
so keep them from being added there.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
When a phandle-array (compound) has multiple members generate a define
that says how many there are; generate an initializer for each
individual member; and generate an initializer for the sequence of
members.
This allows drivers that expect multiple values in a compound to process
them without horrendous conditional compilation code attempting to
detect the number of elements in the compound.
It also eliminates the need to repeat the long prefix when initializing
a structure with the fields of a single compound.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
The lowest level output function is the one that determines the full
name of the macro, including DT_ prefix. Return the name of the macro
that provides the value for an identifier so that it can be used in
higher layers of the generator.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Add str2str to make the conversion of a string into a C literal with all
necessary escapes and enclosing double quotes available outside a
function that emits a define.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
System call arguments, at the arch layer, are single words. So
passing wider values requires splitting them into two registers at
call time. This gets even more complicated for values (e.g
k_timeout_t) that may have different sizes depending on configuration.
This patch adds a feature to gen_syscalls.py to detect functions with
wide arguments and automatically generates code to split/unsplit them.
Unfortunately the current scheme of Z_SYSCALL_DECLARE_* macros won't
work with functions like this, because for N arguments (our current
maximum N is 10) there are 2^N possible configurations of argument
widths. So this generates the complete functions for each handler and
wrapper, effectively doing in python what was originally done in the
preprocessor.
Another complexity is that traditional the z_hdlr_*() function for a
system call has taken the raw list of word arguments, which does not
work when some of those arguments must be 64 bit types. So instead of
using a single Z_SYSCALL_HANDLER macro, this splits the job of
z_hdlr_*() into two steps: An automatically-generated unmarshalling
function, z_mrsh_*(), which then calls a user-supplied verification
function z_vrfy_*(). The verification function is typesafe, and is a
simple C function with exactly the same argument and return signature
as the syscall impl function. It is also not responsible for
validating the pointers to the extra parameter array or a wide return
value, that code gets automatically generated.
This commit includes new vrfy/msrh handling for all syscalls invoked
during CI runs. Future commits will port the less testable code.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
When foo.yaml set some property 'required: true' and bar.yaml set the
same property 'required: false', the check for changing
'required: false' to 'required: true' would raise an error for
include: [bar.yaml, foo.yaml]
(with that particular order due to implementation details).
The order files are included in shouldn't matter. To fix it, change the
logic so that 'required' values are ORed together between included files
(so that 'required: true' is always respected), and remove the
'required' true-to-false check when merging included files.
Keep the true-to-false check when merging the (merged) included files
into the main binding (the binding with the 'include:' in it). This
might give a good organization, and the old scripts do it too.
Piggyback two fixes/cleanups:
- 'compatible' should be allowed to appear in included files
- No need to allow an 'inherits' key in _check_binding(), because
it has been removed before then, when merging bindings
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The 'fname' parameter to merge_included_bindings(), giving the path to
the top-level binding file, was accidentally shadowed in the
'for fname in fnames:' loop. This could lead to the wrong filename being
used in error messages.
Discovered via this pylint warning:
scripts/dts/extract_dts_includes.py:225:12: R1704: Redefining
argument with the local name 'fname' (redefined-argument-from-local)
Improve naming a bit to fix it.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
'a < b and b < c' can be simplified to 'a < b < c' in Python.
Fixes this pylint warning:
R1716: Simplify chained comparison between the operands
(chained-comparison)
Fixing pylint warnings for a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Fixes this pylint warning:
R0201: Method could be a function (no-self-use)
Another option would be to turn them into regular functions, but that'd
be a bigger change.
Piggyback a small ElfHelper.error() improvement: Passing a string to
sys.exit() prints it to stderr and exits with status 1.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Except for a few special properties like 'interrupts' and '#size-cells',
require all devicetree properties on nodes with bindings to be declared
in the binding.
This will help catch misspellings, and makes refactoring and cleanups
safer.
Suggested by Peter A. Bigot.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
When we have multi-level (ie chained interrupt controllers) Zephyr has a
schemee to encode the multi-level and IRQ values along the level's into
a single 32-bit value. This is the "IRQ" value expected by Zephyr APIs.
The encoding scheme is documented here:
doc/reference/kernel/other/interrupts.rst
Update the device tree generation to walk the interrupt levels and
generate the expected encoded value for the IRQ.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Put a type check in the offending method.
Now any scalar will be put in a list for
compatibility with following code.
Signed-off-by: Olle Norelius <norelius.olle@gmail.com>
Update Kconfiglib (and menuconfig/guiconfig, just to sync) to upstream
revision f2ce282eca, to get this commit in:
Allow preprocessor user functions to access the parsing location
Just requires making Kconfig.filename/linenr public.
'lineno' would be a more standard name, but be consistent with
MenuNode.linenr.
This can be used to give friendly errors in
scripts/kconfig/kconfigfunctions.py, e.g. for
https://github.com/zephyrproject-rtos/zephyr/pull/18752.
Some minor optimizations are included too.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
For missing optional properties, it can be handy to generate a default
value instead of no value, to cut down on #ifdefs.
Allow a default value to be specified in the binding, via a new
'default: <default value>' setting for properties in bindings.
Defaults are supported for both scalar and array types. YAML arrays are
used to specify the value for array types.
'default:' also appears in json-schema, with the same meaning.
Include misc. sanity checks, like the 'default' value matching 'type'.
The documentation changes in binding-template.yaml explain the syntax.
Suggested by Peter A. Bigot in
https://github.com/zephyrproject-rtos/zephyr/issues/17829.
Fixes: #17829
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
pylint does not like how this library works and generates spurious
warnings like
scripts/ci/get_modified_tests.py:55:13: E1121: Too many positional
arguments for function call (too-many-function-args)
scripts/ci/get_modified_tests.py:57:13: E1123: Unexpected keyword
argument '_tty_out' in function call (unexpected-keyword-arg)
These warnings are useful enough to want to have enabled in the upcoming
pylint CI check, so suppress them here.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Fixes this pylint warning:
Comparison to True should be just 'expr' (singleton-comparison)
Getting rid of pylint warnings for a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Non-empty sequences are truthy in Python, so len() can be skipped in
tests.
Fixes this pylint warning:
scripts/gitlint/zephyr_commit_rules.py:115:11: C1801: Do not use
`len(SEQUENCE)` to determine if a sequence is empty
(len-as-condition)
Fixing warnings for a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Promote a handy and often-overlooked sys.exit() feature: Passing it a
string (or any other non-int object) prints it to stderr and exits with
status 1.
See the documentation at
https://docs.python.org/3/library/sys.html#sys.exit.
This indirectly prints some errors to stderr that previously went to
stdout.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Instead of
properties:
compatible:
constraint: "foo"
, just have
compatible: "foo"
at the top level of the binding.
For backwards compatibility, the old 'properties: compatible: ...' form
is still accepted for now, and is treated the same as a single-element
'compatible:'.
The old syntax was inspired by dt-schema (though it isn't
dt-schema-compatible), which is in turn a thin wrapper around
json-schema (the idea is to transform .dts files into YAML and then
verify them).
Maybe the idea was to gradually switch the syntax over to dt-schema and
then be able to use unmodified dt-schema bindings, but dt-schema is
really a different kind of tool (a completely standalone linter), and
works very differently from our stuff (see schemas/dt-core.yaml in the
dt-schema repo to get an idea of just how differently).
Better to keep it simple.
This commit also piggybacks some clarifications to the binding template
re. '#cells:'.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
A bare 'except:' can do some annoying stuff like eat Ctrl-C (because it
catches KeyboardInterrupt). Better to use 'except Exception:' as a
catch-all.
Even better might be to catch some more specific exception, because even
'except Exception:' eats stuff like misspelled identifiers.
Fixes this pylint warning:
W0702: No exception type(s) specified (bare-except)
Fixing pylint warnings for a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Doesn't use 'self'. Fixes this pylint warning:
scripts/dts/edtlib.py:272:4: R0201: Method could be a function
(no-self-use)
Fixing pylint warnings for a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Having backwards compatibility for !include and 'constraint:' is silly
without also having backwards compatibility for 'category:', because
that forces a binding change anyway.
Add backwards compatibility for 'category:', and just print a
deprecation warning when it's used.
Also move tests for deprecated features into a dedicated
test-bindings/deprecated.yaml binding, instead of piggybacking on other
tests.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Suppress this pylint warning so that it can be enabled in the upcoming
CI check. The code is safe.
scripts/dts/dtlib.py:1904:13: W0631: Using possibly undefined loop
variable 'i' (undefined-loop-variable)
Also add some more comments to clarify _init_tokens().
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
"\w" gives a two-character string, but is iffy, because it relies on \w
not being defined as an escape sequence. r"\w" is better.
Fixes this pylint warning:
scripts/dts/devicetree.py:134:0: W1401: Anomalous backslash in
string: '\w'. String constant might be missing an r prefix.
(anomalous-backslash-in-string)
Wondering if I should exclude the old DTS scripts from the pylint CI
check, but doesn't hurt to fix it at least.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Move some property fetching and node deletion code from the DT class
over to the Node class. Reads pretty nicely, and indirectly gets rid of
two unused 'self' arguments.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Fix pylint warnings for bad indent, redundant len()s in conditionals,
tests that could be improved with 'in', methods that don't use 'self',
and type()s where isinstance() is more common.
Preparation for adding a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Have
include: foo.dts
include: [foo.dts, bar.dts]
instead of
inherits:
!include foo.dts
inherits:
!include [foo.dts, bar.dts]
This is a nicer and shorter and less cryptic syntax, and will make it
possible to get rid of the custom PyYAML constructor for '!include'
later.
'inherits: !include ...' is still supported for backwards compatibility
for now. Later on, I'm planning to mass-replace it, add a deprecation
warning if it's used, and document 'include:'. Then the '!include'
implementation can be removed a bit later.
'!include' has caused issues in the past (see the comment above the
add_constructor() call), gets iffy with multiple EDT instances, and
makes the code harder to follow.
I'm guessing '!include' might've been intended to be useful outside of
'inherits:' originally, but that's the only place where it's used. It's
undocumented that it's possible to put it elsewhere.
To implement the backwards compatibility, the code just transforms
inherits:
!include foo.dts
into
inherits:
- foo.dts
and treats 'inherits:' similarly to 'include:'. Previously, !include
inserted the contents of the included file instead.
Some more sanity checks for 'include:'/'inherits:' are included as well.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The 'category: required/optional' setting for properties is just a
yes/no thing. Using a boolean makes it clearer, so have
'required: true/false' instead.
Print a clear error when 'category:' is used:
edtlib.EDTError: please put 'required: true' instead of 'category:
required' in 'properties: foo: ...' in
test-bindings/sub-node-parent.yaml - 'category' has been removed
The old scripts in scripts/dts/ ignore this setting, and only print a
warning if 'category: required' in an inherited binding is changed to
'category: optional'. Remove that code, since the new scripts already
have the same check.
The replacement was done with
git ls-files 'dts/bindings/*.yaml' | xargs sed -i \
-e 's/category:\s*required/required: true/' \
-e 's/category:\s*optional/required: false/'
dts/binding-template.yaml is updated as well.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Add a write_phandle_val_list() function for handling GPIOs, PWMs, and IO
channels. The logic is the same in all cases.
This also indirectly makes pwm-names and io-channel-names work the same
as gpio-names. Previously, they were ignored.
Also add a long explanation with example output.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Use Galak's idea from
https://github.com/zephyrproject-rtos/zephyr/pull/18313 to read the
'properties: compatible: constraint: "foo"' string from bindings in a
more robust way.
First, check if any of the compatible strings are in the file (needed as
an optimization). If any of them are, do a more careful check for the
'properties: compatible: constraint: ...' value matching a compatible,
to filter out false positives from comments and the like.
This commit a no-op in itself besides making things a bit more robust,
but it'll make later work easier (supporting multiple compatibles for a
binding, in a dt-schema-like way).
Co-authored-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Sanity-checking each !included file separately was inherited from the
old scripts. It makes it messy to check that combinations of fields make
sense, e.g. to check 'const:' or 'default:' against 'type:', since those
fields might come from different files (this is handy, since it makes
sense to just add/change a 'const:' value, for example).
Drop the requirement that each !included file is a complete binding in
itself, and treat them as binding fragments instead. Only check the
final merged binding.
This also means that !included files no longer need to have a
'description:' or 'title:' (those have always been unused for !included
files), so remove those, and add comments that explain what the
fragments are for instead. That should demystify bindings a bit.
Also fix the descriptions of i2c.yaml, i2s.yaml, spi.yaml, and
uart.yaml. They're for controllers, not devices. These are copy-paste
error from the corresponding device .yaml files.
Piggyback some indentation consistency nits in binding-template.yaml.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Similar to edtlib._err(). Just saves a bunch of 'raise DTError'.
Also add tests for some errors from the global to_num() and to_nums()
functions that were untested.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The public DT.get_node() function was used during parsing to look up
paths in references like &{/foo/bar}, along with an ugly
'DT._is_parsing' flag to adapt its behavior (to not mention aliases in
error messages).
Split out common node lookup code needed during parsing and by
get_node() instead, and stop using get_node() during parsing. This
allows '_is_parsing' to be removed and untangles things a bit.
Piggyback some other small reference-related cleanups, and fix an issue
with the filename/linenr being given twice in some error messages.
This commit also removes the index of path components from error
messages, but just the string is probably good enough.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Require either type TYPE_EMPTY ('ranges;') or TYPE_NUMS
('ranges = < 1 2 ... >;').
Putting the check in _check_dt() means it will run for all nodes,
including nodes without bindings, which is handy.
The _split() function already gives a decent error message if 'ranges'
has unexpected length, so skip checking the length.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Deriving the type from looking at Property.val gets awkward e.g. when
there are many types that make Property.val a list. Instead, save the
type as given in the binding in Property.type.
Let Property.type just be a string. This has typo potential, but is nice
and flexible (and easy to print), and errors will probably be pretty
obvious.
Show the type in Property.__repr__() as well. This automatically gives
some test coverage.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Add two new type-checked property types 'phandles' and 'phandle-array'
to edtlib.
'phandles' is for pure lists of phandles, with no other data, like
foo = < &bar &baz ... >
'phandle-array' is for lists of phandles and (possibly) numbers, like
foo = < &bar 1 2 &baz 3 4 ... >
dt-schema also has the 'phandle-array' type.
Property.val (in edtlib) is set to an array of Device objects for the
'phandles' type.
For the 'phandle-array' type, no Property object is created. This type
is only used for type checking.
Also refactor how types that do not create a Property object
('phandle-array' and 'compound') are handled. Have _prop_val() return
None for them.
The new types are implemented with two new TYPE_PHANDLES and
TYPE_PHANDLES_AND_NUMS types at the dtlib level. There is also a new
Property.to_nodes() functions for fetching the Nodes for an array of
phandles, with type checking.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Previously, Property.to_node() would allow assignments like
x = < 1 >;
as long as 1 happened to be a valid phandle. This was deliberate, but
might hide errors, and would make the planned 'phandles' (list of
phandles) and 'phandle-array' (list of phandles and numbers) types a bit
too similar to 'type: array'.
Change Property.to_node() to only accept
x = < &foo >;
This is probably all we need, and if you really need to accept manually
specified phandles, it can be worked around in other ways.
Piggyback some consistency nits in error messages from the
Property.to_*() functions.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The contents of 'sub-node:' was assigned as-is as the binding, bypassing
_check_binding(). This also hid an error in
test-bindings/sub-node-parent.yaml.
Require 'sub-node:' to just have 'properties:' in it, and sanity-check
the properties like for regular bindings.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
We don't want any defines generated for 'status', 'interrupt-parent',
and 'interrupts-extended' properties. So skip them in write_props if
we see them.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add a 'const' property to bindings for any properties that are expected
to have a specifi known value. For example, #address-cells for an I2C
bus should always be '1'. So we can do something like the following in
the I2C bus binding:
"#address-cells":
type: int
category: required
const: 1
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Move the enum checking before we early out for '#' and '-map' properties
so they can benefit from it. Also make the error messages for failed
'enum' check more informative by including the paths to the .dts file
and the binding for the node.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
When guessing the build folder, the current path might not exist at all,
leading to an uncaught exception when trying to list its folders. Fix
this by making sure the path exists at all first.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
A recent developer experience study has pointed out that it's very
common for people to miss that the minimum cmake version required by
zephyr is higher than that which is commonly packaged by Linux
distributions.
Since this is a serious usability issue, it's worth adding extra
checking from zcmake.py to make sure that west commands which run
cmake always print a sensible error message if the cmake version used
is too old. Make that happen.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
When running run_ci.sh locally with:
./scripts/ci/run_ci.sh -l -b master -R upstream/master..
we export BSIM_OUT_PATH unconditionally which causes sanitycheck to fail
on nrf52_bsim (it depends on BSIM_OUT_PATH variable).
Check if the path defined in BSIM_OUT_PATH is available and unset env.
variable if it is not.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Getting slightly subjective, but fixes this pylint warning:
scripts/west_commands/zcmake.py:186:13: R1714: Consider merging
these comparisons with "in" to "type_ in ('STRING', 'INTERNAL')"
(consider-using-in)
Use a set literal instead of a tuple literal, as recent Python 3
versions optimize set literals with constant keys nicely.
Getting rid of pylint warnings for a CI check. I could disable any
controversial ones (it's already a list of warnings to enable anyway).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Empty sequences are falsy in Python, so len() can be skipped.
Fixing pylint warnings for a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Non-empty sequences are truthy in Python, so len() can be skipped.
Fixing pylint warnings for a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Remove a trailing comma that generated a single-element tuple and made
pylint warn:
scripts/west_commands/boards.py:50:8: W0106: Expression
"(parser.add_argument(...), )" is assigned to nothing
(expression-not-assigned)
No functional change.
Fixing pylint warnings for a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
'a < b and b < c' can be simplified to 'a < b < c' in Python.
Fixes this pylint warning:
scripts/gen_kobject_list.py:198:22: R1716: Simplify chained
comparison between the operands (chained-comparison)
Fixing pylint warnings for a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Removing these doesn't change behavior, since the
subprocess.CalledProcessError is just immediately re-raised when caught.
Fixes this pylint warning:
W0706: The except handler raises immediately (try-except-raise)
Fixing pylint warnings for a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
These just pass their arguments through to the base class constructor.
Removing them means the base class constructor gets called directly
instead.
Fixes this pylint warning:
W0235: Useless super delegation in method '__init__'
(useless-super-delegation)
Fixing pylint warnings for a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Should be wrn() instead of warn(). Reported by pylint.
Also remove a {} from the message. It's not being formatted.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Getting slightly subjective, but fixes this pylint warning:
scripts/gen_relocate_app.py:228:38: R1714: Consider merging these
comparisons with "in" to "region in ('data', 'bss')"
(consider-using-in)
Use a set literal instead of a tuple literal, as recent Python 3
versions optimize set literals with constant keys nicely.
Getting rid of pylint warnings for a CI check. I could disable any
controversial ones (it's already a list of warnings to enable anyway).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Fixes this pylint warning:
R0201: Method could be a function (no-self-use)
Another option would be to turn them into regular functions, but that'd
be a bigger change.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
dtlib.py and guiconfig.py do some hackery to build token and image
variable names, which triggers spurious pylint warnings like
scripts/dts/dtlib.py:243:28: E0602: Undefined variable '_T_LABEL'
(undefined-variable)
Suppress the warning for those files. The generated names get used in
lots of places.
Also suppress some warnings in doc/conf.py ('tags' is from Sphinx), and
fix a legitimate issue in scripts/dts/testdtlib.py.
This pylint check is useful enough to want enabled in the upcoming CI
check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Getting slightly subjective, but fixes this pylint warning:
scripts/gen_kobject_list.py:308:11: R1714: Consider merging these
comparisons with "in" to "kobj in ('device',
'_k_thread_stack_element')" (consider-using-in)
Use a set literal instead of a tuple literal, as recent Python 3
versions optimize set literals with constant keys nicely.
Getting rid of pylint warnings for a CI check. I could disable any
controversial ones (it's already a list of warnings to enable anyway).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This is a common Python idiom, and it's easy to look up what the unused
value is in this case if you need to. Fixes this pylint warning:
scripts/west_commands/build.py:227:15: W0612: Unused variable
'origin' (unused-variable)
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
pylint might be afraid that there'd be less than three elements in
'args', but there never is. Fixes this warning:
scripts/kconfig/menuconfig.py:3184:8: W0632: Possible unbalanced
tuple unpacking with sequence: left side has 3 label(s), right side
has 0 value(s) (unbalanced-tuple-unpacking)
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Fixes these pylint warnings:
scripts/sanity_chk/ini2yaml.py:25:22: R1719: The if expression can
be replaced with 'test' (simplifiable-if-expression)
scripts/sanity_chk/expr_parser.py:208:15: R1719: The if expression
can be replaced with 'bool(test)' (simplifiable-if-expression)
scripts/sanity_chk/expr_parser.py:210:15: R1719: The if expression
can be replaced with 'bool(test)' (simplifiable-if-expression)
Also replace a redundant re.compile().match() with re.match(). compile()
doesn't help when re-compiling the regular expression each time through.
(compile() often doesn't help much in general, because the 're' module
caches compiled regexes.)
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
A bare 'except:' can do some annoying stuff like eat Ctrl-C (because it
catches KeyboardInterrupt). Better to use 'except Exception:' as a
catch-all.
Even better might be to catch some more specific exception, because even
'except Exception:' eats stuff like misspelled identifiers.
Fixes this pylint warning:
scripts/gen_gcov_files.py:54:12: W0702: No exception type(s)
specified (bare-except)
Piggyback a formatting nit.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Fixes this pylint warning:
scripts/west_commands/run_common.py:175:12: R1719: The if expression
can be replaced with 'test' (simplifiable-if-expression)
Fixing pylint warnings for a CI check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Reported by pylint's 'bad-whitespace' warning.
Not gonna enable this warning in the CI check, because it flags stuff
like deliberately aligning assignments and gets too cultish. Just a
cleanup pass.
For whatever reason, the common convention in Python is to skip spaces
around '=' when passing keyword arguments and giving default arguments:
f(x=3, y=4)
def f(x, y=8):
...
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update scripts/requirements.txt to use 0.6.2 or later (avoiding 0.6.1
that has an known issue)
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
If a stack is declared with K_THREAD_STACK_EXTERN first, analyze array
in elf_helper.py will ignore this declaration which will be referenced
by the actual instances via the tag DW_AT_specification, so that this
stack can't be detected by the kernel object detection mechanism, and
this will cause userspace not work.
Fixes: #16760.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
The sphinx-tabs extension provides a tabbed interface within documents
that will let us dynamically display information based on a user
selection, for example, for instruction variations based on the user's
development OS (Linux, macOS, Windows).
I'm adding this early so it can get integrated into the CI doc build
before subsequent PRs using this extension are submitted.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
west is yet another python package, so lets add it here. This will
provide us with one single file with all python requirements that can be
used during setup and for example for docker images.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If there is more than one IO Channel than generate a define with a
trailing index for the IO Channel. This matches what we do for GPIOs
and PWMs.
So something like:
DT_FOOBAR_IO_CHANNELS_CONTROLLER_0
DT_FOOBAR_IO_CHANNELS_CONTROLLER_1
...
DT_FOOBAR_IO_CHANNELS_CONTROLLER_<N>
Fixes#18352
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
There is a bug where non-normalized paths can introduce multiple entries
for the same file. E.g. '/1/2/../2.file' and '/1/2/3/../../2.file' would
both be listed, and end in a ninja error because multiple targets
generate the same file.
This commit fixes this issue by normalizing the paths.
Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
Newer pyocd versions (specifically the 0.21.0 we have in our
requirements.txt) no longer support -b and have moved the same option
to -u. Keep up.
Fixes: #17554
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
This is a band-aid to make it more obvious to potential users of 'west
sign' and 'west flash' which hex file they are flashing, when they are
falling back on a binary file, and erroring out when a hex file does
not exist.
Fixes: #18201
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Add a check to make sure the hex file exists as that is what we utilize
in openocd to flash. If its missing we report that its likely due to
not having CONFIG_BUILD_OUTPUT_HEX set.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This was allowed due to a misunderstanding:
foo = 'x';
In reality, 'x' works like an integer literal, and is used like this:
foo = < 'x' >;
Fix character literal parsing to match the C tools.
Also fix backslash escape parsing to match the C tools exactly
(get_escape_char() in util.c): \<char> should be turned into <char> if
<char> isn't recognized as a special escape character, instead of being
left alone. This fixes parsing of e.g. '\'' (a character literal with a
single quote in it).
Piggyback some more tests for weird property/node names.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Property type-checking has been pretty rudimentary until now, only
checking things like the length being divisible by 4 for 'type: array',
and strings being null-terminated. In particular, no checking was done
for 'type: uint8-array', letting
jedec-id = < 0xc8 0x28 0x17 >;
slip through when
jedec-id = [ 0xc8 0x28 0x17 ];
was intended.
Fix it by adding a syntax-based type checker:
1. Add Property.type, which gives a high-level type for the property,
derived from the markers added in the previous commit.
This includes types like TYPE_EMPTY ('foo;'),
TYPE_NUM ('foo = < 3 >;'), TYPE_BYTES ('foo = [ 01 02 ];'),
TYPE_STRINGS ('foo = "bar", "baz"'),
TYPE_PHANDLE ('foo = < &bar >;'), and TYPE_COMPOUND (everything not
recognized).
See the Property.type docstring in dtlib for more info.
2. Use the high-level type in
Property.to_num()/to_string()/to_node()/etc. to verify that the
property was assigned in an expected way for the type.
If the assignment looks bad, give a helpful error:
expected property 'nums' on /foo/bar in some.dts to be assigned
with 'nums = < (number) (number) ... >', not 'nums = "oops";'
Some other related changes are included as well:
- There's a new Property.to_bytes() function that works like accessing
Property.bytes, except with an added check for the value being
assigned like 'foo = [ ... ]'.
This function solves problems like the jedec-id one.
- There's a new Property.to_path() function for fetching the
referenced node for assignments like 'foo = &node;', with type
checking. (Strings are accepted too, as long as they give the path
to an existing node.)
This function is used for /chosen and /aliases.
- A new 'type: phandle' type can now be given in bindings, for
properties that are assigned like 'foo = < &node >;'.
- Property.__str__() now displays phandles and path references as they
were written (e.g. '< &foo >' instead of '< 0x1 >', if the
allocated phandle happened to be 1).
- Property.to_num() and Property.to_nums() no longer take a 'length'
parameter, because it makes no sense with the type checking.
- The global dtlib.to_string() and dtlib.to_strings() functions were
removed, because they're not that useful.
- More tests were added, along with misc. minor cleanup in various
places.
- Probably other stuff I forgot.
The more strict type checking in dtlib indirectly makes some parts of
edtlib more strict as well (wherever Property.to_*() is used).
Fixes: #18131
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Previously, dtlib just stored the raw 'bytes' value for each property,
along with some markers in Property._markers for phandle and path
references.
Extend Property._markers to also remember where different data blocks
start, so that e.g.
foo = <1 2 3>, "bar", [00 01];
can be reproduced as written.
Use the new information to reproduce properties as written in
Property.__str__(). This gives good test coverage as well, since the
test suite checks literal __str__() output.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
If there is more than one PWM than generate a define with a trailing
index for the PWM. This matches what we do for GPIOs.
So something like:
DT_PWM_LEDS_RED_PWM_LED_PWMS_CONTROLLER_0
DT_PWM_LEDS_RED_PWM_LED_PWMS_CONTROLLER_1
...
DT_PWM_LEDS_RED_PWM_LED_PWMS_CONTROLLER_<N>
Fixes#18171
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Package "hub" has been renamed some time ago to "git-spindle".
Recently package with the same name "hub" has been released on PyPi
page, which causes installing pip requirements.txt to fail since
it is trying to install different package.
Signed-off-by: Marcin Sloniewski <marcin.sloniewski@gmail.com>
We don't want any defines generated for the boolean
'gpio-controller'. So skip it in write_props if we see it.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
We don't want any defines generated for the boolean
'interrupt-controller'. So skip it in write_props if we see it.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This is a direct search-and-replace copy of the PWM code.
The name is chosen to match Linux's iio-bindings.txt.
Signed-off-by: Jim Paris <jim@jtan.com>
Move when we early out for properties that start with # like
"#address-cells" or end with -map like "interrupt-map" to after we do
some error checking. This allows us to check those properties at least
exist if they are required.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
'keys' is really a dictionary of options (like {"type": "int", ...}) for
a property. Calling it 'options' makes it clearer.
Also s/prop/prop_name/.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Use hex file for flash command, instead of elf file. This allows to
flash signed firmware, which is not available in elf format, by
specifying --hex-file command line argument.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
So far zephyr.elf file was hardcoded in cmake files. Remove it from
there and use cfg.elf_file from python, which can be overwritten by
specifying --elf-file command line option.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
dtlib is meant to be general and anything-goes re. property values, but
edtlib can be pickier. Check that all 'status' properties have one of
the values listed in the devicetree specification
(https://www.devicetree.org/specifications/), and error out otherwise.
This will get rid of the 'status = "ok"'s (should be "okay") that keep
cropping up.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
We should only assume a GPIO specifier is either named <FOO>-gpios or
gpios. Any other form like ngpios should not be considered a GPIO
specifier. especially since 'ngpios' is the standard property name for
the number of gpio's that are implemented.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Most of the logic for initializing 'clocks' and 'pwms' is the same and
can be shared. Add an EDT._simple_phandle_val_list() helper function for
initializing 'clocks', 'pwms', and any other properties on the form
<foo>s = <phandle value phandle value ...>
where the nodes pointed at by the phandles are expected to have a
'#<foo>-cells' property.
This should make it easier to add similar properties.
There's still some code duplication in the classes (PWM, Clock, etc.),
but also some differences, so I'm wondering if requiring a class for
each might be okay. Maybe some more class-related stuff could be
factored out later.
Piggyback some related cleanup:
- Have _phandle_val_list() take the name of the #foo-cells property
instead of a function for fetching the value. The pattern is always
the same.
- Have _add_names() just take the "foo" part of "foo-names". Same
pattern everywhere.
- Clean up some redundant comments for stuff that's already documented
in docstrings
- Fix error messages printed by _named_cells() ("GPIOS controller" ->
"GPIO controller", etc.)
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Zephyr verifies if it is built from a west-initialized directory.
The message changed in west@c08061cef1c7b0e19a58a82db731098e2f4bba4a.
Closes#18034.
Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Zephyr codebase standardizes in UTF-8 as file encoding. To
accommodate this, we explicitly pass encoding="utf-8" to Python's
open() function, to be independent of any locale setting of a
particular system (e.g., CI/build systems oftentimes have "C",
i.e. ASCII-only, locale). In a few places, we lacked this parameter,
so add it consistently.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
The pytest.raises context manager is now returning an ExceptionInfo
whose str() doesn't contain the str() of the underlying exception
object. Take str(e.value) directly to make sure we're looking at the
exception string.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
The main change is the elimination of the bootstrapper, a design flaw
/ misfeature.
Update the documentation to be compatible with the 0.6.x releases as
well. This has to be done atomically, as there were incompatible
changes. Make use of the versionchanged and versionadded directives
to begin keeping track of how these APIs are evolving.
(Note that west 0.6.0 will remain compatible with the extension
commands in Zephyr v1.14 LTS as long as that is still alive. This
change is targeted towards Zephyr 2.0 users.)
This requires a bump in the shippable container and allows us to
simplify the west_commands test procedure.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Add two bindings
test-bindings/multidir.yaml
test-bindings-2/multidir.yaml
and a new test-multidir.dts with two nodes that use them.
Verify that the two bindings were found by checking the
Device.binding_path attribute for the two device nodes.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
gen_defines.py and edtlib.py were recently added in
commit 62d5741476 ("dts: Add new DTS/binding parser").
The old extract_dts_includes.py script allowed for multiple
dts bindings dirs. Let's add that functionality to the new
scripts as well.
Signed-off-by: Michael Scott <mike@foundries.io>
Add a new sifive,plic-1.0.0 binding that inherits from the riscv,plic0
binding. The new binding adds a required riscv,ndev property, which
gives the number of external interrupts supported.
Use the new binding for microsemi-miv.dtsi (with a value of 31 for
riscv,ndev, from http://www.actel.com/ipdocs/MiV_RV32IMAF_L1_AHB_HB.pdf)
and riscv32-fe310.dtsi (which already assigns riscv,ndev).
Also remove a spurious riscv,ndev assignment from
riscv32-litex-vexriscv.dtsi.
Also make edtlib and the old scripts/dts/ scripts replace '.' in
compatible strings with '_' when generating identifiers.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
If we are doing a nightly build we can utilize a large (over 50G) of
disk space just to generate the list of tests to build. We need to
optimize this so as we finish building the initial pass we clean up
as we go and only keep around the files we need (like .config,
generated_dts_board.conf, CMakeCache.txt, etc).
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The content of subsys/fb/cfb_fonts cannot be replicated by the existing
script due to lack of positioning options and use of a full-color frame
buffer, which affects the generated bitmap. Switch to the solution used
in the original script, add the required options, and document the
process of regenerating the fonts.
This commit also determines the required bounding box for the glyphs to
be sure that the user-provided value is sufficient to avoid partial
characters. Ideally the calculated width and height would be used for
font characters, but this would require significant restructuring of the
script to make calculated values available at the point where the
arguments are used to produce output.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
The output of this script is intended to be put into an implementation
file, where the font data is accessed by index to an array maintained by
the linker script. There is no need for protection against multiple
includes, and the font data array should not be a global symbol.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
We generated a define for each instance to convey its existance of the
form:
#define DT_<COMPAT>_<INSTANCE> 1
However we renamed all other instance defines to be of the form
DT_INST_<INSTANCE>_<FOO>. To make things consistent we now generate a
define of the form:
#define DT_INST_<INSTANCE>_<COMPAT> 1
We also now deprecate the DT_<COMPAT>_<INSTANCE> form and fixup all uses
to use the new form.
Fixes: #17650
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a new DTS/binding parser to scripts/dts/ for generating
generated_dts_board.conf and generated_dts_board_unfixed.h.
The old code is kept to generate some deprecated defines, using the
--deprecated-only flag. It will be removed later.
The new parser is implemented in three files in scripts/dts/:
dtlib.py:
A low-level .dts parsing library. This is similar to devicetree.py in
the old code, but is a general robust DTS parser that doesn't rely on
preprocessing.
edtlib.py (e for extended):
A library built on top of dtlib.py that brings together data from DTS
files and bindings and creates Device instances with all the data for
a device.
gen_defines.py:
A script that uses edtlib.py to generate generated_dts_board.conf and
generated_dts_board_unfixed.h. Corresponds to extract_dts_includes.py
and the files in extract/ in the old code.
testdtlib.py:
Test suite for dtlib.py. Can be run directly as a script.
testedtlib.py (uses test.dts and test-bindings/):
Test suite for edtlib.py. Can be run directly as a script.
The test suites will be run automatically in CI.
The new code turns some things that were warnings (or not checked) in
the old code into errors, like missing properties that are specified
with 'category: required' in the binding for the node.
The code includes lots of documentation and tries to give helpful error
messages instead of Python errors.
Co-authored-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
--deprecate-only sounded like a command to "only deprecate (something)"
to me at first. --deprecated-only might make it clearer that it's about
only generating deprecated stuff.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Any fatal error will print "ZEPHYR FATAL ERROR" now, so
we don't have to maintain a set of strings in the
sanitycheck harness.py
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This is now called z_arch_esf_t, conforming to our naming
convention.
This needs to remain a typedef due to how our offset generation
header mechanism works.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This new flag will indicate that the kernel object represents
an instance of a device driver object.
Fixes: #14037
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
No binding has anything but 'version: 0.1', and the code in scripts/dts/
never does anything with it except print a warning if it isn't there.
It's undocumented what it means.
I suspect it's overkill if it's meant to be the binding format version.
If we'd need to tell different versions from each other, we could change
some other minor thing in the format, and it probably won't be needed.
Remove the 'version' fields from the bindings and the warning from the
scripts/dts/ scripts.
The new device tree script will give an error when unknown fields appear
in bindings.
The deletion was done with
git ls-files 'dts/bindings/*.yaml' | xargs sed -i '/^\s*version: /d'
Some blank lines at the beginning of bindings were removed as well.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit adds a DTCM (Device Tightly Coupled Memory) section for
Cortex F7 MCUs. The Address and length is defined in the corresponding
device tree file.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
In order to make sure that the build works in folders that require a UTF
encoding, make sure that both CMake and the various Python scripts that
interact with each other on files use the same encoding, in this case
UTF-8.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
We don't use the DT_FLASH_AREA_*_LABEL defines today so lets mark them
deprecated until we actually need something.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This script is looking for a hyperspecific error (mismatched padding
when linking into two simultaneous output sections) that bit us once,
in an era where the linker scripts were less unified. We haven't seen
it crop up since, and multiple platforms have changed the way they do
this anyway.
It's needless complexity. Junk it.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
In a3bea8872b (PR #16352)
_bt_br_channels_area was added to the code but not the
sanitycheck sections whitelist => Add it
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
In c20ff1150f
and 5f19c8160a
(PR #16897)
_bt_settings_area was replaced with _settings_handlers_area
Update sanitycheck sections whitelist accordingly
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
The code to sanitize the generated font path by removing bindir
improperly stripped the first character of every argument when --bindir
was not provided, corrupting the command documentation when fonts are
generated manually. Only sanitize if --bindir was provided with
non-empty content.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
* Remove dead code that referenced 'generation' but didn't do anything
with it
* Replace looking at 'generation' with a simple check for property
starting with # (for things like #address-cells, etc) or ending in
-map (for things like gpio-map) to skip
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
uint8-array is the name for what the devicetree specification calls a
bytestring.
The original parsing code treated square brackets as equivalent to
quotes or angle brackets, failing to interpret elements as hex-encoded.
This was a bug, corrected in this patch by processing content as a
sequence of hex-encoded bytes with arbitrary whitespace.
The original generating code emitted the property as individual
elements. Replace that with generation of a single structure
initializer, which is more useful in cases where the length of a
property value may vary between nodes.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
For using alpha numeric property values in a devicetree node, we
need to match the values starts with a number. Current scenario will
return the value as a numeric literal if it starts with a number. This
will not work for a compatible like, "96b-ls-con" which is proposed in
issue #15598.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
sanitycheck --help mentions that west-flash requires device-testing
to be enabled (and indeed it does because DeviceHandler will never
be called where west_flash option is used. Let's generate an error
if west-flash is used w/o specifying device-testing.
Also cleanup help text which looks odd in both sanitycheck --help
and in the file itself.
Signed-off-by: Michael Scott <mike@foundries.io>
Several boards have multiple runners setup. We need a way to specify
which runner to use with sanitycheck. Introduce --west-runner option.
Signed-off-by: Michael Scott <mike@foundries.io>
We don't have any uses of this form of define so deprecate it for now.
If needed this should be DT_INST_<INSTANCE ID>_<COMPAT>_BUS_<BUS>.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Now that we've converted LED and SW to use DT_ prefix we can mark the
non-DT_ prefixed versions as deprecated.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Now that we've converted all _GPIO_ to _GPIOS_ we can mark the _GPIO_
form as deprecated (same for _PWM_ / _PWMS_).
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>