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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.11.1-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.1-cp310-abi3-musllinux_1_2_i686.whl (1.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

mcumgr_toolkit-0.11.1-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.1-cp310-abi3-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

mcumgr_toolkit-0.11.1-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.1-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.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

mcumgr_toolkit-0.11.1-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.11.1-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.11.1-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.1-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.1-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.11.1-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a01b693387ed2fc21b2aba6a70345b3c97523c6837e1e9347fb21c184f0b1439
MD5 0b5739fa29e161ddc1e3cedbabb7fd92
BLAKE2b-256 0f3f3176a32b237bb762ef0b0a86bbdf833cb6bda7afe2e5611aab256feaf37f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcumgr_toolkit-0.11.1-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.11.1-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 151014f4de15b887e964dc350dc3d023fdd436b4bdfe35f0caa5306f2918a73b
MD5 4e9b2f18191f1160422fa21d0fb29328
BLAKE2b-256 e9236dfdb7ee890a3d41fca3736f90354e2fe9fe7539f96eea6db06540981eb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1076a3e24018a194517e5a38b926aa5cab9ea8621b9606c68b9f2f4b6e3aed01
MD5 b200e3c641b7b8f8665170c698716ad0
BLAKE2b-256 bccd70102452181d83eefdd244c7972af74fb822d3fcc0a6de3055d255773898

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.1-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 2678a15532bab206d1b3a14515bdccc4ff0d4bc0826477c64a0b899c48cf6dec
MD5 5f9199c809b6d9d5cd78ebbff3b0ad36
BLAKE2b-256 d11253006a2a5caf22b59ee51bf01ee77e7d04ff6fc5f00de37964cc3f9a1d98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.1-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 5ca2e1213fad8af27867514c5e8fb13fe29220709c8112231f62455ae3e0195b
MD5 766f0869e392e6bbb21b8c927f302031
BLAKE2b-256 6acc192682418ab970cb2525e32142bb4ddfe47f0638c0648a5551043dd6050e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.1-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 d037a3612b606d402689a15765f1b6d345efd4f844dcc4b92dfe5af8fee8a4ef
MD5 468f607d68a8a4769d56e3ffc1eb468f
BLAKE2b-256 08c44a96058a99ef17f3dba641f7c9f98543a0ea382d6ec10627ece0ba2317a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 267121004944d42257319c021d9b61a84c3a2adfa6f4f63fd0781f5ad30211ad
MD5 9419ef28411eef70c7cd5ecc8927def2
BLAKE2b-256 d28920409672a3938d509b0e98e5afaa2db9eade9dc50a8a767129342f46f21b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 752ae1f58ab83eabdd22e3b61121d3cd9c0daa35e79cf6b16103cec4091fbc81
MD5 98a71c8e6e43d8d20dc091e707cf5dea
BLAKE2b-256 c9e2b9ba35d895b9203b49a04f7795a33f2198b489ebd411c3752e5d5785b821

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 1233c83fd99710e0edb74e8c3d4b377ebdc5ce3deca1403cef65815193cc8715
MD5 004840dfa4582b035c357dd1cae432af
BLAKE2b-256 92a29e4348fbf49cb839c0cfa00e97f7a9e1efd911444be52a473d01a68c7110

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.1-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 2d9754e9d7394714dbc1432ae230da50fcc3db89ddf8a728696842a9d75d59a1
MD5 f7afedecf6d0d61044cd6da6c30b5b71
BLAKE2b-256 d7cff1541231bfb144543b459fa5b64176f93cf4424d7ebc1b671248e7b1f9ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 cd1b3366e8e1129f906dcef6d66c73d4814fc33966789573aaa61110243484fc
MD5 3c8dbc7e6f43f72ce473eba652a0003c
BLAKE2b-256 93204f60851395f6356e7efda62619e2045f935d802a355e3cf40ded0a14d4b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 75afc6f5a4388699cd9b963597f5ec84ab4af1361534eb07907e3f45cce39521
MD5 8d7f2cb380fa4054e2640232a437b416
BLAKE2b-256 4798ef0090bf98fc626ce2218c46cbdfad56855cb42338118ddeecbdc3436eab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.1-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 b3b385464f056440d3c5a766c219c440d0d4f282f89344ef3cdd9a57bc05853e
MD5 7e34b271d1f93d58ba5056823cfcefbf
BLAKE2b-256 e26c9c1c6ded1ba9feded64d74f538d503a27d0ea880d1ac9a8ecbdfda0334cd

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.11.1-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.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 317a7f101a41086f790f3658d900bc6f89d04a78f33c95e0b6a8ed7f6817103e
MD5 be5a204588a23ce8f417925d23a6afbb
BLAKE2b-256 6cd4456b645e90208808cfb7aad79dac550a46785762f483d5897b44e3e6079d

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