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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.11.4-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.4-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.4-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.4-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.4-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.4-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.11.4-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.4-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.4-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (1.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ i686

mcumgr_toolkit-0.11.4-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.4-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.4-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.4-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c959f425f43405820f70b4dad695e38295e0bfe32d49435ce26abe6e97ac4545
MD5 974d426e9b243ed5d429628b6fe4128a
BLAKE2b-256 3ef7c0d4339b0fb8bf1db15b448a8dd5e82dc14564df69396e7f6659af392cee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 67988843d2e98a70e71b1a2cf4e099c1e768e5aca04768192e6e43b68db3e6d5
MD5 85130b70e5cc551950fe45288b322a67
BLAKE2b-256 6fe6aea79f04677e6c69ae411f9cba3dd83c7d8a9498fc9b7f817d48cd95b03d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ffb24959619c4d7586a3124ff287c932fba464b24d2631b394d5393d5a120f44
MD5 258b4a52732971018a7b6c6ea2d7879a
BLAKE2b-256 9e40f3d015998a41d1baa83936c6f6099af223e7c0de3bbedcf7082afc069db3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 be92d48fede02aaed2dd0eace71955ab9a633625d1d6d9de4e926cf9ba0ae1dc
MD5 88eeb969498f3f8b83981cd6163ec96a
BLAKE2b-256 adebe3ce3b7b17e71558236f1f3463815e66f8979e6adc75edbe840dadcee877

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 25cc644941b3c7f48d85b9c152a979c53503cfa7ab749c9ebd2333ef46a87d5f
MD5 26a6122bf4ff35f18acbe0e86c1c989f
BLAKE2b-256 3c993709d5397ad6fdc039c8eb337fbfbd86706f77d084e4e7882345b96cf7e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8aec8a7e098ed9b9fa8c9b11cefd1cec329b479b785a35da98fc9bf48fa3e29c
MD5 c8c0bd63c025c142863557e4cd534091
BLAKE2b-256 83bddcd3ec7b699838254449f59d5ee17b007d11fa68d5d0f1d2e0ff9980be38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 faa2de32a6dcd890acb61c2b545d3b49a0c6e3f579ce7d4fafcd452c967fb12a
MD5 6b9bb7bb95fb2df668600e5e9200d0f9
BLAKE2b-256 bb5456d264366f62b9454e67506835f2a92a4cfa5a148f23aec66e836354de8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 5142b3a97f668573ea901c86c22a1e4ba8ad8bdc2fa8f72a73fdc520cc176923
MD5 4f57e171d66f0d82551d41fda307ed2e
BLAKE2b-256 b79b89b74bf4b7f3520a444aad3a88e039a992eb96385aa3a927104c49b9977d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 94d60b60c5f5cf15a8469e630b87b051d4d8b736da03f5382a5fc18b9fbca41f
MD5 34a2d99add6543968f924c24e4bfde54
BLAKE2b-256 a7b335347e4b5ba3f996094c5210fc63cd722cd8cd76ca0d16ca410cc1ba97fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 57de3640649f00cc2b5cdaaa2a7419b6eaa71ba23d8c4453fb78f06c3361b3c7
MD5 4fd1ea24f272b8937957221e16b2c650
BLAKE2b-256 afce8e991709c01e44821bbb8df7eaad792287737ebd8d455f1a5c6faec8db72

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.11.4-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 334b88d1572508eb5ad6bf9e2d2a87e86629f1f612a7436350fa3e816b58486a
MD5 88441d89424c4d2fefd5bc73e7e22ffe
BLAKE2b-256 c5b5d4b968564b85bf8c6049c8a9b38e29d32ed4d574b6d24ad0679f197a9057

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 2d4b6f3034024da99c446d8223da5f8fbe5c9e9ce6b2e6722a9073380e59b89f
MD5 27630f78940005f7648688c1e66ccf5a
BLAKE2b-256 23254744c6d2766f62070bf940ffd263dc544e8e12b7bc871dc4b1d8f83a6e6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.4-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f9781d285c4712e0e544da0905f5c768834ccd51ed5d818ddb896a0ec95845a9
MD5 f1c96a516fde471d133f3e06a3f2c329
BLAKE2b-256 52858152292207d8e0542a6e170895046eb8203f7b8d0769e5a61879244df5a9

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.11.4-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.4-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 8a6be1e567e8e949dd271241bba23a9ad275035e77c74464d5ef8c47f594fd8b
MD5 bb6b7299edfc42e8d2c50734b5969397
BLAKE2b-256 cb6451a5cf7536ec18496e0ad17467c0eaac64d808dd29101e827ebda8058219

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