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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.14.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.14.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.14.0-cp310-abi3-musllinux_1_2_armv7l.whl (1.6 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

mcumgr_toolkit-0.14.0-cp310-abi3-musllinux_1_2_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

mcumgr_toolkit-0.14.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

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

mcumgr_toolkit-0.14.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.14.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.14.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.14.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (1.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ i686

mcumgr_toolkit-0.14.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.14.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.14.0-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.14.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7fac9a551cd83ec05ba7603f9ad0620f298f45335eb24ebd36ee1380f7cc892a
MD5 4e5be9c242443d1b7b24bd01b1ab92d1
BLAKE2b-256 362d526537a1cf7d88a4a6b2d79eb6f19066cc389cf981032377d17730461faa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcumgr_toolkit-0.14.0-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.14.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 3ff675171ccd96942c165c59ea920d9ca937370fc0b7d0a3887028aa2901d12f
MD5 41cfaf7934f9166e21292aac4ea17de8
BLAKE2b-256 b7fe66872ec366c3cad4a4bce61fed7fb2ebd41847a3b9638ea6be38b9299249

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 59a575cb2c340a56ceb78769997aaf3ae1c2c53390119b6c7d2ca2734b94eb40
MD5 6586d35f2c4eb9e47f4705641b7d5499
BLAKE2b-256 709ee30c1db6af9309c5c5ceafb799331e472e1677a4addbed689b3e2661fe07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 cb8b1ae003b471f0ab5b82258162e81c167440f9f956f214861f8bd1b960e3ce
MD5 61e64ab735f5d863f5caf570e49afce9
BLAKE2b-256 53db1347a6ea61441e1b2da1364282f9fc0177c313e8a0391f27277a3ef82aa1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 cfa0f2938605459c60911325e6d486437d3f2cbc34b183924867fd071053d923
MD5 e4f1059463f86c65f753d392e1af9ea1
BLAKE2b-256 db0980d3b7a7bec9a37e52f4b7e1b1ea79dcc842536f378dd65f9c634ab10fa1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4834d3d95a4281990f030b8a4bfc235627f536d1a987a77e7e19c50659324e79
MD5 91dbf65af74240617d94b5717543bb42
BLAKE2b-256 0847442f947c8aa7d50d6f5543d4271935029a48686abceab5ebfcd54cfafa11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa2f262e810fae956f74dc96999f4b808ecd60edfcc81e266a3de89c4c798aa5
MD5 542f967fb53b4f1057c6d6f06ddc0751
BLAKE2b-256 98ac280efff07d24b05472b1c5a5fdde366db0eaddb028c7c63005db7cc7b84d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 de1fc08d51790e1fd525cf0bea8932ca05b05a39d57bd79addcba202fa634b64
MD5 cde77fa6100941eb89711e52959e2f1f
BLAKE2b-256 0a1cf25cd7956ee99f46408bed09501c21bbfd735fc5aaf7eafaea4193ecb6cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 a9bb85472f5bf2ffc4195d86a0a1e9d3f95875bbbd43cddb15626ad971debb24
MD5 9044d53365378456e34fc9841e603605
BLAKE2b-256 3fe7b134853e282debfd170b56bc1e8ad9a4a961a76a95836f5e1aeb7ead21e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 3ac9b80f25486fe013c9e7e2b2a29d05f841b85a5039395d5228d9fc1b82f950
MD5 c4d5c044602e98da3e4cc33e6db77bb4
BLAKE2b-256 3d90c90ce388dcab83b1c5a04773a1682775f816c7cbae12237530badb3e00ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 be76fc842e2d43abb4172372ac078044c5a4b2f1ff5a50a607004da82e8a2150
MD5 9b05acbc854aa43d481a03c3317ae7f2
BLAKE2b-256 300cc477ce0150d55a8e70ccfd62d636428ff31116114079b73808ef67de0f70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 6d5806752c5e6fdc6ca3c3c335bedf2e67796381c4b5a0d84e54bc54c3a03c4e
MD5 3a1f3adbb196b1a7403b6a191320c0d8
BLAKE2b-256 2f26acddde08854e936de59157962f37e696c9919d08d3e0c13089f510d70e6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.14.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 56b3faf3fc5d76c5b3b9cb6f49400b027075da476e3c82a604dccb964915b363
MD5 827350fc203bd84fa79750032785d381
BLAKE2b-256 88ef3f4b4a6033a26d585f4ec436aefbdf726e19cb87b28c7db9244081ecefb8

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.14.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.14.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 0dff61a938f16d55cf16daa8f293e15f8c35832744d476457fad6d59cf149a9a
MD5 f806f2eddf7ec303afc9c6fec0afb706
BLAKE2b-256 e2eedf0fe52c9d48429dfe84817235155da6ac6bc1eba885a99f0c8de237e161

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