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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.10.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.10.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.10.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.10.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.10.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.10.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.10.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.10.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.10.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.10.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

mcumgr_toolkit-0.10.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.10.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.10.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 31b68f134300e9cdbe1aec307772765bb10f1d423f381496266b949ec5f657b9
MD5 5ed1fa22cca2376b3233e2ab8123b27d
BLAKE2b-256 183b922ab9198d8b4eb349d36155a480aed7c4f70fb4e280cf1c5d65a7a8a7a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 d7464291f050e5626dd14da8cccc31ec37bedc59fdc2ff44ef4bc7506d6b41f1
MD5 3baa60b805d6838a103c471fed50ded1
BLAKE2b-256 7b8590c6496da4964c597af3cedf4aa7c8a2e7df366b98d0002a4e818564193e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 54d22be7b3dc67b64e3925282e6d8ac91243ba2de1efec630a57a43140a987a4
MD5 f981abf217613e00ece5f868c249d4a2
BLAKE2b-256 bf40fb839c7e260f285f01ee04fe5e4eb342835d3042574a3fc244d498620b51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 3011d446031e135ddc139210ca42e5318695e8743fbc9701db5f75cc427f1755
MD5 78cfe41c9d353f7a78eb954165cfd71d
BLAKE2b-256 d852090b0376def611af764b48d4678f0d9d22ed31b3809e3f7f58f1f5858a39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 1f1b8879b9066ee4bbf45841dd6c3d92932cb181b7e6be3f0eb454db6da6b07d
MD5 e3a9bf67328d529658713aae9b4dab10
BLAKE2b-256 3052417ba49a0b65972cfea1edcf532c5fb2dd59ae34f3a014756cfb9be35cb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 012ac4effcb79f619871c1a28705db2803b5ae3cbfec39ae0ce1453b7b9f037f
MD5 2f82ea3834f27ee1b8c8aac50bbd7394
BLAKE2b-256 a43e146b7d1a8e943ac1cd4358c9866840f0000285ddd7b3f3254324731ef201

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6472a825b39ec5b7225ecacb8b1dd659ee27c7d0e4f877ae659f534689a95ff1
MD5 56883c12dae084cf9d95efac56d136b9
BLAKE2b-256 05a70a68ad1402291f6f9ca012619b2de450f6dbe9d1ded065a53b2c6804f478

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 c7ed1615eb6f9af2802e4daef06efee6de9efe72091bbac2bd3542a8f724f9f4
MD5 1201c9393222c3af7165e004d001e678
BLAKE2b-256 df2b315f6867db10236fec69fa9346ac606159f85ffb9c40efec8572f2258c84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 bbf6ad216ea3a5e8f35586d999eef796abcc4d55d91aa1870a69448041428303
MD5 a39158e6e8c35843b6c6bb1d60831697
BLAKE2b-256 5df3afe903848a35b4446e0abdf6638322029cf34fc1588d4d6f3309da0f2289

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 5ff37c56d9c6c82b2ab3a5bb2e72fe0281820f6911498d43525d563303337d57
MD5 4308f2f44d833a6071e1cfd98d1c2f54
BLAKE2b-256 648bf7154225e318412aa8e8f332325572f30fb21a4251c5648664d158c3f3ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 5ff02fd78f55bc8c809d5beb91d656dcff23f8534449fbbdadeab95c4d886b95
MD5 2f9c9619429671371ebf21d26e67c6b3
BLAKE2b-256 bb9d7f0c149acdb009fa06835ce387369c8e726fcc93181815b0b2585478d2e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5849be519246180132897f3c99e7080f722facb9ef2d5fceebfd3ab42a59bf48
MD5 38d0c21a1ecbbfd208e25d06a6c414a9
BLAKE2b-256 97097bc16185d827285524df9422dca4502aea7f16562da70e5366e5d7dd31dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.10.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 2cc9ef7f163331e14253d5eae7f85b9ca1cc22715ab5429a657fd0c531c2173b
MD5 8f3ec1e0481664c0fb2a408bb3c2f6fa
BLAKE2b-256 00c601f8e1c17216b8572127650f1bb0c4b11135a09f241a374a6046863380b6

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.10.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.10.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 10d8cdb87ade9fa60cb61376bf74ee364b53230ee4336c2458de21deaedb3001
MD5 8204554b657c8bacc4f695116d908245
BLAKE2b-256 c11b311779319df644b194b869ba8dab9d0d770d9b45fbf8224f3282085595cf

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