micropython-stubber 1.20.6__py3-none-any.whl → 1.23.1__py3-none-any.whl

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.
Files changed (89) hide show
  1. {micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.1.dist-info}/METADATA +4 -3
  2. micropython_stubber-1.23.1.dist-info/RECORD +159 -0
  3. mpflash/README.md +14 -4
  4. mpflash/mpflash/add_firmware.py +1 -1
  5. mpflash/mpflash/ask_input.py +1 -1
  6. {stubber → mpflash/mpflash}/basicgit.py +3 -13
  7. mpflash/mpflash/bootloader/__init__.py +2 -37
  8. mpflash/mpflash/bootloader/activate.py +60 -0
  9. mpflash/mpflash/bootloader/detect.py +82 -0
  10. mpflash/mpflash/bootloader/manual.py +10 -11
  11. mpflash/mpflash/bootloader/micropython.py +2 -0
  12. mpflash/mpflash/bootloader/touch1200.py +13 -22
  13. mpflash/mpflash/cli_download.py +1 -1
  14. mpflash/mpflash/cli_flash.py +4 -4
  15. mpflash/mpflash/cli_group.py +18 -5
  16. mpflash/mpflash/cli_main.py +3 -5
  17. mpflash/mpflash/common.py +1 -0
  18. mpflash/mpflash/config.py +6 -9
  19. mpflash/mpflash/connected.py +9 -5
  20. mpflash/mpflash/download.py +9 -5
  21. mpflash/mpflash/downloaded.py +4 -3
  22. mpflash/mpflash/{flash.py → flash/__init__.py} +20 -17
  23. mpflash/mpflash/{flash_esp.py → flash/esp.py} +1 -1
  24. mpflash/mpflash/flash/stm32.py +19 -0
  25. mpflash/mpflash/{flash_stm32_dfu.py → flash/stm32_dfu.py} +4 -1
  26. mpflash/mpflash/{flash_uf2.py → flash/uf2/__init__.py} +44 -23
  27. mpflash/mpflash/{flash_uf2_linux.py → flash/uf2/linux.py} +15 -8
  28. mpflash/mpflash/{flash_uf2_macos.py → flash/uf2/macos.py} +13 -5
  29. mpflash/mpflash/{flash_uf2_windows.py → flash/uf2/windows.py} +16 -7
  30. mpflash/mpflash/{worklist.py → flash/worklist.py} +9 -9
  31. mpflash/mpflash/list.py +13 -3
  32. mpflash/mpflash/mpboard_id/__init__.py +1 -1
  33. mpflash/mpflash/mpboard_id/add_boards.py +3 -7
  34. mpflash/mpflash/mpboard_id/board_id.py +1 -1
  35. mpflash/mpflash/mpremoteboard/__init__.py +5 -4
  36. {stubber/utils → mpflash/mpflash}/versions.py +31 -24
  37. mpflash/poetry.lock +16 -5
  38. mpflash/pyproject.toml +8 -3
  39. stubber/__init__.py +1 -1
  40. stubber/board/createstubs.py +4 -4
  41. stubber/board/createstubs_db.py +5 -5
  42. stubber/board/createstubs_db_min.py +1 -1
  43. stubber/board/createstubs_db_mpy.mpy +0 -0
  44. stubber/board/createstubs_mem.py +5 -5
  45. stubber/board/createstubs_mem_min.py +1 -1
  46. stubber/board/createstubs_mem_mpy.mpy +0 -0
  47. stubber/board/createstubs_min.py +1 -1
  48. stubber/board/createstubs_mpy.mpy +0 -0
  49. stubber/codemod/utils.py +2 -3
  50. stubber/commands/build_cmd.py +1 -1
  51. stubber/commands/cli.py +8 -4
  52. stubber/commands/clone_cmd.py +16 -4
  53. stubber/commands/enrich_folder_cmd.py +2 -1
  54. stubber/commands/get_core_cmd.py +5 -3
  55. stubber/commands/get_docstubs_cmd.py +6 -4
  56. stubber/commands/get_frozen_cmd.py +5 -3
  57. stubber/commands/get_mcu_cmd.py +9 -4
  58. stubber/commands/merge_cmd.py +3 -3
  59. stubber/commands/publish_cmd.py +2 -3
  60. stubber/commands/stub_cmd.py +2 -1
  61. stubber/commands/switch_cmd.py +14 -6
  62. stubber/commands/variants_cmd.py +3 -3
  63. stubber/freeze/get_frozen.py +1 -1
  64. stubber/minify.py +4 -3
  65. stubber/publish/candidates.py +4 -10
  66. stubber/publish/defaults.py +4 -9
  67. stubber/publish/missing_class_methods.py +1 -1
  68. stubber/publish/package.py +1 -1
  69. stubber/publish/pathnames.py +1 -1
  70. stubber/publish/publish.py +1 -1
  71. stubber/publish/stubpackage.py +3 -5
  72. stubber/rst/reader.py +5 -13
  73. stubber/tools/manifestfile.py +71 -27
  74. stubber/tools/readme.md +3 -2
  75. stubber/update_fallback.py +1 -1
  76. stubber/utils/__init__.py +2 -1
  77. stubber/utils/config.py +3 -5
  78. stubber/utils/manifest.py +2 -4
  79. stubber/utils/repos.py +5 -12
  80. micropython_stubber-1.20.6.dist-info/RECORD +0 -159
  81. mpflash/mpflash/flash_stm32.py +0 -24
  82. mpflash/mpflash/flash_stm32_cube.py +0 -111
  83. mpflash/mpflash/vendor/versions.py +0 -119
  84. {micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.1.dist-info}/LICENSE +0 -0
  85. {micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.1.dist-info}/WHEEL +0 -0
  86. {micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.1.dist-info}/entry_points.txt +0 -0
  87. /mpflash/{mpflash/vendor/basicgit.py → basicgit.py} +0 -0
  88. /mpflash/mpflash/{flash_uf2_boardid.py → flash/uf2/boardid.py} +0 -0
  89. /mpflash/mpflash/{uf2disk.py → flash/uf2/uf2disk.py} +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: micropython-stubber
3
- Version: 1.20.6
3
+ Version: 1.23.1
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
@@ -26,7 +26,7 @@ Requires-Dist: executing (>=2.0.1,<3.0.0)
26
26
  Requires-Dist: importlib-metadata (>=1.0,<2.0) ; python_version < "3.8"
27
27
  Requires-Dist: libcst (>=1.1.0,<2.0.0)
28
28
  Requires-Dist: loguru (>=0.6,<0.8)
29
- Requires-Dist: mpflash (>=0.8.6,<0.9.0)
29
+ Requires-Dist: mpflash (==0.9.1.post2)
30
30
  Requires-Dist: mpremote (>=1.23.0,<2.0.0)
31
31
  Requires-Dist: mypy (==1.9.0)
32
32
  Requires-Dist: mypy-gitlab-code-quality (>=1.1.0,<2.0.0)
@@ -38,13 +38,14 @@ Requires-Dist: pyright (>=1.1.341,<2.0.0)
38
38
  Requires-Dist: pyserial (>=3.5,<4.0)
