[GitHub] mkiiskila commented on issue #763: Integrate nrfx

2018-02-12 Thread GitBox
mkiiskila commented on issue #763: Integrate nrfx
URL: https://github.com/apache/mynewt-core/pull/763#issuecomment-365175456
 
 
   Looks pretty good. Here's one target that seems to be failing:
   
   [marko@IsMyLaptop:~/src/incubator-mynewt-blinky]$ newt target show 
bleprph_nrf52 
   targets/bleprph_nrf52
   app=@apache-mynewt-core/apps/bleprph
   bsp=@apache-mynewt-core/hw/bsp/nrf52840pdk
   build_profile=debug
   
syscfg=BLE_EXT_ADV=1:BLE_LL_CFG_FEAT_LE_2M_PHY=1:BLE_LL_CFG_FEAT_LE_CODED_PHY=1
   [marko@IsMyLaptop:~/src/incubator-mynewt-blinky]$ newt build -j 1 
bleprph_nrf52
   Building target targets/bleprph_nrf52
   Compiling repos/apache-mynewt-core/hw/drivers/nimble/nrf52/src/ble_phy.c
   Error: repos/apache-mynewt-core/hw/drivers/nimble/nrf52/src/ble_phy.c: In 
function 'ble_phy_get_cur_rx_phy_mode':
   repos/apache-mynewt-core/hw/drivers/nimble/nrf52/src/ble_phy.c:796:35: 
error: subscripted value is neither array nor pointer nor vector
phy = NRF_RADIO->RESERVED7[0] & 0x06 ?
  ^
   
   exit status 1
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mkiiskila commented on issue #757: HW driver: drv2605l

2018-02-12 Thread GitBox
mkiiskila commented on issue #757: HW driver: drv2605l
URL: https://github.com/apache/mynewt-core/pull/757#issuecomment-365167518
 
 
   You can merge your PRs yourself.
   
   We seem to have adopted a method of doing this where the person who opened 
the PR merges the code in after it has been reviewed. Obviously if the PR was 
opened by someone who is not in the committer list then we have to merge it on 
their behalf.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-mcumgr] 22/42: Minor code cleanup.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit ad3d83a25e18f72902f5db86624ecbd6a929019b
Author: Christopher Collins 
AuthorDate: Tue Jan 30 11:47:12 2018 -0800

Minor code cleanup.
---
 cmd/log_mgmt/Kconfig  | 1 +
 cmd/log_mgmt/src/log_mgmt.c   | 4 ++--
 cmd/os_mgmt/include/os_mgmt/os_mgmt.h | 2 --
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/cmd/log_mgmt/Kconfig b/cmd/log_mgmt/Kconfig
index e949aa6..8b43166 100644
--- a/cmd/log_mgmt/Kconfig
+++ b/cmd/log_mgmt/Kconfig
@@ -18,6 +18,7 @@
 menuconfig MCUMGR_CMD_LOG_MGMT
 bool
 prompt "Enable mcumgr handlers for log management"
+depends on MDLOG
 default n
 help
   Enables mcumgr handlers for log management
diff --git a/cmd/log_mgmt/src/log_mgmt.c b/cmd/log_mgmt/src/log_mgmt.c
index 430f35a..a3c0cac 100644
--- a/cmd/log_mgmt/src/log_mgmt.c
+++ b/cmd/log_mgmt/src/log_mgmt.c
@@ -92,7 +92,7 @@ log_mgmt_encode_entry(CborEncoder *enc, const struct 
log_mgmt_entry *entry,
 }
 
 static int
-log_mgmt_walk_cb_encode(const struct log_mgmt_entry *entry, void *arg)
+log_mgmt_cb_encode(const struct log_mgmt_entry *entry, void *arg)
 {
 struct CborCntWriter cnt_writer;
 struct log_walk_ctxt *ctxt;
@@ -151,7 +151,7 @@ log_encode_entries(const struct log_mgmt_log *log, 
CborEncoder *enc,
 };
 
 rc = log_mgmt_impl_foreach_entry(log->name, ,
- log_mgmt_walk_cb_encode, );
+ log_mgmt_cb_encode, );
 if (rc != 0 && rc != MGMT_ERR_EMSGSIZE) {
 return rc;
 }
