Clarify comment about why this samples is skipped in
posix arch based targets.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Let's replace the references to native_posix with native_sim in
the documentation, and enable this tests by default in
native_sim.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This is a private kernel header with private kernel APIs, it should not
be exposed in the public zephyr include directory.
Once sample remains to be fixed (metairq_dispatch), which currently uses
private APIs from that header, it should not be the case.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
All those benchmarks are kernel related, so add the kernel tag to avoid
building them when non kernel changes are being submitted.
Signed-off-by: Anas Nashif <anas.nashif@intel.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>
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>
Make queues used in metairq dispatch sample capable of storing all
generated messages. This prevents seemingly random hangs that tend to
happen with some random seeds.
Fixes: #54610
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Differ the __ASSERT_NO_MSG of the k_msgq_get()
just after checking the nb of cycles.
It allows precise counting of cpu cycles where the assert
does not interfere.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
For samples that set CONFIG_MP_NUM_CPUS=1, switch to using
CONFIG_MP_MAX_NUM_CPUS=1 instead as we work to phase out
CONFIG_MP_NUM_CPUS.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
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>
When coverage is enabled, some boards require more stack space
for the custom threads created in main(). Since this "samples"
already has CONFIG_TEST enabled, we can pad the stack size
with CONFIG_TEST_EXTRA_STACK_SIZE.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
samples should not use CONFIG_TEST_EXTRA_STACK_SIZE, instead, they
should set the recommended stack size directly.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
In order to bring consistency in-tree, migrate all samples to the use
the new prefix <zephyr/...>. Note that the conversion has been scripted:
```python
from pathlib import Path
import re
EXTENSIONS = ("c", "h", "cpp", "rst")
for p in Path(".").glob("samples/**/*"):
if not p.is_file() or p.suffix and p.suffix[1:] not in EXTENSIONS:
continue
content = ""
with open(p) as f:
for line in f:
m = re.match(r"^(.*)#include <(.*)>(.*)$", line)
if (m and
not m.group(2).startswith("zephyr/") and
(Path(".") / "include" / "zephyr" / m.group(2)).exists()):
content += (
m.group(1) +
"#include <zephyr/" + m.group(2) +">" +
m.group(3) + "\n"
)
else:
content += line
with open(p, "w") as f:
f.write(content)
```
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The metairq sample sometimes failed due to stuck because it has a
potential race when recording the latencies. The previous solution
checks whether the stats.mirq greater than MAX_EVENT. But stats.mirq
might also have a race here. So we change to check the msg sequence,
its correctness ensured by the kernel's message queue.
And also remove the spinlock in previous fix because tests only use
1 CPU, no need to add this. It also improves the fix for #40889,
to prevent test failed sporadically on acrn_ehl_crb and ehl_crb.
Fix#42874.
Signed-off-by: Enjia Mai <enjia.mai@intel.com>
The samples/kernel/metairq_dispatch runs failed on acrn_ehl_crb
due to the potential race condition in accessing the global stat
data. Add a spinlock to prevent this.
Fixes#40889
Signed-off-by: Enjia Mai <enjia.mai@intel.com>
Previously cycle64 was under `samples/`. It's been moved to
`tests/` and has been marked with `slow: True` so that it
will not disrupt CI by adding excessive delays.
Fixes#40367
Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
The cycle64 sample is intended to complement
`test_clock_cycle_64()` in `tests/kernel/common`.
The sample demonstrates the upper 32-bits of the 64-bit cycle
counter incrementing when the bottom 32-bits roll over from
`UINT32_MAX` to 0.
If the upper 32-bits of the 64-bit cycle counter does not
increment, then an error message is printed.
```
west build -p auto -b qemu_cortex_a53 -t run \
samples/kernel/cycle64
...
*** Booting Zephyr OS build v2.7.99-1124-gd7ba4e394832 ***
wrap-around should occur in 68s
[ddd:hh:mm:ss.0ms]
[000:00:00:00.020]: c64: 0000000000174258
[000:00:01:08.760]: c64: 000000010027f8bb
[000:00:02:17.490]: c64: 0000000200348c85
```
Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
Move to CMake 3.20.0.
At the Toolchain WG it was decided to move to CMake 3.20.0.
The main reason for increasing CMake version is better toolchain
support.
Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Normally main.c file doesn't have a header, beacuse it doesn't need to
be declared to other modules.
And in this sample it makes more sense to use name msgdev.h instead of
main.h as the header file for msgdev.c.
Signed-off-by: Paul He <pawpawhe@gmail.com>
Set integration_platforms on these samples to just native_posix. This
should be sufficient to make sure these tests build and run.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>