39
39
  Requires-Dist: pysondb-v2 (>=2.1.0,<3.0.0)
40
40
  Requires-Dist: python-minifier (>=2.7.0,<3.0.0) ; python_version < "3.12"
41
- Requires-Dist: requests (>=2.28.0,<3.0.0)
41
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
42
42
  Requires-Dist: rich-click (>=1.8.3,<2.0.0)
43
43
  Requires-Dist: tabulate (>=0.9.0,<0.10.0)
44
44
  Requires-Dist: tenacity (>=8.2.2,<9.0.0)
45
45
  Requires-Dist: tomli (>=2.0.1,<3.0.0) ; python_version < "3.11"
46
46
  Requires-Dist: tomli-w (>=1.0.0,<2.0.0)
47
47
  Requires-Dist: typed-config (>=1.3.0,<2.0.0)
48
+ Requires-Dist: urllib3 (>=2.2.2,<3.0.0)
48
49
  Project-URL: Documentation, https://micropython-stubber.readthedocs.io/
49
50
  Project-URL: Repository, https://github.com/Josverl/micropython-stubber
50
51
  Description-Content-Type: text/markdown
@@ -0,0 +1,159 @@
1
+ mpflash/README.md,sha256=cajL2pq_Fjt7G7cOHp1_uDTf5jmOf6iQwOIvg2X5AJ0,14233
2
+ mpflash/basicgit.py,sha256=b6-gdK_DT0dmW3jEY9T0cjKR-TSEQOSl9U9sRcJh538,9257
3
+ mpflash/libusb_flash.ipynb,sha256=sw5MVQvPmH-DJy9kOdXyO80BSjEPMEXf_GJsGk3usrc,6428
4
+ mpflash/mpflash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ mpflash/mpflash/add_firmware.py,sha256=h-Nu9AnXO6ug2CurmgLoUVG1gNy6CA1NjwQl1nUoMZ4,3330
6
+ mpflash/mpflash/ask_input.py,sha256=EsPPlPS_wLC8j9f4o68yKIcqex0dV5tRH7k3rP3spG0,8710
7
+ mpflash/mpflash/basicgit.py,sha256=r_bI2U6QYFiS8ypUd6KtrjyZjK4JCANyK80L6wEzFoU,9213
8
+ mpflash/mpflash/bootloader/__init__.py,sha256=cRIxVRtUc4jZAgtFggRNhEn0BW-9WFpzm5xRy5B4B2U,105
9
+ mpflash/mpflash/bootloader/activate.py,sha256=sN2YuIuFGjLBd_PdG6P3N1yLuLyjnsVWDksrTMhzr_M,2301
10
+ mpflash/mpflash/bootloader/detect.py,sha256=eXL_JPcowb8g0tpZmj9DQXYbpfZFoSrzq86lScKhkT4,2608
11
+ mpflash/mpflash/bootloader/manual.py,sha256=qGInguhYil4v8EkUxPFlxzvs3m__KraPAj3LAKbV1Ts,3069
12
+ mpflash/mpflash/bootloader/micropython.py,sha256=0KDrfdZPtK7fLaxh-_4VxSO-u4IUj7qCyNVw9-LQ74M,517
13
+ mpflash/mpflash/bootloader/touch1200.py,sha256=tL2H4ERh0-YSdR8_v6aK_pDRPMjMevHWUGq4-TTFcWo,1083
14
+ mpflash/mpflash/cli_download.py,sha256=Ip5HViXCVAiG88XgJ3Lg_hhBGIF5DKFTNpL-_gQkdV0,3520
15
+ mpflash/mpflash/cli_flash.py,sha256=KFuJRNgOZ62m70I_KqxqLfLE69b4bOCj69MOfIWdZRo,7136
16
+ mpflash/mpflash/cli_group.py,sha256=JFBtp4qhakJeQkuupEoObHeSFke8eWIU1HjnOZ-JfH0,2504
17
+ mpflash/mpflash/cli_list.py,sha256=AvYq5_Z7l0Z4rkbr23TwFNzstuZsQgopFpdcrTLwUvs,1965
18
+ mpflash/mpflash/cli_main.py,sha256=cElgh8Soq3U5TEAvrrD1sj7NDi-Eb-pei3QcMI0tlwE,1094
19
+ mpflash/mpflash/common.py,sha256=h4pVuOpopn5oIy5NQdbggtOOktTL_c92cS_oUfPG4v8,5783
20
+ mpflash/mpflash/config.py,sha256=h2Oq7kSe40tOnglpo02wkpaPHxHNVqyB3uGxreIu57U,1029
21
+ mpflash/mpflash/connected.py,sha256=p6RMix-tFr0pfT9TErh0LD1nm24ApTr3CqVGcrnDHk8,3024
22
+ mpflash/mpflash/download.py,sha256=mckR3pdMFQMYBKNmKBEJm9bJnTtQEnkuQ1vWYXcRRv8,13941
23
+ mpflash/mpflash/downloaded.py,sha256=YPN0LDf8DSDvdB9gbVny61bvaJHIDbUs81XUwftTb1c,4808
24
+ mpflash/mpflash/errors.py,sha256=6lUhVtECY3syV2bBGKzegGH4pPKXhevvhYQZd74sy6o,238
25
+ mpflash/mpflash/flash/__init__.py,sha256=xX2ZJGNX9xpX2s8V7SEJ1It7eOEbl8WkdFzpRd3TLzk,2041
26
+ mpflash/mpflash/flash/esp.py,sha256=LcOgjpE4zmPawHNwSd_6WFkaIYYazA__rf3ihGXR7I0,2228
27
+ mpflash/mpflash/flash/stm32.py,sha256=W8SJ2_8FGXyMS6cRcZpfOvOM8iOC_cn4vK8xd8tKzI4,555
28
+ mpflash/mpflash/flash/stm32_dfu.py,sha256=uTn06H0ZezzCv5O0hvry8ohBtuZXHe_GX2zNUfCxu58,2986
29
+ mpflash/mpflash/flash/uf2/__init__.py,sha256=PWEVxzZEca3pfLx_Qy5c4zlHH4W5fAjd0BmDTkS7s6g,2766
30
+ mpflash/mpflash/flash/uf2/boardid.py,sha256=2s4K3QiKWK5HKFKWYsDV3hI8alfWSxEOMeurER3eZtM,408
31
+ mpflash/mpflash/flash/uf2/linux.py,sha256=4azbcx_YqLZ3RyYNWljejHG_Y6SU-wREL8hhkTYqCjI,4099
32
+ mpflash/mpflash/flash/uf2/macos.py,sha256=sncXJsc2FVfm9rvLDjcEu7ZIyrDeHmazHiNQTUaf1Y0,1187
33
+ mpflash/mpflash/flash/uf2/uf2disk.py,sha256=dQ8_U6e3qkFOyfXZDpWAsvEBIlMr-ZzLkzTDD8SADqM,286
34
+ mpflash/mpflash/flash/uf2/windows.py,sha256=k9Yv71YswPnLx-Z5rf4KjhtVkEWr8SU8EXpeRv87h3A,1290
35
+ mpflash/mpflash/flash/worklist.py,sha256=1uBvn-T35Oey04g6xxNxo5t68q5_tp18eZcRAamF0tY,5828
36
+ mpflash/mpflash/list.py,sha256=O0tX4BvclmDMnnjMxCN9Zh8hdL6vnuvS9pLNxYLBya8,3112
37
+ mpflash/mpflash/logger.py,sha256=BAVrSXMGZLfSDRFbtVBtvb7Rl0sTJxooCgBS5t-6bXo,1057
38
+ mpflash/mpflash/mpboard_id/__init__.py,sha256=rQrPCN30GP-lfB2a2deA-lQ6iKvaKPK_xbtBoIavGsM,3716
39
+ mpflash/mpflash/mpboard_id/add_boards.py,sha256=ehQn560S0XxAD3nsUMo4o_f6w8XTVAfO0GCnfTKa6-4,9379
40
+ mpflash/mpflash/mpboard_id/board.py,sha256=yQ8IDHQS09AelvTvmPhpmsL4oX3L7IXGqHorkxDOkoE,1114
41
+ mpflash/mpflash/mpboard_id/board_id.py,sha256=wzGrxJu_ciOVT7n2861lhoKmPAjh1QjWnAdfcqNUUqc,2871
42
+ mpflash/mpflash/mpboard_id/board_info.zip,sha256=F6YowS96DAqjten4ySe4MXgZwPtE-saZOUfY5OQkqKk,19759
43
+ mpflash/mpflash/mpboard_id/store.py,sha256=lQQgHSxcaM_ZURcfZNSUv3-ZJjUKMC_xEOOSdpzVvBU,1493
44
+ mpflash/mpflash/mpremoteboard/__init__.py,sha256=7uI-5HJgNsQz_EOCW3cRy2xtqXKt9kX51gDSx6HC0Kc,7522
45
+ mpflash/mpflash/mpremoteboard/mpy_fw_info.py,sha256=BTupe4rZDTs3UHRqvs429XqWHCchSpwa05yACOiOt5U,4413
46
+ mpflash/mpflash/mpremoteboard/runner.py,sha256=YUmo5Y0aOgMaww8CXSdNdgXD-wRKncILuMZ0OB_2qRU,4646
47
+ mpflash/mpflash/vendor/click_aliases.py,sha256=K98inhtze8td1dw312kexJS7OX_0ojlptPQ5Z0SHxJY,3065
48
+ mpflash/mpflash/vendor/dfu.py,sha256=jGsiD3lbSV1Ar9qJubhoY_hy-L8FI-K55aow8vgwoYQ,5590
49
+ mpflash/mpflash/vendor/pydfu.py,sha256=1ObubGsPFrQ7T9M3JRlIPNIG2xx8uYffaEe0Y6bdf_g,19937
50
+ mpflash/mpflash/vendor/readme.md,sha256=ZVg7kuUYyXcWcrWkaSJ0CunwebCqu2SiS2sqDadwrT8,84
51
+ mpflash/mpflash/versions.py,sha256=x5VrdVfWhZJfH7tZmwu2vVx-mPrK1iunYSpSce9VUXU,4492
52
+ mpflash/poetry.lock,sha256=JBMsMo9yzGVD9SdckwbYHFDUnHfg-wHzUQYg6K93APg,118420
53
+ mpflash/pyproject.toml,sha256=MCytD4FfOtlJX5MbeO2yU1GvnqqDQzpjy1jC4e-6nFM,1701
54
+ mpflash/stm32_udev_rules.md,sha256=LJelvFFA8w9mBcEUDA02SZ4yzNKfUFL_NWLNUb6geWY,2622
55
+ stubber/__init__.py,sha256=6KpMPO6c9ZEvZBPPZx5uuHwyJypuElaoMoTPmiTw7d0,46
56
+ stubber/board/board_info.csv,sha256=3BBwHOtKfq_U0Xl8iWgNsN3akhbNMjb-TIeusDwtTXQ,8434
57
+ stubber/board/boot.py,sha256=TEBSaKXY_TYJy9YrTRWv22m8jZRefaRNiwM8xNAlH5M,1086
58
+ stubber/board/createstubs.py,sha256=sXSMviwCmlXL2tjyMq18L2L7Y4fOzMVFHdrqAXMxo7A,31936
59
+ stubber/board/createstubs_db.py,sha256=RS6ywP7m_C22HEQs_rhvLn5OgNnN5dKrCwdjjwzG7cQ,29558
60
+ stubber/board/createstubs_db_min.py,sha256=W4GQ1iDV7M-2QZ4EfuBQ7M-ZrqzKU_adOZ-Y7WykEJ8,11142
61
+ stubber/board/createstubs_db_mpy.mpy,sha256=oHZUyh-iTIzMN_hUFyDauX8WL8ghj-YKFpTfOQRReDM,9536
62
+ stubber/board/createstubs_lvgl.py,sha256=LDlY2AxT5S_IZ5twi2wK9gm3SnHsDt9inrpCLOYmZIk,26476
63
+ stubber/board/createstubs_lvgl_min.py,sha256=9L9JsZUCY0E5x4F_Uyckkd8GjiB_49guU6DN-u7XhgU,26466
64
+ stubber/board/createstubs_lvgl_mpy.mpy,sha256=ex-nlq2V5e8anQBJvRWEEc-FzU7nlwg5NSrZ8vOadIA,9267
65
+ stubber/board/createstubs_mem.py,sha256=9VTkI51ReZdBGh7U0cnJsg6D3jZcO4srmGCpk_y-FpI,27953
66
+ stubber/board/createstubs_mem_min.py,sha256=T4joCuKAxUf1Op6kVtc4dZ4TSnIHrKNIZ5qUsSyAkJs,10713
67
+ stubber/board/createstubs_mem_mpy.mpy,sha256=QpuonHENnSzxDYQTOhxo9f8D8YV84KlzSLzjzUh9AOI,9118
68
+ stubber/board/createstubs_min.py,sha256=6PLxTD8XD7JGeTfJ_97DuJf-6iDbkMKCbKLHFvQE3KM,13405
69
+ stubber/board/createstubs_mpy.mpy,sha256=Nj0rwiGFEkCiaQcs-AiYcDp3NvPY2Hr-1xPRBBf9HwM,12388
70
+ stubber/board/fw_info.py,sha256=BTupe4rZDTs3UHRqvs429XqWHCchSpwa05yACOiOt5U,4413
71
+ stubber/board/info.py,sha256=0FCQZ5J3KFDbYe0D5iOuwhmZUUBVASPU7-L6fA7ZRGc,5446
72
+ stubber/board/main.py,sha256=l-5RCT-MMV93SkVwXh3guzx_kxFIJciSEgH1e4UrqT8,394
73
+ stubber/board/modulelist.txt,sha256=LH3tz0w9MxZEAoYRl0JPmVSrYlbsrhkHd9lBP9z2h88,2653
74
+ stubber/board/pyrightconfig.json,sha256=4jEkjN3pTfa8Ok5wxW0_W2mAOWIjKZPq5GRsk8oTBN4,1342
75
+ stubber/bulk/mcu_stubber.py,sha256=_iv2G3QaiGxe7L7W40KahNGyOoKTGw_yyyejMHY6O7Q,15893
76
+ stubber/codemod/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
+ stubber/codemod/_partials/__init__.py,sha256=SKt5UKja7SGdJ2PIQLp7-CURTQ-EimrswhW-ZTaRBEk,1382
78
+ stubber/codemod/_partials/db_main.py,sha256=yvl1ydyiWJDhNmuH7P_5b85Crfrh2CAroA_i_8aCqIw,3856
79
+ stubber/codemod/_partials/lvgl_main.py,sha256=ANMJr4XpWyLHhk3ZHsR0YnGe8fNtIi58YOdN6TLay1o,1887
80
+ stubber/codemod/_partials/modules_reader.py,sha256=kIYUxrCNtR7K1D0NVxePuNjhPoPkOx9qbjh-mdW1IVs,1966
81
+ stubber/codemod/add_comment.py,sha256=qGaa-sF3WyeLZwa5FPyT_Yp-ARFruKlBIIe0tayUiTk,1912
82
+ stubber/codemod/add_method.py,sha256=AbHmfwjgTYWes3XrqPGk0-FjKxnGQuDLXbE5APhApF4,2544
83
+ stubber/codemod/board.py,sha256=WVeUbVOV8MlDAyr5JLhOLdlmyFdlOpdRunjdzM_ULsM,11564
84
+ stubber/codemod/enrich.py,sha256=9hb2__De3eNkF8WKg0CLwYs0lngIDJ0M3nmx2yyuGCU,5293
85
+ stubber/codemod/merge_docstub.py,sha256=-F2P9UAD98Xt8ArsNqQJ-AM6bz9H9V9E3S2d17Jk5xg,12397
86
+ stubber/codemod/modify_list.py,sha256=_YTj3E44dwb7QaRqKaIq0IWg-BzH69AZRqTr3QMkFnY,2064
87
+ stubber/codemod/utils.py,sha256=7I69E23wnlwABTbfszq6lZN7PNA7H5y4_KiSEu0fJ84,2403
88
+ stubber/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
+ stubber/commands/build_cmd.py,sha256=lZfbxPyduDkLDTCGWI_nBc_3lKwZjfWPvq4nVy2v944,2381
90
+ stubber/commands/cli.py,sha256=PkwD9c3dkvhbmX5u1eGjSxE8y5Uph0Ke1_x9HTyjA-4,1836
91
+ stubber/commands/clone_cmd.py,sha256=_bSv9R6zuYp7N8dpUUMupUMk4dpFEAhRzV8HoaApGHg,2689
92
+ stubber/commands/config_cmd.py,sha256=CMFe0IngKPJYrb3kcZ6BObBOh4dW_0Wf7etAuJthB18,964
93
+ stubber/commands/enrich_folder_cmd.py,sha256=ysdd_CLdPCiEja4xuFOAX_a89telX4Da7cvkrpXP4lY,1798
94
+ stubber/commands/get_core_cmd.py,sha256=VwkZl9g81LvwWu4grrIb2Qo8M5-yXrDEX5mUWJ2uKFo,2240
95
+ stubber/commands/get_docstubs_cmd.py,sha256=gGn0cUVledj4GjCqOIM8p2piiarddWknTlU5UqumC44,2935
96
+ stubber/commands/get_frozen_cmd.py,sha256=dzIivxAmef2OlVrL914ZCQUs7m9L_rkzTeh1aMsrGmk,3857
97
+ stubber/commands/get_mcu_cmd.py,sha256=7xhu8vfaa_nCyE-T-8OIedgpDTyae3KquxvLsL3Dx3E,2018
98
+ stubber/commands/merge_cmd.py,sha256=kK8SGfB3SDiNkwyhzFQyyRvmw1q2Q7kswv-ml30ktCw,1605
99
+ stubber/commands/publish_cmd.py,sha256=qfSyPXMSPE1qHe0mG9JW_90IK16E_jCF9a47TR1ywN0,2788
100
+ stubber/commands/stub_cmd.py,sha256=PzvCppuhY2vRJJEzKbdc87WnrVEd3jPJ7AdtQeUSpn8,1171
101
+ stubber/commands/switch_cmd.py,sha256=qfJxshcKZggHsmGX-FBpLj06PAnIfHFU6hmCcFv-n34,1819
102
+ stubber/commands/variants_cmd.py,sha256=nJKePmxNzyz82b8E-qcJGvzHGTdFxowxKNOz7KDe1k4,1234
103
+ stubber/cst_transformer.py,sha256=Er9kww4hgdeQ9dARMx8lB5PLIvPaKjtKJMe8BofKOzY,6301
104
+ stubber/data/board_info.csv,sha256=3BBwHOtKfq_U0Xl8iWgNsN3akhbNMjb-TIeusDwtTXQ,8434
105
+ stubber/data/board_info.json,sha256=LbyNo3qeij8bY_PRTxWoS5nFuDv6VyaRTKGiXC_-zRQ,57210
106
+ stubber/data/micropython_tags.csv,sha256=95Y4zBefqi65QNvQy5bJXr7Fw8sVHmspeo2rnyLZECQ,1894
107
+ stubber/data/requirements-core-micropython.txt,sha256=mRQ8Sj-PqYP74lVgpWWXSYkVJilSKVsjijoLARQNAwY,1279
108
+ stubber/data/requirements-core-pycopy.txt,sha256=UKZooNXL7GbojDwmaiBTxHEQzzd-H8kI6l5eJCX-oyk,1012
109
+ stubber/downloader.py,sha256=TwvdzSdep1jtCpjocqFJdi7c-I5bZSc3dhfDE5zX-ps,1170
110
+ stubber/freeze/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
111
+ stubber/freeze/common.py,sha256=gY0JSlXmwZqnoosb91M7W3wy3Ej6w48dTdJP8gKOg-U,2571
112
+ stubber/freeze/freeze_folder.py,sha256=-n1w9jxzLjL1Sg-f9VHqHaxsBKDiPGHqBNgeY68pqq8,2422
113
+ stubber/freeze/freeze_manifest_2.py,sha256=uogLPLb4bAah5ULkKzhWWadvu0CswGI3TygRqOb5XYc,3948
114
+ stubber/freeze/get_frozen.py,sha256=7s0thtTccXmJw6QgfeZaQX-X-STqeBWx_97Nayrffuo,5157
115
+ stubber/get_cpython.py,sha256=PEiDn2STECuKeRBSyWx7WuexUpSsyZ-76jQrBvWZY4U,3683
116
+ stubber/get_lobo.py,sha256=I6bVpcGX7TaD4CI9UID8R9brOG-bBdeL07j1WsTXQH4,1717
117
+ stubber/minify.py,sha256=3PRfq6J8etJLmh0b6WQJQazotUiF0AX0zxrS1ZPRJ44,14616
118
+ stubber/publish/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
+ stubber/publish/bump.py,sha256=M9ePaH-K1lbh-OVyPNAv6uxumDtHe3cOD2rXeAMWDqY,3176
120
+ stubber/publish/candidates.py,sha256=JFR9V77DTwBMo_8Z-cZXHwiAA-751o54kBdVhWwAYpk,10328
121
+ stubber/publish/database.py,sha256=fH_-Zjd_JHTEaW2Yf8kEB6DQduKrmZl9R-67mNYE3HI,605
122
+ stubber/publish/defaults.py,sha256=x9E03Im7d7aCAotRSg2vjTl0bbxG-X8Sa2pxc9n61EQ,1492
123
+ stubber/publish/enums.py,sha256=BRzoSjLxYPLcEHySaFprY1ndLLdUetqRjYJmi5CW7xU,756
124
+ stubber/publish/helpers.py,sha256=XRN9KZgPtIEgVW6NSmZunvTiT0UqP_rr63lM69hcqbs,687
125
+ stubber/publish/merge_docstubs.py,sha256=nQJVloB_iHnsEiILCHIJrS2dgR1bP06LtiXYyaJi4Sc,5189
126
+ stubber/publish/missing_class_methods.py,sha256=khb5JcOF6ImLunRZtFa8wMa9whnZkBsAiM1mdxTV9o8,1768
127
+ stubber/publish/package.py,sha256=Oo7QM1aDmM2-RPPlKAwytePrno1s4O6J9_P0LRzQRkE,5122
128
+ stubber/publish/pathnames.py,sha256=VwBDZZy8vsJkmcHvkRA_eaL2DSdPFRJAjvQ0KNM_288,1754
129
+ stubber/publish/publish.py,sha256=DPpzb8Jo5wyvOvJawAEqnleE20bVMZTfYzKXS3DuRqY,3827
130
+ stubber/publish/pypi.py,sha256=fuxpVFOvvCXXjdTgEB2vWqMjhwUDDQMiHJ6N98C_JdM,1202
131
+ stubber/publish/stubpackage.py,sha256=ntM1FZn2n0zxFWNKzKABQGNPg47T_ZJngmgDrWRv9h0,43666
132
+ stubber/rst/__init__.py,sha256=8KUzMFNdDU9X6U1VMU1q5bGu_KGxB1XNcJhzNg7tF98,284
133
+ stubber/rst/classsort.py,sha256=jofWVYPQQUzUhN-t2qFJT6381DH46Pjy0fTp5ek5JJU,2578
134
+ stubber/rst/lookup.py,sha256=QIX0_xbXydfXgD-7ctni3QJo2hFN7BzsGz-5Bq1owKQ,19656
135
+ stubber/rst/output_dict.py,sha256=tH_32ZTNj7BndvY2YcZCa1uB-lLeyJUeltoEkTT_Np8,14354
136
+ stubber/rst/reader.py,sha256=LDeH1dTWsg6hPwtXTyPX1sbRkvKqG1dGJKM2TDkBEh4,32758
137
+ stubber/rst/report_return.py,sha256=r6WeysP2VygcBM-nk1Jo_iItcxsl6sWgWg6myHTjBFY,2745
138
+ stubber/rst/rst_utils.py,sha256=8wfodql00CnO57x8VeNh1yoz7yx_ONa330kWuR1JFoE,17277
139
+ stubber/stubber.py,sha256=sScRIAq7vvUZUS9Mzh4Ne6ny0qpsReGNqo0u8vtZXEc,1596
140
+ stubber/stubs_from_docs.py,sha256=jcNdbNFQ6qZiVOVzdD8nfBNTubD-jviL_KJDPqOfTxo,2743
141
+ stubber/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
142
+ stubber/tools/manifestfile.py,sha256=1P2_MUPZ6PIoHR71pLFKDycknY6N9BG8eUScV-JsUXc,25082
143
+ stubber/tools/readme.md,sha256=NJ_g0oeeExhiRs2lMQVekccnR_c2lGLt-snu1RnUIx0,278
144
+ stubber/update_fallback.py,sha256=r7pVfUxVkJWVBFDfN_u5XaFJ5jg7FpFSHCFGor1UXU8,4798
145
+ stubber/update_module_list.py,sha256=smeu-xSeFgtr1piJNR1JqLzHd3HZ1K5_iaKNRea6dzk,3886
146
+ stubber/utils/__init__.py,sha256=FzTO7K7X4pBCRxbZjl15JyRNusidLX7uk_DgYMcIFzM,228
147
+ stubber/utils/config.py,sha256=AEKRevg9BHSbXz_5RGZR8bpuwcD3KlPuBIqmGltXu6E,4704
148
+ stubber/utils/makeversionhdr.py,sha256=65VXDavYQU5GnR8OfbFAXAq6RCAtLdbEM-a7a3UiLxc,1899
149
+ stubber/utils/manifest.py,sha256=ROGiUEZsvMZ-8c8uUYMU_Uh8_HddY3u96vkUH2o8BH0,3149
150
+ stubber/utils/post.py,sha256=qoN-XiNBNMExUdHeXbkjlsvllkG2jKB-ptuApe4kjpc,2758
151
+ stubber/utils/repos.py,sha256=qquw-y5V14xqTl7Ivuh8NB5PBy1ZpaScprQFU7zAc7w,5674
152
+ stubber/utils/stubmaker.py,sha256=1eMNpZZ-BWBtxLwBO-kz4CywjUe0JexN6QSyAVNICxM,5099
153
+ stubber/utils/typed_config_toml.py,sha256=6nlFgHwdCcK_0MJICsstCFgm9M6TblvF-l0_2cpw_cY,2552
154
+ stubber/variants.py,sha256=iS3sv8cT7czdI9x4KqzTCPT6hX1CKQ-bIlWnDG6gyoU,3688
155
+ micropython_stubber-1.23.1.dist-info/LICENSE,sha256=2zsOXlYgl9W7_XGXcncAXIYfvSVlyNcVBycC6hhlKhA,1542
156
+ micropython_stubber-1.23.1.dist-info/METADATA,sha256=5QlsVnjIFbHYFeJ7mWWejAFeON8jPpjoeNbodwomzKo,19197
157
+ micropython_stubber-1.23.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
158
+ micropython_stubber-1.23.1.dist-info/entry_points.txt,sha256=NQi_M36fgq5k6giSuASas3LrpF6CVdkzfvJC0ja73_g,55
159
+ micropython_stubber-1.23.1.dist-info/RECORD,,
mpflash/README.md CHANGED
@@ -11,8 +11,8 @@ This tool was initially created to be used in a CI/CD pipeline to automate the p
11
11
  `mpflash` has been tested on:
