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.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.17.0
File
mcumgr_toolkit-0.17.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
mcumgr_toolkit-0.17.0-cp310-abi3-win32.whl CPython 3.10 abi3 Windows x86-32 Details
mcumgr_toolkit-0.17.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
mcumgr_toolkit-0.17.0-cp310-abi3-musllinux_1_2_i686.whl CPython 3.10 abi3 Linux musl 1.2+ x86-32 Details
mcumgr_toolkit-0.17.0-cp310-abi3-musllinux_1_2_armv7l.whl CPython 3.10 abi3 Linux musl 1.2+ ARMv7l Details
mcumgr_toolkit-0.17.0-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
mcumgr_toolkit-0.17.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.17.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.17.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.17.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.17.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-32 Details
mcumgr_toolkit-0.17.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.10 abi3 Linux glibc 2.17+ ARMv7l Details
mcumgr_toolkit-0.17.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
mcumgr_toolkit-0.17.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 11.0+ ARM64, macOS 10.12+ x86-64 Details

Total release size: 29.3 MB

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

Download URL mcumgr_toolkit-0.17.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
51e2dae28d8048281273c9290f68a7b2bec41a5e896613baf67c8659d5a9adea
BLAKE2b-256 checksum
How to use checksums
078837b43ac65fa5b10ef9d620a5d852c88a89b29031a3ddcbfc4f25b62337d8
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.0-cp310-abi3-win32.whl

Download URL mcumgr_toolkit-0.17.0-cp310-abi3-win32.whl
Size 1.5 MB
Tags CPython 3.10 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
a3c4d03270b1b71700ec8e6cdf3c014b320ca96d68f3f6e64f85b751bc4bd497
BLAKE2b-256 checksum
How to use checksums
08480cfb926b784aa78102ed0b441170cc829c26ffd90a76c07b7d8ef5dd6378
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.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL mcumgr_toolkit-0.17.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
dfea796d8d5e6739bfa783594112dfe90ae8a425d31907e7bea6c2aa1c1bbd37
BLAKE2b-256 checksum
How to use checksums
60dc3fa1fbf8a7cc289532da10d624ee2cdf5a5a812d4476b819259fa70fb8e5
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.0-cp310-abi3-musllinux_1_2_i686.whl

Download URL mcumgr_toolkit-0.17.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
11a3a6a9f767a2128907a761dcecaec886a38675a489bbfcbc4d5d43fa6ff6f4
BLAKE2b-256 checksum
How to use checksums
8494efd0ac6a73e58e6dec474e8dba5fed6fd1feedff7ba0c2732155bf86a293
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.0-cp310-abi3-musllinux_1_2_armv7l.whl

Download URL mcumgr_toolkit-0.17.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
56818bd8c81374479fdaa026b7785bdfa89c333ae0c7e365ffba7461e57fd7b4
BLAKE2b-256 checksum
How to use checksums
25271064cd3da4788c850497339ad699415e1dadcf405667fa009e02a1c12027
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.0-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL mcumgr_toolkit-0.17.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
4a6b8cacbd80af42d6a0d3a2e39ad90b8b8005878ac2e11d9586cf0ef2e4982d
BLAKE2b-256 checksum
How to use checksums
3afcb3e626faf249bc26a4e3cd8c051c430ad452b9b87c8fca1c0b13776935ea
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.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mcumgr_toolkit-0.17.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
1c22c64488b18a5baf8323921a3bb43aeae21f5e8fbbce11967b5bce76575647
BLAKE2b-256 checksum
How to use checksums
d53f4b9fd6f3fb7c9859d579057666b1c9ac4018c4ba9d40295b2976e16b68d3
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.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL mcumgr_toolkit-0.17.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
4ab9f48460b7ead7bb8037297ceef1abd8f63b5a1132c8f7b09fe114fbc841d9
BLAKE2b-256 checksum
How to use checksums
2cc3989f3d1ce2ac3cdf1d64310fa9ca5ba760aea1897d3916541d77e2013dfe
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.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL mcumgr_toolkit-0.17.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
cd3d1ef1c7b847bd287c2fc7e4c2c237a4bff18ec5ed9ad5760f20ab507783d7
BLAKE2b-256 checksum
How to use checksums
61c84074a2339905ee6fd05d4c5d12dbd17ff733fdcde9684ed7bb52336aba58
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.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl

Download URL mcumgr_toolkit-0.17.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
860c0ef60104b5bbbfd896d9b0ebf5bbc38b65cf9aa1b97eb9900cf3200cfa1b
BLAKE2b-256 checksum
How to use checksums
7d28964a233fd1611a25b667440114067b692383afe73a6d72699ba696cf6f6f
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.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL mcumgr_toolkit-0.17.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
73c89356c6e8267e0facd31cedbcf96e6d7e6a68e26af0f472b8fe401ed36252
BLAKE2b-256 checksum
How to use checksums
86b5b368c17d1da8644aa15dc68f259d4f27d14567170d0ff23a863ff4e100c4
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.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL mcumgr_toolkit-0.17.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
2ef778fec65bf1798f27619af14d72fc8535a40a0530f2259c9a0d4facd7f29b
BLAKE2b-256 checksum
How to use checksums
d4e4d5ccc6dd96e34a5c918c405b752cfc9a63285557c4069cb2e3b744044b75
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.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL mcumgr_toolkit-0.17.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
0968990b4f7e90940f02743c4fad26498fbf652466565e99e55325f07f6c4bc9
BLAKE2b-256 checksum
How to use checksums
04b90d70a050d068fdffbc0d154992bf9b7b93c44d59c796a28b4b54c08a060d
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.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL mcumgr_toolkit-0.17.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
cc3c9a68813f653f7726a3d7b577408fad0b95e0de361ad3175ef497b43bc0ae
BLAKE2b-256 checksum
How to use checksums
02ce7965ba716ea9912d582bc1fbd5958828997e5c2f75710f858c0a402a38df
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