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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.13.0-cp310-abi3-musllinux_1_2_x86_64.whl (1.6 MB view details)

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

mcumgr_toolkit-0.13.0-cp310-abi3-musllinux_1_2_i686.whl (1.5 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

mcumgr_toolkit-0.13.0-cp310-abi3-musllinux_1_2_armv7l.whl (1.5 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

mcumgr_toolkit-0.13.0-cp310-abi3-musllinux_1_2_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

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

mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ s390x

mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (1.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64

mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (1.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ i686

mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

mcumgr_toolkit-0.13.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.4 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.13.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 204f8899a2756312b18e54ca53b35ff93dd2b9de0c216fe1475ed464d2883a03
MD5 1e2081a81abca02ffffa26558344c09b
BLAKE2b-256 8d63f01882aec7bccee57979c3aa91b4d4f2b88f70698ffb4134ba26e6d7ae36

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcumgr_toolkit-0.13.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.20

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 e6695a8eee5ae8fe81dd3abcce2ed18d44a71ce1ed3ecb4bb4819f8f9ca893a8
MD5 d024f25f91e3539f568ab52b54bc5de0
BLAKE2b-256 f8a595cae19cc1b3f40308bdc0aab6d0ecbae4d18b9402895f76294193409ba8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 34afb14c6f51ee9dc71016543ec826fb505e5f94a59936805c604fddf5c0a226
MD5 61b652dc949c5bafbf86fafef77a07d7
BLAKE2b-256 e9e5310a95ab97294bed3923d35115504fa24ca3669d22432ed20d58f33272fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 320bea89ea49b3219f28317fa62892611b76b05f4c6119f95d71c9443044575f
MD5 2104b03d74f03cb4198c5b5cf746ef49
BLAKE2b-256 6cbe0ef228b2061e90fd62f3665ab8d6014d7e6051e189902d07b5f6593d848d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 723f7fd97a830a981adee9855a69b97f28bb5c6308af7c09b56f73a89d956d7f
MD5 162658483467914bffcc83cce9eb9aad
BLAKE2b-256 59e88b0d12e28083862eb50f1e2fdf9138c49818f2869d27d672c74c55a6414e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 201b9131cda36621529f67c0f81fd00353d404b4456b22528a070fa9266b4500
MD5 1e1ba64903c6389c62f02c4c297989fe
BLAKE2b-256 cdd9fcb0c503826748a4aa26b6fd5ded665dd9d9f58f4b5d2507b1cddbf3679e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6835464a21c0123bf4023279671f5011e45f7031bcb550443f20ffa60724e204
MD5 1f4542f53e86aa32375cb323e7880fca
BLAKE2b-256 fedc8ca5aa4ddedb890b5c9f23ec9470068053d51c61ab37479ed66939284cd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 dd4a559537d76bc0de8dcea58941696173b764accb1e0563b5a34e9d88b1da34
MD5 1f62b6ad1b5f75629dd0a4fd4ae0fe73
BLAKE2b-256 bb923c558d9bce30acef495b481776cbb6cd5cd284ff141d156ed30f928cd6b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 3445f36e623cfeea959f5a57c3fae8f607fd669271fe5040325215e6cdd60e20
MD5 be8b7a7e99d1fe3acd638685c7444614
BLAKE2b-256 e70717fa0247222f9729d1d45e3476752d3f79b92b765fb41152826d014f3bb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 e9e9c6aa333edae5563fd80a0604b5a0a04c9b1fc5fb0828b5c5cfd9bc457cae
MD5 a3db49247b920a44e84590fc73c832f1
BLAKE2b-256 7d6bdb5dcc1a5561dfaed8820431f5af46ed2e0bdba19c6475ad7f8274a47535

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 89bb172e29360ada343b8cce739b7127492c0c04c5bc5b2db7be2b3c7256563f
MD5 4fba3daa28abef997458ae1a0a206051
BLAKE2b-256 52bce9aa3da433bc517185fee921af68796a73759672905eadbf1520c324ac29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 a84caac320447a8882a0c127a665ce970c0b39b84a4062aa8cf3c5f1696da17b
MD5 c3e3764645a670593ef7b23354d89da2
BLAKE2b-256 2f85d3782739d862e2acbeb489fc1d80fd31c90262d79a704c2ae33a25995e42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 70e00b9961fc5236fd02e398ee25c379c19f1c0576953374cc6200bbe34f04c8
MD5 c27472c2e39b66caff3eb71ab54dff00
BLAKE2b-256 f866640501d10234a086f33d5368a65f3f896096de7fe57bad3a721dbd037498

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.13.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.13.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 6f6ceff9f099602cdd3957833405cfc17d69da928621dceedcd51aad961ac21d
MD5 3bb4cf44ef9810d8c1d4835148069182
BLAKE2b-256 617916d38a6675cabffbb360035879eefe6a6ddd33da4c7e4c73378a74be9e2d

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