12
12
  - OS: Windows x64, Linux X64, but not (yet) macOS.
13
13
  - Micropython (hardware) ports:
14
- - `rp2`, using `.uf2`, using filecopy (macos not tested yet)
15
- - `samd`, using ` .uf2`, using filecopy (macos not tested yet)
14
+ - `rp2`, using `.uf2`, using filecopy
15
+ - `samd`, using ` .uf2`, using filecopy
16
16
  - `esp32`, using `.bin`, using esptool,
17
17
  - `esp8266`, using `.bin`, using esptool
18
18
  - `stm32`, using ` .dfu`, using pydfu
@@ -25,7 +25,7 @@ Not yet implemented: `nrf`, `cc3200`, `mimxrt`
25
25
  3. Flash one or all connected MicroPython boards with a specific firmware or version.
26
26
 
27
27
  ## Installation
28
- To install mpflash, you can use pip: `pip install mpflash`
28
+ To install mpflash, you can use: `pipx install mpflash` or `pip install mpflash`
29
29
 
30
30
  ## Basic usage
31
31
  You can use mpflash to perform various operations on your MicroPython boards. Here is an example of basic usage:
@@ -69,7 +69,7 @@ To download the MicroPython firmware for some boards, use the following command:
69
69
 
70
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.
71
71
  The stable version (default) is determined based on the most recent published release,
