Skip to content

Commit

Permalink
[nrfconnect] Fix configuration of pigweed logger (project-chip#36745)
Browse files Browse the repository at this point in the history
This commit adjusts the Pigweed logger configuration to prevent the use
of mutexes within ISR. Additionally, it increases the Bluetooth RX stack
size when the Pigweed logger is enabled.

Signed-off-by: Łukasz Duda <[email protected]>
  • Loading branch information
LuDuda authored Dec 6, 2024
1 parent 609926a commit 9e671ad
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
4 changes: 4 additions & 0 deletions examples/chef/nrfconnect/rpc.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ CONFIG_LOG_OUTPUT=y

# Increase zephyr tty rx buffer
CONFIG_CONSOLE_GETCHAR_BUFSIZE=128

# Increase BLE thread stack size
CONFIG_BT_RX_STACK_SIZE=2048

4 changes: 4 additions & 0 deletions examples/lighting-app/nrfconnect/rpc.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ CONFIG_LOG_OUTPUT=y

# Increase zephyr tty rx buffer
CONFIG_CONSOLE_GETCHAR_BUFSIZE=128

# Increase BLE thread stack size
CONFIG_BT_RX_STACK_SIZE=2048

19 changes: 7 additions & 12 deletions examples/platform/nrfconnect/util/PigweedLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,29 +100,24 @@ void init(const log_backend *)

void processMessage(const struct log_backend * const backend, union log_msg_generic * msg)
{
if (sIsPanicMode || k_is_in_isr())
{
return;
}

int ret = k_sem_take(&sLoggerLock, K_FOREVER);
assert(ret == 0);

if (!sIsPanicMode)
{
log_format_func_t outputFunc = log_format_func_t_get(LOG_OUTPUT_TEXT);
log_format_func_t outputFunc = log_format_func_t_get(LOG_OUTPUT_TEXT);

outputFunc(&pigweedLogOutput, &msg->log, log_backend_std_get_flags());
}
outputFunc(&pigweedLogOutput, &msg->log, log_backend_std_get_flags());

k_sem_give(&sLoggerLock);
}

void panic(const log_backend *)
{
int ret = k_sem_take(&sLoggerLock, K_FOREVER);
assert(ret == 0);

log_backend_std_panic(&pigweedLogOutput);
flush();
sIsPanicMode = true;

k_sem_give(&sLoggerLock);
}

const log_backend_api pigweedLogApi = {
Expand Down

0 comments on commit 9e671ad

Please sign in to comment.