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

2018-02-08 Thread GitBox
jacobrosenthal commented on issue #757: HW driver: drv2605l
URL: https://github.com/apache/mynewt-core/pull/757#issuecomment-364176451
 
 
   @mkiiskila check again. I noticed there are other _writelen with different 
style. Preferences on how to correct these others
   
https://github.com/apache/mynewt-core/blob/f7ee032db6b0c3b3e20cac2b7d8ae8d14d33ca71/hw/drivers/sensors/bmp280/src/bmp280.c#L802
   
https://github.com/apache/mynewt-core/blob/41613e9867edc263166d002c58af3df6717bfc90/hw/drivers/sensors/bme280/src/bme280.c#L886
   
https://github.com/apache/mynewt-core/blob/f7ee032db6b0c3b3e20cac2b7d8ae8d14d33ca71/hw/drivers/sensors/ms5837/src/ms5837.c#L327


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] 02/25: Mynewt support.

2018-02-08 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 1da5b49604d14809be323cbdfcfede7a9e17b702
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] 01/25: Zephyr support.

2018-02-08 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 e5ec68560e40fb279a39a13ad5cc754ec636ceab
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] 24/25: Zephyr port: move mcumgr location in zephyr.

2018-02-08 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 a989cc9220a77b69638a3891ec78d37f33d4b139
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] 21/25: Correct "MCUboot" spelling in documentation.

2018-02-08 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 9dfb17740ae065591498c38d82795b5736fd4829
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] 12/25: smp_svr Mynewt sample app - Remove redundant dep.

2018-02-08 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 2ee969589c879e01a20f4edb0f7c77dbfee2cf22
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] 06/25: Make MCUMGR_CMD_FS_MGMT depend on FILE_SYSTEM.

2018-02-08 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 1ea9adba8c7ae251f91e9bea1de6bd062226f147
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] 10/25: log_mgmt command handler group.

2018-02-08 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 e5fcfd64b4e507b6fe1f870c09b934f00ac2da1e
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] 08/25: Fix some misnamed identifiers.

2018-02-08 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 1a1e22753cb3bf85ffaa4a4b90868bb6d528c01d
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] 23/25: zephyr img_mgmt: Use `FLASH_DEV_NAME`

2018-02-08 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 6629d1c0abf9bec84afc4327da14f7a157f2f16f
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] 16/25: smp_svr - Allow both CONFIG_FCB and CONFIG_FS_NFFS

2018-02-08 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 112427108305ef082ba099b6462faaf2cbc780cb
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] 14/25: Add doxygen comments for log_mgmt.

2018-02-08 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 89ee0f53d87e5abd47fffc052b5d945505ab7940
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] 15/25: Minor code cleanup.

2018-02-08 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 90c5cfd8142a1a49ef8e89ba45f0d6c6e20c6c5f
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] 20/25: smp_svr - Use CONFIG_BOOTLOADER_MCUBOOT setting.

2018-02-08 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 b15ecf9b80b8d05681e86e14000dc69cc4b9cf97
Author: Christopher Collins 
AuthorDate: Wed Jan 31 16:30:37 2018 -0800

smp_svr - Use CONFIG_BOOTLOADER_MCUBOOT setting.
---
 samples/smp_svr/zephyr/prj.conf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/samples/smp_svr/zephyr/prj.conf b/samples/smp_svr/zephyr/prj.conf
index 5179c2c..fc2f99c 100644
--- a/samples/smp_svr/zephyr/prj.conf
+++ b/samples/smp_svr/zephyr/prj.conf
@@ -1,8 +1,8 @@
 # Some command handlers require a large stack.
 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
 
-# Allow room for the mcuboot image header.
-CONFIG_TEXT_SECTION_OFFSET=0x200
+# Ensure an MCUboot-compatible binary is generated.
+CONFIG_BOOTLOADER_MCUBOOT=y
 
 # Increase the number of transmit buffers to avoid the Bluetooth stack buffer
 # leak.

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


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

2018-02-08 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 bfd56c36a888ba9088a8b51bd66acbf173541698
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] 09/25: Reboot in system workqueue, not ISR.

2018-02-08 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 7f40df230449b15ca4777e73e720b52238152c7a
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] 05/25: Remove extraneous README.rst file.

2018-02-08 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 7e83bda6950c3d29f49e81eaa927b2484db915a6
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] 04/25: Sample app - smp_svr

2018-02-08 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 7c761c0338502a2a68a835584232a28fdb3af7d8
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] 03/25: Documentation.

2018-02-08 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 373dcb18309a2a42a9819efd887596a3c0496b40
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] 11/25: Add log_mgmt support to smp_svr sample app.

2018-02-08 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 6c0dd9f31e7c1c4eb868ba3ae2cdbab8f12e5574
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] 07/25: Add missing license text.

2018-02-08 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 a4f1ba0b4665f6c4c03db2ef2c92b8ec4ae6b2bf
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] 13/25: Update documentation.

2018-02-08 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 e93bd66e0727c37ca1f6981a2b91c9da516545c2
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] branch master updated (d046efd -> bfd56c3)

