Commit graph

621 commits

Author SHA1 Message Date
Krzysztof Chruscinski 539c509d2c logging: cleanup in CMakeLists.txt
log_output.c was added in two places: unconditionally when logging
is enabled and when CONFIG_LOG_OUTPUT is set. Cleaning up to add
source file only when module is enabled.

Original commit was reverted. Now it is reapplied.
Original commit:af31cad8366c82a35e8749e6488252e394ce158d

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-09-01 20:54:13 +02:00
Carles Cufi d03d17a7fa Revert "logging: cleanup in CMakeLists.txt"
This reverts commit af31cad836.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-08-30 17:28:05 -04:00
Kai Vehmanen 8195ea7ea0 logging: Intel ADSP mtrace logging backend
Implements a logging backend implementing the mtrace protocol
to relay log messages over SRAM. This protocol is implemented
by the SOF Linux driver ("mtrace" debugfs interface).

This implementation follows example of the ADSP HDA logger implemented
in commit 6913da9ddd ("logging: cAVS HDA based logger").

Cc: Tom Burdick <thomas.burdick@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-29 10:43:42 +02:00
Tom Burdick 3a4864bdd2 logging: adsp hda backend improvements
* Adds a default hook and init function for cavstool.
* Adds an optional padding on flush feature to ensure all data is written.
* Fixes an error in cavstool.py for correctly wrapping the ring buffer.
* The test case now ensures wraps and flushes occur numerous times.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-26 21:33:10 -04:00
Krzysztof Chruscinski bb74b4f028 lib: os: cbprintf: Renamed flags used for conversion function
At some point, package copy function was extended and renamed
to cbprintf_package_convert. However, flags used by this
function were not renamed and used contained COPY idiom.
Deprecating flags with COPY and replacing them with flags
with CONVERT idiom to match function which is utilizing them.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-08-26 12:52:08 +02:00
Krzysztof Chruscinski af31cad836 logging: cleanup in CMakeLists.txt
log_output.c was added in two places: unconditionally when logging
is enabled and when CONFIG_LOG_OUTPUT is set. Cleaning up to add
source file only when module is enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-08-25 12:18:26 +02:00
Gerard Marull-Paretas 42b53e46aa logging: initialize devices at compile time
Initialize devices at compile time, allowing to constify device pointer.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Aastha Grover 70c51768de kconfig: logging: Add LOG_MIPI_SYST_ARGS_BUFFER_SIZE option.
Add user configurable LOG_MIPI_SYST_ARGS_BUFFER_SIZE Kconfig
option to use it for macro MIPI_SYST_PCFG_PRINTF_ARGBUF_SIZE.
Moving macro definition of MIPI_SYST_PCFG_PRINTF_ARGBUF_SIZE
from mipi-sys-t library to platform.h which defaulted to 1kb
and resulted in stack overflow in some applications.
LOG_MIPI_SYST_ARGS_BUFFER_SIZE gives flexibilty to users when
maximum log length is known.

Fixes zephyrproject-rtos/mipi-sys-t#10

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2022-08-17 12:07:08 +02:00
Krzysztof Chruscinski 15fdee04e3 logging: log_output: Add function for processing input arguments
Add function which formats a logging string from input parameters
and not from logging message. This function is more flexible since
it does not require data to be placed in the log message.

Converted a function for message processing to used this new function
internally.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-21 09:04:37 -04:00
Justin Huang cb5264162d logging: added log process thread priority support
Added Zephyr config items to support setting the priority of the log
process thread at build time.

Signed-off-by: Justin Huang <justinyhuang@fb.com>
2022-07-21 08:59:38 -04:00
Tom Burdick c225cf3b8a dma: HDA rename prefix from cAVS to ADSP
HDA is a common IP used across the entire ADSP line and deserves
a name respecting that alongside similiar IP drivers such as the
ADSP GPDMA driver.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-07-14 17:53:46 +00:00
Kumar Gala 989e17a493 dma: HDA: Convert to DEVICE_DT_GET
Move to using DEVICE_DT_GET so we can phase out DT_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-13 13:11:17 -05:00
Krzysztof Chruscinski 5f60164a0f logging: Prevent redundant thread wake up
Fix a bug introduced by 658123bb21 where if all backends were
ready prior to logging thread loop, thread was periodically
waken up for no reason. Fix is setting timeout to K_FOREVER
if all backends are ready after the initialization.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-11 18:05:35 +00:00
Krzysztof Chruscinski 60ca7899c7 logging: Initialize backends with autostart flag set
Added check which ensures that only backends with autostart
flag set are enabled automatically by the logging.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-11 18:05:35 +00:00
Daniel Leung d0d6e1181c logging: backend: notify when process thread finishes one cycle
This adds the bits to allow the process thread to notify
backends when it has finished processing pending log messages.

This allows, for example, flash-based backends to group writing
log messages to storage to limit wear, since log_output_flush()
is called per message. Also the backend does not have to resort
to using timer to periodically flush its buffer to storage,
avoiding waking up the device when there are no messages.
Another use of this is for backends requiring DMA transfers.
Grouping all pending log messages into one DMA transfer is
sometimes preferrable.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-07-11 11:09:31 +02:00
Tom Burdick 572ccd531d intel_adsp: Use device tree to enable/disable each HDA driver
Uses the dt_compat_enabled Kconfig preprocessor to set defaults
for each HDA driver.

Each direction is uniquely selectable which can be useful when building
with SOF where only some directions may wish to be enabled at any given
time.

By default, given the device tree (intel_cavs.dtsi) only the host
directions are enabled but an overlay may adjust that as needed.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-07-08 14:33:06 -04:00
Adrian Bonislawski b3beafcbac logging: cavs_hda: Allow format timestamp
LOG_BACKEND_CAVS_HDA supports LOG_BACKEND_FORMAT_TIMESTAMP

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-07-07 17:58:56 +00:00
Enjia Mai d1f2aa5516 logging: add a logging backend of EFI console
Add a EFI console logging backend to support logging sub-system.
To fix those testcases have no log output due to no logging backend.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-07-05 16:52:32 -04:00
Krzysztof Chruscinski e4bd0fceef logging: Allow for compilation without log_output
Add option to Kconfig to enable log_output module. It is used
by most of the backends but it is an optional formatter helper
thus it is possible to run logging without it. One example might
be dictionary based logging which does not format log message
to a readable string.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-04 16:43:32 +02:00
Krzysztof Chruscinski e4bfec8100 logging: Use spin lock
Updated log_core to use spin lock instead of irq_lock.
Refactored z_log_msg_post_finalize function.

