Commit Graph

655 Commits

Author SHA1 Message Date
Kumar Gala a1195ae39b smp: Move for loops to use arch_num_cpus instead of CONFIG_MP_NUM_CPUS
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>
2022-10-21 13:14:58 +02:00
Stephanos Ioannidis 30c5e0222b tests: cmsis_dsp: MVE correlate out-of-bounds access workaround
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>
2022-10-20 22:12:42 +09:00
Kumar Gala 4f0166088c tests: move to using CONFIG_MP_MAX_NUM_CPUS
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>
2022-10-20 22:04:10 +09:00
Stephanos Ioannidis 9dd570f8a2 tests: Remove explicit newlib nano override
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>
2022-10-19 16:02:51 +02:00
Jamie McCrae 6798f447d5 tests: devicetree: device: Add bl5340 and bt610 exclusions
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>
2022-10-19 10:46:53 +02:00
Stephanos Ioannidis 44be5c941a tests: cmsis_dsp: Remove invalid mps3_an547 integration platform spec
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>
2022-10-18 17:52:48 +09:00
Maureen Helm 03c8deb599 devicetree: Add model name helpers based on compat
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>
2022-10-07 11:48:02 -07:00
Anas Nashif a5bd666f4e lib: notify: build sys-notify conditionally.
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>
2022-10-03 10:18:15 +02:00
Anas Nashif a81b322828 lib: onoff: add a config for on-off and build conditionally
Do not build this service unconditionally.

Partial fix of #50654

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-03 10:18:15 +02:00
Gerard Marull-Paretas b8f9d8add7 tests: devicetree: cover DT(_INST)_FOREACH_PROP_ELEM_SEP(_VARGS)
Add coverage for DT(_INST)_FOREACH_PROP_ELEM_SEP(_VARGS).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-03 10:11:18 +02:00
Andrei Emeltchenko 2e56f955db trivial: Remove empty files
Remove empty files.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-30 09:41:55 +00:00
Andrei Emeltchenko 1d879b93c5 trivial: tests: Remove empty file
Remove empty file.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-29 13:41:18 -05:00
Anas Nashif 215159c6ff tests: mem_blocks: remove board configs using dma logging
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>
2022-09-26 10:53:43 +00:00
Zhao Shuai b15e64569c tests: lib: add a tag to uniquely identify mem_blocks test
To identify mem_blocks test uniquely.

