Skip to main content

Python API for Zephyr's MCUmgr protocol

Project description

MCUmgr Client for Zephyr

Crates.io PyPI - Version PyPI - Downloads License Build Status Docs Status

This library provides a Rust-based Python API for Zephyr's MCUmgr protocol.

It might be compatible with other MCUmgr/SMP-based systems, but it is developed with Zephyr in mind.

Its primary design goals are:

  • Completeness
    • cover all use cases of Zephyr's MCUmgr
    • for implementation progress, see this tracking issue
  • Performance
    • use static memory and large buffers to prioritize performance over memory footprint
    • see further down for more information regarding performance optimizations required on Zephyr side

Usage Example

Connect to a serial port:

from mcumgr_toolkit import MCUmgrClient

with MCUmgrClient.serial("/dev/ttyACM0") as client:
    client.use_auto_frame_size()

    print(client.os_echo("Hello world!"))
Hello world!

Or a USB-based serial port:

from mcumgr_toolkit import MCUmgrClient

with MCUmgrClient.usb_serial("2fe3:0004") as client:
    client.use_auto_frame_size()

    print(client.os_echo("Hello world!"))
Hello world!

For more information, take a look at the API reference.

Performance

Zephyr's default buffer sizes are quite small and reduce the read/write performance drastically.

The central most important setting is MCUMGR_TRANSPORT_NETBUF_SIZE. Its default of 384 bytes is very limiting, both for performance and as cutoff for large responses, like os_task_statistics() or some shell commands.

Be aware that changing this value also requires an increase of MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE to prevent overflow crashes.

In practice, I found that the following values work quite well (on i.MX RT1060) and give me 410 KB/s read and 120 KB/s write throughput, which is an order of magnitude faster than the default settings.

CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=4096
CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=8192

If the experience differs on other chips, please open an issue and let me know.

Contributions

Contributions are welcome!

I primarily wrote this crate for myself, so any ideas for improvements are greatly appreciated.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mcumgr_toolkit-0.9.0-cp310-abi3-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.10+Windows x86-64

mcumgr_toolkit-0.9.0-cp310-abi3-win32.whl (1.1 MB view details)

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.9.0-cp310-abi3-musllinux_1_2_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

mcumgr_toolkit-0.9.0-cp310-abi3-musllinux_1_2_i686.whl (1.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

mcumgr_toolkit-0.9.0-cp310-abi3-musllinux_1_2_armv7l.whl (1.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

mcumgr_toolkit-0.9.0-cp310-abi3-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ s390x

mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.9 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (2.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64

mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.5 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl (1.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.5+ i686

mcumgr_toolkit-0.9.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.8 MB view details)

Uploaded CPython 3.10+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 64df12de70176d7162ae486cadca35280235ce6e775e6c2842b11f119e4d9b63
MD5 b449f8f3b0ceb87b91de533da999a510
BLAKE2b-256 ab98c73e4d6e2c614a8e92c930e977c9b7bf9d3d5876bbfbffcc5a7d83cec61b

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-win32.whl.

File metadata

  • Download URL: mcumgr_toolkit-0.9.0-cp310-abi3-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 e56ff0121cba9792e09049a25722833c65ba911faca7ade92f5ea97e6d30456b
MD5 f119830d3f79e6ff3d8cb96c39869a44
BLAKE2b-256 1d271f6341356b9c1e155b8c53f2eca599bec43b71c9f976b719d247db762af7

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 6ecb505c824ec8b78d16d7d31d2de89f173393d56c5878c72eb19a01a3004abc
MD5 7bf338850fd296fc19ce1af88abda784
BLAKE2b-256 2adf396f481d91f23a6898d3d3e6793dc65c354b35119b96cd9bfd9d26cf8f0f

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 0ceac0fe0fd05d3f897a97231483769128b30ec172ed50d58bec7b0b35ca4f2a
MD5 ed1fef22c4cc4fc103c3c93d8a702d1f
BLAKE2b-256 620feb52262d2972b0a29c037d5c71341126671b7f0385aa1b9ea8a067f3d12c

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 5ba49447af307caa6fb2ae865977dc5abe140175f8b21d5ce0792b611704abdb
MD5 7f5dfb93ff7ce5c04507948ebca78c2c
BLAKE2b-256 af4edd183bc4f1ea29b67b8a3dd876f068dd118a5071ad9cb15b228f7ec3fa78

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f730f57d06e277c6a139a01e7b8c25eaf8790d6032a997641daa4b79d81d5ba7
MD5 e386b045b9fce65bf19c0656b922d1bf
BLAKE2b-256 12e8f408845670db016bd847a093bb8a6617ce714f6e312f1a93fc8fd59584a7

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ccd716e7e4e3acb09aed6166140b382d1c21c63b38bed4200e9656fcdd6ef1b0
MD5 f2accd1a9490f44566f47637a3488c8d
BLAKE2b-256 2f275b05a70092fbe3180e837c715519a1cab74d79a4ed6889d67dbeabfb2a5b

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 761d41d22adbb89c8efa5d6f7155a505be063b28dac24c321d82f4c7c82e5ac5
MD5 b21729101efe59164edf9a9f54c47197
BLAKE2b-256 dd26f4a140a6d60647c5a4b09bab5c2fcd7408c03a978e3226f78febd1445478

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 9d1ae0e0a6e9abd7dea0e02bfa02af7bf30597d1817ad4c54691b3e74b0e5ab9
MD5 1c05d551ba77f577ef52bb75912952ea
BLAKE2b-256 ecc81b484320e9f9764a9f8932c8e79d90cb2001dc1ae08f66fa1089befdc4f9

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 6b2c59864da9abd2c7d24a459a825a3606f34ed3c00de28b6f9dff9963ce78fe
MD5 940a0c180bc3720ecf2765556650e8b2
BLAKE2b-256 9326a571403eb8db7e03b5e26e94e8f39a963db098a03d9246dbcb49eb9d088b

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 9bb3ad3677883153c15527aa79de2609e0ffe45fdc8422542cb5421f325f96d0
MD5 694879f4c44f4c4ac09f26ac93784b9a
BLAKE2b-256 e6636dad791417581f84461b4beabd9c65e6c01bf259d43bd743acaad3e3980d

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 45f7d795f98d7e8aa810a7f6926fbc08732996969d5712ba1d7de8e19013cd95
MD5 67dd4650acb594bbdb392251f2ed0b34
BLAKE2b-256 4aefc1d2beb6e4a8c0ccf72b10a32db7c95f2207fff559ff42c899042620436b

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 60d9f921a3f2a13739f3df8de4b1d23232825e204bddd4e12c519ab2627d88b3
MD5 c82eccd7b7f99c9d3d9c435b13ed1b2e
BLAKE2b-256 1ce7a1d3f6d8682aed127625ff2bdd6e8288492427a3d504f737cf5b33f8b3b5

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.9.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.9.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 52bb19b15a716ecd2ac9af346e5ddd0dae5b607c67e6e61722f2ea50c5bd8873
MD5 8e8e67f527c41ee2700506c276b3d7b9
BLAKE2b-256 8b71156e5ce8105717ed506e79a463bb5532b89eccb55bdb60c9f7d3ff15909d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page