Commit Graph

54 Commits

Author SHA1 Message Date
Alberto Escolar Piedras
b4d0791d1a services/tracing doc & samples: Replace native_posix w native_sim
In the docs replace the references to native_posix with native_sim.
In the sample, add overlays for native_sim, and add native_sim to filter
and as default integration platform.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-14 13:06:01 +01:00
Johan Hedberg
dee64613c2 samples: tracing: Reenable the percepio test case
Update to a fixed percepio tree, which allows the build to pass for valid
version numbers with 0 being one of the version number components.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2023-10-02 16:17:10 +03:00
Johan Hedberg
021003c5c0 samples: tracing: Skip broken percepio test case
The percepio build seems to have a bug and fail whenever the major, minor
or patchlevel numeric value is 0:

Invalid version specified: major: 3, minor: 5, patchlevel: 0

Disable the sample until a proper fix is available.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2023-10-01 20:29:10 +03:00
Daniel Leung
0a50ff366e kernel: rename z_current_get() to k_sched_current_thread_query()
The original idea of z_current_get() was to be the counterpart
of k_current_get() when thread local variable for current has
not been initialized if TLS is enabled, otherwise they are
the same function. Now since z_current_get() is being used
outside of core kernel, rename it under kernel namespace so
other subsystem can conceptually use them too.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-28 16:15:46 +02:00
Anas Nashif
3e2ada7451 tests: tracing: TraceRecorderSource was renamed to percepio
Change module name in dependencies of test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-25 18:42:05 -04:00
Benjamin Cabé
4f1cd0e428 doc: Migrate subsys/ code samples to new Sphinx extension
This migrates the subsys code samples to the new Sphinx code-sample
extension, making it easier to find relevant samples when browsing
API reference.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-09-21 09:28:31 +02:00
Manuel Argüelles
c9cc03b6ef samples: tracing: exclude mr_canhubk3 board
The mr_canhubk3 board enables by default an off-chip watchdog that must
be serviced to avoid triggering a reset and cannot be disabled on a
per-test basis.

The amount of data printed on this test prevents to initialize the
on-board watchdog within the expected window, causing a board reset.
Hence do not run the test on mr_canhubk3 board.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-18 10:37:22 +01:00
Yong Cong Sin
96dee583c0 sample: tracing: update README for USER
Update the README.rst to include build instruction for
tracing_user.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-08-17 15:13:17 +02:00
Yong Cong Sin
8e27b2ea8b sample: tracing_user: check for lines from the implementation
Updated the sample to check for lines from the tracing user
implementation to make sure that the glue works.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-08-17 15:13:17 +02:00
Yong Cong Sin
3337c15707 tracing_user: let user implementation to do everything
Let's just let the user implementation to its things, like
checking, locking and stuff.
The tracing_user.c now just acts as a glue.

Moved previous implementation to its sample, and cleaned up
headers.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-08-17 15:13:17 +02:00
Florian Grandel
781b6d7b0a samples/doc: segger: rtt: enhanced tracing/logging
Fixes a minor documentation issue and suggests/documents additional RTT
tracing and logging options.

Showcases logging via RTT UART which is now available w/o restrictions
due to the preceding change. This has been tested on CC13/26xx hardware.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-06 07:44:06 -04:00
Anas Nashif
b835b02136 tests: cleanup metadata and filtering
- Add integration_platforms to avoid excessive filtering
- Make sure integration platforms are actually part of the filter
- Fix some tags and test meta data

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-13 09:38:27 -04:00
Benjamin Cabé
21f473aaec samples: doc: fix dead links
Fixed deadlinks reported by Sphinx linkchecker

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-06-07 04:40:47 -04:00
Anas Nashif
0064b6e8b6 tests: samples: cleanup test tags, add integration_platforms
Use integration platforms and sanitize tags.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-02 04:47:06 -04: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
Alejandro Hidalgo Muñoz de Rivera
e9f12f21d5 samples: Updated README for tracing application sample
Updated README.txt to .rst format file

