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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

mcumgr_toolkit-0.11.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0f3f09555ae7b6c65bcc633f341492e8184ddc75f9f4f3c5815e1f73b6bc5a5e
MD5 2f3e8a1fb1154d1ab89c6b29ce41b78c
BLAKE2b-256 ad62cf983a842438b6ef265ba51ffc459ad40b1a62df632a4c5a25575179f58b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcumgr_toolkit-0.11.0-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.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 a1125fbc1bb328cd749beeca67a94504e86ba578785172659588cefb75027ee4
MD5 9ed391528b0b34a0c7ebf45c05248e7a
BLAKE2b-256 0a4163ea09ddbec449b35177a05278108d435c01af92a6e36ba8e221ba0594ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8fe299d71c6e73fec2657ef8614353f878e8e4511babc3585431053ef65983fe
MD5 56b97acdba02e294d78336799506a119
BLAKE2b-256 02df1938914ec2a5967f8d3e508535d4f62905ce056c8a874d0a3e7d63fe211f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 2b8ad87f0e55348b1e47477346c703ffbd61f93ab44e739f5604572d9e9dfa1d
MD5 c71012ea263a66d86749968e91006813
BLAKE2b-256 abd881c1b2f81f02df9d12452bded5906eaeb9d1839b0065043179cd3c5afca1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 fd7821c48dd332aabfdc37aa30c8b579df979f1464d1cb82ed58b0b919fabcc4
MD5 9368012bf73e239686613c863d41f49b
BLAKE2b-256 7ddc29b9de09e1ff04310aff52d17a8e049a2c3ce47fb0a8838ca82502b6237e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4f6fb16ad31a6537fe21588bac29693caff20141508e0d39bbe6193c3221f115
MD5 c7a12d79352226e0e7d2c00ab11744e2
BLAKE2b-256 b80b65c0da1638380067fe7b4fc60e20b0d33c1a4a0c60f3756963eaa4f60223

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ef620922046a261965deed39d132d690f5414c9b74c20bf54921b729967b5ca8
MD5 923e02282669c155918638846b5d5aca
BLAKE2b-256 2a7fdb5164965d693008cae1ba70e0add9a1fd627cc37b8951697d5ba88e7177

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 8a0077ffe36b3b7defe52389a7bdd134346ce286a1dfdf125be41a01ea093d1a
MD5 c4b2f3d44c7470930054afd7e83d1ba7
BLAKE2b-256 c44ae9924aaa052feb96aa00fdbaf4fd318896e68d86ec215086b158b5784c82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 51b0278dd2103a70d5786df0079bbb9ad86027e5f6c1fc01660258eff27a2e94
MD5 0845cb5d264a64d1d52d7e8cbb27b87e
BLAKE2b-256 5cd5848184eedfa3ac4736afeecc7f2b9c7680b6c759db648ca5d99098857425

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.0-cp310-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 6bd381ae68d64fe3574f62b0701c1ecf10e18ef11a1be3b7db9501b94d9e7215
MD5 2bf3c76748d48aeba5d70ce2e48b4302
BLAKE2b-256 f6d4ab1d769de0fec329d8fbbbf923ad29b0fb311409acb8600e3f1e8c535de0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 8ea2abd0ef08902552217156348fc4eb356a2de29a51d85b2f9659045ce2fc6f
MD5 8902e076199144d552444f57bbd8f5f9
BLAKE2b-256 40ff38516457c80288d6588f36e80786785ea16fefe3e8b4fd3672aad1a75de0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3d0004cc484c7f3afb852072780f2b61bd58cfd776c317a9b955221fe7776510
MD5 8123f1dc7a6ffc3615b5a184a1de2c1f
BLAKE2b-256 e1a89650d4ce5dddc49d694f2758eb197c35f17b913d67836517d5226c96a316

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcumgr_toolkit-0.11.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 f6d057b9489c32e6901c4a2135cb69590639ccd3652ed20697e52ca1189cab92
MD5 ea2610fc33044d177f355e8aa40b185c
BLAKE2b-256 1ccb4f3223488b50ae850e4ed9f6a0e08294294c92a689fb5d681903801b1e12

See more details on using hashes here.

File details

Details for the file mcumgr_toolkit-0.11.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.11.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 869203c66e0304387363a5ea747a449ac3a09fed5d3fcb48e140c43d45cf6176
MD5 6edfa1dc04c1f111563376b3808fecb2
BLAKE2b-256 bc70d28cb5bf8d1f29642f5bf49fe6d487e14cf213963c13e49379627cab6e42

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