2018-02-08 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 d046efd  Pull latest tinycbor changes from the PR#83
 discard 6baf3fa  Sample app - smp_svr
 discard 433ad4e  Documentation.
 discard 71f5c18  Mynewt support.
 discard 90b5f3c  Zephyr support.
 new e5ec685  Zephyr support.
 new 1da5b49  Mynewt support.
 new 373dcb1  Documentation.
 new 7c761c0  Sample app - smp_svr
 new 7e83bda  Remove extraneous README.rst file.
 new 1ea9adb  Make MCUMGR_CMD_FS_MGMT depend on FILE_SYSTEM.
 new a4f1ba0  Add missing license text.
 new 1a1e227  Fix some misnamed identifiers.
 new 7f40df2  Reboot in system workqueue, not ISR.
 new e5fcfd6  log_mgmt command handler group.
 new 6c0dd9f  Add log_mgmt support to smp_svr sample app.
 new 2ee9695  smp_svr Mynewt sample app - Remove redundant dep.
 new e93bd66  Update documentation.
 new 89ee0f5  Add doxygen comments for log_mgmt.
 new 90c5cfd  Minor code cleanup.
 new 1124271  smp_svr - Allow both CONFIG_FCB and CONFIG_FS_NFFS
 new ee62327  smp_svr - fix build error when CONFIG_MDLOG unset.
 new 00bf1b8  stat_mgmt command handler group.
 new 3390a3a  smp_svr - Add statistics.
 new b15ecf9  smp_svr - Use CONFIG_BOOTLOADER_MCUBOOT setting.
 new 9dfb177  Correct "MCUboot" spelling in documentation.
 new 0921e38  Remove local tinycbor copy.
 new 6629d1c  zephyr img_mgmt: Use `FLASH_DEV_NAME`
 new a989cc9  Zephyr port: move mcumgr location in zephyr.
 new bfd56c3  smp_svr - Update zephyr port for compatibility.

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   (d046efd)
\
 N -- N -- N   refs/heads/master (bfd56c3)

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 25 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:
 Kconfig|5 +-
 README-mynewt.md   |   31 +
 README-zephyr.md   |   30 +
 README.md  |   29 +-
 cmd/CMakeLists.txt |2 +
 cmd/Kconfig|8 +-
 cmd/fs_mgmt/Kconfig|1 +
 cmd/fs_mgmt/src/fs_mgmt_config.h   |   19 +
 cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c |   35 +-
 cmd/img_mgmt/src/img_mgmt_config.h |   19 +
 cmd/log_mgmt/CMakeLists.txt|9 +
 cmd/log_mgmt/Kconfig   |   54 +
 cmd/log_mgmt/include/log_mgmt/log_mgmt.h   |   83 +
 cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h  |  120 +
 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 +
 .../log_mgmt/src/log_mgmt_config.h |   31 +-
 cmd/{img_mgmt => log_mgmt}/src/stubs.c |   21 +-
 cmd/os_mgmt/include/os_mgmt/os_mgmt.h  |2 -
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c   |   14 +-
 cmd/os_mgmt/src/os_mgmt_config.h   |   19 +
 cmd/stat_mgmt/CMakeLists.txt   |9 +
 cmd/stat_mgmt/Kconfig  |   36 +
 .../include/stat_mgmt/stat_mgmt.h} |   23 +-
 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 ++
 .../stat_mgmt/src/stat_mgmt_config.h   |   27 +-
 cmd/{os_mgmt => stat_mgmt}/src/stubs.c |   10 +-
 ext/CMakeLists.txt |1 -
 ext/tinycbor/.appveyor.yml |   35 -
 ext/tinycbor/.gitattributes|4 -
 ext/tinycbor/.gitignore|   81 -
 ext/tinycbor/.tag  |1 -
 ext/tinycbor/.travis.yml   |   60 -
 ext/tinycbor/CMakeLists.txt|   15 -
 ext/tinycbor/Doxyfile  | 2318 
 

[GitHub] jacobrosenthal opened a new pull request #800: adc driver impl: correct incoming arg check

2018-02-08 Thread GitBox
jacobrosenthal opened a new pull request #800: adc driver impl: correct 
incoming arg check
URL: https://github.com/apache/mynewt-core/pull/800
 
 
   I noticed this while working on the nrfx drivers. This check was actually 
off by one I beleive


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 opened a new issue #801: Split status: non-matching (1) when (near?) out of memory

2018-02-08 Thread GitBox
jacobrosenthal opened a new issue #801: Split status: non-matching (1) when 
(near?) out of memory
URL: https://github.com/apache/mynewt-core/issues/801
 
 
   
   I keep randomly running into this and just figurd it out. When split targets 
