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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.13.1-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.1-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.1-cp310-abi3-musllinux_1_2_armv7l.whl (1.5 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

mcumgr_toolkit-0.13.1-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.13.1-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.1-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.1-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.1-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.13.1-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.1-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.1-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.1-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 08103c357d2df6db03e47377e82506113910a34d49d384d145212eba8206d627
MD5 1cf7f0f28f565a6fb746d29ae5d1a42a
BLAKE2b-256 424ff46a746bf0265d2e8042f78b546ab1559cc80ccd6b48e57f636f274cc4d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcumgr_toolkit-0.13.1-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.1-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 f2d31208fc72bc06a9c899a0315a9d02025f6775b09ab13cbaf409cd733e1337
MD5 b7438a38cf4859d26a7c5d145ea1bf65
BLAKE2b-256 9400337f100d0b0d822da325745ab3d72bbc71fdabc19da271fa0d1dcf3ab3cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ede58e96c37015733ef47c3a32e4643ab0b53b1cf5a9c17f1e3ea116ff7ef25e
MD5 d8f9243ed4738e88e70e04e201f79b6a
BLAKE2b-256 a9c4100feddf200e7c7763b8130bebdd238126b13c1a3ade332d41198ec45c73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.1-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 a5a8cb4a1ba16ebd9d8224ad94b026aa1a70d39e768777611694e950bac20aa5
MD5 12aaa06307eb448b189a8f5b9f2e033f
BLAKE2b-256 b06ab1aa4466be2d2704081b1693a33ba246933086fbfc4ab2329298b8bddd93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.1-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 a87cb17d38b0b14b0edb84c37864e63d338e91221348fb1801011e3d5f90f3db
MD5 64ec68673d3379b0888289087f218e9e
BLAKE2b-256 2baf602c179da7cc14b4e391cd1731d2e4dfb1fd2d3c3739228e579e2ba4be7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.1-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a125c21f9b47f0f37289483132894f14736b92e18704bbff269974982d7ee5f4
MD5 4bc138262098047e96fd8cd29963d72e
BLAKE2b-256 3b87740df86b322db6c6611ecb04baeffb3834216824659b3866ea28c1154a64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 515ec922c39d1b4c4f0cb513a47072dfe461446425a6113f112e264d1c9451ef
MD5 6660ec0a53c62070d25258b2ec313191
BLAKE2b-256 c05d575a267a433127718405437bffc0626c86c8e6d8cc880d81273545ab54f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 34795a0c3992239c56dfd0015acf8329004fde21ff9e82e8f5437527f9fb30de
MD5 c65117195262aaa80432af56d6ed91f9
BLAKE2b-256 a601599a94590634959866e91e72e6f8eb50071a604383807d166432fc1d64ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 f032b94215e09a0bc1d24489e58013335ec04b1de268a46e59b6e9748fe0995e
MD5 ef8aad43c078d2634d7faa9a2da6b8af
BLAKE2b-256 c51bd7602b6febb9e92f3cc8d996cc08a465c811016bd678f5c6177ced51799c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.1-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 6f98de829a0ea3f50e8b030a48b904320492662f48f727360529a1227e25c2cd
MD5 84fd745505e15f24bf46d409c005a472
BLAKE2b-256 d43b7d7f83d61dfce6f4791c2aa4830691a1f5ec7d1f6c7a0600a85f94e45de5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 1528bd81f62d50bc5e94545fcaf99c6a480f309c28e521de9431df96edde11ff
MD5 b5d4d671a74fbeefe2ce7091aaaef932
BLAKE2b-256 bc19481f3d1f3c275c96a2d54f9dde959677b2b10231bec5e3617b43e7b7b443

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 7ee1087b60c1903013f6cfdcecb02f8a4240aa05a548a7ea274dc7f317bb53ca
MD5 476c313fd7665475a8ede3bf876d8855
BLAKE2b-256 e43cf0c9dba6ff733ff612cb1db501293449725c8dcac3495757ae064cc759a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.13.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 76a4a562c7762c9d81216b9612ad92d77335141e48ed93847de54341c440c0d4
MD5 512647b03341921ca1e674ec266b31ce
BLAKE2b-256 158c88f78f93d80a7aeeb9dfabfe885c01bb566a9c453068ab8d7bb40422683a

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.13.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.13.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 6362e8314bb70d3dee258ff1870c3789c496dc5fadd064d5c8f365c2bbfa6ce6
MD5 06759f3875882d94edf4cc90d7722cfe
BLAKE2b-256 a0839425a56ca988c0baa03189c18a6fa1de5fb0fb9818a56edae167e70dd60d

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