Signed-off-by: Alejandro Hidalgo Muñoz de Rivera <ahmrivera@gmail.com>
2023-03-22 11:41:56 +01:00
Jamie McCrae
5bc019d713 samples: tracing: Replace prj_<board> files with overlays
Replaces the old prj_<board>.conf files with board overlays instead.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-20 10:18:32 +01:00
Jamie McCrae
11c7371f99 samples: Explicitly disable boot USB device support init at boot
Disables having USB enabled for boards that configure USB CDC for
console, shell or logging at bootup in applications that enable USB
to prevent a conflict arising whereby USB is registered from
multiple points and later calls fail.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-10 12:21:10 +01:00
Fabio Baltieri
792469aae9 yamllint: indentation: fix files in samples/
Fix the YAML files indentation for files in samples/.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 14:23:53 +01:00
Anas Nashif
ba7d730e9b tests/samples: use integration_plaforms in more tests/samples
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>
2022-11-29 16:03:23 +01:00
Anas Nashif
aead5b523b sample: tracing: add a configuration for percepio
Add a sample configuration for percepio.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-04 10:00:48 +01:00
Kumar Gala
ad5966a432 samples: move to using CONFIG_MP_MAX_NUM_CPUS=1
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>
2022-10-20 22:04:10 +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
Katarzyna Giadla
a84531f4fd samples: Add name "sample" in the some samples modules
Some test cases in the module `samples` have not a name of this module.
This change adds the name `sample` to these test cases.

Signed-off-by: Katarzyna Giadla <katarzyna.giadla@nordicsemi.no>
2022-08-29 07:30:10 -04: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
Kumar Gala
930f56baef samples: tracing: Add filter for uart tests
Add a filter to make sure devicetree chosen node has
property 'zephyr,tracing-uart' set in it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-29 05:57:54 -04:00
Kumar Gala
3c9932ddf8 samples: tracing: make example in readme work
Add mps2_an521.overlay so that the example in the README.txt will
actually build.  Update README.txt to document needing to have
'zephyr,tracing-uart' property set under chosen node in devicetree.

Fixes #48416

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-29 05:57:54 -04:00
Kumar Gala
dcfcd05ed3 tracing: Move to DTS for uart device
Move from using Kconfig TRACING_BACKEND_UART_NAME to a devicetree
chosen property ("zephyr,tracing-uart").  This is similar to a number
of other functions like "zephyr,shell-uart" or "zephyr,bt-uart".

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 16:00:47 -07: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
Nazar Kazakov
f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04: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
Wealian Liao
7467dc4c12 tracing_user: Add ISR nest level parameter
For tracing_user, the sys_trace_isr_enter() & sys_trace_isr_exit()
block any nest interrupts & most SMP interrupts for the user. It is
hard to analyze the IRQ preemption(e.g., each IRQ counter and execution
time). This commit adds ISR nest level for each CPU to the user instead
of blocking user call back when nest interrupts.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-21 14:38:35 -05:00
Wealian Liao
1fd29fb131 tracing: Fix tracing_user config
`tracing_user.h` lost several definitions, which made
CONFIG_TRACING_USER build fail. This fixes the TRACING_USER
config & adds it to the test case.

Moreover, the idle task stack is overflow on qemu_x86, qemu_cortex_m0 &
qemu_riscv64. This makes the test fail. So this commit sets the idle
stack size to 2048 for this sample to avoid it.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-11 18:13:18 -05:00
Evgeniy Paltsev
eacabaf5ae tests: tracing.osawareness.openocd cleanup
Move all config options to prj.conf. No functional
changes intended.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-13 06:22:44 -04:00
Evgeniy Paltsev
8077907827 tests: fix tracing.osawareness.openocd when thread names disabled
tracing.osawareness.openocd relies on the CONFIG_THREAD_NAME is
enabled, however we don't enable it in test config.

Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-13 06:22:44 -04:00
Evgeniy Paltsev
2677e55b92 tests: fix tracing.osawareness.openocd for SMP platforms
The tracing.osawareness.openocd doesn't support executing
on multicore Zephyr. However we disable multiple CPUs
usage in two different ways for this test:
 - by setting CONFIG_MP_NUM_CPUS to 1
 - by setting CONFIG_SMP to n

