1# Copyright (c) 2021 Nordic Semiconductor ASA 2# SPDX-License-Identifier: Apache-2.0 3 4config LOG_BACKEND_RTT 5 bool "Segger J-Link RTT backend" 6 depends on USE_SEGGER_RTT 7 default y if !SHELL_BACKEND_RTT 8 select SEGGER_RTT_CUSTOM_LOCKING 9 select LOG_OUTPUT 10 help 11 When enabled, backend will use RTT for logging. This backend works on a per 12 message basis. Only a whole message (terminated with a carriage return: '\r') 13 is transferred to up-buffer at once depending on available space and 14 selected mode. 15 In panic mode backend always blocks and waits until there is space 16 in up-buffer for a message and message is transferred to host. 17 18if LOG_BACKEND_RTT 19 20choice LOG_BACKEND_RTT_MODE 21 prompt "Logger behavior" 22 default LOG_BACKEND_RTT_MODE_BLOCK 23 24config LOG_BACKEND_RTT_MODE_DROP 25 bool "Drop messages that do not fit in up-buffer." 26 help 27 If there is not enough space in up-buffer for a message, drop it. 28 Number of dropped messages will be logged. 29 Increase up-buffer size helps to reduce dropping of messages. 30 31config LOG_BACKEND_RTT_MODE_BLOCK 32 bool "Block until message is transferred to host." 33 help 34 Waits until there is enough space in the up-buffer for a message. 35 36config LOG_BACKEND_RTT_MODE_OVERWRITE 37 bool "Overwrite messages if up-buffer full" 38 help 39 If there is not enough space in up-buffer for a message overwrite 40 oldest one. 41 42endchoice 43 44backend = RTT 45backend-str = rtt 46source "subsys/logging/Kconfig.template.log_format_config" 47 48config LOG_BACKEND_RTT_MESSAGE_SIZE 49 int "Size of internal buffer for storing messages." 50 range 32 256 51 default 128 52 depends on LOG_BACKEND_RTT_MODE_DROP 53 help 54 This option defines maximum message size transferable to up-buffer. 55 56if LOG_BACKEND_RTT_MODE_BLOCK 57 58config LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE 59 int "Size of the output buffer" 60 default 16 61 help 62 Buffer is used by log_output module for preparing output data (e.g. 63 string formatting). 64 65config LOG_BACKEND_RTT_RETRY_CNT 66 int "Number of retries" 67 default 4 68 help 69 Number of TX retries before dropping the data and assuming that 70 RTT session is inactive. 71 72config LOG_BACKEND_RTT_RETRY_DELAY_MS 73 int "Delay between TX retries in milliseconds" 74 default 5 75 help 76 Sleep period between TX retry attempts. During RTT session, host pulls 77 data periodically. Period starts from 1-2 milliseconds and can be 78 increased if traffic on RTT increases (also from host to device). In 79 case of heavy traffic data can be lost and it may be necessary to 80 increase delay or number of retries. 81 82endif # LOG_BACKEND_RTT_MODE_BLOCK 83 84config LOG_BACKEND_RTT_BUFFER 85 int "Buffer number used for logger output." 86 range 0 SEGGER_RTT_MAX_NUM_UP_BUFFERS 87 default 0 88 help 89 Select index of up-buffer used for logger output, by default it uses 90 terminal up-buffer and its settings. 91 92config LOG_BACKEND_RTT_BUFFER_SIZE 93 int "Size of reserved up-buffer for logger output." 94 default 1024 95 depends on LOG_BACKEND_RTT_BUFFER > 0 96 help 97 Specify reserved size of up-buffer used for logger output. 98 99# Enable processing of printk calls using log if terminal buffer is used. 100# Same buffer is used by RTT console. If printk would go through RTT console 101# that will lead to corruption of RTT data which is not protected against being 102# interrupted by an interrupt. 103config LOG_BACKEND_RTT_FORCE_PRINTK 104 bool 105 default y if LOG_BACKEND_RTT_BUFFER = 0 && RTT_CONSOLE 106 select LOG_PRINTK 107 108endif # LOG_BACKEND_RTT 109