Jelajahi Sumber

优化预编译

Meco Man 3 tahun lalu
induk
melakukan
028feb9245
2 mengubah file dengan 4 tambahan dan 7 penghapusan
  1. 2 5
      rt-thread/tinyusb_port.c
  2. 2 2
      rt-thread/usb_descriptor.c

+ 2 - 5
rt-thread/tinyusb_port.c

@@ -43,10 +43,6 @@ static int init_tinyusb(void)
                            PKG_TINYUSB_STACK_SIZE,
                            PKG_TINYUSB_THREAD_PRIORITY, 10);
     if (tid == RT_NULL)
-    {
-        LOG_E("Fail to create TinyUSB thread");
-        return -1;
-    }
 #else
     rt_err_t result;
 
@@ -54,11 +50,12 @@ static int init_tinyusb(void)
     result = rt_thread_init(tid, "tusb", tusb_thread_entry, RT_NULL,
                             tusb_stack, sizeof(tusb_stack), 4, 10);
     if (tid != RT_EOK)
+#endif /* RT_USING_HEAP */
     {
         LOG_E("Fail to create TinyUSB thread");
         return -1;
     }
-#endif
+
     rt_thread_startup(tid);
 
     return 0;

+ 2 - 2
rt-thread/usb_descriptor.c

@@ -123,7 +123,7 @@ TU_ATTR_WEAK void tud_descriptor_set_serial(char *serial_number, uint8_t length)
         length = 31;
     }
 
-    memcpy(_serial_number, serial_number, length);
+    rt_memcpy(_serial_number, serial_number, length);
     _serial_number[length] = '\0';
 }
 
@@ -139,7 +139,7 @@ TU_ATTR_WEAK uint16_t const *tud_descriptor_string_cb(uint8_t index, uint16_t la
 
     if (index == 0)
     {
-        memcpy(&desc_str[1], string_desc_arr[0], 2);
+        rt_memcpy(&desc_str[1], string_desc_arr[0], 2);
         chr_count = 1;
     }
     else