| /* rtt_console.c - Console messages to a RAM buffer that is then read by |
| * the Segger J-Link debugger |
| * Copyright (c) 2016 Nordic Semiconductor ASA |
| * SPDX-License-Identifier: Apache-2.0 |
| #include <rtt/SEGGER_RTT.h> |
| extern void __printk_hook_install(int (*fn)(int)); |
| extern void __stdout_hook_install(int (*fn)(int)); |
| static int rtt_console_out(int character) |
| char c = (char)character; |
| SEGGER_RTT_WriteNoLock(0, &c, 1); |
| static int rtt_console_init(struct device *d) |
| __printk_hook_install(rtt_console_out); |
| __stdout_hook_install(rtt_console_out); |
| SYS_INIT(rtt_console_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); |