72
- other versions are `--version preview` and `--version x.y.z` to download the latest preview or version x.y.z respectively.
72
+ other options are `--version stable`, `--version preview` and `--version x.y.z` to download the latest stable, preview or version x.y.z respectively.
73
73
 
74
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.
75
75
 
@@ -92,8 +92,18 @@ After you have downloaded a firmware you can flash the firmware to a board usin
92
92
  This will (try to) autodetect the connected boards, and determine the correct firmware to flash to each board.
93
93
 
94
94
  - `mpflash flash` will flash the latest stable firmware to all connected boards.
95
+ If you have a board withouth a running micropython version, you will need to specify the board and the serial port to flash.
95
96
  - `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
+ In order to flash the firmware some boards need to be put in bootloader mode, this is done automatically by mpflash where possible and supported by the boards hardware and current bootloader.
99
+ The supported `--bootloader` options are:
100
+
101
+ - `touch1200` bootloader is activated by connecting to the board at 1200 baud
102
+ - `mpy` using micropython to enter the bootloader
103
+ - `manual` manual intervention is needed to enter the bootloader
104
+ - `none` mpflash assumes the board is ready to flash
105
+
106
+ For ESP32 and ESP8266 boards the `esptool` is used to flash the firmware, and this includes activating the bootloader.
97
107
 
98
108
  ### Flashing all connected boards with the latest stable firmware
99
109
  ```bash
