You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/05/11 09:13:54 UTC

[GitHub] [mynewt-core] michal-narajowski opened a new pull request #2286: [WIP] Add Memfault integration

michal-narajowski opened a new pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286


   https://memfault.com/


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] vrahane commented on pull request #2286: Add Memfault integration

Posted by GitBox <gi...@apache.org>.
vrahane commented on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-946001453


   @michal-narajowski @andrzej-kaczmarek  Perhaps we can close this out too since we have decided a path forward now ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2286: [WIP] Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-626709617


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### sys/memfault/src/memfault_platform_core.c
   <details>
   
   ```diff
   @@ -30,9 +30,11 @@
    void
    memfault_platform_halt_if_debugging(void)
    {
   -//    if (hal_debugger_connected()) {
   -//        __asm("bkpt");
   -//    }
   +/*
   +      if (hal_debugger_connected()) {
   +          __asm("bkpt");
   +      }
   + */
    }
    
    void
   @@ -49,7 +51,7 @@
        metrics_period_sec = period_sec;
        metrics_callback = callback;
        metrics_callout_cb(NULL);
   -    return true; // indicates setup was successful
   +    return true; /* indicates setup was successful */
    }
    
    uint64_t
   @@ -74,20 +76,22 @@
        const sMemfaultEventStorageImpl *evt_storage =
            memfault_events_storage_boot(s_event_storage, sizeof(s_event_storage));
    
   -    // Pass the storage to collect reset info
   +    /* Pass the storage to collect reset info */
        memfault_reboot_tracking_collect_reset_info(evt_storage);
   -    // Pass the storage to initialize the trace event module
   +    /* Pass the storage to initialize the trace event module */
        memfault_trace_event_boot(evt_storage);
    
   -    // NOTE: crash count represents the number of unexpected reboots since the
   -    // last heartbeat was reported. In the simplest case if reboots are
   -    // unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   -    // how this can be tracked with the reboot_tracking module.
   +    /*
   +       NOTE: crash count represents the number of unexpected reboots since the
   +       last heartbeat was reported. In the simplest case if reboots are
   +       unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   +       how this can be tracked with the reboot_tracking module.
   +     */
        sMemfaultMetricBootInfo boot_info = {
            .unexpected_reboot_count = memfault_reboot_tracking_get_crash_count()
        };
        rc = memfault_metrics_boot(evt_storage, &boot_info);
   -    // NOTE: a non-zero value indicates a configuration error took place
   +    /* NOTE: a non-zero value indicates a configuration error took place */
        SYSINIT_PANIC_ASSERT(rc == 0);
    
        memfault_reboot_tracking_reset_crash_count();
   ```
   
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] kasjer commented on a change in pull request #2286: Add Memfault integration

Posted by GitBox <gi...@apache.org>.
kasjer commented on a change in pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#discussion_r432821159



##########
File path: sys/memfault/src/memfault_platform_core.c
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "sysinit/sysinit.h"
+#include "os/os.h"
+
+#include "memfault/core/debug_log.h"
+#include "memfault/core/event_storage.h"
+#include "memfault/core/trace_event.h"
+#include "memfault/metrics/metrics.h"
+#include "memfault/metrics/platform/timer.h"
+#include "memfault/panics/reboot_tracking.h"
+#include "memfault/panics/platform/coredump.h"
+
+#include "memfault_common.h"
+
+/* Your .ld file:
+ * MEMORY
+ * {
+ *     [...]
+ *     NOINIT (rw) :  ORIGIN = <RAM_REGION_END>, LENGTH = 64
+ * }
+ * SECTIONS
+ * {
+ *     .noinit (NOLOAD): { KEEP(*(*.mflt_reboot_info)) } > NOINIT
+ * }
+ */
+static uint8_t s_reboot_tracking[MEMFAULT_REBOOT_TRACKING_REGION_SIZE]
+    __attribute__((section(".mflt_reboot_info")));
+
+static struct os_callout metrics_callout;
+static uint32_t metrics_period_sec;
+static MemfaultPlatformTimerCallback *metrics_callback;
+
+static void
+metrics_callout_cb(struct os_event *ev)
+{
+    if (metrics_callback) {
+        metrics_callback();
+    }
+    os_callout_reset(&metrics_callout,
+                     os_time_ms_to_ticks32(metrics_period_sec * 1000));
+}
+
+void
+memfault_platform_halt_if_debugging(void)
+{
+    if (hal_debugger_connected()) {
+        __asm("bkpt");
+    }
+}
+
+void
+memfault_platform_reboot(void)
+{
+    os_reboot(HAL_RESET_REQUESTED);
+    MEMFAULT_UNREACHABLE;
+}
+
+bool
+memfault_platform_metrics_timer_boot(uint32_t period_sec,
+                                     MemfaultPlatformTimerCallback callback)
+{
+    metrics_period_sec = period_sec;
+    metrics_callback = callback;
+    metrics_callout_cb(NULL);
+    return true;
+}
+
+uint64_t
+memfault_platform_get_time_since_boot_ms(void)
+{
+    return (uint64_t) (os_get_uptime_usec() / 1000);

Review comment:
       cast here seems superfluous




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2286: [WIP] Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-633533521


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] michal-narajowski commented on pull request #2286: Add Memfault integration

Posted by GitBox <gi...@apache.org>.
michal-narajowski commented on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-1083103082


   Closing since this feature has been added to memfault repo as a newt package: https://github.com/memfault/memfault-firmware-sdk/tree/master/ports/mynewt


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2286: Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-633534628






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2286: Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-634074495






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] kasjer commented on a change in pull request #2286: Add Memfault integration

Posted by GitBox <gi...@apache.org>.
kasjer commented on a change in pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#discussion_r432821159



