Commit Graph

17 Commits

Author SHA1 Message Date
Benjamin Cabé 1db9b009a7 doc: samples: Adopt code-sample-category across tree
This commit uses the new .. zephyr:code-sample-category directive to
categorize code samples across the tree.
Updates existing legacy references to manually defined targets to now
use :zephyr:code-sample-category: role instead.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-09-23 12:00:00 +02:00
Daniel Leung 3664ed64c3 arch: move arch_interface.h under zephyr/arch
arch_interface.h is for architecture and should not be
under sys/. So move it under include/zephyr/arch/.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-03-25 09:58:35 +00:00
Alberto Escolar Piedras 2777461858 samples kernel: Replace references to native_posix w native_sim
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>
2023-11-14 13:06:01 +01:00
Benjamin Cabé 5832f6ed5f doc: Use new Sphinx extension for code samples
Use the new code-sample directive and roles in a few places
to demonstrate how it works.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-09-06 12:11:28 +02:00
Gerard Marull-Paretas 93b63df762 samples, tests: convert string-based twister lists to YAML lists
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>
2023-05-10 09:52:37 +02:00
Keith Packard 0b90fd5adf samples, tests, boards: Switch main return type from void to int
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>
2023-04-14 07:49:41 +09: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
Aastha Grover 8a730b818b samples: kernel: Add README for simple condition variable sample.
Add README for simple conditional variable kernel sample.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2022-08-25 13:24:14 -05:00
Daniel Leung ee40548788 samples: condvar: extra stack space for custom threads
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>
2022-08-18 17:23:18 +02:00
Anas Nashif 31e0d86484 samples: do not use CONFIG_TEST_EXTRA_STACK_SIZE
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>
2022-08-03 11:22:20 +02:00
Aastha Grover 6f5c26d71e samples: kernel: condvar: add README
Add readme for the sample for conditional variables in kernel.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2022-07-08 21:06:33 -04:00
Stephanos Ioannidis ac04889ee0 samples: kernel: condition_variables: Remove unneeded `tstack` extern
This commit removes the `tstack` symbol extern that is not used
anywhere in this sample.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-20 10:25:52 +02:00
Gerard Marull-Paretas c7b5b3c419 samples: migrate includes to contain <zephyr/...> prefix
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>
2022-05-06 11:29:59 +02:00
Carles Cufi e83a13aabf kconfig: Rename the TEST_EXTRA stack size option to align with the rest
All stack sizes should end with STACK_SIZE.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-22 08:23:05 -05:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
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>
2021-08-20 09:47:34 +02:00
Kumar Gala ca3bf282b6 samples: condition_variables: set integration_platforms to native_posix
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>
2021-02-25 10:36:02 -05:00
Anas Nashif 930789dbe7 samples: kernel: add condition variable samples
Add a few samples for using condition variables..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-19 08:55:47 -05:00