Signed-off-by: Zhao Shuai <shuai1x.zhao@intel.com>
2022-09-26 08:11:13 +00:00
Henri Xavier 1a276d0ac6 ring_buffer: Introduce `RING_BUF_ITEM_SIZEOF`
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>
2022-09-20 09:08:14 +00:00
Krzysztof Chruscinski a7224830ce lib: os: cbprintf: Mechanism for detecting %p in static package
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>
2022-09-19 10:14:23 +00:00
Enjia Mai ca5d698563 tests: lib: move the cmsis_dsp transform test to new ztest API
Migrate the testsuite tests/lib/cmsis_dsp/transform to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-14 07:22:09 -04:00
Enjia Mai ccb3927233 tests: lib: move the cmsis_dsp matrix test to new ztest API
Migrate the testsuite tests/lib/cmsis_dsp/matrix to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-14 07:22:09 -04:00
Enjia Mai 26b816cb5a tests: lib: move the cmsis_dsp filtering test to new ztest API
Migrate the testsuite tests/lib/cmsis_dsp/filtering to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-14 07:22:09 -04:00
Enjia Mai 082e598f84 tests: lib: move the cmsis_dsp interpolation test to new ztest API
Migrate the testsuite tests/lib/cmsis_dsp/interpolation to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-14 07:22:09 -04:00
Enjia Mai 63105256f7 tests: lib: move the cmsis_dsp statistics test to new ztest API
Migrate the testsuite tests/lib/cmsis_dsp/statistics to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-14 07:22:09 -04:00
Enjia Mai 3e2fe17fa8 tests: lib: move the cmsis_dsp support test to new ztest API
Migrate the testsuite tests/lib/cmsis_dsp/support to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-14 07:22:09 -04:00
Daniel Leung db9d83fbb8 tests: devicetree: add bits to test multi-bus nodes
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>
2022-09-09 17:42:33 -04:00
Michał Barnaś 1ea41b34c6 ztest: improve some tests
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>
2022-09-09 07:05:38 -04:00
Michał Barnaś dae8efa692 ztest: remove the obsolete NULL appended to zassert macros
This commit removes the usage of NULL parameter as message in
zassert_* macros after making it optional

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-09-09 07:05:38 -04:00
Gerard Marull-Paretas 3732bbfa12 tests: devicetree: add tests for DT_CHILD/DT_INST_CHILD
Add some coverage for the DT_CHILD/DT_INST_CHILD macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-06 08:45:25 -07:00
Dominik Ermel d5810693ea tests: lib: gui: lvgl: Switch to FIXED_PARTITION_ macros
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>
2022-09-06 09:56:37 +02:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
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>
2022-09-05 16:31:47 +02:00
Maureen Helm e1e16640b5 devicetree: Add vendor name helpers based on vendor prefixes
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>
2022-09-01 14:53:55 -07:00
Ming Shao b92b8719b8 tests: use HDA logging for mem_blocks test on cavs platforms
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>
2022-09-01 10:26:52 +02:00
Gerard Marull-Paretas 18454e46f2 devicetree: add DT_INST_FOREACH_CHILD_STATUS_OKAY* macros
Add the instance version of the DT_FOREACH_CHILD_STATUS_OKAY* family of
macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas fff9ecbc7f devicetree: add DT_(INST_)FOREACH_CHILD(_STATUS_OKAY)_SEP(_VARGS)
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>
2022-08-30 16:19:57 +02:00
Krzysztof Chruscinski bb74b4f028 lib: os: cbprintf: Renamed flags used for conversion function
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>
2022-08-26 12:52:08 +02:00
Kumar Gala f3ff449524 tests: devicetree: device: Rename gpio@0 to avoid name conflict
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>
2022-08-26 12:51:45 +02:00
Krzysztof Chruscinski 716fa446cd tests: lib: spsc_pbuf: Improve stress test
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>
2022-08-24 17:48:50 +00:00
Krzysztof Chruscinski 4b5ff413f5 lib: os: spsc_pbuf: Fix miscalculation in the allocation
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>
2022-08-24 17:48:50 +00:00
Radosław Koppel 7614110a20 dts: Add _STRING_TOKEN and _STRING_UPPER_TOKEN to string-array
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>
2022-08-22 13:58:30 -05:00
Radosław Koppel d493751fa1 test: devicetree: api: Limit test to native_posix and simulation
This commit limits test targets for the test to run only on native
or simulated machines.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2022-08-22 13:58:30 -05:00
Spoorthy Priya Yerabolu d4049e2cd6 tests: lib: sysutil: migrating lib tests to new ZTEST API
Migrating the sysutil tests to new ztest API

Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
2022-08-19 20:45:19 +00:00
Spoorthy Priya Yerabolu b341bce3a5 tests: lib: sprintf: migrating lib tests to new ZTEST API
Migrating sprintf tests to new ZTEST API.

Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
2022-08-19 20:45:19 +00:00
Kumar Gala c4ee3f3733 devicetree: deprecate DT_LABEL variants
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>
2022-08-19 06:49:50 -05:00
Kumar Gala 729f1ec301 tests: devicetree: device: Exclude test on bbc_microbit
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>
2022-08-19 12:08:33 +02:00
Kumar Gala 3f124ba14d tests: devicetree: device: utilize DEVICE_DT_NAME
Convert DT_LABEL to DEVICE_DT_NAME.  This lets us drop label properties
in the app.overlay.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-19 12:08:33 +02:00
li biao c2c467a6ff tests: lib: move ringbuffer to new ztest API
Move test ringbuffer to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-18 16:08:44 +02:00
li biao b6fadd1600 tests: lib: move smf to new ztest API
Move test smf to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-18 11:34:50 +00:00
Katarzyna Giadla eae01f0fc5 samples: tests: Rename duplicated testcases
Names of some testcases are duplicated in another files.
This change rename duplicated testcases.

Signed-off-by: Katarzyna Giadla <katarzyna.giadla@nordicsemi.no>
2022-08-17 12:11:00 +02:00
li biao ff6bf25632 tests: lib: cmsis_dsp: move svm to new ztest API
Move test svm to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-17 12:04:38 +02:00
li biao cbcc21e418 tests: lib: move p4workq to new ztest API
Move test lib/p4workp to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-17 12:04:22 +02:00
Robert Lubos 208cbffbf7 test: Add uoscore tests
Add unit tests for OSCORE library.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-08-12 16:17:59 +02:00
Stephanos Ioannidis 8355341c66 tests: lib: cmsis_nn: Initialise bias dimensions for depthwise convolve
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>
2022-08-10 12:00:18 +02:00