##########
File path: sys/memfault/src/memfault_platform_core.c
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "sysinit/sysinit.h"
+#include "os/os.h"
+
+#include "memfault/core/debug_log.h"
+#include "memfault/core/event_storage.h"
+#include "memfault/core/trace_event.h"
+#include "memfault/metrics/metrics.h"
+#include "memfault/metrics/platform/timer.h"
+#include "memfault/panics/reboot_tracking.h"
+#include "memfault/panics/platform/coredump.h"
+
+#include "memfault_common.h"
+
+/* Your .ld file:
+ * MEMORY
+ * {
+ *     [...]
+ *     NOINIT (rw) :  ORIGIN = <RAM_REGION_END>, LENGTH = 64
+ * }
+ * SECTIONS
+ * {
+ *     .noinit (NOLOAD): { KEEP(*(*.mflt_reboot_info)) } > NOINIT
+ * }
+ */
+static uint8_t s_reboot_tracking[MEMFAULT_REBOOT_TRACKING_REGION_SIZE]
+    __attribute__((section(".mflt_reboot_info")));
+
+static struct os_callout metrics_callout;
+static uint32_t metrics_period_sec;
+static MemfaultPlatformTimerCallback *metrics_callback;
+
+static void
+metrics_callout_cb(struct os_event *ev)
+{
+    if (metrics_callback) {
+        metrics_callback();
+    }
+    os_callout_reset(&metrics_callout,
+                     os_time_ms_to_ticks32(metrics_period_sec * 1000));
+}
+
+void
+memfault_platform_halt_if_debugging(void)
+{
+    if (hal_debugger_connected()) {
+        __asm("bkpt");
+    }
+}
+
+void
+memfault_platform_reboot(void)
+{
+    os_reboot(HAL_RESET_REQUESTED);
+    MEMFAULT_UNREACHABLE;
+}
+
+bool
+memfault_platform_metrics_timer_boot(uint32_t period_sec,
+                                     MemfaultPlatformTimerCallback callback)
+{
+    metrics_period_sec = period_sec;
+    metrics_callback = callback;
+    metrics_callout_cb(NULL);
+    return true;
+}
+
+uint64_t
+memfault_platform_get_time_since_boot_ms(void)
+{
+    return (uint64_t) (os_get_uptime_usec() / 1000);

Review comment:
       case here seems superfluous

##########
File path: sys/memfault/src/memfault_platform_core.c
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "sysinit/sysinit.h"
+#include "os/os.h"
+
+#include "memfault/core/debug_log.h"
+#include "memfault/core/event_storage.h"
+#include "memfault/core/trace_event.h"
+#include "memfault/metrics/metrics.h"
+#include "memfault/metrics/platform/timer.h"
+#include "memfault/panics/reboot_tracking.h"
+#include "memfault/panics/platform/coredump.h"
+
+#include "memfault_common.h"
+
+/* Your .ld file:
+ * MEMORY
+ * {
+ *     [...]
+ *     NOINIT (rw) :  ORIGIN = <RAM_REGION_END>, LENGTH = 64
+ * }
+ * SECTIONS
+ * {
+ *     .noinit (NOLOAD): { KEEP(*(*.mflt_reboot_info)) } > NOINIT
+ * }
+ */
+static uint8_t s_reboot_tracking[MEMFAULT_REBOOT_TRACKING_REGION_SIZE]
+    __attribute__((section(".mflt_reboot_info")));
+
+static struct os_callout metrics_callout;
+static uint32_t metrics_period_sec;
+static MemfaultPlatformTimerCallback *metrics_callback;
+
+static void
+metrics_callout_cb(struct os_event *ev)
+{
+    if (metrics_callback) {
+        metrics_callback();
+    }
+    os_callout_reset(&metrics_callout,
+                     os_time_ms_to_ticks32(metrics_period_sec * 1000));
+}
+
+void
+memfault_platform_halt_if_debugging(void)
+{
+    if (hal_debugger_connected()) {
+        __asm("bkpt");
+    }
+}
+
+void
+memfault_platform_reboot(void)
+{
+    os_reboot(HAL_RESET_REQUESTED);
+    MEMFAULT_UNREACHABLE;
+}
+
+bool
+memfault_platform_metrics_timer_boot(uint32_t period_sec,
+                                     MemfaultPlatformTimerCallback callback)
+{
+    metrics_period_sec = period_sec;
+    metrics_callback = callback;
+    metrics_callout_cb(NULL);
+    return true;
+}
+
+uint64_t
+memfault_platform_get_time_since_boot_ms(void)
+{
+    return (uint64_t) (os_get_uptime_usec() / 1000);
+}
+
+void
+memfault_platform_core_init(void)
+{
+    static uint8_t s_event_storage[MYNEWT_VAL(MEMFAULT_EVENT_STORAGE_SIZE)];
+    int rc;
+
+    SYSINIT_ASSERT_ACTIVE();
+    os_callout_init(&metrics_callout, os_eventq_dflt_get(),
+                    metrics_callout_cb, NULL);
+    SYSINIT_PANIC_ASSERT(metrics_callout.c_evq != NULL);
+
+    const sResetBootupInfo reset_reason = {

Review comment:
       variables are declared all over the place in this function

##########
File path: sys/memfault/src/memfault_platform_core.c
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "sysinit/sysinit.h"
+#include "os/os.h"
+
+#include "memfault/core/debug_log.h"
+#include "memfault/core/event_storage.h"
+#include "memfault/core/trace_event.h"
+#include "memfault/metrics/metrics.h"
+#include "memfault/metrics/platform/timer.h"
+#include "memfault/panics/reboot_tracking.h"
+#include "memfault/panics/platform/coredump.h"
+
+#include "memfault_common.h"
+
+/* Your .ld file:
+ * MEMORY
+ * {
+ *     [...]
+ *     NOINIT (rw) :  ORIGIN = <RAM_REGION_END>, LENGTH = 64
+ * }
+ * SECTIONS
+ * {
+ *     .noinit (NOLOAD): { KEEP(*(*.mflt_reboot_info)) } > NOINIT
+ * }
+ */
+static uint8_t s_reboot_tracking[MEMFAULT_REBOOT_TRACKING_REGION_SIZE]
+    __attribute__((section(".mflt_reboot_info")));
+
+static struct os_callout metrics_callout;
+static uint32_t metrics_period_sec;
+static MemfaultPlatformTimerCallback *metrics_callback;
+
+static void
+metrics_callout_cb(struct os_event *ev)
+{
+    if (metrics_callback) {
+        metrics_callback();
+    }
+    os_callout_reset(&metrics_callout,
+                     os_time_ms_to_ticks32(metrics_period_sec * 1000));
+}
+
+void
+memfault_platform_halt_if_debugging(void)
+{
+    if (hal_debugger_connected()) {
+        __asm("bkpt");
+    }
+}
+
+void
+memfault_platform_reboot(void)
+{
+    os_reboot(HAL_RESET_REQUESTED);
+    MEMFAULT_UNREACHABLE;
+}
+
+bool
+memfault_platform_metrics_timer_boot(uint32_t period_sec,
+                                     MemfaultPlatformTimerCallback callback)
+{
+    metrics_period_sec = period_sec;
+    metrics_callback = callback;
+    metrics_callout_cb(NULL);
+    return true;
+}
+
+uint64_t
+memfault_platform_get_time_since_boot_ms(void)
+{
+    return (uint64_t) (os_get_uptime_usec() / 1000);
+}
+
+void
+memfault_platform_core_init(void)
+{
+    static uint8_t s_event_storage[MYNEWT_VAL(MEMFAULT_EVENT_STORAGE_SIZE)];
+    int rc;
+
+    SYSINIT_ASSERT_ACTIVE();
+    os_callout_init(&metrics_callout, os_eventq_dflt_get(),
+                    metrics_callout_cb, NULL);
+    SYSINIT_PANIC_ASSERT(metrics_callout.c_evq != NULL);
+
+    const sResetBootupInfo reset_reason = {
+        .reset_reason_reg = NRF_POWER->RESETREAS,
+    };
+
+    memfault_reboot_tracking_boot(s_reboot_tracking, &reset_reason);
+    /* Note: MCU reset reason register bits are usually "sticky" and
+     * need to be cleared.
+     */
+    NRF_POWER->RESETREAS |= NRF_POWER->RESETREAS;

Review comment:
       On memfault page they claim that not only Nordic is supported. Is our implementation is limited to NRF?

##########
File path: sys/memfault/pkg.yml
##########
@@ -0,0 +1,48 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+pkg.name: sys/memfault
+pkg.description: Memfault integration package (https://memfault.com/)
+pkg.author: "Apache Mynewt <de...@mynewt.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+pkg.type: sdk
+pkg.deps:
+    - "@apache-mynewt-core/kernel/os"
+    - "@apache-mynewt-core/sys/shell"
+    - "@apache-mynewt-core/sys/flash_map"
+    - "@apache-mynewt-core/hw/hal"
+    - "@apache-mynewt-core/mgmt/imgmgr"
+    - "@mcuboot/boot/bootutil"
+
+pkg.deps.MEMFAULT_MGMT:
+    - "@apache-mynewt-mcumgr/cmd/memfault_mgmt"

Review comment:
       non existing package




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] michal-narajowski closed pull request #2286: Add Memfault integration

Posted by GitBox <gi...@apache.org>.
michal-narajowski closed pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2286: [WIP] Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-626624614


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### apps/memfault_demo/src/main.c
   <details>
   
   ```diff
   @@ -49,10 +49,10 @@
    struct os_callout send_bytes_co;
    
    void
   -bluetooth_driver_send_bytes(struct os_event* ev)
   +bluetooth_driver_send_bytes(struct os_event * ev)
    {
        memfault_metrics_heartbeat_add(MEMFAULT_METRICS_KEY(BtBytesSent), 50);
   -    // [ ... code to send bluetooth data ... ]
   +    /* [ ... code to send bluetooth data ... ] */
        os_callout_reset(&send_bytes_co, os_time_ms_to_ticks32(2000));
    }
    
   ```
   
   </details>
   
   #### sys/memfault/src/memfault_demo_cli.c
   <details>
   
   ```diff
   @@ -6,60 +6,77 @@
    
    #include "memfault_common.h"
    
   -static int prv_clear_core_cmd(int argc, char **argv) {
   -	return memfault_demo_cli_cmd_clear_core(argc, argv);
   +static int
   +prv_clear_core_cmd(int argc, char **argv)
   +{
   +    return memfault_demo_cli_cmd_clear_core(argc, argv);
    }
    
   -static int prv_get_core_cmd(int argc, char **argv) {
   -	return memfault_demo_cli_cmd_get_core(argc, argv);
   +static int
   +prv_get_core_cmd(int argc, char **argv)
   +{
   +    return memfault_demo_cli_cmd_get_core(argc, argv);
    }
    
   -static int prv_crash_example(int argc, char **argv) {
   -	return memfault_demo_cli_cmd_crash(argc, argv);
   +static int
   +prv_crash_example(int argc, char **argv)
   +{
   +    return memfault_demo_cli_cmd_crash(argc, argv);
    }
    
   -static int prv_get_device_info(int argc, char **argv) {
   -	return memfault_demo_cli_cmd_get_device_info(argc, argv);
   +static int
   +prv_get_device_info(int argc, char **argv)
   +{
   +    return memfault_demo_cli_cmd_get_device_info(argc, argv);
    }
    
   -static int prv_print_chunk_cmd(int argc, char **argv) {
   -	return memfault_demo_cli_cmd_print_chunk(argc, argv);
   +static int
   +prv_print_chunk_cmd(int argc, char **argv)
   +{
   +    return memfault_demo_cli_cmd_print_chunk(argc, argv);
    }
    
   -static int prv_heartbeat_trigger(int argc, char **argv) {
   -	memfault_metrics_heartbeat_debug_trigger();
   -	return 0;
   +static int
   +prv_heartbeat_trigger(int argc, char **argv)
   +{
   +    memfault_metrics_heartbeat_debug_trigger();
   +    return 0;
    }
    
   -static int prv_heartbeat_print(int argc, char **argv) {
   -	memfault_metrics_heartbeat_debug_print();
   -	return 0;
   +static int
   +prv_heartbeat_print(int argc, char **argv)
   +{
   +    memfault_metrics_heartbeat_debug_print();
   +    return 0;
    }
    
   -static int prv_test_trace_event(int argc, char **argv) {
   -	MEMFAULT_TRACE_EVENT(test);
   -	return 0;
   +static int
   +prv_test_trace_event(int argc, char **argv)
   +{
   +    MEMFAULT_TRACE_EVENT(test);
   +    return 0;
    }
    
    static const struct shell_cmd os_commands[] = {
   -	SHELL_CMD("crash", prv_crash_example, NULL),
   -	SHELL_CMD("clear_core", prv_clear_core_cmd, NULL),
   -	SHELL_CMD("get_core", prv_get_core_cmd, NULL),
   -	SHELL_CMD("get_device_info", prv_get_device_info, NULL),
   -	SHELL_CMD("print_chunk", prv_print_chunk_cmd, NULL),
   -	SHELL_CMD("heartbeat_trigger", prv_heartbeat_trigger, NULL),
   -	SHELL_CMD("heartbeat_print", prv_heartbeat_print, NULL),
   -	SHELL_CMD("test_trace_event", prv_test_trace_event, NULL),
   -	{ 0 },
   +    SHELL_CMD("crash", prv_crash_example, NULL),
   +    SHELL_CMD("clear_core", prv_clear_core_cmd, NULL),
   +    SHELL_CMD("get_core", prv_get_core_cmd, NULL),
   +    SHELL_CMD("get_device_info", prv_get_device_info, NULL),
   +    SHELL_CMD("print_chunk", prv_print_chunk_cmd, NULL),
   +    SHELL_CMD("heartbeat_trigger", prv_heartbeat_trigger, NULL),
   +    SHELL_CMD("heartbeat_print", prv_heartbeat_print, NULL),
   +    SHELL_CMD("test_trace_event", prv_test_trace_event, NULL),
   +    { 0 },
    };
    
   -void shell_mflt_register(void)
   +void
   +shell_mflt_register(void)
    {
   -	int rc;
   +    int rc;
    
   -	rc = shell_register("mflt", os_commands);
   -	SYSINIT_PANIC_ASSERT_MSG(
   -		rc == 0, "Failed to register OS shell commands");
   +    rc = shell_register("mflt", os_commands);
   +    SYSINIT_PANIC_ASSERT_MSG(
   +        rc == 0, "Failed to register OS shell commands");
    
   -	shell_register_default_module("mflt");
   +    shell_register_default_module("mflt");
    }
   ```
   
   </details>
   
   #### sys/memfault/src/memfault_platform_core.c
   <details>
   
   ```diff
   @@ -30,9 +30,11 @@
    void
    memfault_platform_halt_if_debugging(void)
    {
   -//    if (hal_debugger_connected()) {
   -//        __asm("bkpt");
   -//    }
   +/*
   +      if (hal_debugger_connected()) {
   +          __asm("bkpt");
   +      }
   + */
    }
    
    void
   @@ -49,7 +51,7 @@
        metrics_period_sec = period_sec;
        metrics_callback = callback;
        metrics_callout_cb(NULL);
   -    return true; // indicates setup was successful
   +    return true; /* indicates setup was successful */
    }
    
    uint64_t
   @@ -74,20 +76,22 @@
        const sMemfaultEventStorageImpl *evt_storage =
            memfault_events_storage_boot(s_event_storage, sizeof(s_event_storage));
    
   -    // Pass the storage to collect reset info
   +    /* Pass the storage to collect reset info */
        memfault_reboot_tracking_collect_reset_info(evt_storage);
   -    // Pass the storage to initialize the trace event module
   +    /* Pass the storage to initialize the trace event module */
        memfault_trace_event_boot(evt_storage);
    
   -    // NOTE: crash count represents the number of unexpected reboots since the
   -    // last heartbeat was reported. In the simplest case if reboots are
   -    // unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   -    // how this can be tracked with the reboot_tracking module.
   +    /*
   +       NOTE: crash count represents the number of unexpected reboots since the
   +       last heartbeat was reported. In the simplest case if reboots are
   +       unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   +       how this can be tracked with the reboot_tracking module.
   +     */
        sMemfaultMetricBootInfo boot_info = {
            .unexpected_reboot_count = memfault_reboot_tracking_get_crash_count()
        };
        rc = memfault_metrics_boot(evt_storage, &boot_info);
   -    // NOTE: a non-zero value indicates a configuration error took place
   +    /* NOTE: a non-zero value indicates a configuration error took place */
        SYSINIT_PANIC_ASSERT(rc == 0);
    
        memfault_reboot_tracking_reset_crash_count();
   ```
   
   </details>
   
   #### sys/memfault/src/memfault_platform_debug_log.c
   <details>
   
   ```diff
   @@ -7,43 +7,47 @@
    #define MEMFAULT_DEBUG_LOG_BUFFER_SIZE_BYTES (128)
    #endif
    
   -void memfault_platform_log(eMemfaultPlatformLogLevel level, const char *fmt, ...) {
   -	va_list args;
   -	va_start(args, fmt);
   +void
   +memfault_platform_log(eMemfaultPlatformLogLevel level, const char *fmt, ...)
   +{
   +    va_list args;
   +    va_start(args, fmt);
    
   -	char log_buf[MEMFAULT_DEBUG_LOG_BUFFER_SIZE_BYTES];
   -	vsnprintf(log_buf, sizeof(log_buf), fmt, args);
   +    char log_buf[MEMFAULT_DEBUG_LOG_BUFFER_SIZE_BYTES];
   +    vsnprintf(log_buf, sizeof(log_buf), fmt, args);
    
   -	const char *lvl_str = "???";
   -	switch (level) {
   -		case kMemfaultPlatformLogLevel_Debug:
   -			lvl_str = "dbg";
   -			break;
   +    const char *lvl_str = "???";
   +    switch (level) {
   +    case kMemfaultPlatformLogLevel_Debug:
   +        lvl_str = "dbg";
   +        break;
    
   -		case kMemfaultPlatformLogLevel_Info:
   -			lvl_str = "inf";
   -			break;
   +    case kMemfaultPlatformLogLevel_Info:
   +        lvl_str = "inf";
   +        break;
    
   -		case kMemfaultPlatformLogLevel_Warning:
   -			lvl_str = "wrn";
   -			break;
   +    case kMemfaultPlatformLogLevel_Warning:
   +        lvl_str = "wrn";
   +        break;
    
   -		case kMemfaultPlatformLogLevel_Error:
   -			lvl_str = "err";
   -			break;
   +    case kMemfaultPlatformLogLevel_Error:
   +        lvl_str = "err";
   +        break;
    
   -		default:
   -			break;
   -	}
   -	console_printf("<%s> <mflt>: %s\n", lvl_str, log_buf);
   +    default:
   +        break;
   +    }
   +    console_printf("<%s> <mflt>: %s\n", lvl_str, log_buf);
    
   -	va_end(args);
   +    va_end(args);
    }
    
   -void memfault_platform_log_raw(const char *fmt, ...) {
   -	va_list args;
   -	va_start(args, fmt);
   -	vprintf(fmt, args);
   -	va_end(args);
   -	console_printf("\n");
   +void
   +memfault_platform_log_raw(const char *fmt, ...)
   +{
   +    va_list args;
   +    va_start(args, fmt);
   +    vprintf(fmt, args);
   +    va_end(args);
   +    console_printf("\n");
    }
   ```
   
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2286: [WIP] Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-633530374


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### apps/bleprph_memfault/src/gatt_svr.c
   <details>
   
   ```diff
   @@ -31,13 +31,13 @@
    
        switch (ctxt->op) {
        case BLE_GATT_REGISTER_OP_SVC:
   -    DFLT_LOG_DEBUG("registered service %s with handle=%d\n",
   +        DFLT_LOG_DEBUG("registered service %s with handle=%d\n",
                       ble_uuid_to_str(ctxt->svc.svc_def->uuid, buf),
                       ctxt->svc.handle);
            break;
    
        case BLE_GATT_REGISTER_OP_CHR:
   -    DFLT_LOG_DEBUG("registering characteristic %s with "
   +        DFLT_LOG_DEBUG("registering characteristic %s with "
                       "def_handle=%d val_handle=%d\n",
                       ble_uuid_to_str(ctxt->chr.chr_def->uuid, buf),
                       ctxt->chr.def_handle,
   @@ -45,7 +45,7 @@
            break;
    
        case BLE_GATT_REGISTER_OP_DSC:
   -    DFLT_LOG_DEBUG("registering descriptor %s with handle=%d\n",
   +        DFLT_LOG_DEBUG("registering descriptor %s with handle=%d\n",
                       ble_uuid_to_str(ctxt->dsc.dsc_def->uuid, buf),
                       ctxt->dsc.handle);
            break;
   ```
   
   </details>
   
   #### apps/bleprph_memfault/src/main.c
   <details>
   
   ```diff
   @@ -58,7 +58,8 @@
    };
    
    void
   -memfault_metrics_heartbeat_collect_data(void) {
   +memfault_metrics_heartbeat_collect_data(void)
   +{
        struct os_task *prev_task;
        struct os_task_info oti;
        char *name;
   ```
   
   </details>
   
   #### sys/memfault/src/memfault_platform_core.c
   <details>
   
   ```diff
   @@ -69,7 +69,7 @@
        metrics_period_sec = period_sec;
        metrics_callback = callback;
        metrics_callout_cb(NULL);
   -    return true; // indicates setup was successful
   +    return true; /* indicates setup was successful */
    }
    
    uint64_t
   @@ -94,27 +94,31 @@
        };
    
        memfault_reboot_tracking_boot(s_reboot_tracking, &reset_reason);
   -    // Note: MCU reset reason register bits are usually "sticky" and
   -    // need to be cleared
   +    /*
   +       Note: MCU reset reason register bits are usually "sticky" and
   +       need to be cleared
   +     */
        NRF_POWER->RESETREAS |= NRF_POWER->RESETREAS;
    
        const sMemfaultEventStorageImpl *evt_storage =
            memfault_events_storage_boot(s_event_storage, sizeof(s_event_storage));
    
   -    // Pass the storage to collect reset info
   +    /* Pass the storage to collect reset info */
        memfault_reboot_tracking_collect_reset_info(evt_storage);
   -    // Pass the storage to initialize the trace event module
   +    /* Pass the storage to initialize the trace event module */
        memfault_trace_event_boot(evt_storage);
    
   -    // NOTE: crash count represents the number of unexpected reboots since the
   -    // last heartbeat was reported. In the simplest case if reboots are
   -    // unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   -    // how this can be tracked with the reboot_tracking module.
   +    /*
   +       NOTE: crash count represents the number of unexpected reboots since the
   +       last heartbeat was reported. In the simplest case if reboots are
   +       unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   +       how this can be tracked with the reboot_tracking module.
   +     */
        sMemfaultMetricBootInfo boot_info = {
            .unexpected_reboot_count = memfault_reboot_tracking_get_crash_count()
        };
        rc = memfault_metrics_boot(evt_storage, &boot_info);
   -    // NOTE: a non-zero value indicates a configuration error took place
   +    /* NOTE: a non-zero value indicates a configuration error took place */
        SYSINIT_PANIC_ASSERT(rc == 0);
    
        memfault_reboot_tracking_reset_crash_count();
   ```
   
   </details>
   
   #### sys/memfault/src/memfault_platform_flash_backed_coredump.c
   <details>
   
   ```diff
   @@ -32,8 +32,7 @@
    
    
    const sMfltCoredumpRegion *
   -memfault_platform_coredump_get_regions(
   -    const sCoredumpCrashInfo *crash_info, size_t *num_regions)
   +memfault_platform_coredump_get_regions(const sCoredumpCrashInfo *crash_info, size_t *num_regions)
    {
        static sMfltCoredumpRegion s_coredump_regions[1];
        int area_cnt;
   ```
   
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2286: [WIP] Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-633532440


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### sys/memfault/src/memfault_platform_core.c
   <details>
   
   ```diff
   @@ -102,20 +102,22 @@
        const sMemfaultEventStorageImpl *evt_storage =
            memfault_events_storage_boot(s_event_storage, sizeof(s_event_storage));
    
   -    // Pass the storage to collect reset info
   +    /* Pass the storage to collect reset info */
        memfault_reboot_tracking_collect_reset_info(evt_storage);
   -    // Pass the storage to initialize the trace event module
   +    /* Pass the storage to initialize the trace event module */
        memfault_trace_event_boot(evt_storage);
    
   -    // NOTE: crash count represents the number of unexpected reboots since the
   -    // last heartbeat was reported. In the simplest case if reboots are
   -    // unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   -    // how this can be tracked with the reboot_tracking module.
   +    /*
   +       NOTE: crash count represents the number of unexpected reboots since the
   +       last heartbeat was reported. In the simplest case if reboots are
   +       unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   +       how this can be tracked with the reboot_tracking module.
   +     */
        sMemfaultMetricBootInfo boot_info = {
            .unexpected_reboot_count = memfault_reboot_tracking_get_crash_count()
        };
        rc = memfault_metrics_boot(evt_storage, &boot_info);
   -    // NOTE: a non-zero value indicates a configuration error took place
   +    /* NOTE: a non-zero value indicates a configuration error took place */
        SYSINIT_PANIC_ASSERT(rc == 0);
    
        memfault_reboot_tracking_reset_crash_count();
   ```
   
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] michal-narajowski commented on pull request #2286: Add Memfault integration

Posted by GitBox <gi...@apache.org>.
michal-narajowski commented on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-636707524


   Depends on these pull requests:
   https://github.com/apache/mynewt-mcumgr/pull/84
   https://github.com/apache/mynewt-newtmgr/pull/165


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2286: [WIP] Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-633534796


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2286: [WIP] Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-626653618


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### apps/memfault_demo/src/main.c
   <details>
   
   ```diff
   @@ -53,7 +53,7 @@
    bluetooth_driver_send_bytes(struct os_event *ev)
    {
        memfault_metrics_heartbeat_add(MEMFAULT_METRICS_KEY(BtBytesSent), 50);
   -    // [ ... code to send bluetooth data ... ]
   +    /* [ ... code to send bluetooth data ... ] */
        os_callout_reset(&send_bytes_co, os_time_ms_to_ticks32(2000));
    }
    
   ```
   
   </details>
   
   #### sys/memfault/src/memfault_platform_core.c
   <details>
   
   ```diff
   @@ -30,9 +30,11 @@
    void
    memfault_platform_halt_if_debugging(void)
    {
   -//    if (hal_debugger_connected()) {
   -//        __asm("bkpt");
   -//    }
   +/*
   +      if (hal_debugger_connected()) {
   +          __asm("bkpt");
   +      }
   + */
    }
    
    void
   @@ -49,7 +51,7 @@
        metrics_period_sec = period_sec;
        metrics_callback = callback;
        metrics_callout_cb(NULL);
   -    return true; // indicates setup was successful
   +    return true; /* indicates setup was successful */
    }
    
    uint64_t
   @@ -74,20 +76,22 @@
        const sMemfaultEventStorageImpl *evt_storage =
            memfault_events_storage_boot(s_event_storage, sizeof(s_event_storage));
    
   -    // Pass the storage to collect reset info
   +    /* Pass the storage to collect reset info */
        memfault_reboot_tracking_collect_reset_info(evt_storage);
   -    // Pass the storage to initialize the trace event module
   +    /* Pass the storage to initialize the trace event module */
        memfault_trace_event_boot(evt_storage);
    
   -    // NOTE: crash count represents the number of unexpected reboots since the
   -    // last heartbeat was reported. In the simplest case if reboots are
   -    // unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   -    // how this can be tracked with the reboot_tracking module.
   +    /*
   +       NOTE: crash count represents the number of unexpected reboots since the
   +       last heartbeat was reported. In the simplest case if reboots are
   +       unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   +       how this can be tracked with the reboot_tracking module.
   +     */
        sMemfaultMetricBootInfo boot_info = {
            .unexpected_reboot_count = memfault_reboot_tracking_get_crash_count()
        };
        rc = memfault_metrics_boot(evt_storage, &boot_info);
   -    // NOTE: a non-zero value indicates a configuration error took place
   +    /* NOTE: a non-zero value indicates a configuration error took place */
        SYSINIT_PANIC_ASSERT(rc == 0);
    
        memfault_reboot_tracking_reset_crash_count();
   ```
   
   </details>
   
   #### sys/memfault/src/memfault_platform_debug_log.c
   <details>
   
   ```diff
   @@ -18,24 +18,24 @@
    
        const char *lvl_str = "???";
        switch (level) {
   -        case kMemfaultPlatformLogLevel_Debug:
   -            lvl_str = "dbg";
   -            break;
   +    case kMemfaultPlatformLogLevel_Debug:
   +        lvl_str = "dbg";
   +        break;
    
   -        case kMemfaultPlatformLogLevel_Info:
   -            lvl_str = "inf";
   -            break;
   +    case kMemfaultPlatformLogLevel_Info:
   +        lvl_str = "inf";
   +        break;
    
   -        case kMemfaultPlatformLogLevel_Warning:
   -            lvl_str = "wrn";
   -            break;
   +    case kMemfaultPlatformLogLevel_Warning:
   +        lvl_str = "wrn";
   +        break;
    
   -        case kMemfaultPlatformLogLevel_Error:
   -            lvl_str = "err";
   -            break;
   +    case kMemfaultPlatformLogLevel_Error:
   +        lvl_str = "err";
   +        break;
    
   -        default:
   -            break;
   +    default:
   +        break;
        }
        console_printf("<%s> <mflt>: %s\n", lvl_str, log_buf);
    
   ```
   
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2286: [WIP] Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-633534628


   
   <!-- license-bot -->
   
   ## RAT Report (2020-05-25 11:52:09)
   
   ## New files with unknown licenses
   
   * <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/apps/bleprph_memfault/include/memfault_metrics_heartbeat_config.def">apps/bleprph_memfault/include/memfault_metrics_heartbeat_config.def</a>
   * <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/apps/bleprph_memfault/include/memfault_trace_reason_user_config.def">apps/bleprph_memfault/include/memfault_trace_reason_user_config.def</a>
   
   ## 22 new files were excluded from check (.rat-excludes)
   
   <details>
     <summary>Detailed analysis</summary>
   
   ## New files in this PR
   
   | License | File |
   |---------|------|
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/apps/bleprph_memfault/pkg.yml">apps/bleprph_memfault/pkg.yml</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/apps/bleprph_memfault/syscfg.yml">apps/bleprph_memfault/syscfg.yml</a> |
   | ?????  | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/apps/bleprph_memfault/include/memfault_metrics_heartbeat_config.def">apps/bleprph_memfault/include/memfault_metrics_heartbeat_config.def</a> |
   | ?????  | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/apps/bleprph_memfault/include/memfault_trace_reason_user_config.def">apps/bleprph_memfault/include/memfault_trace_reason_user_config.def</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/apps/bleprph_memfault/src/bleprph.c">apps/bleprph_memfault/src/bleprph.c</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/apps/bleprph_memfault/src/bleprph.h">apps/bleprph_memfault/src/bleprph.h</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/apps/bleprph_memfault/src/gatt_svr.c">apps/bleprph_memfault/src/gatt_svr.c</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/apps/bleprph_memfault/src/main.c">apps/bleprph_memfault/src/main.c</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/apps/bleprph_memfault/src/misc.c">apps/bleprph_memfault/src/misc.c</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/sys/memfault/pkg.yml">sys/memfault/pkg.yml</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/sys/memfault/syscfg.yml">sys/memfault/syscfg.yml</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/sys/memfault/src/memfault_common.h">sys/memfault/src/memfault_common.h</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/sys/memfault/src/memfault_demo_cli.c">sys/memfault/src/memfault_demo_cli.c</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/sys/memfault/src/memfault_platform_core.c">sys/memfault/src/memfault_platform_core.c</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/sys/memfault/src/memfault_platform_debug_log.c">sys/memfault/src/memfault_platform_debug_log.c</a> |
   | AL     | <a href="https://github.com/apache/mynewt-core/blob/05611ff7541173a3dae7c9047bf662782aa0197a/sys/memfault/src/memfault_platform_flash_backed_coredump.c">sys/memfault/src/memfault_platform_flash_backed_coredump.c</a> |
   </details>
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2286: [WIP] Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-626624614


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### apps/memfault_demo/src/main.c
   <details>
   
   ```diff
   @@ -49,10 +49,10 @@
    struct os_callout send_bytes_co;
    
    void
   -bluetooth_driver_send_bytes(struct os_event* ev)
   +bluetooth_driver_send_bytes(struct os_event * ev)
    {
        memfault_metrics_heartbeat_add(MEMFAULT_METRICS_KEY(BtBytesSent), 50);
   -    // [ ... code to send bluetooth data ... ]
   +    /* [ ... code to send bluetooth data ... ] */
        os_callout_reset(&send_bytes_co, os_time_ms_to_ticks32(2000));
    }
    
   ```
   
   </details>
   
   #### sys/memfault/src/memfault_demo_cli.c
   <details>
   
   ```diff
   @@ -6,60 +6,77 @@
    
    #include "memfault_common.h"
    
   -static int prv_clear_core_cmd(int argc, char **argv) {
   -	return memfault_demo_cli_cmd_clear_core(argc, argv);
   +static int
   +prv_clear_core_cmd(int argc, char **argv)
   +{
   +    return memfault_demo_cli_cmd_clear_core(argc, argv);
    }
    
   -static int prv_get_core_cmd(int argc, char **argv) {
   -	return memfault_demo_cli_cmd_get_core(argc, argv);
   +static int
   +prv_get_core_cmd(int argc, char **argv)
   +{
   +    return memfault_demo_cli_cmd_get_core(argc, argv);
    }
    
   -static int prv_crash_example(int argc, char **argv) {
   -	return memfault_demo_cli_cmd_crash(argc, argv);
   +static int
   +prv_crash_example(int argc, char **argv)
   +{
   +    return memfault_demo_cli_cmd_crash(argc, argv);
    }
    
   -static int prv_get_device_info(int argc, char **argv) {
   -	return memfault_demo_cli_cmd_get_device_info(argc, argv);
   +static int
   +prv_get_device_info(int argc, char **argv)
   +{
   +    return memfault_demo_cli_cmd_get_device_info(argc, argv);
    }
    
   -static int prv_print_chunk_cmd(int argc, char **argv) {
   -	return memfault_demo_cli_cmd_print_chunk(argc, argv);
   +static int
   +prv_print_chunk_cmd(int argc, char **argv)
   +{
   +    return memfault_demo_cli_cmd_print_chunk(argc, argv);
    }
    
   -static int prv_heartbeat_trigger(int argc, char **argv) {
   -	memfault_metrics_heartbeat_debug_trigger();
   -	return 0;
   +static int
   +prv_heartbeat_trigger(int argc, char **argv)
   +{
   +    memfault_metrics_heartbeat_debug_trigger();
   +    return 0;
    }
    
   -static int prv_heartbeat_print(int argc, char **argv) {
   -	memfault_metrics_heartbeat_debug_print();
   -	return 0;
   +static int
   +prv_heartbeat_print(int argc, char **argv)
   +{
   +    memfault_metrics_heartbeat_debug_print();
   +    return 0;
    }
    
   -static int prv_test_trace_event(int argc, char **argv) {
   -	MEMFAULT_TRACE_EVENT(test);
   -	return 0;
   +static int
   +prv_test_trace_event(int argc, char **argv)
   +{
   +    MEMFAULT_TRACE_EVENT(test);
   +    return 0;
    }
    
    static const struct shell_cmd os_commands[] = {
   -	SHELL_CMD("crash", prv_crash_example, NULL),
   -	SHELL_CMD("clear_core", prv_clear_core_cmd, NULL),
   -	SHELL_CMD("get_core", prv_get_core_cmd, NULL),
   -	SHELL_CMD("get_device_info", prv_get_device_info, NULL),
   -	SHELL_CMD("print_chunk", prv_print_chunk_cmd, NULL),
   -	SHELL_CMD("heartbeat_trigger", prv_heartbeat_trigger, NULL),
   -	SHELL_CMD("heartbeat_print", prv_heartbeat_print, NULL),
   -	SHELL_CMD("test_trace_event", prv_test_trace_event, NULL),
   -	{ 0 },
   +    SHELL_CMD("crash", prv_crash_example, NULL),
   +    SHELL_CMD("clear_core", prv_clear_core_cmd, NULL),
   +    SHELL_CMD("get_core", prv_get_core_cmd, NULL),
   +    SHELL_CMD("get_device_info", prv_get_device_info, NULL),
   +    SHELL_CMD("print_chunk", prv_print_chunk_cmd, NULL),
   +    SHELL_CMD("heartbeat_trigger", prv_heartbeat_trigger, NULL),
   +    SHELL_CMD("heartbeat_print", prv_heartbeat_print, NULL),
   +    SHELL_CMD("test_trace_event", prv_test_trace_event, NULL),
   +    { 0 },
    };
    
   -void shell_mflt_register(void)
   +void
   +shell_mflt_register(void)
    {
   -	int rc;
   +    int rc;
    
   -	rc = shell_register("mflt", os_commands);
   -	SYSINIT_PANIC_ASSERT_MSG(
   -		rc == 0, "Failed to register OS shell commands");
   +    rc = shell_register("mflt", os_commands);
   +    SYSINIT_PANIC_ASSERT_MSG(
   +        rc == 0, "Failed to register OS shell commands");
    
   -	shell_register_default_module("mflt");
   +    shell_register_default_module("mflt");
    }
   ```
   
   </details>
   
   #### sys/memfault/src/memfault_platform_core.c
   <details>
   
   ```diff
   @@ -30,9 +30,11 @@
    void
    memfault_platform_halt_if_debugging(void)
    {
   -//    if (hal_debugger_connected()) {
   -//        __asm("bkpt");
   -//    }
   +/*
   +      if (hal_debugger_connected()) {
   +          __asm("bkpt");
   +      }
   + */
    }
    
    void
   @@ -49,7 +51,7 @@
        metrics_period_sec = period_sec;
        metrics_callback = callback;
        metrics_callout_cb(NULL);
   -    return true; // indicates setup was successful
   +    return true; /* indicates setup was successful */
    }
    
    uint64_t
   @@ -74,20 +76,22 @@
        const sMemfaultEventStorageImpl *evt_storage =
            memfault_events_storage_boot(s_event_storage, sizeof(s_event_storage));
    
   -    // Pass the storage to collect reset info
   +    /* Pass the storage to collect reset info */
        memfault_reboot_tracking_collect_reset_info(evt_storage);
   -    // Pass the storage to initialize the trace event module
   +    /* Pass the storage to initialize the trace event module */
        memfault_trace_event_boot(evt_storage);
    
   -    // NOTE: crash count represents the number of unexpected reboots since the
   -    // last heartbeat was reported. In the simplest case if reboots are
   -    // unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   -    // how this can be tracked with the reboot_tracking module.
   +    /*
   +       NOTE: crash count represents the number of unexpected reboots since the
   +       last heartbeat was reported. In the simplest case if reboots are
   +       unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   +       how this can be tracked with the reboot_tracking module.
   +     */
        sMemfaultMetricBootInfo boot_info = {
            .unexpected_reboot_count = memfault_reboot_tracking_get_crash_count()
        };
        rc = memfault_metrics_boot(evt_storage, &boot_info);
   -    // NOTE: a non-zero value indicates a configuration error took place
   +    /* NOTE: a non-zero value indicates a configuration error took place */
        SYSINIT_PANIC_ASSERT(rc == 0);
    
        memfault_reboot_tracking_reset_crash_count();
   ```
   
   </details>
   
   #### sys/memfault/src/memfault_platform_debug_log.c
   <details>
   
   ```diff
   @@ -7,43 +7,47 @@
    #define MEMFAULT_DEBUG_LOG_BUFFER_SIZE_BYTES (128)
    #endif
    
   -void memfault_platform_log(eMemfaultPlatformLogLevel level, const char *fmt, ...) {
   -	va_list args;
   -	va_start(args, fmt);
   +void
   +memfault_platform_log(eMemfaultPlatformLogLevel level, const char *fmt, ...)
   +{
   +    va_list args;
   +    va_start(args, fmt);
    
   -	char log_buf[MEMFAULT_DEBUG_LOG_BUFFER_SIZE_BYTES];
   -	vsnprintf(log_buf, sizeof(log_buf), fmt, args);
   +    char log_buf[MEMFAULT_DEBUG_LOG_BUFFER_SIZE_BYTES];
   +    vsnprintf(log_buf, sizeof(log_buf), fmt, args);
    
   -	const char *lvl_str = "???";
   -	switch (level) {
   -		case kMemfaultPlatformLogLevel_Debug:
   -			lvl_str = "dbg";
   -			break;
   +    const char *lvl_str = "???";
   +    switch (level) {
   +    case kMemfaultPlatformLogLevel_Debug:
   +        lvl_str = "dbg";
   +        break;
    
   -		case kMemfaultPlatformLogLevel_Info:
   -			lvl_str = "inf";
   -			break;
   +    case kMemfaultPlatformLogLevel_Info:
   +        lvl_str = "inf";
   +        break;
    
   -		case kMemfaultPlatformLogLevel_Warning:
   -			lvl_str = "wrn";
   -			break;
   +    case kMemfaultPlatformLogLevel_Warning:
   +        lvl_str = "wrn";
   +        break;
    
   -		case kMemfaultPlatformLogLevel_Error:
   -			lvl_str = "err";
   -			break;
   +    case kMemfaultPlatformLogLevel_Error:
   +        lvl_str = "err";
   +        break;
    
   -		default:
   -			break;
   -	}
   -	console_printf("<%s> <mflt>: %s\n", lvl_str, log_buf);
   +    default:
   +        break;
   +    }
   +    console_printf("<%s> <mflt>: %s\n", lvl_str, log_buf);
    
   -	va_end(args);
   +    va_end(args);
    }
    
   -void memfault_platform_log_raw(const char *fmt, ...) {
   -	va_list args;
   -	va_start(args, fmt);
   -	vprintf(fmt, args);
   -	va_end(args);
   -	console_printf("\n");
   +void
   +memfault_platform_log_raw(const char *fmt, ...)
   +{
   +    va_list args;
   +    va_start(args, fmt);
   +    vprintf(fmt, args);
   +    va_end(args);
   +    console_printf("\n");
    }
   ```
   
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2286: [WIP] Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-633532440


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### sys/memfault/src/memfault_platform_core.c
   <details>
   
   ```diff
   @@ -102,20 +102,22 @@
        const sMemfaultEventStorageImpl *evt_storage =
            memfault_events_storage_boot(s_event_storage, sizeof(s_event_storage));
    
   -    // Pass the storage to collect reset info
   +    /* Pass the storage to collect reset info */
        memfault_reboot_tracking_collect_reset_info(evt_storage);
   -    // Pass the storage to initialize the trace event module
   +    /* Pass the storage to initialize the trace event module */
        memfault_trace_event_boot(evt_storage);
    
   -    // NOTE: crash count represents the number of unexpected reboots since the
   -    // last heartbeat was reported. In the simplest case if reboots are
   -    // unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   -    // how this can be tracked with the reboot_tracking module.
   +    /*
   +       NOTE: crash count represents the number of unexpected reboots since the
   +       last heartbeat was reported. In the simplest case if reboots are
   +       unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   +       how this can be tracked with the reboot_tracking module.
   +     */
        sMemfaultMetricBootInfo boot_info = {
            .unexpected_reboot_count = memfault_reboot_tracking_get_crash_count()
        };
        rc = memfault_metrics_boot(evt_storage, &boot_info);
   -    // NOTE: a non-zero value indicates a configuration error took place
   +    /* NOTE: a non-zero value indicates a configuration error took place */
        SYSINIT_PANIC_ASSERT(rc == 0);
    
        memfault_reboot_tracking_reset_crash_count();
   ```
   
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2286: [WIP] Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-633533521


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2286: [WIP] Add Memfault integration

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2286:
URL: https://github.com/apache/mynewt-core/pull/2286#issuecomment-633530374


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### apps/bleprph_memfault/src/gatt_svr.c
   <details>
   
   ```diff
   @@ -31,13 +31,13 @@
    
        switch (ctxt->op) {
        case BLE_GATT_REGISTER_OP_SVC:
   -    DFLT_LOG_DEBUG("registered service %s with handle=%d\n",
   +        DFLT_LOG_DEBUG("registered service %s with handle=%d\n",
                       ble_uuid_to_str(ctxt->svc.svc_def->uuid, buf),
                       ctxt->svc.handle);
            break;
    
        case BLE_GATT_REGISTER_OP_CHR:
   -    DFLT_LOG_DEBUG("registering characteristic %s with "
   +        DFLT_LOG_DEBUG("registering characteristic %s with "
                       "def_handle=%d val_handle=%d\n",
                       ble_uuid_to_str(ctxt->chr.chr_def->uuid, buf),
                       ctxt->chr.def_handle,
   @@ -45,7 +45,7 @@
            break;
    
        case BLE_GATT_REGISTER_OP_DSC:
   -    DFLT_LOG_DEBUG("registering descriptor %s with handle=%d\n",
   +        DFLT_LOG_DEBUG("registering descriptor %s with handle=%d\n",
                       ble_uuid_to_str(ctxt->dsc.dsc_def->uuid, buf),
                       ctxt->dsc.handle);
            break;
   ```
   
   </details>
   
   #### apps/bleprph_memfault/src/main.c
   <details>
   
   ```diff
   @@ -58,7 +58,8 @@
    };
    
    void
   -memfault_metrics_heartbeat_collect_data(void) {
   +memfault_metrics_heartbeat_collect_data(void)
   +{
        struct os_task *prev_task;
        struct os_task_info oti;
        char *name;
   ```
   
   </details>
   
   #### sys/memfault/src/memfault_platform_core.c
   <details>
   
   ```diff
   @@ -69,7 +69,7 @@
        metrics_period_sec = period_sec;
        metrics_callback = callback;
        metrics_callout_cb(NULL);
   -    return true; // indicates setup was successful
   +    return true; /* indicates setup was successful */
    }
    
    uint64_t
   @@ -94,27 +94,31 @@
        };
    
        memfault_reboot_tracking_boot(s_reboot_tracking, &reset_reason);
   -    // Note: MCU reset reason register bits are usually "sticky" and
   -    // need to be cleared
   +    /*
   +       Note: MCU reset reason register bits are usually "sticky" and
   +       need to be cleared
   +     */
        NRF_POWER->RESETREAS |= NRF_POWER->RESETREAS;
    
        const sMemfaultEventStorageImpl *evt_storage =
            memfault_events_storage_boot(s_event_storage, sizeof(s_event_storage));
    
   -    // Pass the storage to collect reset info
   +    /* Pass the storage to collect reset info */
        memfault_reboot_tracking_collect_reset_info(evt_storage);
   -    // Pass the storage to initialize the trace event module
   +    /* Pass the storage to initialize the trace event module */
        memfault_trace_event_boot(evt_storage);
    
   -    // NOTE: crash count represents the number of unexpected reboots since the
   -    // last heartbeat was reported. In the simplest case if reboots are
   -    // unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   -    // how this can be tracked with the reboot_tracking module.
   +    /*
   +       NOTE: crash count represents the number of unexpected reboots since the
   +       last heartbeat was reported. In the simplest case if reboots are
   +       unexpected, this can just be set to 1 but see memfault/metrics/metrics.h
   +       how this can be tracked with the reboot_tracking module.
   +     */
        sMemfaultMetricBootInfo boot_info = {
            .unexpected_reboot_count = memfault_reboot_tracking_get_crash_count()
        };
        rc = memfault_metrics_boot(evt_storage, &boot_info);
   -    // NOTE: a non-zero value indicates a configuration error took place
   +    /* NOTE: a non-zero value indicates a configuration error took place */
        SYSINIT_PANIC_ASSERT(rc == 0);
    
        memfault_reboot_tracking_reset_crash_count();
   ```
   
   </details>
   
   #### sys/memfault/src/memfault_platform_flash_backed_coredump.c
   <details>
   
   ```diff
   @@ -32,8 +32,7 @@
    
    
    const sMfltCoredumpRegion *
   -memfault_platform_coredump_get_regions(
   -    const sCoredumpCrashInfo *crash_info, size_t *num_regions)
   +memfault_platform_coredump_get_regions(const sCoredumpCrashInfo *crash_info, size_t *num_regions)
    {
        static sMfltCoredumpRegion s_coredump_regions[1];
        int area_cnt;
   ```
   
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org