micropython-stubber 1.20.0__tar.gz → 1.20.2__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.
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/PKG-INFO +6 -6
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/pyproject.toml +10 -7
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/readme.md +2 -2
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/README.md +54 -35
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/libusb_flash.ipynb +203 -203
- micropython_stubber-1.20.2/src/mpflash/mpflash/add_firmware.py +98 -0
- micropython_stubber-1.20.2/src/mpflash/mpflash/ask_input.py +226 -0
- micropython_stubber-1.20.2/src/mpflash/mpflash/cli_download.py +128 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/cli_flash.py +77 -35
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/cli_group.py +14 -12
- micropython_stubber-1.20.2/src/mpflash/mpflash/cli_list.py +77 -0
- micropython_stubber-1.20.2/src/mpflash/mpflash/cli_main.py +38 -0
- micropython_stubber-1.20.2/src/mpflash/mpflash/common.py +151 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/config.py +2 -0
- micropython_stubber-1.20.2/src/mpflash/mpflash/connected.py +74 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/download.py +67 -50
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/downloaded.py +9 -9
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/flash.py +2 -2
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/flash_esp.py +2 -2
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/flash_uf2.py +16 -8
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/flash_uf2_linux.py +5 -16
- micropython_stubber-1.20.2/src/mpflash/mpflash/flash_uf2_macos.py +78 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/flash_uf2_windows.py +1 -1
- micropython_stubber-1.20.2/src/mpflash/mpflash/list.py +89 -0
- micropython_stubber-1.20.2/src/mpflash/mpflash/mpboard_id/__init__.py +89 -0
- micropython_stubber-1.20.2/src/mpflash/mpflash/mpboard_id/add_boards.py +255 -0
- micropython_stubber-1.20.2/src/mpflash/mpflash/mpboard_id/board.py +37 -0
- micropython_stubber-1.20.2/src/mpflash/mpflash/mpboard_id/board_id.py +70 -0
- micropython_stubber-1.20.2/src/mpflash/mpflash/mpboard_id/board_info.zip +0 -0
- micropython_stubber-1.20.2/src/mpflash/mpflash/mpboard_id/store.py +42 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/mpremoteboard/__init__.py +18 -6
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/mpremoteboard/runner.py +12 -12
- micropython_stubber-1.20.2/src/mpflash/mpflash/uf2disk.py +12 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/vendor/dfu.py +1 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/vendor/versions.py +7 -3
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/worklist.py +71 -48
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/poetry.lock +163 -137
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/pyproject.toml +18 -15
- micropython_stubber-1.20.2/src/stubber/__init__.py +3 -0
- micropython_stubber-1.20.2/src/stubber/basicgit.py +288 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/createstubs.py +4 -3
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/createstubs_db.py +5 -7
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/createstubs_db_min.py +1 -1
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/createstubs_db_mpy.mpy +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/createstubs_mem.py +6 -7
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/createstubs_mem_min.py +1 -1
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/createstubs_mem_mpy.mpy +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/createstubs_min.py +2 -2
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/createstubs_mpy.mpy +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/modulelist.txt +1 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/get_core_cmd.py +7 -6
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/get_docstubs_cmd.py +8 -3
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/get_frozen_cmd.py +5 -2
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/publish.py +18 -7
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/utils/makeversionhdr.py +3 -2
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/utils/versions.py +2 -1
- micropython_stubber-1.20.0/src/mpflash/mpflash/ask_input.py +0 -234
- micropython_stubber-1.20.0/src/mpflash/mpflash/cli_download.py +0 -107
- micropython_stubber-1.20.0/src/mpflash/mpflash/cli_list.py +0 -41
- micropython_stubber-1.20.0/src/mpflash/mpflash/cli_main.py +0 -26
- micropython_stubber-1.20.0/src/mpflash/mpflash/common.py +0 -38
- micropython_stubber-1.20.0/src/mpflash/mpflash/list.py +0 -88
- micropython_stubber-1.20.0/src/mpflash/mpflash/mpboard_id/__init__.py +0 -96
- micropython_stubber-1.20.0/src/mpflash/mpflash/mpboard_id/board_id.py +0 -63
- micropython_stubber-1.20.0/src/mpflash/mpflash/mpboard_id/board_info.csv +0 -2213
- micropython_stubber-1.20.0/src/mpflash/mpflash/mpboard_id/board_info.json +0 -19910
- micropython_stubber-1.20.0/src/stubber/__init__.py +0 -3
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/LICENSE +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/__init__.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/errors.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/flash_stm32.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/flash_stm32_cube.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/flash_stm32_dfu.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/flash_uf2_boardid.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/logger.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/mpremoteboard/mpy_fw_info.py +0 -0
- {micropython_stubber-1.20.0/src/stubber → micropython_stubber-1.20.2/src/mpflash/mpflash/vendor}/basicgit.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/vendor/pydfu.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/mpflash/vendor/readme.md +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/mpflash/stm32_udev_rules.md +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/board_info.csv +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/boot.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/createstubs_lvgl.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/createstubs_lvgl_min.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/createstubs_lvgl_mpy.mpy +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/fw_info.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/info.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/main.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/board/pyrightconfig.json +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/bulk/mcu_stubber.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/codemod/__init__.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/codemod/_partials/__init__.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/codemod/_partials/db_main.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/codemod/_partials/lvgl_main.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/codemod/_partials/modules_reader.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/codemod/add_comment.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/codemod/add_method.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/codemod/board.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/codemod/enrich.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/codemod/merge_docstub.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/codemod/modify_list.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/codemod/utils.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/__init__.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/build_cmd.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/cli.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/clone_cmd.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/config_cmd.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/enrich_folder_cmd.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/get_mcu_cmd.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/merge_cmd.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/publish_cmd.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/stub_cmd.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/switch_cmd.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/commands/variants_cmd.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/cst_transformer.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/data/board_info.csv +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/data/board_info.json +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/data/micropython_tags.csv +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/data/requirements-core-micropython.txt +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/data/requirements-core-pycopy.txt +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/downloader.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/freeze/__init__.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/freeze/common.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/freeze/freeze_folder.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/freeze/freeze_manifest_2.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/freeze/get_frozen.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/get_cpython.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/get_lobo.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/minify.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/__init__.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/bump.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/candidates.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/database.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/defaults.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/enums.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/helpers.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/merge_docstubs.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/missing_class_methods.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/package.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/pathnames.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/pypi.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/publish/stubpackage.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/rst/__init__.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/rst/classsort.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/rst/lookup.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/rst/output_dict.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/rst/reader.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/rst/report_return.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/rst/rst_utils.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/stubber.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/stubs_from_docs.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/tools/__init__.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/tools/manifestfile.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/tools/readme.md +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/update_fallback.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/update_module_list.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/utils/__init__.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/utils/config.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/utils/manifest.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/utils/post.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/utils/repos.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/utils/stubmaker.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/utils/typed_config_toml.py +0 -0
- {micropython_stubber-1.20.0 → micropython_stubber-1.20.2}/src/stubber/variants.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: micropython-stubber
|
3
|
-
Version: 1.20.
|
3
|
+
Version: 1.20.2
|
4
4
|
Summary: Tooling to create and maintain stubs for MicroPython
|
5
5
|
Home-page: https://github.com/Josverl/micropython-stubber#readme
|
6
6
|
License: MIT
|
@@ -18,16 +18,16 @@ Classifier: Programming Language :: Python :: Implementation :: MicroPython
|
|
18
18
|
Classifier: Topic :: Software Development :: Build Tools
|
19
19
|
Classifier: Topic :: Text Editors :: Integrated Development Environments (IDE)
|
20
20
|
Requires-Dist: autoflake (>=1.7,<3.0)
|
21
|
-
Requires-Dist: black (>=22.10,<
|
21
|
+
Requires-Dist: black (>=22.10,<25.0)
|
22
22
|
Requires-Dist: cachetools (>=5.3.0,<6.0.0)
|
23
23
|
Requires-Dist: click (>=8.1.3,<9.0.0)
|
24
24
|
Requires-Dist: executing (>=2.0.1,<3.0.0)
|
25
25
|
Requires-Dist: importlib-metadata (>=1.0,<2.0) ; python_version < "3.8"
|
26
26
|
Requires-Dist: libcst (>=1.1.0,<2.0.0)
|
27
27
|
Requires-Dist: loguru (>=0.6,<0.8)
|
28
|
-
Requires-Dist: mpflash (>=0.
|
28
|
+
Requires-Dist: mpflash (>=0.7.4,<0.8.0)
|
29
29
|
Requires-Dist: mpremote (>=1.22.0,<2.0.0)
|
30
|
-
Requires-Dist: mypy (==1.
|
30
|
+
Requires-Dist: mypy (==1.9.0)
|
31
31
|
Requires-Dist: mypy-gitlab-code-quality (>=1.1.0,<2.0.0)
|
32
32
|
Requires-Dist: packaging (>=21.3,<24.0)
|
33
33
|
Requires-Dist: pipx (>=1.1.0,<2.0.0)
|
@@ -129,8 +129,8 @@ cd my_stub_folder
|
|
129
129
|
mkdir all-stubs
|
130
130
|
|
131
131
|
# clone the micropython repo's and switch to a specific version
|
132
|
-
stubber clone
|
133
|
-
stubber switch
|
132
|
+
stubber clone --add-stubs
|
133
|
+
stubber switch v1.22.2
|
134
134
|
|
135
135
|
# get the document stubs for the current version ( v1.18 )
|
136
136
|
stubber get-docstubs
|
@@ -8,7 +8,7 @@ repo-path = "./repos"
|
|
8
8
|
|
9
9
|
[tool.poetry]
|
10
10
|
name = "micropython-stubber"
|
11
|
-
version = "1.20.
|
11
|
+
version = "1.20.2"
|
12
12
|
description = "Tooling to create and maintain stubs for MicroPython"
|
13
13
|
authors = ["Jos Verlinde <jos_verlinde@hotmail.com>"]
|
14
14
|
license = "MIT"
|
@@ -46,18 +46,20 @@ stubber = "stubber.stubber:stubber_cli"
|
|
46
46
|
|
47
47
|
[tool.poetry.dependencies]
|
48
48
|
python = ">=3.9,<4.0"
|
49
|
-
|
49
|
+
python-minifier = { version = "^2.7.0", python = "<3.12" } # no support for 3.12 yet
|
50
|
+
requests = "^2.28.0"
|
51
|
+
mypy = "1.9.0"
|
52
|
+
mpflash = "^0.7.4"
|
50
53
|
mpremote = "^1.22.0"
|
51
54
|
# others
|
52
55
|
autoflake = ">=1.7,<3.0"
|
53
|
-
black = ">=22.10,<
|
56
|
+
black = ">=22.10,<25.0"
|
57
|
+
libcst = "^1.1.0"
|
54
58
|
cachetools = "^5.3.0"
|
55
59
|
click = "^8.1.3"
|
56
60
|
executing = "^2.0.1"
|
57
61
|
importlib-metadata = { version = "^1.0", python = "<3.8" }
|
58
|
-
libcst = "^1.1.0"
|
59
62
|
loguru = ">=0.6,<0.8"
|
60
|
-
mypy = "1.7.0"
|
61
63
|
mypy-gitlab-code-quality = "^1.1.0"
|
62
64
|
packaging = ">=21.3,<24.0"
|
63
65
|
pipx = "^1.1.0"
|
@@ -66,8 +68,6 @@ pyright = "^1.1.341"
|
|
66
68
|
pyserial = "^3.5"
|
67
69
|
pysondb-v2 = "^2.1.0"
|
68
70
|
pypi-simple = "^1.0.0"
|
69
|
-
python-minifier = { version = "^2.7.0", python = "<3.12" } # no support for 3.12 yet
|
70
|
-
requests = "^2.28.0"
|
71
71
|
rich-click = "^1.7.3"
|
72
72
|
tabulate = "^0.9.0"
|
73
73
|
tenacity = "^8.2.2"
|
@@ -97,6 +97,7 @@ pytest-mock = "^3.10.0"
|
|
97
97
|
mock = "^4.0.3"
|
98
98
|
distro = "^1.8.0"
|
99
99
|
fasteners = "^0.19"
|
100
|
+
jsons = "^1.6.3"
|
100
101
|
|
101
102
|
[tool.poetry.group.dev]
|
102
103
|
optional = true
|
@@ -141,6 +142,7 @@ exclude = [
|
|
141
142
|
|
142
143
|
"**/all-stubs",
|
143
144
|
"src/stubber/board/stubs",
|
145
|
+
"**/.venv"
|
144
146
|
]
|
145
147
|
ignore = [
|
146
148
|
"tests/mocks",
|
@@ -164,6 +166,7 @@ reportInvalidStringEscapeSequence = "information"
|
|
164
166
|
reportUnboundVariable = "information"
|
165
167
|
ReportSelfClsParameterName = "information"
|
166
168
|
reportOptionalSubscript = "information"
|
169
|
+
reportCallInDefaultInitializer = "error"
|
167
170
|
# Section 3 - reduce noise
|
168
171
|
reportMissingTypeStubs = "none"
|
169
172
|
reportOptionalMemberAccess = "none" # "read" is not a known member of "None" - occurs often in frozen code
|
@@ -79,8 +79,8 @@ cd my_stub_folder
|
|
79
79
|
mkdir all-stubs
|
80
80
|
|
81
81
|
# clone the micropython repo's and switch to a specific version
|
82
|
-
stubber clone
|
83
|
-
stubber switch
|
82
|
+
stubber clone --add-stubs
|
83
|
+
stubber switch v1.22.2
|
84
84
|
|
85
85
|
# get the document stubs for the current version ( v1.18 )
|
86
86
|
stubber get-docstubs
|
@@ -1,15 +1,28 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# MPFLASH
|
2
|
+
[](https://pypi.org/project/mpflash/)
|
3
|
+
[](https://badgen.net/pypi/python/mpflash)
|
4
|
+
[](https://pepy.tech/project/mpflash)
|
3
5
|
|
4
|
-
This tool was created to be used in a CI/CD pipeline to automate the process of downloading and flashing MicroPython firmware to multiple boards, but it can also be used for manual flashing and development.
|
5
6
|
|
6
|
-
mpflash
|
7
|
+
`mpflash` is a command-line tool for working with MicroPython firmware. It provides features to help you flash and update Micropython on one or more .
|
7
8
|
|
9
|
+
This tool was initially created to be used in a CI/CD pipeline to automate the process of downloading and flashing MicroPython firmware to multiple boards, but it has been extend with a TUI to be used for manual downloadig, flashing and development.
|
10
|
+
|
11
|
+
`mpflash` has been tested on:
|
12
|
+
- OS: Windows x64, Linux X64, but not (yet) macOS.
|
13
|
+
- Micropython (hardware) ports:
|
14
|
+
- `rp2`, using `.uf2`, using filecopy (macos not tested yet)
|
15
|
+
- `samd`, using ` .uf2`, using filecopy (macos not tested yet)
|
16
|
+
- `esp32`, using `.bin`, using esptool,
|
17
|
+
- `esp8266`, using `.bin`, using esptool
|
18
|
+
- `stm32`, using ` .dfu`, using pydfu
|
19
|
+
|
20
|
+
Not yet implemented: `nrf`, `cc3200`, `mimxrt`
|
21
|
+
|
8
22
|
## Features
|
9
23
|
1. List the connected boards including their firmware details, in a tabular or json format
|
10
|
-
2. Download MicroPython firmware for
|
11
|
-
3. Flash one or all connected MicroPython boards with a specific firmware or version.
|
12
|
-
Tested ports: rp2, samd, esp32, esp32s3, esp8266 and stm32
|
24
|
+
2. Download MicroPython firmware for versions, and matching a specified board or matches your current attached board.
|
25
|
+
3. Flash one or all connected MicroPython boards with a specific firmware or version.
|
13
26
|
|
14
27
|
## Installation
|
15
28
|
To install mpflash, you can use pip: `pip install mpflash`
|
@@ -30,40 +43,39 @@ On Windows this will not be an issue, but on Linux you can use udev rules to gi
|
|
30
43
|
[See the stm32_permissions documentation](./stm32_udev_rules.md) for more information.
|
31
44
|
|
32
45
|
|
33
|
-
##
|
46
|
+
## Detailed usage
|
34
47
|
You can list the connected boards using the following command:
|
35
48
|
```bash
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
│
|
44
|
-
│
|
45
|
-
│
|
46
|
-
│
|
47
|
-
|
48
|
-
│ COM8 │ micropython │ esp32 │ ESP32_GENERIC_S3 │ ESP32S3 │ 1.23.0-preview │ 155 │
|
49
|
-
└────────┴─────────────┴─────────┴────────────────────┴─────────────┴────────────────┴───────┘
|
49
|
+
$> mpflash list
|
50
|
+
Connected boards
|
51
|
+
┏━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━┓
|
52
|
+
┃ Serial ┃Family ┃Port ┃Board ┃CPU ┃Version ┃build ┃
|
53
|
+
┡━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━┩
|
54
|
+
│ COM21 │micropython │rp2 │RPI_PICO │RP2040 │v1.23.0-preview │ 236 │
|
55
|
+
│ │ │ │Raspberry Pi Pico with RP2040 │ │ │ │
|
56
|
+
│ COM23 │micropython │rp2 │RPI_PICO_W │RP2040 │v1.23.0-preview │ 176 │
|
57
|
+
│ │ │ │Raspberry Pi Pico W with RP2040 │ │ │ │
|
58
|
+
│ COM9 │micropython │rp2 │ARDUINO_NANO_RP2040_CONNECT │RP2040 │v1.23.0-preview │ 341 │
|
59
|
+
│ │ │ │Arduino Nano RP2040 Connect with RP2040 │ │ │ │
|
60
|
+
└─────────┴─────────────┴──────┴───────────────────────────────────────────┴────────┴─────────────────┴──────┘
|
50
61
|
```
|
62
|
+
## Download the firmware
|
51
63
|
|
52
|
-
|
64
|
+
To download the MicroPython firmware for some boards, use the following command:
|
65
|
+
- `mpflash download` download the latest stable firmware for all connected boards
|
66
|
+
- `mpflash download --version preview` download the current preview for all connected boards
|
67
|
+
- `mpflash download --board ESP8266_GENERIC --board SEEED_WIO_TERMINAL` download these specific boards
|
68
|
+
- `mpflash download --version ? --board ?` prompt to select a specific version and board to download
|
53
69
|
|
54
|
-
|
55
|
-
# download the firmware
|
56
|
-
$ mpflash download --board ESP8266_GENERIC --board SEEED_WIO_TERMINAL
|
57
|
-
```
|
58
|
-
This will download the latest stable version of the MicroPython firmware for the boards and save it in the `firmware` directory.
|
70
|
+
These will try to download the prebuilt MicroPython firmware for the boards from https://micropython.org/download/ and save it in your downloads folder in the `firmware` directory.
|
59
71
|
The stable version (default) is determined based on the most recent published release,
|
60
|
-
other
|
72
|
+
other versions are `--version preview` and `--version x.y.z` to download the latest preview or version x.y.z respectively.
|
61
73
|
|
62
|
-
|
74
|
+
By default the firmware will be downloaded to your OS's preferred `Downloads/firmware` folder, but you can speciy a different directory using the `--dir` option.
|
63
75
|
|
64
|
-
```bash
|
65
76
|
The directory structure will be something like this:
|
66
|
-
|
77
|
+
|
78
|
+
``` text
|
67
79
|
Downloads/firmware
|
68
80
|
| firmware.jsonl
|
69
81
|
+---esp8266
|
@@ -74,9 +86,16 @@ Downloads/firmware
|
|
74
86
|
\---samd
|
75
87
|
SEEED_WIO_TERMINAL-v1.22.2.uf2
|
76
88
|
```
|
77
|
-
|
89
|
+
|
90
|
+
## Flashing the firmware
|
91
|
+
After you have downloaded a firmware you can flash the firmware to a board using the following command: `mpflash flash`
|
78
92
|
This will (try to) autodetect the connected boards, and determine the correct firmware to flash to each board.
|
79
93
|
|
94
|
+
- `mpflash flash` will flash the latest stable firmware to all connected boards.
|
95
|
+
- `mpflash flash --serial ? --board ?` will prompt to select a specific serial port and board to flash. (the firmware must be dowloaded earlier)
|
96
|
+
|
97
|
+
|
98
|
+
### Flashing all connected boards with the latest stable firmware
|
80
99
|
```bash
|
81
100
|
> mpflash flash
|
82
101
|
22:15:55 | ℹ️ - Using latest stable version: v1.22.2
|
@@ -158,8 +177,8 @@ Note that if no matching firmware can be found for a board, it will be skipped.
|
|
158
177
|
(For example, the PYBV11 and ESP32_GENERIC_S3 boards in the example above.)
|
159
178
|
|
160
179
|
## Issues and bug reports
|
161
|
-
mpflash is currently co-located in the [micropython-stubber](https://github.com/Josverl/micropython-stubber) repository.
|
162
|
-
Please report any issues or bugs in the [issue tracker](https://github.com/Josverl/micropython-stubber/issues)
|
180
|
+
mpflash is currently co-located in the [micropython-stubber](https://github.com/Josverl/micropython-stubber) repository.
|
181
|
+
Please report any issues or bugs in the [issue tracker](https://github.com/Josverl/micropython-stubber/issues) using the MPflash feedback template.
|
163
182
|
|
164
183
|
## License
|
165
184
|
mpflash is licensed under the MIT license. See the LICENSE file for more details.
|
@@ -1,203 +1,203 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": 3,
|
6
|
-
"metadata": {},
|
7
|
-
"outputs": [
|
8
|
-
{
|
9
|
-
"data": {
|
10
|
-
"text/plain": [
|
11
|
-
"[<DEVICE ID 0a05:7211 on Bus 002 Address 054>,\n",
|
12
|
-
" <DEVICE ID 0a05:7211 on Bus 002 Address 032>,\n",
|
13
|
-
" <DEVICE ID 045e:0c1e on Bus 002 Address 002>,\n",
|
14
|
-
" <DEVICE ID 045e:07b2 on Bus 002 Address 028>,\n",
|
15
|
-
" <DEVICE ID 045e:0904 on Bus 002 Address 015>,\n",
|
16
|
-
" <DEVICE ID 043e:9a39 on Bus 002 Address 057>,\n",
|
17
|
-
" <DEVICE ID 045e:0901 on Bus 002 Address 006>,\n",
|
18
|
-
" <DEVICE ID 05e3:0610 on Bus 002 Address 010>,\n",
|
19
|
-
" <DEVICE ID 2109:0817 on Bus 001 Address 001>,\n",
|
20
|
-
" <DEVICE ID 045e:0902 on Bus 002 Address 008>,\n",
|
21
|
-
" <DEVICE ID 1000:2000 on Bus 002 Address 016>,\n",
|
22
|
-
" <DEVICE ID 1189:8890 on Bus 002 Address 027>,\n",
|
23
|
-
" <DEVICE ID 2109:0817 on Bus 001 Address 002>,\n",
|
24
|
-
" <DEVICE ID 2109:2812 on Bus 002 Address 025>,\n",
|
25
|
-
" <DEVICE ID 046d:085e on Bus 002 Address 017>,\n",
|
26
|
-
" <DEVICE ID 045e:07c6 on Bus 002 Address 056>,\n",
|
27
|
-
" <DEVICE ID 0bda:5401 on Bus 002 Address 009>,\n",
|
28
|
-
" <DEVICE ID 10c4:ea60 on Bus 002 Address 055>,\n",
|
29
|
-
" <DEVICE ID 2109:2817 on Bus 002 Address 004>,\n",
|
30
|
-
" <DEVICE ID 0bda:5411 on Bus 002 Address 005>,\n",
|
31
|
-
" <DEVICE ID 045e:0900 on Bus 002 Address 003>,\n",
|
32
|
-
" <DEVICE ID 04e8:61f5 on Bus 002 Address 023>,\n",
|
33
|
-
" <DEVICE ID 045e:0903 on Bus 002 Address 020>,\n",
|
34
|
-
" <DEVICE ID 2109:2812 on Bus 002 Address 026>,\n",
|
35
|
-
" <DEVICE ID 8086:a0ed on Bus 002 Address 000>,\n",
|
36
|
-
" <DEVICE ID 2109:2817 on Bus 002 Address 013>,\n",
|
37
|
-
" <DEVICE ID 8087:0029 on Bus 002 Address 001>,\n",
|
38
|
-
" <DEVICE ID 8086:9a13 on Bus 001 Address 000>]"
|
39
|
-
]
|
40
|
-
},
|
41
|
-
"execution_count": 3,
|
42
|
-
"metadata": {},
|
43
|
-
"output_type": "execute_result"
|
44
|
-
}
|
45
|
-
],
|
46
|
-
"source": [
|
47
|
-
"import usb.core\n",
|
48
|
-
"import usb.util\n",
|
49
|
-
"import usb.backend.libusb1 as libusb1\n",
|
50
|
-
"from usb.core import USBError, Device\n",
|
51
|
-
"\n",
|
52
|
-
"from pathlib import Path\n",
|
53
|
-
"import platform\n",
|
54
|
-
"\n",
|
55
|
-
"if platform.system() == \"Windows\":\n",
|
56
|
-
" # on windows you need to use the libusb1 backend\n",
|
57
|
-
" import libusb\n",
|
58
|
-
"\n",
|
59
|
-
" arch = \"x64\" if platform.architecture()[0] == \"64bit\" else \"x86\"\n",
|
60
|
-
" libusb1_dll = Path(libusb.__file__).parent / f\"_platform\\\\_windows\\\\{arch}\\\\libusb-1.0.dll\"\n",
|
61
|
-
"\n",
|
62
|
-
" backend = libusb1.get_backend(find_library=lambda x: libusb1_dll.as_posix())\n",
|
63
|
-
"usb_devices = usb.core.find(backend=backend, find_all=True)\n",
|
64
|
-
"\n",
|
65
|
-
"list(usb_devices)"
|
66
|
-
]
|
67
|
-
},
|
68
|
-
{
|
69
|
-
"cell_type": "code",
|
70
|
-
"execution_count": null,
|
71
|
-
"metadata": {},
|
72
|
-
"outputs": [],
|
73
|
-
"source": [
|
74
|
-
"for d in usb.core.find(backend=backend, find_all=True):\n",
|
75
|
-
" print(f\"Device {d.idVendor:04x}:{d.idProduct:04x}\")\n",
|
76
|
-
" print(f\"{d.iManufacturer=}\")\n",
|
77
|
-
" print(f\"{d.iProduct=}\")\n",
|
78
|
-
" print(f\"{d.bDeviceClass=}\")\n",
|
79
|
-
" print(f\"{d.bDescriptorType=}\")\n",
|
80
|
-
" print(f\"{d.bcdDevice=}\")\n",
|
81
|
-
" print(f\"{d.bcdUSB=}\")\n",
|
82
|
-
" # print(dir(d))\n",
|
83
|
-
" # print(f\" Manufacturer: {usb.util.get_string(dev, dev.iManufacturer)}\")\n",
|
84
|
-
"\n",
|
85
|
-
" print()"
|
86
|
-
]
|
87
|
-
},
|
88
|
-
{
|
89
|
-
"cell_type": "code",
|
90
|
-
"execution_count": null,
|
91
|
-
"metadata": {},
|
92
|
-
"outputs": [],
|
93
|
-
"source": [
|
94
|
-
"import serial.tools.list_ports\n",
|
95
|
-
"\n",
|
96
|
-
"ports = serial.tools.list_ports.comports()\n",
|
97
|
-
"\n",
|
98
|
-
"for port in ports:\n",
|
99
|
-
" print(f\"Port: {port.device}\")\n",
|
100
|
-
" print(f\"Description: {port.description}\")\n",
|
101
|
-
" print(f\"Hardware ID: {port.hwid}\")\n",
|
102
|
-
" print()"
|
103
|
-
]
|
104
|
-
},
|
105
|
-
{
|
106
|
-
"cell_type": "code",
|
107
|
-
"execution_count": null,
|
108
|
-
"metadata": {},
|
109
|
-
"outputs": [],
|
110
|
-
"source": [
|
111
|
-
"from mpflash.vendor import pydfu as pydfu\n",
|
112
|
-
"\n",
|
113
|
-
"try:\n",
|
114
|
-
" pydfu.list_dfu_devices()\n",
|
115
|
-
"except SystemExit:\n",
|
116
|
-
" print(\"No DFU devices found\")"
|
117
|
-
]
|
118
|
-
},
|
119
|
-
{
|
120
|
-
"cell_type": "code",
|
121
|
-
"execution_count": null,
|
122
|
-
"metadata": {},
|
123
|
-
"outputs": [],
|
124
|
-
"source": [
|
125
|
-
"pydfu.init()"
|
126
|
-
]
|
127
|
-
},
|
128
|
-
{
|
129
|
-
"cell_type": "code",
|
130
|
-
"execution_count": null,
|
131
|
-
"metadata": {},
|
132
|
-
"outputs": [],
|
133
|
-
"source": [
|
134
|
-
"dfu_file = Path(\"C:\\\\Users\\\\josverl\\\\Downloads\\\\firmware\\\\stm32\\\\PYBV11-THREAD-v1.23.0-preview.203.dfu\")\n",
|
135
|
-
"\n",
|
136
|
-
"print(\"Read DFU file...\")\n",
|
137
|
-
"elements = pydfu.read_dfu_file(dfu_file)\n",
|
138
|
-
"if not elements:\n",
|
139
|
-
" print(\"No data in dfu file\")"
|
140
|
-
]
|
141
|
-
},
|
142
|
-
{
|
143
|
-
"cell_type": "code",
|
144
|
-
"execution_count": 1,
|
145
|
-
"metadata": {},
|
146
|
-
"outputs": [
|
147
|
-
{
|
148
|
-
"name": "stdout",
|
149
|
-
"output_type": "stream",
|
150
|
-
"text": [
|
151
|
-
"Writing memory...\n"
|
152
|
-
]
|
153
|
-
},
|
154
|
-
{
|
155
|
-
"ename": "NameError",
|
156
|
-
"evalue": "name 'pydfu' is not defined",
|
157
|
-
"output_type": "error",
|
158
|
-
"traceback": [
|
159
|
-
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
160
|
-
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
161
|
-
"Cell \u001b[1;32mIn[1], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWriting memory...\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m----> 2\u001b[0m \u001b[43mpydfu\u001b[49m\u001b[38;5;241m.\u001b[39mwrite_elements(elements, \u001b[38;5;28;01mFalse\u001b[39;00m, progress\u001b[38;5;241m=\u001b[39mpydfu\u001b[38;5;241m.\u001b[39mcli_progress)\n",
|
162
|
-
"\u001b[1;31mNameError\u001b[0m: name 'pydfu' is not defined"
|
163
|
-
]
|
164
|
-
}
|
165
|
-
],
|
166
|
-
"source": [
|
167
|
-
"print(\"Writing memory...\")\n",
|
168
|
-
"pydfu.write_elements(elements, False, progress=pydfu.cli_progress)"
|
169
|
-
]
|
170
|
-
},
|
171
|
-
{
|
172
|
-
"cell_type": "code",
|
173
|
-
"execution_count": null,
|
174
|
-
"metadata": {},
|
175
|
-
"outputs": [],
|
176
|
-
"source": [
|
177
|
-
"print(\"Exiting DFU...\")\n",
|
178
|
-
"pydfu.exit_dfu()"
|
179
|
-
]
|
180
|
-
}
|
181
|
-
],
|
182
|
-
"metadata": {
|
183
|
-
"kernelspec": {
|
184
|
-
"display_name": ".venv",
|
185
|
-
"language": "python",
|
186
|
-
"name": "python3"
|
187
|
-
},
|
188
|
-
"language_info": {
|
189
|
-
"codemirror_mode": {
|
190
|
-
"name": "ipython",
|
191
|
-
"version": 3
|
192
|
-
},
|
193
|
-
"file_extension": ".py",
|
194
|
-
"mimetype": "text/x-python",
|
195
|
-
"name": "python",
|
196
|
-
"nbconvert_exporter": "python",
|
197
|
-
"pygments_lexer": "ipython3",
|
198
|
-
"version": "3.11.7"
|
199
|
-
}
|
200
|
-
},
|
201
|
-
"nbformat": 4,
|
202
|
-
"nbformat_minor": 2
|
203
|
-
}
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": 3,
|
6
|
+
"metadata": {},
|
7
|
+
"outputs": [
|
8
|
+
{
|
9
|
+
"data": {
|
10
|
+
"text/plain": [
|
11
|
+
"[<DEVICE ID 0a05:7211 on Bus 002 Address 054>,\n",
|
12
|
+
" <DEVICE ID 0a05:7211 on Bus 002 Address 032>,\n",
|
13
|
+
" <DEVICE ID 045e:0c1e on Bus 002 Address 002>,\n",
|
14
|
+
" <DEVICE ID 045e:07b2 on Bus 002 Address 028>,\n",
|
15
|
+
" <DEVICE ID 045e:0904 on Bus 002 Address 015>,\n",
|
16
|
+
" <DEVICE ID 043e:9a39 on Bus 002 Address 057>,\n",
|
17
|
+
" <DEVICE ID 045e:0901 on Bus 002 Address 006>,\n",
|
18
|
+
" <DEVICE ID 05e3:0610 on Bus 002 Address 010>,\n",
|
19
|
+
" <DEVICE ID 2109:0817 on Bus 001 Address 001>,\n",
|
20
|
+
" <DEVICE ID 045e:0902 on Bus 002 Address 008>,\n",
|
21
|
+
" <DEVICE ID 1000:2000 on Bus 002 Address 016>,\n",
|
22
|
+
" <DEVICE ID 1189:8890 on Bus 002 Address 027>,\n",
|
23
|
+
" <DEVICE ID 2109:0817 on Bus 001 Address 002>,\n",
|
24
|
+
" <DEVICE ID 2109:2812 on Bus 002 Address 025>,\n",
|
25
|
+
" <DEVICE ID 046d:085e on Bus 002 Address 017>,\n",
|
26
|
+
" <DEVICE ID 045e:07c6 on Bus 002 Address 056>,\n",
|
27
|
+
" <DEVICE ID 0bda:5401 on Bus 002 Address 009>,\n",
|
28
|
+
" <DEVICE ID 10c4:ea60 on Bus 002 Address 055>,\n",
|
29
|
+
" <DEVICE ID 2109:2817 on Bus 002 Address 004>,\n",
|
30
|
+
" <DEVICE ID 0bda:5411 on Bus 002 Address 005>,\n",
|
31
|
+
" <DEVICE ID 045e:0900 on Bus 002 Address 003>,\n",
|
32
|
+
" <DEVICE ID 04e8:61f5 on Bus 002 Address 023>,\n",
|
33
|
+
" <DEVICE ID 045e:0903 on Bus 002 Address 020>,\n",
|
34
|
+
" <DEVICE ID 2109:2812 on Bus 002 Address 026>,\n",
|
35
|
+
" <DEVICE ID 8086:a0ed on Bus 002 Address 000>,\n",
|
36
|
+
" <DEVICE ID 2109:2817 on Bus 002 Address 013>,\n",
|
37
|
+
" <DEVICE ID 8087:0029 on Bus 002 Address 001>,\n",
|
38
|
+
" <DEVICE ID 8086:9a13 on Bus 001 Address 000>]"
|
39
|
+
]
|
40
|
+
},
|
41
|
+
"execution_count": 3,
|
42
|
+
"metadata": {},
|
43
|
+
"output_type": "execute_result"
|
44
|
+
}
|
45
|
+
],
|
46
|
+
"source": [
|
47
|
+
"import usb.core\n",
|
48
|
+
"import usb.util\n",
|
49
|
+
"import usb.backend.libusb1 as libusb1\n",
|
50
|
+
"from usb.core import USBError, Device\n",
|
51
|
+
"\n",
|
52
|
+
"from pathlib import Path\n",
|
53
|
+
"import platform\n",
|
54
|
+
"\n",
|
55
|
+
"if platform.system() == \"Windows\":\n",
|
56
|
+
" # on windows you need to use the libusb1 backend\n",
|
57
|
+
" import libusb\n",
|
58
|
+
"\n",
|
59
|
+
" arch = \"x64\" if platform.architecture()[0] == \"64bit\" else \"x86\"\n",
|
60
|
+
" libusb1_dll = Path(libusb.__file__).parent / f\"_platform\\\\_windows\\\\{arch}\\\\libusb-1.0.dll\"\n",
|
61
|
+
"\n",
|
62
|
+
" backend = libusb1.get_backend(find_library=lambda x: libusb1_dll.as_posix())\n",
|
63
|
+
"usb_devices = usb.core.find(backend=backend, find_all=True)\n",
|
64
|
+
"\n",
|
65
|
+
"list(usb_devices)"
|
66
|
+
]
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"cell_type": "code",
|
70
|
+
"execution_count": null,
|
71
|
+
"metadata": {},
|
72
|
+
"outputs": [],
|
73
|
+
"source": [
|
74
|
+
"for d in usb.core.find(backend=backend, find_all=True):\n",
|
75
|
+
" print(f\"Device {d.idVendor:04x}:{d.idProduct:04x}\")\n",
|
76
|
+
" print(f\"{d.iManufacturer=}\")\n",
|
77
|
+
" print(f\"{d.iProduct=}\")\n",
|
78
|
+
" print(f\"{d.bDeviceClass=}\")\n",
|
79
|
+
" print(f\"{d.bDescriptorType=}\")\n",
|
80
|
+
" print(f\"{d.bcdDevice=}\")\n",
|
81
|
+
" print(f\"{d.bcdUSB=}\")\n",
|
82
|
+
" # print(dir(d))\n",
|
83
|
+
" # print(f\" Manufacturer: {usb.util.get_string(dev, dev.iManufacturer)}\")\n",
|
84
|
+
"\n",
|
85
|
+
" print()"
|
86
|
+
]
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"cell_type": "code",
|
90
|
+
"execution_count": null,
|
91
|
+
"metadata": {},
|
92
|
+
"outputs": [],
|
93
|
+
"source": [
|
94
|
+
"import serial.tools.list_ports\n",
|
95
|
+
"\n",
|
96
|
+
"ports = serial.tools.list_ports.comports()\n",
|
97
|
+
"\n",
|
98
|
+
"for port in ports:\n",
|
99
|
+
" print(f\"Port: {port.device}\")\n",
|
100
|
+
" print(f\"Description: {port.description}\")\n",
|
101
|
+
" print(f\"Hardware ID: {port.hwid}\")\n",
|
102
|
+
" print()"
|
103
|
+
]
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"cell_type": "code",
|
107
|
+
"execution_count": null,
|
108
|
+
"metadata": {},
|
109
|
+
"outputs": [],
|
110
|
+
"source": [
|
111
|
+
"from mpflash.vendor import pydfu as pydfu\n",
|
112
|
+
"\n",
|
113
|
+
"try:\n",
|
114
|
+
" pydfu.list_dfu_devices()\n",
|
115
|
+
"except SystemExit:\n",
|
116
|
+
" print(\"No DFU devices found\")"
|
117
|
+
]
|
118
|
+
},
|
119
|
+
{
|
120
|
+
"cell_type": "code",
|
121
|
+
"execution_count": null,
|
122
|
+
"metadata": {},
|
123
|
+
"outputs": [],
|
124
|
+
"source": [
|
125
|
+
"pydfu.init()"
|
126
|
+
]
|
127
|
+
},
|
128
|
+
{
|
129
|
+
"cell_type": "code",
|
130
|
+
"execution_count": null,
|
131
|
+
"metadata": {},
|
132
|
+
"outputs": [],
|
133
|
+
"source": [
|
134
|
+
"dfu_file = Path(\"C:\\\\Users\\\\josverl\\\\Downloads\\\\firmware\\\\stm32\\\\PYBV11-THREAD-v1.23.0-preview.203.dfu\")\n",
|
135
|
+
"\n",
|
136
|
+
"print(\"Read DFU file...\")\n",
|
137
|
+
"elements = pydfu.read_dfu_file(dfu_file)\n",
|
138
|
+
"if not elements:\n",
|
139
|
+
" print(\"No data in dfu file\")"
|
140
|
+
]
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"cell_type": "code",
|
144
|
+
"execution_count": 1,
|
145
|
+
"metadata": {},
|
146
|
+
"outputs": [
|
147
|
+
{
|
148
|
+
"name": "stdout",
|
149
|
+
"output_type": "stream",
|
150
|
+
"text": [
|
151
|
+
"Writing memory...\n"
|
152
|
+
]
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"ename": "NameError",
|
156
|
+
"evalue": "name 'pydfu' is not defined",
|
157
|
+
"output_type": "error",
|
158
|
+
"traceback": [
|
159
|
+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
160
|
+
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
161
|
+
"Cell \u001b[1;32mIn[1], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWriting memory...\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m----> 2\u001b[0m \u001b[43mpydfu\u001b[49m\u001b[38;5;241m.\u001b[39mwrite_elements(elements, \u001b[38;5;28;01mFalse\u001b[39;00m, progress\u001b[38;5;241m=\u001b[39mpydfu\u001b[38;5;241m.\u001b[39mcli_progress)\n",
|
162
|
+
"\u001b[1;31mNameError\u001b[0m: name 'pydfu' is not defined"
|
163
|
+
]
|
164
|
+
}
|
165
|
+
],
|
166
|
+
"source": [
|
167
|
+
"print(\"Writing memory...\")\n",
|
168
|
+
"pydfu.write_elements(elements, False, progress=pydfu.cli_progress)"
|
169
|
+
]
|
170
|
+
},
|
171
|
+
{
|
172
|
+
"cell_type": "code",
|
173
|
+
"execution_count": null,
|
174
|
+
"metadata": {},
|
175
|
+
"outputs": [],
|
176
|
+
"source": [
|
177
|
+
"print(\"Exiting DFU...\")\n",
|
178
|
+
"pydfu.exit_dfu()"
|
179
|
+
]
|
180
|
+
}
|
181
|
+
],
|
182
|
+
"metadata": {
|
183
|
+
"kernelspec": {
|
184
|
+
"display_name": ".venv",
|
185
|
+
"language": "python",
|
186
|
+
"name": "python3"
|
187
|
+
},
|
188
|
+
"language_info": {
|
189
|
+
"codemirror_mode": {
|
190
|
+
"name": "ipython",
|
191
|
+
"version": 3
|
192
|
+
},
|
193
|
+
"file_extension": ".py",
|
194
|
+
"mimetype": "text/x-python",
|
195
|
+
"name": "python",
|
196
|
+
"nbconvert_exporter": "python",
|
197
|
+
"pygments_lexer": "ipython3",
|
198
|
+
"version": "3.11.7"
|
199
|
+
}
|
200
|
+
},
|
201
|
+
"nbformat": 4,
|
202
|
+
"nbformat_minor": 2
|
203
|
+
}
|