Skip to content

Commit f193f78

Browse files
committedFeb 21, 2024
Made changes to get logs on uart port
1 parent b8de5cc commit f193f78

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed
 

‎examples/platform/silabs/SiWx917/BUILD.gn

+4
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ source_set("siwx917-common") {
241241
public_deps += [ "${chip_root}/examples/common/QRCode" ]
242242
}
243243

244+
if (sl_uart_log_output) {
245+
sources += [ "${silabs_common_plat_dir}/SiWx917/uart.cpp" ]
246+
}
247+
244248
if (enable_heap_monitoring) {
245249
sources += [ "${silabs_common_plat_dir}/MemMonitoring.cpp" ]
246250
}

‎src/platform/silabs/Logging.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#endif
5656

5757
#if SILABS_LOG_OUT_UART
58+
#include "rsi_debug.h"
5859
#include "uart.h"
5960
#endif
6061

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

137138
#if SILABS_LOG_OUT_UART
138-
uartLogWrite(msg, sz);
139+
for (/* Empty */; sz != 0; --sz)
140+
{
141+
Board_UARTPutChar(*msg++);
142+
}
143+
// To print next log in new line with proper formatting
144+
Board_UARTPutChar('\r');
145+
Board_UARTPutChar('\n');
139146
#elif PW_RPC_ENABLED
140147
PigweedLogger::putString(msg, sz);
141148
#else
142149
SEGGER_RTT_WriteNoLock(LOG_RTT_BUFFER_INDEX, msg, sz);
143-
#endif
150+
#endif // SILABS_LOG_OUT_UART
144151

145152
#if SILABS_LOG_OUT_RTT || PW_RPC_ENABLED
146153
const char * newline = "\r\n";

‎third_party/silabs/SiWx917_sdk.gni

+7
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ template("siwx917_sdk") {
282282
}
283283
}
284284

285+
if (sl_uart_log_output) {
286+
defines += [
287+
"SILABS_LOG_OUT_UART=1",
288+
"SILABS_LOG_OUT_RTT=0",
289+
]
290+
}
291+
285292
if (chip_build_libshell) { # matter shell
286293
defines += [ "ENABLE_CHIP_SHELL" ]
287294
}

0 commit comments

Comments
 (0)