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>
Extended support in the log_core and log_output to 15 arguments
which is the hard limitation of log message format.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Log_generic() can be used by external logger systems to map to zephyr
logger subsystem. Function has variable number of arguments. So far
logger assumed maximal number of arguments to avoid scanning
string to count number of arguments. In outcome, uninitialized memory
was treated as valid argument in a message (but discarded when actual
string formatting took place). Valgrind complained about that so
log_generic() has been extended to scan the string and count number
of arguments and build message with valid number of arguments.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
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>
Fix grammar in subsys/logging/Kconfig
Fix grammar in subsys/logging/Kconfig
Fix grammar in subsys/logging/Kconfig
Fix grammar in subsys/logging/Kconfig
Signed-off-by: David Kinder <david.b.kinder@intel.com>
Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>
This option allows to explicitly include Segger RTT libraries and
enables use of it for various subsystems. It is disabled by
default as it consumes more RAM.
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>
log_strdup requested for a piece of memory, with the first 4 bytes as
the number of references and the next used to copy strings. In the
implementation of this function, the memory is managed by user and
is a little hard to understand.
Rewriting this part of code, using structure to manage the memory
requested, make it easier to understand.
Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
log_strdup writes out of bounds of a strdup slab.
e.g: CONFIG_LOG_STRDUP_MAX_STRING=46 and
LOG_STRBUF_STR_SIZE=47 then in the line L:529
sdupl[LOG_STRBUF_STR_SIZE - 1] = '\0';
writes out of bounds because the available buffer space
is only 44 bytes (rounded up to 48 bytes and minus 4 bytes
for the allocated flag).
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
Extended logger to support optional log message prepending with
function name.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Extended supported number of arguments in log message. Support for
messages consisting of more than 2 chunks had to be added. So far
messages could consist of one chunk (up to 3 args) or two chunks
(2 args in first chunk and 7 in second chunk). Once 2+ chunks
support is added number of arguments is techinically limited to
15 (4 bit field). log_core and log_output extended to suppor 10
arguments.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Add 2 new flags to control the output of newlines by the logger output
module. By default the logger adds both CR and LF, and with these 2 new
flags it is now possible to request LF only or no newlines at all.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
In initial state of the system it is possible that no backends are
yet enabled and log processing is triggered. In that case logs were
discarded. A flag has been added to the log core to do processing
only if at least one backend is enabled. It is applicable only to
initial phase. If backends are disabled in application lifetime
logs will be discarded.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Extended macro to accept flag indicating if given backend must be
initialized and enabled when log subsystem starts. Typically, simple
backends will have autostart flag set. More complex may require
explicit enabling (e.g. shell over BLE can only be enabled when
BLE connection is established).
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
We are using a non-32-bit aligned value as the block size
when initializing the strdup mem_slab for Logger.
When the non-aligned pointer is being freed, it's converted
to a u32_t and this generates the following:
***** USAGE FAULT *****
Unaligned memory access
Let's use the aligned buffer size as the block size instead.
Signed-off-by: Michael Scott <mike@foundries.io>
The string parameter needs to be const as otherwise calling this
function using a const string pointer will lead to a warning.
Besides the function does not modify the parameter so should be
const anyway.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
1. Command handler can return command exectution status as int.
2. Existing command handlers rework.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Extending logger to support logging transient strings (with %s).
With dedicated call (log_strdup), string is duplicated to a buffer
from internal logger pool. Logger implicitly manages the pool.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Added flag in log_output module to add timestamp when message is
formatted to a string. Updated existing backends.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Added flag in log_output module to add severity level when message is
formatted to a string. Updated existing backends.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
After the recent change in `struct log_backend_api` (ie: add
of `init` function), init function can be marked as `static`
as it is only used in the scope of the file.
Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
Fix merge error introduced in:
ba01a3952f
(as part of #9362)
which deleted the native_posix backend for the logger.
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Added commands for getting current status and controlling which log
messages are forwared to available backends.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
For the native_posix backend, use the appropiate tracing
functions and enable color if it should be
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
When CONFIG_LOG_PROCESS_THREAD was not set the logger
was not initialized.
Register a POST_KERNEL init for that case.
Also added an assert in the logger thread in case there
is no backends, instead of having that thread spinning
forever.
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Module refactored: splitted data into read-only part and control block,
adding macro for creating log_output instance
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Move to more generic tracing hooks that can be implemented in different
ways and do not interfere with the kernel.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Consistently use
config FOO
bool/int/hex/string "Prompt text"
instead of
config FOO
bool/int/hex/string
prompt "Prompt text"
(...and a bunch of other variations that e.g. swapped the order of the
type and the 'prompt', or put other properties between them).
The shorthand is fully equivalent to using 'prompt'. It saves lines and
avoids tricking people into thinking there is some semantic difference.
Most of the grunt work was done by a modified version of
https://unix.stackexchange.com/questions/26284/how-can-i-use-sed-to-replace-a-multi-line-string/26290#26290, but some
of the rarer variations had to be converted manually.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>