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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.8.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fb1d749cbe90fae30aa0b09437926079be9149db6ec2bcba7e77914fa479ca4e
MD5 d303dd8c4f060465ead3491e04b5803b
BLAKE2b-256 35ebd217c49457e756d3b8cf0712263f8cfa50867b1b7b413059f120f2f55d9c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcumgr_toolkit-0.8.0-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.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 f9a24edeed31d630de905ed15b773a600054a55bfdc6e61e4e86b224eec2f145
MD5 56aedeb4409e428a6e4ea2142b981498
BLAKE2b-256 f989ad6348dde367b45808035fea4f87b35c55c2086aaa69e0e20e4c02943ffa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d145f6e008714f8febaab94f85c1674c14a74896ab36cf5e40d8fd57009a5d25
MD5 86cfab8aca8b6dda8f6b07e9209f538a
BLAKE2b-256 11734c47dc14a385b6e736d4f10bfd194017b5116a872c6d6834eced307adf3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 7ee98084339d80d16bf9869ccae853d12e6a784e8b389d30c4a4fa1305f7bc19
MD5 ff509eb806fe5d4d225e19b55cd703a0
BLAKE2b-256 33db6cd86c2f0a0623aa2f4e08839c142aa021cd6df520840b8d927361051007

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 9b8c23d9f4f70d2f9a78e55722b85d85e7e746ea6d9e43c42cdfacdb836f28ba
MD5 d430f5ccbecd91f7eeddcdba115689a7
BLAKE2b-256 5f993fb43d8492f451d94669073cd7285012d5eb086b50c56d352d360cea6b6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 fdc8730f0c2593823ab08cc0ad695301edec206afdd4d1704505483ba0a62a51
MD5 0303744fe54c78b576b16dd7ca686027
BLAKE2b-256 3663f8b80c081d1a6c952a6f24930dfe7138a7663df38db954b71b465da62cbf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eeff16d4705e67758957107606f641e1d81727e4f4161ed3ce4fe279dcfa1037
MD5 54010aae6a57331693b02edc2bba5630
BLAKE2b-256 4ff4e2a08b2d7e93ed6f12fee735baa7dbc7c3eb85fcf8441f6277ea641ca6b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 6ae0f575e44942081ed6108c9deba059c3152b36433b511c14795a0a77e453f7
MD5 37f92a9994861d996cf7f475b1705328
BLAKE2b-256 86c480e5addaab48b61058b33ecf9b7081f68ba6e3c2c642458f8931dffab020

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 0fc4741fbab7b0edaca3aedd0505aed4ca09f73fef6c7b8edd94a92be0c40a29
MD5 75333f2374fd1a6a3c57fdeced5f04c6
BLAKE2b-256 e5a799f26646dad2272d1e67793134517f17595d70a7bc826c511de3e0b42cd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 bdcbeb36e5b5717e3ace301c57136aef1762b8c19e7d19798485d0f4dd42c391
MD5 e7fcea221f85bf757a11a9def532f352
BLAKE2b-256 43e3e5432f4884cb0cbab589504fcf3aeb7438e5f349ac3148f92a87eefa6eff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 5a026584bfaa5dfdfdeb7f4aad31b56fcca7106e1ccc8a32facbba73c4f8a040
MD5 b3f54309bd5da261d8c174f64f3065e2
BLAKE2b-256 65dcb021e9fe312f3aa7ae6c50fde0f8519366b770a322292b125c3972cb261c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d51e2204928c3e9a1298fa10f1c61702d5db8355d2d88e86551ea266c23a4490
MD5 874ddfecc85bcae6d30544d1c041b323
BLAKE2b-256 a7720467860b4f5386048caeb696b1eb69644e10e8b7996865c338649834c654

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.8.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 f6dce66e7997f59ff037a009b4c606c566538d25ba77c2536d3bd22601d571d1
MD5 adca51e486199e4f3d6a934ca8f9e4f8
BLAKE2b-256 def92caf3856954a2e4f56969495babf5a491b059bd11a0b58e778747ca395c2

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.8.0-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.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b6a81762df0cb0271fcc3a9884eea7914c5fbf03d5776983fd22732d8e07f43c
MD5 7bee8ffddd614a2952ac80ba52b014be
BLAKE2b-256 95390d072d8ffa97900f6aa51b185bc337b8d0504066fea2b92fc213b9b52ab6

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