Update thresholds in the log_stack test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-04 15:50:53 +02:00
Krzysztof Chruscinski 3bcd14f420 logging: Reduce code size for frontend only case
Add early returns from functions which are not used when
there is only one frontend in the system (no backends). This
allows to significantly reduce logging code size in that
configuration.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-02 14:13:54 +02:00
Andrei Emeltchenko 5fa0a979ca logging: Remove dead code
Remove unused variable.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-07-01 21:36:01 +02:00
Ryan Erickson fb34a9749f logging: add log_source_id_get
Add API to get the logging module source ID from the
module name;

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-07-01 16:30:30 +02:00
Flavio Ceolin 9e0629176d logging: adsp: Allow format timestamp
LOG_BACKEND_ADSP supports LOG_BACKEND_FORMAT_TIMESTAMP.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-07-01 11:37:32 +02:00
Adrian Bonislawski 65a242552b logging: use std_get_flags in cAVS HDA backend
This will use std_get_flags in cAVS HDA backend
and remove unnecessary duplication

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-06-29 14:42:23 +00:00
Adrian Bonislawski 83100c72cf logging: support dictionary based logging in cAVS HDA backend
This adds a dictionary based logging support in cAVS HDA backend

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-06-29 14:42:23 +00:00
Keith Packard 866f1cb9b0 lib/cbprintf: Disable tagged arguments with picolibc
Picolibc doesn't have the non-standard printf support required for tagged
arguments in cbprintf. Disable this and use the format string parsing code
instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-29 10:29:13 +02:00
Daniel DeGrasse fcc25dcf0c log: swo: enable pin control support for swo log backend
Enable pin control support for SWO log backend, by creating a new
ITM node for the ARM instrumentation trace macrocell. Add pin control
properties under this node, and refactor the swo-req-freq property to be
defined within this node.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-06-28 16:02:09 -05:00
Tom Burdick 5e08a3c40a logging: Use dma buffer alignment property for HDA
Use the newly added dma buffer alignment device tree property and macro
helper to set the buffer alignment.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-06-27 12:46:11 +02:00
Krzysztof Chruscinski 9833ca61c9 logging: Removing v2 suffix from logging names
Renaming objects which had 2 in the name to indicate that
it is v2 specific. Once logging v1 has been removed such
suffixes are redundant.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 15:46:37 -04:00
Krzysztof Chruscinski 7f1b4f88e3 logging: Rename files and test from log_msg2 to log_msg
Renaming log_msg2 files to log_msg.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 09:10:33 +02:00
Krzysztof Chruscinski c5f2cdef09 logging: Remove logging v1 from the logging
Remove v1 implementation from log_core and all references in the tree.
Remove modules used by v1: log_list and log_msg.
Remove Kconfig v1 specific options.
Remove Kconfig flags used for distinction between v1 and v2.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-16 10:51:15 -04:00
Krzysztof Chruscinski 3faee83748 logging: log_backend_xtensa: Remove LOG1 support
Remove support for LOG1 from Xtensa backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-15 10:55:26 -04:00
Krzysztof Chruscinski 34a725e89d logging: log_backend_uart: Remove LOG1 support
Remove support for LOG1 from UART backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-15 10:55:26 -04:00
Krzysztof Chruscinski 7c48063a1f logging: log_backend_swo: Remove LOG1 support
Remove support for LOG1 from SWO backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-15 10:55:26 -04:00
Krzysztof Chruscinski 28e9f4a559 logging: log_backend_spinel: Remove LOG1 support
Remove support for LOG1 from spinel backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-15 10:55:26 -04:00
Krzysztof Chruscinski ca24cb8948 logging: log_backend_rtt: Remove LOG1 support
Remove support for LOG1 from RTT backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-15 10:55:26 -04:00
Krzysztof Chruscinski 2bb3e64f89 logging: log_backend_net: Remove LOG1 support
Remove support for LOG1 from net backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-15 10:55:26 -04:00
Krzysztof Chruscinski e550a5ccda logging: log_backend_native_posix: Remove LOG1 support
Remove support for LOG1 from native_posix backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-15 10:55:26 -04:00
Krzysztof Chruscinski eb3756c2be logging: log_backend_fs: Remove LOG1 support
Remove support for LOG1 from filesystem backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-15 10:55:26 -04:00
Krzysztof Chruscinski 31971a5593 logging: log_backend_adsp: Remove LOG1 support
Remove support for LOG1 from ADSP backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-15 10:55:26 -04:00
Krzysztof Chruscinski ad12e4be32 logging: Add guards for v1 frontend API
Prevent of linking of v1 frontend API when it is not being used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-15 09:12:04 +02:00
Krzysztof Chruscinski d660492914 logging: Add option for prolonged backend initialization
Extended logging backend API with log_backend_is_ready call which
returns 0 is backend is ready. Logging core will make sure that
all autostarted backends are ready before they are enabled.

This option allows to handle backends which are not yet ready
after init function is called (e.g. usb backend that is not plugged
in). If this is the only backend in the system, logging processing
will not start util first backend is ready.

Function for checking readiness is optional and when backend has
no such function it is assumed that backend is ready after
initialization function returns which makes this feature backward
compatible.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-09 09:40:01 +02:00
Daniel Leung 125b33c185 logging: remove CONFIG_LOG2_MSG_PKG_ALWAYS_ADD_RO_STRING_IDXS
CONFIG_LOG2_MSG_PKG_ALWAYS_ADD_RO_STRING_IDXS was added as
a stop-gap measure to support Sys-T catalog messages. Since
the Sys-T backend has envolved to use tagged argument, this
kconfig and its effect are no longer needed. So remove it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-06-08 00:15:55 +09:00
Daniel Leung 134d26bade logging: syst: extend catalog messages support for other archs
This extends Sys-T catalog messages support for other architectures,
by utilizing tagged arguments to prepare the catalog messages. So
this is no longer limited to architectures where the printf
argument list has the exact format as the catalog message argument
list.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-06-08 00:15:55 +09:00
Daniel Leung fe0aa4c167 logging: support tagged argument in log message packaging
This adds support for packaging with tagged arguments for log
messages so that backends can make use of this information
when they process messages.

Note that currently tagged arguments must be used with
CONFIG_LOG2_ALWAYS_RUNTIME where log messages are created via
z_log_msg2_runtime_{v,}create(). For some reason, using C++ on
Cortex-M (mps2_an385) results in an additional empty string
argument being added to the list. This does not happen if only
doing C on mps2_an385, or on other architectures.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-06-08 00:15:55 +09:00
Fabio Baltieri e24314f10f include: add more missing zephyr/ prefixes
Adds few missing zephyr/ prefixes to leftover #include statements that
either got added recently or were using double quote format.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-27 15:20:27 -07:00
Daniel Leung 6ec1fcc214 logging: syst: embed log message source IDs in Sys-T messages
This embeds the log message source IDs inside the origin unit
as module IDs in Sys-T messages. This allows Sys-T message
parsers to see where the log messages are coming from.

This is enabled by default if using Sys-T catalog messages as
the collateral XML file contains the information to interpret
the module ID.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-05-09 12:54:53 -05:00
Gerard Marull-Paretas 5113c1418d subsystems: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all subsystems code to
the new prefix <zephyr/...>. Note that the conversion has been scripted,
refer to zephyrproject-rtos#45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-09 12:07:35 +02:00
Tom Burdick 6913da9ddd logging: cAVS HDA based logger
Adds a log backend that maintains a ringbuffer in coordination
with cAVS HDA.

