esptool 4.9.dev7__tar.gz → 5.0.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.
Files changed (233) hide show
  1. {esptool-4.9.dev7 → esptool-5.0.0}/MANIFEST.in +1 -1
  2. {esptool-4.9.dev7/esptool.egg-info → esptool-5.0.0}/PKG-INFO +15 -15
  3. {esptool-4.9.dev7 → esptool-5.0.0}/README.md +5 -5
  4. {esptool-4.9.dev7 → esptool-5.0.0}/esp_rfc2217_server/__init__.py +7 -2
  5. {esptool-4.9.dev7 → esptool-5.0.0}/esp_rfc2217_server/esp_port_manager.py +1 -1
  6. {esptool-4.9.dev7 → esptool-5.0.0}/esp_rfc2217_server.py +1 -1
  7. esptool-5.0.0/espefuse/__init__.py +233 -0
  8. esptool-5.0.0/espefuse/cli_util.py +246 -0
  9. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/base_fields.py +220 -140
  10. esptool-5.0.0/espefuse/efuse/base_operations.py +1181 -0
  11. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/csv_table_parser.py +8 -3
  12. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/emulate_efuse_controller_base.py +2 -1
  13. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32/__init__.py +2 -0
  14. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32/emulate_efuse_controller.py +5 -6
  15. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32/fields.py +14 -23
  16. esptool-5.0.0/espefuse/efuse/esp32/operations.py +327 -0
  17. {esptool-4.9.dev7/espefuse/efuse/esp32c3 → esptool-5.0.0/espefuse/efuse/esp32c2}/__init__.py +2 -0
  18. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c2/fields.py +24 -30
  19. esptool-5.0.0/espefuse/efuse/esp32c2/operations.py +292 -0
  20. {esptool-4.9.dev7/espefuse/efuse/esp32c2 → esptool-5.0.0/espefuse/efuse/esp32c3}/__init__.py +2 -0
  21. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c3/fields.py +28 -34
  22. esptool-5.0.0/espefuse/efuse/esp32c3/operations.py +310 -0
  23. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c5/__init__.py +2 -0
  24. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c5/fields.py +79 -38
  25. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c5/mem_definition.py +29 -9
  26. esptool-5.0.0/espefuse/efuse/esp32c5/operations.py +317 -0
  27. esptool-5.0.0/espefuse/efuse/esp32c6/__init__.py +5 -0
  28. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c6/fields.py +25 -32
  29. esptool-5.0.0/espefuse/efuse/esp32c6/operations.py +315 -0
  30. esptool-5.0.0/espefuse/efuse/esp32c61/__init__.py +5 -0
  31. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c61/fields.py +26 -32
  32. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c61/mem_definition.py +1 -2
  33. esptool-5.0.0/espefuse/efuse/esp32c61/operations.py +316 -0
  34. esptool-5.0.0/espefuse/efuse/esp32h2/__init__.py +5 -0
  35. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32h2/fields.py +22 -28
  36. esptool-5.0.0/espefuse/efuse/esp32h2/operations.py +334 -0
  37. esptool-5.0.0/espefuse/efuse/esp32h21/__init__.py +5 -0
  38. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32h21/fields.py +22 -28
  39. esptool-5.0.0/espefuse/efuse/esp32h21/operations.py +313 -0
  40. esptool-5.0.0/espefuse/efuse/esp32h4/__init__.py +5 -0
  41. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32h4/fields.py +22 -28
  42. esptool-5.0.0/espefuse/efuse/esp32h4/operations.py +305 -0
  43. esptool-5.0.0/espefuse/efuse/esp32p4/__init__.py +5 -0
  44. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32p4/fields.py +39 -32
  45. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32p4/mem_definition.py +12 -2
  46. esptool-5.0.0/espefuse/efuse/esp32p4/operations.py +318 -0
  47. esptool-5.0.0/espefuse/efuse/esp32s2/__init__.py +5 -0
  48. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32s2/fields.py +23 -29
  49. esptool-5.0.0/espefuse/efuse/esp32s2/operations.py +384 -0
  50. esptool-5.0.0/espefuse/efuse/esp32s3/__init__.py +5 -0
  51. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32s3/fields.py +28 -33
  52. esptool-5.0.0/espefuse/efuse/esp32s3/operations.py +388 -0
  53. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/mem_definition_base.py +6 -6
  54. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/util.py +1 -3
  55. esptool-5.0.0/espefuse/efuse_defs/esp32c5.yaml +123 -0
  56. esptool-5.0.0/espefuse/efuse_defs/esp32c61.yaml +105 -0
  57. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse_defs/esp32p4.yaml +3 -3
  58. esptool-5.0.0/espefuse/efuse_interface.py +197 -0
  59. {esptool-4.9.dev7 → esptool-5.0.0}/espsecure/__init__.py +819 -772
  60. {esptool-4.9.dev7 → esptool-5.0.0}/espsecure/esp_hsm_sign/__init__.py +49 -36
  61. {esptool-4.9.dev7 → esptool-5.0.0}/espsecure/esp_hsm_sign/exceptions.py +19 -15
  62. esptool-5.0.0/esptool/__init__.py +1205 -0
  63. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/bin_image.py +284 -214
  64. esptool-5.0.0/esptool/cli_util.py +428 -0
  65. esptool-5.0.0/esptool/cmds.py +2345 -0
  66. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/config.py +6 -4
  67. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/loader.py +437 -261
  68. esptool-5.0.0/esptool/logger.py +273 -0
  69. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/reset.py +7 -6
  70. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/__init__.py +0 -10
  71. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp32.py +30 -50
  72. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp32c2.py +15 -24
  73. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp32c3.py +15 -31
  74. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp32c5.py +57 -34
  75. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp32c6.py +18 -32
  76. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp32c61.py +9 -22
  77. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp32h2.py +11 -26
  78. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp32h21.py +10 -21
  79. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp32h4.py +9 -21
  80. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp32p4.py +17 -32
  81. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp32s2.py +17 -36
  82. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp32s3.py +19 -33
  83. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/esp8266.py +6 -29
  84. esptool-5.0.0/esptool/targets/stub_flasher/1/.DS_Store +0 -0
  85. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/stub_flasher/1/README.md +1 -1
  86. esptool-5.0.0/esptool/targets/stub_flasher/1/esp32.json +8 -0
  87. esptool-5.0.0/esptool/targets/stub_flasher/1/esp32c2.json +8 -0
  88. esptool-5.0.0/esptool/targets/stub_flasher/1/esp32c3.json +8 -0
  89. esptool-5.0.0/esptool/targets/stub_flasher/1/esp32c5.json +8 -0
  90. esptool-5.0.0/esptool/targets/stub_flasher/1/esp32c6.json +8 -0
  91. esptool-5.0.0/esptool/targets/stub_flasher/1/esp32c61.json +8 -0
  92. esptool-5.0.0/esptool/targets/stub_flasher/1/esp32h2.json +8 -0
  93. esptool-5.0.0/esptool/targets/stub_flasher/1/esp32p4.json +8 -0
  94. esptool-5.0.0/esptool/targets/stub_flasher/1/esp32s2.json +8 -0
  95. esptool-5.0.0/esptool/targets/stub_flasher/1/esp32s3.json +8 -0
  96. esptool-5.0.0/esptool/targets/stub_flasher/2/LICENSE-APACHE +201 -0
  97. esptool-5.0.0/esptool/targets/stub_flasher/2/LICENSE-MIT +21 -0
  98. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/stub_flasher/2/README.md +1 -1
  99. esptool-5.0.0/esptool/targets/stub_flasher/2/esp32.json +5 -0
  100. esptool-5.0.0/esptool/targets/stub_flasher/2/esp32c2.json +5 -0
  101. esptool-5.0.0/esptool/targets/stub_flasher/2/esp32c3.json +5 -0
  102. esptool-5.0.0/esptool/targets/stub_flasher/2/esp32c5.json +5 -0
  103. esptool-5.0.0/esptool/targets/stub_flasher/2/esp32c6.json +5 -0
  104. esptool-5.0.0/esptool/targets/stub_flasher/2/esp32c61.json +5 -0
  105. esptool-5.0.0/esptool/targets/stub_flasher/2/esp32h2.json +5 -0
  106. esptool-5.0.0/esptool/targets/stub_flasher/2/esp32p4.json +5 -0
  107. esptool-5.0.0/esptool/targets/stub_flasher/2/esp32s2.json +5 -0
  108. esptool-5.0.0/esptool/targets/stub_flasher/2/esp32s3.json +5 -0
  109. esptool-5.0.0/esptool/targets/stub_flasher/2/esp8266.json +5 -0
  110. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/uf2_writer.py +4 -6
  111. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/util.py +68 -25
  112. {esptool-4.9.dev7 → esptool-5.0.0/esptool.egg-info}/PKG-INFO +15 -15
  113. {esptool-4.9.dev7 → esptool-5.0.0}/esptool.egg-info/SOURCES.txt +11 -27
  114. esptool-5.0.0/esptool.egg-info/entry_points.txt +5 -0
  115. {esptool-4.9.dev7 → esptool-5.0.0}/esptool.egg-info/requires.txt +8 -6
  116. {esptool-4.9.dev7 → esptool-5.0.0}/esptool.egg-info/top_level.txt +2 -0
  117. {esptool-4.9.dev7 → esptool-5.0.0}/pyproject.toml +16 -30
  118. esptool-5.0.0/setup.py +34 -0
  119. esptool-4.9.dev7/espefuse/__init__.py +0 -371
  120. esptool-4.9.dev7/espefuse/efuse/base_operations.py +0 -804
  121. esptool-4.9.dev7/espefuse/efuse/esp32/operations.py +0 -365
  122. esptool-4.9.dev7/espefuse/efuse/esp32c2/operations.py +0 -349
  123. esptool-4.9.dev7/espefuse/efuse/esp32c3/operations.py +0 -402
  124. esptool-4.9.dev7/espefuse/efuse/esp32c5/operations.py +0 -399
  125. esptool-4.9.dev7/espefuse/efuse/esp32c5beta3/__init__.py +0 -3
  126. esptool-4.9.dev7/espefuse/efuse/esp32c5beta3/emulate_efuse_controller.py +0 -92
  127. esptool-4.9.dev7/espefuse/efuse/esp32c5beta3/fields.py +0 -464
  128. esptool-4.9.dev7/espefuse/efuse/esp32c5beta3/mem_definition.py +0 -165
  129. esptool-4.9.dev7/espefuse/efuse/esp32c5beta3/operations.py +0 -395
  130. esptool-4.9.dev7/espefuse/efuse/esp32c6/__init__.py +0 -3
  131. esptool-4.9.dev7/espefuse/efuse/esp32c6/operations.py +0 -409
  132. esptool-4.9.dev7/espefuse/efuse/esp32c61/__init__.py +0 -3
  133. esptool-4.9.dev7/espefuse/efuse/esp32c61/operations.py +0 -466
  134. esptool-4.9.dev7/espefuse/efuse/esp32h2/__init__.py +0 -3
  135. esptool-4.9.dev7/espefuse/efuse/esp32h2/operations.py +0 -424
  136. esptool-4.9.dev7/espefuse/efuse/esp32h21/__init__.py +0 -3
  137. esptool-4.9.dev7/espefuse/efuse/esp32h21/operations.py +0 -406
  138. esptool-4.9.dev7/espefuse/efuse/esp32h2beta1/__init__.py +0 -3
  139. esptool-4.9.dev7/espefuse/efuse/esp32h2beta1/emulate_efuse_controller.py +0 -92
  140. esptool-4.9.dev7/espefuse/efuse/esp32h2beta1/fields.py +0 -465
  141. esptool-4.9.dev7/espefuse/efuse/esp32h2beta1/mem_definition.py +0 -152
  142. esptool-4.9.dev7/espefuse/efuse/esp32h2beta1/operations.py +0 -405
  143. esptool-4.9.dev7/espefuse/efuse/esp32h4/__init__.py +0 -3
  144. esptool-4.9.dev7/espefuse/efuse/esp32h4/operations.py +0 -389
  145. esptool-4.9.dev7/espefuse/efuse/esp32p4/__init__.py +0 -3
  146. esptool-4.9.dev7/espefuse/efuse/esp32p4/operations.py +0 -466
  147. esptool-4.9.dev7/espefuse/efuse/esp32s2/__init__.py +0 -3
  148. esptool-4.9.dev7/espefuse/efuse/esp32s2/operations.py +0 -519
  149. esptool-4.9.dev7/espefuse/efuse/esp32s3/__init__.py +0 -3
  150. esptool-4.9.dev7/espefuse/efuse/esp32s3/operations.py +0 -520
  151. esptool-4.9.dev7/espefuse/efuse/esp32s3beta2/__init__.py +0 -3
  152. esptool-4.9.dev7/espefuse/efuse/esp32s3beta2/emulate_efuse_controller.py +0 -92
  153. esptool-4.9.dev7/espefuse/efuse/esp32s3beta2/fields.py +0 -489
  154. esptool-4.9.dev7/espefuse/efuse/esp32s3beta2/mem_definition.py +0 -167
  155. esptool-4.9.dev7/espefuse/efuse/esp32s3beta2/operations.py +0 -519
  156. esptool-4.9.dev7/espefuse/efuse_defs/esp32c5.yaml +0 -120
  157. esptool-4.9.dev7/espefuse/efuse_defs/esp32c5beta3.yaml +0 -104
  158. esptool-4.9.dev7/espefuse/efuse_defs/esp32c61.yaml +0 -95
  159. esptool-4.9.dev7/esptool/__init__.py +0 -1378
  160. esptool-4.9.dev7/esptool/cmds.py +0 -1569
  161. esptool-4.9.dev7/esptool/targets/esp32c5beta3.py +0 -126
  162. esptool-4.9.dev7/esptool/targets/esp32c6beta.py +0 -25
  163. esptool-4.9.dev7/esptool/targets/esp32h2beta1.py +0 -184
  164. esptool-4.9.dev7/esptool/targets/esp32h2beta2.py +0 -41
  165. esptool-4.9.dev7/esptool/targets/esp32s3beta2.py +0 -35
  166. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32.json +0 -8
  167. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32c2.json +0 -8
  168. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32c3.json +0 -8
  169. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32c5.json +0 -8
  170. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32c5beta3.json +0 -8
  171. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32c6.json +0 -8
  172. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32c61.json +0 -8
  173. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32c6beta.json +0 -8
  174. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32h2.json +0 -8
  175. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32h2beta1.json +0 -8
  176. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32h2beta2.json +0 -8
  177. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32p4.json +0 -8
  178. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32s2.json +0 -8
  179. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32s3.json +0 -8
  180. esptool-4.9.dev7/esptool/targets/stub_flasher/1/esp32s3beta2.json +0 -8
  181. esptool-4.9.dev7/esptool/targets/stub_flasher/2/LICENSE-APACHE +0 -201
  182. esptool-4.9.dev7/esptool/targets/stub_flasher/2/LICENSE-MIT +0 -25
  183. esptool-4.9.dev7/esptool/targets/stub_flasher/2/esp32.json +0 -1
  184. esptool-4.9.dev7/esptool/targets/stub_flasher/2/esp32c2.json +0 -1
  185. esptool-4.9.dev7/esptool/targets/stub_flasher/2/esp32c3.json +0 -1
  186. esptool-4.9.dev7/esptool/targets/stub_flasher/2/esp32c6.json +0 -1
  187. esptool-4.9.dev7/esptool/targets/stub_flasher/2/esp32h2.json +0 -1
  188. esptool-4.9.dev7/esptool/targets/stub_flasher/2/esp32s2.json +0 -1
  189. esptool-4.9.dev7/esptool/targets/stub_flasher/2/esp32s3.json +0 -1
  190. esptool-4.9.dev7/setup.py +0 -21
  191. {esptool-4.9.dev7 → esptool-5.0.0}/LICENSE +0 -0
  192. {esptool-4.9.dev7 → esptool-5.0.0}/esp_rfc2217_server/__main__.py +0 -0
  193. {esptool-4.9.dev7 → esptool-5.0.0}/esp_rfc2217_server/redirector.py +0 -0
  194. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/__main__.py +0 -0
  195. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/__init__.py +0 -0
  196. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32/mem_definition.py +0 -0
  197. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c2/emulate_efuse_controller.py +0 -0
  198. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c2/mem_definition.py +0 -0
  199. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c3/emulate_efuse_controller.py +0 -0
  200. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c3/mem_definition.py +0 -0
  201. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c5/emulate_efuse_controller.py +0 -0
  202. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c6/emulate_efuse_controller.py +0 -0
  203. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c6/mem_definition.py +0 -0
  204. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32c61/emulate_efuse_controller.py +0 -0
  205. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32h2/emulate_efuse_controller.py +0 -0
  206. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32h2/mem_definition.py +0 -0
  207. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32h21/emulate_efuse_controller.py +0 -0
  208. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32h21/mem_definition.py +0 -0
  209. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32h4/emulate_efuse_controller.py +0 -0
  210. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32h4/mem_definition.py +0 -0
  211. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32p4/emulate_efuse_controller.py +0 -0
  212. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32s2/emulate_efuse_controller.py +0 -0
  213. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32s2/mem_definition.py +0 -0
  214. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32s3/emulate_efuse_controller.py +0 -0
  215. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse/esp32s3/mem_definition.py +0 -0
  216. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse_defs/esp32.yaml +0 -0
  217. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse_defs/esp32c2.yaml +0 -0
  218. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse_defs/esp32c3.yaml +0 -0
  219. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse_defs/esp32c6.yaml +0 -0
  220. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse_defs/esp32h2.yaml +0 -0
  221. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse_defs/esp32h21.yaml +0 -0
  222. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse_defs/esp32h2_v0.0_v1.1.yaml +0 -0
  223. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse_defs/esp32h4.yaml +0 -0
  224. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse_defs/esp32s2.yaml +0 -0
  225. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse/efuse_defs/esp32s3.yaml +0 -0
  226. {esptool-4.9.dev7 → esptool-5.0.0}/espefuse.py +0 -0
  227. {esptool-4.9.dev7 → esptool-5.0.0}/espsecure/__main__.py +0 -0
  228. {esptool-4.9.dev7 → esptool-5.0.0}/espsecure.py +0 -0
  229. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/__main__.py +0 -0
  230. {esptool-4.9.dev7 → esptool-5.0.0}/esptool/targets/stub_flasher/1/esp8266.json +0 -0
  231. {esptool-4.9.dev7 → esptool-5.0.0}/esptool.egg-info/dependency_links.txt +0 -0
  232. {esptool-4.9.dev7 → esptool-5.0.0}/esptool.py +0 -0
  233. {esptool-4.9.dev7 → esptool-5.0.0}/setup.cfg +0 -0
