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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

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

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

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

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

mcumgr_toolkit-0.15.0-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.15.0-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.15.0-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.15.0-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.15.0-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.15.0-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.15.0-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.15.0-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.15.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 975d092f8f7b011efd8a0793ef001bf5bdd6fc37a477c643aea93f7656ed9944
MD5 906ca145166d085321c0ce7087eb4d3b
BLAKE2b-256 fd64ab9bc201cc5a98ea3682a683a1436d6c2810b131411ee0f99d50bbe98930

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 6ce118334533f0cedf5880a09f5457d84730b375405966eca38bbe6cc4454a54
MD5 4c0893d7801c5abc915e9be3843d0e97
BLAKE2b-256 faba858d9347def1800baf2577c3953af3694da8c7098267555ddc45e0356dc1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2b4b7143e168e6a016589197540b86f9dc5e6ebaf0935012190c53181907e510
MD5 8785791be917d71341768bddbde549a5
BLAKE2b-256 cad7231b405e9b6a3a7f812c9a7ab6c8831ca7138bf2c90cefa6bbcf7b47a3f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 63bb9989aaff5fe44f80023cccd8b7277b58cad8c2e8f090cff020a3114e265a
MD5 7b4a65497aed7d95a33138151e15788c
BLAKE2b-256 ecdd3f9b6cab9aaff713414003c37733c74046f9294c670a3d1f84d9be2c08c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 0a27953975753443355320cefa567e98834066c88a55153ac7cd327f4f9fa09b
MD5 c9b45462b860c3c1261ba73f18017989
BLAKE2b-256 62ce317e2f75779b9e0f4949e29a476cc1380be5e7704d57977c20c9d73f3c01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f17a0e4515292027aee2c0fbaa8144778b3e3df9fe9c7a86092c760d7ba90d2c
MD5 daa82f101a79c8686864cc0c44762b4b
BLAKE2b-256 c91ca71f26a1b586d0d5d726e15b9ab4b5cbfb56fb0ca251016997afa254f066

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb0f7efbf8a2fa7a9094fd05ad4db6f0d88d6d85652f57f7a08e88554fba62bd
MD5 34ea7f45ad2dcacded3011ab8a27e9d6
BLAKE2b-256 a16be9c087a64a0ad04f4f48dcc17cfbdd01a16b62bc7e8e633507132c8805aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 1ff63f60d6f285fc838d89552357c60f6e90ad1e174070e92d5968335049fd6b
MD5 23108415f618ca005dd3d5b0144c812d
BLAKE2b-256 13c9c2ede8a34d896a58bf1e22a6d385f4211b47e2c15e4f254e6653eed0d799

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 71f5c4bbe2fe5c22a57c5ba0bf234e8a2d4198b05bd66d3d57e143fa62b230c5
MD5 09cdf3347ddb4679666389ffcc164cb3
BLAKE2b-256 7c7c71b3617b4305023b2d8f19edf76b77c49a169f7661eab90e6fdafdf9c4e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 330ba7bfe639bf7427c8fdf235b152ad131b89065f7c88f079b0b7dc93488805
MD5 15bf1c62ccf6ac01d5f422b141ba41c1
BLAKE2b-256 fad21806ef3b10d83ceaf89bb74e994adb3fb577c89fee98102b9d5612d5da8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 ab2968e42d5c0b4178e08d3c7d179831d258ca7947beaed57da82389e6da9e09
MD5 8ec13d5cb3513da817e082fb8750fdde
BLAKE2b-256 81d01ed7c5e8996526bc476613fabae7da932e9cb60465e9cf6273682f5dd0d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 5cf9a84fff47483d9a7aeb80e01c62bf1693066708210ccad1e56a39f457a782
MD5 ba94aee54f2da4719f19a4eee9bdf530
BLAKE2b-256 520b9b9a8e75cebd76d3247dd249a8fcd92b9504ac62ede821c0be43122e7465

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.15.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 22964806e0daa8dc5778207e6a6cb3a8967d8900ca8d9fec015ddda2b8bc993a
MD5 dd453d0e13f570e28c4e8a38641c23c9
BLAKE2b-256 95c7ad383473d7542e5e470dc7afa7c895b61c5ed087c6f68d4a04bb639e0883

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.15.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.15.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 7094092b21ad302540d5ebdf1609f856f82a44a81f36314f3f8f50475c595b60
MD5 2c6ce73e83875167914d549426b073ca
BLAKE2b-256 4ab7cd0e639555de94d6cad605583434bec3332b125c68a9671a65dff6e2510b

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