The DMA channel is expected to be given some time after the logger
starts so a seperate step to initialize the dma channel is required.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-05-04 18:56:13 -04:00
Keith Packard 2c310d431f subsys/logging: Increase logging stack size for assert or spin_validate
These two options significantly increase the amount of stack space used
by the logging thread as these generate both additional logging and
generate deep stacks themselves. This fixes running the
tests/subsys/logging/log_core_additional/logging.add.log1 test on
riscv32 with THREAD_LOCAL_STORAGE enabled.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-04-28 11:09:01 +09:00
Peter Mitsis 79b57e2cbb logging: Enable Sys-T on ADSP backend
Enables the Sys-T formatting on the ADSP backend when the
SYST logging format is selected.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2022-04-20 10:25:16 -04:00
Ryan McClelland 1216f19a89 logging: fix LOG_TAG_MAX_LEN min warning
if CONFIG_LOG_TAG_MAX_LEN is 0, then a warning would be generated
on the MIN macro always being false, but as
CONFIG_LOG_TAG_MAX_LEN is a constant, then it is better to just
compile out the function if it's 0.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2022-04-19 11:49:34 +02:00
Bartosz Bilas 6367075dfe logging: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-19 11:49:27 +02:00
Rihards Skuja d5b83a8c90 logging: disable Linux-style timestamp formatting by default
Fix a typo in #43934.

Signed-off-by: Rihards Skuja <rhssk@posteo.eu>
2022-04-15 10:33:15 -07:00
Piotr Golyzniak 00a4a94076 logging: remove obj character
Remove OBJECT REPLACEMENT CHARACTER U+FFFC from warning log messages.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2022-04-15 09:24:32 -04:00
Tom Burdick 02503c37c3 logging: backend_adsp: lock the output
Adds a lock around the output to prevent corruption, and sets the buffer
size of the output to size of the output buffer. This fixes the
corrupted log output as process() may be called from multiple contexts
from different CPUs. A background log processing thread may race against
the panic ISR log context also calling process() on an SMP system.

Additionally sets the buffer size to 80 such that the cavs trace_out.c
functionality and lock are useful for more than one character at a time
greatly reducing the chances of garbled output in a printk and log race
but does not entirely prevent it. CONFIG_LOG_PRINTK=y should be used
to avoid all races.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-13 17:41:27 -04:00
Krzysztof Chruscinski 33923014b9 logging: Kconfig cleanup of frontened related options
Cleanup in kconfig options in preparation for adding a
frontend that will use dictionary mode.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-13 13:45:36 -07:00
Krzysztof Chruscinski 8f919e41fa logging: Add UART dictionary frontend
Add frontend which dumps log messages in binary dictionary
mode.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-13 13:45:36 -07:00
Krzysztof Chruscinski 8b0d429bfd logging: Add timestamp getter function part of internal API
Expose timestamp getter so it can be used, e.g. in the frontend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-13 13:45:36 -07:00
Krzysztof Chruscinski 653cda5029 logging: Fix LOG_OVERRIDE_LEVEL option
When option is set whole logs shall be set to minimum
of CONFIG_LOG_OVERRIDE_LEVEL. However, module was not
registered when module specific level was set to NONE.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-06 10:59:57 +02:00
Daniel Leung ba488d14d4 logging: syst: add support for catalog messages
MIPI Sys-T catalog messages are similar to dictionary logging
where an ID is emitted instead of the format string. This allows
the format strings to be removed from the final binary to save
a few bytes. This adds the necessary bits to determine to emit
catalog messages when appropriate.

Note that this implementation copies the argument list as-is
with string arguments stitched together since the format strings
are assumed to have been removed and they cannot be examined
to properly convert the argument lists into catalog message
payloads. Because of this, various build asserts are there to
avoid building for configurations where they are known not to
work.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-04-01 13:29:45 +02:00
Daniel Leung f7d3d0268e logging: v2: add kconfig to always add indexes to msg packages
This adds a new CONFIG_LOG2_MSG_PKG_ALWAYS_ADD_RO_STRING_IDXS
kconfig. If enabled, the log message packages will always have
the indexes of read-only string arguments appended to the package.
This will be selected only by those backends requiring it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-04-01 13:29:45 +02:00
Daniel Leung 8610f9f019 logging: syst: v1/imm: remove temp buffer for sync string output
The MIPI Sys-T library can now take a format string with a variable
argument list so there is no need for the temporary buffer anymore.

This saves some stack space in v1 immediate mode.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-04-01 13:29:45 +02:00
Krzysztof Chruscinski b98f8e39fa logging: Adapt logging to use new cbprintf feature
Adapt logging to always use static packaging. Runtime packaging
is used only when configuration requires that. Static packaging
significantly speeds up logging when there are string arguments.

Update log_stack test to new stack usage.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-30 16:16:40 -04:00
Valerio Setti 45751e2a11 logging: fix for 64 bit timestamp + new timestamp format option
Timestamps can be 32 or 64 bit long based on the platform and
build configurations. The proper way to handle these timestamps
is to use the ad-hoc log_timestamp_t variable.
This patch fixes some timestamp's reference which were still
using uint32_t changing them to log_timestamp_t.

Moreover also a new config is added in order to print the
timestamp as the Linux's kernel format. This might be useful
in AMP platforms in which Linux's and Zephyr's logs must be
interleaved in order to get a more comprehensive log solution.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-03-29 12:34:58 -07: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
Jordan Yates e65e261621 logging: backend_uart: configurable buffer size
Update the UART RAM buffer size to be user configurable from Kconfig.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-14 16:44:17 -05:00
Krzysztof Chruscinski f7b44a36f8 soc: xtensa: sample_controller: Cleanup backend config
Removing backend config from board Kconfig.defconfig and moving
it to xtensa_sim backend configuration in logging. Without this
change define persisted even when logging was not using backends
and that impacted what is compiled in.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-14 14:08:49 -04:00
Krzysztof Chruscinski 54ca1b36d7 boards: posix: Cleanup backend config for native_posix and nrf52_bsim
Removing backend config from board Kconfig.defconfig and moving
it to native_posix backend configuration in logging. Without this
change define persisted even when logging was not using backends
and that impacted what is compiled in.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-14 14:08:49 -04:00
Krzysztof Chruscinski 7c72b78660 logging: Add frontend support to v2
Extended logging v2 to support frontend api. Contrary to v1,
it is possible to have frontend and backends in the system.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-14 14:08:49 -04:00
Krzysztof Chruscinski c917e6c2ce lib: os: cbprintf: Extend API to support new packaging modes
Added new flags to packaging API:
- CBPRINTF_PACKAGE_ADD_RO_STR_IDXS - when set, read-only string
  locations are appended to the package
- CBPRINTF_PACKAGE_ADD_RW_STR_IDXS - when set, read-write string
  locations are appended to the package (instead of appending actual
  strings)
- CBPRINTF_PACKAGE_FIRST_RO_STR_CNT(n) - indicate that n first strings
  are known to be read only. Ignored in runtime packaging.

Add function for copying packages with optional appending strings.

Changed CBPRINTF_MUST_RUNTIME_PACKAGE to use same flags as packaging.

