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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.12.0-cp310-abi3-musllinux_1_2_x86_64.whl (1.5 MB view details)

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

mcumgr_toolkit-0.12.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.12.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.12.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.12.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.12.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.12.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

mcumgr_toolkit-0.12.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.12.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.12.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

mcumgr_toolkit-0.12.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

mcumgr_toolkit-0.12.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.12.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 973834bcc503a3bb3a718210eea80101962281de4ae9f417955ae0b88258fa0f
MD5 3ef181cafc6fa7209c516c25cf29ed2c
BLAKE2b-256 01063130e4be185c69b45459e88cb349b7dc31cc0c334e1ad7d2026431c250a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 857a878fe46aa740ba4413386c2f354989e1c10b6976ce50437b31a0b5e31430
MD5 ffaad32f0e8a19400dc1d66aa797cdfa
BLAKE2b-256 c44465e410758441a26f5c7f3b34ebe96d77c0d05816786668531c671edf0735

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c79175669dfc5560cd070db851f96c6f490e0436615dd9ce29880fe5e7cb830c
MD5 26cc8b600b1d684ce7bf1520004b1b3e
BLAKE2b-256 2c8abeddaeaa2b022f5e31be1901f85d458c406da09d42367e1a3c3473a938b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 451a6bd135e1e6ec4eda10dd35537f1b92492a2ddffa7355e54738a3468f42c5
MD5 72ab92e98c289faae2b941ab7c872de5
BLAKE2b-256 b15effe67651d18c196d81111f9ef5332d0b5cd881b999502cf262ad1504c93f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 5406ee451cc88fb607d80bf7148da281d820417672e2bb196ac610150257e266
MD5 7d8efab4e293fbc9f438a7118341c520
BLAKE2b-256 b2a9de7660c84fe8c28139aa0d527acc0b1ca1bfd6f5a1d63bf09e8a481cdac3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 66f9f863bbe2ba0eedd59b58cde9689139053a7ee03bf216c403b9e3a0135b1c
MD5 4ca3ae052a3e6b303a2b1bf76f50206a
BLAKE2b-256 1d98148df46366ab2ed44ffacaabc14136084e7d2f88f8f636ed285f8660a627

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dec29c3487653e73508bbbf0ced2bf2ad644175bb9def3d1a81eae53174d882b
MD5 31ebf0cfc57150a3dcbc39c13b33f412
BLAKE2b-256 5c08096ff2d3abcffd6b77e62ac92d5db46f9b6778802aa547cef2219af8d53d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 b8966a2c9c447a1f28530fca262925581bfd4515d1cc55dc7390cba0fb72ed9a
MD5 a10fe377f6b3b1288c39ad14aeb6287a
BLAKE2b-256 4b2868db2fa0602af355e54e7c943201630564b807e697af5548bfff6f91911f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 55adb94739258fb4f59281947bb2256901ece66c253e510cee8dce663b58c328
MD5 6431681e201bd8115b1c2185bd144bc3
BLAKE2b-256 5e4995b2867414ab2a3e1fb7bd8bba36808c33759ab473e05e6497374e7fd071

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 0d2c0470e756ce82229cf646ae0cd256166dc33d96a53a32574d91091841bab0
MD5 1c3f93888c932217d8698ac59c36cb9d
BLAKE2b-256 de531840942170a00f8ae09ef8e73717920cf89b0111f94e24ff240050aae717

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 982e65c72273a5f8435f7f9f936e7ea82ad49c3dc0dab643e2dadd6e1babec07
MD5 201c9b7d1cf2ef508ca506f2e0a42b6a
BLAKE2b-256 88f4c0196954f9986072a729e6e3bdd6c912ce3d5bfb51a2d522995c410251c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 4ae4dc3fb8e3264f20a074a41cb28b0910a232041089da9a5e56e82c949439eb
MD5 8ed2679de6a0db674a3ead03e699c7b6
BLAKE2b-256 ad228d223107c77fad67beadc029e786d26be7e7ba33419ff5ef5cdc3a48d7b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.12.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 921ede2614498de66b59adda0c48c6b79fddffb7ab33f70816fbd465ab74ed03
MD5 aa141b2c9c541336e23f937ebd95d35f
BLAKE2b-256 3c3ea64230c3f921d867deb7a0b76435ad63c2b7afcb47ba8f8d4029c0327ae4

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.12.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.12.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 e6431f42c97358e86d1874dc0eb30132454d75efa3af0dc2e2191bb76d9e0179
MD5 04e9eb51c410c362287bcab957765b83
BLAKE2b-256 5b557e3c2365a50c6208b83fe7609e8b15888ca248809f5a989ea67582bfe7f2

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