Test of the sys_heap_aligned_alloc() API. This is separate from the
existing heap test because aligned_alloc() requires a kconfig to
enable it that can change the heap block header format and will impact
code coverage of the "small" block variant.
It's a fairly simple whitebox test that instantiates a heap and then
enumerates all possible alignments within it, with and without
pre-allocated data, to verify that the resulting memory is correctly
aligned and the heap stays consistent.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Update code comments in ringbuffer/src/main.c
modify a testcase to verify the address stored by ring buffer
is contiguous, and the size of every element is equal to the size of
pointer.
Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
... because it is (required).
This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.
In this particular case, REQUIRED turns this harmless looking log
statement:
-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
Cannot specify sources for target "app" which is not built by
this project.
... into this louder, clearer, faster and (last but not least) final
error:
CMake Error at CMakeLists.txt:5 (find_package):
Could not find a package configuration file provided by "Zephyr" with
any of the following names:
ZephyrConfig.cmake
zephyr-config.cmake
Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
"Zephyr_DIR" to a directory containing one of the above files. If
"Zephyr" provides a separate development package or SDK, be sure it
has been installed.
-- Configuring incomplete, errors occurred!
Signed-off-by: Marc Herbert <marc.herbert@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>
This is preparation for an additional test suite specifically for the
legacy API which will be added next.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
At some point, "child-binding:" apparently only worked up to 2 levels
deep. That's not the case anymore, but add a regression test to make
sure that doesn't break. 3 levels deep ought to be enough for anyone.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The cell paramater should have been last to match both the
DT_*_CELL_BY_NAME macros as well as how DT_PHA_BY_IDX works. We fix the
DT_INST_*_CELL_BY_NAME macros as well.
The dma macro's implemented the behavior correctly, but got the argument
names in correct. We fix that to make everything consistent.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
On some STM32 boards : nucleo_wb55rg, nucleo_l152re
the test lasts longer than defaut 60sec timeout.
Increase timeout to 120 sec.
Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
This CPU-bound test on qemu_riscv32 platform is very slow when
QEMU icount mode enabled, taking upwards of several minutes.
There's little value here, this is a unit test of library code
and we have coverage of the RISC-V 32 bit arch via hifive1.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Convert with a combo of scripts and by hand fixups:
git grep -l DT_FLASH_AREA_.*_ID | \
xargs sed -i -r 's/DT_FLASH_AREA_(.*)_ID/FLASH_AREA_ID(\L\1)/'
git grep -l DT_FLASH_AREA_.*_OFFSET | \
xargs sed -i -r 's/DT_FLASH_AREA_(.*)_OFFSET/FLASH_AREA_OFFSET(\L\1)/'
git grep -l DT_FLASH_AREA_.*_SIZE | \
xargs sed -i -r 's/DT_FLASH_AREA_(.*)_SIZE/FLASH_AREA_SIZE(\L\1)/'
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The macro iterates through the list of child nodes in a DT_DRV_COMPAT
instance and invokes provided macro for each node.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Several reviewers agreed that DT_HAS_NODE_STATUS_OKAY(...) was an
undesirable API for the following reasons:
- it's inconsistent with the rest of the DT_NODE_HAS_FOO names
- DT_NODE_HAS_FOO_BAR_BAZ(node) was agreed upon as a shorthand
for macros which are equivalent to
DT_NODE_HAS_FOO(node) && DT_NODE_HAS_BAR(node) &&
- DT_NODE_HAS_BAZ(node), and DT_HAS_NODE_STATUS_OKAY is an odd duck
- DT_NODE_HAS_STATUS(..., okay) was viewed as more readable anyway
- it is seen as a somewhat aesthetically challenged name
Replace all users with DT_NODE_HAS_STATUS(..., okay), which is
semantically equivalent.
This is mostly done with sed, but a few remaining cases were done by
hand, along with whitespace, docs, and comment changes. These special
cases include the Nordic SOC static assert files.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The driver-specific config_info structure referenced from the device
structure is marked const. Some drivers fail to preserve that
qualifier when casting the pointer to the driver-specific structure,
violating MISRA 11.8.
Changes produced by scripts/coccinelle/const_config_info.cocci.
Some changes proposed by the script are not included because they
reveal mutation of state through the const pointer, though the
code works as long as the driver-specific object is defined without
the const qualifier.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Swap this out and make the status a parameter.
Leave a couple of cases of DT_NODE_HAS_COMPAT().
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
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>
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>
Make drivers multi-instance wherever possible using DT_INST_FOREACH.
This allows removing DT_HAS_DRV_INST in favor of making drivers just
do the right thing regardless of how many instances there are.
There are a few exceptions:
- SoC drivers which use CMake input files (like i2c_dw.c) or otherwise
would require more time to convert than I have at the moment. For the
sake of expediency, just inline the DT_HAS_DRV_INST expansion for
now in these cases.
- SoC drivers which are explicitly single-instance (like the nRF SAADC
driver). Again for the sake of expediency, drop a BUILD_ASSERT in
those cases to make sure the assumption that all supported SoCs have
at most one available instance is valid, failing fast otherwise.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Rename DT_HAS_NODE to DT_HAS_NODE_STATUS_OKAY so the semantics are
clear. As going forward DT_HAS_NODE will report if a NODE exists
regardless of its status.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit provides the workarounds for the CMSIS-DSP RIFFT input
buffer access bug reported in #24701.
The upstream issue for this bug is ARM-software/CMSIS_5#906.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
The bounds check failed to account for the additional space required
for the terminating NUL after the encoded value was written.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit renames the Kconfig `FLOAT` symbol to `FPU`, since this
symbol only indicates that the hardware Floating Point Unit (FPU) is
used and does not imply and/or indicate the general availability of
toolchain-level floating point support (i.e. this symbol is not
selected when building for an FPU-less platform that supports floating
point operations through the toolchain-provided software floating point
library).
Moreover, given that the symbol that indicates the availability of FPU
is named `CPU_HAS_FPU`, it only makes sense to use "FPU" in the name of
the symbol that enables the FPU.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
In order to reduce CI overhead, this commit restricts the CMSIS-DSP
tests to only run on the following ARM platforms:
* `frdm_k64f`: Cortex-M4 (to be replaced by `qemu_cortex_m4`)
* `sam_e70_xplained`: Cortex-M7
* `mps2_an521`: Cortex-M33
The following platforms should be added to the platform whitelist in
the future when adequate support is available:
* `qemu_cortex_m4`: Replace `frdm_k64f` when available
* `qemu_cortex_r5`: Add when Cortex-R VFP support is available
* `qemu_cortex_a53`: Add when AArch64 VFP support is available
(and other VFP-equipped ARM testing platforms added in the future)
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the test application for the CMSIS-DSP 'filtering'
functions.
This test application is loosely based on the C++ test suite included
in the upstream CMSIS-DSP distribution.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the test application for the CMSIS-DSP 'svm'
functions.
This test application is loosely based on the C++ test suite included
in the upstream CMSIS-DSP distribution.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the test application for the CMSIS-DSP 'bayes'
functions.
This test application is loosely based on the C++ test suite included
in the upstream CMSIS-DSP distribution.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the test application for the CMSIS-DSP 'distance'
functions.
This test application is loosely based on the C++ test suite included
in the upstream CMSIS-DSP distribution.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the test application for the CMSIS-DSP 'transform'
functions.
This test application is loosely based on the C++ test suite included
in the upstream CMSIS-DSP distribution.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the test application for the CMSIS-DSP 'matrix'
functions.
This test application is loosely based on the C++ test suite included
in the upstream CMSIS-DSP distribution.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the test application for the CMSIS-DSP 'statistics'
functions.
This test application is loosely based on the C++ test suite included
in the upstream CMSIS-DSP distribution.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the test application for the CMSIS-DSP 'support'
functions.
This test application is loosely based on the C++ test suite included
in the upstream CMSIS-DSP distribution.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the test application for the CMSIS-DSP 'fast math'
functions.
This test application is loosely based on the C++ test suite included
in the upstream CMSIS-DSP distribution.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the test application for the CMSIS-DSP 'complex math'
functions.
This test application is loosely based on the C++ test suite included
in the upstream CMSIS-DSP distribution.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the test application for the CMSIS-DSP 'basic math'
functions.
This test application is loosely based on the C++ test suite included
in the upstream CMSIS-DSP distribution.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
The previous architecture proved unable to support user expectations,
so the API has been rebuilt from first principles. Backward
compatibility cannot be maintained for this change.
Key changes include:
* Formerly the service-provided transition functions were allowed to
sleep, and the manager took care to not invoke them from ISR
context, instead returning an error if unable to initiate a
transition. In the new architecture transition functions are
required to work regardless of calling context: it is the service's
responsibility to guarantee the transition will proceed even if it
needs to be transferred to a thread. This eliminates state machine
complexities related to calling context.
* Constants identifying the visible state of the manager are exposed
to clients through both notification callbacks and a new monitor API
that allows clients to be notified of all state changes.
* Formerly the release operation was async, and would be delayed for the
last release to ensure a client would exist to be notified of any
failures. It is now synchronous.
* Formerly the cancel operation would fail on the last client associated
with a transition. The cancel operation is now synchronous.
* A helper function is provided to safely synchronously release a
request regardless of whether it has completed or is in progress,
satisfying the use case underlying #22974.
* The user-data parameter to asynchronous notification callbacks has
been removed as user data can be retrieved from the CONTAINER_OF
the client data.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Add the following macro's to get clock info by name:
DT_CLOCKS_LABEL_BY_NAME
DT_CLOCKS_CELL_BY_NAME
DT_INST_CLOCKS_LABEL_BY_NAME
DT_INST_CLOCKS_CELL_BY_NAME
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Co-Authored-By: Marti Bolivar <marti.bolivar@nordicsemi.no>
The macros should have been DMAS_CELL_ not DMAS_CELLS_ as this matches
the other devicetree macro naming convention.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The following PR's #23941#23601 was merged using old boilerplate
inclusion.
This commit updates those tests to use find_package(Zephyr)
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Some of the ARC platforms aren't consistent between kconfig and their
linker scripts as to the size of memory, add a special case.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The renode emulator is REALLY slow on this test, what completes in 20
seconds on qemu takes 4-10 minutes on renode. That's causing trouble
in CI.
And this is a CPU-bound unit test of library code, where we have
coverage for riscv32 via qemu anyway. There's no value to having
better platform emulation here.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
CONFIG_SRAM_SIZE is a kconfig value, which is an int (units of kb),
but when doing math on it to produce a memory buffer size needs to be
done in size_t precision otherwise we could overflow on 64 bit
platforms with >4G memory.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Use the white box validation and test rig added as part of the
sys_heap work. Add a layer that puts hashed cookies into the blocks
to detect corruption, check the validity state after every operation,
and enumerate a few different usage patterns:
+ Small heap, "real world" allocation where the heap is about half
full and most allocations succeed.
+ Small heap, "fragmentation runaway" scenario where most allocations
start failing, but the heap must remain consistent.
+ Big heap. We can't test this with the same exhaustive coverage
(many re/allocations for every byte of storage) for performance
reasons, but we do what we can.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>