Skip to content

Commit

Permalink
Added some checks to enable uart logging for SoC and efr.
Browse files Browse the repository at this point in the history
  • Loading branch information
arun-silabs committed Feb 22, 2024
1 parent f193f78 commit 9b75837
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 1 addition & 5 deletions examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ source_set("siwx917-common") {
"SiWx917/wfx_rsi_host.c",
]

if (chip_enable_pw_rpc || chip_build_libshell) {
if (chip_enable_pw_rpc || chip_build_libshell || sl_uart_log_output) {
sources += [ "uart.cpp" ]
}

Expand All @@ -241,10 +241,6 @@ source_set("siwx917-common") {
public_deps += [ "${chip_root}/examples/common/QRCode" ]
}

if (sl_uart_log_output) {
sources += [ "${silabs_common_plat_dir}/SiWx917/uart.cpp" ]
}

if (enable_heap_monitoring) {
sources += [ "${silabs_common_plat_dir}/MemMonitoring.cpp" ]
}
Expand Down
6 changes: 6 additions & 0 deletions src/platform/silabs/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
#endif

#if SILABS_LOG_OUT_UART
#if SIWX_917
#include "rsi_debug.h"
#endif // SIWX_917
#include "uart.h"
#endif

Expand Down Expand Up @@ -136,13 +138,17 @@ static void PrintLog(const char * msg)
sz = strlen(msg);

#if SILABS_LOG_OUT_UART
#if SIWX_917
for (/* Empty */; sz != 0; --sz)
{
Board_UARTPutChar(*msg++);
}
// To print next log in new line with proper formatting
Board_UARTPutChar('\r');
Board_UARTPutChar('\n');
#else
uartLogWrite(msg, sz);
#endif // SIWX_917
#elif PW_RPC_ENABLED
PigweedLogger::putString(msg, sz);
#else
Expand Down

0 comments on commit 9b75837

Please sign in to comment.