Aligned logging and test to those changes.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-14 11:16:14 +01:00
Gerard Marull-Paretas 95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Krzysztof Chruscinski 3cbfc505b3 logging: Add prompt to LOG2_ALWAYS_RUNTIME option
Prompt was removed by 154ca8526 to ensure that it is not
disable when it is required. That removed possibility of
manually enabling that option my the user. Bringing prompt
back and adding check to code to fail compilation if
LOG2_ALWAYS_RUNTIME is not set but is required.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-08 12:36:28 +01:00
Krzysztof Chruscinski 923e491db5 logging: Fix Kconfig dependency
Fix dependencies when enabling of legacy kconfig option

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-03 12:06:10 -05:00
Daniel Leung dc22617478 linker: add a utility func to check if an addr is in RO section
This adds a utility function to check if an address is within
read only section. This is extracted from logging subsys so
use the new func in logging. The one is cbprintf_packaged is
also replaced.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-02-28 10:53:02 +01:00
Daniel Leung e54b4faabc logging: v2: force LOG2_ALWAYS_RUNTIME if XCC
XCC is based on GCC 4.2.0 which doesn't support auto type.
So force CONFIG_LOG2_ALWAYS_RUNTIME to be enabled if XCC is
being used.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-02-28 10:52:51 +01:00
Krzysztof Chruscinski b74397db13 logging: Making format_table static const
Add static const to format_table.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-24 08:51:26 -08:00
Aastha Grover c0d7e10beb logging: Add support to backends to switch log format at runtime.
Adding mechanism to all the backends to switch the logging formats
at runtime while leveraging the function pointer table based upon
the Kconfigs which also cleans up the logging backend design.
Also demonstrate the working API with the changes
to syst sample. Clean up Kconfig for backends and add a standard
template to generate the Kconfigs for logging formats to be used
by all backends.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2022-02-23 14:12:22 -06:00
Aastha Grover 9fcbace639 logging: Add API's to switch logging formats at runtime.
Add support for new API's log_backend_format_set and
log_format_set_all_active_backends to switch the logging format
for one backend and for all the active backends respectively.
Using format_set function pointer in log_backend_api struct as a hook
to set the log format at runtime in the backends. Add function pointer
table with helper functions to be used as a way to select log format.
Add supported log format types as macros to use with the API.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2022-02-23 14:12:22 -06:00
Aastha Grover e4e675dc37 logging: Add API to get log_backend instance by name.
Added helper API to the logging backend interface to get the
log backend instance by name.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2022-02-23 14:12:22 -06:00
Krzysztof Chruscinski a662e69cad logging: Prevent multiple arguments evaluation
Logging v2 is utilizing complex preprocessing operations to
prepare message at compile time. Multiple operations are peformed
on log message arguments. However, it is expected that argument
will be evaluated only once (e.g. it can be a call to a function
with side effects). Adding additional layer which creates copies
of user arguments on stack and passes them to further processing.

Updated test for log_msg2 which is using internal macro which
got renamed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-22 14:44:11 +01:00
Krzysztof Chruscinski 154ca8526c logging: Use runtime packaging in immediate mode
Always use runtime packaging in immediate mode. Removing attempt to
package on stack if possible. It would be done only to speed up
logging but that is not a requirement in immediate mode where
packaging time is fractional compared to backend processing. Using
runtime packaging also reduces stack usage in the context which calls
log message.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-22 14:44:11 +01:00
Anas Nashif 49d08c25fe Revert "logging: Use spin lock"
This reverts commit dfe9561d9b.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-02-22 00:29:17 -05:00
Krzysztof Chruscinski dfe9561d9b logging: Use spin lock
Updated log_core to use spin lock instead of irq_lock.
Refactored z_log_msg_post_finalize function.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-21 22:19:00 -05:00
Krzysztof Chruscinski 81ce6db313 logging: Add common api for getting memory usage
Logging v2 did not support getting memory usage data. Adding this
support by creating common api for getting current and maximum
usage. Tracking of maximum usage is optional and can be enabled
using CONFIG_LOG_MEM_UTILIZATION.

Updated shell command to use common API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-21 20:41:17 -05:00
Daniel Leung 579829776a logging: syst: fix logging v2 with strings as arguments
The packaged string coming from logging subsys requires some
additional processing if there are string arguments.
These strings are actually embedded inside the package so
the string pointers inside the argument list must be
replaced with pointers to strings inside the package.
Without this extra step of processing, MIPI Sys-T's printf
function would process these arguments directly which may be
NULL pointers or invalid one pointing to somewhere.

This utilizes the new cbpprintf_external() for the processing
before feeding data to the MIPI library.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-02-04 11:14:55 +01:00
Krzysztof Chruscinski 157c48e4eb logging: log_output: Fix immediate output for big endian
Pointer to int was passed to a function which expected pointer to
uint8_t. There was an unexpected content for big endian as the
highest byte was read instead of the lowest which contained valid char.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-27 10:02:21 +01:00
Krzysztof Chruscinski a40ca6fd1c logging: printk: Fix LOG_PRINTK for v2
Fixed a dependency from printk.h to logging headers which in
certain configurations could lead to circular dependencies.
Cleaned up printk.c to call z_log_vprintk from vprintk.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-27 10:02:21 +01:00
Krzysztof Chruscinski 18165b1d49 logging: Fix tracking of buffered messages
Algorithm was failing in case when overflow mode was enabled
but allocation of new message failed. It could happen if message
size exceeded buffer size. Losing track of buffered messages
can lead to logging processing freeze.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-20 08:52:08 -05:00
Antony Pavlov 0369998e61 arch: add MIPS architecture support
MIPS (Microprocessor without Interlocked Pipelined Stages) is a
instruction set architecture (ISA) developed by MIPS Computer
Systems, now MIPS Technologies.

This commit provides MIPS architecture support to Zephyr. It is
compatible with the MIPS32 Release 1 specification.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
2022-01-19 13:48:21 -05:00
Krzysztof Chruscinski aff9cfc65a logging: Add assert when wrong backend is used
Add assert when logging v2 is enabled but backend doesn't support it.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-17 15:49:10 -05:00
Krzysztof Chruscinski 262cc55609 logging: Deprecate v1, default to v2
Reduced logging mode selection to deferred, immediate, minimal and
frontend. Decoupled logging version from mode and created CONFIG_LOG1
which can be used to explicitly select deprecated version.

From now on, chosing CONFIG_LOG_MODE_{IMMEDIATE,DEFERRED} will result
in version2.

Deprecated CONFIG_LOG2_MODE_{IMMEDIATE,DEFERRED} with cmake warning.

Codebase adapted to those changes.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-17 15:49:10 -05:00
Daniel Leung 4b6eb55236 logging: output/syst: don't use raw output for hexdump
Hexdump via logging is supposed to be human-readable for
debug information. Therefore, it should actually print
in human-readable form (well... after some magical decoder
has processed the raw MIPI Sys-T output).

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-14 09:59:06 -05:00
Krzysztof Chruscinski c51aa88046 logging: Fix counting of buffered messages
When message is dropped then log_process is called with
bypass flag set and additionally z_log_dropped() is called.
In both functions counter of buffered messages was decremented.
That resulted in counter being decremented twice. It resulted
in logging misbehavior after messages being dropped (delayed
processing). Fixing it by decrementing the counter in log_process
only when bypass flag is not set.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-05 14:42:40 +01:00
Krzysztof Chruscinski 8c0a017cd3 logging: Improve algorithm for waking up the thread
Use value returned by atomic_inc to decide on action.
Previously direct value was used and that could lead to
delays in logging processing because thread waking up
could be mishandled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-05 14:42:40 +01:00
Aastha Grover a89fae798c logging: Add MIPI sys-t support for v2 logging subsystem.
Adding functions log_output_msg2_syst_process and hexdump2_print
to support v2 logging subsystem.

