Skip to content

Commit 63cf0c8

Browse files
JarmouniAkartben
authored andcommitted
logging: uart_backend: add uncached buffers support
When async UART is used & DCache is enabled, some SoCs, like STM32H7, require UART buffers to be placed in nocache memory to avoid cache coherence issues. Fixes issue 87795 Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
1 parent 1305429 commit 63cf0c8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

subsys/logging/backends/log_backend_uart.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,15 @@ const struct log_backend_api log_backend_uart_api = {
225225
.format_set = format_set,
226226
};
227227

228+
#if defined(CONFIG_LOG_BACKEND_UART_ASYNC) && defined(CONFIG_SOC_FAMILY_STM32) && \
229+
defined(CONFIG_ARCH_HAS_NOCACHE_MEMORY_SUPPORT)
230+
#define NOCACHE_ATTR __nocache
231+
#else
232+
#define NOCACHE_ATTR
233+
#endif
234+
228235
#define LBU_DEFINE(node_id, ...) \
229-
static uint8_t lbu_buffer##__VA_ARGS__[CONFIG_LOG_BACKEND_UART_BUFFER_SIZE]; \
236+
static uint8_t lbu_buffer##__VA_ARGS__[CONFIG_LOG_BACKEND_UART_BUFFER_SIZE] NOCACHE_ATTR; \
230237
LOG_OUTPUT_DEFINE(lbu_output##__VA_ARGS__, char_out, lbu_buffer##__VA_ARGS__, \
231238
CONFIG_LOG_BACKEND_UART_BUFFER_SIZE); \
232239
\

0 commit comments

Comments
 (0)