Browse Source

Merge branch 'master' of gitee.com:openLuat/LuatOS

Wendal Chen 4 years ago
parent
commit
8292d5cbaa
2 changed files with 15 additions and 0 deletions
  1. 13 0
      bsp/rtt/luat_log_rtt.c
  2. 2 0
      bsp/rtt/luat_uart_rtt.c

+ 13 - 0
bsp/rtt/luat_log_rtt.c

@@ -0,0 +1,13 @@
+
+#include "luat_base.h"
+#include "luat_conf_bsp.h"
+
+#include "rtthread.h"
+#include <rtdevice.h>
+
+extern rt_device_t luat_log_uart_device;
+
+void luat_log_write(char *s, size_t l) {
+    rt_device_write(luat_log_uart_device, 0, s, l);
+}
+

+ 2 - 0
bsp/rtt/luat_uart_rtt.c

@@ -18,6 +18,7 @@
 static rt_device_t serials[MAX_DEVICE_COUNT];
 static uint8_t serials_marks[MAX_DEVICE_COUNT];
 static uint8_t uart_init_complete = 0;
+rt_device_t luat_log_uart_device;
 
 int luat_uart_rtt_init() {
     if (uart_init_complete) return 0;
@@ -35,6 +36,7 @@ int luat_uart_rtt_init() {
         serials[i] = rt_device_find(name);
         //LOG_I("uart device dev=0x%08X uart.id=%ld", serials[i], i);
     }
+    luat_log_uart_device = rt_device_find(RT_CONSOLE_DEVICE_NAME);
     uart_init_complete = 1;
     return 0;
 }