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.19.0

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.19.0
File
mcumgr_toolkit-0.19.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
mcumgr_toolkit-0.19.0-cp310-abi3-win32.whl CPython 3.10 abi3 Windows x86-32 Details
mcumgr_toolkit-0.19.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
mcumgr_toolkit-0.19.0-cp310-abi3-musllinux_1_2_i686.whl CPython 3.10 abi3 Linux musl 1.2+ x86-32 Details
mcumgr_toolkit-0.19.0-cp310-abi3-musllinux_1_2_armv7l.whl CPython 3.10 abi3 Linux musl 1.2+ ARMv7l Details
mcumgr_toolkit-0.19.0-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
mcumgr_toolkit-0.19.0-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.19.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl CPython 3.10 abi3 Linux glibc 2.17+ IBM System/390x Details
mcumgr_toolkit-0.19.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl CPython 3.10 abi3 Linux glibc 2.17+ PowerPC 64-le Details
mcumgr_toolkit-0.19.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl CPython 3.10 abi3 Linux glibc 2.17+ PowerPC 64-be Details
mcumgr_toolkit-0.19.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-32 Details
mcumgr_toolkit-0.19.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.10 abi3 Linux glibc 2.17+ ARMv7l Details
mcumgr_toolkit-0.19.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
mcumgr_toolkit-0.19.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.10 abi3 macOS 11.0+ ARM64, macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64) Details

Total release size: 29.4 MB

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

Download URL mcumgr_toolkit-0.19.0-cp310-abi3-win_amd64.whl
Size 1.7 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6c32e27ff49e077dfd2dd12513fef4fc137201637968efffdad527231b2b9b17
BLAKE2b-256 checksum
How to use checksums
7ad09e43b50e11de99b2f6478a19f03ef63e32b94fefd62daa93b42942c0e5d6
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.19.0-cp310-abi3-win32.whl

Download URL mcumgr_toolkit-0.19.0-cp310-abi3-win32.whl
Size 1.5 MB
Tags CPython 3.10 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
3c4c742e40cb8385c0270221319d391b1acdb83ac2bf89effa1e5c35439e1b2a
BLAKE2b-256 checksum
How to use checksums
a15360d7850986136782f74e4db4c5cf15bacbb61e1e1ba43d1bb43d17c6d4e5
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.19.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL mcumgr_toolkit-0.19.0-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
5e94630d141da3aa81c08449adf973e106cb9ca7a70499ac556929e3ed1a5703
BLAKE2b-256 checksum
How to use checksums
99bcc081130c337b4f0bdb2509edc1553ce4fe07c50c7f3ba6d864d277f4c535
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.19.0-cp310-abi3-musllinux_1_2_i686.whl

Download URL mcumgr_toolkit-0.19.0-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
47863fd2e3d6f901a49fa41b19d97551472b3bc11ea890974cb0af7b3cae68cc
BLAKE2b-256 checksum
How to use checksums
f7459db7a3afc3fd4e9748a50911ba50b1e8e67fa314ce977fa7ccbeb4cceacf
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.19.0-cp310-abi3-musllinux_1_2_armv7l.whl

Download URL mcumgr_toolkit-0.19.0-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
9e9bfeae217d1d63c398c8fd517b65a8f1a7fd09e3ac57fae01e9df205c5c346
BLAKE2b-256 checksum
How to use checksums
69b52337506feb81a99b32c2fc2634c013cafc387157b2c9dcde53a84ddf73d7
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.19.0-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL mcumgr_toolkit-0.19.0-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
673d1edf8b733828e1deaf6c56fca7d3b9c070cb4cb3fbc0600a8930199ed665
BLAKE2b-256 checksum
How to use checksums
c10534d21a9bb3a6d269fda0e4d6e97428f21a733527d8294f5085bb5890f8fc
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.19.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mcumgr_toolkit-0.19.0-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
21bc2a46c4b3e7a80ff20a7c4711e780ab0aeb2cb30f8b30837b8996978b6218
BLAKE2b-256 checksum
How to use checksums
8b54b56e552f88018ce77409fc72076d547cc30e6e1f1bab6b3f099148861983
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.19.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL mcumgr_toolkit-0.19.0-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
b4efbab6d8d665e40086198804863353052974bbc5e42cb626b92f54773dc5c8
BLAKE2b-256 checksum
How to use checksums
1b2063296fece0d1c33515c878d8695b3c208b70ee03ba6be8a9a620277f4f63
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.19.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL mcumgr_toolkit-0.19.0-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
80e770cdf617dc4a0d6b1b757b9f48ec5a2c6c848208f892239b8a82ef278c69
BLAKE2b-256 checksum
How to use checksums
7afc1a935ec37b6491f6c453295ae9f1948d0b13ea8f3bf6c65dda2646b4d770
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.19.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl

Download URL mcumgr_toolkit-0.19.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Size 2.1 MB
Tags CPython 3.10 Linux glibc 2.17+ PowerPC 64-be abi3
SHA-256 checksum
How to use checksums
dd893d69e8d2cc15690bbd8dbe9f9e269085c4563be9d49dbebbfb5cb3892e5c
BLAKE2b-256 checksum
How to use checksums
029b4899ba24d3caeed188892b9823b27336089112409bf6552c6398f112407c
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.19.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL mcumgr_toolkit-0.19.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Size 2.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-32 abi3
SHA-256 checksum
How to use checksums
02a7eb1bc7aa124dacf0f137a2f714c1ce93bb91e3bc390d741ed08fa6519b00
BLAKE2b-256 checksum
How to use checksums
ce5abf23c9b1f69202c3c885ef1327aee74824d05c76d375d56b2fb62e756b1c
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.19.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL mcumgr_toolkit-0.19.0-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
197c9af4835c319be6e2bbad9794790bb9f5543ab3ee535101891f261662f3c0
BLAKE2b-256 checksum
How to use checksums
2af16fcf156a755a3be6fbc2c748419c0c1b70ff3f76ca917fe37fcf754622a0
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.19.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL mcumgr_toolkit-0.19.0-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
a6834c22995f773397e38c7764ee96077166adc88e041001e7a0bd3b8da8b866
BLAKE2b-256 checksum
How to use checksums
df333a4c7ba2850fad43b69a337d74c95d7d3d4fd14eb687ae3a4b962c268599
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.19.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL mcumgr_toolkit-0.19.0-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
3bd1e51bf697fca7a57129c63359a32c1f4236ebf3ce82331298c694c42e9b88
BLAKE2b-256 checksum
How to use checksums
dcbd53734e74d0b394f414f8e527687dd4f45dde1db6e45c53def00f894616c0
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