Skip to main content

Python API for Zephyr's MCUmgr protocol

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mcumgr_toolkit-0.14.1-cp310-abi3-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

mcumgr_toolkit-0.14.1-cp310-abi3-win32.whl (1.2 MB view details)

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.14.1-cp310-abi3-musllinux_1_2_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

mcumgr_toolkit-0.14.1-cp310-abi3-musllinux_1_2_i686.whl (1.5 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

mcumgr_toolkit-0.14.1-cp310-abi3-musllinux_1_2_armv7l.whl (1.5 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

mcumgr_toolkit-0.14.1-cp310-abi3-musllinux_1_2_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ s390x

mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (1.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64

mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (1.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ i686

mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

mcumgr_toolkit-0.14.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.4 MB view details)

Uploaded CPython 3.10+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 97d22a5d3582d2988e6b119eb8133ca58518c9f86774268419a7a2e8a2169e5a
MD5 978cc49dd2778de769437808d9cdc72f
BLAKE2b-256 3b25ac813ec8e30cf1cd01429467a7de375893cf66c05ac30e9ed76382296e48

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-win32.whl.

File metadata

  • Download URL: mcumgr_toolkit-0.14.1-cp310-abi3-win32.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 71636cd92ee4a37826e1975bba4b65e212a75a41e50003fa0b9392ad94aa73bf
MD5 4416e1d0071f10c7421738fca2384124
BLAKE2b-256 306826eb62eff9e656d4a4df4467bda7f7cc94d3e65a0a881a964a5006a9f321

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2e82e541029188255aee82278e71344f408d80c2a2acde94df09c3c276fbf361
MD5 43c2ebf3d90cc89c9a9aba7ba674ae6d
BLAKE2b-256 a7197ca8c0907750dd4a97ba1ab91fcd477b5038284d2bbcdffa54d533b0b3a0

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 06d7d71cb2e9c9b7ab1eb0b472048f0daec4f05b3f2f9dbd1cc23d42bb61a378
MD5 f3a8a41128cd7da6a5321a96d9c10f0c
BLAKE2b-256 fa6e076bd1935001f8f1b80e02ca512cb619f5d0bfdf04f1e6ab3957c0ccbe4f

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 613f184da57409c23c6aaf561fa80167cb35e2a621fbf9be0b853836e04869f2
MD5 3a8ff5c7e06220fe1bf419b6f8a25be4
BLAKE2b-256 f947ea9db6561a9c9b409339df4626ae5e3ae3a8cd14949f183d357b029cf994

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6aaf56e49aadca2196b21fa6e8f3808ebab003856920c633a409fe9a01b61bde
MD5 a9e281e95666defda1977c73cbb8dcf0
BLAKE2b-256 38a3304677717ac69d2d695e1394bed18aa7aaf7c219d37629a23039fe0b2c89

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae2870b3d2e63c7e1ad7f13c5b95b61c7d1dadd87154a03ee9f7d25e4b7c48fb
MD5 49a1565cc2c7e5eaa91923b36c2ed237
BLAKE2b-256 f9f2906d0f11d64267004a6748defe7d72aee540ed6c7bf6f38220eee6083a8a

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 36379be2cfddbc6747aa1f263692c20d3204601abf91c1338a2935afcc1fa302
MD5 453ebca6fc12e039468da04bc8fd5c7f
BLAKE2b-256 6cbfabed90b93c57c121b9f5c499cde0e6bcbf4e37b8fa7011a23c60daf9b5b2

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 5501bc0b2925ae3d2cbaec16593277c8fa957bd210413bc6eda63668aeaaf224
MD5 c12ef21f7691e59a290493f5bc0c6c04
BLAKE2b-256 835ad175e22db1e5169b15d90e725ec9dc5607283a4d51f8feecf0785928f1a1

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 a769e04ce1eb00b57a3854df71efd9ba48ee7b8551b6bd0a88ce9ee6d62182ce
MD5 bf91c854d317785d937990d7282be352
BLAKE2b-256 e551e0208fec0ba36f65de5e1b63cf62a99b419d5a51a6d4976bdf9c20ace0bb

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 26dff6ea19959092121b32cd837fa568fa4700d5da687252a15cdbd19e33104b
MD5 e68a7cc668e390e8f290fa28067e824c
BLAKE2b-256 3716a1da97bb541f545aea15aeede7979801fac11589549fe6cbfd19bcd79044

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 c0dbfd3df0ef0ad70aa04cf52dd3dd4f279327937cbe7f653c15a76426e4ccf1
MD5 648c4dedad3d338bad4107d35e32731b
BLAKE2b-256 f1a62b86d501f826b9d47ffa4e93f0ae2df23c98f31dbb0a52724bf23252d540

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d329f6d4721ebdf27fda217feea69b7a2a030619ea02230ac60e497c7c663c74
MD5 955e9086b93acaa6fd6139189ab02839
BLAKE2b-256 d1fc7860718cd0deb2f76c5a443b10cc2d826b109e7628dce9a1c3b5abf2eeb3

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 5e46a7262ea454715b7dc57173495cd3deac8ff3b5d1cb2e35f110bdf7ec926a
MD5 c2b165351bae22ec888a0531df828249
BLAKE2b-256 7842e5e64d7145f94cbb0c4226b5815ceea8ff9bb733c4dc3972eac36ab6375b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page