You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2022/02/16 14:48:51 UTC

[mynewt-core] branch master updated: tinyusb: Add TinyUSB loging

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new ab74d72  tinyusb: Add TinyUSB loging
ab74d72 is described below

commit ab74d7281de617b68ed56ac65eca3bbc48a7ca93
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Wed Feb 16 12:19:12 2022 +0100

    tinyusb: Add TinyUSB loging
    
    TinyUSB provides logs that can be enabled in tusb_config.h
    
    This provides syscfg value that can enable those logs when needed.
    
    When logs are enabled due to printf usage USBD_STASK_SIZE need to be increased,
    and maybe some other tasks stacks that call TinyUSB functions.
    It is also recommended having UART baudrate set to 1000000 or higher.
    Recommended additional settings for logs:
    CONSOLE_UART: 1
    CONSOLE_UART_BAUD: 1000000
    CONSOLE_UART_TX_BUF_SIZE: 512
---
 hw/usb/tinyusb/std_descriptors/include/tusb_config.h |  2 +-
 hw/usb/tinyusb/std_descriptors/syscfg.yml            | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/usb/tinyusb/std_descriptors/include/tusb_config.h b/hw/usb/tinyusb/std_descriptors/include/tusb_config.h
index 0f60123..d0d0381 100755
--- a/hw/usb/tinyusb/std_descriptors/include/tusb_config.h
+++ b/hw/usb/tinyusb/std_descriptors/include/tusb_config.h
@@ -49,7 +49,7 @@ extern "C" {
 #else
 #define CFG_TUSB_OS                 OPT_OS_MYNEWT
 #endif
-#define CFG_TUSB_DEBUG              0
+#define CFG_TUSB_DEBUG              MYNEWT_VAL(CFG_TUSB_DEBUG)
 
 /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
  * Tinyusb use follows macros to declare transferring memory so that they can be put
diff --git a/hw/usb/tinyusb/std_descriptors/syscfg.yml b/hw/usb/tinyusb/std_descriptors/syscfg.yml
index ad84117..99b3767 100644
--- a/hw/usb/tinyusb/std_descriptors/syscfg.yml
+++ b/hw/usb/tinyusb/std_descriptors/syscfg.yml
@@ -171,3 +171,13 @@ syscfg.defs:
         description: >
             Interface number associated with USBD_WINDOWS_COMP_ID.
         value: 0
+
+    CFG_TUSB_DEBUG:
+        description: >
+            When set to value > 0 enables TinyUSB logs and redirects them to Mynewt console.
+            It activates logs created by TU_LOG1, TU_LOG2, TU_LOG3
+        range: 0..3
+        value: 0
+
+syscfg.restrictions:
+    - '(CFG_TUSB_DEBUG == 0) || (USBD_STACK_SIZE >= 400)'