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.11.3-cp310-abi3-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

mcumgr_toolkit-0.11.3-cp310-abi3-win32.whl (1.2 MB view details)

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.11.3-cp310-abi3-musllinux_1_2_x86_64.whl (1.9 MB view details)

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

mcumgr_toolkit-0.11.3-cp310-abi3-musllinux_1_2_i686.whl (1.9 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

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

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

mcumgr_toolkit-0.11.3-cp310-abi3-musllinux_1_2_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

mcumgr_toolkit-0.11.3-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.11.3-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ s390x

mcumgr_toolkit-0.11.3-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

mcumgr_toolkit-0.11.3-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (2.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64

mcumgr_toolkit-0.11.3-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

mcumgr_toolkit-0.11.3-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.11.3-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.11.3-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.9 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.11.3-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.3-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 36096e178a4e4b7fe378f6965e9455da4d2efd03be94b2d841f348a83d4a41ea
MD5 66e4e937efbd774cc9c74ee71aa98db6
BLAKE2b-256 e6eff8b6511bb6049ce428f0776eebfa2b988e802c0ad9ebc766a10ac2778672

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcumgr_toolkit-0.11.3-cp310-abi3-win32.whl
  • Upload date:
  • Size: 1.2 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.11.3-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 bf2e9171eb62aaad1578b13ac43a4c1ca61e085f663d685066a8e3d80182a12a
MD5 5a895898d6e75a80a96e75caa1ad04ac
BLAKE2b-256 6fb4e4e3a5333380e0e655de9433069405593de727e8b10d9929d64fa2b0e922

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.3-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8c57d4dc701bf2669401f8b9ca4f9f9a3a629233050bdeca9fa748a148e6021b
MD5 a9e54e6c5671524845a3bcb9439ed6ef
BLAKE2b-256 221d1304e08f8d6e4c1583df72e99b07fe7e07cf3b240ae8266d318e4345abce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.3-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 271c94fdcbec1dd709325d7895301652c187c9414a15a310e9ad01e32b7186ce
MD5 c44651aab992e91e485b5f00af9c915a
BLAKE2b-256 8abf1d477320996a753ae2843817985dacc2dd571782d9d42f0ade21729f499f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.3-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 92c1440773e6f89cedf4da1f2ef71d2b856c9ffc8b3c739c9c6df38b9087207a
MD5 e5ffd5f7f08c9b53da284a2cf27b9d8f
BLAKE2b-256 74d44165b00234d74853f2ce4a84b66f443fed18074a75e805330543e51bda65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.3-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 08a6e00c5b5d389870681e462b068a35b5c413db6a030dd6c591eac11f877d04
MD5 49eb3ff50d733bb7d298200ebc02a2fd
BLAKE2b-256 81bf82c485a6b8f5e584eff8eb1b53d08c95d5bcbb63d7430d7d026092ec6b09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.3-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f827bdd16eb9de4605cc3a62d5d182342646a6b1b9ed1ae20fc40edcbb1f172d
MD5 131e6e05d93391e105290bef59012511
BLAKE2b-256 4c6c4d710f497b2074f4c82b0f705514df2c36698885a698cf0b7fb824e5ee9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.3-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 216a6ec24600455dcf8765ce69d05890ad9979cc5658871d9e7364790496220c
MD5 7fd3fccb41abdb0a2a2a8caf0a7b2d5a
BLAKE2b-256 c7520fec870589af0d9e843efee03cc0059fe7faa0ced03acb4c5e2b2f509151

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.3-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 d492a1d73d4b90144255eaafb937c2067e58f9d13239cb7ea053118b85bea9c3
MD5 385ab7d9a8222656507fbbe16355d928
BLAKE2b-256 76c53ebc9998f2289de1191008235c12df9675db958498c06c7aabd32ef0d064

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.3-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 87d010cd89deb8c2039f228e6d9a5cc78debda134964fcb1a000798fd1276e01
MD5 8664b4b3de9428df8f03447227361ba5
BLAKE2b-256 05fb3a5d8e4bc5b7a45f05c4b7a661371f5b0cbda054324dc50b73f1515f0636

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.3-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 0c15514ed6f5499418eb39d9a55a675062180f99e0bf80efbb7f6b855d5717b1
MD5 7093b6af1ea2d3cf8f24dbd36fde3816
BLAKE2b-256 3188d2c4bef8b64cd88a524ebf80c54cc1e3c2f89a73f6a60cd6af2849485409

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.3-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d30aed4a1c7e4d37dcc1db072c259c4c954d98ae85b1810fab11c4602b13198c
MD5 baef2ffb347fda93f892ea825b9966c6
BLAKE2b-256 a84407f89511b6109914efe99965d7f344beb8aec23c8db56e23fe8aa43cc8d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.3-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 2f80eddd9eb24f6a35505700824aa8cca3392c034a4f2b05e4220863a11f941f
MD5 fd080ff5c846d25f5f03634eb232e5c1
BLAKE2b-256 ff436c98f88f727e3b082c8f5be30dfe53b5ccd46b7b153c422c59ef594a6266

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.11.3-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.11.3-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b3e699ddc7ba6a2b5c0e5b279731ad8e24f38a9fdf532e0844cc99b08c62f14a
MD5 02d455efbaabfe99f6878461d39481d7
BLAKE2b-256 1e7b5ca64af292d43b8095831cad98151d9c133dc03cf2e2c766e3f5fc1632e7

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