Picolibc has two floating point output modules, the default, "exact",
module which meets the ISO/IEC 9899:2011 specification and a smaller
"inexact" version which does not meet those specifications. Add a test for
this latter version to make sure it meets some modest Zephyr requirements.
Signed-off-by: Keith Packard <keithp@keithp.com>
Picolibc needs more than 1024 bytes of stack when printing floating point
values exactly. Increase the stack to 2048 bytes.
Signed-off-by: Keith Packard <keithp@keithp.com>
There's no reason to limit testing floating point printf to platforms with
an FPU; neither the minimal C library nor picolibc even use floating point
instructions for printf. And even if they did, the toolchain should have
soft float support.
However, we do need to restrict picolibc testing to configurations with
floating point printf enabled.
Signed-off-by: Keith Packard <keithp@keithp.com>
Analog to json_obj_encode vs. json_calc_encoded_len which
calculates the object len using json_obj_encode, introduce
json_calc_encoded_arr_len which calculates the length using
json_arr_encode. That is needed when the object to be encoded
is array on the root level.
Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
Verify expected results for every permissible argument type, including
with a phandle and a string in an inferred binding from /zephyr,user.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
It will be convenient to treat these respectively as degenerate cases
of 'phandles' and 'string-array'. Add support for this and regression
tests. (There's nothing to do in the case of 'phandle' beyond
documenting the guarantee.)
For the record, the other DT_PROP_LEN() tests for each type are in:
type test case property
------------ -------------------- ------------
array test_arrays a
string-array test_path_props compatible
uint8-array test_arrays b
phandles test_phandles phs
phandle-array test_phandles pha-gpios
phandle test_phandles ph
Update docstrings and fix some issues in them.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Instead of detecting that the minimal C library is in use before running
the malloc failure tests, check for the common malloc being in use as that
will also allow this test to run with picolibc.
Signed-off-by: Keith Packard <keithp@keithp.com>
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Test had 2 timeout entries (90, 120). Left 120 to be safe, as it's the
larger value.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Rather than the rings, which weren't shared between userspace and kernel
space in Zephyr like they are in Linux with io_uring, use atomic mpsc
queues for submission and completion queues.
Most importantly this removes a potential head of line blocker in the
submission queue as the sqe would be held until a task is completed.
As additional bonuses this avoids some additional locks and restrictions
about what can be submitted and where. It also removes the need for
two executors as all chains/transactions are done concurrently.
Lastly this opens up the possibility for a common pool of sqe's to
allocate from potentially saving lots of memory.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
With picolibc moving to using the common malloc implementation, samples and
tests with picolibc-specific settings need to switch to using the common
malloc settings instead.
Signed-off-by: Keith Packard <keithp@keithp.com>
Some tests were filtering by explicitly listing
all posix arch boards.
Filter by the arch instead.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
add boards/nucleo_c031c6.conf with
CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=4096
to avoid twister issue due to a too low heap size on the co31c6
Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
add boards/nucleo_c031c6.conf with
CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=4096
to avoid twister issue due to a too low heap size on the co31c6
Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
With the minimal C library malloc implementation moving to libc/common, all
of the related Kconfig variables have also changed. Update uses within the
tree.
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit adds a new libcxx testcase that tests the host standard
C++ library.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
The C language says that use of a NULL FILE pointer with stdio functions is
undefined behavior. Let's just remove them instead of expecting the minimal
C library to exhibit a specific behavior in this case.
This also avoids problems when not using -ffreestanding as in that case,
the C compiler may generate warnings, or even cause undefined behavior on
its own.
Signed-off-by: Keith Packard <keithp@keithp.com>
Increase the min ram configuration when running
libraries.cmsis_dsp.matrix.unary_f64 testcase
This should have been included in #51883 but was skipped for some reason.
Signed-off-by: Patryk Kuniecki <patryk.kuniecki@intel.com>
Remove all init functions that do nothing, and provide a `NULL` to
*DEVICE*DEFINE* macros.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
There are several tests with undefined behavior ("UB") this causes
compile warnings with armclang. Skip these tests in this case.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.
Most of these changes were automated using coccinelle with the following
script:
@@
@@
- void
+ int
main(...) {
...
- return;
+ return 0;
...
}
Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.
Signed-off-by: Keith Packard <keithp@keithp.com>
The init infrastructure, found in `init.h`, is currently used by:
- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices
They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:
```c
struct init_entry {
int (*init)(const struct device *dev);
/* only set by DEVICE_*, otherwise NULL */
const struct device *dev;
}
```
As a result, we end up with such weird/ugly pattern:
```c
static int my_init(const struct device *dev)
{
/* always NULL! add ARG_UNUSED to avoid compiler warning */
ARG_UNUSED(dev);
...
}
```
This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:
```c
static int my_init(void)
{
...
}
```
This is achieved using a union:
```c
union init_function {
/* for SYS_INIT, used when init_entry.dev == NULL */
int (*sys)(void);
/* for DEVICE*, used when init_entry.dev != NULL */
int (*dev)(const struct device *dev);
};
struct init_entry {
/* stores init function (either for SYS_INIT or DEVICE*)
union init_function init_fn;
/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
* to know which union entry to call.
*/
const struct device *dev;
}
```
This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.
**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
init: convert SYS_INIT functions to the new signature
Conversion scripted using scripts/utils/migrate_sys_init.py.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
manifest: update projects for SYS_INIT changes
Update modules with updated SYS_INIT calls:
- hal_ti
- lvgl
- sof
- TraceRecorderSource
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
tests: devicetree: devices: adjust test
Adjust test according to the recently introduced SYS_INIT
infrastructure.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
tests: kernel: threads: adjust SYS_INIT call
Adjust to the new signature: int (*init_fn)(void);
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
We get compile warnings of the form:
error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
[-Werror,-Wint-in-bool-context]
if (!isprint(byte)) {
^
Since isprint (and the other is* functions) return an int, change check
to an explicit test against the return value.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Increase timeout for tests/lib/mpsc_pbuf/libraries.mpsc_pbuf_concurrent
as it fails sometimes on the 60 sec. default timeout.
Fixes#56349
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
The arm clang toolchain provides its own libc and that libc doesn't
implement reallocarray, so skip the test like we do on newlib.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
We get compile warnings of the form:
drivers/console/uart_console.c:508:8: error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
[-Werror,-Wint-in-bool-context]
if (!isprint(byte)) {
^
Since isprint returns an int, change check to an explicit test against
the return value.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
We need to exclude all POSIX arch boards, not just
native_posix* as all use the host compiler toolchain.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
WAIT_FOR is a busy wait loop, which in the POSIX ARCH
should include a very minor delay in each iteration.
After this fix, tests/lib/sys_util does not need to
exclude native_posix anymore.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add some cases to enumerate all the C++ standard variants that the SDK
gcc supports (there are MANY) to prevent compatibility regressions in
the OS headers.
Signed-off-by: Andy Ross <andyross@google.com>
The Host Commands can be used with different transport layers e.g. SHI
or eSPI. The code that provides the peripheral API and allows sending
and receiving Host Commands via different transport layers is not
actually drivers of a peripheral, so move it to the
subsys/mgmt/ec_host_cmd folder.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Add a test for `sys_hash32()`. The expectation is that hash
functions should be approximately uniform over a given field.
We can use the Kolmogorov Smirnov test to verify that our
hash function is approximately uniform over a given field.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
linear_range_get_win_index does not behave correctly when the
window of values is above the linear range. It reports
-ERANGE (partial intersection) instead of -EINVAL.
Extra conditions added for edge cases and tests cases updated.
Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
This commit adds access to the string values without a quotes.
Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
Co-authored-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
These tests include:
* ThriftTest - an upstream exercies for all Thrift facilities
This code was merged from the following repository
at the commit specified below, with minor formatting
and coding-style modifications.
https://github.com/zephyrproject-rtos/gsoc-2022-thrift
e12e014d295918cc5ba0b4c507d1bf595a2f539a
Signed-off-by: Chris Friedt <cfriedt@meta.com>
lib -> libraries to be consistent with everything else.
And fix identifier for a few stray tests that were wrongly
labeled/tagged.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The limiting factor is the output bitmask that says which elements have
been filled in by the parser. This patch changes the bitmask type from int
to int64_t.
Signed-off-by: Björn Stenberg <bjorn@haxx.se>
When the toolchain has picolibc support, run
samples/subsys/cpp/cpp_synchronization and tests/subsys/cpp/libcxx tests
using it.
Signed-off-by: Keith Packard <keithp@keithp.com>
The existing linear_range API did not allow values or windows outside of
the linear range (returned -EINVAL). With this change values are allowed
outside of the range, being adjusted to the edge values (min/max)
instead. In the case of windows, it is allowed to have partial
intersection. In both cases, the API assigns a valid index (nearest) and
returns -ERANGE. This change is useful because the main client of the
linear range API, regulators, needs such behavior. For example, If an
application specifies a voltage range from 1.0V to 1.5V and the
regulator supports from 1.2V to 2.7V, the regulator can configure a
voltage that satisfies the condition: 1.2V. With the current API, the
input would be refused because 1.0V lies outside of the 1.2V-2.7V range.
Also, for constant ranges, the minimum index is returned.
Tests have been updated/extended accordingly.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit updates all deprecated `CONFIG_LIB_CPLUSPLUS` usages to:
* check if the Zephyr minimal C++ library is enabled using
`CONFIG_MINIMAL_LIBCPP` instead of relying on the
`CONFIG_LIB_CPLUSPLUS`-based inference.
* select `CONFIG_REQUIRES_FULL_LIBCPP` when there exists a component-
level C++ standard library dependency. This allows a component to
declare C++ standard library dependency without designating a
specific libray implementation.
* select the correct type of C++ standard library implementation to use
through one of the `CONFIG_LIBCPP_IMPLEMENTATION` choices.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit updates all in-tree code to use `CONFIG_CPP_EXCEPTIONS`
instead of `CONFIG_EXCEPTIONS`, which is now deprecated.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit updates all in-tree code to use `CONFIG_CPP` instead of
`CONFIG_CPLUSPLUS`, which is now deprecated.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit moves the C++ library tests under `tests/subsys/cpp` to
`tests/lib/cpp` now that the C++ library has been relocated to
`lib/cpp`.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Fix few duplicate keys warnings in sample.yaml and testcase.yaml files,
this is going to enable some tests that were otherwise being
unintentionally ignored.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Fix all line-length errors detected by yamllint:
yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
grep '(line-length)'
Using a limit is set to 100 columns, not touching the commandlines in
GitHub workflows (at least for now).
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Added stress test which validates proper behavior of mpsc_pbuf
when there are 2 producing contexts and dedicated consumer
context. Various configuration are tested with consumer having
the lowest, medium and the higher priority.
Test produces random size packets at random intervals. It validates
that each produced packet is consumed or dropped.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Adapt test to the new method of buffer full detection. New
method increased buffer capacity.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Ranges with step 0, that is, multiple indices representing the same
value, need to report the count exclusively based on indices. This makes
it possible to later retrieve all values, e.g. in a group.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Adds mimxrt595_evk_cm33 target to the exclusion list for tests
as this board enabled i2c by default for regulator usage which
conflicts with the test.
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
When dealing with groups, the specified window in
linear_range_group_get_win_index can span across multiple groups. In the
current implementation, if maximum value was not in the same sub-window
as the minimum value the function would return -EINVAL. This patch fixes
the problem and updates test cases to cover such scenario.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
integration_platforms help us control what get built/executed in CI and
for each PR submitted. They do not filter out platforms, instead they
just minimize the amount of builds/testing for a particular
tests/sample.
Tests still run on all supported platforms when not in integration mode.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Increase the min ram configuration when running the
libraries.cmsis_dsp.transform.cf64 testcase of the
tests/lib/cmsis_dsp/transform/
Fixes https://github.com/zephyrproject-rtos/zephyr/issues/52284
Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit removes the `mps2_an521_remote` board from the integration
platform list of the CMSIS-DSP transform tests because this board no
longer has a sufficient code memory (FLASH) to fit these tests after
the resizing done in the PR #52052 for TF-M compatibility.
Consider adding `mps2_an386` as an integration platform for these tests
once the support for it is added to Zephyr (refer to the issue #45319).
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Since the new CONFIG_ZTEST_NEW_API the ram fr execution
must be adjusted (higher)
to avoid buffer allocation failure s with some target board.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
Move runtime checks to use arch_num_cpus() and build checks
to use CONFIG_MP_MAX_NUM_CPUS. This is to allow runtime
determination of the number of CPUs in the future.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Enable all cbprintf / logging related tests which were previously
disabled for qemu_arc_hs6x.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Change for loops of the form:
for (i = 0; i < CONFIG_MP_NUM_CPUS; i++)
...
to
unsigned int num_cpus = arch_num_cpus();
for (i = 0; i < num_cpus; i++)
...
We do the call outside of the for loop so that it only happens once,
rather than on every iteration.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
The MVE `arm_correlate_f32` and `arm_correlate_q31` implementations may
write to negative indices of the output buffer (refer to the upstream
CMSIS-DSP bug ARM-software/CMSIS-DSP#59).
This commit adds a workaround for the above bug by overallocating the
output buffer memory and offsetting the output buffer supplied to the
function.
Revert this commit when this bug is fixed.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
For tests that set CONFIG_MP_NUM_CPUS, switch to using
CONFIG_MP_MAX_NUM_CPUS instead as we work to phase out
CONFIG_MP_NUM_CPUS.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
This commit removes explicit `CONFIG_NEWLIB_LIBC_NANO=n` overrides
because the newlib nano variant is no longer enabled by default when
it is available.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Adds bt610 and bl5340_dvk_cpuapp* targets to exclusion list for tests
as these boards enabled i2c by default for GPIO usage which conflicts
with the test.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit removes the `mps3_an547` board from the integration
platform list for the tests whose minimum flash size requirement exceed
the size of the flash available on the board.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Follow up to e1e16640b5 adding model name
helpers to access generated macros based on a compatible's matching
entries in vendor prefixes.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Add a new Kconfig and build this code conditionally, so we do not end up
with this file being built for each zephyr app.
Partial fix for #50654
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This is no longer needed and currently generating a fault with this
backend. Using the ztest delay fixes the issue and produces the complete
console output.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Currently, to compute the 'item' size in a ring buffer, we have
`SIZE32_OF`.
Several issues with this:
- `SIZE32_OF` only works on variables, not types, due to an extra
parenthesis pair. Indeed, `sizeof((int))` is not valid C, whereas
`sizeof((my_var))` is.
- `SIZE32_OF` is not a proper public API
- `SIZE32_OF` rounds down if the argument size is not a multiple
of 4 bytes.
Thus, we introduce a proper `RING_BUF_ITEM_SIZEOF`, fixing the
aforementioned issues.
Signed-off-by: Henri Xavier <datacomos@huawei.com>
Static packaging is using only argument types to build a package. There
is one case where analysing argument type only is not enough to
determine package content. That is %p with (unsigned) char pointer vs
%s. In case of %s a string might need to be appended to the package
and in case of %p it must be avoided. Format string analysis is required
to distinguish those two cases.
In order to speed up the runtime inspection, additional information is
added to a static package. That is index of the string argument (where
first argument has index 0). This information allows quick format string
inspection where nth format specifier is found and checked if it is a
pointer format specifier.
Inspection algorithm is added to cbprintf_package_convert() and if %p
is found then data for that argument is discarded. Additionally, log
warning is printed with suggestion to cast pointer argument to void *
to avoid confusion. It is desired to get rid of this ambiguity because
there are going to be logging configurations where strings are stripped
from a binary and runtime inspection cannot be performed.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This adds a few bits to the devicetree API tests for multi-bus
nodes where a bus can support multiple protocols. This uses
I3C as basis as I3C controller can support both I2C and I3C on
the same bus, while I2C controller cannot support both. So
this needs to make sure the correct bus macros are generated
if appropriate (and not generated if not needed).
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit changes some tests from using zassert_equal to validate
the pointers to using the zassert_is_null and zassert_not_null.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
The commit switches flash area access from FLASH_AREA_ macros
to FIXED_PARTITION_ macros and to usage of DTS node labels,
to identify partitions, instead of label property.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.
The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.
NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Adds vendor name helpers to access generated macros based on matching
entries in the vendor prefixes file.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Logging through winstream can miss logs when log output is
fast. The mem_blocks test suffer from this on CAVS platforms.
Add CAVS config overlays to use HDA logging instead.
Signed-off-by: Ming Shao <ming.shao@intel.com>
It is frequent to see in Devicetree code constructs like:
```c
#define NAME_AND_COMMA(node_id) DT_NODE_FULL_NAME(node_id),
const char *child_names[] = {
DT_FOREACH_CHILD(DT_NODELABEL(n), NAME_AND_COMMA)
};
```
That is, an auxiliary macro to append a separator character in
DT_FOREACH* macros. Non-DT API, e.g. FOR_EACH(), takes a separator
argument to avoid such intermediate macros.
This patch adds DT_FOREACH_CHILD_SEP (and instance/status okay/vargs
versions of it). They all take an extra argument: a separator. With this
change, the example above can be simplified to:
```c
const char *child_labels[] = {
DT_FOREACH_CHILD(DT_NODELABEL(n), DT_NODE_FULL_NAME, (,))
};
```
Notes:
- Other DT_FOREACH* macros could/should be extended as well
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
At some point, package copy function was extended and renamed
to cbprintf_package_convert. However, flags used by this
function were not renamed and used contained COPY idiom.
Deprecating flags with COPY and replacing them with flags
with CONVERT idiom to match function which is utilizing them.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
There are some platforms like the lpcxpresso54114 that utilize gpio@0
so rename gpio@0 to gpio@ffff as this is a highly unlikely to conflict
with any real device.
Fixes#49439
Signed-off-by: Kumar Gala <galak@kernel.org>
Improve stress tests to be more robust and demanding. Previous
implementation did not reveal race condition.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Wrong value was used for free space calculation. Updating test which
previously was hiding this bug.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit adds string token versions of the values also
in items inside string-array.
Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
Co-authored-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Co-authored-by: Kumar Gala <galak@kernel.org>
Deprecate DT_LABEL and DT_INST_LABEL as we have phased out
general 'label' usage and there isn't a need to keep a specific
set of macros for 'label'. DT_PROP(node, label) works fine for
the small handful of cases that need it now.
Signed-off-by: Kumar Gala <galak@kernel.org>
The bbc_microbit boards end up enabling CONFIG_SENSOR because of
CLOCK_CONTROL_NRF_USES_TEMP_SENSOR. This ends up enabling the I2C
bus which causes CONFIG_I2C_TEST=y. We end up with a build conflict
betwee the i2c_test.c driver and the test case code. So the easiest
solution is to just exclude the platforms from this test.
Signed-off-by: Kumar Gala <galak@kernel.org>
Names of some testcases are duplicated in another files.
This change rename duplicated testcases.
Signed-off-by: Katarzyna Giadla <katarzyna.giadla@nordicsemi.no>
This commit adds an initialisation for the `bias_dims` variable, which
is given as an input to the `arm_depthwise_conv_s8` function.
Note that the `bias_dims` parameter is currently unused by the function
implementation.
This fixes the following warning reported by the GCC 12:
error: 'bias_dims' may be used uninitialized
Werror=maybe-uninitialized]
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Add two new utility macros for iterating over the entire tree, along
with tests.
I have a use case for DT_FOREACH_STATUS_OKAY_NODE() right now, but I
think it makes sense to define both of them right away for
completeness.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add a bunch of missing "zephyr/" prefixes to #include statements in
various test and test framework files.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Refactoring test by adding macro for total packet length
calculation and header length.
Tuning test to trigger a scenario where free space was miscalculated.
Bug was fixed in the previous commit.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
If a device manually specifies that it depends on a second DT device,
add the first device to the second devices list of supported devices.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit sets an initial value of 0 for the `res` variable, whose
pointer is passed to other functions and is not directly assigned
within the calling function.
Note that, when the test completes successfully, the value of the `res`
variable should be set to `423` (the value of `set_res`).
This fixes the "‘res’ may be used uninitialized" warning generated by
the GCC 12.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
the testcase source file f16.c and f32.c might be
compiled into the final binary at the same time,
so need to set unique testcase name for each test.
Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
the testcase source file f16.c and f32.c might be
compiled into the final binary at the same time,
so need to set unique test names for each test,
otherwise, it will report build failures "multiple
definitions".
Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
A lot of places that DT_LABEL is used we can replace with DT_SAME_NODE
as we are just checking that the node we got from the macro is the
same as what we expect.
Signed-off-by: Kumar Gala <galak@kernel.org>
All in tree device drivers use some form of DEVICE_DT_GET
so we no longer need to require label properties.
Signed-off-by: Kumar Gala <galak@kernel.org>
Deprecate DT_BUS_LABEL and DT_INST_BUS_LABEL as we phase out
'label' property usage in favor of DT_BUS and variants.
Signed-off-by: Kumar Gala <galak@kernel.org>
Deprecate DT_GPIO_LABEL, DT_INST_GPIO_LABEL, DT_GPIO_LABEL_BY_IDX,
and DT_INST_GPIO_LABEL_BY_IDX as we phase out 'label' property usage
in favor of DT_GPIO_CTLR and variants.
Signed-off-by: Kumar Gala <galak@kernel.org>
Deprecate DT_SPI_DEV_CS_GPIOS_LABEL and DT_INST_SPI_DEV_CS_GPIOS_LABEL
as we phase out 'label' property usage in favor of
DT_SPI_DEV_CS_GPIOS_CTLR and variants.
Signed-off-by: Kumar Gala <galak@kernel.org>
Following zephyr's style guideline, all if statements, including single
line statements shall have braces.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
As Zephyr currently requires CMake version 3.20.0, update all
occurrences of cmake_minimum_required.
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
Now that picolibc's malloc arena configuration always allocates
some space, we don't need explicit allocations for tests.
Signed-off-by: Keith Packard <keithp@keithp.com>
Now that picolibc's malloc arena configuration always allocates
some space, we don't need explicit allocations for tests.
Signed-off-by: Keith Packard <keithp@keithp.com>
Extend test suite to validate zero copy API.
Add stress tests.
Add support for cache in the test. Test is not emulating cache
but ensures that buffer works correctly with cache enabled.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Added functions which allow to use zero copy model for handling
data within the packet buffer.
Additionally, added handling of cache by adding option to keep rd_idx
in different cache line than wr_idx and data.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The hifive_unleashed board is configured with 0xf0000000 bytes of memory,
so an allocation of 0x7fffffff should succeed. Instead, use a much larger
value to ensure that the allocation fails.
Signed-off-by: Keith Packard <keithp@keithp.com>
One test reads too few bytes from the source to ensure nul-termination of
the result which generates a compiler warning.
Signed-off-by: Keith Packard <keithp@keithp.com>
The random/rand tests assume the PRNG operates in a specific fashion,
which is not true when running Picolibc.
v2:
Call ztest_test_skip for picolibc
Signed-off-by: Keith Packard <keithp@keithp.com>
Picolibc excludes %n support on purpose as it can introduce security issues
when the format string is vulnerable to manipulation.
Signed-off-by: Keith Packard <keithp@keithp.com>
Passing NULL as the stream to stdio functions is "UB" (undefined behavior)
in the C standard. Picolibc crashes in this case, which is valid, but not
helpful. Skip these tests in this case.
Signed-off-by: Keith Packard <keithp@keithp.com>
When the compiler is allowed to know the semantics of malloc and free,
this test needs to be careful to not have both calls elided by not using
the result at all. Simply storing the malloc pointer in a global
variable is sufficient here.
Signed-off-by: Keith Packard <keithp@keithp.com>
This board has external cache enabled but fails to link when cache
API is used. Temporary disabling.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Add flags option to init call and a flag to use cache.
Add Kconfig choice to pick how to approach cache. Cache can be
enforced in all spsc_pbuf instances, disable in all, or runtime selected
based on configuration flag. Option is added to allow memory footprint
savings.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>