You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2019/01/09 10:07:01 UTC

[mynewt-core] branch bus-dev-test created (now 563cea5)

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

andk pushed a change to branch bus-dev-test
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


      at 563cea5  [donotmerge] hw/util/i2cn: debug printouts

This branch includes the following new commits:

     new 0c00247  [donotmerge] hw/bus: Debug printouts
     new 2b09fdc  [donotmerge] hw/sensor: abi compat mode
     new 0277c99  [wip] sys/console: Add console_write_str
     new a69c145  [wip] sys/log: Update log module names
     new 16348e7  [wip] sys/log: Add pretty-printing option for log_console
     new 8766153  [donotmerge] hw/mcu/nordic: hal_i2c debug printouts
     new 36f1ec0  [donotmerge] hw/mcu/nordic: hal_i2c debug printouts (w)
     new 563cea5  [donotmerge] hw/util/i2cn: debug printouts

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[mynewt-core] 06/08: [donotmerge] hw/mcu/nordic: hal_i2c debug printouts

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch bus-dev-test
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 87661531442ce4b548a28b09f20b3956fa4e27d2
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Nov 26 13:58:28 2018 +0100

    [donotmerge] hw/mcu/nordic: hal_i2c debug printouts
---
 hw/mcu/nordic/nrf52xxx/src/hal_i2c.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c b/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c
index dde19ff..88d9518 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c
@@ -26,6 +26,7 @@
 #include <hal/hal_gpio.h>
 #include <mcu/nrf52_hal.h>
 #include "nrf_twim.h"
+#include "console/console.h"
 
 #include <nrf.h>
 
@@ -542,6 +543,8 @@ err:
         rc = hal_i2c_convert_status(nrf_status);
     }
 
+    console_printf("\x1B[1;31m%s: addr %02x last_op %d rc %d\x1B[0m\n", __func__, pdata->address, last_op, rc);
+
     return (rc);
 }
 
@@ -618,6 +621,8 @@ err:
         rc = hal_i2c_convert_status(nrf_status);
     }
 
+    console_printf("\x1B[1;31m%s: addr %02x last_op %d rc %d\x1B[0m\n", __func__, pdata->address, last_op, rc);
+
     return (rc);
 }
 


[mynewt-core] 02/08: [donotmerge] hw/sensor: abi compat mode

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch bus-dev-test
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 2b09fdc93314c63098c028c34bfc3c57127e0910
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Tue Nov 27 15:11:46 2018 +0100

    [donotmerge] hw/sensor: abi compat mode
---
 hw/sensor/include/sensor/sensor.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/sensor/include/sensor/sensor.h b/hw/sensor/include/sensor/sensor.h
