Skip to content

Commit

Permalink
snapshot: Update mcumgr to commit ae4659b from upstream
Browse files Browse the repository at this point in the history
The commit applies changes that have appeared between
 apache/mynewt-mcumgr:ae4659b445b707409fb17d626c806de3ed284720
and
 zephyrproject-rtos/mcumgr:d4e97cd4fc80ff949415062b1c83fd42929e8fe4

Signed-off-by: Dominik Ermel <[email protected]>
  • Loading branch information
de-nordic authored and carlescufi committed Mar 10, 2020
1 parent d4e97cd commit 0a71499
Show file tree
Hide file tree
Showing 106 changed files with 8,473 additions and 414 deletions.
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions README-mynewt.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ To use *mcumgr*, your Mynewt app needs to be configured to use:
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'
- '@apache-mynewt-core/mgmt/smp/transport/ble'
- '@apache-mynewt-core/mgmt/smp/transport/smp_shell'
- '@mynewt-mcumgr/cmd/fs_mgmt'
- '@mynewt-mcumgr/cmd/img_mgmt'
- '@mynewt-mcumgr/cmd/os_mgmt'
Expand Down
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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.
core commands: image management, file system management, and OS management.

mcumgr is operating system and hardware independent. It relies on hardware
porting layers from the operating system it runs on. Currently, mcumgr runs on
Expand Down Expand Up @@ -112,27 +112,23 @@ 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`
* [SMP/Console](transport/smp-console.md)
* [SMP/Bluetooth](transport/smp-bluetooth.md)

Implementations, being hardware- and OS-specified, are not included.
Implementations, being hardware- and OS-specific, 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/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.
- [cborattr](cborattr): Used for parsing incoming mcumgr requests. Destructures mcumgr packets and populates corresponding field variables.
- [cmd](cmd): Built-in command handlers for the core mcumgr commands.
- [ext](ext): Third-party libraries that mcumgr depends on.
- [mgmt](mgmt): Code implementing the `mgmt` layer of mcumgr.
- [samples](samples): Sample applications utilizing mcumgr.
- [smp](smp): The built-in transfer encoding: Simple management protocol.

## Joining

Expand Down
69 changes: 68 additions & 1 deletion cborattr/include/cborattr/cborattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
#include <ctype.h>
#include <stdio.h>
#include <sys/types.h>
#include "cbor.h"
#include "tinycbor/cbor.h"

#ifdef MYNEWT
#include <os/os_mbuf.h>
#endif

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -117,6 +121,43 @@ struct cbor_attr_t {
bool nodefault;
};

#ifndef __ZEPHYR__
/** An array value to be encoded as CBOR. */
struct cbor_out_arr_val_t {
struct cbor_out_val_t *elems;
size_t len;
};

/** A single value to be encoded as CBOR. */
struct cbor_out_val_t {
/** The type of data. */
CborAttrType type;

/** The data value. */
union {
long long int integer;
long long unsigned int uinteger;
double real;
float fval;
const char *string;
bool boolean;
struct {
const uint8_t *data;
size_t len;
} bytestring;
struct cbor_out_arr_val_t array;
struct cbor_out_attr_t *obj; /* Terminated with a type=0 entry. */
};
};

/** An object key-value pair to be encoded as CBOR. */
struct cbor_out_attr_t {
const char *attribute; /** The attribute name (key). */
struct cbor_out_val_t val; /** The attribute value. */
bool omit; /** Attribute ignored if true. */
};
#endif

/*
* Use the following macros to declare template initializers for
* CborAttrStructObjectType arrays. Writing the equivalents out by hand is
Expand Down Expand Up @@ -144,7 +185,33 @@ int cbor_read_array(struct CborValue *, const struct cbor_array_t *);

int cbor_read_flat_attrs(const uint8_t *data, int len,
const struct cbor_attr_t *attrs);
#ifdef MYNEWT
int cbor_read_mbuf_attrs(struct os_mbuf *m, uint16_t off, uint16_t len,
const struct cbor_attr_t *attrs);

/**
* @brief Encodes a CBOR representation of the specified key-value map.
*
* @param enc The CBOR encoder to write to.
* @param attrs The key-value map to encode.
*
* @return 0 on success; SYS_E[...] error on failure.
*/
int cbor_write_object(struct CborEncoder *enc,
const struct cbor_out_attr_t *attrs);

/**
* @brief Encodes a CBOR representation of the specified key-value map into an
* msys mbuf chain.
*
* @param attrs The key-value map to encode.
* @param out_om On success, points to the populate mbuf chain.
*
* @return 0 on success; SYS_E[...] error on failure.
*/
int cbor_write_object_msys(const struct cbor_out_attr_t *attrs,
struct os_mbuf **out_om);
#endif
#ifdef __cplusplus
}
#endif
Expand Down
29 changes: 29 additions & 0 deletions cborattr/pkg.yml
Original file line number Diff line number Diff line change
@@ -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.
#

pkg.name: cborattr
pkg.description: CBOR encoding/decoding library
pkg.author: "Apache Mynewt <[email protected]>"
pkg.homepage: "http://mynewt.apache.org/"
pkg.keywords:

pkg.deps:
- "@apache-mynewt-core/encoding/tinycbor"

pkg.cflags.FLOAT_USER: -DFLOAT_SUPPORT
Loading

0 comments on commit 0a71499

Please sign in to comment.