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.13.3-cp310-abi3-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.13.3-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.13.3-cp310-abi3-musllinux_1_2_i686.whl (1.5 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

mcumgr_toolkit-0.13.3-cp310-abi3-musllinux_1_2_armv7l.whl (1.6 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

mcumgr_toolkit-0.13.3-cp310-abi3-musllinux_1_2_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

mcumgr_toolkit-0.13.3-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

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

mcumgr_toolkit-0.13.3-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.13.3-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.13.3-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.13.3-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (1.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ i686

mcumgr_toolkit-0.13.3-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.13.3-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.13.3-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.5 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.13.3-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.3-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7722f5f590182fa9cc8cdcb1d4b4b44e071ab49a83b9edcc5f5e0e2608828529
MD5 620a34fc4a9cf7dfc75301480a415198
BLAKE2b-256 8eb7bb632dd15c10f55c7ddf5a84af508f51dcaf0cd81ec4215465492016ef9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcumgr_toolkit-0.13.3-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.13.3-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 cdaf1e3e3e53203a17ed32682ffd747e6dbc2a689732be5bc1f8dd81d135fb3f
MD5 222ea7efc9d6aa9bc8f1477a19fb94c5
BLAKE2b-256 784c82050ca2ab41d7e9e6b6e7b964b7649083448c15efa84745895d695d7e59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.3-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 619efaa5398011bfb8940b5081f84f00da6df375abbaa99c386913c29ca8928c
MD5 666adccbdb45b9ee363b7bfa0ff401a5
BLAKE2b-256 e727ff9ebcc3f3f5b47161e55e722d3c0dd6f27795514599bd3bb524f54f64d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.3-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 5a5f4ea90619c71e19bca320ae3ec2b26fe83c0d69ef6882594fafec16fc3528
MD5 2928e4173186b966d03a8336aa660eee
BLAKE2b-256 3afc8f18306ffb50e48a91c85c0f41c3e806d1fef1818d66e4359a0d0af8d8d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.3-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 da37cf8bc1d074f7f650d2c13aaebe21e7194f364897b4e3981cf78cf5e1fffe
MD5 9c5db2d976bd7cafe0f34af8c51eb188
BLAKE2b-256 b39c8dd192fbcaa6c3298716cc7b800ca4c38f0d811aa552a342d97d0368b3c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.3-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4fa029ce2617c5ca1b11a0a19145f8710563db243e9ee6676e322a8b53fbbee8
MD5 a181407d943b736ea3ed5ad9e085c934
BLAKE2b-256 244483cb48976746089c0358cdc486349aa17528f7cbbb141173500c26955475

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.3-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9523a6b5456b45f63cdf070197f836732856ebf337c58c00ae6911aaa088d037
MD5 5173ad2e49992a2b38c7b3a91dd96f60
BLAKE2b-256 27b581753baa98d59a39b480c409ceedf9fa3e7f5d64f8685829a7fe74631b1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.3-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 918b1e4caff2bd67e534463278c4ec1cb7370dd05f14ec29d62e67ff6d6a71ef
MD5 460543a3e78f1b1e1fa93df7c646cd30
BLAKE2b-256 88f1c38c27b8ff378c20a76090ece6cb1da65936e69209d1d02a2cbba0240e24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.3-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 17a6db20ef1c6e267d0ba3fba8f986a7cb0ea68465fe8a999abbe19bca615b4b
MD5 dbab0baf03ba9ba55e59978cf4a97c76
BLAKE2b-256 951d7e2f7b4d9ce600a93ec2625fb70632f37e37d7fecd04aecf80da1d39d2a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.3-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 e911c773d82489e88f2e192d2d1e91b42d44b98a802fcd74f7baba0b189b3dcb
MD5 59f0f7804c2813c342a922e85b2c856c
BLAKE2b-256 283cfc53b5f0691892f00dcd0fce06eafa77306bcb3e1d4e78438d309adf9114

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.3-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 3559524e3cbf62a6ee64722f7ea1c800fcf0bb588579d198b685d23f6a3ffa09
MD5 af0fb5847633fa5fd75bfa61dab7d780
BLAKE2b-256 24241f79ff2e4d6c025cb1a472eb07855c3ff8c17cf1b23ac170d0869b77818e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.3-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 6f533401d06b905a1d493abdcec4ffe7466fed7d193e62ac00919a12c175bcb3
MD5 dc94851ea0a6305db3f2f07e1e80fc8e
BLAKE2b-256 bdec1d041a56973cdeff1877a56c1b5e1a985f74219866fbbe54169dae29d285

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.3-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 feb1b3c171b73052c8ec74682a69bf991f8bf4cb3bc959b496ff2c2a6779f7cf
MD5 9f2ec331af38fe1fa89a38793f51c9bc
BLAKE2b-256 404d4ca9d3712091a8275fa9aa2d2b44e26f7f6718e72d66d01c4d51f044e9ff

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.13.3-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.13.3-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 23a4cb2d10669ca6384f1d695c48a48aab864186d0a5b82de08a9feae5402f30
MD5 41a0c400f771e58ce560d506cf9135f8
BLAKE2b-256 d5582a95e91c6d4e558954d1357e6c8c9dbfc88c84646a26a168aaf801d019a3

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