Updates west.yml to pick up a new version of the MIPI sys-t library that
supports vprintf.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-01-05 14:41:51 +01:00
Krzysztof Chruscinski 194c0acdfd logging: Add option to have tag which is prepended to all messages
Tag can be changed at runtime. Feature is enabled by setting
maximum tag length to positive value. Additionally, default
tag can be configured in Kconfig.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-04 14:57:31 -06:00
Krzysztof Chruscinski 94a01d0192 logging: Increase stack size when NO_OPTIMIZATIONS=y
Increase stack size when optimization is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-21 09:36:09 +01:00
Robert Melchers 9c3ab333de log_backend_net: local_addrX may be used uninitialized
When CONFIG_NET_HOSTNAME_ENABLE=y, local_addrX may be used uninitialized
causing unexpected behaviour.

Signed-off-by: Robert Melchers <robert.melchers@taitradio.com>
2021-12-09 19:53:17 -05:00
Emil Lindqvist bd2eb48c05 logging: fix timestamp func overwrite on log2
When LOG2 is enabled, timestamp func which was just set
according to various conditions, is overwritten using sysclock.
Since sysclock is very fast, it will cause uint32_t to wrap very
fast and cause the time to start over from 0 often.

This commit combines the two statements doing the same thing,
to one statement.

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-12-02 10:52:51 +01:00
Krzysztof Chruscinski 74015ef2a5 logging: uart: Add support for asynchronous API
Asynchronous API may utilize DMA and significantly reduce
CPU load during outputing to UART.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-01 10:02:28 +01:00
Krzysztof Chruscinski 059d2d0c0b logging: Fix tracking of active messages
A variable is tracking number of buffered messages. This is used
to trigger processing thread in certain cases. Counter was not
handled correctly when message was dropped. In certain cases that
can lead to hanging of log processing.

Added counter decrementation in the callback called whenever
message is dropped.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-11-29 21:13:44 +01:00
Krzysztof Chruscinski c0808e3f59 logging: Minimal mode configuration cleanup
Remove LOG_MINIMAL kconfig option which was confusing
since LOG_MODE_MINIMAL existed. LOG_MINIMAL was used to
force minimal mode but because of invalid dependencies
it was leading to issues.

Refactored code to use LOG_MODE_MINIMAL everywhere and
renamed LOG_MINIMAL to LOG_DEFAULT_MINIMAL which has impact
on defualt logging mode (which still can be later changed
in conf file or in menuconfig).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-11-20 11:58:40 -05:00
Christopher Friedt 5dc6686c63 logging: log_core: do not alias atomic_t
Previously, a `uint32_t` was aliased as an `atomic_t`. However,
with #39531, `atomic_t` is now a `long` under the hood, which
is 64-bit on 64-bit platforms.

Fixes #40369

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-11-17 12:25:10 +01:00
Emil Lindqvist f0af9275ed logging: typecast to stop signed-unsigned comparison
If source_id is -1, which is a valid value, it will be
converted to unsigned since it's compared with an unsigned
which means it will be huge and asserts will trigger. To avoid
this, we typecast the unsigned part to signed.

Resolves #40115

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-11-15 08:53:51 -05:00
Guillaume Lager 7eb74f3db5 logging: rtt: Fix compilation error when multithreading disable
Fixes #39538

RTT_UNLOCK() uses a variable defined in RTT_LOCK() making mandatory
to use both function in the same block

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-10-19 23:06:20 -04:00
Krzysztof Chruscinski a18bc0f4f7 logging: Cleaning references to tracing in logging
There were some leftovers in logging after attempt to use
logging as tracing backend. Removing all references since it
lead to test compilation failures.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-29 14:59:36 +02:00
Krzysztof Chruscinski abf8c741e4 logging: Prefix internal functions with z_
There are 2 function in log_internal that were not prefixed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-28 20:31:52 -04:00
Krzysztof Chruscinski 03165c914b logging: Cleanup in the internal headers
Added log_internal.h for internal APIs. Move functions out of
log_core.h. Log_core.h shall have only macros and functions related
to logging message creation. Log_core.h is included by log.h thus
number of dependencies in that headers must be limited to minimum
to allow including without risk of circular dependencies.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-28 20:31:52 -04:00
Marin Jurjević f4a5c7d680 logging: use green color for info log level
Info log messages don't have dedicated color which
makes them harder to separate from debug logs.

Introduce green color in log output for info level
so it stands out like error and warning messages do.

Signed-off-by: Marin Jurjević <marin.jurjevic@hotmail.com>
2021-09-28 20:10:41 -04:00
Emil Lindqvist f7dad07bb0 kconfig: add names to some choices
In order to be able to make a "choice" from any other
Kconfig.defconfig (-ish) file, the choice needs to be named.
This commit names a few choices.

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-09-28 19:56:32 -04:00
Krzysztof Chruscinski ba60c94b48 lib: os: mpsc_pbuf: Add const qualifier to API calls
Add const qualifier where it was missing. Updating
relevant code.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-28 06:15:39 -04:00
Guillaume Lager a55a5b744d logging: rtt: Add overwrite mode
In this mode the oldest data is overwritten
when the buffer is full

Closes #36282

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-09-28 11:45:02 +02:00
Meng xianglin 10232b536e test: logging: improve test coverage for logging subsystem
Add some test point in existing test cases. Add some test
cases for usersapce.

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2021-09-27 10:19:49 -04:00
Krzysztof Chruscinski b942aabe69 logging: Fixing coverity issue
Add casting to fix coverity report.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-27 10:15:51 -04:00
Bartosz Bilas 0a9e930fdc logging: log_core: add extra space in missed strdup err msg
It improves readability in an error message:

before: <err> log: argument 0 in source storage log message "val %s"
missinglog_strdup().

after: <err> log: argument 0 in source storage log message "val %s"
missing log_strdup().

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-09-13 05:54:13 -04:00
Kamil Gawor dc96f016a4 logging: Add choice name in template
This commit adds choice name in a logging subsystem
Kconfig template file.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2021-09-06 14:11:06 -04:00
Markus Fuchs 05a1a5c41d logging: fs: Remove littlefs dependency
Remove littlefs dependency as FS backend works with any file system as
long as it is (manually or automatically) mounted.

Fixes #36851

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2021-09-01 08:39:24 -04:00
Torsten Rasmussen c6aded2dcb linker: align _image_rodata and _image_rom start/end/size linker symbols
Cleanup and preparation commit for linker script generator.

Zephyr linker scripts provides start and end symbols for each larger
areas in the linker script.

The symbols _image_rom_start and _image_rom_end corresponds to the group
ROMABLE_REGION defined in the ld linker scripts.

The symbols _image_rodata_start and _image_rodata_end is not placed as
independent group but covers common-rom.ld, thread-local-storage.ld,
kobject-rom.ld and snippets-rodata.ld.

This commit align those names and prepares for generation of groups in
linker scripts.

The symbols describing the ROMABLE_REGION will be renamed to:
_image_rom_start -> __rom_region_start
_image_rom_end   -> __rom_region_end