@@ -11,7 +11,7 @@ from mpremote.mip import _rewrite_url as rewrite_url # type: ignore
11
11
 
12
12
  from mpflash.common import FWInfo
13
13
  from mpflash.config import config
14
- from mpflash.vendor.versions import get_preview_mp_version, get_stable_mp_version
14
+ from mpflash.versions import get_preview_mp_version, get_stable_mp_version
15
15
 
16
16
 
17
17
  def add_firmware(
@@ -14,7 +14,7 @@ from .config import config
14
14
  from .mpboard_id import (get_known_boards_for_port, get_known_ports,
15
15
  known_stored_boards)
16
16
  from .mpremoteboard import MPRemoteBoard
17
- from .vendor.versions import micropython_versions
17
+ from .versions import micropython_versions
18
18
 
19
19
 
20
20
  def ask_missing_params(
@@ -14,16 +14,11 @@ from github import Auth, Github
14
14
  from loguru import logger as log
15
15
  from packaging.version import parse
16
16
 
17
- # from stubber.utils.versions import get_stable_mp_version
18
- from mpflash.vendor.versions import get_stable_mp_version
19
-
20
- # from stubber.utils.versions import SET_PREVIEW
17
+ # from mpflash.versions import SET_PREVIEW
21
18
 
22
19
  # Token with no permissions to avoid throttling
23
20
  # https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#getting-a-higher-rate-limit
24
- PAT_NO_ACCESS = (
25
- "github_pat" + "_11AAHPVFQ0qAkDnSUaMKSp" + "_ZkDl5NRRwBsUN6EYg9ahp1Dvj4FDDONnXVgimxC2EtpY7Q7BUKBoQ0Jq72X"
26
- )
21
+ PAT_NO_ACCESS = "github_pat" + "_11AAHPVFQ0qAkDnSUaMKSp" + "_ZkDl5NRRwBsUN6EYg9ahp1Dvj4FDDONnXVgimxC2EtpY7Q7BUKBoQ0Jq72X"
27
22
  PAT = os.environ.get("GITHUB_TOKEN") or PAT_NO_ACCESS
28
23
  GH_CLIENT = Github(auth=Auth.Token(PAT))
29
24
 
@@ -40,9 +35,7 @@ def _run_local_git(
40
35
  if repo:
41
36
  if isinstance(repo, str):
42
37
  repo = Path(repo)
43
- result = subprocess.run(
44
- cmd, capture_output=capture_output, check=True, cwd=repo.absolute().as_posix(), encoding="utf-8"
45
- )
38
+ result = subprocess.run(cmd, capture_output=capture_output, check=True, cwd=repo.absolute().as_posix(), encoding="utf-8")
46
39
  else:
47
40
  result = subprocess.run(cmd, capture_output=capture_output, check=True, encoding="utf-8")
48
41
  except (NotADirectoryError, FileNotFoundError) as e: # pragma: no cover
@@ -74,9 +67,6 @@ def clone(remote_repo: str, path: Path, shallow: bool = False, tag: Optional[str
74
67
  cmd = ["git", "clone"]
75
68
  if shallow:
76
69
  cmd += ["--depth", "1"]
77
- if tag in {"stable"}:
78
- tag = get_stable_mp_version()
79
-
80
70
  if tag in {"preview", "latest", "master"}:
81
71
  tag = None
82
72
  cmd += [remote_repo, "--branch", tag, str(path)] if tag else [remote_repo, str(path)]
@@ -1,37 +1,2 @@
1
- import time
2
-
3
- from mpflash.common import BootloaderMethod
4
- from mpflash.errors import MPFlashError
5
- from mpflash.logger import log
6
- from mpflash.mpremoteboard import MPRemoteBoard
7
-
8
- from .manual import enter_bootloader_manual
9
- from .micropython import enter_bootloader_mpy
10
- from .touch1200 import enter_bootloader_cdc_1200bps
11
-
12
-
13
- def enter_bootloader(
14
- mcu: MPRemoteBoard,
15
- method: BootloaderMethod = BootloaderMethod.MPY,
16
- timeout: int = 10,
17
- wait_after: int = 2,
18
- ):
19
- """Enter the bootloader mode for the board"""
20
- if method == BootloaderMethod.NONE:
21
- # NO bootloader requested, so must be OK to flash
22
- return True
23
-
24
- log.info(f"Entering bootloader on {mcu.board} on {mcu.serialport} using method: {method.value}")
25
- if method == BootloaderMethod.MPY:
26
- result = enter_bootloader_mpy(mcu, timeout=timeout)
27
- elif method == BootloaderMethod.MANUAL:
28
- result = enter_bootloader_manual(mcu, timeout=timeout)
29
- elif method == BootloaderMethod.TOUCH_1200:
30
- result = enter_bootloader_cdc_1200bps(mcu, timeout=timeout)
31
- else:
32
- raise MPFlashError(f"Unknown bootloader method {method}")
33
- if result:
34
- time.sleep(wait_after)
35
- else:
36
- log.error(f"Failed to enter bootloader on {mcu.serialport}")
37
- return result
1
+ from .activate import enter_bootloader # type: ignore
2
+ from .detect import in_bootloader # type: ignore
@@ -0,0 +1,60 @@
1
+ import time
2
+
3
+ from mpflash.bootloader.detect import in_bootloader
4
+ from mpflash.common import BootloaderMethod
5
+ from mpflash.errors import MPFlashError
6
+ from mpflash.logger import log
7
+ from mpflash.mpremoteboard import MPRemoteBoard
8
+
9
+ from .manual import enter_bootloader_manual
10
+ from .micropython import enter_bootloader_mpy
11
+ from .touch1200 import enter_bootloader_touch_1200bps
12
+
13
+ BL_OPTIONS = {
14
+ "stm32": [BootloaderMethod.TOUCH_1200, BootloaderMethod.MPY, BootloaderMethod.MANUAL],
15
+ "rp2": [BootloaderMethod.TOUCH_1200, BootloaderMethod.MPY, BootloaderMethod.MANUAL],
16
+ "samd": [BootloaderMethod.TOUCH_1200, BootloaderMethod.MPY, BootloaderMethod.MANUAL],
17
+ "esp32": [BootloaderMethod.NONE],
18
+ "esp8266": [BootloaderMethod.NONE],
19
+ }
20
+
21
+
22
+ def enter_bootloader(
23
+ mcu: MPRemoteBoard,
24
+ method: BootloaderMethod = BootloaderMethod.MPY,
25
+ timeout: int = 10,
26
+ wait_after: int = 2,
27
+ ):
28
+ """Enter the bootloader mode for the board"""
29
+ if method == BootloaderMethod.NONE:
30
+ # NO bootloader requested, so must be OK to flash
31
+ return True
32
+ elif method == BootloaderMethod.AUTO:
33
+ # build a list of options to try for this board
34
+ bl_list = BL_OPTIONS.get(mcu.port, [BootloaderMethod.MPY, BootloaderMethod.MANUAL])
35
+ else:
36
+ bl_list = [method, BootloaderMethod.MANUAL]
37
+ log.info(f"Entering bootloader on {mcu.serialport} using methods {[bl.value for bl in bl_list]}")
38
+ for method in bl_list:
39
+ try:
40
+ if method == BootloaderMethod.MPY:
41
+ result = enter_bootloader_mpy(mcu, timeout=timeout)
42
+ elif method == BootloaderMethod.MANUAL:
43
+ result = enter_bootloader_manual(mcu, timeout=timeout)
44
+ elif method == BootloaderMethod.TOUCH_1200:
45
+ result = enter_bootloader_touch_1200bps(mcu, timeout=timeout)
46
+ except MPFlashError as e:
47
+ log.warning(f"Failed to enter bootloader on {mcu.serialport} using {method.value}")
48
+ log.exception(e)
49
+ result = False
50
+ if not result:
51
+ # try a next method
52
+ continue
53
+
54
+ # todo - check every second or so for up to max wait time
55
+ time.sleep(wait_after)
56
+ # check if bootloader was entered
57
+ if in_bootloader(mcu):
58
+ return True
59
+
60
+ return result
@@ -0,0 +1,82 @@
1
+ """ Detect if a board is in bootloader mode
2
+ """
3
+
4
+ import os
5
+
6
+ from mpflash.common import PORT_FWTYPES
7
+ from mpflash.flash.uf2 import waitfor_uf2
8
+ from mpflash.logger import log
9
+ from mpflash.mpremoteboard import MPRemoteBoard
10
+
11
+
12
+ def in_bootloader(mcu: MPRemoteBoard) -> bool:
13
+ """Check if the board is in bootloader mode"""
14
+ if ".uf2" in PORT_FWTYPES[mcu.port]:
15
+ return in_uf2_bootloader(mcu.port.upper())
16
+ elif mcu.port in ["stm32"]:
17
+ return in_stm32_bootloader()
18
+ elif mcu.port in ["esp32", "esp8266"]:
19
+ log.debug("esp32/esp8266 does not have a bootloader mode, Assume OK to flash")
20
+ return True
21
+
22
+ log.error(f"Bootloader mode not supported on {mcu.board} on {mcu.serialport}")
23
+ return False
24
+
25
+
26
+ def in_uf2_bootloader(board_id: str) -> bool:
27
+ """
28
+ Check if the board is in UF2 bootloader mode.
29
+
30
+ :param board_id: The board ID to check for (SAMD or RP2)
31
+ """
32
+ return bool(waitfor_uf2(board_id=board_id))
33
+
34
+
35
+ def in_stm32_bootloader() -> bool:
36
+ """Check if the board is in STM32 bootloader mode"""
37
+ if os.name == "nt":
38
+ driver_installed, status = check_for_stm32_bootloader_device()
39
+ if not driver_installed:
40
+ log.warning("STM32 BOOTLOADER device not found.")
41
+ return False
42
+ print()
43
+ if status != "OK":
44
+ log.warning(f"STM32 BOOTLOADER device found, Device status: {status}")
45
+ log.error("Please use Zadig to install a WinUSB (libusb) driver.\nhttps://github.com/pbatard/libwdi/wiki/Zadig")
46
+ return False
47
+ return check_dfu_devices()
48
+
49
+
50
+ def check_dfu_devices():
51
+ """Check if there are any DFU devices connected"""
52
+ # JIT import
53
+ from mpflash.flash.stm32_dfu import dfu_init
54
+ from mpflash.vendor.pydfu import get_dfu_devices
55
+
56
+ # need to init on windows to get the right usb backend
57
+ dfu_init()
58
+ devices = get_dfu_devices()
59
+ return len(devices) > 0
60
+
61
+
62
+ def check_for_stm32_bootloader_device():
63
+ import win32com.client
64
+
65
+ # Windows only
66
+ # Create a WMI interface object
67
+ wmi = win32com.client.GetObject("winmgmts:")
68
+
69
+ # Query for USB devices
70
+ for usb_device in wmi.InstancesOf("Win32_PnPEntity"):
71
+ try:
72
+ # Check if device name or description contains "STM32 BOOTLOADER"
73
+ if str(usb_device.Name).strip() in {
74
+ "STM32 BOOTLOADER",
75
+ "STM BOOTLOADER",
76
+ }:
77
+ # Just the first match is enough
78
+ return True, usb_device.Status
79
+ except Exception:
80
+ pass
81
+ # If no matching device was found
82
+ return False, "Not found."
@@ -12,13 +12,14 @@ from mpflash.mpremoteboard import MPRemoteBoard
12
12
 
13
13
 
14
14
  class MCUHighlighter(RegexHighlighter):
15
- """Apply style to anything that looks like an email."""
15
+ """Apply style to things that should stand out."""
16
16
 
17
17
  base_style = "mcu."
18
18
  highlights = [
19
19
  r"(?P<bold>Method[\s\d\:]*)",
20
20
  r"(?P<bold> \d.)", # numbered items
21
21
  r"(?P<bold> - )", # bullets
22
+ # mcu things
22
23
  r"(?P<pad>GPIO[\d]*)",
23
24
  r"(?P<pad>GPI[\d]*)",
24
25
  r"(?P<pad>IO[\d]*)",
@@ -33,21 +34,19 @@ class MCUHighlighter(RegexHighlighter):
33
34
  r"(?P<button>reset)",
34
35
  # other
35
36
  r"(?P<cable>USB)",
36
- # r"(?P<mcu>SAMD[\d]*)",
37
- # r"(?P<mcu>ESP[\d]*)",
38
- # r"(?P<mcu>rp2)",
39
- # r"(?P<mcu>rp2040)",
37
+ r"(?P<cable>USB-C)",
38
+ r"(?P<cable>Serial)",
40
39
  ]
41
40
 
42
41
 
43
42
  # https://rich.readthedocs.io/en/stable/appendix/colors.html?highlight=colors#standard-colors
43
+ # use 3 colors to keep things simple but clear
44
44
  mcu_theme = Theme(
45
45
  {
46
- "mcu.bold": "orange3",
47
- "mcu.mcu": "orange3",
48
- "mcu.button": "bold green",
49
- "mcu.pad": "dodger_blue2",
50
- "mcu.cable": "dodger_blue2",
46
+ "mcu.bold": "orange3", # readers guidance
47
+ "mcu.button": "bold green", # things to press
48
+ "mcu.pad": "dodger_blue2", # things to connect
49
+ "mcu.cable": "dodger_blue2", # things to connect
51
50
  }
52
51
  )
53
52
 
@@ -84,7 +83,7 @@ Please put your {mcu.port.upper()} device into bootloader mode by:
84
83
  """
85
84
 
86
85
  # todo: would be nice to re-use the console instance from logger
87
- console = Console(highlighter=MCUHighlighter(), theme=mcu_theme)
86
+ console = Console(highlighter=MCUHighlighter(), theme=mcu_theme) # type: ignore
88
87
  message += "\nIf you are unsure how to enter bootloader mode, please refer to the device documentation."
89
88
  console.print(
90
89
  Panel(
@@ -1,10 +1,12 @@
1
1
  """Module for handling the bootloader mode for micropython boards"""
2
2
 
3
+ from mpflash.logger import log
3
4
  from mpflash.mpremoteboard import MPRemoteBoard
4
5
 
5
6
 
6
7
  def enter_bootloader_mpy(mcu: MPRemoteBoard, timeout: int = 10):
7
8
  """Enter the bootloader mode for the board using mpremote and micropython on the board"""
9
+ log.info(f"Attempting bootloader on {mcu.serialport} using 'mpremote bootloader'")
8
10
  mcu.run_command("bootloader", timeout=timeout)
9
11
  # todo: check if mpremote command was successful
10
12
  return True
@@ -1,4 +1,8 @@
1
- import sys
1
+ """
2
+ Enter bootloader using Touch 1200Bd for boards with bootloaders that support this.
3
+
4
+ """
5
+
2
6
  import time
3
7
 
4
8
  import serial
@@ -7,32 +11,19 @@ from mpflash.errors import MPFlashError
7
11
  from mpflash.logger import log
8
12
  from mpflash.mpremoteboard import MPRemoteBoard
9
13
 
10
- from .manual import enter_bootloader_manual
11
-
12
14
 
13
- def enter_bootloader_cdc_1200bps(mcu: MPRemoteBoard, timeout: int = 10):
14
- if sys.platform == "win32":
15
- log.warning("Touch 1200bps method is currently not supported on Windows, switching to manual")
16
- return enter_bootloader_manual(mcu, timeout=timeout)
17
-
18
- log.info(f"Entering bootloader on {mcu.board} on {mcu.serialport} using CDC 1200bps")
19
- # if port argument is present perform soft reset
15
+ def enter_bootloader_touch_1200bps(mcu: MPRemoteBoard, timeout: int = 10):
20
16
  if not mcu.serialport:
21
17
  raise MPFlashError("No serial port specified")
18
+ log.info(f"Attempting bootloader on {mcu.serialport} using 'Touch 1200Bd'")
19
+ # if port argument is present perform soft reset
22
20
  # try to initiate serial port connection on PORT with 1200 baudrate
23
21
  try:
24
- with serial.Serial(
25
- port=mcu.serialport,
26
- baudrate=1200,
27
- parity=serial.PARITY_NONE,
28
- stopbits=serial.STOPBITS_ONE,
29
- bytesize=serial.EIGHTBITS,
30
- rtscts=True,
31
- ) as connection:
32
- print("Connection established")
33
- connection.rts = True
34
- connection.dtr = False
35
- time.sleep(0.4)
22
+ com = serial.Serial(mcu.serialport, 1200, dsrdtr=True)
23
+ com.rts = False # required
24
+ com.dtr = False # might as well
25
+ time.sleep(0.2)
26
+ com.close()
36
27
 
37
28
  except serial.SerialException as e:
38
29
  log.exception(e)
@@ -8,7 +8,7 @@ from loguru import logger as log
8
8
  from mpflash.connected import connected_ports_boards
9
9
  from mpflash.errors import MPFlashError
10
10
  from mpflash.mpboard_id import find_known_board
11
- from mpflash.vendor.versions import clean_version
11
+ from mpflash.versions import clean_version
12
12
 
13
13
  from .ask_input import ask_missing_params
14
14
  from .cli_group import cli
@@ -8,7 +8,7 @@ from mpflash.common import BootloaderMethod
8
8
  from mpflash.errors import MPFlashError
9
9
  from mpflash.mpboard_id import find_known_board
10
10
  from mpflash.mpremoteboard import MPRemoteBoard
11
- from mpflash.vendor.versions import clean_version
11
+ from mpflash.versions import clean_version
12
12
 
13
13
  from .ask_input import ask_missing_params
14
14
  from .cli_download import connected_ports_boards
@@ -17,7 +17,7 @@ from .cli_list import show_mcus
17
17
  from .common import FlashParams
18
18
  from .config import config
19
19
  from .flash import flash_list
20
- from .worklist import (WorkList, full_auto_worklist, manual_worklist,
20
+ from .flash.worklist import (WorkList, full_auto_worklist, manual_worklist,
21
21
  single_auto_worklist)
22
22
 
23
23
  # #########################################################################################################
@@ -103,10 +103,10 @@ from .worklist import (WorkList, full_auto_worklist, manual_worklist,
103
103
  )
104
104
  @click.option(
105
105
  "--bootloader",
106
- "-b",
106
+ "-bl",
107
107
  "bootloader",
108
108
  type=click.Choice([e.value for e in BootloaderMethod]),
109
- default="mpy",
109
+ default="auto",
110
110
  show_default=True,
111
111
  help="""How to enter the (MicroPython) bootloader before flashing.""",
112
112
  )