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.18.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.18.0
File
mcumgr_toolkit-0.18.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
mcumgr_toolkit-0.18.0-cp310-abi3-win32.whl CPython 3.10 abi3 Windows x86-32 Details
mcumgr_toolkit-0.18.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
mcumgr_toolkit-0.18.0-cp310-abi3-musllinux_1_2_i686.whl CPython 3.10 abi3 Linux musl 1.2+ x86-32 Details
mcumgr_toolkit-0.18.0-cp310-abi3-musllinux_1_2_armv7l.whl CPython 3.10 abi3 Linux musl 1.2+ ARMv7l Details
mcumgr_toolkit-0.18.0-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
mcumgr_toolkit-0.18.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.18.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.18.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.18.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.18.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-32 Details
mcumgr_toolkit-0.18.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.10 abi3 Linux glibc 2.17+ ARMv7l Details
mcumgr_toolkit-0.18.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
mcumgr_toolkit-0.18.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.10 abi3 macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64 Details

Total release size: 29.4 MB

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

Download URL mcumgr_toolkit-0.18.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
585d78d07a6d3eb411b94804af6cb491e34b7f8c7b685ea426973f0850911e1b
BLAKE2b-256 checksum
How to use checksums
7fb9a8bd34757cd591e890b14545c88c5a8019b7b94913d2e7012354aaa5a958
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.18.0-cp310-abi3-win32.whl

Download URL mcumgr_toolkit-0.18.0-cp310-abi3-win32.whl
Size 1.5 MB
Tags CPython 3.10 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
2b599312086015ce1bbaaa3d7478fa8c0d0142afa9fbf5e398d5b0996539df6e
BLAKE2b-256 checksum
How to use checksums
93d12b2c9cc760d750e10457238a1e123f14f1237af9622a46e9621ad1361d41
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.18.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL mcumgr_toolkit-0.18.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
6c7a4674a2eca939986123bda0af5bac722b43c621ef52ae03b6db23d63cea1e
BLAKE2b-256 checksum
How to use checksums
f8243c8af110be6aa3dfedaee4960fdf288e456c1323bcad8126d0138b1fa52a
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.18.0-cp310-abi3-musllinux_1_2_i686.whl

Download URL mcumgr_toolkit-0.18.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
65603b3aaaa15f600ae8371f98a8837a3cffca3d4e4a1724b736759aed0b3ff3
BLAKE2b-256 checksum
How to use checksums
5c1ce57108a13293493e3214db279ce2313e734b3fb20cfc814bc830b5bcd012
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.18.0-cp310-abi3-musllinux_1_2_armv7l.whl

Download URL mcumgr_toolkit-0.18.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
8c312776b592810f7b8bd04a35d6a1b8a71e1d5dd75ee190001ee5efa96be2b9
BLAKE2b-256 checksum
How to use checksums
72ffbc2d605f4dd74df5b60c10e117c7019e251efd2531e3f80d94ae5b81d14b
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.18.0-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL mcumgr_toolkit-0.18.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
365f688ee60543f13f752913ab526558b0e438cbc05cdd2bc6179ed92931142b
BLAKE2b-256 checksum
How to use checksums
16fb9171ad4005e116cb2c0fa620a3a750d3e9b66645438b9c594d885f6eefdc
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.18.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mcumgr_toolkit-0.18.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
618a4d43333dc93942d2b7338918a995a8de7a173f29b0868865e9a38ea9c1b1
BLAKE2b-256 checksum
How to use checksums
262cccbab1c2c32998ba0b9b0e55d8dc1daf72decbea6b675c700b1775f93fa5
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.18.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL mcumgr_toolkit-0.18.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
4a913ef9f466badbc22b34f5e2b4178d00e4e2dd73bab181e81c1f339ec497b7
BLAKE2b-256 checksum
How to use checksums
da6fc9bc725e2d2651cb3e283a9c485c15c23e8c2d3643ba3844c2a85b374026
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.18.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL mcumgr_toolkit-0.18.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
4b54e6c232a48f7aee5eb23ebeba0f2c54377994b966ffab35091c011424e4e6
BLAKE2b-256 checksum
How to use checksums
c1371a8289081844a5ba284706966bf1d250dce0240fae5061aade8dfd457cbd
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.18.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl

Download URL mcumgr_toolkit-0.18.0-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
39ebfe30df04ebbb781717decc34438e2d978b381f48dc0c57f801c1c5dfc2b4
BLAKE2b-256 checksum
How to use checksums
38b8018cd1e514560eac5a89dac092c9a5dd0a4cd72f61c3923abb28b0281f55
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.18.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL mcumgr_toolkit-0.18.0-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
9926c909b63c00238828720e0ddf90dbfa0edb86e87ce0a27d7e490dd3f58326
BLAKE2b-256 checksum
How to use checksums
566801916a7dc4d88186c80b706e34209084b94c8e0a4a7a6bbe03aabc17f336
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.18.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL mcumgr_toolkit-0.18.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
9e228a18430eacbe925c9c29fa3eec429052cc2c35def5b486e21cd42d375423
BLAKE2b-256 checksum
How to use checksums
f62559686857d621c3da12c29aac2bf372e460c27210ec908a29375595f8bd05
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.18.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL mcumgr_toolkit-0.18.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
3aff89022bd8cb137b2e3266083046ff9bfdb7f4b22346f7253e59586f3c668a
BLAKE2b-256 checksum
How to use checksums
3b4b9b9d42ee7af5295577d369eae689c7ce7b39385679661700cb8bff82a44b
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.18.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL mcumgr_toolkit-0.18.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
7fb53517fddc72f82cfa3ecbcc59505c8efc8d2f56a8d0ee0cfa48c3044133ae
BLAKE2b-256 checksum
How to use checksums
d568480e50f848801350162aa7d67c5275db481c0888fec39c3400e6bf5a6fdb
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