It's not correct for all SMP platforms to disable SMP. As
it is also excessive (we can guarantee the execution on
single core by setting CONFIG_MP_NUM_CPUS=1) let's drop
SMP disabling.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-13 06:22:44 -04:00
Bradley Bolen
bdc80ebe16 samples: tracing: Add a sample for tracing_user
The user tracing backend allows one to implement weak symbols to perform
user specific tracing, e.g gpio toggling or spi transactions.  This adds
a qemu sample that just does a simple printk for each of the traced
functions, but could be changed to do whatever function the user
desires.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2021-09-02 06:54:35 -04: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
Johann Fischer
946964e374 samples: remove USB configuration option
Remove USB configuration option, replace it where necessary
with USB_DEVICE_STACK.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-03 19:00:12 -04:00
Anas Nashif
270be80caa tracing: add empty test macros
Add support for new tracing macros in test backend. Move header from
sample into the subsystem and make it available for general testing with
any application.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-07 22:10:21 -04:00
Anas Nashif
bc747e7167 tracing: remove cpu_stats in favor of thread runtime stats
Removing CONFIG_TRACING_CPU_STATS in favor of
CONFIG_THREAD_RUNTIME_STATS which provides per thread stats. The same
functionality is also available when Thread analyzer is enabled with the
runtime stats enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-16 15:31:24 -04:00
Carles Cufi
d2465d6268 debug: Move away from openocd and make it generic
The exported structures that were originally introduced for OpenOCD have
since then been reused for other debugger plugins, including PyOCD and
Segger J-Link.

Rename the Kconfig option and the implementation from openocd to debug
thread info, so that it reflects the fact that this is no longer
specifically tied to OpenOCD.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-03-17 14:43:01 -05:00
Maureen Helm
17695ce9d9 samples: tracing: Extend the SystemView configuration to more platforms
Extends the Segger SystemView configuration for the tracing sample to
more platforms that support Segger RTT, not just nrf52840dk_nrf52840.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-11-20 12:54:09 -06:00
Maureen Helm
ca6ed09e2b samples: tracing: Extract SystemView configuration into separate file
Extracts the Segger SystemView configuration for the tracing sample from
sample.yaml into a separate file. Increases the idle thread stack size
to fix overflows observed on i.MX RT boards. Removes
CONFIG_USE_SEGGER_RTT=y which is selected by CONFIG_SEGGER_SYSTEMVIEW.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-11-20 12:54:09 -06:00
Martin Åberg
a5fd0d5c0b samples: tracing: use TEST_EXTRA_STACKSIZE
Take TEST_EXTRA_STACKSIZE into account when sizing the stack for the
tracing sample tasks.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2020-11-18 10:31:26 +01:00
Anas Nashif
74576a0515 samples: tracing: print out useful information
Instead if printing the line number, output the context (thread,
semaphore, mutex, ..) and the ID of the event where applicable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-20 21:27:55 -04:00
Anas Nashif
dca317c730 sanitycheck: inclusive language
change whitelist -> allow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-27 07:04:07 -04:00
Anas Nashif
390537bf68 tracing: trace mutex/semaphore using dedicated calls
Instead of using generic trace calls, use dedicated functions for
tracing sempahores and mutexes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Emil Obalski
3758a3d4f9 samples: tracing: Enable USB by the application
usb_enable() must be called by the application.
The application may want to register usb_dc_status_callback
and trace usb status codes (usb_dc_status_code).

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-08-13 11:49:47 +02:00
Marc Herbert
2cd51a33ce samples: make find_package(Zephyr...) REQUIRED
This provides a better error message when building with CMake and
forgetting ZEPHYR_BASE or not registering Zephyr in the CMake package
registry. See parent commit for more details (split from parent for
better readability).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00