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

Uploaded CPython 3.10+Windows x86-64

mcumgr_toolkit-0.8.1-cp310-abi3-win32.whl (1.1 MB view details)

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.8.1-cp310-abi3-musllinux_1_2_x86_64.whl (1.8 MB view details)

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

mcumgr_toolkit-0.8.1-cp310-abi3-musllinux_1_2_i686.whl (1.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

mcumgr_toolkit-0.8.1-cp310-abi3-musllinux_1_2_armv7l.whl (1.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

mcumgr_toolkit-0.8.1-cp310-abi3-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

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

mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ s390x

mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.9 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (2.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64

mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.5 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl (1.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.5+ i686

mcumgr_toolkit-0.8.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (2.8 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.8.1-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a9e7849cfd88729d475cd8c5cf9899402ad9abe2ff1a4624ccf62928d953d284
MD5 7288527319952698a9cfda185edb3978
BLAKE2b-256 c75e4270a2b34fe51d97f332cb030c3de2b3920fc448e36e92bf53576bf358fd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 6ed9bc4c70e0dc954b2f68d5b0f74366f7cf213b072dc2965c6364ac375cbe56
MD5 5b2ee0114ff67de6f628f70f5dc14b24
BLAKE2b-256 fe71e1940926d389c4eed21aaab045fdd8ffbf00fa21f7f85ce956822f989f99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c851109f581e27ac95716455b02c0bb68744aba6c8cc809935d553dd674ab4ee
MD5 1d7a0e0e8bdfcb030ab4f9407e6eb1d9
BLAKE2b-256 1e014fd326dceb41f73bbda96ef39c31d0b58e6df56cb3c4b91b2553d9cc907f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 ef18cf8cc22e4c553ca8056dfc313061d56413d0271e0308d7287f445fd99f3d
MD5 ca4cb65161b373516304b716a7aa8308
BLAKE2b-256 0e2464f73f66c5f2df3cd3f4a4a2086507aaa26c41fbf27d4b8a847348f800f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 55c67ec070ced09e9fe708019695e619e761ffd413ef8c75684c455cd1f8a70f
MD5 6be119965623559737ef3ffc09520bc9
BLAKE2b-256 df58c1843fe39e1d9d61e2e2f7898a4e1e61f4d2be5788c18de400ce811f093e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 77cc7c8a38a476890287bbf4ca34012ac0debc6b4194c94a5eb88e0d4901d899
MD5 c2fa2352e08337cee8ea5da180987f54
BLAKE2b-256 943c84be937a2d183fc6dc8dd198891e5044b0bedf11a23009f0c3c1a99f58a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2305a6acd5ebe9441bbd715cb1d48b4127161d43de5b18bddcdce85edace2551
MD5 5a025018fbfc76132e07def90b48a296
BLAKE2b-256 ddeb40c496292cb8334dce6da56c741f25668dcff64f3ce045457c591732f4a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 1f4b6428f94ed4a2c72a5bb4343ccb8a03159bc8db912848fe8877dd883a3d7f
MD5 1e1cfbb1f56bf5448088b8016efe48f5
BLAKE2b-256 995b91eb4b7a5726c0fab076b20c26c0d9cb364f168aa9a52006d5e09dea3dc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 13ee5bb010bce9f011fe9e5291847ef2900f512896e399b606bf31d668b63ba3
MD5 a960be858e6389d67fabff8ef58d05fb
BLAKE2b-256 eda5397d7972097370a20be6e7ffe1fb6086e1dada4b6e3976ba0eaaf77e615d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 90073e7af8de401b93b50a6dcb55e9f72200177031a14f9d4d1a8528278baa7c
MD5 e2c28240c931cbf9eb333bcdf6342876
BLAKE2b-256 fd46d9671fd3424020967e614f84c46f3439085f7809d88d2bafc2f3f89715a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 ce2f6e2716dc01c8cb17ad11ccf725a61d75707f67a87fb9e24a8f728c204eee
MD5 bf60e5a27d4e89eee385089a9b5ab0bf
BLAKE2b-256 70b9c571aa65067ad0ff23db06a972dd7f45ffa05486051b239b5bc35e3925b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eb66fab986ffc92ea88b68839aea06aad65e65c329d7b7e4856fd003e25ae334
MD5 37e748b2e38da8fdc6e8e53a36cff7e8
BLAKE2b-256 db3d855c5597645ad3ea623dcd8c5464cc87e9d1ccfc199270be7f4976565826

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.1-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 f12d688f7a002c1355dfc2c8612d156fa11b1202953c8616b7c1728bfd397869
MD5 9c0755955593ff01441b1c67d3f0edc2
BLAKE2b-256 660b4bb5ca34f58aaeb8482b956ee541783b7248a5205c439d925a39acf310fa

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.8.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.8.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 5299eef44ff93bc3a4a8a4c197fdba05c2cd6ca4a2e538fd3eb2d731f4ba837c
MD5 c81b48d6976ff967f81e35e4e9d682e7
BLAKE2b-256 818fef5a51faddf2e8c5b822c9265179727498a47cbec1ad008eb0e5b906b542

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