are low memory on one or the other image, they can show as Split status: 
non-matching (1) after you test into the app
   
   ```
   $ newt target show split-microbit
   targets/split-microbit
   app=@apache-mynewt-core/apps/blesplit
   bsp=@apache-mynewt-core/hw/bsp/bbc_microbit
   build_profile=optimized
   loader=@apache-mynewt-core/apps/bleprph
   
syscfg=BLE_LL_CFG_FEAT_LE_ENCRYPTION=0:BLE_SM_LEGACY=0:BLE_SM_SC=0:LOG_LEVEL=255:MSYS_1_BLOCK_COUNT=19
   ```
   
   
   ```
   $ newtmgr -cnimble_blesplit image list
   Images:
slot=0
   version: 0.0.0.1
   bootable: true
   flags: active confirmed
   hash: dced80ca9c6c18500c8035d31afb3d41c900e4de7defeaa1c27c083f13125d7c
slot=1
   version: 0.0.0.1
   bootable: false
   flags: active confirmed
   hash: d04aae5bf5bc8ae495e1d59b6211600a9de983ab851be2cbe6d9c759b86d68d7
   Split status: non-matching (1)
   ```
   
   Clearly it 'runs' enough to respond to an image list command, but it also 
doesnt think its matchin. But if I decrease block count and give some more 
breathing room:
   
   ```
   $ newt target show split-microbit
   targets/split-microbit
   app=@apache-mynewt-core/apps/blesplit
   bsp=@apache-mynewt-core/hw/bsp/bbc_microbit
   build_profile=optimized
   loader=@apache-mynewt-core/apps/bleprph
   
syscfg=BLE_LL_CFG_FEAT_LE_ENCRYPTION=0:BLE_SM_LEGACY=0:BLE_SM_SC=0:LOG_LEVEL=255:MSYS_1_BLOCK_COUNT=18
   ```
   
   
   
   ```
   $ newtmgr -cnimble_blesplit image list
   Images:
slot=0
   version: 0.0.0.1
   bootable: true
   flags: active confirmed
   hash: 9ed01981c27d6aa45003a322ec4091ebcc62173a1a84e79bdbc803e5c1d9a219
slot=1
   version: 0.0.0.1
   bootable: false
   flags: active
   hash: 3e74b1cd8f2e76629160cfd6f91e9ce6726f4ca289f9c8707718873911a5d148
   Split status: matching (2)
   ```
   
   
   Maybe a feature not a bug? Documenting here either way.
   


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] ryangrimm opened a new pull request #390: The header to include should be fs/fsutil.h

2018-02-08 Thread GitBox
ryangrimm opened a new pull request #390: The header to include should be 
fs/fsutil.h
URL: https://github.com/apache/mynewt-site/pull/390
 
 
   


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] ryangrimm opened a new pull request #391: The header to include should be fs/fsutil.h

2018-02-08 Thread GitBox
ryangrimm opened a new pull request #391: The header to include should be 
fs/fsutil.h
URL: https://github.com/apache/mynewt-site/pull/391
 
 
   


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 #763: [WIP - Do not merge] Integrate nrfx

2018-02-08 Thread GitBox
jacobrosenthal commented on issue #763: [WIP - Do not merge] Integrate nrfx
URL: https://github.com/apache/mynewt-core/pull/763#issuecomment-364343396
 
 
   ADC is now in with minimal changes (for better or worse)
   
   Were getting close to squashing this.
   
   But mlaz and I are going back and forth on why you might use ign.files like
   
https://github.com/runtimeco/mynewt_nordic/blob/master/hw/mcu/nordic_sdk/pkg.yml#L35
   
   There are one or two files in the sdk that dont compile and were not using 
them so those obviously go on the list, but should literally all the files were 
not using be on that list, does that speed up newt compiles at all?
   
   


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 closed pull request #798: net/oic; make responding oc_endpoint available to coap client response handlers

2018-02-08 Thread GitBox
mkiiskila closed pull request #798: net/oic; make responding oc_endpoint 
available to coap client response handlers
URL: https://github.com/apache/mynewt-core/pull/798
 
 
   

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/net/oic/include/oic/oc_client_state.h 
b/net/oic/include/oic/oc_client_state.h
index 8623ffcd8..6ad1eaa12 100644
--- a/net/oic/include/oic/oc_client_state.h
+++ b/net/oic/include/oic/oc_client_state.h
@@ -31,6 +31,7 @@ typedef enum { HIGH_QOS = 0, LOW_QOS } oc_qos_t;
 
 typedef struct oc_client_response {
 struct coap_packet_rx *packet;
+struct oc_endpoint *origin;
 oc_status_t code;
 uint32_t observe_option;
 } oc_client_response_t;
diff --git a/net/oic/src/api/oc_ri.c b/net/oic/src/api/oc_ri.c
index 7edfef2bf..9636a1429 100644
--- a/net/oic/src/api/oc_ri.c
+++ b/net/oic/src/api/oc_ri.c
@@ -807,6 +807,7 @@ oc_ri_invoke_client_cb(struct coap_packet_rx *rsp, 
oc_endpoint_t *endpoint)
 }
 } else {
 client_response.packet = rsp;
+client_response.origin = endpoint;
 handler = (oc_response_handler_t)cb->handler;
 handler(_response);
 }


 


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 opened a new pull request #66: newtmgr; allow payload in CoAP DELETE

2018-02-08 Thread GitBox
mkiiskila opened a new pull request #66: newtmgr; allow payload in CoAP DELETE
URL: https://github.com/apache/mynewt-newtmgr/pull/66
 
 
   


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