diff --git a/cmd/os_mgmt/include/os_mgmt/os_mgmt.h 
b/cmd/os_mgmt/include/os_mgmt/os_mgmt.h
index 493d227..0c85cbe 100644
--- a/cmd/os_mgmt/include/os_mgmt/os_mgmt.h
+++ b/cmd/os_mgmt/include/os_mgmt/os_mgmt.h
@@ -24,8 +24,6 @@
 extern "C" {
 #endif
 
-struct mgmt_ctxt;
-
 /**
  * Command IDs for OS management group.
  */

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 31/42: Zephyr port: move mcumgr location in zephyr.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 374e8e85a7d29a7580fd019225f8d2da64508789
Author: Christopher Collins 
AuthorDate: Thu Feb 8 15:24:24 2018 -0800

Zephyr port: move mcumgr location in zephyr.

`ext/mcumgr` --> `ext/lib/mgmt/mcumgr`
---
 Kconfig |  4 ++--
 cmd/Kconfig | 10 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Kconfig b/Kconfig
index fe04b1a..b4ff836 100644
--- a/Kconfig
+++ b/Kconfig
@@ -24,6 +24,6 @@ config MCUMGR
   This option enables the mcumgr management library.
 
 if MCUMGR
-source "ext/mcumgr/mgmt/port/zephyr/Kconfig"
-source "ext/mcumgr/cmd/Kconfig"
+source "ext/lib/mgmt/mcumgr/mgmt/port/zephyr/Kconfig"
+source "ext/lib/mgmt/mcumgr/cmd/Kconfig"
 endif
diff --git a/cmd/Kconfig b/cmd/Kconfig
index e404d2d..d26d382 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -17,10 +17,10 @@
 
 menu "Command handlers"
 
-source "ext/mcumgr/cmd/fs_mgmt/Kconfig"
-source "ext/mcumgr/cmd/img_mgmt/Kconfig"
-source "ext/mcumgr/cmd/log_mgmt/Kconfig"
-source "ext/mcumgr/cmd/os_mgmt/Kconfig"
-source "ext/mcumgr/cmd/stat_mgmt/Kconfig"
+source "ext/lib/mgmt/mcumgr/cmd/fs_mgmt/Kconfig"
+source "ext/lib/mgmt/mcumgr/cmd/img_mgmt/Kconfig"
+source "ext/lib/mgmt/mcumgr/cmd/log_mgmt/Kconfig"
+source "ext/lib/mgmt/mcumgr/cmd/os_mgmt/Kconfig"
+source "ext/lib/mgmt/mcumgr/cmd/stat_mgmt/Kconfig"
 
 endmenu

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 36/42: Remove "zephyr, code_partition" from dts overlay

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit eacfbcc56e6dc9c65e1f196ea8254fdc071f7abd
Author: Christopher Collins 
AuthorDate: Mon Feb 12 13:03:34 2018 -0800

Remove "zephyr,code_partition" from dts overlay

This is no longer needed now that MCUboot has been integrated more fully
into Zephyr.
---
 samples/smp_svr/zephyr/dts.overlay | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/samples/smp_svr/zephyr/dts.overlay 
b/samples/smp_svr/zephyr/dts.overlay
index 5a3a7f3..7e73db7 100644
--- a/samples/smp_svr/zephyr/dts.overlay
+++ b/samples/smp_svr/zephyr/dts.overlay
@@ -4,9 +4,6 @@
 
 / {
chosen {
-   /* Required by mcuboot. */
-   zephyr,code-partition = _partition;
-
/* Use uart0 for the mcumgr UART transport. */
zephyr,uart-mcumgr = 
};

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 32/42: smp_svr - Update zephyr port for compatibility.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit add6e0e63735a83efce770474ab5c42500f551de
Author: Christopher Collins 
AuthorDate: Thu Feb 8 15:05:09 2018 -0800

smp_svr - Update zephyr port for compatibility.
---
 samples/smp_svr/zephyr/prj.conf   | 6 ++
 samples/smp_svr/zephyr/src/main.c | 9 +
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/samples/smp_svr/zephyr/prj.conf b/samples/smp_svr/zephyr/prj.conf
index fc2f99c..9e04c3c 100644
--- a/samples/smp_svr/zephyr/prj.conf
+++ b/samples/smp_svr/zephyr/prj.conf
@@ -1,3 +1,6 @@
+# Enable mcumgr.
+CONFIG_MCUMGR=y
+
 # Some command handlers require a large stack.
 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
 
@@ -16,6 +19,9 @@ CONFIG_BT_RX_BUF_LEN=260
 CONFIG_MCUMGR_SMP_BT=y
 CONFIG_MCUMGR_SMP_SHELL=y
 
+# Enable flash operations.
+CONFIG_FLASH=y
+
 # Enable the NFFS file system.
 CONFIG_FILE_SYSTEM=y
 CONFIG_FILE_SYSTEM_NFFS=y
diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index 47e5de2..3e06e40 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -151,11 +151,10 @@ static int init_fcb(void)
 .f_version = MDLOG_VERSION,
 .f_sector_cnt = sector_cnt - 1,
 .f_scratch_cnt = 1,
-.f_area_id = 4,
 .f_sectors = sectors,
 };
 
-rc = fcb_init(_svr_fcb);
+rc = fcb_init(4, _svr_fcb);
 if (rc != 0) {
 return rc;
 }
@@ -168,7 +167,9 @@ void main(void)
 int rc;
 
 rc = init_fcb();
-assert(rc == 0);
+if (rc != 0) {
+printk("Failed to initialize FCB; rc=%d\n", rc);
+}
 
 #ifdef CONFIG_REBOOT_LOG
 reboot_log_configure(_svr_log);
@@ -205,7 +206,7 @@ void main(void)
 /* Initialize the Bluetooth mcumgr transport. */
 smp_bt_register();
 
-#ifdef CONFIG_MDLOG
+#if defined(CONFIG_MDLOG) && defined(CONFIG_FCB)
 mdlog_register("smp_svr", _svr_log, _fcb_handler, _svr_fcb,
MDLOG_LEVEL_DEBUG);
 #endif

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 23/42: smp_svr - Allow both CONFIG_FCB and CONFIG_FS_NFFS

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 9092e0666a449273b2ea5bacdca64d1a4f55f4e8
Author: Christopher Collins 
AuthorDate: Tue Jan 30 12:05:44 2018 -0800

smp_svr - Allow both CONFIG_FCB and CONFIG_FS_NFFS

Prior to this commit, the smp_svr sample app raised a build-time error
if both FCB and NFFS were enabled.  The thinking was that a user only
has enough flash space for one or the other.  However, this does not
justify an error for two reasons:

1. The user's platform may have sufficient flash for both storage types.

2. Even if only one storage type is enabled, it is still OK to enable
both.  One storage type will silently fail to initialize, but the other
will work.  Enabling both makes it easier to switch configurations in
the sample app.
---
 samples/smp_svr/zephyr/CMakeLists.txt | 4 +---
 samples/smp_svr/zephyr/prj.conf   | 4 ++--
 samples/smp_svr/zephyr/src/main.c | 5 -
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/samples/smp_svr/zephyr/CMakeLists.txt 
b/samples/smp_svr/zephyr/CMakeLists.txt
index ec1fced..b61b8ea 100644
--- a/samples/smp_svr/zephyr/CMakeLists.txt
+++ b/samples/smp_svr/zephyr/CMakeLists.txt
@@ -41,7 +41,5 @@ target_sources(app PRIVATE
 
 zephyr_link_libraries(
 MCUMGR
-
-### Uncomment this line to use the NFFS file system.
-# NFFS
+NFFS
 )
diff --git a/samples/smp_svr/zephyr/prj.conf b/samples/smp_svr/zephyr/prj.conf
index 60ccd65..88ad795 100644
--- a/samples/smp_svr/zephyr/prj.conf
+++ b/samples/smp_svr/zephyr/prj.conf
@@ -17,8 +17,8 @@ CONFIG_MCUMGR_SMP_BT=y
 CONFIG_MCUMGR_SMP_SHELL=y
 
 # Enable the NFFS file system.
-#CONFIG_FILE_SYSTEM=y
-#CONFIG_FILE_SYSTEM_NFFS=y
+CONFIG_FILE_SYSTEM=y
+CONFIG_FILE_SYSTEM_NFFS=y
 
 # Enable the flash circular buffer (FCB) for the reboot log.
 CONFIG_FLASH_PAGE_LAYOUT=y
diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index fad6fbc..7f5e9e6 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -17,11 +17,6 @@
 #include "mgmt/smp_bt.h"
 #include "mgmt/buf.h"
 
-#if defined CONFIG_FCB && defined CONFIG_FILE_SYSTEM_NFFS
-#error Both CONFIG_FCB and CONFIG_FILE_SYSTEM_NFFS are defined; smp_svr \
-   application only supports one at a time.
-#endif
-
 #ifdef CONFIG_MCUMGR_CMD_FS_MGMT
 #include "fs_mgmt/fs_mgmt.h"
 #endif

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 37/42: fs_mgmt - Surround macro definition with ().

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 9c708eb5f5064ad24277a77e2797cb3ef8d06900
Author: Christopher Collins 
AuthorDate: Mon Feb 12 13:16:56 2018 -0800

fs_mgmt - Surround macro definition with ().
---
 cmd/fs_mgmt/src/fs_mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/fs_mgmt/src/fs_mgmt.c b/cmd/fs_mgmt/src/fs_mgmt.c
index 2ce7fc2..2d43ac1 100644
--- a/cmd/fs_mgmt/src/fs_mgmt.c
+++ b/cmd/fs_mgmt/src/fs_mgmt.c
@@ -47,7 +47,7 @@ static const struct mgmt_handler fs_mgmt_handlers[] = {
 };
 
 #define FS_MGMT_HANDLER_CNT \
-sizeof fs_mgmt_handlers / sizeof fs_mgmt_handlers[0]
+(sizeof fs_mgmt_handlers / sizeof fs_mgmt_handlers[0])
 
 static struct mgmt_group fs_mgmt_group = {
 .mg_handlers = fs_mgmt_handlers,

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 41/42: Remove base64 library.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 2410e54fb63715c22a9657e0c236e4f4d297239c
Author: Christopher Collins 
AuthorDate: Fri Feb 9 13:59:49 2018 -0800

Remove base64 library.

The application code is expected to provide its own base64 library.
---
 CMakeLists.txt   |   2 -
 ext/CMakeLists.txt   |   1 -
 ext/base64/CMakeLists.txt|  17 ---
 ext/base64/include/base64/base64.h   |  40 ---
 ext/base64/include/base64/hex.h  |  33 --
 ext/base64/pkg.yml   |  26 -
 ext/base64/src/base64.c  | 181 ---
 ext/base64/src/hex.c | 101 -
 ext/base64/test/pkg.yml  |  30 -
 ext/base64/test/src/encoding_test.c  |  53 -
 ext/base64/test/src/encoding_test_priv.h |  38 ---
 ext/base64/test/src/testcases/hex2str.c  |  64 ---
 ext/base64/test/src/testcases/str2hex.c  |  72 
 samples/smp_svr/zephyr/CMakeLists.txt|   1 +
 14 files changed, 1 insertion(+), 658 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4225f3e..b88b4ac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,6 @@ add_library(MCUMGR INTERFACE)
 zephyr_library()
 add_subdirectory(cborattr)
 add_subdirectory(cmd)
-add_subdirectory(ext)
 add_subdirectory(mgmt)
 add_subdirectory(smp)
 
@@ -11,6 +10,5 @@ zephyr_library_link_libraries(MCUMGR)
 
 target_link_libraries(MCUMGR INTERFACE
   zephyr_interface
-  BASE64
   TINYCBOR
   )
diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt
deleted file mode 100644
index f453a03..000
--- a/ext/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_subdirectory(base64)
diff --git a/ext/base64/CMakeLists.txt b/ext/base64/CMakeLists.txt
deleted file mode 100644
index 101985e..000
--- a/ext/base64/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-add_library(BASE64 INTERFACE)
-
-target_include_directories(BASE64 INTERFACE src)
-
-zephyr_library()
-target_include_directories(BASE64 INTERFACE
-include
-port/zephyr/include
-)
-
-zephyr_library_sources(
-src/base64.c
-src/hex.c
-)
-
-zephyr_library_link_libraries(BASE64)
-target_link_libraries(BASE64 INTERFACE zephyr_interface)
diff --git a/ext/base64/include/base64/base64.h 
b/ext/base64/include/base64/base64.h
deleted file mode 100644
index 53c4853..000
--- a/ext/base64/include/base64/base64.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-#ifndef __UTIL_BASE64_H
-#define __UTIL_BASE64_H
-
-#include 
-#include 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int base64_encode(const void *, int, char *, uint8_t);
-int base64_decode(const char *, void *buf);
-int base64_pad(char *, int);
-int base64_decode_len(const char *str);
-
-#define BASE64_ENCODE_SIZE(__size) (__size) - 1) / 3) * 4) + 4)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __UTIL_BASE64_H__ */
diff --git a/ext/base64/include/base64/hex.h b/ext/base64/include/base64/hex.h
deleted file mode 100644
index 8ebae77..000
--- a/ext/base64/include/base64/hex.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-#ifndef _UTIL_HEX_H_
-#define _UTIL_HEX_H_
-
-#ifdef __cplusplus
-extern 

[mynewt-mcumgr] 34/42: mcumgr: Minor refactor to increase readability

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 02164de9691578ba653a5a7d3952f62e62599af9
Author: Sebastian Bøe 
AuthorDate: Mon Feb 12 12:32:37 2018 +0100

mcumgr: Minor refactor to increase readability

horizontal alignment improves readability and diff-ability.

Signed-off-by: Sebastian Bøe 
---
 CMakeLists.txt | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a88725a..4225f3e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,4 +9,8 @@ add_subdirectory(smp)
 
 zephyr_library_link_libraries(MCUMGR)
 
-target_link_libraries(MCUMGR INTERFACE zephyr_interface BASE64 TINYCBOR)
+target_link_libraries(MCUMGR INTERFACE
+  zephyr_interface
+  BASE64
+  TINYCBOR
+  )

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] branch master updated (44e3500 -> 9c30f4b)

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git.


 discard 44e3500  smp_svr (zephyr) - CONFIG_NET_BUF_USER_DATA_SIZE=7
 discard 785fe1a  Remove base64 library.
 discard 1aca722  Zephyr: use <> for non-relative include paths.
 discard 6e77227  smp_svr/CMakeLists.txt: remove FROM_WHO variable
 discard 75c5f1a  smp_svr/CMakeLists.txt: remove set_conf_file macro
 discard 9b45fbc  fs_mgmt - Surround macro definition with ().
 discard 821f578  Remove "zephyr,code_partition" from dts overlay
 discard 490f44f  Indicate units (bytes) in Kconfig help.
 discard 4a72306  mcumgr: Minor refactor to increase readability
 discard 80fc499  Readme.md: Fix bad links in file README.md
 discard e6dc5b6  smp_svr - Update zephyr port for compatibility.
 discard 4ab4db6  Zephyr port: move mcumgr location in zephyr.
 discard fec5444  zephyr img_mgmt: Use `FLASH_DEV_NAME`
 discard d69cfa3  Remove local tinycbor copy.
 discard e4db21b  Correct "MCUboot" spelling in documentation.
 discard ffdecf8  smp_svr - Use CONFIG_BOOTLOADER_MCUBOOT setting.
 discard e86e83f  smp_svr - Add statistics.
 discard 7bdec14  stat_mgmt command handler group.
 discard 980c924  smp_svr - fix build error when CONFIG_MDLOG unset.
 discard af277cf  smp_svr - Allow both CONFIG_FCB and CONFIG_FS_NFFS
 discard 4b601ef  Minor code cleanup.
 discard f43f1df  Add doxygen comments for log_mgmt.
 discard a6898ca  Update documentation.
 discard b5c74b5  smp_svr Mynewt sample app - Remove redundant dep.
 discard d9131d6  Add log_mgmt support to smp_svr sample app.
 discard afdb047  log_mgmt command handler group.
 discard 80e46f3  Reboot in system workqueue, not ISR.
 discard a4d9248  Fix some misnamed identifiers.
 discard 4df50f7  Add missing license text.
 discard ad113bc  Make MCUMGR_CMD_FS_MGMT depend on FILE_SYSTEM.
 discard db04a30  Remove extraneous README.rst file.
 discard 22bba90  Sample app - smp_svr
 discard 5515138  Documentation.
 discard 6974956  Mynewt support.
 discard cfe132e  Zephyr support.
 discard 1636f65  cborattr library
 discard 4355617  OS-agnostic command handlers: fs, img, os.
 discard 42b2816  External tinycbor library.
 discard 9417697  External base64 library.
 discard 63d47c1  smp - The built-in transfer encoding.
 discard b9e2cf8  mgmt - Code implementing the core `mgmt` layer.
 discard 9eee2c6  Initial commit.
 new 87ae256  Initial commit.
 new 612dc4f  mgmt - Code implementing the core `mgmt` layer.
 new 1950ce6  smp - The built-in transfer encoding.
 new 1db7199  External base64 library.
 new dce8b05  External tinycbor library.
 new 29e37f3  OS-agnostic command handlers: fs, img, os.
 new 06d963b  cborattr library
 new 9256a6a  Zephyr support.
 new 6e11ff8  Mynewt support.
 new 4c4c6de  Documentation.
 new 854e66b  Sample app - smp_svr
 new ae06525  Remove extraneous README.rst file.
 new 33ae61d  Make MCUMGR_CMD_FS_MGMT depend on FILE_SYSTEM.
 new 2f70bbc  Add missing license text.
 new 2f1953c  Fix some misnamed identifiers.
 new 3e895c3  Reboot in system workqueue, not ISR.
 new 2622b41  log_mgmt command handler group.
 new 0738644  Add log_mgmt support to smp_svr sample app.
 new be0aca3  smp_svr Mynewt sample app - Remove redundant dep.
 new 43da26e  Update documentation.
 new 6f7c931  Add doxygen comments for log_mgmt.
 new ad3d83a  Minor code cleanup.
 new 9092e06  smp_svr - Allow both CONFIG_FCB and CONFIG_FS_NFFS
 new 6e6e525  smp_svr - fix build error when CONFIG_MDLOG unset.
 new c182e11  stat_mgmt command handler group.
 new 0d01ec0  smp_svr - Add statistics.
 new 1be364d  smp_svr - Use CONFIG_BOOTLOADER_MCUBOOT setting.
 new ae76310  Correct "MCUboot" spelling in documentation.
 new 640853b  Remove local tinycbor copy.
 new 93f9223  zephyr img_mgmt: Use `FLASH_DEV_NAME`
 new 374e8e8  Zephyr port: move mcumgr location in zephyr.
 new add6e0e  smp_svr - Update zephyr port for compatibility.
 new 0ccac7e  Readme.md: Fix bad links in file README.md
 new 02164de  mcumgr: Minor refactor to increase readability
 new d25c44c  Indicate units (bytes) in Kconfig help.
 new eacfbcc  Remove "zephyr,code_partition" from dts overlay
 new 9c708eb  fs_mgmt - Surround macro definition with ().
 new 3297b8e  smp_svr/CMakeLists.txt: remove set_conf_file macro
 new 5ee473d  smp_svr/CMakeLists.txt: remove FROM_WHO variable
 new aa6d6ca  Zephyr: use <> for non-relative include paths.
 new 2410e54  Remove base64 library.
 new 9c30f4b  smp_svr (zephyr) - CONFIG_NET_BUF_USER_DATA_SIZE=7

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing 

[mynewt-mcumgr] 09/42: Mynewt support.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 6e11ff85f1d9fad2da48f2fbe6a0ee4a188a4a41
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:15:59 2018 -0800

Mynewt support.
---
 cmd/fs_mgmt/pkg.yml|  27 
 cmd/fs_mgmt/port/mynewt/src/mynewt_fs_mgmt.c   | 106 
 cmd/fs_mgmt/syscfg.yml |  40 +
 cmd/img_mgmt/pkg.yml   |  30 
 cmd/img_mgmt/port/mynewt/src/mynewt_img_mgmt.c | 214 +
 cmd/img_mgmt/syscfg.yml|  26 +++
 cmd/os_mgmt/pkg.yml|  27 
 cmd/os_mgmt/port/mynewt/src/mynewt_os_mgmt.c   | 116 ++
 cmd/os_mgmt/syscfg.yml |  26 +++
 repository.yml |  25 +++
 10 files changed, 637 insertions(+)

diff --git a/cmd/fs_mgmt/pkg.yml b/cmd/fs_mgmt/pkg.yml
new file mode 100644
index 000..9452cc6
--- /dev/null
+++ b/cmd/fs_mgmt/pkg.yml
@@ -0,0 +1,27 @@
+#
+# 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: cmd/fs_mgmt
+pkg.description: 'File system command handlers for mcumgr.'
+pkg.author: "Apache Mynewt "
+pkg.homepage: "http://mynewt.apache.org/;
+pkg.keywords:
+
+pkg.deps:
+- '@apache-mynewt-core/fs/fs'
diff --git a/cmd/fs_mgmt/port/mynewt/src/mynewt_fs_mgmt.c 
b/cmd/fs_mgmt/port/mynewt/src/mynewt_fs_mgmt.c
new file mode 100644
index 000..632bd1e
--- /dev/null
+++ b/cmd/fs_mgmt/port/mynewt/src/mynewt_fs_mgmt.c
@@ -0,0 +1,106 @@
+/*
+ * 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 "mgmt/mgmt.h"
+#include "fs_mgmt/fs_mgmt_impl.h"
+#include "fs/fs.h"
+
+int
+fs_mgmt_impl_filelen(const char *path, size_t *out_len)
+{
+struct fs_file *file;
+int rc;
+
+rc = fs_open(path, FS_ACCESS_READ, );
+if (rc != 0) {
+return MGMT_ERR_EUNKNOWN;
+}
+
+rc = fs_filelen(file, _len);
+fs_close(file);
+if (rc != 0) {
+return MGMT_ERR_EUNKNOWN;
+}
+
+return 0;
+}
+
+int
+fs_mgmt_impl_read(const char *path, size_t offset, size_t len,
+  void *out_data, size_t *out_len)
+{
+struct fs_file *file;
+uint32_t bytes_read;
+int rc;
+
+rc = fs_open(path, FS_ACCESS_READ, );
+if (rc != 0) {
+return MGMT_ERR_EUNKNOWN;
+}
+
+rc = fs_seek(file, offset);
+if (rc != 0) {
+goto done;
+}
+
+rc = fs_read(file, len, file_data, _read);
+if (rc != 0) {
+goto done;
+}
+
+*out_len = bytes_read;
+
+done:
+fs_close(file);
+
+if (rc != 0) {
+return MGMT_ERR_EUNKNOWN;
+}
+
+return 0;
+}
+
+int
+fs_mgmt_impl_write(const char *path, size_t offset, const void *data,
+   size_t len)
+{
+struct fs_file *file;
+uint8_t access;
+int rc;
+ 
+access = FS_ACCESS_WRITE;
+if (offset == 0) {
+access |= FS_ACCESS_TRUNCATE;
+} else {
+access |= FS_ACCESS_APPEND;
+}
+
+rc = fs_open(path, access, );
+if (rc != 0) {
+return MGMT_ERR_EUNKNOWN;
+}
+
+rc = fs_write(file, data, len);
+fs_close(file);
+if (rc != 0) {
+return MGMT_ERR_EUNKNOWN;
+}
+
+return 0;
+}
diff --git a/cmd/fs_mgmt/syscfg.yml b/cmd/fs_mgmt/syscfg.yml
new file mode 100644
index 

[mynewt-mcumgr] 21/42: Add doxygen comments for log_mgmt.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 6f7c931eeaf42eb67f3b729ebfb8000a784267aa
Author: Christopher Collins 
AuthorDate: Tue Jan 30 11:40:38 2018 -0800

Add doxygen comments for log_mgmt.
---
 cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h | 72 +++
 1 file changed, 72 insertions(+)

diff --git a/cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h 
b/cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h
index 1890643..b3f6b12 100644
--- a/cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h
+++ b/cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h
@@ -17,6 +17,13 @@
  * under the License.
  */
 
+/**
+ * @file
+ * @brief Declares implementation-specific functions required by log
+ *management.  The default stubs can be overridden with functions that
+ *are compatible with the host OS.
+ */
+
 #ifndef H_LOG_MGMT_IMPL_
 #define H_LOG_MGMT_IMPL_
 
@@ -31,14 +38,79 @@ struct log_mgmt_log;
 typedef int log_mgmt_foreach_entry_fn(const struct log_mgmt_entry *entry,
   void *arg);
 
+/**
+ * @brief Retrieves the log at the specified index.
+ *
+ * @param idx   The index of the log to retrieve.
+ * @param out_name  On success, the requested log gets written
+ *   here.
+ *
+ * @return  0 on success;
+ *  MGMT_ERR_ENOENT if no log with the specified
+ *  index exists;
+ *  Other MGMT_ERR_[...] code on failure.
+ */
 int log_mgmt_impl_get_log(int idx, struct log_mgmt_log *out_log);
+
+/**
+ * @brief Retrieves the name of log module at the specified index.
+ *
+ * @param idx   The index of the log module to retrieve.
+ * @param out_name  On success, the requested module's name gets
+ *  written here.
+ *
+ * @return  0 on success;
+ *  MGMT_ERR_ENOENT if no log module with the
+ *  specified index exists;
+ *  Other MGMT_ERR_[...] code on failure.
+ */
 int log_mgmt_impl_get_module(int idx, const char **out_module_name);
+
+/**
+ * @brief Retrieves the name of log level at the specified index.
+ *
+ * @param idx   The index of the log level to retrieve.
+ * @param out_name  On success, the requested level's name gets
+ *  written here.
+ *
+ * @return  0 on success;
+ *  MGMT_ERR_ENOENT if no log level with the
+ *  specified index exists;
+ *  Other MGMT_ERR_[...] code on failure.
+ */
 int log_mgmt_impl_get_level(int idx, const char **out_level_name);
+
+/**
+ * @brief Retrieves the index that the next log entry will use.
+ *
+ * @param out_idx   On success, the next index gets written here.
+ *
+ * @return  0 on success; MGMT_ERR_[...] code on failure.
+ */
 int log_mgmt_impl_get_next_idx(uint32_t *out_idx);
+
+/**
+ * @brief Applies a function to every matching entry in the specified log.
+ *
+ * @param log_name  The name of the log to operate on.
+ * @param filterSpecifies which log entries to operate on.
+ * @param cbThe callback to apply to each log entry.
+ * @param arg   An optional argument to pass to the callback.
+ *
+ * @return  0 on success; MGMT_ERR_[...] code on failure.
+ */
 int log_mgmt_impl_foreach_entry(const char *log_name,
 const struct log_mgmt_filter *filter,
 log_mgmt_foreach_entry_fn *cb,
 void *arg);
+
+/**
+ * @brief Clear the log with the specified name.
+ *
+ * @param log_name  The name of the log to clear.
+ *
+ * @return  0 on success; MGMT_ERR_[...] code on failure.
+ */
 int log_mgmt_impl_clear(const char *log_name);
 
 #ifdef __cplusplus

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 33/42: Readme.md: Fix bad links in file README.md

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 0ccac7e35ae0ea7fd65ce27224310537b309a52b
Author: Ding Tao 
AuthorDate: Fri Feb 9 17:39:54 2018 +0800

Readme.md: Fix bad links in file README.md

Replace "mcumgr" with "mynewt-mcumgr".

Signed-off-by: Ding Tao 
---
 README.md | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index 4726883..cad3514 100644
--- a/README.md
+++ b/README.md
@@ -124,12 +124,12 @@ Information and documentation for mcumgr is stored within 
the source.
 
 For more information in the source, here are some pointers:
 
-- [cborattr](https://github.com/apache/mcumgr/tree/master/cborattr): Used for 
parsing incoming mcumgr requests.  Destructures mcumgr packets and populates 
corresponding field variables.
-- [cmd](https://github.com/apache/mcumgr/tree/master/cmd): Built-in command 
handlers for the core mcumgr commands.
-- [ext](https://github.com/apache/mcumgr/tree/master/ext): Third-party 
libraries that mcumgr depends on.
-- [mgmt](https://github.com/apache/mcumgr/tree/master/mgmt): Code implementing 
the `mgmt` layer of mcumgr.
-- [samples](https://github.com/apache/mcumgr/tree/master/samples): Sample 
applications utilizing mcumgr.
-- [smp](https://github.com/apache/mcumgr/tree/master/smp): The built-in 
transfer encoding: Simple management protocol.
+- [cborattr](https://github.com/apache/mynewt-mcumgr/tree/master/cborattr): 
Used for parsing incoming mcumgr requests.  Destructures mcumgr packets and 
populates corresponding field variables.
+- [cmd](https://github.com/apache/mynewt-mcumgr/tree/master/cmd): Built-in 
command handlers for the core mcumgr commands.
+- [ext](https://github.com/apache/mynewt-mcumgr/tree/master/ext): Third-party 
libraries that mcumgr depends on.
+- [mgmt](https://github.com/apache/mynewt-mcumgr/tree/master/mgmt): Code 
implementing the `mgmt` layer of mcumgr.
+- [samples](https://github.com/apache/mynewt-mcumgr/tree/master/samples): 
Sample applications utilizing mcumgr.
+- [smp](https://github.com/apache/mynewt-mcumgr/tree/master/smp): The built-in 
transfer encoding: Simple management protocol.
 
 ## Joining
 

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 15/42: Fix some misnamed identifiers.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 2f1953caea2d4ed18478540a4db1faf27ab85e45
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:46:06 2018 -0800

Fix some misnamed identifiers.
---
 cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c | 35 +-
 mgmt/include/mgmt/mgmt.h   | 16 ++--
 mgmt/src/mgmt.c| 14 +--
 3 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c 
b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
index dc71d8f..e17952b 100644
--- a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
+++ b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
@@ -29,14 +29,14 @@
 #include "img_mgmt/img_mgmt.h"
 #include "../../../src/img_mgmt_priv.h"
 
-static struct device *zephyr_img_flash_dev;
-static struct flash_img_context zephyr_img_flash_ctxt;
+static struct device *zephyr_img_mgmt_flash_dev;
+static struct flash_img_context zephyr_img_mgmt_flash_ctxt;
 
 /**
  * Determines if the specified area of flash is completely unwritten.
  */
 static int
-img_mgmt_impl_flash_check_empty(off_t offset, size_t size, bool *out_empty)
+zephyr_img_mgmt_flash_check_empty(off_t offset, size_t size, bool *out_empty)
 {
 uint32_t data[16];
 off_t addr;
@@ -55,7 +55,7 @@ img_mgmt_impl_flash_check_empty(off_t offset, size_t size, 
bool *out_empty)
 bytes_to_read = sizeof data;
 }
 
-rc = flash_read(zephyr_img_flash_dev, addr, data, bytes_to_read);
+rc = flash_read(zephyr_img_mgmt_flash_dev, addr, data, bytes_to_read);
 if (rc != 0) {
 return MGMT_ERR_EUNKNOWN;
 }
@@ -76,7 +76,7 @@ img_mgmt_impl_flash_check_empty(off_t offset, size_t size, 
bool *out_empty)
  * Converts an offset within an image slot to an absolute address.
  */
 static off_t
-img_mgmt_impl_abs_offset(int slot, off_t sub_offset)
+zephyr_img_mgmt_abs_offset(int slot, off_t sub_offset)
 {
 off_t slot_start;
 
@@ -104,9 +104,9 @@ img_mgmt_impl_erase_slot(void)
 bool empty;
 int rc;
 
-rc = img_mgmt_impl_flash_check_empty(FLASH_AREA_IMAGE_1_OFFSET,
- FLASH_AREA_IMAGE_1_SIZE,
- );
+rc = zephyr_img_mgmt_flash_check_empty(FLASH_AREA_IMAGE_1_OFFSET,
+   FLASH_AREA_IMAGE_1_SIZE,
+   );
 if (rc != 0) {
 return MGMT_ERR_EUNKNOWN;
 }
@@ -158,8 +158,8 @@ img_mgmt_impl_read(int slot, unsigned int offset, void *dst,
 off_t abs_offset;
 int rc;
 
-abs_offset = img_mgmt_impl_abs_offset(slot, offset);
-rc = flash_read(zephyr_img_flash_dev, abs_offset, dst, num_bytes);
+abs_offset = zephyr_img_mgmt_abs_offset(slot, offset);
+rc = flash_read(zephyr_img_mgmt_flash_dev, abs_offset, dst, num_bytes);
 if (rc != 0) {
 return MGMT_ERR_EUNKNOWN;
 }
@@ -174,18 +174,19 @@ img_mgmt_impl_write_image_data(unsigned int offset, const 
void *data,
 int rc;
 
 if (offset == 0) {
-flash_img_init(_img_flash_ctxt, zephyr_img_flash_dev);
+flash_img_init(_img_mgmt_flash_ctxt, zephyr_img_mgmt_flash_dev);
 }
 
 /* Cast away const. */
-rc = flash_img_buffered_write(_img_flash_ctxt, (void *)data,
+rc = flash_img_buffered_write(_img_mgmt_flash_ctxt, (void *)data,
   num_bytes, false);
 if (rc != 0) {
 return MGMT_ERR_EUNKNOWN;
 }
 
 if (last) {
-rc = flash_img_buffered_write(_img_flash_ctxt, NULL, 0, true);
+rc = flash_img_buffered_write(_img_mgmt_flash_ctxt,
+  NULL, 0, true);
 if (rc != 0) {
 return MGMT_ERR_EUNKNOWN;
 }
@@ -213,15 +214,15 @@ img_mgmt_impl_swap_type(void)
 }
 
 static int
-img_mgmt_impl_init(struct device *dev)
+zephyr_img_mgmt_init(struct device *dev)
 {
 ARG_UNUSED(dev);
 
-zephyr_img_flash_dev = device_get_binding(FLASH_DRIVER_NAME);
-if (zephyr_img_flash_dev == NULL) {
+zephyr_img_mgmt_flash_dev = device_get_binding(FLASH_DRIVER_NAME);
+if (zephyr_img_mgmt_flash_dev == NULL) {
 return -ENODEV;
 }
 return 0;
 }
 
-SYS_INIT(img_mgmt_impl_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
+SYS_INIT(zephyr_img_mgmt_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
diff --git a/mgmt/include/mgmt/mgmt.h b/mgmt/include/mgmt/mgmt.h
index 549fcdc..2762aa8 100644
--- a/mgmt/include/mgmt/mgmt.h
+++ b/mgmt/include/mgmt/mgmt.h
@@ -41,7 +41,7 @@ extern "C" {
 #define MGMT_GROUP_ID_IMAGE 1
 #define MGMT_GROUP_ID_STATS 2
 #define MGMT_GROUP_ID_CONFIG3
-#define MGMT_GROUP_ID_LOGS  4
+#define MGMT_GROUP_ID_LOG   4
 #define MGMT_GROUP_ID_CRASH 5
 #define 

[mynewt-mcumgr] 06/42: OS-agnostic command handlers: fs, img, os.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 29e37f3760c88e3925ee7c07f95b51cff22dba6c
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:12:52 2018 -0800

OS-agnostic command handlers: fs, img, os.
---
 cmd/fs_mgmt/include/fs_mgmt/fs_mgmt.h |  41 +++
 cmd/fs_mgmt/include/fs_mgmt/fs_mgmt_impl.h|  77 +
 cmd/fs_mgmt/src/fs_mgmt.c | 250 
 cmd/fs_mgmt/src/fs_mgmt_config.h  |  26 ++
 cmd/fs_mgmt/src/stubs.c   |  46 +++
 cmd/img_mgmt/include/img_mgmt/image.h |  82 ++
 cmd/img_mgmt/include/img_mgmt/img_mgmt.h  |  49 
 cmd/img_mgmt/include/img_mgmt/img_mgmt_impl.h | 107 +++
 cmd/img_mgmt/src/img_mgmt.c   | 400 ++
 cmd/img_mgmt/src/img_mgmt_config.h|  22 ++
 cmd/img_mgmt/src/img_mgmt_priv.h  |  96 +++
 cmd/img_mgmt/src/img_mgmt_state.c | 315 
 cmd/img_mgmt/src/img_mgmt_util.c  |  39 +++
 cmd/img_mgmt/src/stubs.c  |  64 +
 cmd/os_mgmt/include/os_mgmt/os_mgmt.h |  64 +
 cmd/os_mgmt/include/os_mgmt/os_mgmt_impl.h|  62 
 cmd/os_mgmt/src/os_mgmt.c | 190 
 cmd/os_mgmt/src/os_mgmt_config.h  |  22 ++
 cmd/os_mgmt/src/stubs.c   |  38 +++
 19 files changed, 1990 insertions(+)

diff --git a/cmd/fs_mgmt/include/fs_mgmt/fs_mgmt.h 
b/cmd/fs_mgmt/include/fs_mgmt/fs_mgmt.h
new file mode 100644
index 000..38173fd
--- /dev/null
+++ b/cmd/fs_mgmt/include/fs_mgmt/fs_mgmt.h
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+#ifndef H_FS_MGMT_
+#define H_FS_MGMT_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Command IDs for file system management group.
+ */
+#define FS_MGMT_ID_FILE 0
+
+/**
+ * @brief Registers the file system management command handler group.
+ */ 
+void fs_mgmt_register_group(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/cmd/fs_mgmt/include/fs_mgmt/fs_mgmt_impl.h 
b/cmd/fs_mgmt/include/fs_mgmt/fs_mgmt_impl.h
new file mode 100644
index 000..3cb30b8
--- /dev/null
+++ b/cmd/fs_mgmt/include/fs_mgmt/fs_mgmt_impl.h
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+/**
+ * @file
+ * @brief Declares implementation-specific functions required by file system
+ *management.  The default stubs can be overridden with functions that
+ *are compatible with the host OS.
+ */
+
+#ifndef H_FS_MGMT_IMPL_
+#define H_FS_MGMT_IMPL_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Retrieves the length of the file at the specified path.
+ *
+ * @param path  The path of the file to query.
+ * @param out_len   On success, the file length gets written here.
+ *
+ * @return  0 on success, MGMT_ERR_[...] code on failure.
+ */
+int fs_mgmt_impl_filelen(const char *path, size_t *out_len);
+
+/**
+ * @brief Reads the specified chunk of file data.
+ *
+ * @param path  The path of the file to read from.
+ * @param offsetThe byte offset to read from.
+ * @param len   The number of bytes to read.
+ * @param out_data  On success, the 

[mynewt-mcumgr] 26/42: smp_svr - Add statistics.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 0d01ec0c209aa6e707b104076e95a47b21b53bab
Author: Christopher Collins 
AuthorDate: Tue Jan 30 12:17:43 2018 -0800

smp_svr - Add statistics.
---
 samples/smp_svr/zephyr/prj.conf   |  5 +
 samples/smp_svr/zephyr/src/main.c | 31 +++
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/samples/smp_svr/zephyr/prj.conf b/samples/smp_svr/zephyr/prj.conf
index 88ad795..5179c2c 100644
--- a/samples/smp_svr/zephyr/prj.conf
+++ b/samples/smp_svr/zephyr/prj.conf
@@ -39,11 +39,16 @@ CONFIG_REBOOT_LOG=y
 # Enable assertions.  Required for crash logging.
 CONFIG_ASSERT=y
 
+# Enable statistics and statistic names.
+CONFIG_STATS=y
+CONFIG_STATS_NAMES=y
+
 # Enable all core commands.
 CONFIG_MCUMGR_CMD_FS_MGMT=y
 CONFIG_MCUMGR_CMD_IMG_MGMT=y
 CONFIG_MCUMGR_CMD_LOG_MGMT=y
 CONFIG_MCUMGR_CMD_OS_MGMT=y
+CONFIG_MCUMGR_CMD_STAT_MGMT=y
 
 ### nRF5 specific settings
 
diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index 2906711..47e5de2 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -14,6 +14,7 @@
 #include "logging/mdlog.h"
 #include "logging/reboot_log.h"
 #include "fcb.h"
+#include "stats.h"
 #include "mgmt/smp_bt.h"
 #include "mgmt/buf.h"
 
@@ -29,13 +30,13 @@
 #ifdef CONFIG_MCUMGR_CMD_LOG_MGMT
 #include "log_mgmt/log_mgmt.h"
 #endif
+#ifdef CONFIG_MCUMGR_CMD_STAT_MGMT
+#include "stat_mgmt/stat_mgmt.h"
+#endif
 
 #define DEVICE_NAME CONFIG_BT_DEVICE_NAME
 #define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
 
-struct fcb smp_svr_fcb;
-struct mdlog smp_svr_log;
-
 /* smp_svr uses the first "peruser" log module. */
 #define SMP_SVR_MDLOG_MODULE  (MDLOG_MODULE_PERUSER + 0)
 
@@ -43,6 +44,21 @@ struct mdlog smp_svr_log;
 #define SMP_SVR_MDLOG(lvl, ...) \
 MDLOG_ ## lvl(_svr_log, SMP_SVR_MDLOG_MODULE, __VA_ARGS__)
 
+/* Define an example stats group; tracks seconds of uptime. */
+STATS_SECT_START(smp_svr_stats)
+STATS_SECT_ENTRY(ticks)
+STATS_SECT_END
+
+/* Assign a name to the `ticks` stat. */
+STATS_NAME_START(smp_svr_stats)
+STATS_NAME(smp_svr_stats, ticks)
+STATS_NAME_END(smp_svr_stats)
+
+/* Define an instance of the stats group. */
+STATS_SECT_DECL(smp_svr_stats) smp_svr_stats;
+
+struct fcb smp_svr_fcb;
+struct mdlog smp_svr_log;
 
 static const struct bt_data ad[] = {
 BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
@@ -158,6 +174,9 @@ void main(void)
 reboot_log_configure(_svr_log);
 #endif
 
+rc = STATS_INIT_AND_REG(smp_svr_stats, STATS_SIZE_32, "smp_svr_stats");
+assert(rc == 0);
+
 /* Register the built-in mcumgr command handlers. */
 #ifdef CONFIG_MCUMGR_CMD_FS_MGMT
 fs_mgmt_register_group();
@@ -171,6 +190,9 @@ void main(void)
 #ifdef CONFIG_MCUMGR_CMD_LOG_MGMT
 log_mgmt_register_group();
 #endif
+#ifdef CONFIG_MCUMGR_CMD_STAT_MGMT
+stat_mgmt_register_group();
+#endif
 
 /* Enable Bluetooth. */
 rc = bt_enable(bt_ready);
@@ -192,6 +214,7 @@ void main(void)
  * main thread idle while the mcumgr server runs.
  */
 while (1) {
-k_sleep(INT32_MAX);
+k_sleep(1000);
+STATS_INC(smp_svr_stats, ticks);
 }
 }

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 35/42: Indicate units (bytes) in Kconfig help.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit d25c44cbe3b3a180367637c4b9afd078a2cd477c
Author: Christopher Collins 
AuthorDate: Mon Feb 12 13:01:59 2018 -0800

Indicate units (bytes) in Kconfig help.
---
 cmd/fs_mgmt/Kconfig   | 15 ---
 cmd/img_mgmt/Kconfig  |  5 +++--
 cmd/log_mgmt/Kconfig  | 20 ++--
 cmd/stat_mgmt/Kconfig |  8 
 4 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/cmd/fs_mgmt/Kconfig b/cmd/fs_mgmt/Kconfig
index 03157b0..ccbcf17 100644
--- a/cmd/fs_mgmt/Kconfig
+++ b/cmd/fs_mgmt/Kconfig
@@ -29,23 +29,24 @@ config FS_MGMT_UL_CHUNK_SIZE
 prompt "Maximum chunk size for file uploads"
 default 512
 help
-  Limits the maximum chunk size in file uploads.  A buffer of this size
-  gets allocated on the stack during handling of a file upload command.
+  Limits the maximum chunk size for file uploads, in bytes.  A buffer of
+  this size gets allocated on the stack during handling of a file upload 
command.
 
 config FS_MGMT_DL_CHUNK_SIZE
 int
 prompt "Maximum chunk size for file downloads"
 default 512
 help
-  Limits the maximum chunk size in file downloads.  A buffer of this size
-  gets allocated on the stack during handling of a file download command.
+  Limits the maximum chunk size for file downloads, in bytes.  A buffer of
+  this size gets allocated on the stack during handling of a file download
+  command.
 
 config FS_MGMT_PATH_SIZE
 int
 prompt "Maximum file path length"
 default 64
 help
-  Limits the maximum path length in file operations.  A buffer of this size
-  gets allocated on the stack during handling of file upload and download
-  commands.
+  Limits the maximum path length for file operations, in bytes.  A buffer
+  of this size gets allocated on the stack during handling of file upload
+  and download commands.
 endif
diff --git a/cmd/img_mgmt/Kconfig b/cmd/img_mgmt/Kconfig
index 2ac6c61..f8072b8 100644
--- a/cmd/img_mgmt/Kconfig
+++ b/cmd/img_mgmt/Kconfig
@@ -33,6 +33,7 @@ config IMG_MGMT_UL_CHUNK_SIZE
 prompt "Maximum chunk size for image uploads"
 default 512
 help
-  Limits the maximum chunk size in image uploads.  A buffer of this size
-  gets allocated on the stack during handling of a image upload command.
+  Limits the maximum chunk size for image uploads, in bytes.  A buffer of
+  this size gets allocated on the stack during handling of a image upload
+  command.
 endif
diff --git a/cmd/log_mgmt/Kconfig b/cmd/log_mgmt/Kconfig
index 8b43166..9373571 100644
--- a/cmd/log_mgmt/Kconfig
+++ b/cmd/log_mgmt/Kconfig
@@ -29,26 +29,26 @@ config LOG_MGMT_CHUNK_SIZE
 prompt "Maximum chunk size for log downloads"
 default 512
 help
-  Limits the maximum chunk size in log downloads.  A buffer of this size
-  gets allocated on the stack during handling of the log show command.
+  Limits the maximum chunk size for log downloads, in bytes.  A buffer of
+  this size gets allocated on the stack during handling of the log show 
command.
 
 config LOG_MGMT_NAME_LEN
 int
 prompt "Maximum log name length"
 default 64
 help
-  Limits the maximum length of log names.  If a log's name length exceeds
-  this number, it gets truncated in management responses.  A buffer of this
-  size gets allocated on the stack during handling of all log management
-  commands.
+  Limits the maximum length of log names, in bytes.  If a log's name length
+  exceeds this number, it gets truncated in management responses.  A buffer
+  of this size gets allocated on the stack during handling of all log
+  management commands.
 
 config LOG_MGMT_BODY_LEN
 int
 prompt "Maximum log body length"
 default 128
 help
-  Limits the maximum length of log entry bodies.  If a log entry's body
-  length exceeds this number, it gets truncated in management responses.  A
-  buffer of this size gets allocated on the stack during handling of the
-  log show command.
+  Limits the maximum length of log entry bodies, in bytes.  If a log
+  entry's body length exceeds this number, it gets truncated in management
+  responses.  A buffer of this size gets allocated on the stack during
+  handling of the log show command.
 endif
diff --git a/cmd/stat_mgmt/Kconfig b/cmd/stat_mgmt/Kconfig
index ffda20f..3688ed1 100644
--- a/cmd/stat_mgmt/Kconfig
+++ b/cmd/stat_mgmt/Kconfig
@@ -29,8 +29,8 @@ config STAT_MGMT_MAX_NAME_LEN
 prompt "Maximum stat group name length"
 default 32
 help
-  Limits the maximum stat group name length in mcumgr requests.  A buffer
-  of this size gets allocated on the stack during handling of all stat read
-  commands.  If a 

[mynewt-mcumgr] 10/42: Documentation.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 4c4c6de3a6c5e65c95f436c7ec4d0140
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:16:10 2018 -0800

Documentation.
---
 README.md  | 126 -
 transport/smp-bluetooth.md |  50 ++
 transport/smp-console.md   |  56 
 3 files changed, 231 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 3a9710e..12141dc 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,125 @@
-# mynewt-mcumgr
+# mcumgr
+
+This is mcumgr, version 0.0.1
+
+mcumgr is a management library for 32-bit MCUs.   The goal of mcumgr is to
+define a common management infrastructure with pluggable transport and encoding
+components.  In addition, mcumgr provides definitions and handlers for some
+core commands: image management, file system management, and OS managment.
+
+mcumgr is operating system and hardware independent.  It relies on hardware
+porting layers from the operating system it runs on.  Currently, mcumgr runs on
+both the Apache Mynewt and Zephyr operating systems.
+
+## Command line tool
+
+The `mcumgr` command line tool is available at:
+https://github.com/apache/mynewt-mcumgr-cli.  The tool is written in Go, and it
+is installed with the `go get` command:
+
+```
+$ go get github.com/apache/mynewt-mcumgr-cli/mcumgr
+```
+
+The `mcumgr` tool allows you to manage devices running an mcumgr server.
+
+## Architecture
+
+The mcumgr stack has the following layout:
+
+```
++-+-+
+| |
++-+-+
+|   mgmt|
++-+-+
+| |
++-+-+
+|     |
++-+-+
+```
+
+Items enclosed in angled brackets represent generic components that can be 
plugged into mcumgr.  The items in this stack diagram are defined below:
+* *Command handler*: Processes incoming mcumgr requests and generates 
corresponding responses.  A command handler is associated with a single command 
type, defined by a (group ID, command ID) pair.
+* *mgmt*: The core of mcumgr; facilitates the passing of requests and 
responses between the generic command handlers and the concrete transports and 
transfer encodings.
+* *Transfer encoding*: Defines how mcumgr requests and responses are encoded 
on the wire.
+* *Transport*: Sends and receives mcumgr packets over a particular medium.
+
+Each transport is configured with a single transfer encoding.
+
+As an example, the sample application `smp_svr` uses the following components:
+
+* Command handlers:
+* Image management (`img_mgmt`)
+* File system management (`fs_mgmt`)
+* OS management (`os_mgmt`)
+* Transfer/Transports protocols:
+* SMP/Bluetooth
+* SMP/Shell
+
+yielding the following stack diagram:
+
+```
++--+--+-+
+|   img_mgmt   |   fs_mgmt|   os_mgmt   |
++--+--+-+
+|   mgmt|
++-+-+
+| SMP | SMP |
++-+-+
+|  Bluetooth  |Shell|
++-+-+
+```
+
+## Command definition
+
+An mcumgr request or response consists of the following two components:
+* mcumgr header
+* CBOR key-value map 
+
+How these two components are encoded and parsed depends on the transfer
+encoding used.
+
+The mcumgr header structure is defined in `mgmt/include/mgmt/mgmt.h` as
+`struct mgmt_hdr`.
+
+The contents of the CBOR key-value map are specified per command type.
+
+## Supported transfer encodings
+
+Mcumgr comes with one built-in transfer encoding: Simple Management Protocol 
(SMP).  SMP requests and responses have a very basic structure.  For details, 
see the comments at the top of `smp/include/smp/smp.h`.
+
+## Supported transports
+
+The mcumgr project defines two transports:
+* SMP/Console
+* SMP/Bluetooth
+
+Particulars of these transports are specified in the following documents:
+* SMP/Console: `transports/smp-console.md`
+* SMP/Bluetooth: `transports/smp-bluetooth.md`
+
+Implementations, being hardware- and OS-specified, are not included.
+
+## Browsing
+
+Information and documentation for mcumgr is stored within the source.
+
+For more information in the source, here are some pointers:
+
+- [cborattr](https://github.com/apache/mcumgr/tree/master/cborattr): Used for 
parsing incoming mcumgr requests.  Destructures mcumgr packets and populates 
corresponding field variables.
+- 

[mynewt-mcumgr] 16/42: Reboot in system workqueue, not ISR.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 3e895c3fb6b771d2d5599e9fcc131470d410a41c
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:47:32 2018 -0800

Reboot in system workqueue, not ISR.
---
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c 
b/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
index 221da97..df996a8 100644
--- a/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
+++ b/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
@@ -26,10 +26,13 @@
 #include "os_mgmt/os_mgmt_impl.h"
 
 static void zephyr_os_mgmt_reset_cb(struct k_timer *timer);
+static void zephyr_os_mgmt_reset_work_handler(struct k_work *work);
 
 static K_TIMER_DEFINE(zephyr_os_mgmt_reset_timer,
   zephyr_os_mgmt_reset_cb, NULL);
 
+K_WORK_DEFINE(zephyr_os_mgmt_reset_work, zephyr_os_mgmt_reset_work_handler);
+
 #ifdef CONFIG_THREAD_MONITOR
 static const struct k_thread *
 zephyr_os_mgmt_task_at(int idx)
@@ -72,11 +75,18 @@ os_mgmt_impl_task_info(int idx, struct os_mgmt_task_info 
*out_info)
 #endif /* CONFIG_THREAD_MONITOR */
 
 static void
-zephyr_os_mgmt_reset_cb(struct k_timer *timer)
+zephyr_os_mgmt_reset_work_handler(struct k_work *work)
 {
 sys_reboot(SYS_REBOOT_WARM);
 }
 
+static void
+zephyr_os_mgmt_reset_cb(struct k_timer *timer)
+{
+/* Reboot the system from the system workqueue thread. */
+k_work_submit(_os_mgmt_reset_work);
+}
+
 int
 os_mgmt_impl_reset(unsigned int delay_ms)
 {

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 03/42: smp - The built-in transfer encoding.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 1950ce67ecb83c8258da792f9df2ace2f85a3b50
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:11:12 2018 -0800

smp - The built-in transfer encoding.

Simple management protocol.
---
 smp/CMakeLists.txt|   7 +
 smp/include/smp/smp.h |  91 
 smp/pkg.yml   |  40 ++
 smp/src/smp.c | 379 ++
 4 files changed, 517 insertions(+)

diff --git a/smp/CMakeLists.txt b/smp/CMakeLists.txt
new file mode 100644
index 000..74072ab
--- /dev/null
+++ b/smp/CMakeLists.txt
@@ -0,0 +1,7 @@
+target_include_directories(MCUMGR INTERFACE 
+include
+)
+
+zephyr_library_sources(
+smp/src/smp.c
+)
diff --git a/smp/include/smp/smp.h b/smp/include/smp/smp.h
new file mode 100644
index 000..7afa7ad
--- /dev/null
+++ b/smp/include/smp/smp.h
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+/**
+ * @file
+ * @brief SMP - Simple Management Protocol.
+ *
+ * SMP is a basic protocol that sits on top of the mgmt layer.  SMP requests
+ * and responses have the following format:
+ *
+ * [Offset 0]: Mgmt header
+ * [Offset 8]: CBOR map of command-specific key-value pairs.
+ *
+ * SMP request packets may contain multiple concatenated requests.  Each
+ * request must start at an offset that is a multiple of 4, so padding should
+ * be inserted between requests as necessary.  Requests are processed
+ * sequentially from the start of the packet to the end.  Each response is sent
+ * individually in its own packet.  If a request elicits an error response,
+ * processing of the packet is aborted.
+ */
+
+#ifndef H_SMP_
+#define H_SMP_
+
+#include "mgmt/mgmt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct smp_streamer;
+struct mgmt_hdr;
+
+/** @typedef smp_tx_rsp_fn
+ * @brief Transmits an SMP response packet.
+ *
+ * @param ssThe streamer to transmit via.
+ * @param buf   Buffer containing the response packet.
+ * @param arg   Optional streamer argument.
+ *
+ * @return  0 on success, MGMT_ERR_[...] code on failure.
+ */
+typedef int smp_tx_rsp_fn(struct smp_streamer *ss, void *buf, void *arg);
+
+/**
+ * @brief Decodes, encodes, and transmits SMP packets.
+ */
+struct smp_streamer {
+struct mgmt_streamer mgmt_stmr;
+smp_tx_rsp_fn *tx_rsp_cb;
+};
+
+/**
+ * @brief Processes a single SMP request packet and sends all corresponding
+ *responses.
+ *
+ * Processes all SMP requests in an incoming packet.  Requests are processed
+ * sequentially from the start of the packet to the end.  Each response is sent
+ * individually in its own packet.  If a request elicits an error response,
+ * processing of the packet is aborted.  This function consumes the supplied
+ * request buffer regardless of the outcome.
+ *
+ * @param streamer  The streamer providing the required SMP
+ *  callbacks.
+ * @param req   The request packet to process.
+ *
+ * @return  0 on success, MGMT_ERR_[...] code on failure.
+ */
+int smp_process_request_packet(struct smp_streamer *streamer, void *req);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H_SMP_ */
diff --git a/smp/pkg.yml b/smp/pkg.yml
new file mode 100644
index 000..b9fcc78
--- /dev/null
+++ b/smp/pkg.yml
@@ -0,0 +1,40 @@
+#
+# 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 

[mynewt-mcumgr] 24/42: smp_svr - fix build error when CONFIG_MDLOG unset.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 6e6e52592b92b4008810d526b07ab772da0cd01e
Author: Christopher Collins 
AuthorDate: Tue Jan 30 12:07:25 2018 -0800

smp_svr - fix build error when CONFIG_MDLOG unset.
---
 samples/smp_svr/zephyr/src/main.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index 7f5e9e6..2906711 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -153,7 +153,10 @@ void main(void)
 
 rc = init_fcb();
 assert(rc == 0);
+
+#ifdef CONFIG_REBOOT_LOG
 reboot_log_configure(_svr_log);
+#endif
 
 /* Register the built-in mcumgr command handlers. */
 #ifdef CONFIG_MCUMGR_CMD_FS_MGMT
@@ -180,8 +183,10 @@ void main(void)
 /* Initialize the Bluetooth mcumgr transport. */
 smp_bt_register();
 
+#ifdef CONFIG_MDLOG
 mdlog_register("smp_svr", _svr_log, _fcb_handler, _svr_fcb,
MDLOG_LEVEL_DEBUG);
+#endif
 
 /* The system work queue handles all incoming mcumgr requests.  Let the
  * main thread idle while the mcumgr server runs.

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 20/42: Update documentation.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 43da26e004c1c5495cec544b688044c8cdd34e1c
Author: Christopher Collins 
AuthorDate: Fri Jan 26 17:58:38 2018 -0800

Update documentation.
---
 README-mynewt.md | 31 +++
 README-zephyr.md | 30 ++
 README.md| 29 +
 3 files changed, 82 insertions(+), 8 deletions(-)

diff --git a/README-mynewt.md b/README-mynewt.md
new file mode 100644
index 000..9e65ea8
--- /dev/null
+++ b/README-mynewt.md
@@ -0,0 +1,31 @@
+## Building and using mcumgr with Apache Mynewt
+
+NOTE: The *mcumgr* library consists of functionality that is already present in
+the `apache-mynewt-core` repo.  There is currently no need to use the external
+*mcumgr* library with Mynewt, as the functionality is already built in to the
+OS.  To use this library with a Mynewt application, you will need to remove the
+duplicate functionality from your copy of the `apache-mynewt-core` repo.
+
+### Configuration
+
+To use *mcumgr*, your Mynewt app needs to be configured to use:
+1. An mcumgr transfer encoding
+2. An mcumgr transport
+3. (optional) Command handlers.
+
+This is done by adding the necessary dependencies to your app or target.  The 
following list of dependencies adds support for the SMP transfer encoding, the 
Bluetooth and shell transports, and all the built-in command handlers:
+
+```
+- '@apache-mynewt-core/mgmt/newtmgr/transport/ble'
+- '@apache-mynewt-core/mgmt/newtmgr/transport/nmgr_shell'
+- '@mynewt-mcumgr/cmd/fs_mgmt'
+- '@mynewt-mcumgr/cmd/img_mgmt'
+- '@mynewt-mcumgr/cmd/os_mgmt'
+- '@mynewt-mcumgr/smp'
+```
+
+For an example of an app that uses mcumgr, see the `smp_svr` sample app in 
`samples/smp_svr/mynewt`.
+
+### Building
+
+With the necessary dependencies in place, your project can be built using the 
usual `newt build ` or `newt run `
diff --git a/README-zephyr.md b/README-zephyr.md
new file mode 100644
index 000..b808a2f
--- /dev/null
+++ b/README-zephyr.md
@@ -0,0 +1,30 @@
+## Building and using mcumgr with Zephyr
+
+### Configuration
+
+The `samples/smp_svr/zephyr/prj.conf` file provides a good starting point for
+configuring an application to use *mcumgr*.  The major configuration settings
+are described below:
+
+| Setting   | Description   | Default |
+| - | - | --- |
+| `CONFIG_MCUMGR` | Enable the mcumgr management library. | n |
+| `CONFIG_MCUMGR_CMD_FS_MGMT` | Enable mcumgr handlers for file management | n 
|
+| `CONFIG_MCUMGR_CMD_IMG_MGMT` | Enable mcumgr handlers for image management | 
n |
+| `CONFIG_MCUMGR_CMD_LOG_MGMT` | Enable mcumgr handlers for log management | n 
|
+| `CONFIG_MCUMGR_CMD_OS_MGMT` | Enable mcumgr handlers for OS management | n |
+
+### Building
+
+Your application must specify mcumgr as a link-time dependency.  This is done
+by adding the following to your application's `CMakeLists.txt` file:
+
+```
+zephyr_link_libraries(
+MCUMGR
+)
+```
+
+### Known issues
+
+If the Bluetooth stack runs out of ACL transmit buffers while a large mcumgr 
response is being sent, the buffers never get freed.  This appears to trigger a 
net_buf leak in the stack.
diff --git a/README.md b/README.md
index 12141dc..bbe0016 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,20 @@ mcumgr is operating system and hardware independent.  It 
relies on hardware
 porting layers from the operating system it runs on.  Currently, mcumgr runs on
 both the Apache Mynewt and Zephyr operating systems.
 
+## Getting started
+
+For tips on using mcumgr with your particular OS, see the appropriate file from
+the list below:
+
+* README-mynewt.md
+* README-zephyr.md
+
+## Dependencies
+
+To use mcumgr's image management support, your device must be running the
+MCUBoot boot loader (https://github.com/runtimeco/mcuboot).  The other mcumgr
+features do not require MCUboot.
+
 ## Command line tool
 
 The `mcumgr` command line tool is available at:
@@ -52,6 +66,7 @@ As an example, the sample application `smp_svr` uses the 
following components:
 * Command handlers:
 * Image management (`img_mgmt`)
 * File system management (`fs_mgmt`)
+* Log management (`log_mgmt`)
 * OS management (`os_mgmt`)
 * Transfer/Transports protocols:
 * SMP/Bluetooth
@@ -60,9 +75,9 @@ As an example, the sample application `smp_svr` uses the 
following components:
 yielding the following stack diagram:
 
 ```
-+--+--+-+
-|   img_mgmt   |   fs_mgmt|   os_mgmt   |
-+--+--+-+
++--+--+--+--+
+| img_mgmt |  fs_mgmt | log_mgmt |  os_mgmt |
++--+--+--+--+
 |   mgmt|
 +-+-+

[mynewt-mcumgr] 07/42: cborattr library

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 06d963b12f0ec3c9e747d107b6021473974d9105
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:13:14 2018 -0800

cborattr library

This is used for parsing incoming mcumgr requests.  Destructures mcumgr
packets and populates corresponding field variables.

This comes from Apache Mynewt.
---
 cborattr/CMakeLists.txt|   7 +
 cborattr/include/cborattr/cborattr.h   | 153 
 cborattr/pkg.yml   |  29 ++
 cborattr/src/cborattr.c| 423 +
 cborattr/syscfg.yml|  24 ++
 cborattr/test/pkg.yml  |  30 ++
 cborattr/test/src/test_cborattr.c  |  49 +++
 cborattr/test/src/test_cborattr.h  |  57 +++
 cborattr/test/src/test_cborattr_utils.c|  35 ++
 cborattr/test/src/testcases/cborattr_decode1.c |  83 
 .../src/testcases/cborattr_decode_bool_array.c | 101 +
 .../test/src/testcases/cborattr_decode_int_array.c | 143 +++
 .../test/src/testcases/cborattr_decode_obj_array.c | 109 ++
 .../test/src/testcases/cborattr_decode_object.c| 198 ++
 .../src/testcases/cborattr_decode_object_array.c   | 126 ++
 .../test/src/testcases/cborattr_decode_partial.c   |  47 +++
 .../test/src/testcases/cborattr_decode_simple.c| 123 ++
 .../src/testcases/cborattr_decode_string_array.c   | 135 +++
 .../src/testcases/cborattr_decode_substring_key.c  | 111 ++
 .../src/testcases/cborattr_decode_unnamed_array.c  |  99 +
 20 files changed, 2082 insertions(+)

diff --git a/cborattr/CMakeLists.txt b/cborattr/CMakeLists.txt
new file mode 100644
index 000..2f22bd0
--- /dev/null
+++ b/cborattr/CMakeLists.txt
@@ -0,0 +1,7 @@
+target_include_directories(MCUMGR INTERFACE 
+include
+)
+
+zephyr_library_sources(
+cborattr/src/cborattr.c
+)
diff --git a/cborattr/include/cborattr/cborattr.h 
b/cborattr/include/cborattr/cborattr.h
new file mode 100644
index 000..1cc14b3
--- /dev/null
+++ b/cborattr/include/cborattr/cborattr.h
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ */
+
+
+#ifndef CBORATTR_H
+#define CBORATTR_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "cbor.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* This library wraps the tinycbor decoder with a attribute based decoder
+ * suitable for decoding a binary version of json.  Specifically, the
+ * contents of the cbor contains pairs of attributes.  where the attribute
+ * is a key/value pair.  keys are always text strings, but values can be
+ * many different things (enumerated below) */
+
+typedef enum CborAttrType {
+CborAttrIntegerType = 1,
+CborAttrUnsignedIntegerType,
+CborAttrByteStringType,
+CborAttrTextStringType,
+CborAttrBooleanType,
+CborAttrFloatType,
+CborAttrDoubleType,
+CborAttrArrayType,
+CborAttrObjectType,
+CborAttrStructObjectType,
+CborAttrNullType,
+} CborAttrType;
+
+struct cbor_attr_t;
+
+struct cbor_enum_t {
+char *name;
+long long int value;
+};
+
+struct cbor_array_t {
+CborAttrType element_type;
+union {
+struct {
+const struct cbor_attr_t *subtype;
+char *base;
+size_t stride;
+} objects;
+struct {
+char **ptrs;
+char *store;
+int storelen;
+} strings;
+struct {
+long long int *store;
+} integers;
+struct {
+long long unsigned int *store;
+} uintegers;
+struct {
+double *store;
+} reals;
+struct {
+bool *store;
+} booleans;
+} arr;
+int *count;
+int maxlen;
+};
+
+struct cbor_attr_t {
+char *attribute;
+CborAttrType type;
+union {
+long long int *integer;
+long long unsigned int *uinteger;
+double *real;
+float *fval;
+

[mynewt-mcumgr] 17/42: log_mgmt command handler group.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 2622b41bfc82f66e89b5faea8abfb34959c3c86d
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:52:28 2018 -0800

log_mgmt command handler group.
---
 cmd/CMakeLists.txt |   1 +
 cmd/Kconfig|   1 +
 cmd/log_mgmt/CMakeLists.txt|   9 +
 cmd/log_mgmt/Kconfig   |  53 +++
 cmd/log_mgmt/include/log_mgmt/log_mgmt.h   |  83 +
 cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h  |  48 +++
 cmd/log_mgmt/port/mynewt/src/mynewt_log_mgmt.c | 206 +++
 cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c | 189 ++
 cmd/log_mgmt/src/log_mgmt.c| 494 +
 cmd/log_mgmt/src/log_mgmt_config.h |  45 +++
 cmd/log_mgmt/src/stubs.c   |  65 
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c   |   2 +
 12 files changed, 1196 insertions(+)

diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt
index bc91e2f..be26ded 100644
--- a/cmd/CMakeLists.txt
+++ b/cmd/CMakeLists.txt
@@ -1,3 +1,4 @@
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_FS_MGMT   fs_mgmt)
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_IMG_MGMT  img_mgmt)
+add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_LOG_MGMT  log_mgmt)
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_OS_MGMT   os_mgmt)
diff --git a/cmd/Kconfig b/cmd/Kconfig
index a0e2031..ea51804 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -19,6 +19,7 @@ menu "Command handlers"
 
 source "ext/mcumgr/cmd/fs_mgmt/Kconfig"
 source "ext/mcumgr/cmd/img_mgmt/Kconfig"
+source "ext/mcumgr/cmd/log_mgmt/Kconfig"
 source "ext/mcumgr/cmd/os_mgmt/Kconfig"
 
 endmenu
diff --git a/cmd/log_mgmt/CMakeLists.txt b/cmd/log_mgmt/CMakeLists.txt
new file mode 100644
index 000..7d72dcd
--- /dev/null
+++ b/cmd/log_mgmt/CMakeLists.txt
@@ -0,0 +1,9 @@
+target_include_directories(MCUMGR INTERFACE 
+include
+)
+
+zephyr_library_sources(
+cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c
+cmd/log_mgmt/src/log_mgmt.c
+cmd/log_mgmt/src/stubs.c
+)
diff --git a/cmd/log_mgmt/Kconfig b/cmd/log_mgmt/Kconfig
new file mode 100644
index 000..e949aa6
--- /dev/null
+++ b/cmd/log_mgmt/Kconfig
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE log
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this log
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this log 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.
+
+menuconfig MCUMGR_CMD_LOG_MGMT
+bool
+prompt "Enable mcumgr handlers for log management"
+default n
+help
+  Enables mcumgr handlers for log management
+
+if MCUMGR_CMD_LOG_MGMT
+config LOG_MGMT_CHUNK_SIZE
+int
+prompt "Maximum chunk size for log downloads"
+default 512
+help
+  Limits the maximum chunk size in log downloads.  A buffer of this size
+  gets allocated on the stack during handling of the log show command.
+
+config LOG_MGMT_NAME_LEN
+int
+prompt "Maximum log name length"
+default 64
+help
+  Limits the maximum length of log names.  If a log's name length exceeds
+  this number, it gets truncated in management responses.  A buffer of this
+  size gets allocated on the stack during handling of all log management
+  commands.
+
+config LOG_MGMT_BODY_LEN
+int
+prompt "Maximum log body length"
+default 128
+help
+  Limits the maximum length of log entry bodies.  If a log entry's body
+  length exceeds this number, it gets truncated in management responses.  A
+  buffer of this size gets allocated on the stack during handling of the
+  log show command.
+endif
diff --git a/cmd/log_mgmt/include/log_mgmt/log_mgmt.h 
b/cmd/log_mgmt/include/log_mgmt/log_mgmt.h
new file mode 100644
index 000..01df2e5
--- /dev/null
+++ b/cmd/log_mgmt/include/log_mgmt/log_mgmt.h
@@ -0,0 +1,83 @@
+/*
+ * 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 

[mynewt-mcumgr] 14/42: Add missing license text.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 2f70bbc61a4ff7f65ef4dd443b1cd034d977c6be
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:45:20 2018 -0800

Add missing license text.
---
 cmd/fs_mgmt/src/fs_mgmt_config.h   | 19 +++
 cmd/img_mgmt/src/img_mgmt_config.h | 19 +++
 cmd/os_mgmt/src/os_mgmt_config.h   | 19 +++
 3 files changed, 57 insertions(+)

diff --git a/cmd/fs_mgmt/src/fs_mgmt_config.h b/cmd/fs_mgmt/src/fs_mgmt_config.h
index 81fb7dd..deaec8a 100644
--- a/cmd/fs_mgmt/src/fs_mgmt_config.h
+++ b/cmd/fs_mgmt/src/fs_mgmt_config.h
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef H_FS_MGMT_CONFIG_
 #define H_FS_MGMT_CONFIG_
 
diff --git a/cmd/img_mgmt/src/img_mgmt_config.h 
b/cmd/img_mgmt/src/img_mgmt_config.h
index 4ec8295..a520372 100644
--- a/cmd/img_mgmt/src/img_mgmt_config.h
+++ b/cmd/img_mgmt/src/img_mgmt_config.h
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef H_IMG_MGMT_CONFIG_
 #define H_IMG_MGMT_CONFIG_
 
diff --git a/cmd/os_mgmt/src/os_mgmt_config.h b/cmd/os_mgmt/src/os_mgmt_config.h
index d388dec..fee386b 100644
--- a/cmd/os_mgmt/src/os_mgmt_config.h
+++ b/cmd/os_mgmt/src/os_mgmt_config.h
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef H_OS_MGMT_CONFIG_
 #define H_OS_MGMT_CONFIG_
 

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 04/42: External base64 library.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 1db71990f81342972b82c4cc4057ee00d09ca135
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:11:46 2018 -0800

External base64 library.
---
 ext/base64/CMakeLists.txt|  17 +++
 ext/base64/include/base64/base64.h   |  40 +++
 ext/base64/include/base64/hex.h  |  33 ++
 ext/base64/pkg.yml   |  26 +
 ext/base64/src/base64.c  | 181 +++
 ext/base64/src/hex.c | 101 +
 ext/base64/test/pkg.yml  |  30 +
 ext/base64/test/src/encoding_test.c  |  53 +
 ext/base64/test/src/encoding_test_priv.h |  38 +++
 ext/base64/test/src/testcases/hex2str.c  |  64 +++
 ext/base64/test/src/testcases/str2hex.c  |  72 
 11 files changed, 655 insertions(+)

diff --git a/ext/base64/CMakeLists.txt b/ext/base64/CMakeLists.txt
new file mode 100644
index 000..101985e
--- /dev/null
+++ b/ext/base64/CMakeLists.txt
@@ -0,0 +1,17 @@
+add_library(BASE64 INTERFACE)
+
+target_include_directories(BASE64 INTERFACE src)
+
+zephyr_library()
+target_include_directories(BASE64 INTERFACE
+include
+port/zephyr/include
+)
+
+zephyr_library_sources(
+src/base64.c
+src/hex.c
+)
+
+zephyr_library_link_libraries(BASE64)
+target_link_libraries(BASE64 INTERFACE zephyr_interface)
diff --git a/ext/base64/include/base64/base64.h 
b/ext/base64/include/base64/base64.h
new file mode 100644
index 000..53c4853
--- /dev/null
+++ b/ext/base64/include/base64/base64.h
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+#ifndef __UTIL_BASE64_H
+#define __UTIL_BASE64_H
+
+#include 
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int base64_encode(const void *, int, char *, uint8_t);
+int base64_decode(const char *, void *buf);
+int base64_pad(char *, int);
+int base64_decode_len(const char *str);
+
+#define BASE64_ENCODE_SIZE(__size) (__size) - 1) / 3) * 4) + 4)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UTIL_BASE64_H__ */
diff --git a/ext/base64/include/base64/hex.h b/ext/base64/include/base64/hex.h
new file mode 100644
index 000..8ebae77
--- /dev/null
+++ b/ext/base64/include/base64/hex.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+#ifndef _UTIL_HEX_H_
+#define _UTIL_HEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *hex_format(void *src_v, int src_len, char *dst, int dst_len);
+int hex_parse(const char *src, int src_len, void *dst_v, int dst_len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _UTIL_HEX_H_ */
diff --git a/ext/base64/pkg.yml b/ext/base64/pkg.yml
new file mode 100644
index 000..5ebb1b3
--- /dev/null
+++ b/ext/base64/pkg.yml
@@ -0,0 +1,26 @@
+#
+# 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 

[mynewt-mcumgr] 28/42: Correct "MCUboot" spelling in documentation.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit ae763105a7b3f183e4cc9b7679ef423f7f0b4abe
Author: Christopher Collins 
AuthorDate: Wed Jan 31 16:31:39 2018 -0800

Correct "MCUboot" spelling in documentation.

MCUBoot --> MCUboot.
---
 README.md | 2 +-
 samples/smp_svr/README.md | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index bbe0016..4726883 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ the list below:
 ## Dependencies
 
 To use mcumgr's image management support, your device must be running the
-MCUBoot boot loader (https://github.com/runtimeco/mcuboot).  The other mcumgr
+MCUboot boot loader (https://github.com/runtimeco/mcuboot).  The other mcumgr
 features do not require MCUboot.
 
 ## Command line tool
diff --git a/samples/smp_svr/README.md b/samples/smp_svr/README.md
index 6ff9dcd..5e99d83 100644
--- a/samples/smp_svr/README.md
+++ b/samples/smp_svr/README.md
@@ -50,7 +50,7 @@ the file system management commands will not work.  To enable 
file system
 management for a different platform, adjust the `CONFIG_FS_NFFS_FLASH_DEV_NAME`
 setting in `prj.conf` accordingly.
 
-In addition, the MCUBoot boot loader (https://github.com/runtimeco/mcuboot) is
+In addition, the MCUboot boot loader (https://github.com/runtimeco/mcuboot) is
 required for img_mgmt to function properly.
 
 The smp_svr app logs reboots to a flash circular buffer (FCB) backed log.  The

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 38/42: smp_svr/CMakeLists.txt: remove set_conf_file macro

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 3297b8ed3dc2a12b9826ee68d3f4b807874e6c12
Author: Christopher Collins 
AuthorDate: Mon Feb 12 13:17:22 2018 -0800

smp_svr/CMakeLists.txt: remove set_conf_file macro

This macro is unnecessary.  It was a leftover from the original
CMakeLists.txt file used as a template.
---
 samples/smp_svr/zephyr/CMakeLists.txt | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/samples/smp_svr/zephyr/CMakeLists.txt 
b/samples/smp_svr/zephyr/CMakeLists.txt
index b61b8ea..7765cb4 100644
--- a/samples/smp_svr/zephyr/CMakeLists.txt
+++ b/samples/smp_svr/zephyr/CMakeLists.txt
@@ -7,17 +7,6 @@
 # This provides a basic application structure suitable for communication using
 # mcumgr.  It can be used as a starting point for new applications.
 
-# The default top-level application configuration is prj.conf.  You can place
-# additional board-specific files in boards/${BOARD}.conf, and they will be
-# merged into the configuration along with prj.conf.
-macro(set_conf_file)
-  if(EXISTS ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf)
-set(CONF_FILE "prj.conf ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf")
-  else()
-set(CONF_FILE "prj.conf")
-  endif()
-endmacro()
-
 # Zephyr uses Device Tree (DT) to describe some board hardware configuration.
 #
 # See the Zephyr documentation for more information on DT:

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 42/42: smp_svr (zephyr) - CONFIG_NET_BUF_USER_DATA_SIZE=7

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 9c30f4b023f12061ebcff2e09045dbd42a49e14c
Author: Christopher Collins 
AuthorDate: Mon Feb 12 17:40:40 2018 -0800

smp_svr (zephyr) - CONFIG_NET_BUF_USER_DATA_SIZE=7

This setting is required by the updated net_buf API.  Failing to
configure this setting to a value >= 7 causes a static assert failure.
---
 samples/smp_svr/zephyr/prj.conf | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/samples/smp_svr/zephyr/prj.conf b/samples/smp_svr/zephyr/prj.conf
index 9e04c3c..42abc04 100644
--- a/samples/smp_svr/zephyr/prj.conf
+++ b/samples/smp_svr/zephyr/prj.conf
@@ -19,6 +19,9 @@ CONFIG_BT_RX_BUF_LEN=260
 CONFIG_MCUMGR_SMP_BT=y
 CONFIG_MCUMGR_SMP_SHELL=y
 
+# Bluetooth support requires a net_buf user_data size >= 7.
+CONFIG_NET_BUF_USER_DATA_SIZE=7
+
 # Enable flash operations.
 CONFIG_FLASH=y
 

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 12/42: Remove extraneous README.rst file.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit ae065255ef9c17a2efbf59089cd9f890b959eef1
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:44:11 2018 -0800

Remove extraneous README.rst file.

This file belongs to the "Hello World" sample app in the Zephyr
repository.
---
 samples/smp_svr/zephyr/README.rst | 41 ---
 1 file changed, 41 deletions(-)

diff --git a/samples/smp_svr/zephyr/README.rst 
b/samples/smp_svr/zephyr/README.rst
deleted file mode 100644
index 00218b0..000
--- a/samples/smp_svr/zephyr/README.rst
+++ /dev/null
@@ -1,41 +0,0 @@
-.. _hello_world:
-
-Hello World
-###
-
-Overview
-
-A simple Hello World example that can be used with any supported board and
-prints 'Hello World' to the console. This application can be built into modes:
-
-* single thread
-* multi threading
-
-Building and Running
-
-
-This project outputs 'Hello World' to the console.  It can be built and 
executed
-on QEMU as follows:
-
-.. zephyr-app-commands::
-   :zephyr-app: samples/hello_world
-   :board: qemu_x86
-   :goals: run
-   :compact:
-
-To build the single thread version, use the supplied configuration file for
-single thread: :file:`prj_single.conf`:
-
-.. zephyr-app-commands::
-   :zephyr-app: samples/hello_world
-   :board: qemu_x86
-   :conf: prj_single.conf
-   :goals: run
-   :compact:
-
-Sample Output
-=
-
-.. code-block:: console
-
-Hello World! x86

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 39/42: smp_svr/CMakeLists.txt: remove FROM_WHO variable

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 5ee473deedbd574f48b628a8c8a75f3147df835a
Author: Christopher Collins 
AuthorDate: Mon Feb 12 13:17:48 2018 -0800

smp_svr/CMakeLists.txt: remove FROM_WHO variable

This variable is unnecessary.  It was a leftover from the original
CMakeLists.txt file used as a template.
---
 samples/smp_svr/zephyr/CMakeLists.txt | 5 -
 1 file changed, 5 deletions(-)

diff --git a/samples/smp_svr/zephyr/CMakeLists.txt 
b/samples/smp_svr/zephyr/CMakeLists.txt
index 7765cb4..612b436 100644
--- a/samples/smp_svr/zephyr/CMakeLists.txt
+++ b/samples/smp_svr/zephyr/CMakeLists.txt
@@ -19,11 +19,6 @@ project(NONE)
 
 assert_exists(DTC_OVERLAY_FILE)
 
-# This string ends up getting printed in the device console
-if (NOT DEFINED FROM_WHO)
-  set(FROM_WHO Zephyr)
-endif()
-
 target_sources(app PRIVATE
 src/main.c
 )

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 40/42: Zephyr: use <> for non-relative include paths.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit aa6d6ca42658a3362004ef753554c508594facb9
Author: Christopher Collins 
AuthorDate: Mon Feb 12 13:18:22 2018 -0800

Zephyr: use <> for non-relative include paths.

For `#include` directives, Zephyr uses "" for paths relative to the
source file; <> for headers in an include path.
---
 cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c |  6 +++---
 cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c   |  6 +++---
 cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c   |  8 
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c |  8 
 cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c |  8 
 samples/smp_svr/zephyr/src/main.c| 12 ++--
 6 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c 
b/cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c
index 42b7d80..754d3c3 100644
--- a/cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c
+++ b/cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c
@@ -17,9 +17,9 @@
  * under the License.
  */
 
-#include "mgmt/mgmt.h"
-#include "fs_mgmt/fs_mgmt_impl.h"
-#include "fs.h"
+#include 
+#include 
+#include 
 
 int
 fs_mgmt_impl_filelen(const char *path, size_t *out_len)
diff --git a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c 
b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
index 143b1e0..8693451 100644
--- a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
+++ b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
@@ -24,9 +24,9 @@
 #include 
 #include 
 #include 
-#include "mgmt/mgmt.h"
-#include "img_mgmt/img_mgmt_impl.h"
-#include "img_mgmt/img_mgmt.h"
+#include 
+#include 
+#include 
 #include "../../../src/img_mgmt_priv.h"
 
 static struct device *zephyr_img_mgmt_flash_dev;
diff --git a/cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c 
b/cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c
index 41cf51e..378c3ea 100644
--- a/cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c
+++ b/cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c
@@ -18,10 +18,10 @@
  */
 
 #include 
-#include "logging/mdlog.h"
-#include "mgmt/mgmt.h"
-#include "log_mgmt/log_mgmt.h"
-#include "log_mgmt/log_mgmt_impl.h"
+#include 
+#include 
+#include 
+#include 
 #include "../../../src/log_mgmt_config.h"
 
 struct zephyr_log_mgmt_walk_arg {
diff --git a/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c 
b/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
index 20ee5a6..e127bdb 100644
--- a/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
+++ b/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
@@ -21,10 +21,10 @@
 #include 
 #include 
 #include 
-#include "logging/reboot_log.h"
-#include "mgmt/mgmt.h"
-#include "os_mgmt/os_mgmt.h"
-#include "os_mgmt/os_mgmt_impl.h"
+#include 
+#include 
+#include 
+#include 
 
 static void zephyr_os_mgmt_reset_cb(struct k_timer *timer);
 static void zephyr_os_mgmt_reset_work_handler(struct k_work *work);
diff --git a/cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c 
b/cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c
index dd0ba0b..22654f8 100644
--- a/cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c
+++ b/cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c
@@ -18,10 +18,10 @@
  */
 
 #include 
-#include "stats.h"
-#include "mgmt/mgmt.h"
-#include "stat_mgmt/stat_mgmt.h"
-#include "stat_mgmt/stat_mgmt_impl.h"
+#include 
+#include 
+#include 
+#include 
 
 struct zephyr_stat_mgmt_walk_arg {
 stat_mgmt_foreach_entry_fn *cb;
diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index 3e06e40..fde3f4e 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -11,12 +11,12 @@
 #include 
 #include 
 #include 
-#include "logging/mdlog.h"
-#include "logging/reboot_log.h"
-#include "fcb.h"
-#include "stats.h"
-#include "mgmt/smp_bt.h"
-#include "mgmt/buf.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #ifdef CONFIG_MCUMGR_CMD_FS_MGMT
 #include "fs_mgmt/fs_mgmt.h"

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 30/42: zephyr img_mgmt: Use `FLASH_DEV_NAME`

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 93f9223343b8475c96efefb8ecf0e5d5f52359ab
Author: Christopher Collins 
AuthorDate: Thu Feb 8 14:33:40 2018 -0800

zephyr img_mgmt: Use `FLASH_DEV_NAME`

This used to be `FLASH_DRIVER_NAME`, but it changed in zephyr.
---
 cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c 
b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
index e17952b..143b1e0 100644
--- a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
+++ b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
@@ -218,7 +218,7 @@ zephyr_img_mgmt_init(struct device *dev)
 {
 ARG_UNUSED(dev);
 
-zephyr_img_mgmt_flash_dev = device_get_binding(FLASH_DRIVER_NAME);
+zephyr_img_mgmt_flash_dev = device_get_binding(FLASH_DEV_NAME);
 if (zephyr_img_mgmt_flash_dev == NULL) {
 return -ENODEV;
 }

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 01/42: Initial commit.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 87ae256953d27d94b3886f6242e4a515947739d8
Author: Christopher Collins 
AuthorDate: Thu Dec 7 16:55:48 2017 -0800

Initial commit.
---
 .gitignore | 37 +
 README.md  |  1 +
 2 files changed, 38 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..91be3d8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,37 @@
+#
+# 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.
+#
+
+.app.db
+.app
+bin
+obj
+tags
+.gdb_history
+.gdb_out
+.gdb_cmds
+.gdbinit
+*~
+.DS_Store
+*.swp
+*.swo
+*.bak
+docs/html
+docs/latex
+cscope.*
+*.tags
diff --git a/README.md b/README.md
new file mode 100644
index 000..3a9710e
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# mynewt-mcumgr

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 11/42: Sample app - smp_svr

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 854e66b3540f33059cc4ff57fe171a7f4787e9e3
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:18:13 2018 -0800

Sample app - smp_svr
---
 samples/smp_svr/README.md |  64 +++
 samples/smp_svr/mynewt/pkg.yml|  43 +
 samples/smp_svr/mynewt/src/main.c | 320 ++
 samples/smp_svr/mynewt/syscfg.yml |  39 +
 samples/smp_svr/zephyr/CMakeLists.txt |  42 +
 samples/smp_svr/zephyr/README.rst |  41 +
 samples/smp_svr/zephyr/dts.overlay|  13 ++
 samples/smp_svr/zephyr/prj.conf   |  30 
 samples/smp_svr/zephyr/src/main.c | 108 
 9 files changed, 700 insertions(+)

diff --git a/samples/smp_svr/README.md b/samples/smp_svr/README.md
new file mode 100644
index 000..cb9d3e7
--- /dev/null
+++ b/samples/smp_svr/README.md
@@ -0,0 +1,64 @@
+# smp_svr
+
+This sample application implements a simple SMP server with the following
+transports:
+* Shell
+* Bluetooth
+
+`smp_svr` enables support for the following command groups:
+* fs_mgmt
+* img_mgmt
+* os_mgmt
+
+## Mynewt
+
+The Mynewt port of `smp_svr` is a regular Mynewt app.  The below example uses 
the nRF52dk as the BSP, so you may need to adjust accordingly if you are using 
different hardware.
+
+0. Create a Mynewt project and upload the Apache mynewt boot loader to your
+board as described here: http://mynewt.apache.org/latest/os/tutorials/nRF52/
+
+1. Add the mcumgr repo to your `project.yml` file:
+
+```
+repository.mynewt-mcumgr:
+type: git
+vers: 0-latest
+url: 'g...@github.com:apache/mynewt-mcumgr.git'
+```
+
+2. Create a target that ties the `smp_svr` app to your BSP of choice (nRF52dk 
in this example):
+
+```
+$ newt target create smp_svr-nrf52dk
+$ newt target set smp_svr-nrf52dk app=@mynewt-mcumgr/samples/smp_svr/apache \
+  bsp=@apache-mynewt-core/hw/bsp/nrf52dk\
+  build_profile=debug
+```
+
+3. Build, upload, and run the application on your board:
+
+```
+$ newt run smp_svr-nrf52dk
+```
+
+## Zephyr
+
+The Zephyr port of `smp_svr` is configured to run on an nRF52 MCU.  The
+application should build and run for other platforms without modification, but
+the file system management commands will not work.  To enable file system
+management for a different platform, adjust the `CONFIG_FS_NFFS_FLASH_DEV_NAME`
+setting in `prj.conf` accordingly.
+
+In addition, the MCUBoot boot loader (https://github.com/runtimeco/mcuboot) is
+required for img_mgmt to function properly.
+
+### Building
+
+The Zephyr port of `smp_svr` can be built using the usual procedure:
+
+```
+$ cd samples/smp_svr/zephyr
+$ mkdir build && cd build
+$ cmake -DBOARD= ..
+$ make
+```
diff --git a/samples/smp_svr/mynewt/pkg.yml b/samples/smp_svr/mynewt/pkg.yml
new file mode 100644
index 000..83d38d5
--- /dev/null
+++ b/samples/smp_svr/mynewt/pkg.yml
@@ -0,0 +1,43 @@
+# 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: samples/smp_svr/mynewt
+pkg.type: app
+pkg.description: Simple BLE peripheral running an mcumgr SMP server.
+pkg.author: "Apache Mynewt "
+pkg.homepage: "http://mynewt.apache.org/;
+pkg.keywords:
+
+pkg.deps: 
+- '@apache-mynewt-core/boot/bootutil'
+- '@apache-mynewt-core/mgmt/newtmgr/transport/ble'
+- '@apache-mynewt-core/mgmt/newtmgr/transport/nmgr_shell'
+- '@apache-mynewt-core/net/nimble/controller'
+- '@apache-mynewt-core/net/nimble/host'
+- '@apache-mynewt-core/net/nimble/host/services/ans'
+- '@apache-mynewt-core/net/nimble/host/services/gap'
+- '@apache-mynewt-core/net/nimble/host/services/gatt'
+- '@apache-mynewt-core/net/nimble/host/store/config'
+- '@apache-mynewt-core/net/nimble/transport/ram'
+- '@apache-mynewt-core/sys/console/full'
+- '@apache-mynewt-core/sys/log/full'
+- '@apache-mynewt-core/sys/stats/full'
+- '@mynewt-mcumgr/cmd/fs_mgmt'
+- '@mynewt-mcumgr/cmd/img_mgmt'
+- '@mynewt-mcumgr/cmd/os_mgmt'
+- 

[mynewt-mcumgr] 08/42: Zephyr support.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 9256a6adeb92c82809c97320c8d0de087abec18c
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:15:18 2018 -0800

Zephyr support.
---
 CMakeLists.txt |  12 ++
 Kconfig|  29 
 cmd/CMakeLists.txt |   3 +
 cmd/Kconfig|  24 +++
 cmd/fs_mgmt/CMakeLists.txt |   9 +
 cmd/fs_mgmt/Kconfig|  50 ++
 cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c   | 151 
 cmd/img_mgmt/CMakeLists.txt|  11 ++
 cmd/img_mgmt/Kconfig   |  38 +
 cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c | 227 +
 cmd/os_mgmt/CMakeLists.txt |   9 +
 cmd/os_mgmt/Kconfig|  35 
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c   |  85 +
 ext/CMakeLists.txt |   2 +
 14 files changed, 685 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 000..a88725a
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_library(MCUMGR INTERFACE)
+
+zephyr_library()
+add_subdirectory(cborattr)
+add_subdirectory(cmd)
+add_subdirectory(ext)
+add_subdirectory(mgmt)
+add_subdirectory(smp)
+
+zephyr_library_link_libraries(MCUMGR)
+
+target_link_libraries(MCUMGR INTERFACE zephyr_interface BASE64 TINYCBOR)
diff --git a/Kconfig b/Kconfig
new file mode 100644
index 000..fe04b1a
--- /dev/null
+++ b/Kconfig
@@ -0,0 +1,29 @@
+# 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.
+
+config MCUMGR
+bool
+prompt "mcumgr Support"
+select TINYCBOR
+default n
+help
+  This option enables the mcumgr management library.
+
+if MCUMGR
+source "ext/mcumgr/mgmt/port/zephyr/Kconfig"
+source "ext/mcumgr/cmd/Kconfig"
+endif
diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt
new file mode 100644
index 000..bc91e2f
--- /dev/null
+++ b/cmd/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_FS_MGMT   fs_mgmt)
+add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_IMG_MGMT  img_mgmt)
+add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_OS_MGMT   os_mgmt)
diff --git a/cmd/Kconfig b/cmd/Kconfig
new file mode 100644
index 000..a0e2031
--- /dev/null
+++ b/cmd/Kconfig
@@ -0,0 +1,24 @@
+# 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.
+
+menu "Command handlers"
+
+source "ext/mcumgr/cmd/fs_mgmt/Kconfig"
+source "ext/mcumgr/cmd/img_mgmt/Kconfig"
+source "ext/mcumgr/cmd/os_mgmt/Kconfig"
+
+endmenu
diff --git a/cmd/fs_mgmt/CMakeLists.txt b/cmd/fs_mgmt/CMakeLists.txt
new file mode 100644
index 000..974d0a9
--- /dev/null
+++ b/cmd/fs_mgmt/CMakeLists.txt
@@ -0,0 +1,9 @@
+target_include_directories(MCUMGR INTERFACE 
+include
+)
+
+zephyr_library_sources(
+cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c
+cmd/fs_mgmt/src/fs_mgmt.c
+cmd/fs_mgmt/src/stubs.c
+)
diff --git a/cmd/fs_mgmt/Kconfig b/cmd/fs_mgmt/Kconfig
new file mode 100644
index 000..62602d6
--- /dev/null
+++ b/cmd/fs_mgmt/Kconfig
@@ -0,0 +1,50 @@
+# 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
+# 

[mynewt-mcumgr] 18/42: Add log_mgmt support to smp_svr sample app.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 0738644e1bfa4fa762e013c12d9e080e2bde542f
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:52:34 2018 -0800

Add log_mgmt support to smp_svr sample app.
---
 samples/smp_svr/README.md | 30 +++
 samples/smp_svr/zephyr/CMakeLists.txt |  7 ++-
 samples/smp_svr/zephyr/prj.conf   | 41 ---
 samples/smp_svr/zephyr/src/main.c | 97 +--
 4 files changed, 162 insertions(+), 13 deletions(-)

diff --git a/samples/smp_svr/README.md b/samples/smp_svr/README.md
index cb9d3e7..6ff9dcd 100644
--- a/samples/smp_svr/README.md
+++ b/samples/smp_svr/README.md
@@ -8,6 +8,7 @@ transports:
 `smp_svr` enables support for the following command groups:
 * fs_mgmt
 * img_mgmt
+* log_mgmt
 * os_mgmt
 
 ## Mynewt
@@ -52,6 +53,35 @@ setting in `prj.conf` accordingly.
 In addition, the MCUBoot boot loader (https://github.com/runtimeco/mcuboot) is
 required for img_mgmt to function properly.
 
+The smp_svr app logs reboots to a flash circular buffer (FCB) backed log.  The
+flash map for the nRF52 only allocates flash for either the NFFS file system or
+the FCB, but not both.  By default, this application uses the FCB log, not the
+file system.  You can enable the NFFS file system and disable the FCB as 
follows-
+
+1. In `zephyr/prj.conf`, uncomment the `FILE_SYSTEM` settings and comment out
+the `FLASH` and `FCB` settings:
+
+```
+# Enable the NFFS file system.
+CONFIG_FILE_SYSTEM=y
+CONFIG_FILE_SYSTEM_NFFS=y
+
+ # Enable the flash circular buffer (FCB) for the reboot log.
+#CONFIG_FLASH_PAGE_LAYOUT=y
+#CONFIG_FLASH_MAP=y
+#CONFIG_FCB=y
+```
+
+2. Link in the NFFS library by uncommenting the `NFFS` line in
+`zephyr/CMakeLists.txt`:
+
+```
+zephyr_link_libraries(
+MCUMGR
+NFFS
+)
+```
+
 ### Building
 
 The Zephyr port of `smp_svr` can be built using the usual procedure:
diff --git a/samples/smp_svr/zephyr/CMakeLists.txt 
b/samples/smp_svr/zephyr/CMakeLists.txt
index 30a4ebd..ec1fced 100644
--- a/samples/smp_svr/zephyr/CMakeLists.txt
+++ b/samples/smp_svr/zephyr/CMakeLists.txt
@@ -39,4 +39,9 @@ target_sources(app PRIVATE
 src/main.c
 )
 
-zephyr_link_libraries(MCUMGR NFFS)
+zephyr_link_libraries(
+MCUMGR
+
+### Uncomment this line to use the NFFS file system.
+# NFFS
+)
diff --git a/samples/smp_svr/zephyr/prj.conf b/samples/smp_svr/zephyr/prj.conf
index 50e8ff1..60ccd65 100644
--- a/samples/smp_svr/zephyr/prj.conf
+++ b/samples/smp_svr/zephyr/prj.conf
@@ -1,11 +1,3 @@
-# Required by file management command handlers.
-CONFIG_FILE_SYSTEM=y
-CONFIG_FILE_SYSTEM_NFFS=y
-CONFIG_FS_NFFS_FLASH_DEV_NAME="NRF5_FLASH"
-
-# Required by tinycbor (math.h).
-CONFIG_NEWLIB_LIBC=y
-
 # Some command handlers require a large stack.
 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
 
@@ -24,7 +16,40 @@ CONFIG_BT_RX_BUF_LEN=260
 CONFIG_MCUMGR_SMP_BT=y
 CONFIG_MCUMGR_SMP_SHELL=y
 
+# Enable the NFFS file system.
+#CONFIG_FILE_SYSTEM=y
+#CONFIG_FILE_SYSTEM_NFFS=y
+
+# Enable the flash circular buffer (FCB) for the reboot log.
+CONFIG_FLASH_PAGE_LAYOUT=y
+CONFIG_FLASH_MAP=y
+CONFIG_FCB=y
+
+# Enable the managed log (mdlog).
+CONFIG_MDLOG=y
+CONFIG_MDLOG_CONSOLE=y
+CONFIG_MDLOG_FCB=y
+
+# Required by the `taskstat` command.
+CONFIG_THREAD_MONITOR=y
+
+# Enable the reboot log.
+CONFIG_REBOOT_LOG=y
+
+# Enable assertions.  Required for crash logging.
+CONFIG_ASSERT=y
+
 # Enable all core commands.
 CONFIG_MCUMGR_CMD_FS_MGMT=y
 CONFIG_MCUMGR_CMD_IMG_MGMT=y
+CONFIG_MCUMGR_CMD_LOG_MGMT=y
 CONFIG_MCUMGR_CMD_OS_MGMT=y
+
+### nRF5 specific settings
+
+# Disable flash-radio sync.  This is necessary for writing to the reboot log
+# with an interrupt handler.
+CONFIG_SOC_FLASH_NRF5_RADIO_SYNC=n
+
+# Specify the location of the NFFS file system.
+CONFIG_FS_NFFS_FLASH_DEV_NAME="NRF5_FLASH"
diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index 757725f..fad6fbc 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -11,15 +11,44 @@
 #include 
 #include 
 #include 
+#include "logging/mdlog.h"
+#include "logging/reboot_log.h"
+#include "fcb.h"
+#include "mgmt/smp_bt.h"
+#include "mgmt/buf.h"
+
+#if defined CONFIG_FCB && defined CONFIG_FILE_SYSTEM_NFFS
+#error Both CONFIG_FCB and CONFIG_FILE_SYSTEM_NFFS are defined; smp_svr \
+   application only supports one at a time.
+#endif
+
+#ifdef CONFIG_MCUMGR_CMD_FS_MGMT
 #include "fs_mgmt/fs_mgmt.h"
+#endif
+#ifdef CONFIG_MCUMGR_CMD_OS_MGMT
 #include "os_mgmt/os_mgmt.h"
+#endif
+#ifdef CONFIG_MCUMGR_CMD_IMG_MGMT
 #include "img_mgmt/img_mgmt.h"
-#include "mgmt/smp_bt.h"
-#include "mgmt/buf.h"
- 
+#endif
+#ifdef CONFIG_MCUMGR_CMD_LOG_MGMT
+#include "log_mgmt/log_mgmt.h"
+#endif
+
 #define DEVICE_NAME 

[mynewt-mcumgr] 40/42: Zephyr: use <> for non-relative include paths.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 1aca72268fb6c21977bd45752bb7ca509262e7b0
Author: Christopher Collins 
AuthorDate: Mon Feb 12 13:18:22 2018 -0800

Zephyr: use <> for non-relative include paths.

For `#include` directives, Zephyr uses "" for paths relative to the
source file; <> for headers in an include path.
---
 cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c |  6 +++---
 cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c   |  6 +++---
 cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c   |  8 
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c |  8 
 cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c |  8 
 samples/smp_svr/zephyr/src/main.c| 12 ++--
 6 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c 
b/cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c
index 42b7d80..754d3c3 100644
--- a/cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c
+++ b/cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c
@@ -17,9 +17,9 @@
  * under the License.
  */
 
-#include "mgmt/mgmt.h"
-#include "fs_mgmt/fs_mgmt_impl.h"
-#include "fs.h"
+#include 
+#include 
+#include 
 
 int
 fs_mgmt_impl_filelen(const char *path, size_t *out_len)
diff --git a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c 
b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
index 143b1e0..8693451 100644
--- a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
+++ b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
@@ -24,9 +24,9 @@
 #include 
 #include 
 #include 
-#include "mgmt/mgmt.h"
-#include "img_mgmt/img_mgmt_impl.h"
-#include "img_mgmt/img_mgmt.h"
+#include 
+#include 
+#include 
 #include "../../../src/img_mgmt_priv.h"
 
 static struct device *zephyr_img_mgmt_flash_dev;
diff --git a/cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c 
b/cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c
index 41cf51e..378c3ea 100644
--- a/cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c
+++ b/cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c
@@ -18,10 +18,10 @@
  */
 
 #include 
-#include "logging/mdlog.h"
-#include "mgmt/mgmt.h"
-#include "log_mgmt/log_mgmt.h"
-#include "log_mgmt/log_mgmt_impl.h"
+#include 
+#include 
+#include 
+#include 
 #include "../../../src/log_mgmt_config.h"
 
 struct zephyr_log_mgmt_walk_arg {
diff --git a/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c 
b/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
index 20ee5a6..e127bdb 100644
--- a/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
+++ b/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
@@ -21,10 +21,10 @@
 #include 
 #include 
 #include 
-#include "logging/reboot_log.h"
-#include "mgmt/mgmt.h"
-#include "os_mgmt/os_mgmt.h"
-#include "os_mgmt/os_mgmt_impl.h"
+#include 
+#include 
+#include 
+#include 
 
 static void zephyr_os_mgmt_reset_cb(struct k_timer *timer);
 static void zephyr_os_mgmt_reset_work_handler(struct k_work *work);
diff --git a/cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c 
b/cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c
index dd0ba0b..22654f8 100644
--- a/cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c
+++ b/cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c
@@ -18,10 +18,10 @@
  */
 
 #include 
-#include "stats.h"
-#include "mgmt/mgmt.h"
-#include "stat_mgmt/stat_mgmt.h"
-#include "stat_mgmt/stat_mgmt_impl.h"
+#include 
+#include 
+#include 
+#include 
 
 struct zephyr_stat_mgmt_walk_arg {
 stat_mgmt_foreach_entry_fn *cb;
diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index 3e06e40..fde3f4e 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -11,12 +11,12 @@
 #include 
 #include 
 #include 
-#include "logging/mdlog.h"
-#include "logging/reboot_log.h"
-#include "fcb.h"
-#include "stats.h"
-#include "mgmt/smp_bt.h"
-#include "mgmt/buf.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #ifdef CONFIG_MCUMGR_CMD_FS_MGMT
 #include "fs_mgmt/fs_mgmt.h"

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 28/42: Correct "MCUboot" spelling in documentation.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit e4db21b4ea2042cb9929fa22b9e85dd5c4138cf5
Author: Christopher Collins 
AuthorDate: Wed Jan 31 16:31:39 2018 -0800

Correct "MCUboot" spelling in documentation.

MCUBoot --> MCUboot.
---
 README.md | 2 +-
 samples/smp_svr/README.md | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index bbe0016..4726883 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ the list below:
 ## Dependencies
 
 To use mcumgr's image management support, your device must be running the
-MCUBoot boot loader (https://github.com/runtimeco/mcuboot).  The other mcumgr
+MCUboot boot loader (https://github.com/runtimeco/mcuboot).  The other mcumgr
 features do not require MCUboot.
 
 ## Command line tool
diff --git a/samples/smp_svr/README.md b/samples/smp_svr/README.md
index 6ff9dcd..5e99d83 100644
--- a/samples/smp_svr/README.md
+++ b/samples/smp_svr/README.md
@@ -50,7 +50,7 @@ the file system management commands will not work.  To enable 
file system
 management for a different platform, adjust the `CONFIG_FS_NFFS_FLASH_DEV_NAME`
 setting in `prj.conf` accordingly.
 
-In addition, the MCUBoot boot loader (https://github.com/runtimeco/mcuboot) is
+In addition, the MCUboot boot loader (https://github.com/runtimeco/mcuboot) is
 required for img_mgmt to function properly.
 
 The smp_svr app logs reboots to a flash circular buffer (FCB) backed log.  The

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 35/42: Indicate units (bytes) in Kconfig help.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 490f44f3715373051c16b02238da2c8fab52a4c5
Author: Christopher Collins 
AuthorDate: Mon Feb 12 13:01:59 2018 -0800

Indicate units (bytes) in Kconfig help.
---
 cmd/fs_mgmt/Kconfig   | 15 ---
 cmd/img_mgmt/Kconfig  |  5 +++--
 cmd/log_mgmt/Kconfig  | 20 ++--
 cmd/stat_mgmt/Kconfig |  8 
 4 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/cmd/fs_mgmt/Kconfig b/cmd/fs_mgmt/Kconfig
index 03157b0..ccbcf17 100644
--- a/cmd/fs_mgmt/Kconfig
+++ b/cmd/fs_mgmt/Kconfig
@@ -29,23 +29,24 @@ config FS_MGMT_UL_CHUNK_SIZE
 prompt "Maximum chunk size for file uploads"
 default 512
 help
-  Limits the maximum chunk size in file uploads.  A buffer of this size
-  gets allocated on the stack during handling of a file upload command.
+  Limits the maximum chunk size for file uploads, in bytes.  A buffer of
+  this size gets allocated on the stack during handling of a file upload 
command.
 
 config FS_MGMT_DL_CHUNK_SIZE
 int
 prompt "Maximum chunk size for file downloads"
 default 512
 help
-  Limits the maximum chunk size in file downloads.  A buffer of this size
-  gets allocated on the stack during handling of a file download command.
+  Limits the maximum chunk size for file downloads, in bytes.  A buffer of
+  this size gets allocated on the stack during handling of a file download
+  command.
 
 config FS_MGMT_PATH_SIZE
 int
 prompt "Maximum file path length"
 default 64
 help
-  Limits the maximum path length in file operations.  A buffer of this size
-  gets allocated on the stack during handling of file upload and download
-  commands.
+  Limits the maximum path length for file operations, in bytes.  A buffer
+  of this size gets allocated on the stack during handling of file upload
+  and download commands.
 endif
diff --git a/cmd/img_mgmt/Kconfig b/cmd/img_mgmt/Kconfig
index 2ac6c61..f8072b8 100644
--- a/cmd/img_mgmt/Kconfig
+++ b/cmd/img_mgmt/Kconfig
@@ -33,6 +33,7 @@ config IMG_MGMT_UL_CHUNK_SIZE
 prompt "Maximum chunk size for image uploads"
 default 512
 help
-  Limits the maximum chunk size in image uploads.  A buffer of this size
-  gets allocated on the stack during handling of a image upload command.
+  Limits the maximum chunk size for image uploads, in bytes.  A buffer of
+  this size gets allocated on the stack during handling of a image upload
+  command.
 endif
diff --git a/cmd/log_mgmt/Kconfig b/cmd/log_mgmt/Kconfig
index 8b43166..9373571 100644
--- a/cmd/log_mgmt/Kconfig
+++ b/cmd/log_mgmt/Kconfig
@@ -29,26 +29,26 @@ config LOG_MGMT_CHUNK_SIZE
 prompt "Maximum chunk size for log downloads"
 default 512
 help
-  Limits the maximum chunk size in log downloads.  A buffer of this size
-  gets allocated on the stack during handling of the log show command.
+  Limits the maximum chunk size for log downloads, in bytes.  A buffer of
+  this size gets allocated on the stack during handling of the log show 
command.
 
 config LOG_MGMT_NAME_LEN
 int
 prompt "Maximum log name length"
 default 64
 help
-  Limits the maximum length of log names.  If a log's name length exceeds
-  this number, it gets truncated in management responses.  A buffer of this
-  size gets allocated on the stack during handling of all log management
-  commands.
+  Limits the maximum length of log names, in bytes.  If a log's name length
+  exceeds this number, it gets truncated in management responses.  A buffer
+  of this size gets allocated on the stack during handling of all log
+  management commands.
 
 config LOG_MGMT_BODY_LEN
 int
 prompt "Maximum log body length"
 default 128
 help
-  Limits the maximum length of log entry bodies.  If a log entry's body
-  length exceeds this number, it gets truncated in management responses.  A
-  buffer of this size gets allocated on the stack during handling of the
-  log show command.
+  Limits the maximum length of log entry bodies, in bytes.  If a log
+  entry's body length exceeds this number, it gets truncated in management
+  responses.  A buffer of this size gets allocated on the stack during
+  handling of the log show command.
 endif
diff --git a/cmd/stat_mgmt/Kconfig b/cmd/stat_mgmt/Kconfig
index ffda20f..3688ed1 100644
--- a/cmd/stat_mgmt/Kconfig
+++ b/cmd/stat_mgmt/Kconfig
@@ -29,8 +29,8 @@ config STAT_MGMT_MAX_NAME_LEN
 prompt "Maximum stat group name length"
 default 32
 help
-  Limits the maximum stat group name length in mcumgr requests.  A buffer
-  of this size gets allocated on the stack during handling of all stat read
-  commands.  If a 

[mynewt-mcumgr] 18/42: Add log_mgmt support to smp_svr sample app.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit d9131d612861611bd33d6b344b887c77c606fdfe
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:52:34 2018 -0800

Add log_mgmt support to smp_svr sample app.
---
 samples/smp_svr/README.md | 30 +++
 samples/smp_svr/zephyr/CMakeLists.txt |  7 ++-
 samples/smp_svr/zephyr/prj.conf   | 41 ---
 samples/smp_svr/zephyr/src/main.c | 97 +--
 4 files changed, 162 insertions(+), 13 deletions(-)

diff --git a/samples/smp_svr/README.md b/samples/smp_svr/README.md
index cb9d3e7..6ff9dcd 100644
--- a/samples/smp_svr/README.md
+++ b/samples/smp_svr/README.md
@@ -8,6 +8,7 @@ transports:
 `smp_svr` enables support for the following command groups:
 * fs_mgmt
 * img_mgmt
+* log_mgmt
 * os_mgmt
 
 ## Mynewt
@@ -52,6 +53,35 @@ setting in `prj.conf` accordingly.
 In addition, the MCUBoot boot loader (https://github.com/runtimeco/mcuboot) is
 required for img_mgmt to function properly.
 
+The smp_svr app logs reboots to a flash circular buffer (FCB) backed log.  The
+flash map for the nRF52 only allocates flash for either the NFFS file system or
+the FCB, but not both.  By default, this application uses the FCB log, not the
+file system.  You can enable the NFFS file system and disable the FCB as 
follows-
+
+1. In `zephyr/prj.conf`, uncomment the `FILE_SYSTEM` settings and comment out
+the `FLASH` and `FCB` settings:
+
+```
+# Enable the NFFS file system.
+CONFIG_FILE_SYSTEM=y
+CONFIG_FILE_SYSTEM_NFFS=y
+
+ # Enable the flash circular buffer (FCB) for the reboot log.
+#CONFIG_FLASH_PAGE_LAYOUT=y
+#CONFIG_FLASH_MAP=y
+#CONFIG_FCB=y
+```
+
+2. Link in the NFFS library by uncommenting the `NFFS` line in
+`zephyr/CMakeLists.txt`:
+
+```
+zephyr_link_libraries(
+MCUMGR
+NFFS
+)
+```
+
 ### Building
 
 The Zephyr port of `smp_svr` can be built using the usual procedure:
diff --git a/samples/smp_svr/zephyr/CMakeLists.txt 
b/samples/smp_svr/zephyr/CMakeLists.txt
index 30a4ebd..ec1fced 100644
--- a/samples/smp_svr/zephyr/CMakeLists.txt
+++ b/samples/smp_svr/zephyr/CMakeLists.txt
@@ -39,4 +39,9 @@ target_sources(app PRIVATE
 src/main.c
 )
 
-zephyr_link_libraries(MCUMGR NFFS)
+zephyr_link_libraries(
+MCUMGR
+
+### Uncomment this line to use the NFFS file system.
+# NFFS
+)
diff --git a/samples/smp_svr/zephyr/prj.conf b/samples/smp_svr/zephyr/prj.conf
index 50e8ff1..60ccd65 100644
--- a/samples/smp_svr/zephyr/prj.conf
+++ b/samples/smp_svr/zephyr/prj.conf
@@ -1,11 +1,3 @@
-# Required by file management command handlers.
-CONFIG_FILE_SYSTEM=y
-CONFIG_FILE_SYSTEM_NFFS=y
-CONFIG_FS_NFFS_FLASH_DEV_NAME="NRF5_FLASH"
-
-# Required by tinycbor (math.h).
-CONFIG_NEWLIB_LIBC=y
-
 # Some command handlers require a large stack.
 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
 
@@ -24,7 +16,40 @@ CONFIG_BT_RX_BUF_LEN=260
 CONFIG_MCUMGR_SMP_BT=y
 CONFIG_MCUMGR_SMP_SHELL=y
 
+# Enable the NFFS file system.
+#CONFIG_FILE_SYSTEM=y
+#CONFIG_FILE_SYSTEM_NFFS=y
+
+# Enable the flash circular buffer (FCB) for the reboot log.
+CONFIG_FLASH_PAGE_LAYOUT=y
+CONFIG_FLASH_MAP=y
+CONFIG_FCB=y
+
+# Enable the managed log (mdlog).
+CONFIG_MDLOG=y
+CONFIG_MDLOG_CONSOLE=y
+CONFIG_MDLOG_FCB=y
+
+# Required by the `taskstat` command.
+CONFIG_THREAD_MONITOR=y
+
+# Enable the reboot log.
+CONFIG_REBOOT_LOG=y
+
+# Enable assertions.  Required for crash logging.
+CONFIG_ASSERT=y
+
 # Enable all core commands.
 CONFIG_MCUMGR_CMD_FS_MGMT=y
 CONFIG_MCUMGR_CMD_IMG_MGMT=y
+CONFIG_MCUMGR_CMD_LOG_MGMT=y
 CONFIG_MCUMGR_CMD_OS_MGMT=y
+
+### nRF5 specific settings
+
+# Disable flash-radio sync.  This is necessary for writing to the reboot log
+# with an interrupt handler.
+CONFIG_SOC_FLASH_NRF5_RADIO_SYNC=n
+
+# Specify the location of the NFFS file system.
+CONFIG_FS_NFFS_FLASH_DEV_NAME="NRF5_FLASH"
diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index 757725f..fad6fbc 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -11,15 +11,44 @@
 #include 
 #include 
 #include 
+#include "logging/mdlog.h"
+#include "logging/reboot_log.h"
+#include "fcb.h"
+#include "mgmt/smp_bt.h"
+#include "mgmt/buf.h"
+
+#if defined CONFIG_FCB && defined CONFIG_FILE_SYSTEM_NFFS
+#error Both CONFIG_FCB and CONFIG_FILE_SYSTEM_NFFS are defined; smp_svr \
+   application only supports one at a time.
+#endif
+
+#ifdef CONFIG_MCUMGR_CMD_FS_MGMT
 #include "fs_mgmt/fs_mgmt.h"
+#endif
+#ifdef CONFIG_MCUMGR_CMD_OS_MGMT
 #include "os_mgmt/os_mgmt.h"
+#endif
+#ifdef CONFIG_MCUMGR_CMD_IMG_MGMT
 #include "img_mgmt/img_mgmt.h"
-#include "mgmt/smp_bt.h"
-#include "mgmt/buf.h"
- 
+#endif
+#ifdef CONFIG_MCUMGR_CMD_LOG_MGMT
+#include "log_mgmt/log_mgmt.h"
+#endif
+
 #define DEVICE_NAME 

[mynewt-mcumgr] 34/42: mcumgr: Minor refactor to increase readability

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 4a723061331dedaac52a42d3f5475b14d1a7c32e
Author: Sebastian Bøe 
AuthorDate: Mon Feb 12 12:32:37 2018 +0100

mcumgr: Minor refactor to increase readability

horizontal alignment improves readability and diff-ability.

Signed-off-by: Sebastian Bøe 
---
 CMakeLists.txt | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a88725a..4225f3e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,4 +9,8 @@ add_subdirectory(smp)
 
 zephyr_library_link_libraries(MCUMGR)
 
-target_link_libraries(MCUMGR INTERFACE zephyr_interface BASE64 TINYCBOR)
+target_link_libraries(MCUMGR INTERFACE
+  zephyr_interface
+  BASE64
+  TINYCBOR
+  )

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 38/42: smp_svr/CMakeLists.txt: remove set_conf_file macro

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 75c5f1a7c3842f75c130a41a837157cfad2854e0
Author: Christopher Collins 
AuthorDate: Mon Feb 12 13:17:22 2018 -0800

smp_svr/CMakeLists.txt: remove set_conf_file macro

This macro is unnecessary.  It was a leftover from the original
CMakeLists.txt file used as a template.
---
 samples/smp_svr/zephyr/CMakeLists.txt | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/samples/smp_svr/zephyr/CMakeLists.txt 
b/samples/smp_svr/zephyr/CMakeLists.txt
index b61b8ea..7765cb4 100644
--- a/samples/smp_svr/zephyr/CMakeLists.txt
+++ b/samples/smp_svr/zephyr/CMakeLists.txt
@@ -7,17 +7,6 @@
 # This provides a basic application structure suitable for communication using
 # mcumgr.  It can be used as a starting point for new applications.
 
-# The default top-level application configuration is prj.conf.  You can place
-# additional board-specific files in boards/${BOARD}.conf, and they will be
-# merged into the configuration along with prj.conf.
-macro(set_conf_file)
-  if(EXISTS ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf)
-set(CONF_FILE "prj.conf ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf")
-  else()
-set(CONF_FILE "prj.conf")
-  endif()
-endmacro()
-
 # Zephyr uses Device Tree (DT) to describe some board hardware configuration.
 #
 # See the Zephyr documentation for more information on DT:

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 17/42: log_mgmt command handler group.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit afdb0474da89b2cb8b59ddff6be404ba3484745b
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:52:28 2018 -0800

log_mgmt command handler group.
---
 cmd/CMakeLists.txt |   1 +
 cmd/Kconfig|   1 +
 cmd/log_mgmt/CMakeLists.txt|   9 +
 cmd/log_mgmt/Kconfig   |  53 +++
 cmd/log_mgmt/include/log_mgmt/log_mgmt.h   |  83 +
 cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h  |  48 +++
 cmd/log_mgmt/port/mynewt/src/mynewt_log_mgmt.c | 206 +++
 cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c | 189 ++
 cmd/log_mgmt/src/log_mgmt.c| 494 +
 cmd/log_mgmt/src/log_mgmt_config.h |  45 +++
 cmd/log_mgmt/src/stubs.c   |  65 
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c   |   2 +
 12 files changed, 1196 insertions(+)

diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt
index bc91e2f..be26ded 100644
--- a/cmd/CMakeLists.txt
+++ b/cmd/CMakeLists.txt
@@ -1,3 +1,4 @@
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_FS_MGMT   fs_mgmt)
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_IMG_MGMT  img_mgmt)
+add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_LOG_MGMT  log_mgmt)
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_OS_MGMT   os_mgmt)
diff --git a/cmd/Kconfig b/cmd/Kconfig
index a0e2031..ea51804 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -19,6 +19,7 @@ menu "Command handlers"
 
 source "ext/mcumgr/cmd/fs_mgmt/Kconfig"
 source "ext/mcumgr/cmd/img_mgmt/Kconfig"
+source "ext/mcumgr/cmd/log_mgmt/Kconfig"
 source "ext/mcumgr/cmd/os_mgmt/Kconfig"
 
 endmenu
diff --git a/cmd/log_mgmt/CMakeLists.txt b/cmd/log_mgmt/CMakeLists.txt
new file mode 100644
index 000..7d72dcd
--- /dev/null
+++ b/cmd/log_mgmt/CMakeLists.txt
@@ -0,0 +1,9 @@
+target_include_directories(MCUMGR INTERFACE 
+include
+)
+
+zephyr_library_sources(
+cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c
+cmd/log_mgmt/src/log_mgmt.c
+cmd/log_mgmt/src/stubs.c
+)
diff --git a/cmd/log_mgmt/Kconfig b/cmd/log_mgmt/Kconfig
new file mode 100644
index 000..e949aa6
--- /dev/null
+++ b/cmd/log_mgmt/Kconfig
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE log
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this log
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this log 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.
+
+menuconfig MCUMGR_CMD_LOG_MGMT
+bool
+prompt "Enable mcumgr handlers for log management"
+default n
+help
+  Enables mcumgr handlers for log management
+
+if MCUMGR_CMD_LOG_MGMT
+config LOG_MGMT_CHUNK_SIZE
+int
+prompt "Maximum chunk size for log downloads"
+default 512
+help
+  Limits the maximum chunk size in log downloads.  A buffer of this size
+  gets allocated on the stack during handling of the log show command.
+
+config LOG_MGMT_NAME_LEN
+int
+prompt "Maximum log name length"
+default 64
+help
+  Limits the maximum length of log names.  If a log's name length exceeds
+  this number, it gets truncated in management responses.  A buffer of this
+  size gets allocated on the stack during handling of all log management
+  commands.
+
+config LOG_MGMT_BODY_LEN
+int
+prompt "Maximum log body length"
+default 128
+help
+  Limits the maximum length of log entry bodies.  If a log entry's body
+  length exceeds this number, it gets truncated in management responses.  A
+  buffer of this size gets allocated on the stack during handling of the
+  log show command.
+endif
diff --git a/cmd/log_mgmt/include/log_mgmt/log_mgmt.h 
b/cmd/log_mgmt/include/log_mgmt/log_mgmt.h
new file mode 100644
index 000..01df2e5
--- /dev/null
+++ b/cmd/log_mgmt/include/log_mgmt/log_mgmt.h
@@ -0,0 +1,83 @@
+/*
+ * 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 

[mynewt-mcumgr] 13/42: Make MCUMGR_CMD_FS_MGMT depend on FILE_SYSTEM.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit ad113bc56f9431c276b863ef7c489837a2aed34f
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:45:00 2018 -0800

Make MCUMGR_CMD_FS_MGMT depend on FILE_SYSTEM.
---
 cmd/fs_mgmt/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cmd/fs_mgmt/Kconfig b/cmd/fs_mgmt/Kconfig
index 62602d6..03157b0 100644
--- a/cmd/fs_mgmt/Kconfig
+++ b/cmd/fs_mgmt/Kconfig
@@ -18,6 +18,7 @@
 menuconfig MCUMGR_CMD_FS_MGMT
 bool
 prompt "Enable mcumgr handlers for file management"
+depends on FILE_SYSTEM
 default n
 help
   Enables mcumgr handlers for file management

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 30/42: zephyr img_mgmt: Use `FLASH_DEV_NAME`

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit fec54445ad34a682eea741d6ff4d231f7d07
Author: Christopher Collins 
AuthorDate: Thu Feb 8 14:33:40 2018 -0800

zephyr img_mgmt: Use `FLASH_DEV_NAME`

This used to be `FLASH_DRIVER_NAME`, but it changed in zephyr.
---
 cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c 
b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
index e17952b..143b1e0 100644
--- a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
+++ b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
@@ -218,7 +218,7 @@ zephyr_img_mgmt_init(struct device *dev)
 {
 ARG_UNUSED(dev);
 
-zephyr_img_mgmt_flash_dev = device_get_binding(FLASH_DRIVER_NAME);
+zephyr_img_mgmt_flash_dev = device_get_binding(FLASH_DEV_NAME);
 if (zephyr_img_mgmt_flash_dev == NULL) {
 return -ENODEV;
 }

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 14/42: Add missing license text.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 4df50f799f7b4fb9b9ef953ab64bdd8e6d5cc0c6
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:45:20 2018 -0800

Add missing license text.
---
 cmd/fs_mgmt/src/fs_mgmt_config.h   | 19 +++
 cmd/img_mgmt/src/img_mgmt_config.h | 19 +++
 cmd/os_mgmt/src/os_mgmt_config.h   | 19 +++
 3 files changed, 57 insertions(+)

diff --git a/cmd/fs_mgmt/src/fs_mgmt_config.h b/cmd/fs_mgmt/src/fs_mgmt_config.h
index 81fb7dd..deaec8a 100644
--- a/cmd/fs_mgmt/src/fs_mgmt_config.h
+++ b/cmd/fs_mgmt/src/fs_mgmt_config.h
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef H_FS_MGMT_CONFIG_
 #define H_FS_MGMT_CONFIG_
 
diff --git a/cmd/img_mgmt/src/img_mgmt_config.h 
b/cmd/img_mgmt/src/img_mgmt_config.h
index 4ec8295..a520372 100644
--- a/cmd/img_mgmt/src/img_mgmt_config.h
+++ b/cmd/img_mgmt/src/img_mgmt_config.h
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef H_IMG_MGMT_CONFIG_
 #define H_IMG_MGMT_CONFIG_
 
diff --git a/cmd/os_mgmt/src/os_mgmt_config.h b/cmd/os_mgmt/src/os_mgmt_config.h
index d388dec..fee386b 100644
--- a/cmd/os_mgmt/src/os_mgmt_config.h
+++ b/cmd/os_mgmt/src/os_mgmt_config.h
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef H_OS_MGMT_CONFIG_
 #define H_OS_MGMT_CONFIG_
 

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 42/42: smp_svr (zephyr) - CONFIG_NET_BUF_USER_DATA_SIZE=7

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 44e350044d1d7f417942dd653519525349af42e3
Author: Christopher Collins 
AuthorDate: Mon Feb 12 17:40:40 2018 -0800

smp_svr (zephyr) - CONFIG_NET_BUF_USER_DATA_SIZE=7

This setting is required by the updated net_buf API.  Failing to
configure this setting to a value >= 7 causes a static assert failure.
---
 samples/smp_svr/zephyr/prj.conf | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/samples/smp_svr/zephyr/prj.conf b/samples/smp_svr/zephyr/prj.conf
index 9e04c3c..42abc04 100644
--- a/samples/smp_svr/zephyr/prj.conf
+++ b/samples/smp_svr/zephyr/prj.conf
@@ -19,6 +19,9 @@ CONFIG_BT_RX_BUF_LEN=260
 CONFIG_MCUMGR_SMP_BT=y
 CONFIG_MCUMGR_SMP_SHELL=y
 
+# Bluetooth support requires a net_buf user_data size >= 7.
+CONFIG_NET_BUF_USER_DATA_SIZE=7
+
 # Enable flash operations.
 CONFIG_FLASH=y
 

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 09/42: Mynewt support.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 6974956f30578a763f8aac394d0c52fcc5e31b1b
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:15:59 2018 -0800

Mynewt support.
---
 cmd/fs_mgmt/pkg.yml|  27 
 cmd/fs_mgmt/port/mynewt/src/mynewt_fs_mgmt.c   | 106 
 cmd/fs_mgmt/syscfg.yml |  40 +
 cmd/img_mgmt/pkg.yml   |  30 
 cmd/img_mgmt/port/mynewt/src/mynewt_img_mgmt.c | 214 +
 cmd/img_mgmt/syscfg.yml|  26 +++
 cmd/os_mgmt/pkg.yml|  27 
 cmd/os_mgmt/port/mynewt/src/mynewt_os_mgmt.c   | 116 ++
 cmd/os_mgmt/syscfg.yml |  26 +++
 repository.yml |  25 +++
 10 files changed, 637 insertions(+)

diff --git a/cmd/fs_mgmt/pkg.yml b/cmd/fs_mgmt/pkg.yml
new file mode 100644
index 000..9452cc6
--- /dev/null
+++ b/cmd/fs_mgmt/pkg.yml
@@ -0,0 +1,27 @@
+#
+# 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: cmd/fs_mgmt
+pkg.description: 'File system command handlers for mcumgr.'
+pkg.author: "Apache Mynewt "
+pkg.homepage: "http://mynewt.apache.org/;
+pkg.keywords:
+
+pkg.deps:
+- '@apache-mynewt-core/fs/fs'
diff --git a/cmd/fs_mgmt/port/mynewt/src/mynewt_fs_mgmt.c 
b/cmd/fs_mgmt/port/mynewt/src/mynewt_fs_mgmt.c
new file mode 100644
index 000..632bd1e
--- /dev/null
+++ b/cmd/fs_mgmt/port/mynewt/src/mynewt_fs_mgmt.c
@@ -0,0 +1,106 @@
+/*
+ * 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 "mgmt/mgmt.h"
+#include "fs_mgmt/fs_mgmt_impl.h"
+#include "fs/fs.h"
+
+int
+fs_mgmt_impl_filelen(const char *path, size_t *out_len)
+{
+struct fs_file *file;
+int rc;
+
+rc = fs_open(path, FS_ACCESS_READ, );
+if (rc != 0) {
+return MGMT_ERR_EUNKNOWN;
+}
+
+rc = fs_filelen(file, _len);
+fs_close(file);
+if (rc != 0) {
+return MGMT_ERR_EUNKNOWN;
+}
+
+return 0;
+}
+
+int
+fs_mgmt_impl_read(const char *path, size_t offset, size_t len,
+  void *out_data, size_t *out_len)
+{
+struct fs_file *file;
+uint32_t bytes_read;
+int rc;
+
+rc = fs_open(path, FS_ACCESS_READ, );
+if (rc != 0) {
+return MGMT_ERR_EUNKNOWN;
+}
+
+rc = fs_seek(file, offset);
+if (rc != 0) {
+goto done;
+}
+
+rc = fs_read(file, len, file_data, _read);
+if (rc != 0) {
+goto done;
+}
+
+*out_len = bytes_read;
+
+done:
+fs_close(file);
+
+if (rc != 0) {
+return MGMT_ERR_EUNKNOWN;
+}
+
+return 0;
+}
+
+int
+fs_mgmt_impl_write(const char *path, size_t offset, const void *data,
+   size_t len)
+{
+struct fs_file *file;
+uint8_t access;
+int rc;
+ 
+access = FS_ACCESS_WRITE;
+if (offset == 0) {
+access |= FS_ACCESS_TRUNCATE;
+} else {
+access |= FS_ACCESS_APPEND;
+}
+
+rc = fs_open(path, access, );
+if (rc != 0) {
+return MGMT_ERR_EUNKNOWN;
+}
+
+rc = fs_write(file, data, len);
+fs_close(file);
+if (rc != 0) {
+return MGMT_ERR_EUNKNOWN;
+}
+
+return 0;
+}
diff --git a/cmd/fs_mgmt/syscfg.yml b/cmd/fs_mgmt/syscfg.yml
new file mode 100644
index 

[mynewt-mcumgr] 08/42: Zephyr support.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit cfe132ea4f00ba519ed7f313d974ecbb3aa84987
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:15:18 2018 -0800

Zephyr support.
---
 CMakeLists.txt |  12 ++
 Kconfig|  29 
 cmd/CMakeLists.txt |   3 +
 cmd/Kconfig|  24 +++
 cmd/fs_mgmt/CMakeLists.txt |   9 +
 cmd/fs_mgmt/Kconfig|  50 ++
 cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c   | 151 
 cmd/img_mgmt/CMakeLists.txt|  11 ++
 cmd/img_mgmt/Kconfig   |  38 +
 cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c | 227 +
 cmd/os_mgmt/CMakeLists.txt |   9 +
 cmd/os_mgmt/Kconfig|  35 
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c   |  85 +
 ext/CMakeLists.txt |   2 +
 14 files changed, 685 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 000..a88725a
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_library(MCUMGR INTERFACE)
+
+zephyr_library()
+add_subdirectory(cborattr)
+add_subdirectory(cmd)
+add_subdirectory(ext)
+add_subdirectory(mgmt)
+add_subdirectory(smp)
+
+zephyr_library_link_libraries(MCUMGR)
+
+target_link_libraries(MCUMGR INTERFACE zephyr_interface BASE64 TINYCBOR)
diff --git a/Kconfig b/Kconfig
new file mode 100644
index 000..89de3ee
--- /dev/null
+++ b/Kconfig
@@ -0,0 +1,29 @@
+# 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.
+
+menuconfig MCUMGR
+bool
+prompt "mcumgr Support"
+select TINYCBOR
+default n
+help
+  This option enables the mcumgr management library.
+
+if MCUMGR
+source "ext/mcumgr/mgmt/port/zephyr/Kconfig"
+source "ext/mcumgr/cmd/Kconfig"
+endif
diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt
new file mode 100644
index 000..bc91e2f
--- /dev/null
+++ b/cmd/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_FS_MGMT   fs_mgmt)
+add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_IMG_MGMT  img_mgmt)
+add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_OS_MGMT   os_mgmt)
diff --git a/cmd/Kconfig b/cmd/Kconfig
new file mode 100644
index 000..a0e2031
--- /dev/null
+++ b/cmd/Kconfig
@@ -0,0 +1,24 @@
+# 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.
+
+menu "Command handlers"
+
+source "ext/mcumgr/cmd/fs_mgmt/Kconfig"
+source "ext/mcumgr/cmd/img_mgmt/Kconfig"
+source "ext/mcumgr/cmd/os_mgmt/Kconfig"
+
+endmenu
diff --git a/cmd/fs_mgmt/CMakeLists.txt b/cmd/fs_mgmt/CMakeLists.txt
new file mode 100644
index 000..974d0a9
--- /dev/null
+++ b/cmd/fs_mgmt/CMakeLists.txt
@@ -0,0 +1,9 @@
+target_include_directories(MCUMGR INTERFACE 
+include
+)
+
+zephyr_library_sources(
+cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c
+cmd/fs_mgmt/src/fs_mgmt.c
+cmd/fs_mgmt/src/stubs.c
+)
diff --git a/cmd/fs_mgmt/Kconfig b/cmd/fs_mgmt/Kconfig
new file mode 100644
index 000..62602d6
--- /dev/null
+++ b/cmd/fs_mgmt/Kconfig
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional 

[mynewt-mcumgr] 06/42: OS-agnostic command handlers: fs, img, os.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 4355617a16c1a4c6974d6b4527c7a6d80ef0e9cd
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:12:52 2018 -0800

OS-agnostic command handlers: fs, img, os.
---
 cmd/fs_mgmt/include/fs_mgmt/fs_mgmt.h |  41 +++
 cmd/fs_mgmt/include/fs_mgmt/fs_mgmt_impl.h|  77 +
 cmd/fs_mgmt/src/fs_mgmt.c | 250 
 cmd/fs_mgmt/src/fs_mgmt_config.h  |  26 ++
 cmd/fs_mgmt/src/stubs.c   |  46 +++
 cmd/img_mgmt/include/img_mgmt/image.h |  82 ++
 cmd/img_mgmt/include/img_mgmt/img_mgmt.h  |  49 
 cmd/img_mgmt/include/img_mgmt/img_mgmt_impl.h | 107 +++
 cmd/img_mgmt/src/img_mgmt.c   | 400 ++
 cmd/img_mgmt/src/img_mgmt_config.h|  22 ++
 cmd/img_mgmt/src/img_mgmt_priv.h  |  96 +++
 cmd/img_mgmt/src/img_mgmt_state.c | 315 
 cmd/img_mgmt/src/img_mgmt_util.c  |  39 +++
 cmd/img_mgmt/src/stubs.c  |  64 +
 cmd/os_mgmt/include/os_mgmt/os_mgmt.h |  64 +
 cmd/os_mgmt/include/os_mgmt/os_mgmt_impl.h|  62 
 cmd/os_mgmt/src/os_mgmt.c | 190 
 cmd/os_mgmt/src/os_mgmt_config.h  |  22 ++
 cmd/os_mgmt/src/stubs.c   |  38 +++
 19 files changed, 1990 insertions(+)

diff --git a/cmd/fs_mgmt/include/fs_mgmt/fs_mgmt.h 
b/cmd/fs_mgmt/include/fs_mgmt/fs_mgmt.h
new file mode 100644
index 000..38173fd
--- /dev/null
+++ b/cmd/fs_mgmt/include/fs_mgmt/fs_mgmt.h
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+#ifndef H_FS_MGMT_
+#define H_FS_MGMT_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Command IDs for file system management group.
+ */
+#define FS_MGMT_ID_FILE 0
+
+/**
+ * @brief Registers the file system management command handler group.
+ */ 
+void fs_mgmt_register_group(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/cmd/fs_mgmt/include/fs_mgmt/fs_mgmt_impl.h 
b/cmd/fs_mgmt/include/fs_mgmt/fs_mgmt_impl.h
new file mode 100644
index 000..3cb30b8
--- /dev/null
+++ b/cmd/fs_mgmt/include/fs_mgmt/fs_mgmt_impl.h
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+/**
+ * @file
+ * @brief Declares implementation-specific functions required by file system
+ *management.  The default stubs can be overridden with functions that
+ *are compatible with the host OS.
+ */
+
+#ifndef H_FS_MGMT_IMPL_
+#define H_FS_MGMT_IMPL_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Retrieves the length of the file at the specified path.
+ *
+ * @param path  The path of the file to query.
+ * @param out_len   On success, the file length gets written here.
+ *
+ * @return  0 on success, MGMT_ERR_[...] code on failure.
+ */
+int fs_mgmt_impl_filelen(const char *path, size_t *out_len);
+
+/**
+ * @brief Reads the specified chunk of file data.
+ *
+ * @param path  The path of the file to read from.
+ * @param offsetThe byte offset to read from.
+ * @param len   The number of bytes to read.
+ * @param out_data  On success, the 

[mynewt-mcumgr] 24/42: smp_svr - fix build error when CONFIG_MDLOG unset.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 980c92484528ecba531961218f2453e19741b174
Author: Christopher Collins 
AuthorDate: Tue Jan 30 12:07:25 2018 -0800

smp_svr - fix build error when CONFIG_MDLOG unset.
---
 samples/smp_svr/zephyr/src/main.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index 7f5e9e6..2906711 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -153,7 +153,10 @@ void main(void)
 
 rc = init_fcb();
 assert(rc == 0);
+
+#ifdef CONFIG_REBOOT_LOG
 reboot_log_configure(_svr_log);
+#endif
 
 /* Register the built-in mcumgr command handlers. */
 #ifdef CONFIG_MCUMGR_CMD_FS_MGMT
@@ -180,8 +183,10 @@ void main(void)
 /* Initialize the Bluetooth mcumgr transport. */
 smp_bt_register();
 
+#ifdef CONFIG_MDLOG
 mdlog_register("smp_svr", _svr_log, _fcb_handler, _svr_fcb,
MDLOG_LEVEL_DEBUG);
+#endif
 
 /* The system work queue handles all incoming mcumgr requests.  Let the
  * main thread idle while the mcumgr server runs.

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 15/42: Fix some misnamed identifiers.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit a4d9248ffd41331d2966cd75762ae0b57c3447fc
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:46:06 2018 -0800

Fix some misnamed identifiers.
---
 cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c | 35 +-
 mgmt/include/mgmt/mgmt.h   | 16 ++--
 mgmt/src/mgmt.c| 14 +--
 3 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c 
b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
index dc71d8f..e17952b 100644
--- a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
+++ b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
@@ -29,14 +29,14 @@
 #include "img_mgmt/img_mgmt.h"
 #include "../../../src/img_mgmt_priv.h"
 
-static struct device *zephyr_img_flash_dev;
-static struct flash_img_context zephyr_img_flash_ctxt;
+static struct device *zephyr_img_mgmt_flash_dev;
+static struct flash_img_context zephyr_img_mgmt_flash_ctxt;
 
 /**
  * Determines if the specified area of flash is completely unwritten.
  */
 static int
-img_mgmt_impl_flash_check_empty(off_t offset, size_t size, bool *out_empty)
+zephyr_img_mgmt_flash_check_empty(off_t offset, size_t size, bool *out_empty)
 {
 uint32_t data[16];
 off_t addr;
@@ -55,7 +55,7 @@ img_mgmt_impl_flash_check_empty(off_t offset, size_t size, 
bool *out_empty)
 bytes_to_read = sizeof data;
 }
 
-rc = flash_read(zephyr_img_flash_dev, addr, data, bytes_to_read);
+rc = flash_read(zephyr_img_mgmt_flash_dev, addr, data, bytes_to_read);
 if (rc != 0) {
 return MGMT_ERR_EUNKNOWN;
 }
@@ -76,7 +76,7 @@ img_mgmt_impl_flash_check_empty(off_t offset, size_t size, 
bool *out_empty)
  * Converts an offset within an image slot to an absolute address.
  */
 static off_t
-img_mgmt_impl_abs_offset(int slot, off_t sub_offset)
+zephyr_img_mgmt_abs_offset(int slot, off_t sub_offset)
 {
 off_t slot_start;
 
@@ -104,9 +104,9 @@ img_mgmt_impl_erase_slot(void)
 bool empty;
 int rc;
 
-rc = img_mgmt_impl_flash_check_empty(FLASH_AREA_IMAGE_1_OFFSET,
- FLASH_AREA_IMAGE_1_SIZE,
- );
+rc = zephyr_img_mgmt_flash_check_empty(FLASH_AREA_IMAGE_1_OFFSET,
+   FLASH_AREA_IMAGE_1_SIZE,
+   );
 if (rc != 0) {
 return MGMT_ERR_EUNKNOWN;
 }
@@ -158,8 +158,8 @@ img_mgmt_impl_read(int slot, unsigned int offset, void *dst,
 off_t abs_offset;
 int rc;
 
-abs_offset = img_mgmt_impl_abs_offset(slot, offset);
-rc = flash_read(zephyr_img_flash_dev, abs_offset, dst, num_bytes);
+abs_offset = zephyr_img_mgmt_abs_offset(slot, offset);
+rc = flash_read(zephyr_img_mgmt_flash_dev, abs_offset, dst, num_bytes);
 if (rc != 0) {
 return MGMT_ERR_EUNKNOWN;
 }
@@ -174,18 +174,19 @@ img_mgmt_impl_write_image_data(unsigned int offset, const 
void *data,
 int rc;
 
 if (offset == 0) {
-flash_img_init(_img_flash_ctxt, zephyr_img_flash_dev);
+flash_img_init(_img_mgmt_flash_ctxt, zephyr_img_mgmt_flash_dev);
 }
 
 /* Cast away const. */
-rc = flash_img_buffered_write(_img_flash_ctxt, (void *)data,
+rc = flash_img_buffered_write(_img_mgmt_flash_ctxt, (void *)data,
   num_bytes, false);
 if (rc != 0) {
 return MGMT_ERR_EUNKNOWN;
 }
 
 if (last) {
-rc = flash_img_buffered_write(_img_flash_ctxt, NULL, 0, true);
+rc = flash_img_buffered_write(_img_mgmt_flash_ctxt,
+  NULL, 0, true);
 if (rc != 0) {
 return MGMT_ERR_EUNKNOWN;
 }
@@ -213,15 +214,15 @@ img_mgmt_impl_swap_type(void)
 }
 
 static int
-img_mgmt_impl_init(struct device *dev)
+zephyr_img_mgmt_init(struct device *dev)
 {
 ARG_UNUSED(dev);
 
-zephyr_img_flash_dev = device_get_binding(FLASH_DRIVER_NAME);
-if (zephyr_img_flash_dev == NULL) {
+zephyr_img_mgmt_flash_dev = device_get_binding(FLASH_DRIVER_NAME);
+if (zephyr_img_mgmt_flash_dev == NULL) {
 return -ENODEV;
 }
 return 0;
 }
 
-SYS_INIT(img_mgmt_impl_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
+SYS_INIT(zephyr_img_mgmt_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
diff --git a/mgmt/include/mgmt/mgmt.h b/mgmt/include/mgmt/mgmt.h
index 549fcdc..2762aa8 100644
--- a/mgmt/include/mgmt/mgmt.h
+++ b/mgmt/include/mgmt/mgmt.h
@@ -41,7 +41,7 @@ extern "C" {
 #define MGMT_GROUP_ID_IMAGE 1
 #define MGMT_GROUP_ID_STATS 2
 #define MGMT_GROUP_ID_CONFIG3
-#define MGMT_GROUP_ID_LOGS  4
+#define MGMT_GROUP_ID_LOG   4
 #define MGMT_GROUP_ID_CRASH 5
 #define 

[mynewt-mcumgr] 03/42: smp - The built-in transfer encoding.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 63d47c1811226e19b1ca9458cf969da86d9a5112
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:11:12 2018 -0800

smp - The built-in transfer encoding.

Simple management protocol.
---
 smp/CMakeLists.txt|   7 +
 smp/include/smp/smp.h |  91 
 smp/pkg.yml   |  40 ++
 smp/src/smp.c | 379 ++
 4 files changed, 517 insertions(+)

diff --git a/smp/CMakeLists.txt b/smp/CMakeLists.txt
new file mode 100644
index 000..74072ab
--- /dev/null
+++ b/smp/CMakeLists.txt
@@ -0,0 +1,7 @@
+target_include_directories(MCUMGR INTERFACE 
+include
+)
+
+zephyr_library_sources(
+smp/src/smp.c
+)
diff --git a/smp/include/smp/smp.h b/smp/include/smp/smp.h
new file mode 100644
index 000..7afa7ad
--- /dev/null
+++ b/smp/include/smp/smp.h
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+/**
+ * @file
+ * @brief SMP - Simple Management Protocol.
+ *
+ * SMP is a basic protocol that sits on top of the mgmt layer.  SMP requests
+ * and responses have the following format:
+ *
+ * [Offset 0]: Mgmt header
+ * [Offset 8]: CBOR map of command-specific key-value pairs.
+ *
+ * SMP request packets may contain multiple concatenated requests.  Each
+ * request must start at an offset that is a multiple of 4, so padding should
+ * be inserted between requests as necessary.  Requests are processed
+ * sequentially from the start of the packet to the end.  Each response is sent
+ * individually in its own packet.  If a request elicits an error response,
+ * processing of the packet is aborted.
+ */
+
+#ifndef H_SMP_
+#define H_SMP_
+
+#include "mgmt/mgmt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct smp_streamer;
+struct mgmt_hdr;
+
+/** @typedef smp_tx_rsp_fn
+ * @brief Transmits an SMP response packet.
+ *
+ * @param ssThe streamer to transmit via.
+ * @param buf   Buffer containing the response packet.
+ * @param arg   Optional streamer argument.
+ *
+ * @return  0 on success, MGMT_ERR_[...] code on failure.
+ */
+typedef int smp_tx_rsp_fn(struct smp_streamer *ss, void *buf, void *arg);
+
+/**
+ * @brief Decodes, encodes, and transmits SMP packets.
+ */
+struct smp_streamer {
+struct mgmt_streamer mgmt_stmr;
+smp_tx_rsp_fn *tx_rsp_cb;
+};
+
+/**
+ * @brief Processes a single SMP request packet and sends all corresponding
+ *responses.
+ *
+ * Processes all SMP requests in an incoming packet.  Requests are processed
+ * sequentially from the start of the packet to the end.  Each response is sent
+ * individually in its own packet.  If a request elicits an error response,
+ * processing of the packet is aborted.  This function consumes the supplied
+ * request buffer regardless of the outcome.
+ *
+ * @param streamer  The streamer providing the required SMP
+ *  callbacks.
+ * @param req   The request packet to process.
+ *
+ * @return  0 on success, MGMT_ERR_[...] code on failure.
+ */
+int smp_process_request_packet(struct smp_streamer *streamer, void *req);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H_SMP_ */
diff --git a/smp/pkg.yml b/smp/pkg.yml
new file mode 100644
index 000..b9fcc78
--- /dev/null
+++ b/smp/pkg.yml
@@ -0,0 +1,40 @@
+#
+# 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 

[mynewt-mcumgr] 32/42: smp_svr - Update zephyr port for compatibility.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit e6dc5b64af391c1db2282b00e48a9325cab8339c
Author: Christopher Collins 
AuthorDate: Thu Feb 8 15:05:09 2018 -0800

smp_svr - Update zephyr port for compatibility.
---
 samples/smp_svr/zephyr/prj.conf   | 6 ++
 samples/smp_svr/zephyr/src/main.c | 9 +
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/samples/smp_svr/zephyr/prj.conf b/samples/smp_svr/zephyr/prj.conf
index fc2f99c..9e04c3c 100644
--- a/samples/smp_svr/zephyr/prj.conf
+++ b/samples/smp_svr/zephyr/prj.conf
@@ -1,3 +1,6 @@
+# Enable mcumgr.
+CONFIG_MCUMGR=y
+
 # Some command handlers require a large stack.
 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
 
@@ -16,6 +19,9 @@ CONFIG_BT_RX_BUF_LEN=260
 CONFIG_MCUMGR_SMP_BT=y
 CONFIG_MCUMGR_SMP_SHELL=y
 
+# Enable flash operations.
+CONFIG_FLASH=y
+
 # Enable the NFFS file system.
 CONFIG_FILE_SYSTEM=y
 CONFIG_FILE_SYSTEM_NFFS=y
diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index 47e5de2..3e06e40 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -151,11 +151,10 @@ static int init_fcb(void)
 .f_version = MDLOG_VERSION,
 .f_sector_cnt = sector_cnt - 1,
 .f_scratch_cnt = 1,
-.f_area_id = 4,
 .f_sectors = sectors,
 };
 
-rc = fcb_init(_svr_fcb);
+rc = fcb_init(4, _svr_fcb);
 if (rc != 0) {
 return rc;
 }
@@ -168,7 +167,9 @@ void main(void)
 int rc;
 
 rc = init_fcb();
-assert(rc == 0);
+if (rc != 0) {
+printk("Failed to initialize FCB; rc=%d\n", rc);
+}
 
 #ifdef CONFIG_REBOOT_LOG
 reboot_log_configure(_svr_log);
@@ -205,7 +206,7 @@ void main(void)
 /* Initialize the Bluetooth mcumgr transport. */
 smp_bt_register();
 
-#ifdef CONFIG_MDLOG
+#if defined(CONFIG_MDLOG) && defined(CONFIG_FCB)
 mdlog_register("smp_svr", _svr_log, _fcb_handler, _svr_fcb,
MDLOG_LEVEL_DEBUG);
 #endif

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 07/42: cborattr library

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 1636f65725542693ed1d2941b58c6d6485ff055b
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:13:14 2018 -0800

cborattr library

This is used for parsing incoming mcumgr requests.  Destructures mcumgr
packets and populates corresponding field variables.

This comes from Apache Mynewt.
---
 cborattr/CMakeLists.txt|   7 +
 cborattr/include/cborattr/cborattr.h   | 153 
 cborattr/pkg.yml   |  29 ++
 cborattr/src/cborattr.c| 423 +
 cborattr/syscfg.yml|  24 ++
 cborattr/test/pkg.yml  |  30 ++
 cborattr/test/src/test_cborattr.c  |  49 +++
 cborattr/test/src/test_cborattr.h  |  57 +++
 cborattr/test/src/test_cborattr_utils.c|  35 ++
 cborattr/test/src/testcases/cborattr_decode1.c |  83 
 .../src/testcases/cborattr_decode_bool_array.c | 101 +
 .../test/src/testcases/cborattr_decode_int_array.c | 143 +++
 .../test/src/testcases/cborattr_decode_obj_array.c | 109 ++
 .../test/src/testcases/cborattr_decode_object.c| 198 ++
 .../src/testcases/cborattr_decode_object_array.c   | 126 ++
 .../test/src/testcases/cborattr_decode_partial.c   |  47 +++
 .../test/src/testcases/cborattr_decode_simple.c| 123 ++
 .../src/testcases/cborattr_decode_string_array.c   | 135 +++
 .../src/testcases/cborattr_decode_substring_key.c  | 111 ++
 .../src/testcases/cborattr_decode_unnamed_array.c  |  99 +
 20 files changed, 2082 insertions(+)

diff --git a/cborattr/CMakeLists.txt b/cborattr/CMakeLists.txt
new file mode 100644
index 000..2f22bd0
--- /dev/null
+++ b/cborattr/CMakeLists.txt
@@ -0,0 +1,7 @@
+target_include_directories(MCUMGR INTERFACE 
+include
+)
+
+zephyr_library_sources(
+cborattr/src/cborattr.c
+)
diff --git a/cborattr/include/cborattr/cborattr.h 
b/cborattr/include/cborattr/cborattr.h
new file mode 100644
index 000..1cc14b3
--- /dev/null
+++ b/cborattr/include/cborattr/cborattr.h
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ */
+
+
+#ifndef CBORATTR_H
+#define CBORATTR_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "cbor.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* This library wraps the tinycbor decoder with a attribute based decoder
+ * suitable for decoding a binary version of json.  Specifically, the
+ * contents of the cbor contains pairs of attributes.  where the attribute
+ * is a key/value pair.  keys are always text strings, but values can be
+ * many different things (enumerated below) */
+
+typedef enum CborAttrType {
+CborAttrIntegerType = 1,
+CborAttrUnsignedIntegerType,
+CborAttrByteStringType,
+CborAttrTextStringType,
+CborAttrBooleanType,
+CborAttrFloatType,
+CborAttrDoubleType,
+CborAttrArrayType,
+CborAttrObjectType,
+CborAttrStructObjectType,
+CborAttrNullType,
+} CborAttrType;
+
+struct cbor_attr_t;
+
+struct cbor_enum_t {
+char *name;
+long long int value;
+};
+
+struct cbor_array_t {
+CborAttrType element_type;
+union {
+struct {
+const struct cbor_attr_t *subtype;
+char *base;
+size_t stride;
+} objects;
+struct {
+char **ptrs;
+char *store;
+int storelen;
+} strings;
+struct {
+long long int *store;
+} integers;
+struct {
+long long unsigned int *store;
+} uintegers;
+struct {
+double *store;
+} reals;
+struct {
+bool *store;
+} booleans;
+} arr;
+int *count;
+int maxlen;
+};
+
+struct cbor_attr_t {
+char *attribute;
+CborAttrType type;
+union {
+long long int *integer;
+long long unsigned int *uinteger;
+double *real;
+float *fval;
+

[mynewt-mcumgr] 31/42: Zephyr port: move mcumgr location in zephyr.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 4ab4db676ab074cd8064d59eba35c3b5da1df444
Author: Christopher Collins 
AuthorDate: Thu Feb 8 15:24:24 2018 -0800

Zephyr port: move mcumgr location in zephyr.

`ext/mcumgr` --> `ext/lib/mgmt/mcumgr`
---
 Kconfig |  4 ++--
 cmd/Kconfig | 10 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Kconfig b/Kconfig
index 89de3ee..f0ce016 100644
--- a/Kconfig
+++ b/Kconfig
@@ -24,6 +24,6 @@ menuconfig MCUMGR
   This option enables the mcumgr management library.
 
 if MCUMGR
-source "ext/mcumgr/mgmt/port/zephyr/Kconfig"
-source "ext/mcumgr/cmd/Kconfig"
+source "ext/lib/mgmt/mcumgr/mgmt/port/zephyr/Kconfig"
+source "ext/lib/mgmt/mcumgr/cmd/Kconfig"
 endif
diff --git a/cmd/Kconfig b/cmd/Kconfig
index e404d2d..d26d382 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -17,10 +17,10 @@
 
 menu "Command handlers"
 
-source "ext/mcumgr/cmd/fs_mgmt/Kconfig"
-source "ext/mcumgr/cmd/img_mgmt/Kconfig"
-source "ext/mcumgr/cmd/log_mgmt/Kconfig"
-source "ext/mcumgr/cmd/os_mgmt/Kconfig"
-source "ext/mcumgr/cmd/stat_mgmt/Kconfig"
+source "ext/lib/mgmt/mcumgr/cmd/fs_mgmt/Kconfig"
+source "ext/lib/mgmt/mcumgr/cmd/img_mgmt/Kconfig"
+source "ext/lib/mgmt/mcumgr/cmd/log_mgmt/Kconfig"
+source "ext/lib/mgmt/mcumgr/cmd/os_mgmt/Kconfig"
+source "ext/lib/mgmt/mcumgr/cmd/stat_mgmt/Kconfig"
 
 endmenu

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 11/42: Sample app - smp_svr

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 22bba90da5c1909663581eedd691d0bed2ed07c3
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:18:13 2018 -0800

Sample app - smp_svr
---
 samples/smp_svr/README.md |  64 +++
 samples/smp_svr/mynewt/pkg.yml|  43 +
 samples/smp_svr/mynewt/src/main.c | 320 ++
 samples/smp_svr/mynewt/syscfg.yml |  39 +
 samples/smp_svr/zephyr/CMakeLists.txt |  42 +
 samples/smp_svr/zephyr/README.rst |  41 +
 samples/smp_svr/zephyr/dts.overlay|  13 ++
 samples/smp_svr/zephyr/prj.conf   |  30 
 samples/smp_svr/zephyr/src/main.c | 108 
 9 files changed, 700 insertions(+)

diff --git a/samples/smp_svr/README.md b/samples/smp_svr/README.md
new file mode 100644
index 000..cb9d3e7
--- /dev/null
+++ b/samples/smp_svr/README.md
@@ -0,0 +1,64 @@
+# smp_svr
+
+This sample application implements a simple SMP server with the following
+transports:
+* Shell
+* Bluetooth
+
+`smp_svr` enables support for the following command groups:
+* fs_mgmt
+* img_mgmt
+* os_mgmt
+
+## Mynewt
+
+The Mynewt port of `smp_svr` is a regular Mynewt app.  The below example uses 
the nRF52dk as the BSP, so you may need to adjust accordingly if you are using 
different hardware.
+
+0. Create a Mynewt project and upload the Apache mynewt boot loader to your
+board as described here: http://mynewt.apache.org/latest/os/tutorials/nRF52/
+
+1. Add the mcumgr repo to your `project.yml` file:
+
+```
+repository.mynewt-mcumgr:
+type: git
+vers: 0-latest
+url: 'g...@github.com:apache/mynewt-mcumgr.git'
+```
+
+2. Create a target that ties the `smp_svr` app to your BSP of choice (nRF52dk 
in this example):
+
+```
+$ newt target create smp_svr-nrf52dk
+$ newt target set smp_svr-nrf52dk app=@mynewt-mcumgr/samples/smp_svr/apache \
+  bsp=@apache-mynewt-core/hw/bsp/nrf52dk\
+  build_profile=debug
+```
+
+3. Build, upload, and run the application on your board:
+
+```
+$ newt run smp_svr-nrf52dk
+```
+
+## Zephyr
+
+The Zephyr port of `smp_svr` is configured to run on an nRF52 MCU.  The
+application should build and run for other platforms without modification, but
+the file system management commands will not work.  To enable file system
+management for a different platform, adjust the `CONFIG_FS_NFFS_FLASH_DEV_NAME`
+setting in `prj.conf` accordingly.
+
+In addition, the MCUBoot boot loader (https://github.com/runtimeco/mcuboot) is
+required for img_mgmt to function properly.
+
+### Building
+
+The Zephyr port of `smp_svr` can be built using the usual procedure:
+
+```
+$ cd samples/smp_svr/zephyr
+$ mkdir build && cd build
+$ cmake -DBOARD= ..
+$ make
+```
diff --git a/samples/smp_svr/mynewt/pkg.yml b/samples/smp_svr/mynewt/pkg.yml
new file mode 100644
index 000..83d38d5
--- /dev/null
+++ b/samples/smp_svr/mynewt/pkg.yml
@@ -0,0 +1,43 @@
+# 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: samples/smp_svr/mynewt
+pkg.type: app
+pkg.description: Simple BLE peripheral running an mcumgr SMP server.
+pkg.author: "Apache Mynewt "
+pkg.homepage: "http://mynewt.apache.org/;
+pkg.keywords:
+
+pkg.deps: 
+- '@apache-mynewt-core/boot/bootutil'
+- '@apache-mynewt-core/mgmt/newtmgr/transport/ble'
+- '@apache-mynewt-core/mgmt/newtmgr/transport/nmgr_shell'
+- '@apache-mynewt-core/net/nimble/controller'
+- '@apache-mynewt-core/net/nimble/host'
+- '@apache-mynewt-core/net/nimble/host/services/ans'
+- '@apache-mynewt-core/net/nimble/host/services/gap'
+- '@apache-mynewt-core/net/nimble/host/services/gatt'
+- '@apache-mynewt-core/net/nimble/host/store/config'
+- '@apache-mynewt-core/net/nimble/transport/ram'
+- '@apache-mynewt-core/sys/console/full'
+- '@apache-mynewt-core/sys/log/full'
+- '@apache-mynewt-core/sys/stats/full'
+- '@mynewt-mcumgr/cmd/fs_mgmt'
+- '@mynewt-mcumgr/cmd/img_mgmt'
+- '@mynewt-mcumgr/cmd/os_mgmt'
+- 

[mynewt-mcumgr] 12/42: Remove extraneous README.rst file.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit db04a3084835b6593d7784ba6c0964904d2a66c8
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:44:11 2018 -0800

Remove extraneous README.rst file.

This file belongs to the "Hello World" sample app in the Zephyr
repository.
---
 samples/smp_svr/zephyr/README.rst | 41 ---
 1 file changed, 41 deletions(-)

diff --git a/samples/smp_svr/zephyr/README.rst 
b/samples/smp_svr/zephyr/README.rst
deleted file mode 100644
index 00218b0..000
--- a/samples/smp_svr/zephyr/README.rst
+++ /dev/null
@@ -1,41 +0,0 @@
-.. _hello_world:
-
-Hello World
-###
-
-Overview
-
-A simple Hello World example that can be used with any supported board and
-prints 'Hello World' to the console. This application can be built into modes:
-
-* single thread
-* multi threading
-
-Building and Running
-
-
-This project outputs 'Hello World' to the console.  It can be built and 
executed
-on QEMU as follows:
-
-.. zephyr-app-commands::
-   :zephyr-app: samples/hello_world
-   :board: qemu_x86
-   :goals: run
-   :compact:
-
-To build the single thread version, use the supplied configuration file for
-single thread: :file:`prj_single.conf`:
-
-.. zephyr-app-commands::
-   :zephyr-app: samples/hello_world
-   :board: qemu_x86
-   :conf: prj_single.conf
-   :goals: run
-   :compact:
-
-Sample Output
-=
-
-.. code-block:: console
-
-Hello World! x86

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 02/42: mgmt - Code implementing the core `mgmt` layer.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit b9e2cf860399324c848692f8ef5cd8d61407213f
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:11:06 2018 -0800

mgmt - Code implementing the core `mgmt` layer.

The core of mcumgr; facilitates the passing of requests and responses
between the generic command handlers and the concrete transports and
transfer encodings.
---
 mgmt/CMakeLists.txt|   8 +
 mgmt/include/mgmt/endian.h |  58 +++
 mgmt/include/mgmt/mgmt.h   | 388 +
 mgmt/pkg.yml   |  29 
 mgmt/src/mgmt.c| 170 
 mgmt/syscfg.yml|  18 +++
 6 files changed, 671 insertions(+)

diff --git a/mgmt/CMakeLists.txt b/mgmt/CMakeLists.txt
new file mode 100644
index 000..ffce8a5
--- /dev/null
+++ b/mgmt/CMakeLists.txt
@@ -0,0 +1,8 @@
+target_include_directories(MCUMGR INTERFACE 
+include
+port/zephyr/include
+)
+
+zephyr_library_sources(
+mgmt/src/mgmt.c
+)
diff --git a/mgmt/include/mgmt/endian.h b/mgmt/include/mgmt/endian.h
new file mode 100644
index 000..ad9bd34
--- /dev/null
+++ b/mgmt/include/mgmt/endian.h
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+#ifndef H_MGMT_ENDIAN_
+#define H_MGMT_ENDIAN_
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+
+#ifndef ntohs
+#define ntohs(x) (x)
+#endif
+
+#ifndef htons
+#define htons(x) (x)
+#endif
+
+#else
+/* Little endian. */
+
+#ifndef ntohs
+#define ntohs(x)   ((uint16_t)  \
+x) & 0xff00) >> 8) |\
+ (((x) & 0x00ff) << 8)))
+#endif
+
+#ifndef htons
+#define htons(x) (ntohs(x))
+#endif
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mgmt/include/mgmt/mgmt.h b/mgmt/include/mgmt/mgmt.h
new file mode 100644
index 000..549fcdc
--- /dev/null
+++ b/mgmt/include/mgmt/mgmt.h
@@ -0,0 +1,388 @@
+/*
+ * 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.
+ */
+
+#ifndef H_MGMT_MGMT_
+#define H_MGMT_MGMT_
+
+#include 
+#include "cbor.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Opcodes; encoded in first byte of header. */
+#define MGMT_OP_READ0
+#define MGMT_OP_READ_RSP1
+#define MGMT_OP_WRITE   2
+#define MGMT_OP_WRITE_RSP   3
+
+/**
+ * The first 64 groups are reserved for system level mcumgr commands.
+ * Per-user commands are then defined after group 64.
+ */
+#define MGMT_GROUP_ID_OS0
+#define MGMT_GROUP_ID_IMAGE 1
+#define MGMT_GROUP_ID_STATS 2
+#define MGMT_GROUP_ID_CONFIG3
+#define MGMT_GROUP_ID_LOGS  4
+#define MGMT_GROUP_ID_CRASH 5
+#define MGMT_GROUP_ID_SPLIT 6
+#define MGMT_GROUP_ID_RUN   7
+#define MGMT_GROUP_ID_FS8
+#define MGMT_GROUP_ID_PERUSER   64
+
+/**
+ * mcumgr error codes.
+ */
+#define MGMT_ERR_EOK0
+#define MGMT_ERR_EUNKNOWN   1
+#define MGMT_ERR_ENOMEM 2
+#define MGMT_ERR_EINVAL 3
+#define MGMT_ERR_ETIMEOUT   4
+#define MGMT_ERR_ENOENT 5
+#define MGMT_ERR_EBADSTATE  6   /* Current state disallows command. */
+#define MGMT_ERR_EMSGSIZE   7   /* Response too large. */
+#define MGMT_ERR_ENOTSUP8   /* Command not supported. */
+#define MGMT_ERR_EPERUSER   256
+
+#define 

[mynewt-mcumgr] 33/42: Readme.md: Fix bad links in file README.md

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 80fc49927636f6c66179c553277bebe609563053
Author: Ding Tao 
AuthorDate: Fri Feb 9 17:39:54 2018 +0800

Readme.md: Fix bad links in file README.md

Replace "mcumgr" with "mynewt-mcumgr".

Signed-off-by: Ding Tao 
---
 README.md | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index 4726883..cad3514 100644
--- a/README.md
+++ b/README.md
@@ -124,12 +124,12 @@ Information and documentation for mcumgr is stored within 
the source.
 
 For more information in the source, here are some pointers:
 
-- [cborattr](https://github.com/apache/mcumgr/tree/master/cborattr): Used for 
parsing incoming mcumgr requests.  Destructures mcumgr packets and populates 
corresponding field variables.
-- [cmd](https://github.com/apache/mcumgr/tree/master/cmd): Built-in command 
handlers for the core mcumgr commands.
-- [ext](https://github.com/apache/mcumgr/tree/master/ext): Third-party 
libraries that mcumgr depends on.
-- [mgmt](https://github.com/apache/mcumgr/tree/master/mgmt): Code implementing 
the `mgmt` layer of mcumgr.
-- [samples](https://github.com/apache/mcumgr/tree/master/samples): Sample 
applications utilizing mcumgr.
-- [smp](https://github.com/apache/mcumgr/tree/master/smp): The built-in 
transfer encoding: Simple management protocol.
+- [cborattr](https://github.com/apache/mynewt-mcumgr/tree/master/cborattr): 
Used for parsing incoming mcumgr requests.  Destructures mcumgr packets and 
populates corresponding field variables.
+- [cmd](https://github.com/apache/mynewt-mcumgr/tree/master/cmd): Built-in 
command handlers for the core mcumgr commands.
+- [ext](https://github.com/apache/mynewt-mcumgr/tree/master/ext): Third-party 
libraries that mcumgr depends on.
+- [mgmt](https://github.com/apache/mynewt-mcumgr/tree/master/mgmt): Code 
implementing the `mgmt` layer of mcumgr.
+- [samples](https://github.com/apache/mynewt-mcumgr/tree/master/samples): 
Sample applications utilizing mcumgr.
+- [smp](https://github.com/apache/mynewt-mcumgr/tree/master/smp): The built-in 
transfer encoding: Simple management protocol.
 
 ## Joining
 

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 41/42: Remove base64 library.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 785fe1a7680605755753f9cc97405d345c6ded0e
Author: Christopher Collins 
AuthorDate: Fri Feb 9 13:59:49 2018 -0800

Remove base64 library.

The application code is expected to provide its own base64 library.
---
 CMakeLists.txt   |   2 -
 ext/CMakeLists.txt   |   1 -
 ext/base64/CMakeLists.txt|  17 ---
 ext/base64/include/base64/base64.h   |  40 ---
 ext/base64/include/base64/hex.h  |  33 --
 ext/base64/pkg.yml   |  26 -
 ext/base64/src/base64.c  | 181 ---
 ext/base64/src/hex.c | 101 -
 ext/base64/test/pkg.yml  |  30 -
 ext/base64/test/src/encoding_test.c  |  53 -
 ext/base64/test/src/encoding_test_priv.h |  38 ---
 ext/base64/test/src/testcases/hex2str.c  |  64 ---
 ext/base64/test/src/testcases/str2hex.c  |  72 
 samples/smp_svr/zephyr/CMakeLists.txt|   1 +
 14 files changed, 1 insertion(+), 658 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4225f3e..b88b4ac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,6 @@ add_library(MCUMGR INTERFACE)
 zephyr_library()
 add_subdirectory(cborattr)
 add_subdirectory(cmd)
-add_subdirectory(ext)
 add_subdirectory(mgmt)
 add_subdirectory(smp)
 
@@ -11,6 +10,5 @@ zephyr_library_link_libraries(MCUMGR)
 
 target_link_libraries(MCUMGR INTERFACE
   zephyr_interface
-  BASE64
   TINYCBOR
   )
diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt
deleted file mode 100644
index f453a03..000
--- a/ext/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_subdirectory(base64)
diff --git a/ext/base64/CMakeLists.txt b/ext/base64/CMakeLists.txt
deleted file mode 100644
index 101985e..000
--- a/ext/base64/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-add_library(BASE64 INTERFACE)
-
-target_include_directories(BASE64 INTERFACE src)
-
-zephyr_library()
-target_include_directories(BASE64 INTERFACE
-include
-port/zephyr/include
-)
-
-zephyr_library_sources(
-src/base64.c
-src/hex.c
-)
-
-zephyr_library_link_libraries(BASE64)
-target_link_libraries(BASE64 INTERFACE zephyr_interface)
diff --git a/ext/base64/include/base64/base64.h 
b/ext/base64/include/base64/base64.h
deleted file mode 100644
index 53c4853..000
--- a/ext/base64/include/base64/base64.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-#ifndef __UTIL_BASE64_H
-#define __UTIL_BASE64_H
-
-#include 
-#include 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int base64_encode(const void *, int, char *, uint8_t);
-int base64_decode(const char *, void *buf);
-int base64_pad(char *, int);
-int base64_decode_len(const char *str);
-
-#define BASE64_ENCODE_SIZE(__size) (__size) - 1) / 3) * 4) + 4)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __UTIL_BASE64_H__ */
diff --git a/ext/base64/include/base64/hex.h b/ext/base64/include/base64/hex.h
deleted file mode 100644
index 8ebae77..000
--- a/ext/base64/include/base64/hex.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-#ifndef _UTIL_HEX_H_
-#define _UTIL_HEX_H_
-
-#ifdef __cplusplus
-extern 

[mynewt-mcumgr] branch master updated (3c0c033 -> 44e3500)

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git.


 discard 3c0c033  Merge pull request #1 from miyatsu/readme-fix-2018-02-09
omit 2df71ec  Readme.md: Fix bad links in file README.md
omit bfd56c3  smp_svr - Update zephyr port for compatibility.
omit a989cc9  Zephyr port: move mcumgr location in zephyr.
omit 6629d1c  zephyr img_mgmt: Use `FLASH_DEV_NAME`
omit 0921e38  Remove local tinycbor copy.
omit 9dfb177  Correct "MCUboot" spelling in documentation.
omit b15ecf9  smp_svr - Use CONFIG_BOOTLOADER_MCUBOOT setting.
omit 3390a3a  smp_svr - Add statistics.
omit 00bf1b8  stat_mgmt command handler group.
omit ee62327  smp_svr - fix build error when CONFIG_MDLOG unset.
omit 1124271  smp_svr - Allow both CONFIG_FCB and CONFIG_FS_NFFS
omit 90c5cfd  Minor code cleanup.
omit 89ee0f5  Add doxygen comments for log_mgmt.
omit e93bd66  Update documentation.
omit 2ee9695  smp_svr Mynewt sample app - Remove redundant dep.
omit 6c0dd9f  Add log_mgmt support to smp_svr sample app.
omit e5fcfd6  log_mgmt command handler group.
omit 7f40df2  Reboot in system workqueue, not ISR.
omit 1a1e227  Fix some misnamed identifiers.
omit a4f1ba0  Add missing license text.
omit 1ea9adb  Make MCUMGR_CMD_FS_MGMT depend on FILE_SYSTEM.
omit 7e83bda  Remove extraneous README.rst file.
omit 7c761c0  Sample app - smp_svr
omit 373dcb1  Documentation.
omit 1da5b49  Mynewt support.
omit e5ec685  Zephyr support.
omit b3b7c5e  cborattr library
omit 83a7483  OS-agnostic command handlers: fs, img, os.
omit a1a98c1  External tinycbor library.
omit 17ecb23  External base64 library.
omit 0f10b53  smp - The built-in transfer encoding.
omit 9f3757c  mgmt - Code implementing the core `mgmt` layer.
omit 6683426  Initial commit.
 new 9eee2c6  Initial commit.
 new b9e2cf8  mgmt - Code implementing the core `mgmt` layer.
 new 63d47c1  smp - The built-in transfer encoding.
 new 9417697  External base64 library.
 new 42b2816  External tinycbor library.
 new 4355617  OS-agnostic command handlers: fs, img, os.
 new 1636f65  cborattr library
 new cfe132e  Zephyr support.
 new 6974956  Mynewt support.
 new 5515138  Documentation.
 new 22bba90  Sample app - smp_svr
 new db04a30  Remove extraneous README.rst file.
 new ad113bc  Make MCUMGR_CMD_FS_MGMT depend on FILE_SYSTEM.
 new 4df50f7  Add missing license text.
 new a4d9248  Fix some misnamed identifiers.
 new 80e46f3  Reboot in system workqueue, not ISR.
 new afdb047  log_mgmt command handler group.
 new d9131d6  Add log_mgmt support to smp_svr sample app.
 new b5c74b5  smp_svr Mynewt sample app - Remove redundant dep.
 new a6898ca  Update documentation.
 new f43f1df  Add doxygen comments for log_mgmt.
 new 4b601ef  Minor code cleanup.
 new af277cf  smp_svr - Allow both CONFIG_FCB and CONFIG_FS_NFFS
 new 980c924  smp_svr - fix build error when CONFIG_MDLOG unset.
 new 7bdec14  stat_mgmt command handler group.
 new e86e83f  smp_svr - Add statistics.
 new ffdecf8  smp_svr - Use CONFIG_BOOTLOADER_MCUBOOT setting.
 new e4db21b  Correct "MCUboot" spelling in documentation.
 new d69cfa3  Remove local tinycbor copy.
 new fec5444  zephyr img_mgmt: Use `FLASH_DEV_NAME`
 new 4ab4db6  Zephyr port: move mcumgr location in zephyr.
 new e6dc5b6  smp_svr - Update zephyr port for compatibility.
 new 80fc499  Readme.md: Fix bad links in file README.md
 new 4a72306  mcumgr: Minor refactor to increase readability
 new 490f44f  Indicate units (bytes) in Kconfig help.
 new 821f578  Remove "zephyr,code_partition" from dts overlay
 new 9b45fbc  fs_mgmt - Surround macro definition with ().
 new 75c5f1a  smp_svr/CMakeLists.txt: remove set_conf_file macro
 new 6e77227  smp_svr/CMakeLists.txt: remove FROM_WHO variable
 new 1aca722  Zephyr: use <> for non-relative include paths.
 new 785fe1a  Remove base64 library.
 new 44e3500  smp_svr (zephyr) - CONFIG_NET_BUF_USER_DATA_SIZE=7

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (3c0c033)
\
 N -- N -- N   refs/heads/master (44e3500)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 42 revisions listed above as "new" are entirely new to 

[mynewt-mcumgr] 21/42: Add doxygen comments for log_mgmt.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit f43f1dfd613dba87a8bfbe0b12374958964a434d
Author: Christopher Collins 
AuthorDate: Tue Jan 30 11:40:38 2018 -0800

Add doxygen comments for log_mgmt.
---
 cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h | 72 +++
 1 file changed, 72 insertions(+)

diff --git a/cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h 
b/cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h
index 1890643..b3f6b12 100644
--- a/cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h
+++ b/cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h
@@ -17,6 +17,13 @@
  * under the License.
  */
 
+/**
+ * @file
+ * @brief Declares implementation-specific functions required by log
+ *management.  The default stubs can be overridden with functions that
+ *are compatible with the host OS.
+ */
+
 #ifndef H_LOG_MGMT_IMPL_
 #define H_LOG_MGMT_IMPL_
 
@@ -31,14 +38,79 @@ struct log_mgmt_log;
 typedef int log_mgmt_foreach_entry_fn(const struct log_mgmt_entry *entry,
   void *arg);
 
+/**
+ * @brief Retrieves the log at the specified index.
+ *
+ * @param idx   The index of the log to retrieve.
+ * @param out_name  On success, the requested log gets written
+ *   here.
+ *
+ * @return  0 on success;
+ *  MGMT_ERR_ENOENT if no log with the specified
+ *  index exists;
+ *  Other MGMT_ERR_[...] code on failure.
+ */
 int log_mgmt_impl_get_log(int idx, struct log_mgmt_log *out_log);
+
+/**
+ * @brief Retrieves the name of log module at the specified index.
+ *
+ * @param idx   The index of the log module to retrieve.
+ * @param out_name  On success, the requested module's name gets
+ *  written here.
+ *
+ * @return  0 on success;
+ *  MGMT_ERR_ENOENT if no log module with the
+ *  specified index exists;
+ *  Other MGMT_ERR_[...] code on failure.
+ */
 int log_mgmt_impl_get_module(int idx, const char **out_module_name);
+
+/**
+ * @brief Retrieves the name of log level at the specified index.
+ *
+ * @param idx   The index of the log level to retrieve.
+ * @param out_name  On success, the requested level's name gets
+ *  written here.
+ *
+ * @return  0 on success;
+ *  MGMT_ERR_ENOENT if no log level with the
+ *  specified index exists;
+ *  Other MGMT_ERR_[...] code on failure.
+ */
 int log_mgmt_impl_get_level(int idx, const char **out_level_name);
+
+/**
+ * @brief Retrieves the index that the next log entry will use.
+ *
+ * @param out_idx   On success, the next index gets written here.
+ *
+ * @return  0 on success; MGMT_ERR_[...] code on failure.
+ */
 int log_mgmt_impl_get_next_idx(uint32_t *out_idx);
+
+/**
+ * @brief Applies a function to every matching entry in the specified log.
+ *
+ * @param log_name  The name of the log to operate on.
+ * @param filterSpecifies which log entries to operate on.
+ * @param cbThe callback to apply to each log entry.
+ * @param arg   An optional argument to pass to the callback.
+ *
+ * @return  0 on success; MGMT_ERR_[...] code on failure.
+ */
 int log_mgmt_impl_foreach_entry(const char *log_name,
 const struct log_mgmt_filter *filter,
 log_mgmt_foreach_entry_fn *cb,
 void *arg);
+
+/**
+ * @brief Clear the log with the specified name.
+ *
+ * @param log_name  The name of the log to clear.
+ *
+ * @return  0 on success; MGMT_ERR_[...] code on failure.
+ */
 int log_mgmt_impl_clear(const char *log_name);
 
 #ifdef __cplusplus

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 20/42: Update documentation.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit a6898ca6cb274fbb0e05f85b8d65e1cd415e0ed8
Author: Christopher Collins 
AuthorDate: Fri Jan 26 17:58:38 2018 -0800

Update documentation.
---
 README-mynewt.md | 31 +++
 README-zephyr.md | 30 ++
 README.md| 29 +
 3 files changed, 82 insertions(+), 8 deletions(-)

diff --git a/README-mynewt.md b/README-mynewt.md
new file mode 100644
index 000..9e65ea8
--- /dev/null
+++ b/README-mynewt.md
@@ -0,0 +1,31 @@
+## Building and using mcumgr with Apache Mynewt
+
+NOTE: The *mcumgr* library consists of functionality that is already present in
+the `apache-mynewt-core` repo.  There is currently no need to use the external
+*mcumgr* library with Mynewt, as the functionality is already built in to the
+OS.  To use this library with a Mynewt application, you will need to remove the
+duplicate functionality from your copy of the `apache-mynewt-core` repo.
+
+### Configuration
+
+To use *mcumgr*, your Mynewt app needs to be configured to use:
+1. An mcumgr transfer encoding
+2. An mcumgr transport
+3. (optional) Command handlers.
+
+This is done by adding the necessary dependencies to your app or target.  The 
following list of dependencies adds support for the SMP transfer encoding, the 
Bluetooth and shell transports, and all the built-in command handlers:
+
+```
+- '@apache-mynewt-core/mgmt/newtmgr/transport/ble'
+- '@apache-mynewt-core/mgmt/newtmgr/transport/nmgr_shell'
+- '@mynewt-mcumgr/cmd/fs_mgmt'
+- '@mynewt-mcumgr/cmd/img_mgmt'
+- '@mynewt-mcumgr/cmd/os_mgmt'
+- '@mynewt-mcumgr/smp'
+```
+
+For an example of an app that uses mcumgr, see the `smp_svr` sample app in 
`samples/smp_svr/mynewt`.
+
+### Building
+
+With the necessary dependencies in place, your project can be built using the 
usual `newt build ` or `newt run `
diff --git a/README-zephyr.md b/README-zephyr.md
new file mode 100644
index 000..b808a2f
--- /dev/null
+++ b/README-zephyr.md
@@ -0,0 +1,30 @@
+## Building and using mcumgr with Zephyr
+
+### Configuration
+
+The `samples/smp_svr/zephyr/prj.conf` file provides a good starting point for
+configuring an application to use *mcumgr*.  The major configuration settings
+are described below:
+
+| Setting   | Description   | Default |
+| - | - | --- |
+| `CONFIG_MCUMGR` | Enable the mcumgr management library. | n |
+| `CONFIG_MCUMGR_CMD_FS_MGMT` | Enable mcumgr handlers for file management | n 
|
+| `CONFIG_MCUMGR_CMD_IMG_MGMT` | Enable mcumgr handlers for image management | 
n |
+| `CONFIG_MCUMGR_CMD_LOG_MGMT` | Enable mcumgr handlers for log management | n 
|
+| `CONFIG_MCUMGR_CMD_OS_MGMT` | Enable mcumgr handlers for OS management | n |
+
+### Building
+
+Your application must specify mcumgr as a link-time dependency.  This is done
+by adding the following to your application's `CMakeLists.txt` file:
+
+```
+zephyr_link_libraries(
+MCUMGR
+)
+```
+
+### Known issues
+
+If the Bluetooth stack runs out of ACL transmit buffers while a large mcumgr 
response is being sent, the buffers never get freed.  This appears to trigger a 
net_buf leak in the stack.
diff --git a/README.md b/README.md
index 12141dc..bbe0016 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,20 @@ mcumgr is operating system and hardware independent.  It 
relies on hardware
 porting layers from the operating system it runs on.  Currently, mcumgr runs on
 both the Apache Mynewt and Zephyr operating systems.
 
+## Getting started
+
+For tips on using mcumgr with your particular OS, see the appropriate file from
+the list below:
+
+* README-mynewt.md
+* README-zephyr.md
+
+## Dependencies
+
+To use mcumgr's image management support, your device must be running the
+MCUBoot boot loader (https://github.com/runtimeco/mcuboot).  The other mcumgr
+features do not require MCUboot.
+
 ## Command line tool
 
 The `mcumgr` command line tool is available at:
@@ -52,6 +66,7 @@ As an example, the sample application `smp_svr` uses the 
following components:
 * Command handlers:
 * Image management (`img_mgmt`)
 * File system management (`fs_mgmt`)
+* Log management (`log_mgmt`)
 * OS management (`os_mgmt`)
 * Transfer/Transports protocols:
 * SMP/Bluetooth
@@ -60,9 +75,9 @@ As an example, the sample application `smp_svr` uses the 
following components:
 yielding the following stack diagram:
 
 ```
-+--+--+-+
-|   img_mgmt   |   fs_mgmt|   os_mgmt   |
-+--+--+-+
++--+--+--+--+
+| img_mgmt |  fs_mgmt | log_mgmt |  os_mgmt |
++--+--+--+--+
 |   mgmt|
 +-+-+

[mynewt-mcumgr] 39/42: smp_svr/CMakeLists.txt: remove FROM_WHO variable

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 6e7722722ed385c113f669e3435e91efbd581fdc
Author: Christopher Collins 
AuthorDate: Mon Feb 12 13:17:48 2018 -0800

smp_svr/CMakeLists.txt: remove FROM_WHO variable

This variable is unnecessary.  It was a leftover from the original
CMakeLists.txt file used as a template.
---
 samples/smp_svr/zephyr/CMakeLists.txt | 5 -
 1 file changed, 5 deletions(-)

diff --git a/samples/smp_svr/zephyr/CMakeLists.txt 
b/samples/smp_svr/zephyr/CMakeLists.txt
index 7765cb4..612b436 100644
--- a/samples/smp_svr/zephyr/CMakeLists.txt
+++ b/samples/smp_svr/zephyr/CMakeLists.txt
@@ -19,11 +19,6 @@ project(NONE)
 
 assert_exists(DTC_OVERLAY_FILE)
 
-# This string ends up getting printed in the device console
-if (NOT DEFINED FROM_WHO)
-  set(FROM_WHO Zephyr)
-endif()
-
 target_sources(app PRIVATE
 src/main.c
 )

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 22/42: Minor code cleanup.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 4b601efa12a3fee73a4afe7326bbd64cb09de557
Author: Christopher Collins 
AuthorDate: Tue Jan 30 11:47:12 2018 -0800

Minor code cleanup.
---
 cmd/log_mgmt/Kconfig  | 1 +
 cmd/log_mgmt/src/log_mgmt.c   | 4 ++--
 cmd/os_mgmt/include/os_mgmt/os_mgmt.h | 2 --
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/cmd/log_mgmt/Kconfig b/cmd/log_mgmt/Kconfig
index e949aa6..8b43166 100644
--- a/cmd/log_mgmt/Kconfig
+++ b/cmd/log_mgmt/Kconfig
@@ -18,6 +18,7 @@
 menuconfig MCUMGR_CMD_LOG_MGMT
 bool
 prompt "Enable mcumgr handlers for log management"
+depends on MDLOG
 default n
 help
   Enables mcumgr handlers for log management
diff --git a/cmd/log_mgmt/src/log_mgmt.c b/cmd/log_mgmt/src/log_mgmt.c
index 430f35a..a3c0cac 100644
--- a/cmd/log_mgmt/src/log_mgmt.c
+++ b/cmd/log_mgmt/src/log_mgmt.c
@@ -92,7 +92,7 @@ log_mgmt_encode_entry(CborEncoder *enc, const struct 
log_mgmt_entry *entry,
 }
 
 static int
-log_mgmt_walk_cb_encode(const struct log_mgmt_entry *entry, void *arg)
+log_mgmt_cb_encode(const struct log_mgmt_entry *entry, void *arg)
 {
 struct CborCntWriter cnt_writer;
 struct log_walk_ctxt *ctxt;
@@ -151,7 +151,7 @@ log_encode_entries(const struct log_mgmt_log *log, 
CborEncoder *enc,
 };
 
 rc = log_mgmt_impl_foreach_entry(log->name, ,
- log_mgmt_walk_cb_encode, );
+ log_mgmt_cb_encode, );
 if (rc != 0 && rc != MGMT_ERR_EMSGSIZE) {
 return rc;
 }
diff --git a/cmd/os_mgmt/include/os_mgmt/os_mgmt.h 
b/cmd/os_mgmt/include/os_mgmt/os_mgmt.h
index 493d227..0c85cbe 100644
--- a/cmd/os_mgmt/include/os_mgmt/os_mgmt.h
+++ b/cmd/os_mgmt/include/os_mgmt/os_mgmt.h
@@ -24,8 +24,6 @@
 extern "C" {
 #endif
 
-struct mgmt_ctxt;
-
 /**
  * Command IDs for OS management group.
  */

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 04/42: External base64 library.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 9417697c3e1c259a02edd98cf60a1c5bc38760c6
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:11:46 2018 -0800

External base64 library.
---
 ext/base64/CMakeLists.txt|  17 +++
 ext/base64/include/base64/base64.h   |  40 +++
 ext/base64/include/base64/hex.h  |  33 ++
 ext/base64/pkg.yml   |  26 +
 ext/base64/src/base64.c  | 181 +++
 ext/base64/src/hex.c | 101 +
 ext/base64/test/pkg.yml  |  30 +
 ext/base64/test/src/encoding_test.c  |  53 +
 ext/base64/test/src/encoding_test_priv.h |  38 +++
 ext/base64/test/src/testcases/hex2str.c  |  64 +++
 ext/base64/test/src/testcases/str2hex.c  |  72 
 11 files changed, 655 insertions(+)

diff --git a/ext/base64/CMakeLists.txt b/ext/base64/CMakeLists.txt
new file mode 100644
index 000..101985e
--- /dev/null
+++ b/ext/base64/CMakeLists.txt
@@ -0,0 +1,17 @@
+add_library(BASE64 INTERFACE)
+
+target_include_directories(BASE64 INTERFACE src)
+
+zephyr_library()
+target_include_directories(BASE64 INTERFACE
+include
+port/zephyr/include
+)
+
+zephyr_library_sources(
+src/base64.c
+src/hex.c
+)
+
+zephyr_library_link_libraries(BASE64)
+target_link_libraries(BASE64 INTERFACE zephyr_interface)
diff --git a/ext/base64/include/base64/base64.h 
b/ext/base64/include/base64/base64.h
new file mode 100644
index 000..53c4853
--- /dev/null
+++ b/ext/base64/include/base64/base64.h
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+#ifndef __UTIL_BASE64_H
+#define __UTIL_BASE64_H
+
+#include 
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int base64_encode(const void *, int, char *, uint8_t);
+int base64_decode(const char *, void *buf);
+int base64_pad(char *, int);
+int base64_decode_len(const char *str);
+
+#define BASE64_ENCODE_SIZE(__size) (__size) - 1) / 3) * 4) + 4)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UTIL_BASE64_H__ */
diff --git a/ext/base64/include/base64/hex.h b/ext/base64/include/base64/hex.h
new file mode 100644
index 000..8ebae77
--- /dev/null
+++ b/ext/base64/include/base64/hex.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+#ifndef _UTIL_HEX_H_
+#define _UTIL_HEX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *hex_format(void *src_v, int src_len, char *dst, int dst_len);
+int hex_parse(const char *src, int src_len, void *dst_v, int dst_len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _UTIL_HEX_H_ */
diff --git a/ext/base64/pkg.yml b/ext/base64/pkg.yml
new file mode 100644
index 000..5ebb1b3
--- /dev/null
+++ b/ext/base64/pkg.yml
@@ -0,0 +1,26 @@
+#
+# 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 

[mynewt-mcumgr] 10/42: Documentation.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 5515138c01a910eaeaf67aff89d0ca2f3c1dbcac
Author: Christopher Collins 
AuthorDate: Wed Jan 17 17:16:10 2018 -0800

Documentation.
---
 README.md  | 126 -
 transport/smp-bluetooth.md |  50 ++
 transport/smp-console.md   |  56 
 3 files changed, 231 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 3a9710e..12141dc 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,125 @@
-# mynewt-mcumgr
+# mcumgr
+
+This is mcumgr, version 0.0.1
+
+mcumgr is a management library for 32-bit MCUs.   The goal of mcumgr is to
+define a common management infrastructure with pluggable transport and encoding
+components.  In addition, mcumgr provides definitions and handlers for some
+core commands: image management, file system management, and OS managment.
+
+mcumgr is operating system and hardware independent.  It relies on hardware
+porting layers from the operating system it runs on.  Currently, mcumgr runs on
+both the Apache Mynewt and Zephyr operating systems.
+
+## Command line tool
+
+The `mcumgr` command line tool is available at:
+https://github.com/apache/mynewt-mcumgr-cli.  The tool is written in Go, and it
+is installed with the `go get` command:
+
+```
+$ go get github.com/apache/mynewt-mcumgr-cli/mcumgr
+```
+
+The `mcumgr` tool allows you to manage devices running an mcumgr server.
+
+## Architecture
+
+The mcumgr stack has the following layout:
+
+```
++-+-+
+| |
++-+-+
+|   mgmt|
++-+-+
+| |
++-+-+
+|     |
++-+-+
+```
+
+Items enclosed in angled brackets represent generic components that can be 
plugged into mcumgr.  The items in this stack diagram are defined below:
+* *Command handler*: Processes incoming mcumgr requests and generates 
corresponding responses.  A command handler is associated with a single command 
type, defined by a (group ID, command ID) pair.
+* *mgmt*: The core of mcumgr; facilitates the passing of requests and 
responses between the generic command handlers and the concrete transports and 
transfer encodings.
+* *Transfer encoding*: Defines how mcumgr requests and responses are encoded 
on the wire.
+* *Transport*: Sends and receives mcumgr packets over a particular medium.
+
+Each transport is configured with a single transfer encoding.
+
+As an example, the sample application `smp_svr` uses the following components:
+
+* Command handlers:
+* Image management (`img_mgmt`)
+* File system management (`fs_mgmt`)
+* OS management (`os_mgmt`)
+* Transfer/Transports protocols:
+* SMP/Bluetooth
+* SMP/Shell
+
+yielding the following stack diagram:
+
+```
++--+--+-+
+|   img_mgmt   |   fs_mgmt|   os_mgmt   |
++--+--+-+
+|   mgmt|
++-+-+
+| SMP | SMP |
++-+-+
+|  Bluetooth  |Shell|
++-+-+
+```
+
+## Command definition
+
+An mcumgr request or response consists of the following two components:
+* mcumgr header
+* CBOR key-value map 
+
+How these two components are encoded and parsed depends on the transfer
+encoding used.
+
+The mcumgr header structure is defined in `mgmt/include/mgmt/mgmt.h` as
+`struct mgmt_hdr`.
+
+The contents of the CBOR key-value map are specified per command type.
+
+## Supported transfer encodings
+
+Mcumgr comes with one built-in transfer encoding: Simple Management Protocol 
(SMP).  SMP requests and responses have a very basic structure.  For details, 
see the comments at the top of `smp/include/smp/smp.h`.
+
+## Supported transports
+
+The mcumgr project defines two transports:
+* SMP/Console
+* SMP/Bluetooth
+
+Particulars of these transports are specified in the following documents:
+* SMP/Console: `transports/smp-console.md`
+* SMP/Bluetooth: `transports/smp-bluetooth.md`
+
+Implementations, being hardware- and OS-specified, are not included.
+
+## Browsing
+
+Information and documentation for mcumgr is stored within the source.
+
+For more information in the source, here are some pointers:
+
+- [cborattr](https://github.com/apache/mcumgr/tree/master/cborattr): Used for 
parsing incoming mcumgr requests.  Destructures mcumgr packets and populates 
corresponding field variables.
+- 

[mynewt-mcumgr] 16/42: Reboot in system workqueue, not ISR.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 80e46f31e2a09ff5257fa66372a209cf075cbb30
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:47:32 2018 -0800

Reboot in system workqueue, not ISR.
---
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c 
b/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
index 221da97..df996a8 100644
--- a/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
+++ b/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
@@ -26,10 +26,13 @@
 #include "os_mgmt/os_mgmt_impl.h"
 
 static void zephyr_os_mgmt_reset_cb(struct k_timer *timer);
+static void zephyr_os_mgmt_reset_work_handler(struct k_work *work);
 
 static K_TIMER_DEFINE(zephyr_os_mgmt_reset_timer,
   zephyr_os_mgmt_reset_cb, NULL);
 
+K_WORK_DEFINE(zephyr_os_mgmt_reset_work, zephyr_os_mgmt_reset_work_handler);
+
 #ifdef CONFIG_THREAD_MONITOR
 static const struct k_thread *
 zephyr_os_mgmt_task_at(int idx)
@@ -72,11 +75,18 @@ os_mgmt_impl_task_info(int idx, struct os_mgmt_task_info 
*out_info)
 #endif /* CONFIG_THREAD_MONITOR */
 
 static void
-zephyr_os_mgmt_reset_cb(struct k_timer *timer)
+zephyr_os_mgmt_reset_work_handler(struct k_work *work)
 {
 sys_reboot(SYS_REBOOT_WARM);
 }
 
+static void
+zephyr_os_mgmt_reset_cb(struct k_timer *timer)
+{
+/* Reboot the system from the system workqueue thread. */
+k_work_submit(_os_mgmt_reset_work);
+}
+
 int
 os_mgmt_impl_reset(unsigned int delay_ms)
 {

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 36/42: Remove "zephyr, code_partition" from dts overlay

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 821f578be1bf5a75db6a95b611dd2d50608fb19f
Author: Christopher Collins 
AuthorDate: Mon Feb 12 13:03:34 2018 -0800

Remove "zephyr,code_partition" from dts overlay

This is no longer needed now that MCUboot has been integrated more fully
into Zephyr.
---
 samples/smp_svr/zephyr/dts.overlay | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/samples/smp_svr/zephyr/dts.overlay 
b/samples/smp_svr/zephyr/dts.overlay
index 5a3a7f3..7e73db7 100644
--- a/samples/smp_svr/zephyr/dts.overlay
+++ b/samples/smp_svr/zephyr/dts.overlay
@@ -4,9 +4,6 @@
 
 / {
chosen {
-   /* Required by mcuboot. */
-   zephyr,code-partition = _partition;
-
/* Use uart0 for the mcumgr UART transport. */
zephyr,uart-mcumgr = 
};

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 26/42: smp_svr - Add statistics.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit e86e83f27293ec7eaef751c8d5acc62f411248d3
Author: Christopher Collins 
AuthorDate: Tue Jan 30 12:17:43 2018 -0800

smp_svr - Add statistics.
---
 samples/smp_svr/zephyr/prj.conf   |  5 +
 samples/smp_svr/zephyr/src/main.c | 31 +++
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/samples/smp_svr/zephyr/prj.conf b/samples/smp_svr/zephyr/prj.conf
index 88ad795..5179c2c 100644
--- a/samples/smp_svr/zephyr/prj.conf
+++ b/samples/smp_svr/zephyr/prj.conf
@@ -39,11 +39,16 @@ CONFIG_REBOOT_LOG=y
 # Enable assertions.  Required for crash logging.
 CONFIG_ASSERT=y
 
+# Enable statistics and statistic names.
+CONFIG_STATS=y
+CONFIG_STATS_NAMES=y
+
 # Enable all core commands.
 CONFIG_MCUMGR_CMD_FS_MGMT=y
 CONFIG_MCUMGR_CMD_IMG_MGMT=y
 CONFIG_MCUMGR_CMD_LOG_MGMT=y
 CONFIG_MCUMGR_CMD_OS_MGMT=y
+CONFIG_MCUMGR_CMD_STAT_MGMT=y
 
 ### nRF5 specific settings
 
diff --git a/samples/smp_svr/zephyr/src/main.c 
b/samples/smp_svr/zephyr/src/main.c
index 2906711..47e5de2 100644
--- a/samples/smp_svr/zephyr/src/main.c
+++ b/samples/smp_svr/zephyr/src/main.c
@@ -14,6 +14,7 @@
 #include "logging/mdlog.h"
 #include "logging/reboot_log.h"
 #include "fcb.h"
+#include "stats.h"
 #include "mgmt/smp_bt.h"
 #include "mgmt/buf.h"
 
@@ -29,13 +30,13 @@
 #ifdef CONFIG_MCUMGR_CMD_LOG_MGMT
 #include "log_mgmt/log_mgmt.h"
 #endif
+#ifdef CONFIG_MCUMGR_CMD_STAT_MGMT
+#include "stat_mgmt/stat_mgmt.h"
+#endif
 
 #define DEVICE_NAME CONFIG_BT_DEVICE_NAME
 #define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
 
-struct fcb smp_svr_fcb;
-struct mdlog smp_svr_log;
-
 /* smp_svr uses the first "peruser" log module. */
 #define SMP_SVR_MDLOG_MODULE  (MDLOG_MODULE_PERUSER + 0)
 
@@ -43,6 +44,21 @@ struct mdlog smp_svr_log;
 #define SMP_SVR_MDLOG(lvl, ...) \
 MDLOG_ ## lvl(_svr_log, SMP_SVR_MDLOG_MODULE, __VA_ARGS__)
 
+/* Define an example stats group; tracks seconds of uptime. */
+STATS_SECT_START(smp_svr_stats)
+STATS_SECT_ENTRY(ticks)
+STATS_SECT_END
+
+/* Assign a name to the `ticks` stat. */
+STATS_NAME_START(smp_svr_stats)
+STATS_NAME(smp_svr_stats, ticks)
+STATS_NAME_END(smp_svr_stats)
+
+/* Define an instance of the stats group. */
+STATS_SECT_DECL(smp_svr_stats) smp_svr_stats;
+
+struct fcb smp_svr_fcb;
+struct mdlog smp_svr_log;
 
 static const struct bt_data ad[] = {
 BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
@@ -158,6 +174,9 @@ void main(void)
 reboot_log_configure(_svr_log);
 #endif
 
+rc = STATS_INIT_AND_REG(smp_svr_stats, STATS_SIZE_32, "smp_svr_stats");
+assert(rc == 0);
+
 /* Register the built-in mcumgr command handlers. */
 #ifdef CONFIG_MCUMGR_CMD_FS_MGMT
 fs_mgmt_register_group();
@@ -171,6 +190,9 @@ void main(void)
 #ifdef CONFIG_MCUMGR_CMD_LOG_MGMT
 log_mgmt_register_group();
 #endif
+#ifdef CONFIG_MCUMGR_CMD_STAT_MGMT
+stat_mgmt_register_group();
+#endif
 
 /* Enable Bluetooth. */
 rc = bt_enable(bt_ready);
@@ -192,6 +214,7 @@ void main(void)
  * main thread idle while the mcumgr server runs.
  */
 while (1) {
-k_sleep(INT32_MAX);
+k_sleep(1000);
+STATS_INC(smp_svr_stats, ticks);
 }
 }

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 01/42: Initial commit.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 9eee2c690d7605e3ede0618be1710b08e90961c1
Author: Christopher Collins 
AuthorDate: Thu Dec 7 16:55:48 2017 -0800

Initial commit.
---
 .gitignore | 37 +
 README.md  |  1 +
 2 files changed, 38 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..91be3d8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,37 @@
+#
+# 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.
+#
+
+.app.db
+.app
+bin
+obj
+tags
+.gdb_history
+.gdb_out
+.gdb_cmds
+.gdbinit
+*~
+.DS_Store
+*.swp
+*.swo
+*.bak
+docs/html
+docs/latex
+cscope.*
+*.tags
diff --git a/README.md b/README.md
new file mode 100644
index 000..3a9710e
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# mynewt-mcumgr

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 19/42: smp_svr Mynewt sample app - Remove redundant dep.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit b5c74b58afa8e8ae117d78b15566e77648c9edb1
Author: Christopher Collins 
AuthorDate: Fri Jan 26 17:58:09 2018 -0800

smp_svr Mynewt sample app - Remove redundant dep.
---
 samples/smp_svr/mynewt/pkg.yml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/samples/smp_svr/mynewt/pkg.yml b/samples/smp_svr/mynewt/pkg.yml
index 83d38d5..5ab44e3 100644
--- a/samples/smp_svr/mynewt/pkg.yml
+++ b/samples/smp_svr/mynewt/pkg.yml
@@ -39,5 +39,4 @@ pkg.deps:
 - '@mynewt-mcumgr/cmd/fs_mgmt'
 - '@mynewt-mcumgr/cmd/img_mgmt'
 - '@mynewt-mcumgr/cmd/os_mgmt'
-- '@mynewt-mcumgr/mgmt'
 - '@mynewt-mcumgr/smp'

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.


[mynewt-mcumgr] 25/42: stat_mgmt command handler group.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

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

commit 7bdec147ddcfd211858ec8ca8fcb1327e6c3a24b
Author: Christopher Collins 
AuthorDate: Mon Jan 29 16:05:27 2018 -0800

stat_mgmt command handler group.
---
 cmd/CMakeLists.txt   |   1 +
 cmd/Kconfig  |   1 +
 cmd/stat_mgmt/CMakeLists.txt |   9 ++
 cmd/stat_mgmt/Kconfig|  36 +
 cmd/stat_mgmt/include/stat_mgmt/stat_mgmt.h  |  50 +++
 cmd/stat_mgmt/include/stat_mgmt/stat_mgmt_impl.h |  70 ++
 cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c |  97 ++
 cmd/stat_mgmt/src/stat_mgmt.c| 160 +++
 cmd/stat_mgmt/src/stat_mgmt_config.h |  41 ++
 cmd/stat_mgmt/src/stubs.c|  40 ++
 mgmt/include/mgmt/mgmt.h |   2 +-
 11 files changed, 506 insertions(+), 1 deletion(-)

diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt
index be26ded..a9d5968 100644
--- a/cmd/CMakeLists.txt
+++ b/cmd/CMakeLists.txt
@@ -2,3 +2,4 @@ add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_FS_MGMT   fs_mgmt)
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_IMG_MGMT  img_mgmt)
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_LOG_MGMT  log_mgmt)
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_OS_MGMT   os_mgmt)
+add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_STAT_MGMT stat_mgmt)
diff --git a/cmd/Kconfig b/cmd/Kconfig
index ea51804..e404d2d 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -21,5 +21,6 @@ source "ext/mcumgr/cmd/fs_mgmt/Kconfig"
 source "ext/mcumgr/cmd/img_mgmt/Kconfig"
 source "ext/mcumgr/cmd/log_mgmt/Kconfig"
 source "ext/mcumgr/cmd/os_mgmt/Kconfig"
+source "ext/mcumgr/cmd/stat_mgmt/Kconfig"
 
 endmenu
diff --git a/cmd/stat_mgmt/CMakeLists.txt b/cmd/stat_mgmt/CMakeLists.txt
new file mode 100644
index 000..6dc954a
--- /dev/null
+++ b/cmd/stat_mgmt/CMakeLists.txt
@@ -0,0 +1,9 @@
+target_include_directories(MCUMGR INTERFACE 
+include
+)
+
+zephyr_library_sources(
+cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c
+cmd/stat_mgmt/src/stat_mgmt.c
+cmd/stat_mgmt/src/stubs.c
+)
diff --git a/cmd/stat_mgmt/Kconfig b/cmd/stat_mgmt/Kconfig
new file mode 100644
index 000..ffda20f
--- /dev/null
+++ b/cmd/stat_mgmt/Kconfig
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE log
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this log
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this log 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.
+
+menuconfig MCUMGR_CMD_STAT_MGMT
+bool
+prompt "Enable mcumgr handlers for statistics management"
+depends on STATS
+default n
+help
+  Enables mcumgr handlers for statistics management.
+
+if MCUMGR_CMD_STAT_MGMT
+config STAT_MGMT_MAX_NAME_LEN
+int
+prompt "Maximum stat group name length"
+default 32
+help
+  Limits the maximum stat group name length in mcumgr requests.  A buffer
+  of this size gets allocated on the stack during handling of all stat read
+  commands.  If a stat group's name exceeds this limit, it will be
+  impossible to retrieve its values with a stat show command.
+endif
diff --git a/cmd/stat_mgmt/include/stat_mgmt/stat_mgmt.h 
b/cmd/stat_mgmt/include/stat_mgmt/stat_mgmt.h
new file mode 100644
index 000..f0f76fb
--- /dev/null
+++ b/cmd/stat_mgmt/include/stat_mgmt/stat_mgmt.h
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+#ifndef 

[GitHub] jacobrosenthal closed pull request #757: HW driver: drv2605l

2018-02-12 Thread GitBox
jacobrosenthal closed pull request #757: HW driver: drv2605l
URL: https://github.com/apache/mynewt-core/pull/757
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/apps/sensors_test/src/main.c b/apps/sensors_test/src/main.c
index 423841958..fe4a862d8 100755
--- a/apps/sensors_test/src/main.c
+++ b/apps/sensors_test/src/main.c
@@ -55,6 +55,10 @@
 #if MYNEWT_VAL(BMP280_CLI)
 #include 
 #endif
+#if MYNEWT_VAL(DRV2605_CLI)
+#include 
+#endif
+
 
 #if MYNEWT_VAL(SENSOR_OIC)
 #include 
@@ -430,6 +434,10 @@ sensors_dev_shell_init(void)
 #if MYNEWT_VAL(BMP280_CLI)
 bmp280_shell_init();
 #endif
+
+#if MYNEWT_VAL(DRV2605_CLI)
+drv2605_shell_init();
+#endif
 }
 
 static void
diff --git a/hw/drivers/drv2605/include/drv2605/drv2605.h 
b/hw/drivers/drv2605/include/drv2605/drv2605.h
new file mode 100644
index 0..ce5e661e2
--- /dev/null
+++ b/hw/drivers/drv2605/include/drv2605/drv2605.h
@@ -0,0 +1,171 @@
+/*
+ * 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.
+ */
+
+#ifndef __DRV2605_H__
+#define __DRV2605_H__
+
+#include 
+#include "os/os_dev.h"
+#include "sensor/sensor.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct drv2605_cal {
+uint8_t brake_factor;
+uint8_t loop_gain;
+uint8_t lra_sample_time;
+uint8_t lra_blanking_time;
+uint8_t lra_idiss_time;
+uint8_t auto_cal_time;
+uint8_t lra_zc_det_time;
+};
+
+enum drv2605_power_mode {
+DRV2605_POWER_STANDBY = 0x00, // en pin high, standby bit high
+DRV2605_POWER_ACTIVE, //en pin high, standby bit low
+DRV2605_POWER_OFF //en pin low
+};
+
+enum drv2605_op_mode {
+DRV2605_OP_ROM = 0x00,
+DRV2605_OP_PWM,
+DRV2605_OP_ANALOG,
+DRV2605_OP_RTP,
+DRV2605_OP_DIAGNOSTIC,
+DRV2605_OP_CALIBRATION,
+DRV2605_OP_RESET
+};
+
+struct drv2605_cfg {
+enum drv2605_op_mode op_mode;
+struct drv2605_cal cal;
+};
+
+struct drv2605 {
+struct os_dev dev;
+struct sensor sensor;
+struct drv2605_cfg cfg;
+};
+
+
+/**
+ * Initialize the drv2605. This function is normally called by sysinit.
+ *
+ * @param dev  Pointer to the drv2605_dev device descriptor
+ */
+int
+drv2605_init(struct os_dev *dev, void *arg);
+
+int
+drv2605_config(struct drv2605 *drv2605, struct drv2605_cfg *cfg);
+
+
+#if MYNEWT_VAL(DRV2605_CLI)
+int drv2605_shell_init(void);
+#endif
+
+
+/**
+ * Get a best effort defaults for the drv2605_cal
+ *
+ * @param The sensor interface
+ * @param Pointer to the drv2605_cal struct
+ * @return 0 on success, non-zero on failure
+ */
+int
+drv2605_default_cal(struct drv2605_cal *cal);
+
+/**
+ * Get chip ID from the sensor
+ *
+ * @param The sensor interface
+ * @param Pointer to the variable to fill up chip ID in
+ * @return 0 on success, non-zero on failure
+ */
+int
+drv2605_get_chip_id(struct sensor_itf *itf, uint8_t *id);
+
+/**
+ * Get chip ID from the sensor
+ *
+ * @param The sensor interface
+ * @param Pointer to the buffer of rom library selections
+ * @param Size of the rom buffer (max 8)
+ * @return 0 on success, non-zero on failure
+ */
+int
+drv2605_load_rom(struct sensor_itf *itf, uint8_t *buffer, size_t length);
+
+/**
+ * Load value for rtp playback to device
+ *
+ * @param The sensor interface
+ * @param Value to load
+ * @return 0 on success, non-zero on failure
+ */
+int
+drv2605_load_rtp(struct sensor_itf *itf, uint8_t value);
+
+/**
+ * Trigger preloaded rom selections
+ *
+ * @param The sensor interface
+ * @return 0 on success, non-zero on failure
+ */
+int
+drv2605_trigger_rom(struct sensor_itf *itf);
+
+/**
+ * Get rom playback status from device
+ *
+ * @param The sensor interface
+ * @param Pointer to the variable to fill up status in
+ * @return 0 on success, non-zero on failure
+ */
+int
+drv2605_rom_busy(struct sensor_itf *itf, bool *status);
+
+/**
+ * Set the current power mode from device.
+ *
+ * @param The sensor interface
+ * @param drv2605_power_mode to send to device
+ * @return 0 on success, non-zero on failure
+ */
+int
+drv2605_set_power_mode(struct 

[GitHub] andrzej-kaczmarek opened a new pull request #809: nimble: Fixes for privacy

2018-02-12 Thread GitBox
andrzej-kaczmarek opened a new pull request #809: nimble: Fixes for privacy
URL: https://github.com/apache/mynewt-core/pull/809
 
 
   Few fixes for privacy.
   
   Apparently, in some cases we need to use our identity address even when 
using privacy. This happens if other device is not on our resolving list so we 
do not have entry with local IRK to generate RPA.
   
   - for non-directed advertising host specifies peer address as 
00:00:00:00:00:00 and assuming there is corresponding entry in resolving list 
we use this local LTK to generate RPA for AdvA (already works like this)
   - for scanning a device which is not in our resolving list we do not have 
local LTK to generate RPA for ScanA, but we are allowed to use NRPA so we can 
safely scan anything in the vicinity (fixed here)
   - for initiating with a device which is not in our resolving list we do not 
have local LTK to generate RPA for InitA and we also cannot use NRPA thus we 
need to use identity address (just added a note to make this clear)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] sterlinghughes commented on issue #796: nrf52 thingy target occasionally disconnects and never readvertises ble during first packet of newtmgr upload command

2018-02-12 Thread GitBox
sterlinghughes commented on issue #796: nrf52 thingy target occasionally 
disconnects and never readvertises ble during first packet of newtmgr upload 
command
URL: https://github.com/apache/mynewt-core/issues/796#issuecomment-365045538
 
 
   @sjanc @andrzej-kaczmarek can you take a look at this?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated (3d9b11c -> 65a52bf)

2018-02-12 Thread julian
This is an automated email from the ASF dual-hosted git repository.

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


from 3d9b11c  Merge pull request #808 from rymanluk/adv_int_1
 add aa1e83d  Sensors MPU6050: accelerometer range calculation fix
 new 65a52bf  Merge pull request #804 from vsyn/mpu6050-accel-range-fix

The 1 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.


Summary of changes:
 hw/drivers/sensors/mpu6050/src/mpu6050.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
jul...@apache.org.


[GitHub] IMGJulian closed pull request #804: Sensors MPU6050: accelerometer range calculation fix

2018-02-12 Thread GitBox
IMGJulian closed pull request #804: Sensors MPU6050: accelerometer range 
calculation fix
URL: https://github.com/apache/mynewt-core/pull/804
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/hw/drivers/sensors/mpu6050/src/mpu6050.c 
b/hw/drivers/sensors/mpu6050/src/mpu6050.c
index 6acb78f84..2d15ba587 100644
--- a/hw/drivers/sensors/mpu6050/src/mpu6050.c
+++ b/hw/drivers/sensors/mpu6050/src/mpu6050.c
@@ -529,11 +529,11 @@ mpu6050_sensor_read(struct sensor *sensor, sensor_type_t 
type,
 return rc;
 }
 
-x = (int16_t)((payload[0] << 8) | payload[1]);
-y = (int16_t)((payload[2] << 8) | payload[3]);
-z = (int16_t)((payload[4] << 8) | payload[5]);
+x = (((int16_t)payload[0]) << 8) | payload[1];
+y = (((int16_t)payload[2]) << 8) | payload[3];
+z = (((int16_t)payload[4]) << 8) | payload[5];
 
-switch (mpu->cfg.gyro_range) {
+switch (mpu->cfg.accel_range) {
 case MPU6050_ACCEL_RANGE_2: /* +/- 2g - 16384 LSB/g */
 /* Falls through */
 default:
@@ -571,9 +571,9 @@ mpu6050_sensor_read(struct sensor *sensor, sensor_type_t 
type,
 return rc;
 }
 
-x = (int16_t)((payload[0] << 8) | payload[1]);
-y = (int16_t)((payload[2] << 8) | payload[3]);
-z = (int16_t)((payload[4] << 8) | payload[5]);
+x = (((int16_t)payload[0]) << 8) | payload[1];
+y = (((int16_t)payload[2]) << 8) | payload[3];
+z = (((int16_t)payload[4]) << 8) | payload[5];
 
 switch (mpu->cfg.gyro_range) {
 case MPU6050_GYRO_RANGE_250: /* +/- 250 Deg/s - 131 LSB/Deg/s */


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] 01/01: Merge pull request #804 from vsyn/mpu6050-accel-range-fix

2018-02-12 Thread julian
This is an automated email from the ASF dual-hosted git repository.

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

commit 65a52bf26fec10993e89e061ce5f2eae971fa3b0
Merge: 3d9b11c aa1e83d
Author: IMGJulian 
AuthorDate: Mon Feb 12 20:02:18 2018 +

Merge pull request #804 from vsyn/mpu6050-accel-range-fix

Sensors MPU6050: accelerometer range calculation fix

 hw/drivers/sensors/mpu6050/src/mpu6050.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
jul...@apache.org.


[GitHub] mkiiskila commented on issue #757: HW driver: drv2605l

2018-02-12 Thread GitBox
mkiiskila commented on issue #757: HW driver: drv2605l
URL: https://github.com/apache/mynewt-core/pull/757#issuecomment-365035593
 
 
   Those could be done in a separate PR. IMHO, for static functions the length 
check does not seem as crucial, as the callers are local to file, and these can 
easily be eyeballed for incorrect use.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-site] 01/01: Merge pull request #399 from runtime-bot/asf-site

2018-02-12 Thread aditi
This is an automated email from the ASF dual-hosted git repository.

aditi pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/mynewt-site.git

commit 77f2bf4c83f65e447075422698c8ef1d2c4a169b
Merge: 7373b0b e9abeb5
Author: aditihilbert 
AuthorDate: Mon Feb 12 10:50:19 2018 -0800

Merge pull request #399 from runtime-bot/asf-site

automated asf-site build


-- 
To stop receiving notification emails like this one, please contact
ad...@apache.org.


[mynewt-site] branch asf-site updated (7373b0b -> 77f2bf4)

2018-02-12 Thread aditi
This is an automated email from the ASF dual-hosted git repository.

aditi pushed a change to branch asf-site
in repository https://gitbox.apache.org/repos/asf/mynewt-site.git.


from 7373b0b  Merge pull request #398 from runtime-bot/asf-site
 add e9abeb5  asf-site update Mon Feb 12 18:25:46 UTC 2018
 new 77f2bf4  Merge pull request #399 from runtime-bot/asf-site

The 1 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.


Summary of changes:

-- 
To stop receiving notification emails like this one, please contact
ad...@apache.org.


[mynewt-site] 01/01: Merge pull request #398 from runtime-bot/asf-site

2018-02-12 Thread aditi
This is an automated email from the ASF dual-hosted git repository.

aditi pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/mynewt-site.git

commit 7373b0bb1ed758603e444b32a8327b541c2d5dac
Merge: 1b1c237 31eb4d3
Author: aditihilbert 
AuthorDate: Mon Feb 12 10:24:43 2018 -0800

Merge pull request #398 from runtime-bot/asf-site

automated asf-site build

 develop/_images/BNO055_small.jpg   |  Bin 0 -> 31723 bytes
 develop/_images/MyNewtSensorReader.jpg |  Bin 0 -> 141358 bytes
 develop/_images/MyNewtSensorReader006.jpg  |  Bin 0 -> 211399 bytes
 develop/_images/NRF52_I2C_small.jpg|  Bin 0 -> 78087 bytes
 develop/_images/Senseair1.png  |  Bin 0 -> 1215822 bytes
 develop/_images/Senseair2.png  |  Bin 0 -> 1077537 bytes
 develop/_images/adc-demo-1.png |  Bin 0 -> 530153 bytes
 develop/_images/adc-demo-2.png |  Bin 0 -> 435709 bytes
 develop/_images/breadboard.png |  Bin 0 -> 546231 bytes
 develop/_images/smart_controller_accelerometer.png |  Bin 0 -> 86611 bytes
 develop/_images/smart_controller_main.png  |  Bin 0 -> 104629 bytes
 develop/_images/thingy.jpg |  Bin 0 -> 152774 bytes
 develop/_images/thingy_jlink.jpg   |  Bin 0 -> 146954 bytes
 .../_sources/tutorials/sensors/air_quality.rst.txt |7 +
 .../tutorials/sensors/air_quality_ble.rst.txt  |  235 
 .../tutorials/sensors/air_quality_sensor.rst.txt   |  920 +++
 .../_sources/tutorials/sensors/nrf52_adc.rst.txt   |  923 +++
 .../tutorials/sensors/sensor_bleprph_oic.rst.txt   |  338 ++
 .../tutorials/sensors/sensor_nrf52_bno055.rst.txt  |  581 ++
 .../sensors/sensor_nrf52_bno055_oic.rst.txt|  135 +++
 .../sensors/sensor_offboard_config.rst.txt |  254 +
 .../tutorials/sensors/sensor_oic_overview.rst.txt  |   66 ++
 .../sensors/sensor_thingy_lis2dh12_onb.rst.txt |  777 +
 develop/_sources/tutorials/sensors/sensors.rst.txt |8 +
 .../tutorials/sensors/sensors_framework.rst.txt|   76 ++
 develop/_sources/tutorials/tutorials.rst.txt   |   43 +-
 develop/objects.inv|  Bin 7091 -> 7413 bytes
 develop/os/os_user_guide.html  |4 +-
 develop/searchindex.js |2 +-
 develop/tutorials/ble/ble.html |1 +
 develop/tutorials/ble/ble_bare_bones.html  |1 +
 develop/tutorials/ble/blehci_project.html  |1 +
 .../ble/bleprph/bleprph-sections/bleprph-adv.html  |1 +
 .../ble/bleprph/bleprph-sections/bleprph-app.html  |1 +
 .../bleprph-sections/bleprph-chr-access.html   |1 +
 .../bleprph-sections/bleprph-gap-event.html|1 +
 .../bleprph/bleprph-sections/bleprph-svc-reg.html  |1 +
 develop/tutorials/ble/bleprph/bleprph.html |1 +
 develop/tutorials/ble/eddystone.html   |1 +
 develop/tutorials/ble/ibeacon.html |1 +
 develop/tutorials/blinky/arduino_zero.html |1 +
 develop/tutorials/blinky/blinky.html   |1 +
 develop/tutorials/blinky/blinky_console.html   |1 +
 develop/tutorials/blinky/blinky_primo.html |1 +
 develop/tutorials/blinky/blinky_stm32f4disc.html   |1 +
 develop/tutorials/blinky/nRF52.html|1 +
 develop/tutorials/blinky/olimex.html   |1 +
 develop/tutorials/blinky/rbnano2.html  |1 +
 develop/tutorials/lora/lorawanapp.html |5 +-
 develop/tutorials/repo/add_repos.html  |1 +
 develop/tutorials/repo/create_repo.html|1 +
 develop/tutorials/repo/private_repo.html   |1 +
 develop/tutorials/repo/upgrade_repo.html   |1 +
 .../upgrade_repo.html => sensors/air_quality.html} |   53 +-
 develop/tutorials/sensors/air_quality_ble.html |  556 +
 develop/tutorials/sensors/air_quality_sensor.html  | 1182 
 develop/tutorials/sensors/nrf52_adc.html   | 1097 ++
 develop/tutorials/sensors/sensor_bleprph_oic.html  |  653 +++
 develop/tutorials/sensors/sensor_nrf52_bno055.html |  913 +++
 .../tutorials/sensors/sensor_nrf52_bno055_oic.html |  474 
 .../tutorials/sensors/sensor_offboard_config.html  |  585 ++
 .../sensor_oic_overview.html}  |  135 ++-
 .../sensors/sensor_thingy_lis2dh12_onb.html| 1061 ++
 .../{ble/ble.html => sensors/sensors.html} |   38 +-
 .../blinky.html => sensors/sensors_framework.html} |  142 ++-
 develop/tutorials/slinky/project-nrf52-slinky.html |1 +
 develop/tutorials/slinky/project-sim-slinky.html   |1 +
 develop/tutorials/slinky/project-slinky.html   |1 +
 

[mynewt-site] branch asf-site updated (1b1c237 -> 7373b0b)

2018-02-12 Thread aditi
This is an automated email from the ASF dual-hosted git repository.

aditi pushed a change to branch asf-site
in repository https://gitbox.apache.org/repos/asf/mynewt-site.git.


from 1b1c237  Merge pull request #395 from runtime-bot/asf-site
 add 31eb4d3  asf-site update Mon Feb 12 18:10:46 UTC 2018
 new 7373b0b  Merge pull request #398 from runtime-bot/asf-site

The 1 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.


Summary of changes:
 .../pics => develop/_images}/BNO055_small.jpg  |  Bin
 .../_images}/MyNewtSensorReader.jpg|  Bin
 .../_images}/MyNewtSensorReader006.jpg |  Bin
 .../pics => develop/_images}/NRF52_I2C_small.jpg   |  Bin
 .../pics => develop/_images}/Senseair1.png |  Bin
 .../pics => develop/_images}/Senseair2.png |  Bin
 .../pics => develop/_images}/adc-demo-1.png|  Bin
 .../pics => develop/_images}/adc-demo-2.png|  Bin
 .../pics => develop/_images}/breadboard.png|  Bin
 .../_images}/smart_controller_accelerometer.png|  Bin
 .../_images}/smart_controller_main.png |  Bin
 .../tutorials/pics => develop/_images}/thingy.jpg  |  Bin
 .../pics => develop/_images}/thingy_jlink.jpg  |  Bin
 .../_sources/tutorials/sensors/air_quality.rst.txt |7 +
 .../tutorials/sensors/air_quality_ble.rst.txt  |  235 
 .../tutorials/sensors/air_quality_sensor.rst.txt   |  920 +++
 .../_sources/tutorials/sensors/nrf52_adc.rst.txt   |  923 +++
 .../tutorials/sensors/sensor_bleprph_oic.rst.txt   |  338 ++
 .../tutorials/sensors/sensor_nrf52_bno055.rst.txt  |  581 ++
 .../sensors/sensor_nrf52_bno055_oic.rst.txt|  135 +++
 .../sensors/sensor_offboard_config.rst.txt |  254 +
 .../tutorials/sensors/sensor_oic_overview.rst.txt  |   66 ++
 .../sensors/sensor_thingy_lis2dh12_onb.rst.txt |  777 +
 develop/_sources/tutorials/sensors/sensors.rst.txt |8 +
 .../tutorials/sensors/sensors_framework.rst.txt|   76 ++
 develop/_sources/tutorials/tutorials.rst.txt   |   43 +-
 develop/objects.inv|  Bin 7091 -> 7413 bytes
 develop/os/os_user_guide.html  |4 +-
 develop/searchindex.js |2 +-
 develop/tutorials/ble/ble.html |1 +
 develop/tutorials/ble/ble_bare_bones.html  |1 +
 develop/tutorials/ble/blehci_project.html  |1 +
 .../ble/bleprph/bleprph-sections/bleprph-adv.html  |1 +
 .../ble/bleprph/bleprph-sections/bleprph-app.html  |1 +
 .../bleprph-sections/bleprph-chr-access.html   |1 +
 .../bleprph-sections/bleprph-gap-event.html|1 +
 .../bleprph/bleprph-sections/bleprph-svc-reg.html  |1 +
 develop/tutorials/ble/bleprph/bleprph.html |1 +
 develop/tutorials/ble/eddystone.html   |1 +
 develop/tutorials/ble/ibeacon.html |1 +
 develop/tutorials/blinky/arduino_zero.html |1 +
 develop/tutorials/blinky/blinky.html   |1 +
 develop/tutorials/blinky/blinky_console.html   |1 +
 develop/tutorials/blinky/blinky_primo.html |1 +
 develop/tutorials/blinky/blinky_stm32f4disc.html   |1 +
 develop/tutorials/blinky/nRF52.html|1 +
 develop/tutorials/blinky/olimex.html   |1 +
 develop/tutorials/blinky/rbnano2.html  |1 +
 develop/tutorials/lora/lorawanapp.html |5 +-
 develop/tutorials/repo/add_repos.html  |1 +
 develop/tutorials/repo/create_repo.html|1 +
 develop/tutorials/repo/private_repo.html   |1 +
 develop/tutorials/repo/upgrade_repo.html   |1 +
 .../upgrade_repo.html => sensors/air_quality.html} |   53 +-
 develop/tutorials/sensors/air_quality_ble.html |  556 +
 develop/tutorials/sensors/air_quality_sensor.html  | 1182 
 develop/tutorials/sensors/nrf52_adc.html   | 1097 ++
 develop/tutorials/sensors/sensor_bleprph_oic.html  |  653 +++
 develop/tutorials/sensors/sensor_nrf52_bno055.html |  913 +++
 .../tutorials/sensors/sensor_nrf52_bno055_oic.html |  474 
 .../tutorials/sensors/sensor_offboard_config.html  |  585 ++
 .../sensor_oic_overview.html}  |  135 ++-
 .../sensors/sensor_thingy_lis2dh12_onb.html| 1061 ++
 .../{ble/ble.html => sensors/sensors.html} |   38 +-
 .../blinky.html => sensors/sensors_framework.html} |  142 ++-
 develop/tutorials/slinky/project-nrf52-slinky.html |1 +
 develop/tutorials/slinky/project-sim-slinky.html   |1 +
 develop/tutorials/slinky/project-slinky.html   |1 +
 develop/tutorials/slinky/project-stm32-slinky.html 

[mynewt-site] 01/01: Merge pull request #396 from ryangrimm/patch-4

2018-02-12 Thread aditi
This is an automated email from the ASF dual-hosted git repository.

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

commit 38bcfdd08fb20c13c41718889643731fd5d2334a
Merge: cda0cef 8aef803
Author: aditihilbert 
AuthorDate: Mon Feb 12 10:01:28 2018 -0800

Merge pull request #396 from ryangrimm/patch-4

The NimBLE Stack Initialization page no longer exists

 docs/os/tutorials/bleprph/bleprph-intro.md | 1 -
 1 file changed, 1 deletion(-)

-- 
To stop receiving notification emails like this one, please contact
ad...@apache.org.


[GitHub] aditihilbert closed pull request #396: The NimBLE Stack Initialization page no longer exists

2018-02-12 Thread GitBox
aditihilbert closed pull request #396: The NimBLE Stack Initialization page no 
longer exists
URL: https://github.com/apache/mynewt-site/pull/396
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/docs/os/tutorials/bleprph/bleprph-intro.md 
b/docs/os/tutorials/bleprph/bleprph-intro.md
index efbbd4b18..a07514dc4 100644
--- a/docs/os/tutorials/bleprph/bleprph-intro.md
+++ b/docs/os/tutorials/bleprph/bleprph-intro.md
@@ -19,7 +19,6 @@ familiarize yourself with the following pages:
 
 * [Create Your First Mynewt Project](../../get_started/project_create/)
 * [BLE Bare Bones Application Tutorial](../../../os/tutorials/ble_bare_bones/)
-* [NimBLE Stack Initialization](../../../network/ble/ini_stack/ble_ini_intro/)
 
 
 


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-site] branch master updated (cda0cef -> 38bcfdd)

2018-02-12 Thread aditi
This is an automated email from the ASF dual-hosted git repository.

aditi pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-site.git.


from cda0cef  Merge pull request #394 from spoonofpower/go_import
 add 8aef803  The NimBLE Stack Initialization page no longer exists
 new 38bcfdd  Merge pull request #396 from ryangrimm/patch-4

The 1 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.


Summary of changes:
 docs/os/tutorials/bleprph/bleprph-intro.md | 1 -
 1 file changed, 1 deletion(-)

-- 
To stop receiving notification emails like this one, please contact
ad...@apache.org.


[mynewt-documentation] 01/01: Merge pull request #24 from ritikakapade/sensortutorial

2018-02-12 Thread aditi
This is an automated email from the ASF dual-hosted git repository.

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

commit a10bf14e6a9bfed79266168ac0cc39580f7e108b
Merge: b37639d 34ac1d4
Author: aditihilbert 
AuthorDate: Mon Feb 12 09:58:57 2018 -0800

Merge pull request #24 from ritikakapade/sensortutorial

Adding Sensor tutorials

 docs/tutorials/sensors/air_quality.rst |   7 +
 docs/tutorials/sensors/air_quality_ble.rst | 235 ++
 docs/tutorials/sensors/air_quality_sensor.rst  | 920 
 docs/tutorials/sensors/nrf52_adc.rst   | 923 +
 docs/tutorials/sensors/sensor_bleprph_oic.rst  | 338 
 docs/tutorials/sensors/sensor_nrf52_bno055.rst | 581 +
 docs/tutorials/sensors/sensor_nrf52_bno055_oic.rst | 135 +++
 docs/tutorials/sensors/sensor_offboard_config.rst  | 254 ++
 docs/tutorials/sensors/sensor_oic_overview.rst |  66 ++
 .../sensors/sensor_thingy_lis2dh12_onb.rst | 777 +
 docs/tutorials/sensors/sensors.rst |   8 +
 docs/tutorials/sensors/sensors_framework.rst   |  76 ++
 docs/tutorials/tutorials.rst   |  43 +-
 13 files changed, 4342 insertions(+), 21 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
ad...@apache.org.


[mynewt-documentation] branch master updated (b37639d -> a10bf14)

2018-02-12 Thread aditi
This is an automated email from the ASF dual-hosted git repository.

aditi pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-documentation.git.


from b37639d  Merge pull request #23 from gj262/OSTask
 add f08dbd9  Adding sensor tutorial - Fixing image links and URL's etc - 
Fixing codev blocks and highlighted texts
 add 3aec329  Some more sensors documentation
 add 34ac1d4  Making chanages as per review
 new a10bf14  Merge pull request #24 from ritikakapade/sensortutorial

The 1 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.


Summary of changes:
 docs/tutorials/sensors/air_quality.rst |   7 +
 docs/tutorials/sensors/air_quality_ble.rst | 235 ++
 docs/tutorials/sensors/air_quality_sensor.rst  | 920 
 docs/tutorials/sensors/nrf52_adc.rst   | 923 +
 docs/tutorials/sensors/sensor_bleprph_oic.rst  | 338 
 docs/tutorials/sensors/sensor_nrf52_bno055.rst | 581 +
 docs/tutorials/sensors/sensor_nrf52_bno055_oic.rst | 135 +++
 docs/tutorials/sensors/sensor_offboard_config.rst  | 254 ++
 docs/tutorials/sensors/sensor_oic_overview.rst |  66 ++
 .../sensors/sensor_thingy_lis2dh12_onb.rst | 777 +
 docs/tutorials/sensors/sensors.rst |   8 +
 docs/tutorials/sensors/sensors_framework.rst   |  76 ++
 docs/tutorials/tutorials.rst   |  43 +-
 13 files changed, 4342 insertions(+), 21 deletions(-)
 create mode 100644 docs/tutorials/sensors/air_quality.rst
 create mode 100644 docs/tutorials/sensors/air_quality_ble.rst
 create mode 100644 docs/tutorials/sensors/air_quality_sensor.rst
 create mode 100644 docs/tutorials/sensors/nrf52_adc.rst
 create mode 100644 docs/tutorials/sensors/sensor_bleprph_oic.rst
 create mode 100644 docs/tutorials/sensors/sensor_nrf52_bno055.rst
 create mode 100644 docs/tutorials/sensors/sensor_nrf52_bno055_oic.rst
 create mode 100644 docs/tutorials/sensors/sensor_offboard_config.rst
 create mode 100644 docs/tutorials/sensors/sensor_oic_overview.rst
 create mode 100644 docs/tutorials/sensors/sensor_thingy_lis2dh12_onb.rst
 create mode 100644 docs/tutorials/sensors/sensors.rst
 create mode 100644 docs/tutorials/sensors/sensors_framework.rst

-- 
To stop receiving notification emails like this one, please contact
ad...@apache.org.


[GitHub] adrien3d commented on issue #53: Replace currantlabs dep with go-ble.

2018-02-12 Thread GitBox
adrien3d commented on issue #53: Replace currantlabs dep with go-ble.
URL: https://github.com/apache/mynewt-newtmgr/pull/53#issuecomment-364923376
 
 
   On mac OS High Sierra, while doing a newtmgr image upload -c bleconn 
/path/to/nrf52_app/app/apps/bleprph/bleprph.img, I have a progress bar 
remaining at 0B, and an Error: disconnected:
   newtmgr image upload -c bleconn /path/to/my/bleprph.img 0 B / 122.70 KiB 
[--]
 0.00% Error: disconnected
   
   Any idea of where the problem is coming from?
   
   With the debug flag, I have:
   
   ```newtmgr image upload -c bleconn 
/path/to/nrf52_app/app/apps/bleprph/bleprph.img -l debug
   DEBU[2018-02-12 15:52:54.823] Using connection profile: name=bleconn 
type=ble connstring=peer_name=klocz-ble
   DEBU[2018-02-12 15:52:54.825] {add-oic-listener} [transceiver.go:62] token=[]
   DEBU[2018-02-12 15:52:54.825] Connecting to peer
   DEBU[2018-02-12 15:52:55.217] Exchanging MTU
   DEBU[2018-02-12 15:52:55.218] Exchanged MTU; ATT MTU = 104
   DEBU[2018-02-12 15:52:55.218] Discovering profile
   DEBU[2018-02-12 15:52:55.929] Subscribing to NMP response characteristic
   0 / 125640 
[---]
 0.00%DEBU[2018-02-12 15:52:55.974] {add-nmp-listener} [bll_sesn.go:401] seq=66
   DEBU[2018-02-12 15:52:55.975] Encoded &{NmpBase:{hdr:{Op:2 Flags:0 Len:0 
Group:1 Seq:66 Id:5}}} to:
    a0 |.|
   
   DEBU[2018-02-12 15:52:55.975] Encoded:
    02 00 00 01 00 01 42 05 a0 |..B..|
   
   DEBU[2018-02-12 15:52:55.975] Tx NMP request:  02 00 00 01 00 01 42 
05 a0 |..B..|
   
   0 B / 122.70 KiB 
[-]
 0.00%DEBU[2018-02-12 15:52:58.023] {remove-nmp-listener} [bll_sesn.go:401] 
seq=66
   DEBU[2018-02-12 15:52:58.023] OIC error: disconnected
   DEBU[2018-02-12 15:52:58.027] {remove-oic-listener} [.:0] token=[]
   DEBU[2018-02-12 15:52:58.027] goroutine 1 [running]:
   
mynewt.apache.org/newtmgr/vendor/mynewt.apache.org/newt/util.NewNewtError(0xc420144120,
 0xc, 0xc)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/mynewt.apache.org/newt/util/util.go:77
 +0xe8
   
mynewt.apache.org/newtmgr/vendor/mynewt.apache.org/newt/util.ChildNewtError(0x4a5b0c0,
 0xc42014c220, 0xc4201685a0)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/mynewt.apache.org/newt/util/util.go:103
 +0x82
   mynewt.apache.org/newtmgr/newtmgr/cli.imageUploadCmd(0xc4201bf200, 
0xc4200848c0, 0x1, 0x5)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/newtmgr/cli/image.go:202
 +0x40a
   
mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra.(*Command).execute(0xc4201bf200,
 0xc420084870, 0x5, 0x5, 0xc4201bf200, 0xc420084870)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra/command.go:654
 +0x2a2
   
mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc42008f8c0,
 0xc420131f08, 0xc420131ef8, 0xc420041ab0)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra/command.go:729
 +0x2fe
   
mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra.(*Command).Execute(0xc42008f8c0,
 0x473f778, 0xc420162240)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra/command.go:688
 +0x2b
   main.main()
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/newtmgr/newtmgr.go:111
 +0x119
   
   goroutine 5 [syscall]:
   os/signal.signal_recv(0x0)
   /usr/local/Cellar/go/1.9.4/libexec/src/runtime/sigqueue.go:131 +0xa7
   os/signal.loop()
   /usr/local/Cellar/go/1.9.4/libexec/src/os/signal/signal_unix.go:22 +0x22
   created by os/signal.init.0
   /usr/local/Cellar/go/1.9.4/libexec/src/os/signal/signal_unix.go:28 +0x41
   
   goroutine 18 [select, locked to thread]:
   runtime.gopark(0x4741980, 0x0, 0x4719b96, 0x6, 0x18, 0x1)
   /usr/local/Cellar/go/1.9.4/libexec/src/runtime/proc.go:287 +0x12c
   runtime.selectgo(0xc420038f50, 0xc4201b4060)
   /usr/local/Cellar/go/1.9.4/libexec/src/runtime/select.go:395 +0x1149
   runtime.ensureSigM.func1()
   /usr/local/Cellar/go/1.9.4/libexec/src/runtime/signal_unix.go:511 +0x1fe
   runtime.goexit()
   /usr/local/Cellar/go/1.9.4/libexec/src/runtime/asm_amd64.s:2337 +0x1
   
   goroutine 7 [chan receive]:
   main.main.func1(0xc420162240)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/newtmgr/newtmgr.go:97
 +

[GitHub] adrien3d commented on issue #805: Mac OS High Sierra DFU Error

2018-02-12 Thread GitBox
adrien3d commented on issue #805: Mac OS High Sierra DFU Error
URL: https://github.com/apache/mynewt-core/issues/805#issuecomment-364974543
 
 
   Okay, thanks, I'll give this a try.
   I have currently: `newtmgr -c bleconn image list -l debug`
   ```
   DEBU[2018-02-12 17:17:52.188] Using connection profile: name=bleconn 
type=ble connstring=peer_name=klocz-ble 
   DEBU[2018-02-12 17:17:52.2] {add-oic-listener} [transceiver.go:62] token=[] 
   DEBU[2018-02-12 17:17:52.2] Connecting to peer   
   DEBU[2018-02-12 17:17:52.597] Exchanging MTU   
   DEBU[2018-02-12 17:17:52.597] Exchanged MTU; ATT MTU = 104 
   DEBU[2018-02-12 17:17:52.597] Discovering profile  
   DEBU[2018-02-12 17:17:53.339] Subscribing to NMP response characteristic   
   DEBU[2018-02-12 17:17:53.384] {add-nmp-listener} [bll_sesn.go:401] seq=66  
   DEBU[2018-02-12 17:17:53.384] Encoded &{NmpBase:{hdr:{Op:0 Flags:0 Len:0 
Group:1 Seq:66 Id:0}}} to:
     a0|.|
   DEBU[2018-02-12 17:17:53.384] Encoded:
     00 00 00 01 00 01 42 00  a0   |..B..|
   DEBU[2018-02-12 17:17:53.384] Tx NMP request:   00 00 00 01 00 01 42 
00  a0   |..B..|
   DEBU[2018-02-12 17:17:53.431] Received nmp rsp: &{NmpBase:{hdr:{Op:1 Flags:0 
Len:24 Group:1 Seq:66 Id:0}} Rc:0 Images:[] SplitStatus:N/A} 
   DEBU[2018-02-12 17:17:53.431] {remove-nmp-listener} [bll_sesn.go:401] seq=66 
   Images:
   Split status: N/A (0)
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jacobrosenthal commented on issue #805: Mac OS High Sierra DFU Error

2018-02-12 Thread GitBox
jacobrosenthal commented on issue #805: Mac OS High Sierra DFU Error
URL: https://github.com/apache/mynewt-core/issues/805#issuecomment-364975535
 
 
   Also check it out, if you use triple ticks for large code blocks it will 
maintain your line breaks and format it properly.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] adrien3d commented on issue #805: Mac OS High Sierra DFU Error

2018-02-12 Thread GitBox
adrien3d commented on issue #805: Mac OS High Sierra DFU Error
URL: https://github.com/apache/mynewt-core/issues/805#issuecomment-364974543
 
 
   Okay, thanks, I'll give this a try.
   I have currently: `newtmgr -c bleconn image list -l debug`
   
   `DEBU[2018-02-12 17:17:52.188] Using connection profile: name=bleconn 
type=ble connstring=peer_name=klocz-ble 
   DEBU[2018-02-12 17:17:52.2] {add-oic-listener} [transceiver.go:62] token=[] 
   DEBU[2018-02-12 17:17:52.2] Connecting to peer   
   DEBU[2018-02-12 17:17:52.597] Exchanging MTU   
   DEBU[2018-02-12 17:17:52.597] Exchanged MTU; ATT MTU = 104 
   DEBU[2018-02-12 17:17:52.597] Discovering profile  
   DEBU[2018-02-12 17:17:53.339] Subscribing to NMP response characteristic   
   DEBU[2018-02-12 17:17:53.384] {add-nmp-listener} [bll_sesn.go:401] seq=66  
   DEBU[2018-02-12 17:17:53.384] Encoded &{NmpBase:{hdr:{Op:0 Flags:0 Len:0 
Group:1 Seq:66 Id:0}}} to:
     a0|.|
   DEBU[2018-02-12 17:17:53.384] Encoded:
     00 00 00 01 00 01 42 00  a0   |..B..|
   DEBU[2018-02-12 17:17:53.384] Tx NMP request:   00 00 00 01 00 01 42 
00  a0   |..B..|
   DEBU[2018-02-12 17:17:53.431] Received nmp rsp: &{NmpBase:{hdr:{Op:1 Flags:0 
Len:24 Group:1 Seq:66 Id:0}} Rc:0 Images:[] SplitStatus:N/A} 
   DEBU[2018-02-12 17:17:53.431] {remove-nmp-listener} [bll_sesn.go:401] seq=66 
   Images:
   Split status: N/A (0)`


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] jacobrosenthal commented on issue #805: Mac OS High Sierra DFU Error

2018-02-12 Thread GitBox
jacobrosenthal commented on issue #805: Mac OS High Sierra DFU Error
URL: https://github.com/apache/mynewt-core/issues/805#issuecomment-364972965
 
 
   Please give way more logs, I have no idea where in the process image list is 
failing for you. I find most failures like what youve described above are an 
out of memory or overflow of some type, which means youll need to fully erase 
and load everything again after such an error. This is what my loading script 
looks like for my nrf52 split-thingy target, rename for yours:
   ```
   echo -ne "erase all\nq\n" | JLinkExe -if SWD -device nRF52 -speed 1000
   newt build boot-thingy && newt load boot-thingy
   newt build split-thingy && newt create-image split-thingy 0.0.0.1 && newt 
load split-thingy 0.0.0.1
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] adrien3d commented on issue #805: Mac OS High Sierra DFU Error

2018-02-12 Thread GitBox
adrien3d commented on issue #805: Mac OS High Sierra DFU Error
URL: https://github.com/apache/mynewt-core/issues/805#issuecomment-364914156
 
 
   On mac OS High Sierra, while doing a `newtmgr image upload -c bleconn 
/path/to/nrf52_app/app/apps/bleprph/bleprph.img`, I have a progress bar 
remaining at 0B, and an Error: disconnected:
   ```newtmgr image upload -c bleconn /path/to/my/bleprph.img
0 B / 122.70 KiB 
[--]
   0.00%
   Error: disconnected
   ```
   
   Any idea of where the problem is coming from?
   
   With the debug flag, I have:
   
   ```newtmgr image upload -c bleconn 
/path/to/nrf52_app/app/apps/bleprph/bleprph.img -l debug
   DEBU[2018-02-12 15:52:54.823] Using connection profile: name=bleconn 
type=ble connstring=peer_name=klocz-ble 
   DEBU[2018-02-12 15:52:54.825] {add-oic-listener} [transceiver.go:62] 
token=[] 
   DEBU[2018-02-12 15:52:54.825] Connecting to peer   
   DEBU[2018-02-12 15:52:55.217] Exchanging MTU   
   DEBU[2018-02-12 15:52:55.218] Exchanged MTU; ATT MTU = 104 
   DEBU[2018-02-12 15:52:55.218] Discovering profile  
   DEBU[2018-02-12 15:52:55.929] Subscribing to NMP response characteristic   
0 / 125640 
[---]
   0.00%DEBU[2018-02-12 15:52:55.974] {add-nmp-listener} [bll_sesn.go:401] 
seq=66  
   DEBU[2018-02-12 15:52:55.975] Encoded &{NmpBase:{hdr:{Op:2 Flags:0 Len:0 
Group:1 Seq:66 Id:5}}} to:
     a0|.|

   DEBU[2018-02-12 15:52:55.975] Encoded:
     02 00 00 01 00 01 42 05  a0   |..B..|

   DEBU[2018-02-12 15:52:55.975] Tx NMP request:   02 00 00 01 00 01 42 
05  a0   |..B..|

0 B / 122.70 KiB 
[-]
   0.00%DEBU[2018-02-12 15:52:58.023] {remove-nmp-listener} [bll_sesn.go:401] 
seq=66 
   DEBU[2018-02-12 15:52:58.023] OIC error: disconnected  
   DEBU[2018-02-12 15:52:58.027] {remove-oic-listener} [.:0] token=[] 
   DEBU[2018-02-12 15:52:58.027] goroutine 1 [running]:
   
mynewt.apache.org/newtmgr/vendor/mynewt.apache.org/newt/util.NewNewtError(0xc420144120,
 0xc, 0xc)

/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/mynewt.apache.org/newt/util/util.go:77
 +0xe8
   
mynewt.apache.org/newtmgr/vendor/mynewt.apache.org/newt/util.ChildNewtError(0x4a5b0c0,
 0xc42014c220, 0xc4201685a0)

/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/mynewt.apache.org/newt/util/util.go:103
 +0x82
   mynewt.apache.org/newtmgr/newtmgr/cli.imageUploadCmd(0xc4201bf200, 
0xc4200848c0, 0x1, 0x5)

/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/newtmgr/cli/image.go:202
 +0x40a
   
mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra.(*Command).execute(0xc4201bf200,
 0xc420084870, 0x5, 0x5, 0xc4201bf200, 0xc420084870)

/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra/command.go:654
 +0x2a2
   
mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc42008f8c0,
 0xc420131f08, 0xc420131ef8, 0xc420041ab0)

/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra/command.go:729
 +0x2fe
   
mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra.(*Command).Execute(0xc42008f8c0,
 0x473f778, 0xc420162240)

/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra/command.go:688
 +0x2b
   main.main()

/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/newtmgr/newtmgr.go:111
 +0x119
   
   goroutine 5 [syscall]:
   os/signal.signal_recv(0x0)
/usr/local/Cellar/go/1.9.4/libexec/src/runtime/sigqueue.go:131 +0xa7
   os/signal.loop()
/usr/local/Cellar/go/1.9.4/libexec/src/os/signal/signal_unix.go:22 +0x22
   created by os/signal.init.0
/usr/local/Cellar/go/1.9.4/libexec/src/os/signal/signal_unix.go:28 +0x41
   
   goroutine 18 [select, locked to thread]:
   runtime.gopark(0x4741980, 0x0, 0x4719b96, 0x6, 0x18, 0x1)
/usr/local/Cellar/go/1.9.4/libexec/src/runtime/proc.go:287 +0x12c
   runtime.selectgo(0xc420038f50, 0xc4201b4060)
/usr/local/Cellar/go/1.9.4/libexec/src/runtime/select.go:395 +0x1149
   runtime.ensureSigM.func1()
/usr/local/Cellar/go/1

[GitHub] adrien3d commented on issue #805: Mac OS High Sierra DFU Error

2018-02-12 Thread GitBox
adrien3d commented on issue #805: Mac OS High Sierra DFU Error
URL: https://github.com/apache/mynewt-core/issues/805#issuecomment-364968293
 
 
   Not so sure of this, because `newtmgr -c bleconn image list` returns me 
nothings, even after loading the bleprph example:
   `Images:
   Split status: N/A (0)`


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] adrien3d commented on issue #53: Replace currantlabs dep with go-ble.

2018-02-12 Thread GitBox
adrien3d commented on issue #53: Replace currantlabs dep with go-ble.
URL: https://github.com/apache/mynewt-newtmgr/pull/53#issuecomment-364923376
 
 
   On mac OS High Sierra, while doing a newtmgr image upload -c bleconn 
/path/to/nrf52_app/app/apps/bleprph/bleprph.img, I have a progress bar 
remaining at 0B, and an Error: disconnected:
   newtmgr image upload -c bleconn /path/to/my/bleprph.img 0 B / 122.70 KiB 
[--]
 0.00% Error: disconnected
   
   Any idea of where the problem is coming from?
   
   With the debug flag, I have:
   
   `newtmgr image upload -c bleconn 
/path/to/nrf52_app/app/apps/bleprph/bleprph.img -l debug
   DEBU[2018-02-12 15:52:54.823] Using connection profile: name=bleconn 
type=ble connstring=peer_name=klocz-ble
   DEBU[2018-02-12 15:52:54.825] {add-oic-listener} [transceiver.go:62] token=[]
   DEBU[2018-02-12 15:52:54.825] Connecting to peer
   DEBU[2018-02-12 15:52:55.217] Exchanging MTU
   DEBU[2018-02-12 15:52:55.218] Exchanged MTU; ATT MTU = 104
   DEBU[2018-02-12 15:52:55.218] Discovering profile
   DEBU[2018-02-12 15:52:55.929] Subscribing to NMP response characteristic
   0 / 125640 
[---]
 0.00%DEBU[2018-02-12 15:52:55.974] {add-nmp-listener} [bll_sesn.go:401] seq=66
   DEBU[2018-02-12 15:52:55.975] Encoded &{NmpBase:{hdr:{Op:2 Flags:0 Len:0 
Group:1 Seq:66 Id:5}}} to:
    a0 |.|
   
   DEBU[2018-02-12 15:52:55.975] Encoded:
    02 00 00 01 00 01 42 05 a0 |..B..|
   
   DEBU[2018-02-12 15:52:55.975] Tx NMP request:  02 00 00 01 00 01 42 
05 a0 |..B..|
   
   0 B / 122.70 KiB 
[-]
 0.00%DEBU[2018-02-12 15:52:58.023] {remove-nmp-listener} [bll_sesn.go:401] 
seq=66
   DEBU[2018-02-12 15:52:58.023] OIC error: disconnected
   DEBU[2018-02-12 15:52:58.027] {remove-oic-listener} [.:0] token=[]
   DEBU[2018-02-12 15:52:58.027] goroutine 1 [running]:
   
mynewt.apache.org/newtmgr/vendor/mynewt.apache.org/newt/util.NewNewtError(0xc420144120,
 0xc, 0xc)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/mynewt.apache.org/newt/util/util.go:77
 +0xe8
   
mynewt.apache.org/newtmgr/vendor/mynewt.apache.org/newt/util.ChildNewtError(0x4a5b0c0,
 0xc42014c220, 0xc4201685a0)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/mynewt.apache.org/newt/util/util.go:103
 +0x82
   mynewt.apache.org/newtmgr/newtmgr/cli.imageUploadCmd(0xc4201bf200, 
0xc4200848c0, 0x1, 0x5)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/newtmgr/cli/image.go:202
 +0x40a
   
mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra.(*Command).execute(0xc4201bf200,
 0xc420084870, 0x5, 0x5, 0xc4201bf200, 0xc420084870)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra/command.go:654
 +0x2a2
   
mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc42008f8c0,
 0xc420131f08, 0xc420131ef8, 0xc420041ab0)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra/command.go:729
 +0x2fe
   
mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra.(*Command).Execute(0xc42008f8c0,
 0x473f778, 0xc420162240)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/vendor/github.com/spf13/cobra/command.go:688
 +0x2b
   main.main()
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/newtmgr/newtmgr.go:111
 +0x119
   
   goroutine 5 [syscall]:
   os/signal.signal_recv(0x0)
   /usr/local/Cellar/go/1.9.4/libexec/src/runtime/sigqueue.go:131 +0xa7
   os/signal.loop()
   /usr/local/Cellar/go/1.9.4/libexec/src/os/signal/signal_unix.go:22 +0x22
   created by os/signal.init.0
   /usr/local/Cellar/go/1.9.4/libexec/src/os/signal/signal_unix.go:28 +0x41
   
   goroutine 18 [select, locked to thread]:
   runtime.gopark(0x4741980, 0x0, 0x4719b96, 0x6, 0x18, 0x1)
   /usr/local/Cellar/go/1.9.4/libexec/src/runtime/proc.go:287 +0x12c
   runtime.selectgo(0xc420038f50, 0xc4201b4060)
   /usr/local/Cellar/go/1.9.4/libexec/src/runtime/select.go:395 +0x1149
   runtime.ensureSigM.func1()
   /usr/local/Cellar/go/1.9.4/libexec/src/runtime/signal_unix.go:511 +0x1fe
   runtime.goexit()
   /usr/local/Cellar/go/1.9.4/libexec/src/runtime/asm_amd64.s:2337 +0x1
   
   goroutine 7 [chan receive]:
   main.main.func1(0xc420162240)
   
/private/tmp/mynewt-newtmgr-20180212-9841-nucs1p/gopath/src/mynewt.apache.org/newtmgr/newtmgr/newtmgr.go:97
 +

  1   2   >