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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.13.2-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.2-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.2-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.2-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.2-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.2-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.2-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.2-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.2-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.2-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.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

mcumgr_toolkit-0.13.2-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.5 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.2-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9875924f773d9da4d43bf8e4cb5e3bad73431e995afb52845dcf9301f80dcd07
MD5 e98762687cc274a13b3df8aa25a8fda1
BLAKE2b-256 fb5b1513e646d44a9427114a0f309a8d53a0c25749df83bb10f80c4b2dc1586a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 69d8e8e1ee481f4efc1815959b1d813195f59f9888bbd0a365953d58b7fc9da0
MD5 66a7e2be77ff518d43cc6b51fea1c934
BLAKE2b-256 bd09f4626200598b7e0d084aaf5a4f73ff24c618832b6ef89879ace9bd31d06f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9712f2262a03f748014e3021b33e3187fb133525be40aca744e4c6ba96fb1fc5
MD5 dbfe95b525d3a2683361bd9737cc9bfd
BLAKE2b-256 aa448572224fcb84a50348fdd46651be9a2b9d1f3c2c0c16cefabdc44d43c347

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 7e9dc358d633105322e9d1da7b78fbd293ba1296bf158284c7459bc11fc57d51
MD5 993407b8a638c348d091c0db0e345eda
BLAKE2b-256 73df404b8ab53129eee54df636f35144dea7bef12fcb226a61a91ab1f39eb281

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 4d262ef35ec498b4cf63a3faa393a7e7a8b8a436bd640170c9cfa4c9d4d0a227
MD5 da87797d14608c3a88015acf1170f119
BLAKE2b-256 7e946f232213e2419d5f33bee4b8d08ff57ead663def692ac3fa9e638d4782a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a9839f9a3629bf9c97d917f68a9e891cf28702e9e4d7e37ea0182b8b567858f9
MD5 9d9e91cde192e0f37abd8f739748dd89
BLAKE2b-256 8b3d22c076d592e1e2bceee90a1ea07c111402f40954697663b9634f47597745

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 69eb0203183d483ea555aabead9473ef3ba64704339391a547c1b3da015d29ff
MD5 d87fea6e0cc3005beccdd5aa4fcf6ce4
BLAKE2b-256 c7a99132564b76ef422123349c907ff768a5585a512cb3b2e18b625bedc36e88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 0b2dc3442237550d7470492a63affdab37a8f818c68d9fadfd3fcae58a01543a
MD5 ad2995b093bf911556d0202761b7256b
BLAKE2b-256 115a246e534688cf4c27a5ab58f08426e333e525c289dd452d2f3a443dfd1eee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 3f0d83c1208ceb353dc5d723390a9155944d4fb814f32e67cf9908bc9cab08cf
MD5 ddb9ce169bf65bc75b9fec2298dec183
BLAKE2b-256 16fdb1ff154c91859dda08f388fa2d8519bbbbaab12e4741423463d3769c80e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 deab25c6c92b11ba8753ae019c76728ef798beaf64a98a975979f251ce36bb12
MD5 4e749c62471cd876d47e84df3e7fb295
BLAKE2b-256 c0f94fd87237f196470bdffb67a2eeb0321566ddc151e142ff6895db43f46dcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 f9f871fde3ca354818b46198ec77fa0f3dbb9433e781dd6626f5bbb37b46a928
MD5 e521b25ad41829baefb8dd705a0c0144
BLAKE2b-256 edbd21299d6f9ff51042d3c320391d30e24f4d9fb803e13cc2e3bd3a3f77a566

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 87f664f8c388cad5c6d8ed17fdf040b7ae0f6f26f53d0e9d63b98bead6dc84d3
MD5 c50d60358bd52d327a4673f753c0996b
BLAKE2b-256 79270cdec3c46d1389b1c9e77a9da8fc635fd5a4d92f8f088540fbbad1d18c8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4074f0fec9314dfe1f94492a386c1edd60d30e115679a656f842d8198d142763
MD5 ad57f28408c11d07fa54a68605a60c21
BLAKE2b-256 f7b05ecd265ac67c02a4546dee2d293340180f73af26a41f54021ceb9d6cfccc

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.13.2-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.2-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 3ef1782e3f469588e8e7a5c777c50b142c3048786772130c1afedbf3b2f5f24a
MD5 5088931d2989ba5ab75149d7d6cbc2b6
BLAKE2b-256 16c7b18435c341e0a5aabb94bf1f64d16311ff186101035f7c9f82772a345175

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