Skip to content

Commit

Permalink
Made changes to get logs on uart port
Browse files Browse the repository at this point in the history
  • Loading branch information
arun-silabs committed Feb 21, 2024
1 parent b8de5cc commit f193f78
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ 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
11 changes: 9 additions & 2 deletions src/platform/silabs/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#endif

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

Expand Down Expand Up @@ -135,12 +136,18 @@ static void PrintLog(const char * msg)
sz = strlen(msg);

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

#if SILABS_LOG_OUT_RTT || PW_RPC_ENABLED
const char * newline = "\r\n";
Expand Down
7 changes: 7 additions & 0 deletions third_party/silabs/SiWx917_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@ template("siwx917_sdk") {
}
}

if (sl_uart_log_output) {
defines += [
"SILABS_LOG_OUT_UART=1",
"SILABS_LOG_OUT_RTT=0",
]
}

if (chip_build_libshell) { # matter shell
defines += [ "ENABLE_CHIP_SHELL" ]
}
Expand Down

0 comments on commit f193f78

Please sign in to comment.