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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.11.2-cp310-abi3-musllinux_1_2_x86_64.whl (1.9 MB view details)

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

mcumgr_toolkit-0.11.2-cp310-abi3-musllinux_1_2_i686.whl (1.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

mcumgr_toolkit-0.11.2-cp310-abi3-musllinux_1_2_armv7l.whl (1.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

mcumgr_toolkit-0.11.2-cp310-abi3-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

mcumgr_toolkit-0.11.2-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.11.2-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.11.2-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

mcumgr_toolkit-0.11.2-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.11.2-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.11.2-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.11.2-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.11.2-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.11.2-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 23dc6eb1e8fa223557320e12fdb1be1825ebec677201e7fa2f7a65866b027603
MD5 7d4a977ac9d33fa66350d9ccf10f8fe9
BLAKE2b-256 852adb1db83951abdac898a5a7299a2dc1b2a5574e64c4bf39aeea8a69dcc1cd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcumgr_toolkit-0.11.2-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.11.2-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 4a504f52fc38908df2e545fce3ae7d26d6eb616ce5b6a7cefd8d75265fbe6956
MD5 5fcf5d217a1878e7fa772d3dec3a0843
BLAKE2b-256 810f353a61fec7afd395b400c7474a97e6a1909dfb43e647b2b21c9176c48616

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.2-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 275eb78b3647e249dfc33caa566d83457cfeac1078af2fb3b1517d1bb43227fd
MD5 d788331981f9140384d2f613f053f009
BLAKE2b-256 dc86370bdb02691533bbce569d4f78093952a204578b16cf578b2c94b6fcfb9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.2-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 73081020eda5a79889c901c9967224edc4940a1717626cb65c7a2e7dc53c90f4
MD5 8e5a8b0e491200427de9f858117bfadb
BLAKE2b-256 b951ff08e162ff0db5798bda4e1092b59c494ec2833c32570245cfa48a6f83bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.2-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 082d6aac74ec27843525b2877ca8a7b89b2aa328f63e5c9e68f468fb343d1658
MD5 710ccb4e3795b2f6d711e7c15711405a
BLAKE2b-256 bd0f731d8dbe391b268e4ea54107648dae52a424a6bad99846723f3bded5b9b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.2-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 48b42a7af7799c9af15d616dd76847983eb1adea7b90cee49bacab56c8045235
MD5 3aacdc28ca41510305cf3456ed90621f
BLAKE2b-256 840b4fd6f573a41fb1f7c6ca32f70b323b78a4dcf9dd48d1b925081303cd3690

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a10d764d26ef83e726363e4eaf3504f1b6b356c5fcfbee2380f20fb3668e7730
MD5 38a2686b4a8c36b5aa185696c523ab61
BLAKE2b-256 37c7c826e3c744dee487728d7243a3e1ba0aff557264e15833c2095e4d7bce90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.2-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 aef702f5352b9ae83ad282111984c84b2e81a2763fe72e01220a9fa3bfcec29f
MD5 69bf63ab88d2503abe0bf9064e246fc5
BLAKE2b-256 5300d23986c7db657a9d514f6d0d8867580a24637102ad704177a71331e94241

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.2-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 326467b3a45e3fedbc168ac75585e1d0c5cc61549848ee65b962803fb8fc9c1e
MD5 ee09543f2a93683d68291af80bac9d4f
BLAKE2b-256 13e6bbfbd23729bb6efcfc64c46895c125232676fabe48a8e180787347a639aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.2-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 b7cbcb82a1f71dbf93893aa8da1ce7b9418db317ccfa7f54ae3821cdce6bc038
MD5 d6f89c4b5430a8970b03b12ed3652722
BLAKE2b-256 0e70a691a7b77323933245aa051faae51c124b03e9ce590084596b30a6ddf895

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.2-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 6374c2a56b183be256fb2c26718b031065cadd3c8ad8bdcd879fbed9267fadf1
MD5 3600088e79c0b91a5a0dd81dbd3b38dc
BLAKE2b-256 8fbc0d15fa3953025143443c92219d00cc2817bb243f5e0933600edd40c33539

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c1e357fc243075605e6ad9e7055d8197551bd4f5049e3686d55441a37d46e0c0
MD5 2cbc82e17c197dca703000edc35c5ae7
BLAKE2b-256 b2fd69c4072d29c6b4561e5002e36602c36c3f98057f1414a45609e113399acf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.2-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 3b40b7d089e8212cee0939f16246a835b4710f3e65210f97f0ed29ccc4d7592a
MD5 171bc58b3a0913225ef1c8fbcb88694f
BLAKE2b-256 9dba641c2bd83621b684f77f79ae10fa8536498b34d064918a57e66c953e2297

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.11.2-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.11.2-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 e52a76ad821ff87a70eaf1420f4d11b447a4b6336caaa58dbcf0fa400e17563e
MD5 4de27525b796df3e77494ec65ad4b39a
BLAKE2b-256 ab118a9f63e161de3ba0b9f9c15f526408ef03ad7871bad22752214dd617656c

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