The rodata will also use the group symbol notation as:
_image_rodata_start -> __rodata_region_start
_image_rodata_end   -> __rodata_region_end

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-28 08:48:03 -04:00
Johann Fischer e78b0785b3 console: remove device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME)
Remove device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME)
and use DEVICE_DT_GET(DT_CHOSEN(zephyr_console)) to get
chosen "zephyr,console" node.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer f460848002 net: ot: rework NCP interface configuration
Rework NCP interface configuration and NCP sample. Remove
CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME and
CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM Kconfig
options in favor of chosen node zephyr,ot-uart usage.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Emil Obalski 6f4f1dc230 logging: Add configurable logging thread delay
This patch adds confiugurable delay when starting log processing
thread.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2021-08-13 11:19:27 -04:00
Ryan Erickson e4dc8ed26b logging: Add log mem shell command
Add log mem shell command to determine memory pool
usage of logging system.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-12 11:06:32 -04:00
Andrew Hedin b52ad8f3e1 logging: Add strdup current use to shell cmd
Add the number of strdup buffers currently in use to the
`log strdup_utilization` shell command.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2021-08-12 11:06:32 -04:00
Krzysztof Chruscinski 12f366c954 logging: Add resetting of dropped_cnt to init
It is mainly for testing purposes where logging is multiple times
reinitialized.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-08-03 16:11:49 -05:00
Krzysztof Chruscinski 6024bbc601 logging: Split log_core into two files
Extract functions which are managing logging sources
and backends into separate file: log_mgmt.

So far those functions were in log_core mixed with functions
specific to log message creation and log processing.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-30 19:58:13 -04:00
Evgeniy Paltsev f54d0b7aa5 ARC: 64BIT: increase LOG_PROCESS_THREAD stack size
Increase LOG_PROCESS_THREAD_STACK_SIZE for ARCv3 64 bit to
fix failing test
tests/subsys/logging/log_core_additional/logging.add.async
due to stack overflow.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-07-29 11:47:25 -04:00
Krzysztof Chruscinski 5d80cbae59 lib: os: cbprintf: Add support for conversion to fsc package
Added support for conversion from a standard package which contains
pointers to read only strings to fully self-contained (fsc) package.
Fsc package contains all strings associated with the package thus
access to read only strings is not needed to format a string.

In order to allow conversion to fsc package, standard package must
contain locations of all string pointers within the package. Appending
that information is optional and is controlled by flags parameter
which was added to packaging API. If option flag is set then
package contains header, arguments, locations of read only strings and
transient strings (each prefixed with string argument location).
Package header has been extended with field which contains number of
read only string locations.

A function for conversion to fsc package has been added
(cbprintf_fsc_package()).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-27 14:50:45 +02:00
Krzysztof Chruscinski 0b79661cff logging: log_backend_swo: Add support for logging v2
Added support for logging v2 backend API for SWO backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-23 16:06:37 -04:00
Marcin Niestroj 70bd03799c logging: fs: allow maximum file size to be 1GB
So far the maximum configurable file size was limited to 16KB (2^14).
This might be enough for small partitions on internal flash. For
external QSPI memories however, this is certainly too restrictive.

Change maximum configurable file size to be 1GB, which is 2^30. Such
value will prevent signed integers overflow on 32-bit platforms, while
giving user full flexibility on how big log files should be.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-20 19:57:50 -04:00
Marcin Niestroj eb0eb67481 logging: fs: fix leak of opened directories in check_log_file_exist()
Opened directory descriptor is leaked when returning 1. Fix that by
utilizing goto in function return path.

