Skip to content

Commit 70ab8fe

Browse files
committed
logging: Add v2 support to RTT backend
Add support for logging v2 to RTT backend. Signed-off-by: Krzysztof Chruscinski <[email protected]>
1 parent f660c72 commit 70ab8fe

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

subsys/logging/Kconfig.backends

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ endif # LOG_BACKEND_SWO
5252
config LOG_BACKEND_RTT
5353
bool "Enable Segger J-Link RTT backend"
5454
depends on USE_SEGGER_RTT
55-
depends on !LOG2
5655
default y if !SHELL_BACKEND_RTT
5756
help
5857
When enabled, backend will use RTT for logging. This backend works on a per

subsys/logging/log_backend_rtt.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,20 @@ static void sync_hexdump(const struct log_backend *const backend,
295295
timestamp, metadata, data, length);
296296
}
297297

298+
static void process(const struct log_backend *const backend,
299+
union log_msg2_generic *msg)
300+
{
301+
uint32_t flags = log_backend_std_get_flags();
302+
303+
log_output_msg2_process(&log_output_rtt, &msg->log, flags);
304+
}
305+
298306
const struct log_backend_api log_backend_rtt_api = {
299-
.put = IS_ENABLED(CONFIG_LOG_IMMEDIATE) ? NULL : put,
300-
.put_sync_string = IS_ENABLED(CONFIG_LOG_IMMEDIATE) ?
307+
.process = IS_ENABLED(CONFIG_LOG2) ? process : NULL,
308+
.put = IS_ENABLED(CONFIG_LOG_MODE_DEFERRED) ? put : NULL,
309+
.put_sync_string = IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE) ?
301310
sync_string : NULL,
302-
.put_sync_hexdump = IS_ENABLED(CONFIG_LOG_IMMEDIATE) ?
311+
.put_sync_hexdump = IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE) ?
303312
sync_hexdump : NULL,
304313
.panic = panic,
305314
.init = log_backend_rtt_init,

0 commit comments

Comments
 (0)