smpclient 7.2.0__tar.gz → 7.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- smpclient-7.3.0/.camas/.gitignore +2 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/.githooks/pre-commit +1 -1
- {smpclient-7.2.0 → smpclient-7.3.0}/.github/workflows/test.yaml +34 -13
- {smpclient-7.2.0 → smpclient-7.3.0}/.gitignore +3 -0
- smpclient-7.3.0/.mcp.json +14 -0
- smpclient-7.3.0/PKG-INFO +226 -0
- smpclient-7.3.0/README.md +182 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/usb/upgrade.py +9 -7
- {smpclient-7.2.0 → smpclient-7.3.0}/pyproject.toml +5 -17
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/__init__.py +85 -53
- smpclient-7.3.0/src/smpclient/exceptions.py +17 -0
- smpclient-7.3.0/src/smpclient/transport/serial/__init__.py +13 -0
- smpclient-7.3.0/src/smpclient/transport/serial/common.py +156 -0
- smpclient-7.3.0/src/smpclient/transport/serial/encoded.py +752 -0
- smpclient-7.3.0/src/smpclient/transport/serial/framing/__init__.py +28 -0
- smpclient-7.3.0/src/smpclient/transport/serial/framing/cobs.py +150 -0
- smpclient-7.3.0/src/smpclient/transport/serial/unencoded.py +179 -0
- smpclient-7.3.0/tasks.py +43 -0
- smpclient-7.3.0/tests/fixtures/smp-server/SHA256SUMS +47 -0
- smpclient-7.3.0/tests/fixtures/smp-server/VERSION +46 -0
- smpclient-7.3.0/tests/fixtures/smp-server/manifest.json +776 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_mps2_an385_serial_recovery_buf1024.hex +2680 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_mps2_an385_serial_recovery_buf1024.signed.bin +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_mps2_an385_serial_recovery_buf2048.hex +2680 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_mps2_an385_serial_recovery_buf2048.signed.bin +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_mps2_an385_serial_recovery_buf400.hex +2680 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_mps2_an385_serial_recovery_buf400.signed.bin +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_mps2_an385_serial_recovery_buf512.hex +2680 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_mps2_an385_serial_recovery_buf512.signed.bin +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_serial.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_serial_bigrx.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_serial_buf1024.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_serial_buf2048.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_serial_buf256.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_serial_buf400.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_serial_buf512.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_serial_buf96.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_serial_fs.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_serial_line512.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_serial_noparams.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_serial_raw.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_shell.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_udp.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_native_sim_udp6.exe +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_qemu_cortex_m0_serial.merged.hex +4428 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_qemu_cortex_m0_serial.signed.bin +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_qemu_cortex_m0_serial_buf256.hex +2449 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_4.4.0_smp_server_0eae053d_qemu_cortex_m0_serial_buf512.hex +2449 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_f33aa2bc4a43_smp_server_27c54835_mps2_an385_serial_recovery.hex +2697 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_f33aa2bc4a43_smp_server_27c54835_mps2_an385_serial_recovery.signed.bin +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_f33aa2bc4a43_smp_server_27c54835_mps2_an385_serial_recovery_raw.hex +2636 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_f33aa2bc4a43_smp_server_27c54835_mps2_an385_serial_recovery_raw.signed.bin +0 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_f33aa2bc4a43_smp_server_fa39f8c2_mps2_an385_serial_recovery_raw_cobs.hex +2649 -0
- smpclient-7.3.0/tests/fixtures/smp-server/zephyr_f33aa2bc4a43_smp_server_fa39f8c2_mps2_an385_serial_recovery_raw_cobs.signed.bin +0 -0
- smpclient-7.3.0/tests/integration/__init__.py +7 -0
- smpclient-7.3.0/tests/integration/conftest.py +294 -0
- smpclient-7.3.0/tests/integration/servers.py +453 -0
- smpclient-7.3.0/tests/integration/test_enumeration.py +24 -0
- smpclient-7.3.0/tests/integration/test_file_management.py +53 -0
- smpclient-7.3.0/tests/integration/test_fragmentation.py +138 -0
- smpclient-7.3.0/tests/integration/test_image_management.py +83 -0
- smpclient-7.3.0/tests/integration/test_os_management.py +30 -0
- smpclient-7.3.0/tests/integration/test_serial_raw.py +32 -0
- smpclient-7.3.0/tests/integration/test_serial_recovery.py +193 -0
- smpclient-7.3.0/tests/integration/test_udp.py +27 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/test_base64.py +1 -1
- smpclient-7.3.0/tests/test_cobs.py +214 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/test_smp_client.py +147 -21
- smpclient-7.3.0/tests/test_smp_serial_raw_transport.py +363 -0
- smpclient-7.3.0/tests/test_smp_serial_transport.py +616 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/uv.lock +583 -58
- smpclient-7.2.0/PKG-INFO +0 -132
- smpclient-7.2.0/README.md +0 -88
- smpclient-7.2.0/src/smpclient/exceptions.py +0 -10
- smpclient-7.2.0/src/smpclient/transport/serial.py +0 -371
- smpclient-7.2.0/tests/test_smp_serial_transport.py +0 -262
- {smpclient-7.2.0 → smpclient-7.3.0}/.github/workflows/release.yaml +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/.github/workflows/test-docs.yaml +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/.python-version +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/.vscode/extensions.json +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/.vscode/settings.json +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/LICENSE +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/_generate_requests_docstrings.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/file_management.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/image_management.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/index.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/mcuboot.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/os_management.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/requests.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/settings_management.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/shell_management.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/statistics_management.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/stylesheets/extra.css +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/transport/ble.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/transport/serial.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/transport/transport.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/transport/udp.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/user/intercreate.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/docs/zephyr_management.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/.gitignore +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/README.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/ble_a_smp_dut.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/ble_b_smp_dut.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/envr-default +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/envr.ps1 +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/image_check.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/mcuboot_serial.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/mcuboot_usb.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/mcuboot_usb.overlay +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/stm32f4_disco_flash_overlay.dts +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/stm32f4_disco_serial_overlay.dts +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/stm32f4_disco_serial_recovery_button_overlay.dts +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/udp_a_smp_dut.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/udp_b_smp_dut.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/usb_a_smp_dut.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/usb_b_smp_dut.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/usb_smp_dut.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/usb_smp_dut_1024_1_1024.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/usb_smp_dut_512_8_4096.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/dutfirmware/usb_smp_dut_8192_1_8192.conf +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/README.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/__init__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/ble/README.md +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/ble/__init__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/ble/helloworld.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/ble/imagestate.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/ble/mcumgrparameters.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/ble/upgrade.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/ble/upload.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/adafruit_feather_nrf52840/ble/a_smp_dut.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/adafruit_feather_nrf52840/ble/a_smp_dut.merged.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/adafruit_feather_nrf52840/ble/b_smp_dut.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/mimxrt1060_evkb/usb/a_smp_dut_8192_1_8192.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/mimxrt1060_evkb/usb/a_smp_dut_8192_1_8192.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/mimxrt1060_evkb/usb/b_smp_dut.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/mimxrt1060_evkb/usb/mcuboot.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/ble/a_smp_dut.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/ble/a_smp_dut.merged.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/ble/a_smp_dut_image_check.merged.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/ble/b_smp_dut.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/usb/a_smp_dut_1024_1_1024.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/usb/a_smp_dut_1024_1_1024.merged.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/usb/a_smp_dut_128_2_256.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/usb/a_smp_dut_128_2_256.merged.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/usb/a_smp_dut_512_8_4096.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/usb/a_smp_dut_512_8_4096.merged.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/usb/a_smp_dut_8192_1_8192.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/usb/a_smp_dut_8192_1_8192.merged.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/usb/b_smp_dut.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/usb/mcuboot_a_128_8_1024.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/usb/mcuboot_a_128_8_1024.merged.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52840dk_nrf52840/usb/mcuboot_b_smp_dut.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52dk_nrf52832/ble/a_smp_dut.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52dk_nrf52832/ble/a_smp_dut.merged.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/duts/nrf52dk_nrf52832/ble/b_smp_dut.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/udp/helloworld.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/usb/__init__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/usb/download_file.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/usb/helloworld.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/examples/usb/upload_file.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/mkdocs.yaml +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/extensions/__init__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/extensions/intercreate.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/generics.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/mcuboot.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/py.typed +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/requests/__init__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/requests/enumeration_management.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/requests/file_management.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/requests/image_management.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/requests/os_management.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/requests/settings_management.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/requests/shell_management.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/requests/statistics_management.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/requests/user/__init__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/requests/user/intercreate.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/requests/zephyr_management.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/transport/__init__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/transport/_udp_client.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/transport/ble.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/transport/bumble/__init__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/transport/bumble/__main__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/transport/bumble/device.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/transport/bumble/keystore.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/transport/bumble/pairing.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/transport/bumble/scan.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/transport/firmware/__init__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/transport/firmware/hci.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/src/smpclient/transport/udp.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/__init__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/extensions/__init__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/extensions/test_intercreate.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/fixtures/__init__.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/fixtures/analyze-mcuboot-img.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/fixtures/file_system/255_bytes.txt +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/fixtures/file_system/test.txt +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/fixtures/tf-m-9a4cb1a28/tfm_s_signed.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/fixtures/zephyr-v3.5.0-2795-g28ff83515d/hello_world.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/fixtures/zephyr-v3.5.0-2795-g28ff83515d/hello_world.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/fixtures/zephyr-v3.5.0-2795-g28ff83515d/hello_world.signed.bin +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/fixtures/zephyr-v3.5.0-2795-g28ff83515d/hello_world.signed.hex +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/test_hci_firmware.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/test_mcuboot_tools.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/test_requests.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/test_smp_ble_transport.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/test_smp_bumble_transport.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/test_smp_udp_transport.py +0 -0
- {smpclient-7.2.0 → smpclient-7.3.0}/tests/test_udp_client.py +0 -0
|
@@ -14,21 +14,17 @@ jobs:
|
|
|
14
14
|
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
15
15
|
runs-on: ${{ matrix.os }}
|
|
16
16
|
steps:
|
|
17
|
-
- uses: actions/checkout@
|
|
17
|
+
- uses: actions/checkout@v6
|
|
18
18
|
with:
|
|
19
19
|
fetch-depth: 0
|
|
20
20
|
|
|
21
|
-
- uses: astral-sh/setup-uv@
|
|
21
|
+
- uses: astral-sh/setup-uv@v8.1.0
|
|
22
22
|
|
|
23
|
-
- run: uv run --python ${{ matrix.python-version }}
|
|
24
|
-
|
|
25
|
-
- run: uv run --python ${{ matrix.python-version }} task typecheck
|
|
26
|
-
|
|
27
|
-
- run: uv run --python ${{ matrix.python-version }} task test
|
|
23
|
+
- run: uv run --python ${{ matrix.python-version }} camas
|
|
28
24
|
|
|
29
25
|
- run: uv build
|
|
30
26
|
|
|
31
|
-
- uses: actions/upload-artifact@
|
|
27
|
+
- uses: actions/upload-artifact@v7
|
|
32
28
|
with:
|
|
33
29
|
name: dist-${{ matrix.os }}-${{ matrix.python-version }}
|
|
34
30
|
path: |
|
|
@@ -80,11 +76,11 @@ jobs:
|
|
|
80
76
|
expect-hci-firmware: pass
|
|
81
77
|
name: transport-extras (${{ matrix.name }})
|
|
82
78
|
steps:
|
|
83
|
-
- uses: actions/checkout@
|
|
79
|
+
- uses: actions/checkout@v6
|
|
84
80
|
with:
|
|
85
81
|
fetch-depth: 0
|
|
86
82
|
|
|
87
|
-
- uses: astral-sh/setup-uv@
|
|
83
|
+
- uses: astral-sh/setup-uv@v8.1.0
|
|
88
84
|
|
|
89
85
|
- run: uv venv && uv pip install .${{ matrix.extras }}
|
|
90
86
|
|
|
@@ -126,8 +122,33 @@ jobs:
|
|
|
126
122
|
coverage:
|
|
127
123
|
runs-on: ubuntu-latest
|
|
128
124
|
steps:
|
|
129
|
-
- uses: actions/checkout@
|
|
125
|
+
- uses: actions/checkout@v6
|
|
126
|
+
|
|
127
|
+
- uses: astral-sh/setup-uv@v8.1.0
|
|
128
|
+
|
|
129
|
+
- run: uv run camas coverage
|
|
130
|
+
|
|
131
|
+
integration:
|
|
132
|
+
name: integration (native_sim + qemu)
|
|
133
|
+
runs-on: ubuntu-latest
|
|
134
|
+
steps:
|
|
135
|
+
- uses: actions/checkout@v6
|
|
136
|
+
with:
|
|
137
|
+
fetch-depth: 0
|
|
130
138
|
|
|
131
|
-
- uses: astral-sh/setup-uv@
|
|
139
|
+
- uses: astral-sh/setup-uv@v8.1.0
|
|
132
140
|
|
|
133
|
-
- run:
|
|
141
|
+
- run: |
|
|
142
|
+
sudo dpkg --add-architecture i386
|
|
143
|
+
sudo apt-get update
|
|
144
|
+
sudo apt-get install -y --no-install-recommends qemu-system-arm libc6:i386
|
|
145
|
+
|
|
146
|
+
- run: uv run camas test-integration
|
|
147
|
+
|
|
148
|
+
- name: Upload integration test logs
|
|
149
|
+
if: always()
|
|
150
|
+
uses: actions/upload-artifact@v7
|
|
151
|
+
with:
|
|
152
|
+
path: integration-tests.log
|
|
153
|
+
archive: false
|
|
154
|
+
if-no-files-found: warn
|
smpclient-7.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: smpclient
|
|
3
|
+
Version: 7.3.0
|
|
4
|
+
Summary: Simple Management Protocol (SMP) Client for remotely managing MCU firmware
|
|
5
|
+
Project-URL: Homepage, https://www.intercreate.io
|
|
6
|
+
Project-URL: Documentation, https://intercreate.github.io/smpclient
|
|
7
|
+
Project-URL: Repository, https://github.com/intercreate/smpclient.git
|
|
8
|
+
Project-URL: Issues, https://github.com/intercreate/smpclient/issues
|
|
9
|
+
Author-email: JP Hutchins <jphutchins@gmail.com>, JP Hutchins <jp@intercreate.io>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Framework :: AsyncIO
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Programming Language :: Python
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
21
|
+
Requires-Python: <4,>=3.10
|
|
22
|
+
Requires-Dist: async-timeout>=5.0.1; python_version < '3.11'
|
|
23
|
+
Requires-Dist: intelhex>=2.3.0
|
|
24
|
+
Requires-Dist: smp>=4.1.0
|
|
25
|
+
Provides-Extra: all
|
|
26
|
+
Requires-Dist: bleak<4,>=3.0.2; extra == 'all'
|
|
27
|
+
Requires-Dist: bumble==0.0.228; extra == 'all'
|
|
28
|
+
Requires-Dist: libusb1<4,>=3.1; extra == 'all'
|
|
29
|
+
Requires-Dist: platformdirs<5,>=4; extra == 'all'
|
|
30
|
+
Requires-Dist: pyserial>=3.5; extra == 'all'
|
|
31
|
+
Requires-Dist: zephyr-4-4-0-hci<1,>=0.1.3; extra == 'all'
|
|
32
|
+
Provides-Extra: ble
|
|
33
|
+
Requires-Dist: bleak<4,>=3.0.2; extra == 'ble'
|
|
34
|
+
Provides-Extra: bumble
|
|
35
|
+
Requires-Dist: bumble==0.0.228; extra == 'bumble'
|
|
36
|
+
Requires-Dist: libusb1<4,>=3.1; extra == 'bumble'
|
|
37
|
+
Requires-Dist: platformdirs<5,>=4; extra == 'bumble'
|
|
38
|
+
Provides-Extra: hci-firmware
|
|
39
|
+
Requires-Dist: zephyr-4-4-0-hci<1,>=0.1.3; extra == 'hci-firmware'
|
|
40
|
+
Provides-Extra: serial
|
|
41
|
+
Requires-Dist: pyserial>=3.5; extra == 'serial'
|
|
42
|
+
Provides-Extra: udp
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
|
|
45
|
+
# Simple Management Protocol (SMP) Client
|
|
46
|
+
|
|
47
|
+
`smpclient` implements the transport layer of the Simple Management Protocol. This library can be
|
|
48
|
+
used as a dependency in applications that use SMP over **serial (UART or USB)**, **Bluetooth (BLE)**,
|
|
49
|
+
or **UDP** connections. Some abstractions are provided for common routines like upgrading device
|
|
50
|
+
firmware.
|
|
51
|
+
|
|
52
|
+
If you don't need a library with the transport layer implemented, then you might prefer to use
|
|
53
|
+
[smp](https://github.com/JPHutchins/smp) instead. The SMP specification can be found
|
|
54
|
+
[here](https://docs.zephyrproject.org/latest/services/device_mgmt/smp_protocol.html).
|
|
55
|
+
|
|
56
|
+
If you'd like an SMP CLI application instead of a library, then you should try
|
|
57
|
+
[smpmgr](https://github.com/intercreate/smpmgr).
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
`smpclient` is [distributed by PyPI](https://pypi.org/project/smpclient/) and can be installed with `uv`, `pip`, and other dependency managers.
|
|
62
|
+
|
|
63
|
+
Build with all transports:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
smpclient[all]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Or none (UDP transport only):
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
smpclient
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Or build with only the transports you need:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
smpclient[serial] # Serial (UART, USB, CAN)
|
|
79
|
+
smpclient[ble] # Bluetooth Low Energy
|
|
80
|
+
smpclient[serial,ble] # Serial + BLE
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The UDP transport has no additional dependencies and is always available.
|
|
84
|
+
|
|
85
|
+
## User Documentation
|
|
86
|
+
|
|
87
|
+
Documentation is in the source code so that it is available to your editor.
|
|
88
|
+
An online version is generated and available [here](https://intercreate.github.io/smpclient/).
|
|
89
|
+
|
|
90
|
+
## Server Buffers & SMP Serial Fragmentation
|
|
91
|
+
|
|
92
|
+
Choosing the right fragmentation for the **serial** transport (UART/USB/CAN/etc.) requires
|
|
93
|
+
understanding the buffers in the firmware on the other end. The two SMP servers we
|
|
94
|
+
target name the same concepts differently, and the docs/Kconfig on each side are
|
|
95
|
+
easy to misread, so this section unifies the terminology. (BLE and UDP negotiate
|
|
96
|
+
their MTU directly and need none of this.)
|
|
97
|
+
|
|
98
|
+
### The SMP serial frame
|
|
99
|
+
|
|
100
|
+
A serial SMP transaction is one **decoded frame**: a 2-byte length and a 2-byte
|
|
101
|
+
CRC16 wrap the SMP message — and that wrapped message is exactly what the BLE and
|
|
102
|
+
UDP transports send bare.
|
|
103
|
+
|
|
104
|
+
```mermaid
|
|
105
|
+
flowchart LR
|
|
106
|
+
subgraph FRAME["decoded frame"]
|
|
107
|
+
direction LR
|
|
108
|
+
LEN["length<br/>(2 B)"]
|
|
109
|
+
MSG["decoded SMP message<br/>(SMP header + CBOR)"]
|
|
110
|
+
CRC["CRC16<br/>(2 B)"]
|
|
111
|
+
LEN --- MSG --- CRC
|
|
112
|
+
end
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
For the **serial** transport that whole frame is base64-encoded and split into
|
|
116
|
+
≤ 128-byte (configurable as "line length", but it should always be left at 128) lines on the wire. The server base64-**decodes each line as it arrives**
|
|
117
|
+
and appends it to a single reassembly buffer — it never holds the whole encoded frame
|
|
118
|
+
at once (mcuboot
|
|
119
|
+
[`boot_serial_in_dec`](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/boot_serial/src/boot_serial.c#L1460-L1490);
|
|
120
|
+
Zephyr
|
|
121
|
+
[`mcumgr_serial_decode_frag`](https://github.com/zephyrproject-rtos/zephyr/blob/a65b87f2c6d5961b105193bd94058e523d6df54f/subsys/mgmt/mcumgr/transport/src/serial_util.c#L48-L64)):
|
|
122
|
+
|
|
123
|
+
```mermaid
|
|
124
|
+
sequenceDiagram
|
|
125
|
+
participant C as smpclient
|
|
126
|
+
participant S as SMP server
|
|
127
|
+
loop each of N+1 base64 lines (≤ 128 B)
|
|
128
|
+
C->>S: start / cont. marker · base64(slice) · newline
|
|
129
|
+
S->>S: decode, append to reassembly buffer
|
|
130
|
+
end
|
|
131
|
+
S-->>C: response (length + CRC ok → dispatch)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
So the buffer that actually limits a transaction holds the **decoded** frame, and:
|
|
135
|
+
|
|
136
|
+
> **max SMP message = (reassembly buffer size) − 4** (the 2-byte length + 2-byte CRC16).
|
|
137
|
+
|
|
138
|
+
That message becomes **~1.37×** as many bytes once base64-encoded and split into
|
|
139
|
+
≤ 128-byte lines (base64's 4/3 expansion plus per-line framing). A server that
|
|
140
|
+
advertises a 2048-byte buffer therefore accepts a 2044-byte message that arrives as a
|
|
141
|
+
**2801-byte, 23-line** encoded frame. The advertised/configured number is the
|
|
142
|
+
*decoded* size — **not** the size of the encoded frame on the wire.
|
|
143
|
+
|
|
144
|
+
### Terminology (mcuboot vs. Zephyr)
|
|
145
|
+
|
|
146
|
+
| Role | Bounds | Enc/Dec | mcuboot symbol (default) | Zephyr symbol (default) |
|
|
147
|
+
| --- | --- | --- | --- | --- |
|
|
148
|
+
| **Line buffer** | one base64 line on the wire | encoded | [`BOOT_MAX_LINE_INPUT_LEN`](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/zephyr/Kconfig.serial_recovery#L76) (128) | [`UART_MCUMGR_RX_BUF_SIZE`](https://github.com/zephyrproject-rtos/zephyr/blob/a65b87f2c6d5961b105193bd94058e523d6df54f/drivers/console/Kconfig#L226) (128) |
|
|
149
|
+
| **Fragment pool** | queued unprocessed lines (throughput only — *not* a frame-size cap) | — | [`BOOT_LINE_BUFS`](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/zephyr/Kconfig.serial_recovery#L84) (8) | [`UART_MCUMGR_RX_BUF_COUNT`](https://github.com/zephyrproject-rtos/zephyr/blob/a65b87f2c6d5961b105193bd94058e523d6df54f/drivers/console/Kconfig#L233) (2) |
|
|
150
|
+
| **Reassembly buffer** | the whole message + 4 B framing — *the real ceiling* | decoded | [`BOOT_SERIAL_MAX_RECEIVE_SIZE`](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/zephyr/Kconfig.serial_recovery#L91) (1024) → [`dec_buf`](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/boot_serial/src/boot_serial.c#L164) | [`MCUMGR_TRANSPORT_NETBUF_SIZE`](https://github.com/zephyrproject-rtos/zephyr/blob/a65b87f2c6d5961b105193bd94058e523d6df54f/subsys/mgmt/mcumgr/transport/Kconfig#L40) (384) |
|
|
151
|
+
| **Advertised `buf_size`** (MCUmgr params, OS group cmd 6) | what a client should target | decoded | *not advertised yet* ([mcuboot#2746](https://github.com/mcu-tools/mcuboot/pull/2746)) | = `NETBUF_SIZE` |
|
|
152
|
+
| **Transport "MTU"** | mostly response framing / advisory | — | [`BOOT_SERIAL_FRAME_MTU`](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/boot_serial/src/boot_serial.c#L131) (124, TX only) | [`MCUMGR_TRANSPORT_UART_MTU`](https://github.com/zephyrproject-rtos/zephyr/blob/a65b87f2c6d5961b105193bd94058e523d6df54f/subsys/mgmt/mcumgr/transport/Kconfig.uart#L27) (256, *registered but unused on UART*) |
|
|
153
|
+
|
|
154
|
+
Two traps the table is meant to defuse:
|
|
155
|
+
|
|
156
|
+
- The **fragment pool count** (`BOOT_LINE_BUFS` / `UART_MCUMGR_RX_BUF_COUNT`) is a
|
|
157
|
+
throughput queue — buffers are recycled as lines are decoded — and does **not**
|
|
158
|
+
bound the frame size. The decoded **reassembly buffer** does. (mcuboot's Kconfig
|
|
159
|
+
help suggests `MAX_RECEIVE_SIZE = line_len × line_bufs`, conflating the two; the
|
|
160
|
+
code sizes `dec_buf` to `MAX_RECEIVE_SIZE` *decoded* regardless.)
|
|
161
|
+
- Zephyr's `MCUMGR_TRANSPORT_UART_MTU` reads like the send/receive limit, but its
|
|
162
|
+
`get_mtu` is never called on the UART path; the real incoming limit is `NETBUF_SIZE`.
|
|
163
|
+
|
|
164
|
+
The **128-byte line** is a convention, not negotiated: both servers cap a line and
|
|
165
|
+
discard the overflow ([mcuboot](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/zephyr/serial_adapter.c#L160-L165),
|
|
166
|
+
[Zephyr](https://github.com/zephyrproject-rtos/zephyr/blob/a65b87f2c6d5961b105193bd94058e523d6df54f/drivers/console/uart_mcumgr.c#L110-L118)),
|
|
167
|
+
so clients must fragment at ≤ 128 (smpclient's default). Don't change it.
|
|
168
|
+
|
|
169
|
+
### How smpclient targets these
|
|
170
|
+
|
|
171
|
+
`SMPSerialTransport` fills the decoded reassembly buffer for best throughput. The
|
|
172
|
+
`fragmentation_strategy` chooses how it learns the buffer size — `Auto` (default, from
|
|
173
|
+
MCUmgr params), `BufferSize` (named directly, when params are unavailable such as mcuboot
|
|
174
|
+
serial recovery), or `BufferParams` (a constrained encoded line-buffer budget). See the
|
|
175
|
+
[Serial transport API docs](https://intercreate.github.io/smpclient/transport/serial/)
|
|
176
|
+
for when to use each.
|
|
177
|
+
|
|
178
|
+
This is exercised against real native_sim / QEMU / mps2 Zephyr servers in the
|
|
179
|
+
integration suite (`tests/integration/`): a `buf_size − 4` message round-trips while
|
|
180
|
+
putting ~1.37× `buf_size` encoded bytes on the wire, across the buffer-size matrix.
|
|
181
|
+
|
|
182
|
+
## Development Quickstart
|
|
183
|
+
|
|
184
|
+
> Assumes that you've already [setup your development environment](#development-environment-setup).
|
|
185
|
+
|
|
186
|
+
Tasks are defined in [`tasks.py`](tasks.py) and run with [camas](https://github.com/JPHutchins/camas) — the same definitions drive local development and CI, so running a task locally reproduces CI exactly. Run `uv run camas --list` to see every task.
|
|
187
|
+
|
|
188
|
+
1. run `uv sync` when pulling in new changes
|
|
189
|
+
2. run `uv run camas fix` after making changes (fast)
|
|
190
|
+
3. run `uv run camas all` after making changes (thorough)
|
|
191
|
+
4. add library dependencies with `uv`:
|
|
192
|
+
```
|
|
193
|
+
uv add <my_new_dependency>
|
|
194
|
+
```
|
|
195
|
+
5. add test or other development dependencies:
|
|
196
|
+
```
|
|
197
|
+
uv add --group dev <my_dev_dependency>
|
|
198
|
+
```
|
|
199
|
+
6. run tests for all supported python versions:
|
|
200
|
+
```
|
|
201
|
+
uv run camas matrix
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Development Environment Setup
|
|
205
|
+
|
|
206
|
+
### Install Dependencies
|
|
207
|
+
|
|
208
|
+
- uv: https://docs.astral.sh/uv/getting-started/installation/
|
|
209
|
+
|
|
210
|
+
### Create the venv
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
uv sync
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Verify Your Setup
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
uv run camas all
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Enable the githooks
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
git config core.hooksPath .githooks
|
|
226
|
+
```
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Simple Management Protocol (SMP) Client
|
|
2
|
+
|
|
3
|
+
`smpclient` implements the transport layer of the Simple Management Protocol. This library can be
|
|
4
|
+
used as a dependency in applications that use SMP over **serial (UART or USB)**, **Bluetooth (BLE)**,
|
|
5
|
+
or **UDP** connections. Some abstractions are provided for common routines like upgrading device
|
|
6
|
+
firmware.
|
|
7
|
+
|
|
8
|
+
If you don't need a library with the transport layer implemented, then you might prefer to use
|
|
9
|
+
[smp](https://github.com/JPHutchins/smp) instead. The SMP specification can be found
|
|
10
|
+
[here](https://docs.zephyrproject.org/latest/services/device_mgmt/smp_protocol.html).
|
|
11
|
+
|
|
12
|
+
If you'd like an SMP CLI application instead of a library, then you should try
|
|
13
|
+
[smpmgr](https://github.com/intercreate/smpmgr).
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
`smpclient` is [distributed by PyPI](https://pypi.org/project/smpclient/) and can be installed with `uv`, `pip`, and other dependency managers.
|
|
18
|
+
|
|
19
|
+
Build with all transports:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
smpclient[all]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or none (UDP transport only):
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
smpclient
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or build with only the transports you need:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
smpclient[serial] # Serial (UART, USB, CAN)
|
|
35
|
+
smpclient[ble] # Bluetooth Low Energy
|
|
36
|
+
smpclient[serial,ble] # Serial + BLE
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The UDP transport has no additional dependencies and is always available.
|
|
40
|
+
|
|
41
|
+
## User Documentation
|
|
42
|
+
|
|
43
|
+
Documentation is in the source code so that it is available to your editor.
|
|
44
|
+
An online version is generated and available [here](https://intercreate.github.io/smpclient/).
|
|
45
|
+
|
|
46
|
+
## Server Buffers & SMP Serial Fragmentation
|
|
47
|
+
|
|
48
|
+
Choosing the right fragmentation for the **serial** transport (UART/USB/CAN/etc.) requires
|
|
49
|
+
understanding the buffers in the firmware on the other end. The two SMP servers we
|
|
50
|
+
target name the same concepts differently, and the docs/Kconfig on each side are
|
|
51
|
+
easy to misread, so this section unifies the terminology. (BLE and UDP negotiate
|
|
52
|
+
their MTU directly and need none of this.)
|
|
53
|
+
|
|
54
|
+
### The SMP serial frame
|
|
55
|
+
|
|
56
|
+
A serial SMP transaction is one **decoded frame**: a 2-byte length and a 2-byte
|
|
57
|
+
CRC16 wrap the SMP message — and that wrapped message is exactly what the BLE and
|
|
58
|
+
UDP transports send bare.
|
|
59
|
+
|
|
60
|
+
```mermaid
|
|
61
|
+
flowchart LR
|
|
62
|
+
subgraph FRAME["decoded frame"]
|
|
63
|
+
direction LR
|
|
64
|
+
LEN["length<br/>(2 B)"]
|
|
65
|
+
MSG["decoded SMP message<br/>(SMP header + CBOR)"]
|
|
66
|
+
CRC["CRC16<br/>(2 B)"]
|
|
67
|
+
LEN --- MSG --- CRC
|
|
68
|
+
end
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For the **serial** transport that whole frame is base64-encoded and split into
|
|
72
|
+
≤ 128-byte (configurable as "line length", but it should always be left at 128) lines on the wire. The server base64-**decodes each line as it arrives**
|
|
73
|
+
and appends it to a single reassembly buffer — it never holds the whole encoded frame
|
|
74
|
+
at once (mcuboot
|
|
75
|
+
[`boot_serial_in_dec`](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/boot_serial/src/boot_serial.c#L1460-L1490);
|
|
76
|
+
Zephyr
|
|
77
|
+
[`mcumgr_serial_decode_frag`](https://github.com/zephyrproject-rtos/zephyr/blob/a65b87f2c6d5961b105193bd94058e523d6df54f/subsys/mgmt/mcumgr/transport/src/serial_util.c#L48-L64)):
|
|
78
|
+
|
|
79
|
+
```mermaid
|
|
80
|
+
sequenceDiagram
|
|
81
|
+
participant C as smpclient
|
|
82
|
+
participant S as SMP server
|
|
83
|
+
loop each of N+1 base64 lines (≤ 128 B)
|
|
84
|
+
C->>S: start / cont. marker · base64(slice) · newline
|
|
85
|
+
S->>S: decode, append to reassembly buffer
|
|
86
|
+
end
|
|
87
|
+
S-->>C: response (length + CRC ok → dispatch)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
So the buffer that actually limits a transaction holds the **decoded** frame, and:
|
|
91
|
+
|
|
92
|
+
> **max SMP message = (reassembly buffer size) − 4** (the 2-byte length + 2-byte CRC16).
|
|
93
|
+
|
|
94
|
+
That message becomes **~1.37×** as many bytes once base64-encoded and split into
|
|
95
|
+
≤ 128-byte lines (base64's 4/3 expansion plus per-line framing). A server that
|
|
96
|
+
advertises a 2048-byte buffer therefore accepts a 2044-byte message that arrives as a
|
|
97
|
+
**2801-byte, 23-line** encoded frame. The advertised/configured number is the
|
|
98
|
+
*decoded* size — **not** the size of the encoded frame on the wire.
|
|
99
|
+
|
|
100
|
+
### Terminology (mcuboot vs. Zephyr)
|
|
101
|
+
|
|
102
|
+
| Role | Bounds | Enc/Dec | mcuboot symbol (default) | Zephyr symbol (default) |
|
|
103
|
+
| --- | --- | --- | --- | --- |
|
|
104
|
+
| **Line buffer** | one base64 line on the wire | encoded | [`BOOT_MAX_LINE_INPUT_LEN`](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/zephyr/Kconfig.serial_recovery#L76) (128) | [`UART_MCUMGR_RX_BUF_SIZE`](https://github.com/zephyrproject-rtos/zephyr/blob/a65b87f2c6d5961b105193bd94058e523d6df54f/drivers/console/Kconfig#L226) (128) |
|
|
105
|
+
| **Fragment pool** | queued unprocessed lines (throughput only — *not* a frame-size cap) | — | [`BOOT_LINE_BUFS`](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/zephyr/Kconfig.serial_recovery#L84) (8) | [`UART_MCUMGR_RX_BUF_COUNT`](https://github.com/zephyrproject-rtos/zephyr/blob/a65b87f2c6d5961b105193bd94058e523d6df54f/drivers/console/Kconfig#L233) (2) |
|
|
106
|
+
| **Reassembly buffer** | the whole message + 4 B framing — *the real ceiling* | decoded | [`BOOT_SERIAL_MAX_RECEIVE_SIZE`](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/zephyr/Kconfig.serial_recovery#L91) (1024) → [`dec_buf`](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/boot_serial/src/boot_serial.c#L164) | [`MCUMGR_TRANSPORT_NETBUF_SIZE`](https://github.com/zephyrproject-rtos/zephyr/blob/a65b87f2c6d5961b105193bd94058e523d6df54f/subsys/mgmt/mcumgr/transport/Kconfig#L40) (384) |
|
|
107
|
+
| **Advertised `buf_size`** (MCUmgr params, OS group cmd 6) | what a client should target | decoded | *not advertised yet* ([mcuboot#2746](https://github.com/mcu-tools/mcuboot/pull/2746)) | = `NETBUF_SIZE` |
|
|
108
|
+
| **Transport "MTU"** | mostly response framing / advisory | — | [`BOOT_SERIAL_FRAME_MTU`](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/boot_serial/src/boot_serial.c#L131) (124, TX only) | [`MCUMGR_TRANSPORT_UART_MTU`](https://github.com/zephyrproject-rtos/zephyr/blob/a65b87f2c6d5961b105193bd94058e523d6df54f/subsys/mgmt/mcumgr/transport/Kconfig.uart#L27) (256, *registered but unused on UART*) |
|
|
109
|
+
|
|
110
|
+
Two traps the table is meant to defuse:
|
|
111
|
+
|
|
112
|
+
- The **fragment pool count** (`BOOT_LINE_BUFS` / `UART_MCUMGR_RX_BUF_COUNT`) is a
|
|
113
|
+
throughput queue — buffers are recycled as lines are decoded — and does **not**
|
|
114
|
+
bound the frame size. The decoded **reassembly buffer** does. (mcuboot's Kconfig
|
|
115
|
+
help suggests `MAX_RECEIVE_SIZE = line_len × line_bufs`, conflating the two; the
|
|
116
|
+
code sizes `dec_buf` to `MAX_RECEIVE_SIZE` *decoded* regardless.)
|
|
117
|
+
- Zephyr's `MCUMGR_TRANSPORT_UART_MTU` reads like the send/receive limit, but its
|
|
118
|
+
`get_mtu` is never called on the UART path; the real incoming limit is `NETBUF_SIZE`.
|
|
119
|
+
|
|
120
|
+
The **128-byte line** is a convention, not negotiated: both servers cap a line and
|
|
121
|
+
discard the overflow ([mcuboot](https://github.com/mcu-tools/mcuboot/blob/4ae65047c628365c30ec9a48eb0433169dc4f7ef/boot/zephyr/serial_adapter.c#L160-L165),
|
|
122
|
+
[Zephyr](https://github.com/zephyrproject-rtos/zephyr/blob/a65b87f2c6d5961b105193bd94058e523d6df54f/drivers/console/uart_mcumgr.c#L110-L118)),
|
|
123
|
+
so clients must fragment at ≤ 128 (smpclient's default). Don't change it.
|
|
124
|
+
|
|
125
|
+
### How smpclient targets these
|
|
126
|
+
|
|
127
|
+
`SMPSerialTransport` fills the decoded reassembly buffer for best throughput. The
|
|
128
|
+
`fragmentation_strategy` chooses how it learns the buffer size — `Auto` (default, from
|
|
129
|
+
MCUmgr params), `BufferSize` (named directly, when params are unavailable such as mcuboot
|
|
130
|
+
serial recovery), or `BufferParams` (a constrained encoded line-buffer budget). See the
|
|
131
|
+
[Serial transport API docs](https://intercreate.github.io/smpclient/transport/serial/)
|
|
132
|
+
for when to use each.
|
|
133
|
+
|
|
134
|
+
This is exercised against real native_sim / QEMU / mps2 Zephyr servers in the
|
|
135
|
+
integration suite (`tests/integration/`): a `buf_size − 4` message round-trips while
|
|
136
|
+
putting ~1.37× `buf_size` encoded bytes on the wire, across the buffer-size matrix.
|
|
137
|
+
|
|
138
|
+
## Development Quickstart
|
|
139
|
+
|
|
140
|
+
> Assumes that you've already [setup your development environment](#development-environment-setup).
|
|
141
|
+
|
|
142
|
+
Tasks are defined in [`tasks.py`](tasks.py) and run with [camas](https://github.com/JPHutchins/camas) — the same definitions drive local development and CI, so running a task locally reproduces CI exactly. Run `uv run camas --list` to see every task.
|
|
143
|
+
|
|
144
|
+
1. run `uv sync` when pulling in new changes
|
|
145
|
+
2. run `uv run camas fix` after making changes (fast)
|
|
146
|
+
3. run `uv run camas all` after making changes (thorough)
|
|
147
|
+
4. add library dependencies with `uv`:
|
|
148
|
+
```
|
|
149
|
+
uv add <my_new_dependency>
|
|
150
|
+
```
|
|
151
|
+
5. add test or other development dependencies:
|
|
152
|
+
```
|
|
153
|
+
uv add --group dev <my_dev_dependency>
|
|
154
|
+
```
|
|
155
|
+
6. run tests for all supported python versions:
|
|
156
|
+
```
|
|
157
|
+
uv run camas matrix
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Development Environment Setup
|
|
161
|
+
|
|
162
|
+
### Install Dependencies
|
|
163
|
+
|
|
164
|
+
- uv: https://docs.astral.sh/uv/getting-started/installation/
|
|
165
|
+
|
|
166
|
+
### Create the venv
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
uv sync
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Verify Your Setup
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
uv run camas all
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Enable the githooks
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
git config core.hooksPath .githooks
|
|
182
|
+
```
|
|
@@ -18,7 +18,7 @@ from smpclient.generics import SMPRequest, TEr1, TEr2, TRep, error, error_v1, er
|
|
|
18
18
|
from smpclient.mcuboot import IMAGE_TLV, ImageInfo
|
|
19
19
|
from smpclient.requests.image_management import ImageStatesRead, ImageStatesWrite
|
|
20
20
|
from smpclient.requests.os_management import ResetWrite
|
|
21
|
-
from smpclient.transport.serial import SMPSerialTransport
|
|
21
|
+
from smpclient.transport.serial import BufferParams, SMPSerialTransport
|
|
22
22
|
|
|
23
23
|
logging.basicConfig(
|
|
24
24
|
format="%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s",
|
|
@@ -108,9 +108,10 @@ async def main() -> None:
|
|
|
108
108
|
print("Connecting to SMP DUT...", end="", flush=True)
|
|
109
109
|
async with SMPClient(
|
|
110
110
|
SMPSerialTransport(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
fragmentation_strategy=BufferParams(
|
|
112
|
+
line_length=line_length,
|
|
113
|
+
line_buffers=line_buffers,
|
|
114
|
+
)
|
|
114
115
|
),
|
|
115
116
|
port_a.device,
|
|
116
117
|
) as client:
|
|
@@ -187,9 +188,10 @@ async def main() -> None:
|
|
|
187
188
|
print("Connecting to B SMP DUT...", end="", flush=True)
|
|
188
189
|
async with SMPClient(
|
|
189
190
|
SMPSerialTransport(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
fragmentation_strategy=BufferParams(
|
|
192
|
+
line_length=line_length,
|
|
193
|
+
line_buffers=line_buffers,
|
|
194
|
+
)
|
|
193
195
|
),
|
|
194
196
|
port_b.device,
|
|
195
197
|
) as client:
|
|
@@ -63,7 +63,7 @@ dev = [
|
|
|
63
63
|
"pytest-cov>=7.0.0",
|
|
64
64
|
"pytest-asyncio>=0.23.2",
|
|
65
65
|
"ruff>=0.12.0",
|
|
66
|
-
"
|
|
66
|
+
"camas[mcp,check]==0.1.14",
|
|
67
67
|
]
|
|
68
68
|
doc = [
|
|
69
69
|
"mkdocstrings[python]>=0.26.1",
|
|
@@ -74,22 +74,6 @@ doc = [
|
|
|
74
74
|
"smp>=4.1.0",
|
|
75
75
|
]
|
|
76
76
|
|
|
77
|
-
[tool.taskipy.tasks]
|
|
78
|
-
format = "ruff format ."
|
|
79
|
-
lint = "ruff check . && pydoclint src/smpclient"
|
|
80
|
-
fix = "ruff check --fix . && ruff format ."
|
|
81
|
-
typecheck = "mypy ."
|
|
82
|
-
test = "pytest --maxfail=1"
|
|
83
|
-
coverage = "pytest --cov --cov-report=xml --cov-report=term-missing"
|
|
84
|
-
all = "task format && task lint && task typecheck && task test"
|
|
85
|
-
matrix = """
|
|
86
|
-
UV_PROJECT_ENVIRONMENT=.venv-3.10 uv run --python 3.10 task all &&
|
|
87
|
-
UV_PROJECT_ENVIRONMENT=.venv-3.11 uv run --python 3.11 task all &&
|
|
88
|
-
UV_PROJECT_ENVIRONMENT=.venv-3.12 uv run --python 3.12 task all &&
|
|
89
|
-
UV_PROJECT_ENVIRONMENT=.venv-3.13 uv run --python 3.13 task all &&
|
|
90
|
-
UV_PROJECT_ENVIRONMENT=.venv-3.14 uv run --python 3.14 task all
|
|
91
|
-
"""
|
|
92
|
-
|
|
93
77
|
[tool.ruff]
|
|
94
78
|
line-length = 100
|
|
95
79
|
extend-exclude = ["dutfirmware", ".claude"]
|
|
@@ -118,10 +102,14 @@ check-yield-types = false
|
|
|
118
102
|
[tool.pytest.ini_options]
|
|
119
103
|
norecursedirs = ["dutfirmware/*", ".claude/*"]
|
|
120
104
|
filterwarnings = ["ignore:The --rsyncdir:DeprecationWarning"]
|
|
105
|
+
markers = [
|
|
106
|
+
"integration: end-to-end tests against real SMP servers (Linux only); see tests/integration/",
|
|
107
|
+
]
|
|
121
108
|
|
|
122
109
|
[tool.coverage.run]
|
|
123
110
|
source = ["smpclient", "tests"]
|
|
124
111
|
branch = true
|
|
112
|
+
omit = ["tests/integration/*"]
|
|
125
113
|
|
|
126
114
|
[tool.coverage.report]
|
|
127
115
|
fail_under = 91
|