Fixes: 6b18e6992d ("subsys/loggin/log_backend_fs: added recovery after
  file lost")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-20 13:31:33 +02:00
Christopher Friedt 8e9d055d49 logging: use unsigned print format specifier
Even though it's highly unlikely that a component of time
would ever approach INT_MAX, use the unsigned specifier to mitigate
any unexpected behaviour.

Fixes #36814

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-07-19 20:04:03 -04:00
Marcin Niestroj 8e1a071725 logging: allow timestamp formatting for FS backend
FS backend is no different when it comes to producing human readable
timestamp. Allow to select it when FS is the only enabled logging
backend.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-19 12:02:43 +02:00
Elliot Revell-Nash 15318634b7 logging: count file with index 0 as log file too
Fixes #36667

If you had a single log file with index 0 created and you reboot
the log backend wasn't counting it and was overwiting it.
If you filled that file up before rebooting then it worked as
expected, creating a new file at the next index on each boot.

Signed-off-by: Elliot Revell-Nash <elliot.revell-nash@wdtl.com>
2021-07-16 21:55:55 -04:00
Krzysztof Chruscinski f7efacf441 logging: log_backend_spinel: Add support for logging v2
Added support for logging v2 backend API in spinel backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-14 11:06:46 -05:00
Krzysztof Chruscinski 940a54c6f6 logging: log_backend_xtensa_sim: Add support for logging v2
Added support for logging v2 backend API in xtensa_sim.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-14 11:05:15 -05:00
Krzysztof Chruscinski d90775a014 logging: Shell commands available when shell acts as log backend
Some commands shell not be present when shell is not acting as
a log backend. Use of them lead to crash in that case.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-13 10:12:27 -04:00
Krzysztof Chruscinski 28be4ba91d logging: log_backend_net: Add support for logging v2
Added support for logging v2 backend API in net backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-13 09:39:28 -04:00
Elliot Revell-Nash e4507ec6ee logging: dictionary format output to file
Add the option to send logs to fs backend using new dictionary
formatting
This can result in much better use of filesystem space

Signed-off-by: Elliot Revell-Nash <elliot.revell-nash@wdtl.com>
2021-06-09 05:44:03 -05:00
Maksim Masalski 366de7a890 logging: z_vrfy_log_filter_set: remove extra check
Variable "level" in function z_vrfy_log_filter_set() has type unsigned.
But it is been checked if "level >=LOG_LEVEL_NONE" and
LOG_LEVEL_NONE is 0. It means check if unsigned is ">= 0" in Z_OOPS().
That is logically wrong, because unsigned is ">=0" by default.
Remove that check, to avoid static analysis tool raise
violation

Found as a coding guideline violation (MISRA R14.3) by static
coding scanning tool.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2021-06-04 16:19:49 -05:00
Jennifer Williams d6a3679c97 logging: log_msg.c: fix coding guideline 15.7 missing comment
The final else {} in the if...else if is missing required
comment (non-empty, ';' is not sufficient). This adds a comment
to comply with CG 15.7.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2021-06-03 20:07:16 -05:00
Jennifer Williams 09ee9d6e29 logging: log_core.c: fix coding guideline 15.7 missing comment
The final else {} in the if...else if is missing required
comment (non-empty, ';' is not sufficient). This adds a comment
to comply with CG 15.7.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2021-06-03 20:07:16 -05:00
Krzysztof Chruscinski f98bc0c0bc logging: backend_rtt: Align to changes in RTT_LOCK/UNLOCK
RTT_LOCK/UNLOCK in certain configuration creates code block (curly
braces). In that case variables declared inside are local to that
block. Moved declaration of ret variable before the block. Updated
code to ensure that RTT_LOCK/UNLOCK are in the same code block.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-27 13:33:02 +02:00
Anas Nashif 108129cf7d tracing: fix conflict with RTT locking
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>
2021-05-25 07:36:38 -05:00
Krzysztof Chruscinski f5be847e6d logging: Add missing va_end in log_msg2
Added missing va_end. Reported by coverity CID 232501

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-12 23:36:01 -05:00
Krzysztof Chruscinski 4c971d2c21 logging: Add panic flag reset to core initialization
Add panic_mode flag reset to log_core_init(). It allows full logging
reinitialization which is useful for testing.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-06 15:40:05 +02:00
Krzysztof Chruscinski d58ff39879 logging: Fix runtime filtering in immediate mode
Fixed immediate mode where runtime filter was not applied.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-06 15:40:05 +02:00
Krzysztof Chruscinski d9518ce4cc logging: Add optional context argument to LOG_BACKEND_DEFINE
Extended LOG_BACKEND_DEFINE to support optional context argument.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-06 15:40:05 +02:00
Robert Lubos 39aee39cf9 net: openthread: Align with the new NCP API
OpenThread modified its NCP API, so we need to align with these changes
in Zephyr.

One of the major changes was removal of UART from the platform APIs.
`openthread/platform/uart.h` header file was moved to
`examples/platforms/util/uart.h` so we need to use the new location in
Zephyr. This means that OpenThread no longer impose the UART API but for
the simplicity of the upmerge I've kept the UART APIs as they are for
now.

The NCP initialization function have now to register a send handler,
and the appropriate transport driver have to call NCP callbacks when
transmission/reception is done. For now, re-use the existing code of
the UART driver, just as the upstream NCP application does.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-30 12:55:02 -05:00
Krzysztof Chruscinski 7f1d4fdb5b logging: Enable MPSC_PBUF for legacy modes
Logging failed to compile when --no-gc-sections is used because
log_core is conditionally calling mpsc_pbuf.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-29 09:53:19 -04:00
Krzysztof Chruscinski a4af0ee2ec logging: Fix support for no multithreading
Fixed to ensure that semaphore is not used by the log core
when multithreading is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-29 14:50:35 +02:00
Daniel Leung 8d0201f6eb logging: backend null check to use NULL...
...instead of numeric zero.

Using 0 instead of NULL is a violation of MISRA rule 11.9.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-29 07:16:37 -04:00
Daniel Leung 9b4ae26e70 logging: add UART backend for dictionary based logging
This adds a new UART backend for dictionary based logging,
where this can output binary data in both binary and
hexidecimal strings.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-28 22:25:42 +02:00
Daniel Leung a5ab1a7518 logging: add support for dictionary based logging
This adds dictionary based logging support. Dictionary based
logging is binary based where one big difference is that
static strings are stored as pointers instead of the whole
string. This results in reduced space requirements for
storing log messages in certain scenairos.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-28 22:25:42 +02:00
Daniel Leung 990919fb89 logging: simplify is_rodata() for NIOS2, RISC-V and SPARC
NIOS2, RISC-V and SPARC are using _image_rodata_start/_end in
their linker scripts to mark the boundaries of rodata. So
they no loner need special treatment.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-28 22:25:42 +02:00
Krzysztof Chruscinski 292a15be78 logging: Increase thread stack size when net backend in use
It has been seen that when net backend is enabled stack usage
is around 1080. Setting 1152 as the default.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-26 14:14:34 -04:00
Andrés Manelli ecf89143da logging: Do not set CYCCNTENA to zero in swo backend
The log_backend_swo_init function sets the CYCCNTENA bit of the DWT
register to 0, disabling the counter (which is necessary for the timing
functions.
Avoid overwriting the CYCCNTENA bit.
Do not try to set read-only bits.

Fixes #34341

Signed-off-by: Andrés Manelli <am@toroid.io>
2021-04-22 09:14:44 +02:00
Marcin Niestroj 552028dd20 logging: add log_output_timestamp_to_us() helper function
So far we only have log_msg_timestamp_get() function, which returns
internal timestamp representation. This is either clock cycles or uptime
in ms, depending on main clock precision.

Introduce log_output_timestamp_to_us() helper function, which allows to
convert internal logging timestamp to us.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-04-20 18:21:26 -04:00
Flavio Ceolin 8cbda26cdd logging: log_minimal: Fix violations to rule 10.4
Logical AND operator accepts only unsigned type and operands.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-04-20 15:50:49 -04:00
Flavio Ceolin 3687021c83 logging: log_minimal: Fix violation to rule 14.4
Non-boolean essential type is being interpreted as a boolean.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-04-20 15:50:49 -04:00
Flavio Ceolin 8c5a9ffaab logging: log_minimal: Fix violations to 21.2 and 8.3
Just renaming the function parameter fix two violations, one is
caused because the parameter name is different from the declaration
the other violation is because the identifier was starting with
underscore.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-04-20 15:50:49 -04:00
Flavio Ceolin ed6e016251 logging: log_minimal: Fix violations to rule 10.4
Fix violations for the rule 10.4.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-04-20 15:50:49 -04:00
Krzysztof Chruscinski bb64419a29 logging: Adapt ADSP backend to v2
Added support for v2 backend interface to ADSP.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski da31e09f2b logging: Add v2 support to RTT backend
Add support for logging v2 to RTT backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski e767bf6377 logging: Add v2 support to native_posix backend
Add support for logging v2 to native_posix backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski 7ce3f7a25a logging: backend_uart: Adapt to support v2 api
Adapted to handle processing of v2 log messages.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski f1bb20f6b4 logging: Adapt logger to support both versions
Adapted to be able to switch between v1 and v2.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski 902ccd7235 logging: log_output: Extend to support log_msg2 parsing
Added parsing of log_msg2.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski f6a40ae183 logging: Add logging v2 implementation for log_msg
Added implementation of log_msg2 which is creating log messages
using cbprintf packaging and storing them in circular ring buffer
(mpsg_pbuf).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski ba1aa75c66 logging: Refactor in preparation for logging v2
Refactor and cleanup in preparation for v2.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Flavio Ceolin d0dac69fa9 logging: Fix 10.4 violations
Both operands of an operator in which the usual arithmetic
conversions are performed shall have the same essential
type category.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-04-10 09:59:37 -04:00
Jukka Rissanen b59f0e5057 log: Align the log_strdup_buf properly
The k_mem_slab_init() calls create_free_list() which checks
the slab block alignment. Noticed with Intel ehl_crb board,
which is 64-bit architecture, that the k_mem_slab_init() fails
because the log_strdup_buf items were not aligned properly.
This commit adds the alignment requirement to log_strdup_buf so
that the elements are alignment properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-08 09:57:42 +02:00
Flavio Ceolin 8153666a27 logging: Fix 14.4 guideline violation
The controlling expression of an if statement has to be an
essentially boolean type.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-04-06 10:25:24 -04:00
Anas Nashif 0ec3774bde userspace: rename _is_user_context -> k_is_user_context
This functions is being called across the tree, no reason why it should
not be a public API.

The current usage violates a few MISRA rules.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-01 05:34:17 -04:00
David Leach f2d8b4cc94 logging: log_backend_fs: Fix check for error on fs_sync() - coverity
Fixes #33791

Signed-off-by: David Leach <david.leach@nxp.com>
2021-04-01 04:52:10 -04:00
Carlo Caione 3539c2fbb3 arm/arm64: Make ARM64 a standalone architecture
Split ARM and ARM64 architectures.

Details:

- CONFIG_ARM64 is decoupled from CONFIG_ARM (not a subset anymore)
- Arch and include AArch64 files are in a dedicated directory
  (arch/arm64 and include/arch/arm64)
- AArch64 boards and SoC are moved to soc/arm64 and boards/arm64
- AArch64-specific DTS files are moved to dts/arm64
- The A72 support for the bcm_vk/viper board is moved in the
  boards/bcm_vk/viper directory

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-03-31 10:34:33 -05:00
Flavio Ceolin 9fd4ea91b7 coccinelle: Remove extra semicolon
coccicheck --mode=patch --cocci=semicolon.cocci

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-25 11:35:30 -05:00
Krzysztof Chruscinski 68fd304d19 logging: Increase default CONFIG_LOG_STRDUP_MAX_STRING to 2
In modes where string duplication is not used, the code is
still compiled. On some compilers it was failing due to calling
strncpy which will do nothing because n is 0. Increase
CONFIG_LOG_STRDUP_MAX_STRING to 2 to ensure that n is 1 in that
case

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-24 21:42:10 -04:00
Krzysztof Chruscinski 34decfd408 logging: Add name to the mode choice in kconfig
Adding name allows to modify default choice by other modules.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-23 13:00:33 +01:00
Anas Nashif 2976e12946 logging : do not reuse tag name log_output
Do not reuse tag name (misra rule 5.7).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-22 19:48:14 -04:00
Andrzej Puzdrowski eb9454628e logging/log_backend_fs: support any directory
Added procedure which is able to create nested log director.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-22 13:04:23 -04:00
Andrzej Puzdrowski 6b18e6992d subsys/loggin/log_backend_fs: added recovery after file lost
Added recovery for case when log file was lost somehow.
Back-end will try to create new file if possible.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-22 13:04:23 -04:00
Mateusz Syc fe5f602606 susbys: logging: Added logging to flash backend
New backend is based on littleFS. After init, there is created new file
with continuous numeration. When max size of file is reached, system
creates another one. File size is limited by Kconfig option.
There is possibility to overwrite old files or drop new ones.
FS backend logging to file if the FS location is available.
Otherwise log messages are drooped.

User can also change the name of log files.

Signed-off-by: Mateusz Syc <Mateusz.Syc@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <Andrzej.Puzdrowski@nordicsemi.no>
2021-03-22 13:04:23 -04:00
Krzysztof Chruscinski 1a5fce97b7 logging: swo: Add option to set custom reference frequency
Some devices may use different reference than cpu clock. Add
support for using swo-ref-frequency property when present.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-15 10:23:10 +01:00
Marek Pieta 7e469c2f94 log: Fix defining CONFIG_LOG_STRDUP_MAX_STRING
Change fixes an issue related to data access out of array bounds and
suppresses compiler warning.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-03-15 10:21:18 +01:00
Krzysztof Chruscinski 7e125fe7e4 logging: Add backend parameter to the init function
Added backend parameter to the backend init interface function.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-12 09:24:54 -05:00
James Harris 97b5741ade logging: fix TOCTTOU issue in z_log_hexdump_from_user
Previously, a racing write to the provided metadata could result
in up to CONFIG_LOG_STRDUP_MAX_STRING-2 bytes after the
end of user-accessible memory being leaked into the strdup pool
or the resulting log.

For now, explicitly copy the metadata string. In an ideal world
this could directly copy from userspace into the strdup buffer, but
this obviously only works if strdup is enabled.

Signed-off-by: James Harris <james.harris@intel.com>
2021-03-10 06:09:38 -05:00
Spoorthy Priya Yerabolu 6d10db3ed6 Coding guideline: Fixing code violations for 21.13 Rule
Any value passed to a function in <ctype.h> shall be
representable as an unsigned char or be the value EOF.

So changed type of variable to unsigned char.

Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
2021-03-05 10:53:13 +03:00
Joakim Andersson 45da9d3962 Kconfig: logging: Improve defaults for Bluetooth
Improve default logging strdup buffer count and size.
The maximum string logged with Bluetooth is a 32-byte key in hex.
The strdup buffer is empty too often.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-03-04 14:20:25 +02:00
Krzysztof Chruscinski b4da16e81c logging: Refactor msg_finalize
Extract notifying about new log message into separate function.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-02-28 17:12:29 -05:00
Krzysztof Chruscinski e0392c5a86 logging: Cleaning up log minimal
Removed printk.h include from log_core.h.

Since LOG_PRINTK cannot be enabled with LOG_MINIMAL removed
support for both.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-02-28 17:12:29 -05:00
Krzysztof Chruscinski 7f08061f0c logging: Revamp menuconfig
Clean up logging menuconfig by grouping configuration into
sections like: mode, processing configuration, backends.

Additionlly, removed LOG_ENABLE_FANCY_OUTPUT_FORMATTING which is no
longer in use.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-01-26 06:15:42 -05:00
Dominik Ermel 5a71644518 logging: Fix missing static to k_spinlock definition
The definition of lock, k_spinlock type, that has been used to guard
variables holding statistical data for log_strdup has been missing
static modifier, which caused the lock structure to be reallocated
on stack each time an execution entered the block.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-01-18 19:12:44 +01:00
Martin Åberg dc4e331e45 logging: improve string logging on 64-bit ABI
In std_print(), the log arguments were casted to uint32_t before
being sent further to the output function.

For integer types which can not be represented by uint32_t, the
degraded user experience may be acceptable.

However, for string arguments, the output function will eventually
dereference the pointer, so if the "char *" can not be represented
by uint32_t, bad things are going to happen. In practice you will see
this on 64-bit systems where sizeof (char *) is 8 byte and addresses
higher than 0x80000000.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg cda619996e logging: more default stack on RISC-V 64-bit
The default stack size of 768 is just too small for RISC-V 64-bit.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg 226f918289 logging: Reduce missinglog_strdup() on SPARC
is_rodata() can now determine if an object is the rodata section
on SPARC. This eliminates spurious run-time error messages about
"missinglog_strdup()".

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2020-12-14 11:23:34 +01:00
Jukka Rissanen cc528d37c2 net: syslog: Make sure CONFIG_LOG_IMMEDIATE is not set
The immediate logging option cannot be used with network logging
support CONFIG_LOG_BACKEND_NET as that would cause the generated
rsyslog messages to be malformed. The UDP packets would only have
one byte payloads which is not correct. So make sure that user is
not able to select a configuration with immediate mode and network
logging.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-12-04 15:46:42 +02:00
Markus Becker 638b5f389f net: openthread: OpenThread RCP mode integration into Zephyr
* Add RCP library.
* Conditionally remove non required libraries not required for RCP.
* Drop :option: marker for CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_ACM

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-11-19 12:34:14 +01:00
Andy Ross be2a5824f3 soc/intel_adsp: Unify trace backends
This platform had separate backends for the log subsystem and printk
handler, which was silly.  Unify them to use the same backend so they
don't clobber each other.

This patch appears to be a lot of lines, but it's really mostly code
motion and renaming.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-11-17 12:28:10 -08:00