Add some tracing functions to fix that the samples/tracing code
cannot generate coverage by twister.
Fixed#38323
Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
Create a new tracing option TRACING_USER that allows
the user to define certain user_sys_trace_... functions
to perform whatever work desired for tracing when
tasks are swiched in/out, during isr enter/exit, and when
cpu is idle.
This infrastructure can be useful for plugging into
locally defined tracing tools or any user-specific
debugging environment.
Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
This migrates all the current iterable section usages to the external
API, dropping the "Z_" prefix:
Z_ITERABLE_SECTION_ROM
Z_ITERABLE_SECTION_ROM_GC_ALLOWED
Z_ITERABLE_SECTION_RAM
Z_ITERABLE_SECTION_RAM_GC_ALLOWED
Z_STRUCT_SECTION_ITERABLE
Z_STRUCT_SECTION_ITERABLE_ALTERNATE
Z_STRUCT_SECTION_FOREACH
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The USB configuration option is actually a global switch
to enable USB drivers in general, but currently only
the device controller drivers are meant.
USB device controller drivers also have USB_DEVICE_DRIVER option.
Thus the option USB is actually redundant and can be replaced
by the self-explanatory option USB_DEVICE_DRIVER.
The name USB itself is not unique and should not be used as an
configuration option.
With these changes the option USB_DEVICE_DRIVER generally
enables USB device controller drivers. The option USB_DEVICE_STACK
enables USB device support. It is sufficient to enable only option
USB_DEVICE_STACK because it selects USB_DEVICE_DRIVER.
CONFIG_USB Kconfig option is temporary added to subsys/usb/Kconfig.
This is necessary to pass CI and will be removed again
when the USB configuration has been adapted in modules.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Fixed several compilation errors that resulted from selecting
TRACING without specifying a tracing system (Tracerecorder,
CTF, Systemview). In this case (TRACING_NONE), some default trace hooks
(in tracing.h) were incorrectly named resulting in compilation errors.
The legacy sys_trace_isr_enter, sys_trace_isr_exit, and sys_trace_idle
also caused problems since these were only given as defines, resulting
in undefined reference errors since they are required by the assembly
files calling these. To solve this issue I've added a stub file
"tracing_none.c" (only compiled if TRACING_NONE) and declared the
functions in tracing.h if no tracing system is selected.
Signed-off-by: Torbjörn Leksell <torbjorn.leksell@percepio.com>
Make custom RTT locking configurable and select it where it is needed.
When using RTT for tracing we want to use the default locking.
Update both segger and tracerecorder modules to support that.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
New version of Systemview has Zephyr API description that did not match
what we had, align with what the tools provides and expand hooks to
support additional APIs. We now cover most kernel APIs.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
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>
Adds generic trace hook macros for inserting trace hook for
function entry, exit, blocking, and object initialization
with a variable number of arguments (objects, return values,
etc.). Utilizing macro concatenation these macros produce
trace hooks of a similar format to the old trace system
with SYS_TRACING_OBJ_FUNC(k_thread, switched_in) being
turned into sys_trace_k_thread_switched_in() by the
preprocessor. Although these macros still rely on the manual
definition of each unique trace hook in tracing.h, the benefit
of not directly calling those is that we can enable/disable
trace hooks based on object type (k_thread, k_sem, etc.)
through the preprocessor while providing the ability of adding
type specific runtime trace processing similar to
SYS_TRACING_OBJ_INIT.
Signed-off-by: Torbjörn Leksell <torbjorn.leksell@percepio.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The sysview module does not set an interrupt number when recording ISRs
using SEGGER SystemView. Added ISR numbers for Cortex-M based chips.
Signed-off-by: Jan Müller <jan.mueller@nordicsemi.no>
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>
If Zephyr is running on a coprocessor we might lack I/O
such as uart or usb to output tracing datas but we might
have gigabytes of RAM available.
This patch allows to output trace datas to a ram buffer, which then
may be retrieved using gdb.
e.g:
(gdb) dump binary memory channel0_0 <ram_tracing_start> \
<ram_tracing_end>
Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Use a common function to get the thread name.
There was no necessity in keeping sys_trace_thread_info() inline,
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Enables optionally placing Segger RTT and SystemView data in the DTCM
linker section instead of the default data section. This is needed on
SoCs in the i.MX RT series that use cacheable external SDRAM to store
data.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Since the tracing of thread being switched in/out has the same
instrumentation points, we can roll the tracing function calls
into the one for thread stats gathering functions.
This avoids duplicating code to call another function.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds a Kconfig option for enabling post-mortem mode of SystemView.
This is useful for crashes that occur after a longer period of time.
Signed-off-by: Mattia Fiumara <mattia.fiumara@bgrid.com>
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.
A coccinelle rule is used for this:
@r_const_dev_1
disable optional_qualifier
@
@@
-struct device *
+const struct device *
@r_const_dev_2
disable optional_qualifier
@
@@
-struct device * const
+const struct device *
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Sort entries alphabetically and cleanup top level menu for each
subsystem. Move stats subsystem Kconfig from debug into its own Kconfig.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
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>
Tracing backed is not checking if the chosen backed specifies
the init function and is asuming its always present which could
not be true.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
Include directories for ${ARCH} is not specified correctly.
Several places in Zephyr, the include directories are specified as:
${ZEPHYR_BASE}/arch/${ARCH}/include
the correct line is:
${ARCH_DIR}/${ARCH}/include
to correctly support out of tree archs.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
It was already using uart_irq_callback_user_data_set below, now it also
uses uart_irq_callback_user_data_t as callback type, so let's normalize
the callbacks.
Fixes#26923
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
MISRA-C Rule 5.3 states that identifiers in inner scope should
not hide identifiers in outer scope.
There is a global variable named "dev" to store which UART
device is being used the tracing backend. This name collides
with the parameter of same name in the ISR function. So rename
the global variable.
Signed-off-by: Daniel Leung <daniel.leung@intel.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>
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>