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.16.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.16.0
File
mcumgr_toolkit-0.16.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
mcumgr_toolkit-0.16.0-cp310-abi3-win32.whl CPython 3.10 abi3 Windows x86-32 Details
mcumgr_toolkit-0.16.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
mcumgr_toolkit-0.16.0-cp310-abi3-musllinux_1_2_i686.whl CPython 3.10 abi3 Linux musl 1.2+ x86-32 Details
mcumgr_toolkit-0.16.0-cp310-abi3-musllinux_1_2_armv7l.whl CPython 3.10 abi3 Linux musl 1.2+ ARMv7l Details
mcumgr_toolkit-0.16.0-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
mcumgr_toolkit-0.16.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.16.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.16.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.16.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.16.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-32 Details
mcumgr_toolkit-0.16.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.10 abi3 Linux glibc 2.17+ ARMv7l Details
mcumgr_toolkit-0.16.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
mcumgr_toolkit-0.16.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: 28.8 MB

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

Download URL mcumgr_toolkit-0.16.0-cp310-abi3-win_amd64.whl
Size 1.6 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
92fdc1948ea86b1d82a922a9ed38c42e8a1a62a81bdc9ab44d140efc7a7579f7
BLAKE2b-256 checksum
How to use checksums
a82b0b92ece0be2903942ab767b02d5e38712e759b9fc34a70120fb6a049c5f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

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

Download URL mcumgr_toolkit-0.16.0-cp310-abi3-win32.whl
Size 1.4 MB
Tags CPython 3.10 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
b1dd60a829228ce068ca41b62c6df2f3df5f465352d78d3666eaba2b960cd418
BLAKE2b-256 checksum
How to use checksums
95b1dc7e9447fc8a87d511910ab0a38d54bec3f4656fef2b80584f91bf7a1b23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

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

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

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

Download URL mcumgr_toolkit-0.16.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
7c02406738ac21d57c407b6dd67a8cf2044251c7c0ea7c0198c9a592e167c5cf
BLAKE2b-256 checksum
How to use checksums
6c7dd5f0fd466d6d0a98708e42bf97a97a0856d14b74132bab553dc61f251171
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

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

Download URL mcumgr_toolkit-0.16.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
a8133cb849640b7c9764e46b539a2df23bc6b132e99cc684bd45babf7f49f01a
BLAKE2b-256 checksum
How to use checksums
487618db23bfb180717327f8abdfac58a2d0250d97e42a0c7d9193f7a80ef631
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

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

Download URL mcumgr_toolkit-0.16.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
df46e72efc7e1f20b6ee743811cd7b91d199e43a65f80a7ccd593673a5e34138
BLAKE2b-256 checksum
How to use checksums
68544792f9d739943ae97f8d8f347d1ce9396a1370549edbb7b579c6b2be5a7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

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

Download URL mcumgr_toolkit-0.16.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
c2e366f9b57227660f0605c8665909919d16b76ebcef8072fa86c6b71af25b1d
BLAKE2b-256 checksum
How to use checksums
4aa224b812b96d44069a1735fa3fd7431cfa7f49cc654ce229290078fb72e59c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

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

Download URL mcumgr_toolkit-0.16.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
aa551e003c432b215974f621168c052d254c3d4df4b59fc7d150460aa5f6c88e
BLAKE2b-256 checksum
How to use checksums
30ce3af2f12881393c9338a2469b8a11b8992b07a201978257d581ac30f4b948
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

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

Download URL mcumgr_toolkit-0.16.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
f20451a31e1617245af337f898099942a18eb2f6ef61e7e491822ac8eab862c4
BLAKE2b-256 checksum
How to use checksums
44c8bcb454277d4dd39ca222853610fa86f4f85cd6edc8b92f7af8db96113687
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

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

Download URL mcumgr_toolkit-0.16.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
4632032bf890365f77066464cb55766fa39f59ed5e71fda0e4af0296043b5d56
BLAKE2b-256 checksum
How to use checksums
af125a8b8c60e824023d4712e30b9f36783df64a6eb4c6310b2a5f5d42e39a97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

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

Download URL mcumgr_toolkit-0.16.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
ae1b2fd8a5ef36ef6a0e73817224bd98939142f00bc1053e8176cfbb5b294d75
BLAKE2b-256 checksum
How to use checksums
390851ddfcf986752110008925d9676e79d632763a7faf5072686e1b260f8551
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

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

Download URL mcumgr_toolkit-0.16.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
cb980d8b22a10a92d31de695a536aea5a3c319cff937b7217d231d7c87ade396
BLAKE2b-256 checksum
How to use checksums
c306b7b7ca77179c52f5c946c5249c88ebbee47d6e00b25b5b99f0ae80b5768c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

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

Download URL mcumgr_toolkit-0.16.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
9104f9c06bb82587a5f5468ebab667423c31918a9c1e135f010337dc91bc68a2
BLAKE2b-256 checksum
How to use checksums
b428d6e386da7a317c7d8a393d20cb65335e522bf3a7e6e2bcb4c84f97d00a0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

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

Download URL mcumgr_toolkit-0.16.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 3.1 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
f459c580072fc33cffbf8423ac88d670b28ef04a4fb1a6f07ba8c71022fe14a8
BLAKE2b-256 checksum
How to use checksums
d9b15b9fa1839b0cc9eb68dacc33028f9b9b74b7461cd8c28254f479d6512057
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20
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