@@ -3,7 +3,7 @@ include LICENSE
3
3
  include esptool/targets/stub_flasher/1/*
4
4
  include esptool/targets/stub_flasher/2/*
5
5
  include espefuse/efuse_defs/*.yaml
6
- # sdist includes test/test*.py by default, but esptool.py tests
6
+ # sdist includes test/test*.py by default, but esptool tests
7
7
  # are so far only intended to run from the git repo itself
8
8
  prune test
9
9
  prune .github
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: esptool
3
- Version: 4.9.dev7
4
- Summary: A serial utility to communicate & flash code to Espressif chips.
3
+ Version: 5.0.0
4
+ Summary: A serial utility for flashing, provisioning, and interacting with Espressif SoCs.
5
5
  Author: Fredrik Ahlberg (themadinventor), Angus Gratton (projectgus), Espressif Systems
6
6
  License: GPLv2+
7
7
  Project-URL: Homepage, https://github.com/espressif/esptool/
@@ -18,24 +18,21 @@ Classifier: Operating System :: MacOS :: MacOS X
18
18
  Classifier: Topic :: Software Development :: Embedded Systems
19
19
  Classifier: Environment :: Console
20
20
  Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
21
- Classifier: Programming Language :: Python :: 3.7
22
- Classifier: Programming Language :: Python :: 3.8
23
- Classifier: Programming Language :: Python :: 3.9
24
21
  Classifier: Programming Language :: Python :: 3.10
25
22
  Classifier: Programming Language :: Python :: 3.11
26
23
  Classifier: Programming Language :: Python :: 3.12
27
24
  Classifier: Programming Language :: Python :: 3.13
28
- Requires-Python: >=3.7
25
+ Requires-Python: >=3.10
29
26
  Description-Content-Type: text/markdown
30
27
  License-File: LICENSE
31
28
  Requires-Dist: bitstring!=4.2.0,>=3.1.6
32
- Requires-Dist: cryptography>=2.1.4
33
- Requires-Dist: ecdsa>=0.16.0
29
+ Requires-Dist: cryptography>=43.0.0
34
30
  Requires-Dist: pyserial>=3.3
35
31
  Requires-Dist: reedsolo<1.8,>=1.5.3
36
32
  Requires-Dist: PyYAML>=5.1
37
33
  Requires-Dist: intelhex
38
- Requires-Dist: argcomplete>=3; sys_platform != "win32"
34
+ Requires-Dist: rich_click
35
+ Requires-Dist: click<8.2.0
39
36
  Provides-Extra: dev
40
37
  Requires-Dist: pyelftools; extra == "dev"
41
38
  Requires-Dist: coverage~=6.0; extra == "dev"
@@ -43,28 +40,31 @@ Requires-Dist: pre-commit; extra == "dev"
43
40
  Requires-Dist: pytest; extra == "dev"
44
41
  Requires-Dist: pytest-rerunfailures; extra == "dev"
45
42
  Requires-Dist: requests; extra == "dev"
46
- Requires-Dist: commitizen; extra == "dev"
43
+ Requires-Dist: czespressif; extra == "dev"
47
44
  Provides-Extra: hsm
48
45
  Requires-Dist: python-pkcs11; extra == "hsm"
46
+ Provides-Extra: docs
47
+ Requires-Dist: esp-docs~=1.10; extra == "docs"
48
+ Requires-Dist: sphinx-tabs; extra == "docs"
49
49
  Dynamic: license-file
50
50
 
51
- # esptool.py
51
+ # esptool
52
52
 
53
- A Python-based, open-source, platform-independent utility to communicate with the ROM bootloader in Espressif chips.
53
+ A Python-based, open-source, platform-independent serial utility for flashing, provisioning, and interacting with Espressif SoCs.
54
54
 
55
55
  [![Test esptool](https://github.com/espressif/esptool/actions/workflows/test_esptool.yml/badge.svg?branch=master)](https://github.com/espressif/esptool/actions/workflows/test_esptool.yml) [![Build esptool](https://github.com/espressif/esptool/actions/workflows/build_esptool.yml/badge.svg?branch=master)](https://github.com/espressif/esptool/actions/workflows/build_esptool.yml)
56
56
 
57
57
  ## Documentation
58
58
 
59
- Visit the [documentation](https://docs.espressif.com/projects/esptool/) or run `esptool.py -h`.
59
+ Visit the [documentation](https://docs.espressif.com/projects/esptool/) or run `esptool -h`.
60
60
 
61
61
  ## Contribute
62
62
 
63
- If you're interested in contributing to esptool.py, please check the [contributions guide](https://docs.espressif.com/projects/esptool/en/latest/contributing.html).
63
+ If you're interested in contributing to esptool, please check the [contributions guide](https://docs.espressif.com/projects/esptool/en/latest/contributing.html).
64
64
 
65
65
  ## About
66
66
 
67
- esptool.py was initially created by Fredrik Ahlberg (@[themadinventor](https://github.com/themadinventor/)), and later maintained by Angus Gratton (@[projectgus](https://github.com/projectgus/)). It is now supported by Espressif Systems. It has also received improvements from many members of the community.
67
+ esptool was initially created by Fredrik Ahlberg (@[themadinventor](https://github.com/themadinventor/)), and later maintained by Angus Gratton (@[projectgus](https://github.com/projectgus/)). It is now supported by Espressif Systems. It has also received improvements from many members of the community.
68
68
 
69
69
  ## License
70
70
 
@@ -1,20 +1,20 @@
1
- # esptool.py
1
+ # esptool
2
2
 
3
- A Python-based, open-source, platform-independent utility to communicate with the ROM bootloader in Espressif chips.
3
+ A Python-based, open-source, platform-independent serial utility for flashing, provisioning, and interacting with Espressif SoCs.
4
4
 
5
5
  [![Test esptool](https://github.com/espressif/esptool/actions/workflows/test_esptool.yml/badge.svg?branch=master)](https://github.com/espressif/esptool/actions/workflows/test_esptool.yml) [![Build esptool](https://github.com/espressif/esptool/actions/workflows/build_esptool.yml/badge.svg?branch=master)](https://github.com/espressif/esptool/actions/workflows/build_esptool.yml)
6
6
 
7
7
  ## Documentation
8
8
 
9
- Visit the [documentation](https://docs.espressif.com/projects/esptool/) or run `esptool.py -h`.
9
+ Visit the [documentation](https://docs.espressif.com/projects/esptool/) or run `esptool -h`.
10
10
 
11
11
  ## Contribute
12
12
 
13
- If you're interested in contributing to esptool.py, please check the [contributions guide](https://docs.espressif.com/projects/esptool/en/latest/contributing.html).
13
+ If you're interested in contributing to esptool, please check the [contributions guide](https://docs.espressif.com/projects/esptool/en/latest/contributing.html).
14
14
 
15
15
  ## About
16
16
 
17
- esptool.py was initially created by Fredrik Ahlberg (@[themadinventor](https://github.com/themadinventor/)), and later maintained by Angus Gratton (@[projectgus](https://github.com/projectgus/)). It is now supported by Espressif Systems. It has also received improvements from many members of the community.
17
+ esptool was initially created by Fredrik Ahlberg (@[themadinventor](https://github.com/themadinventor/)), and later maintained by Angus Gratton (@[projectgus](https://github.com/projectgus/)). It is now supported by Espressif Systems. It has also received improvements from many members of the community.
18
18
 
19
19
  ## License
20
20
 
@@ -18,9 +18,11 @@ import sys
18
18
  import serial
19
19
 
20
20
  from esp_rfc2217_server.redirector import Redirector
21
+ from esptool.util import check_deprecated_py_suffix
21
22
 
22
23
 
23
24
  def main():
25
+ check_deprecated_py_suffix("esp_rfc2217_server")
24
26
  import argparse
25
27
 
26
28
  parser = argparse.ArgumentParser(
@@ -92,7 +94,10 @@ def main():
92
94
  logging.info(f"TCP/IP port: {args.localport}")
93
95
 
94
96
  host_ip = socket.gethostbyname(socket.gethostname())
95
- wait_msg = f"Waiting for connection ... use the 'rfc2217://{host_ip}:{args.localport}?ign_set_control' as a PORT"
97
+ wait_msg = (
98
+ "Waiting for connection ... use the 'rfc2217://"
99
+ f"{host_ip}:{args.localport}?ign_set_control' as a PORT"
100
+ )
96
101
  logging.info(wait_msg)
97
102
 
98
103
  while True:
@@ -127,7 +132,7 @@ def main():
127
132
  # capable client)
128
133
  ser.apply_settings(settings)
129
134
  except KeyboardInterrupt:
130
- sys.stdout.write("\n")
135
+ print(flush=True)
131
136
  break
132
137
  except socket.error as msg:
133
138
  logging.error(str(msg))
@@ -82,7 +82,7 @@ class EspPortManager(serial.rfc2217.PortManager):
82
82
 
83
83
  def _reset_thread(self):
84
84
  """
85
- The reset logic is used from esptool.py because the RTS and DTR signals
85
+ The reset logic is used from esptool because the RTS and DTR signals
86
86
  cannot be retransmitted through RFC 2217 with proper timing.
87
87
  """
88
88
  if self.logger:
@@ -26,7 +26,7 @@
26
26
  # Esptool can connect to the ESP device through that server as it is
27
27
  # demonstrated in the following example:
28
28
  #
29
- # esptool.py --port rfc2217://localhost:4000?ign_set_control flash_id
29
+ # esptool --port rfc2217://localhost:4000?ign_set_control flash-id
30
30
  #
31
31
 
32
32
  import contextlib
@@ -0,0 +1,233 @@
1
+ # SPDX-FileCopyrightText: 2016-2025 Espressif Systems (Shanghai) CO LTD
2
+ #
3
+ # SPDX-License-Identifier: GPL-2.0-or-later
4
+
5
+ import sys
6
+
7
+ import rich_click as click
8
+
9
+ import esptool
10
+ from esptool.cli_util import ChipType, ResetModeType
11
+ from esptool.logger import log
12
+
13
+ from espefuse.cli_util import Group
14
+ from espefuse.efuse.base_operations import BaseCommands
15
+ from espefuse.efuse_interface import (
16
+ DEPRECATED_COMMANDS,
17
+ get_esp,
18
+ init_commands,
19
+ SUPPORTED_COMMANDS,
20
+ SUPPORTED_BURN_COMMANDS,
21
+ SUPPORTED_READ_COMMANDS,
22
+ SUPPORTED_CHIPS,
23
+ )
24
+ from esptool.util import check_deprecated_py_suffix
25
+
26
+ __all__ = [
27
+ "get_esp",
28
+ "init_commands",
29
+ "BaseCommands",
30
+ "SUPPORTED_COMMANDS",
31
+ "SUPPORTED_CHIPS",
32
+ "SUPPORTED_BURN_COMMANDS",
33
+ "SUPPORTED_READ_COMMANDS",
34
+ ]
35
+
36
+
37
+ @click.group(
38
+ cls=Group,
39
+ chain=True, # allow using multiple commands in a single run
40
+ no_args_is_help=True,
41
+ context_settings=dict(help_option_names=["-h", "--help"], max_content_width=120),
42
+ help=f"espefuse v{esptool.__version__} - "
43
+ "Utility for eFuse configuration in Espressif SoCs.",
44
+ )
45
+ @click.option(
46
+ "--chip",
47
+ "-c",
48
+ type=ChipType(choices=["auto"] + list(SUPPORTED_CHIPS.keys())),
49
+ default="auto",
50
+ envvar="ESPTOOL_CHIP",
51
+ help="Target chip type.",
52
+ )
53
+ @click.option(
54
+ "--baud",
55
+ "-b",
56
+ type=int,
57
+ default=esptool.ESPLoader.ESP_ROM_BAUD,
58
+ envvar="ESPTOOL_BAUD",
59
+ help="Serial port baud rate used when flashing/reading.",
60
+ )
61
+ @click.option(
62
+ "--port",
63
+ "-p",
64
+ envvar="ESPTOOL_PORT",
65
+ type=click.Path(),
66
+ help="Serial port device.",
67
+ )
68
+ @click.option(
69
+ "--before",
70
+ type=ResetModeType(
71
+ choices=["default-reset", "usb-reset", "no-reset", "no-reset-no-sync"]
72
+ ),
73
+ default="default-reset",
74
+ help="Which reset to perform before connecting to the chip.",
75
+ )
76
+ @click.option(
77
+ "--debug", "-d", is_flag=True, help="Show debugging information (loglevel=DEBUG)."
78
+ )
79
+ @click.option(
80
+ "--virt",
81
+ is_flag=True,
82
+ help="For host tests, work in virtual mode (no chip connection).",
83
+ )
84
+ @click.option(
85
+ "--path-efuse-file",
86
+ type=click.Path(),
87
+ help="For host tests, save eFuse memory to file.",
88
+ )
89
+ @click.option(
90
+ "--do-not-confirm",
91
+ is_flag=True,
92
+ help="Do not pause for confirmation before permanently writing eFuses. "
93
+ "Use with caution!",
94
+ )
95
+ @click.option(
96
+ "--postpone",
97
+ is_flag=True,
98
+ help="Postpone burning some eFuses from BLOCK0 at the end.",
99
+ )
100
+ @click.option(
101
+ "--extend-efuse-table",
102
+ type=click.File("r"),
103
+ help="CSV file from ESP-IDF (esp_efuse_custom_table.csv).",
104
+ )
105
+ @click.pass_context
106
+ def cli(
107
+ ctx,
108
+ chip,
109
+ baud,
110
+ port,
111
+ before,
112
+ debug,
113
+ virt,
114
+ path_efuse_file,
115
+ do_not_confirm,
116
+ postpone,
117
+ extend_efuse_table,
118
+ ):
119
+ log.print(f"espefuse v{esptool.__version__}")
120
+
121
+ ctx.ensure_object(dict)
122
+ esp = ctx.obj.get("esp", None)
123
+ external_esp = esp is not None
124
+ is_help = ctx.obj.get("is_help", False)
125
+ used_cmds = ctx.obj.get("used_cmds", [])
126
+
127
+ if any(cmd.replace("_", "-") in DEPRECATED_COMMANDS for cmd in used_cmds):
128
+ return # do not connect to ESP if any command is deprecated
129
+
130
+ if not port and not external_esp and not is_help and not virt:
131
+ raise click.BadOptionUsage(
132
+ "--port", "Missing required argument. Please specify the --port option."
133
+ )
134
+
135
+ if not esp:
136
+ try:
137
+ esp = get_esp(
138
+ port, baud, before, chip, is_help, virt, debug, path_efuse_file
139
+ )
140
+ except esptool.FatalError as e:
141
+ raise esptool.FatalError(
142
+ f"{e}\nPlease make sure you specified the right port with --port."
143
+ )
144
+
145
+ def close_port():
146
+ if not external_esp and not virt and esp._port:
147
+ esp._port.close()
148
+
149
+ ctx.call_on_close(close_port)
150
+
151
+ # handle chip auto
152
+ if chip == "auto":
153
+ if ctx.obj.get("is_help", False):
154
+ log.note(
155
+ "Chip not specified, showing commands for ESP32 by default. "
156
+ "Specify the --chip option to get chip-specific help."
157
+ )
158
+ chip = esp.CHIP_NAME.lower()
159
+
160
+ commands = init_commands(
161
+ esp=esp,
162
+ skip_connect=is_help,
163
+ debug=debug,
164
+ do_not_confirm=do_not_confirm,
165
+ extend_efuse_table=extend_efuse_table,
166
+ )
167
+ commands.efuses.postpone = postpone
168
+ commands.add_cli_commands(cli)
169
+
170
+ multiple_burn_commands = (
171
+ sum(cmd.replace("_", "-") in SUPPORTED_BURN_COMMANDS for cmd in used_cmds) > 1
172
+ )
173
+ if multiple_burn_commands:
174
+ commands.use_batch_mode()
175
+
176
+ # Add the objects to the context
177
+ ctx.obj["debug"] = debug
178
+ ctx.obj["commands"] = commands
179
+ ctx.obj["efuses"] = commands.efuses
180
+ ctx.obj["do_not_confirm"] = do_not_confirm
181
+
182
+ @cli.result_callback()
183
+ def process_result(result, *args, **kwargs):
184
+ if multiple_burn_commands:
185
+ if not commands.burn_all(check_batch_mode=True):
186
+ raise esptool.FatalError("BURN was not done.")
187
+ log.print("Successful.")
188
+
189
+
190
+ @cli.command("execute-scripts", hidden=True)
191
+ @click.argument("scripts", nargs=-1, type=click.UNPROCESSED)
192
+ @click.option("--index", type=click.UNPROCESSED)
193
+ @click.option("--configfiles", type=click.UNPROCESSED)
194
+ def execute_scripts_cli(scripts, index, configfiles):
195
+ """REMOVED: See Migration guide in documentation for details."""
196
+ log.error(
197
+ "REMOVED: `execute_scripts` was replaced with the public API in v5. "
198
+ "Please see Migration Guide in documentation for details: "
199
+ "https://docs.espressif.com/projects/esptool/en/latest/migration-guide.html#espefuse-py-v5-migration-guide"
200
+ )
201
+ sys.exit(2)
202
+
203
+
204
+ def main(argv: list[str] | None = None, esp: esptool.ESPLoader | None = None):
205
+ """
206
+ Main function for espefuse
207
+
208
+ argv - Optional override for default arguments parsing
209
+ (that uses sys.argv), can be a list of custom arguments as strings.
210
+ Arguments and their values need to be added as individual items to the list
211
+ e.g. "--port /dev/ttyUSB1" thus becomes ['--port', '/dev/ttyUSB1'].
212
+
213
+ esp - Optional override of the connected device previously
214
+ returned by esptool.get_default_connected_device()
215
+ """
216
+ args = esptool.expand_file_arguments(argv or sys.argv[1:])
217
+ cli(args=args, esp=esp)
218
+
219
+
220
+ def _main():
221
+ check_deprecated_py_suffix(__name__)
222
+ try:
223
+ main()
224
+ except esptool.FatalError as e:
225
+ log.error(f"\nA fatal error occurred: {e}")
226
+ sys.exit(2)
227
+ except KeyboardInterrupt:
228
+ log.error("KeyboardInterrupt: Run cancelled by user.")
229
+ sys.exit(2)
230
+
231
+
232
+ if __name__ == "__main__":
233
+ _main()
@@ -0,0 +1,246 @@
1
+ # SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
2
+ #
3
+ # SPDX-License-Identifier: GPL-2.0-or-later
4
+
5
+ from typing import Any
6
+
7
+ import rich_click as click
8
+ from click.parser import OptionParser, ParsingState, _unpack_args
9
+ from esptool.cli_util import Group as EsptoolGroup
10
+ from esptool.logger import log
11
+
12
+ from espefuse.efuse_interface import (
13
+ DEPRECATED_COMMANDS,
14
+ init_commands,
15
+ SUPPORTED_BURN_COMMANDS,
16
+ SUPPORTED_READ_COMMANDS,
17
+ SUPPORTED_COMMANDS,
18
+ )
19
+
20
+
21
+ click.rich_click.USE_CLICK_SHORT_HELP = True
22
+ click.rich_click.COMMAND_GROUPS = {
23
+ "*": [
24
+ {
25
+ "name": "Burn commands",
26
+ "commands": SUPPORTED_BURN_COMMANDS,
27
+ },
28
+ {
29
+ "name": "Read commands",
30
+ "commands": SUPPORTED_READ_COMMANDS,
31
+ },
32
+ ]
33
+ }
34
+
35
+
36
+ class ChainParser(OptionParser):
37
+ """
38
+ This is a modified version of the OptionParser class from click.parser.
39
+ It allows for the processing of arguments and options in interspersed order
40
+ together with chaining commands.
41
+ """
42
+
43
+ def _process_args_for_options(self, state: ParsingState) -> None:
44
+ while state.rargs:
45
+ arg = state.rargs.pop(0)
46
+ arglen = len(arg)
47
+ # Double dashes always handled explicitly regardless of what
48
+ # prefixes are valid.
49
+ if arg == "--":
50
+ return
51
+ # if the argument is a command, stop parsing options
52
+ elif arg.replace("_", "-") in SUPPORTED_COMMANDS:
53
+ state.largs.append(arg)
54
+ return
55
+ elif arg[:1] in self._opt_prefixes and arglen > 1:
56
+ self._process_opts(arg, state)
57
+ elif self.allow_interspersed_args:
58
+ state.largs.append(arg)
59
+ else:
60
+ state.rargs.insert(0, arg)
61
+ return
62
+
63
+ def _process_args_for_args(self, state: ParsingState) -> None:
64
+ pargs, args = _unpack_args(
65
+ state.largs + state.rargs, [x.nargs for x in self._args]
66
+ )
67
+
68
+ # This check is required because of the way we modify nargs in ChainingCommand
69
+ if len(pargs) > 0:
70
+ for idx, arg in enumerate(self._args):
71
+ arg.process(pargs[idx], state)
72
+
73
+ state.largs = args
74
+ state.rargs = []
75
+
76
+
77
+ class EfuseContext(click.RichContext):
78
+ @property
79
+ def show_sensitive_info(self) -> bool:
80
+ self.ensure_object(dict)
81
+ value: bool = self.obj.get("show_sensitive_info", False)
82
+ if not value:
83
+ log.print("Sensitive data will be hidden (see --show-sensitive-info)")
84
+ return value
85
+
86
+
87
+ class ChainingCommand(click.RichCommand, click.Command):
88
+ context_class = EfuseContext
89
+
90
+ def __init__(self, *args, **kwargs):
91
+ super().__init__(*args, **kwargs)
92
+
93
+ def _is_option(self, arg: str) -> bool:
94
+ return arg.startswith("--") or arg.startswith("-")
95
+
96
+ def invoke(self, ctx: click.Context) -> Any:
97
+ log.print(f'\n=== Run "{self.name}" command ===')
98
+ return super().invoke(ctx)
99
+
100
+ def parse_args(self, ctx: click.Context, args: list[str]):
101
+ # This is a hack to set nargs of the last argument to the number of arguments
102
+ # that will be processed separately
103
+ param_changed = None
104
+ for idx, arg in enumerate(args):
105
+ # command found in args or option found after argument
106
+ if arg.replace("_", "-") in SUPPORTED_COMMANDS or (
107
+ self._is_option(arg) and idx > 0
108
+ ):
109
+ arguments_count = sum(
110
+ isinstance(param, click.Argument) for param in self.params
111
+ )
112
+ for param in self.params:
113
+ if param.nargs != -1:
114
+ continue
115
+ # set nargs of parameter to actual count of arguments and deduct
116
+ # arguments_count as each argument will be processed separately,
117
+ # we only care about the last one with nargs=-1
118
+ # at the end we add 1 to account for the processedargument itself
119
+ # e.g. if we have burn-bit BLOCK2 1 2 3, we want to set nargs to 3,
120
+ # so we need to account for BLOCK2 being processed separately
121
+ param.nargs = args.index(arg) - arguments_count + 1
122
+ param_changed = param
123
+ if (
124
+ param.nargs == 0
125
+ and param.required
126
+ and not ctx.resilient_parsing
127
+ ):
128
+ raise click.UsageError(
129
+ f"Command `{self.name}` requires the `{param.name}` "
130
+ "argument."
131
+ )
132
+ break
133
+ break
134
+ ret = super().parse_args(ctx, args)
135
+ # restore nargs of the last argument to -1, in case it is going to be used again
136
+ if param_changed is not None:
137
+ param.nargs = -1
138
+ return ret
139
+
140
+ def make_parser(self, ctx: click.Context) -> OptionParser:
141
+ """Creates the underlying option parser for this command."""
142
+ parser = ChainParser(ctx)
143
+ parser.allow_interspersed_args = True
144
+ for param in self.get_params(ctx):
145
+ param.add_to_parser(parser, ctx)
146
+ return parser
147
+
148
+
149
+ class Group(EsptoolGroup):
150
+ DEPRECATED_OPTIONS = {
151
+ "--file_name": "--file-name",
152
+ }
153
+
154
+ command_class = ChainingCommand
155
+ context_class = EfuseContext
156
+
157
+ @staticmethod
158
+ def _split_to_groups(args: list[str]) -> tuple[list[list[str]], list[str]]:
159
+ """
160
+ This function splits the args list into groups,
161
+ where each item is a cmd with all its args.
162
+
163
+ Example:
164
+ all_args:
165
+ ['burn-key-digest', 'secure_images/ecdsa256_secure_boot_signing_key_v2.pem',
166
+ 'burn-key', 'BLOCK_KEY0', 'images/efuse/128bit_key',
167
+ 'XTS_AES_128_KEY_DERIVED_FROM_128_EFUSE_BITS']
168
+
169
+ used_cmds: ['burn-key-digest', 'burn-key']
170
+ groups:
171
+ [['burn-key-digest', 'secure_images/ecdsa256_secure_boot_signing_key_v2.pem'],
172
+ ['burn-key', 'BLOCK_KEY0', 'images/efuse/128bit_key',
173
+ 'XTS_AES_128_KEY_DERIVED_FROM_128_EFUSE_BITS']]
174
+ """
175
+ groups: list[list[str]] = []
176
+ args_group: list[str] = []
177
+ used_cmds: list[str] = []
178
+ for arg in args:
179
+ if arg.replace("_", "-") in SUPPORTED_COMMANDS:
180
+ groups.append(args_group)
181
+ used_cmds.append(arg)
182
+ args_group = [arg]
183
+ else:
184
+ args_group.append(arg)
185
+ groups.append(args_group)
186
+ return groups, used_cmds
187
+
188
+ @staticmethod
189
+ def repeat_read_commands(
190
+ used_cmds: list[str], groups: list[list[str]]
191
+ ) -> list[list[str]]:
192
+ if (
193
+ sum(cmd in SUPPORTED_BURN_COMMANDS for cmd in used_cmds) > 0
194
+ and sum(cmd in SUPPORTED_READ_COMMANDS for cmd in used_cmds) > 0
195
+ ):
196
+ # append all read commands at the end of group
197
+ read_commands = []
198
+ for group in groups:
199
+ if group[0] in SUPPORTED_READ_COMMANDS:
200
+ read_commands.append(group)
201
+ groups.extend(read_commands)
202
+ return groups
203
+
204
+ def parse_args(self, ctx: click.Context, args: list[str]):
205
+ ctx.ensure_object(dict)
206
+ ctx.obj["is_help"] = any(help_arg in args for help_arg in ctx.help_option_names)
207
+ idx = (
208
+ args.index("--chip")
209
+ if "--chip" in args
210
+ else (args.index("-c") if "-c" in args else -1)
211
+ )
212
+ ctx.obj["chip"] = args[idx + 1] if idx != -1 and idx + 1 < len(args) else "auto"
213
+ # override the default behavior of EsptoolGroup, because we don't need
214
+ # support for parameters with nargs=-1
215
+ args = self._replace_deprecated_args(args)
216
+ cmd_groups, used_cmds = self._split_to_groups(args)
217
+
218
+ # Add commands for shell completion
219
+ if ctx.resilient_parsing:
220
+ commands = init_commands(port=None, chip=ctx.obj["chip"], skip_connect=True)
221
+ commands.add_cli_commands(self)
222
+ elif len(used_cmds) == 0:
223
+ self.get_help(ctx)
224
+ ctx.exit()
225
+
226
+ cmd_groups = self.repeat_read_commands(used_cmds, cmd_groups)
227
+ args = [arg for group in cmd_groups for arg in group]
228
+
229
+ ctx.obj["used_cmds"] = used_cmds
230
+ ctx.obj["args"] = args
231
+ return super(click.RichGroup, self).parse_args(ctx, args)
232
+
233
+ def get_help(self, ctx: click.Context) -> str:
234
+ # help was called without any commands, so we need to add the commands for the
235
+ # default chip
236
+ if not (set(self.list_commands(ctx)) - set(DEPRECATED_COMMANDS)):
237
+ chip = ctx.obj["chip"]
238
+ if chip == "auto":
239
+ log.note(
240
+ "Chip not specified, showing commands for ESP32 by default. "
241
+ "Specify the --chip option to get chip-specific help."
242
+ )
243
+ chip = "esp32"
244
+ commands = init_commands(port=None, chip=chip, skip_connect=True)
245
+ commands.add_cli_commands(self)
246
+ return super().get_help(ctx) # type: ignore