Exported header oftenly used when creating a logging
backend that inpects the log 'stream'.
Enables use in external Zephyr modules implementing the
logging backend interface.
Signed-off-by: Emil Hammarstrom <emil.hammarstrom@assaabloy.com>
The logging subsytsem had if else if constructs without final
else statement. This commit adds else {} to comply with
coding guideline 15.7.
Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
MISRA-C Rule 5.3 states that identifiers in inner scope should
not hide identifiers in outer scope.
The log output instances all named "log_output" in backends
collide with the "log_output" parameter of various functions.
This renames the variables in the backends to make them
more descriptive. Same goes for the buffers for some of
these instances as they are all named "buf", and "hostname"
being used in the network backend, so they are renamed.
There are a few places where variables are overriden within
an inner scope (e.g. inside loop and if block) so they are
also renamed.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Set 'log_backend_rtt:panic_mode' before calling 'log_backend_std_panic',
because otherwise the RTT backend behaves as if the system is NOT
panicking and tries to do asynchronous writes via RTT_LOCK/UNLOCK.
Signed-Off-By: Andrew Fernandes <andrew@fernandes.org>
Kernel timeouts have always been a 32 bit integer despite the
existence of generation macros, and existing code has been
inconsistent about using them. Upcoming commits are going to make the
timeout arguments opaque, so fix things up to be rigorously correct.
Changes include:
+ Adding a K_TIMEOUT_EQ() macro for code that needs to compare timeout
values for equality (e.g. with K_FOREVER or K_NO_WAIT).
+ Adding a k_msleep() synonym for k_sleep() which can continue to take
integral arguments as k_sleep() moves away to timeout arguments.
+ Pervasively using the K_MSEC(), K_SECONDS(), et. al. macros to
generate timeout arguments.
+ Removing the usage of K_NO_WAIT as the final argument to
K_THREAD_DEFINE(). This is just a count of milliseconds and we need
to use a zero.
This patch include no logic changes and should not affect generated
code at all.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
RTT backend was treating synchronous mode (LOG_IMMEDIATE) and panic
mode in the same way. That lead to decreased bandwidth since after
each transfer operation backend was pending until RTT data is read by
the host. It is vital only in panic mode to ensure that device do not
reset before all data is read by the host. In synchronous mode that
degrades performance significantly.
Added distinction between those two modes.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Ensure that RTT and xtensa_sim backends are using single byte
log_output buffer.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Drop mode in RTT backend was broken. It is not the default
one so most likely it was unnoticed for a long time. Fixed
to report drop message when logs are lost.
Additionally, added assert to ensure that memmove does not
do memory overwrite.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
RTT backend supports two modes blocking and drop. Apparently,
defines used lead to warning while clang compilation. Define
that caused warning has been changed together with clean up
which removed #ifdefs for definitions.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Backend was not initialized to work in synchronous mode if LOG_IMMEDIATE
was enabled. That causes use of rtt_lock which uses mutex. That lead to
assert in application.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
In case it was detected that RTT host was not present
backend was still performing single sleep or busy wait
round before dropping data. That was degrading log
processing performance.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.
This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.
All files that use these macros have been updated.
Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
RTT log backend was locking in panic if host absense was not yet
detected (early panic). It is fixed by adding detection of host
absense while pending on data being read by the host.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
It may happen that panic occured while logger backend
was formatting output data. In that case output buffer
could get corrupted as logger assumes that processing
happens in one context only (panic is the only exception).
Added log output buffer flushing on entering panic state.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Refactored blocking operation of RTT backend. Log_output buffer
is used directly in case of blocking operation. Detection of
host presence added. Prevent use of RTT lock when in panic mode.
Removed pending on data being read by the host on every message.
Refactor gives savings of 300 bytes in ROM and 120 bytes in RAM.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
According with MISRA-C the value returned by a non-void function has
to be used. As memcpy return is almost useless, we are explicitly
ignoring it.
MISRA-C rule 17.7
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Fix issue caused by 3fc497ac9a
This change removes `rtt` and `systemview` from header includes
as these are already placed in the path.
Also `SEGGER_SYSVIEW_ConfDefaults.h` header included from
`SEGGER_SYSVIEW_Int.h` is placed higher to make sure `INLINE`
definition is properly visible.
Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
When a RTT logger backend is configured to blocks, allow other threads
to continue during waiting for data to be transferred to host.
Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>
As RTT is used by more subsystem in Zephyr, initialization is moved
from RTT console and RTT logger backend to common kernel init phase.
Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>
Add logger backend that uses Segger RTT for message output. Several
options are provided allowing configuration of up-buffer and logger
behaviour.
Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>