index 5eeb7e8..40b443e 100644
--- a/hw/sensor/include/sensor/sensor.h
+++ b/hw/sensor/include/sensor/sensor.h
@@ -510,10 +510,6 @@ struct sensor_int {
 
 struct sensor_itf {
 
-#if MYNEWT_VAL(BUS_DRIVER_PRESENT)
-    /* Device configuration is stored in bus node */
-    struct os_dev *si_dev;
-#else
     /* Sensor interface type */
     uint8_t si_type;
 
@@ -526,6 +522,10 @@ struct sensor_itf {
     /* Sensor address */
     uint16_t si_addr;
 
+#if MYNEWT_VAL(BUS_DRIVER_PRESENT)
+    /* Device configuration is stored in bus node */
+    struct os_dev *si_dev;
+#else
     /* Mutex for interface access */
     struct os_mutex *si_lock;
 #endif


[mynewt-core] 08/08: [donotmerge] hw/util/i2cn: debug printouts

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch bus-dev-test
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 563cea567138b7688fb5a09378c13236fd2a3291
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Fri Jan 4 12:17:09 2019 +0100

    [donotmerge] hw/util/i2cn: debug printouts
---
 hw/util/i2cn/src/i2cn.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/hw/util/i2cn/src/i2cn.c b/hw/util/i2cn/src/i2cn.c
index cd350c4..9c09c33 100644
--- a/hw/util/i2cn/src/i2cn.c
+++ b/hw/util/i2cn/src/i2cn.c
@@ -19,6 +19,7 @@
 
 #include "hal/hal_i2c.h"
 #include "i2cn/i2cn.h"
+#include "console/console.h"
 
 int
 i2cn_master_read(uint8_t i2c_num, struct hal_i2c_master_data *pdata,
@@ -35,8 +36,17 @@ i2cn_master_read(uint8_t i2c_num, struct hal_i2c_master_data *pdata,
     for (i = 0; i <= retries; i++) {
         rc = hal_i2c_master_read(i2c_num, pdata, timeout, last_op);
         if (rc == 0) {
+            if (i > 0) {
+                console_printf("\x1B[1;32m%s: attempt %d/%d addr %02x\x1B[0m\n", __func__, i + 1, retries + 1, pdata->address);
+            }
             break;
         }
+
+        if (i < retries) {
+            console_printf("\x1B[1;33m%s: attempt %d/%d addr %02x\x1B[0m\n", __func__, i + 1, retries + 1, pdata->address);
+        } else {
+            console_printf("\x1B[1;31m%s: attempt %d/%d addr %02x\x1B[0m\n", __func__, i + 1, retries + 1, pdata->address);
+        }
     }
 
     return rc;
@@ -57,8 +67,17 @@ i2cn_master_write(uint8_t i2c_num, struct hal_i2c_master_data *pdata,
     for (i = 0; i <= retries; i++) {
         rc = hal_i2c_master_write(i2c_num, pdata, timeout, last_op);
         if (rc == 0) {
+            if (i > 0) {
+                console_printf("\x1B[1;32m%s: attempt %d/%d addr %02x\x1B[0m\n", __func__, i + 1, retries + 1, pdata->address);
+            }
             break;
         }
+
+        if (i < retries) {
+            console_printf("\x1B[1;33m%s: attempt %d/%d addr %02x\x1B[0m\n", __func__, i + 1, retries + 1, pdata->address);
+        } else {
+            console_printf("\x1B[1;31m%s: attempt %d/%d addr %02x\x1B[0m\n", __func__, i + 1, retries + 1, pdata->address);
+        }
     }
 
     return rc;


[mynewt-core] 03/08: [wip] sys/console: Add console_write_str

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch bus-dev-test
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 0277c991919648ade6cc85434266901f39f61ce1
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Dec 5 15:11:52 2018 +0100

    [wip] sys/console: Add console_write_str
    
    This is the same as console_write except in assumes input is a
    null-terminated string.
---
 sys/console/full/include/console/console.h    |  1 +
 sys/console/full/src/console.c                | 10 ++++++++++
 sys/console/minimal/include/console/console.h |  1 +
 sys/console/minimal/src/console.c             | 10 ++++++++++
 sys/console/stub/include/console/console.h    |  4 ++++
 5 files changed, 26 insertions(+)

diff --git a/sys/console/full/include/console/console.h b/sys/console/full/include/console/console.h
index bb9f11a..ea6c5ef 100644
--- a/sys/console/full/include/console/console.h
+++ b/sys/console/full/include/console/console.h
@@ -48,6 +48,7 @@ typedef void (*completion_cb)(char *str, console_append_char_cb cb);
 int console_init(console_rx_cb rx_cb);
 int console_is_init(void);
 void console_write(const char *str, int cnt);
+void console_write_str(const char *str);
 #if MYNEWT_VAL(CONSOLE_COMPAT)
 int console_read(char *str, int cnt, int *newline);
 #endif
diff --git a/sys/console/full/src/console.c b/sys/console/full/src/console.c
index 6f996cf..2df2546 100644
--- a/sys/console/full/src/console.c
+++ b/sys/console/full/src/console.c
@@ -112,6 +112,16 @@ console_write(const char *str, int cnt)
     }
 }
 
+void
+console_write_str(const char *str)
+{
+    while (*str) {
+        if (console_out(*str++) == EOF) {
+            break;
+        }
+    }
+}
+
 #if MYNEWT_VAL(CONSOLE_COMPAT)
 int
 console_read(char *str, int cnt, int *newline)
diff --git a/sys/console/minimal/include/console/console.h b/sys/console/minimal/include/console/console.h
index 6c82006..83445e0 100644
--- a/sys/console/minimal/include/console/console.h
+++ b/sys/console/minimal/include/console/console.h
@@ -39,6 +39,7 @@ int console_init(console_rx_cb rx_cb);
 int console_is_init(void);
 
 void console_write(const char *str, int cnt);
+void console_write_str(const char *str);
 #if MYNEWT_VAL(CONSOLE_COMPAT)
 int console_read(char *str, int cnt, int *newline);
 #endif
diff --git a/sys/console/minimal/src/console.c b/sys/console/minimal/src/console.c
index 9f50e90..78a391c 100644
--- a/sys/console/minimal/src/console.c
+++ b/sys/console/minimal/src/console.c
@@ -82,6 +82,16 @@ console_write(const char *str, int cnt)
     }
 }
 
+void
+console_write_str(const char *str)
+{
+    while (*str) {
+        if (console_out(*str++) == EOF) {
+            break;
+        }
+    }
+}
+
 #if MYNEWT_VAL(CONSOLE_COMPAT)
 int
 console_read(char *str, int cnt, int *newline)
diff --git a/sys/console/stub/include/console/console.h b/sys/console/stub/include/console/console.h
index 57c5ab0..b4b360c 100644
--- a/sys/console/stub/include/console/console.h
+++ b/sys/console/stub/include/console/console.h
@@ -54,6 +54,10 @@ console_write(const char *str, int cnt)
 {
 }
 
+static void inline console_write_str(const char *str)
+{
+}
+
 static int inline
 console_read(char *str, int cnt, int *newline)
 {


[mynewt-core] 07/08: [donotmerge] hw/mcu/nordic: hal_i2c debug printouts (w)

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch bus-dev-test
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 36f1ec0cc7e7a9825a945c0af243b2cc6da9223a
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Nov 26 12:16:36 2018 +0100

    [donotmerge] hw/mcu/nordic: hal_i2c debug printouts (w)
---
 hw/mcu/nordic/nrf52xxx/src/hal_i2c.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c b/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c
index 88d9518..1f19be3 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c
@@ -417,8 +417,10 @@ hal_i2c_config(uint8_t i2c_num, const struct hal_i2c_settings *cfg)
 static inline void
 hal_i2c_trigger_start(NRF_TWI_Type *twi, __O uint32_t *task)
 {
+    static const int max_attempt = 2;
     uint32_t end_ticks;
-    int retry = 2;
+    char op = task == &twi->TASKS_STARTTX ? 't' : 'r';
+    int attempt = 1;
 
     /*
      * Some devices [1] can cause glitch on I2C bus which makes TWI controller
@@ -463,10 +465,20 @@ hal_i2c_trigger_start(NRF_TWI_Type *twi, __O uint32_t *task)
              * writes.
              */
             if (!hal_gpio_read(twi->PSELSCL) || twi->EVENTS_BB) {
+                if (attempt > 1) {
+                    console_printf("\x1B[1;32m%s: op %cx attempt %d/%d addr %02x\x1B[0m\n", __func__, op, attempt, max_attempt, (unsigned)twi->ADDRESS);
+                }
                 return;
             }
         } while (CPUTIME_LT(os_cputime_get32(), end_ticks));
 
+        if (attempt == max_attempt) {
+            console_printf("\x1B[1;31m%s: op %cx attempt %d/%d addr %02x\x1B[0m\n", __func__, op, attempt, max_attempt, (unsigned)twi->ADDRESS);
+        } else {
+            console_printf("\x1B[1;33m%s: op %cx attempt %d/%d addr %02x\x1B[0m\n", __func__, op, attempt, max_attempt, (unsigned)twi->ADDRESS);
+        }
+        attempt++;
+
         twi->ENABLE = TWI_ENABLE_ENABLE_Disabled;
         /*
          * This is to "clear" other devices on bus which may be affected by the
@@ -474,7 +486,7 @@ hal_i2c_trigger_start(NRF_TWI_Type *twi, __O uint32_t *task)
          */
         hal_i2c_clear_bus(twi->PSELSCL, twi->PSELSDA);
         twi->ENABLE = TWI_ENABLE_ENABLE_Enabled;
-    } while (--retry);
+    } while (attempt <= max_attempt);
 }
 
 int


