logging: Force LOG_PRINTK option if RTT backend is used

Log RTT backed is using mutex for locking access to RTT data.
RTT console (which by default is used by printk) writes to
RTT data directly and it cannot use mutex because it can be
called from any context (including interrupt). If both
modules access RTT buffer 0, data can be corrupted.

This patch forces LOG_PRINTK option if RTT backend is used to
ensure single point of access to RTT buffer 0 data.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2019-03-13 09:54:56 +01:00 committed by Kumar Gala
commit 94ae61f765

View file

@ -431,6 +431,17 @@ config LOG_BACKEND_RTT_BUFFER_SIZE
Specify reserved size of up-buffer used for logger output.
endif # LOG_BACKEND_RTT_BUFFER
# Enable processing of printk calls using log if terminal buffer is used.
# Same buffer is used by RTT console. If printk would go through RTT console
# that will lead to corruption of RTT data which is not protected against being
# interrupted by an interrupt.
config LOG_BACKEND_RTT_FORCE_PRINTK
bool
default y if LOG_BACKEND_RTT_BUFFER = 0
select LOG_PRINTK
endif # LOG_BACKEND_RTT
config LOG_BACKEND_NATIVE_POSIX