Skip to main content

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.

Metadata

Release files for mcumgr-toolkit 0.17.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for mcumgr-toolkit 0.17.1
File
mcumgr_toolkit-0.17.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
mcumgr_toolkit-0.17.1-cp310-abi3-win32.whl CPython 3.10 abi3 Windows x86-32 Details
mcumgr_toolkit-0.17.1-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
mcumgr_toolkit-0.17.1-cp310-abi3-musllinux_1_2_i686.whl CPython 3.10 abi3 Linux musl 1.2+ x86-32 Details
mcumgr_toolkit-0.17.1-cp310-abi3-musllinux_1_2_armv7l.whl CPython 3.10 abi3 Linux musl 1.2+ ARMv7l Details
mcumgr_toolkit-0.17.1-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl CPython 3.10 abi3 Linux glibc 2.17+ IBM System/390x Details
mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl CPython 3.10 abi3 Linux glibc 2.17+ PowerPC 64-le Details
mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl CPython 3.10 abi3 Linux glibc 2.17+ PowerPC 64-be Details
mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-32 Details
mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.10 abi3 Linux glibc 2.17+ ARMv7l Details
mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
mcumgr_toolkit-0.17.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.10 abi3 macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 Details

Total release size: 29.3 MB

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-win_amd64.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-win_amd64.whl
Size 1.6 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
0bbf7b23f694bcb41b284b120b4255941d451d4c1454e1fbe2ad9b6d1b5384dd
BLAKE2b-256 checksum
How to use checksums
86bcf9ed73e16338295df4c2209b63ba0bdc4d51ffd86d8c6cb462f55ef43937
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-win32.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-win32.whl
Size 1.5 MB
Tags CPython 3.10 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
37a465c65300a5a1a56ac34693f06433dc461a475fb1657882149be040f2f075
BLAKE2b-256 checksum
How to use checksums
4fe55d6345f7e76ab778fa7fdd8e586a591ce3764eaed540e6589feb1af47ec9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-musllinux_1_2_x86_64.whl
Size 2.3 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
d6999d5af4b918185671d09fa1722cdd0160cead8ffc37b4ca94c024917dec28
BLAKE2b-256 checksum
How to use checksums
d8599541dfbfea30b8257232b173940afb439bf1250b378099a0fb63bb9d762a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-musllinux_1_2_i686.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-musllinux_1_2_i686.whl
Size 2.2 MB
Tags CPython 3.10 Linux musl 1.2+ x86-32 abi3
SHA-256 checksum
How to use checksums
57926d0a84a0ec813c17f3674c6e5059e4ff76f04a3c4225783b4ea45e3ba49d
BLAKE2b-256 checksum
How to use checksums
8783a5715a457f16ecc0c08c350e9ceace8bdaa712b264e3bbb9aa3b4621adce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-musllinux_1_2_armv7l.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-musllinux_1_2_armv7l.whl
Size 2.2 MB
Tags CPython 3.10 Linux musl 1.2+ ARMv7l abi3
SHA-256 checksum
How to use checksums
28ec7b454140b9a5d5c0069443870ad9555248e3e6da57ccf94254b3de32393c
BLAKE2b-256 checksum
How to use checksums
5aefb99c7bcdea04d3f432ac4ec54ad2118291d9768e6c13b0ba535302559405
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-musllinux_1_2_aarch64.whl
Size 2.1 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
0064ce1ce7f32d310f1e634c72bfd282dbde80424131e4eefcd317151cefdaf3
BLAKE2b-256 checksum
How to use checksums
5ab5bf9b58bcc8d0e255b9c657afb1dbfa554b191b1cf49e189ea5db30de864e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.0 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
68ce94b3de6f202bae5a941a824ee6d9bb77b598af696af0b62dfe7996fc0799
BLAKE2b-256 checksum
How to use checksums
0f32153d2c8b044a7e6cb62fd740da3b3fab18ad72d058a7761639c3294b7d9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 2.1 MB
Tags CPython 3.10 Linux glibc 2.17+ IBM System/390x abi3
SHA-256 checksum
How to use checksums
927dc15d0ddeef02d919bd11efc74f2ed1d2f0403fc7b2e974e3ef04a6f71091
BLAKE2b-256 checksum
How to use checksums
a74ead1525a2dac4827813d2d18785ce8d4145e18296af7839039d0c174e56ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 2.1 MB
Tags CPython 3.10 Linux glibc 2.17+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
681cbe07eae47bf85aa42dedc2224a17a83420c856581b821a80cc01e40dee0e
BLAKE2b-256 checksum
How to use checksums
84b8f550d885862c3e384adea509f018f5e087d4506c783a7f3819d35af13b74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Size 2.2 MB
Tags CPython 3.10 Linux glibc 2.17+ PowerPC 64-be abi3
SHA-256 checksum
How to use checksums
c9c61de7bc80ce7b61b6b45af89dece8c3c7402fa661806b9a560d1b29b5ff94
BLAKE2b-256 checksum
How to use checksums
8237cc6511e9c21eff6b3095736d4fc0159e0dd2d338697dd1cc4235611bda41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Size 2.0 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-32 abi3
SHA-256 checksum
How to use checksums
11c400ede46fa7ab6f33987e3c6e43653143b9bfadd878c85d4e821adc39c603
BLAKE2b-256 checksum
How to use checksums
ea20b55ec6c4b768fd541f10516bb8caa5a3697eee0af96f4477c43dd2560757
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 1.9 MB
Tags CPython 3.10 Linux glibc 2.17+ ARMv7l abi3
SHA-256 checksum
How to use checksums
ddd37c26de4019ea1827cfccdc41f402e45365db66fdc16453ef0d13644dda99
BLAKE2b-256 checksum
How to use checksums
b3b6e795b2f5e943bcb28056764c317540494201a834031f8c8a034e58c219eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.9 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
a44f88e305d6c5598929d9fe8f88430993489c1b3981d1f81c69be10a3097b8e
BLAKE2b-256 checksum
How to use checksums
a8bc432b2d245fcb8d9212570a5f13ac817d6f7d50e738f92910476ce8740d11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / mcumgr_toolkit-0.17.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL mcumgr_toolkit-0.17.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 3.2 MB
Tags CPython 3.10 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8e8d6a259c4dc08ea1a147353f25b9aae9a3767a6b7bb4c96277f17bc16a94a7
BLAKE2b-256 checksum
How to use checksums
5138b6675862d5915cd2524af5eb331dc5e628d48085dd8c8486486137c17842
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page