[mynewt-core] 04/08: [wip] sys/log: Update log module names

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch bus-dev-test
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit a69c1453bfd1d8acfefbb10c90df6ca42dab9788
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Dec 5 15:14:33 2018 +0100

    [wip] sys/log: Update log module names
    
    Do not use uppercase names so they don't scream at user when using
    pretty-printing.
---
 sys/log/full/src/log.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sys/log/full/src/log.c b/sys/log/full/src/log.c
index 343cb42..f238906 100644
--- a/sys/log/full/src/log.c
+++ b/sys/log/full/src/log.c
@@ -215,23 +215,23 @@ log_module_get_name(uint8_t module)
     if (module < LOG_MODULE_PERUSER) {
         switch (module) {
         case LOG_MODULE_DEFAULT:
-            return "DEFAULT";
+            return "Default";
         case LOG_MODULE_OS:
             return "OS";
         case LOG_MODULE_NEWTMGR:
-            return "NEWTMGR";
+            return "Newtmgr";
         case LOG_MODULE_NIMBLE_CTLR:
-            return "NIMBLE_CTLR";
+            return "NimBLE_Ctlr";
         case LOG_MODULE_NIMBLE_HOST:
-            return "NIMBLE_HOST";
+            return "NimBLE";
         case LOG_MODULE_NFFS:
             return "NFFS";
         case LOG_MODULE_REBOOT:
-            return "REBOOT";
+            return "Reboot";
         case LOG_MODULE_IOTIVITY:
-            return "IOTIVITY";
+            return "IoTivity";
         case LOG_MODULE_TEST:
-            return "TEST";
+            return "Test";
         }
     } else if (module - LOG_MODULE_PERUSER < MYNEWT_VAL(LOG_MAX_USER_MODULES)) {
         return g_log_module_list[module - LOG_MODULE_PERUSER];


[mynewt-core] 05/08: [wip] sys/log: Add pretty-printing option for log_console

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch bus-dev-test
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 16348e78c73c77989917e4d344b9fd7cc1957453
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Nov 21 15:24:01 2018 +0100

    [wip] sys/log: Add pretty-printing option for log_console
---
 sys/log/full/src/log_console.c | 135 ++++++++++++++++++++++++++++++++++-------
 sys/log/full/syscfg.yml        |  30 +++++++++
 2 files changed, 142 insertions(+), 23 deletions(-)

diff --git a/sys/log/full/src/log_console.c b/sys/log/full/src/log_console.c
index 6a00a17..cb736fa 100644
--- a/sys/log/full/src/log_console.c
+++ b/sys/log/full/src/log_console.c
@@ -27,53 +27,142 @@
 
 static struct log log_console;
 
+#if MYNEWT_VAL(LOG_CONSOLE_FORMATTER) == 1
+#define LOG_CONSOLE_COLOR_DEFAULT   "\x1B[0m"
+#if MYNEWT_VAL(LOG_CONSOLE_PRETTY_BRIGHT_COLORS)
+#define LOG_CONSOLE_COLOR_RED       "\x1B[1;31m"
+#define LOG_CONSOLE_COLOR_YELLOW    "\x1B[1;33m"
+#define LOG_CONSOLE_COLOR_MAGENTA   "\x1B[1;35m"
+#else
+#define LOG_CONSOLE_COLOR_RED       "\x1B[31m"
+#define LOG_CONSOLE_COLOR_YELLOW    "\x1B[33m"
+#define LOG_CONSOLE_COLOR_MAGENTA   "\x1B[35m"
+#endif
+
+#define LOG_CONSOLE_LEVEL_DEF(_str, _color) \
+    {                                       \
+        .level_str = (_str),                \
+        .color_seq = (_color),              \
+    }
+
+#define LOG_CONSOLE_LEVEL_DEF_MAX   \
+    ((sizeof(log_console_level_defs) / sizeof(log_console_level_defs[0])) - 1)
+
+struct log_console_level_def {
+    const char *level_str;
+    const char *color_seq;
+};
+
+static const struct log_console_level_def log_console_level_defs[] = {
+    LOG_CONSOLE_LEVEL_DEF("D", LOG_CONSOLE_COLOR_DEFAULT),
+    LOG_CONSOLE_LEVEL_DEF("I", LOG_CONSOLE_COLOR_DEFAULT),
+    LOG_CONSOLE_LEVEL_DEF("W", LOG_CONSOLE_COLOR_YELLOW),
+    LOG_CONSOLE_LEVEL_DEF("E", LOG_CONSOLE_COLOR_RED),
+    LOG_CONSOLE_LEVEL_DEF("C", LOG_CONSOLE_COLOR_RED),
+    LOG_CONSOLE_LEVEL_DEF("U", LOG_CONSOLE_COLOR_MAGENTA), /* unknown level */
+};
+#endif
+
 struct log *
 log_console_get(void)
 {
     return &log_console;
 }
 
+#if MYNEWT_VAL(LOG_CONSOLE_FORMATTER) == 0
 static void
-log_console_print_hdr(const struct log_entry_hdr *hdr)
+log_console_write(const struct log_entry_hdr *hdr, const void *body, int length)
 {
-    console_printf("[ts=%lluus, mod=%u level=%u] ",
-                   hdr->ue_ts, hdr->ue_module, hdr->ue_level);
-}
+    if (!console_is_init()) {
+        return;
+    }
 
-static int
-log_console_append(struct log *log, void *buf, int len)
+    if (!console_is_midline) {
+        console_printf("[ts=%lluus, mod=%u level=%u] ", hdr->ue_ts,
+                       hdr->ue_module, hdr->ue_level);
+    }
+
+    console_write(body, length);
+}
+#elif MYNEWT_VAL(LOG_CONSOLE_FORMATTER) == 1
+static void
+log_console_write(const struct log_entry_hdr *hdr, const void *body, int length)
 {
-    struct log_entry_hdr *hdr;
+    const struct log_console_level_def *def;
+    const char *mod_name;
+    int level;
+    bool is_midline;
 
     if (!console_is_init()) {
-        return (0);
+        return;
     }
 
-    if (!console_is_midline) {
-        hdr = (struct log_entry_hdr *) buf;
-        log_console_print_hdr(hdr);
+    level = min(hdr->ue_level, LOG_CONSOLE_LEVEL_DEF_MAX);
+    def = &log_console_level_defs[level];
+
+    is_midline = console_is_midline;
+
+    if (!is_midline) {
+#if MYNEWT_VAL(LOG_CONSOLE_PRETTY_TS_WIDTH) > 0
+        console_printf("%s%0*llu ", def->color_seq,
+                       MYNEWT_VAL(LOG_CONSOLE_PRETTY_TS_WIDTH),
+                       hdr->ue_ts / MYNEWT_VAL(LOG_CONSOLE_PRETTY_TS_DIV));
+#else
+        console_printf("%s", def->color_seq);
+#endif
+
+        console_write_str(def->level_str);
+        console_write_str("/");
+
+        mod_name = log_module_get_name(hdr->ue_module);
+        if (mod_name) {
+            console_write_str(mod_name);
+        } else {
+            console_printf("%u", hdr->ue_module);
+        }
+
+#if MYNEWT_VAL(LOG_CONSOLE_PRETTY_USE_TASK_NAME)
+        console_write_str(" (");
+        console_write_str(os_sched_get_current_task()->t_name);
+        console_write_str("): ");
+#endif
     }
 
-    console_write((char *) buf + LOG_ENTRY_HDR_SIZE, len - LOG_ENTRY_HDR_SIZE);
+    if (((const char *)body)[length - 1] == '\n') {
+        /*
+         * Need to reset to default color before printing \n as otherwise escape
+         * sequence would make console think it's mid-line.
+         */
+        console_write(body, length - 1);
+        console_write_str(LOG_CONSOLE_COLOR_DEFAULT);
+        console_write_str("\n");
+    } else {
+        console_write(body, length);
+    }
+}
+#else
+#error Unsupported console formatter selected.
+#endif
 
-    return (0);
+static int
+log_console_append(struct log *log, void *buf, int len)
+{
+    struct log_entry_hdr *hdr = (struct log_entry_hdr *) buf;
+    const void *body = buf + LOG_ENTRY_HDR_SIZE;
+    int body_len = len - LOG_ENTRY_HDR_SIZE;
+
+    log_console_write(hdr, body, body_len);
+
+    return 0;
 }
 
 static int
 log_console_append_body(struct log *log, const struct log_entry_hdr *hdr,
                         const void *body, int body_len)
 {
-    if (!console_is_init()) {
-        return (0);
-    }
-
-    if (!console_is_midline) {
-        log_console_print_hdr(hdr);
-    }
-
-    console_write(body, body_len);
+    log_console_write(hdr, body, body_len);
 
-    return (0);
+    return 0;
 }
 
 static int
diff --git a/sys/log/full/syscfg.yml b/sys/log/full/syscfg.yml
index 9e530fd..61556e6 100644
--- a/sys/log/full/syscfg.yml
+++ b/sys/log/full/syscfg.yml
@@ -50,6 +50,33 @@ syscfg.defs:
     LOG_CONSOLE:
         description: 'Support logging to console.'
         value: 1
+    LOG_CONSOLE_FORMATTER:
+        description: >
+            Defines formatter used for console output. Supported values are:
+              0 = standard formatter
+              1 = pretty-printing formatter
+        value: 1
+    LOG_CONSOLE_PRETTY_BRIGHT_COLORS:
+        description: >
+            Use bright colors when using pretty-printing. Useful on dark
+            terminals for better contrast.
+        value: 1
+    LOG_CONSOLE_PRETTY_TS_WIDTH:
+        description: >
+            Width of timestamp field when using pretty-printing formatter.
+            Set to 0 to disable printing of timestamp.
+        value: 0
+    LOG_CONSOLE_PRETTY_TS_DIV:
+        description: >
+            Divisor for timestamp value when pretty-printing formatter.
+            Each timestamp will be divided by this number, i.e. a value of 1000
+            will scale timestamp from default [ns] to [us]. This reduces width
+            of printed timestamp but also reduces timestamp resolution,
+        value: 1000
+    LOG_CONSOLE_PRETTY_USE_TASK_NAME:
+        description: >
+            Enables printing of current task name for each log entry.
+        value: 1
 
     LOG_CLI:
         description: 'Expose "log" command in shell.'
@@ -100,3 +127,6 @@ syscfg.defs:
         description: >
             Sysinit stage for logging to the second image slot.
         value: 101
+
+syscfg.restrictions:
+    - LOG_CONSOLE_FORMATTER == 0 || LOG_CONSOLE_FORMATTER == 1


[mynewt-core] 01/08: [donotmerge] hw/bus: Debug printouts

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch bus-dev-test
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 0c0024770e4e646b01fbfc9c9326bb7cd118e561
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Nov 26 16:16:29 2018 +0100

    [donotmerge] hw/bus: Debug printouts
---
 hw/bus/src/bus.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/hw/bus/src/bus.c b/hw/bus/src/bus.c
index 93f7153..fa5399a 100644
--- a/hw/bus/src/bus.c
+++ b/hw/bus/src/bus.c
@@ -26,6 +26,7 @@
 #if MYNEWT_VAL(BUS_STATS)
 #include "stats/stats.h"
 #endif
+#include "console/console.h"
 
 static os_time_t g_bus_node_lock_timeout;
 
@@ -222,6 +223,7 @@ bus_node_read(struct os_dev *node, void *buf, uint16_t length,
 
     rc = bus_node_lock(node, bus_node_get_lock_timeout(node));
     if (rc) {
+        console_printf("\x1B[1;31m%s: bnode %p rc %d\x1B[0m\n", __func__, bnode, rc);
         return rc;
     }
 
@@ -233,6 +235,10 @@ bus_node_read(struct os_dev *node, void *buf, uint16_t length,
 
     (void)bus_node_unlock(node);
 
+    if (rc) {
+        console_printf("\x1B[1;31m%s: bnode %p rc %d\x1B[0m\n", __func__, bnode, rc);
+    }
+
     return rc;
 }
 
@@ -253,6 +259,7 @@ bus_node_write(struct os_dev *node, const void *buf, uint16_t length,
 
     rc = bus_node_lock(node, bus_node_get_lock_timeout(node));
     if (rc) {
+        console_printf("\x1B[1;31m%s: bnode %p rc %d\x1B[0m\n", __func__, bnode, rc);
         return rc;
     }
 
@@ -264,6 +271,10 @@ bus_node_write(struct os_dev *node, const void *buf, uint16_t length,
 
     (void)bus_node_unlock(node);
 
+    if (rc) {
+        console_printf("\x1B[1;31m%s: bnode %p rc %d\x1B[0m\n", __func__, bnode, rc);
+    }
+
     return rc;
 }
 
@@ -285,6 +296,7 @@ bus_node_write_read_transact(struct os_dev *node, const void *wbuf,
 
     rc = bus_node_lock(node, bus_node_get_lock_timeout(node));
     if (rc) {
+        console_printf("\x1B[1;31m%s: bnode %p rc %d\x1B[0m\n", __func__, bnode, rc);
         return rc;
     }
 
@@ -311,6 +323,10 @@ bus_node_write_read_transact(struct os_dev *node, const void *wbuf,
 done:
     (void)bus_node_unlock(node);
 
+    if (rc) {
+        console_printf("\x1B[1;31m%s: bnode %p rc %d\x1B[0m\n", __func__, bnode, rc);
+    }
+
     return rc;
 }