mpflash 0.4.0.post2__py3-none-any.whl → 0.4.2__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.
- mpflash/ask_input.py +163 -0
- mpflash/cli_download.py +18 -10
- mpflash/cli_flash.py +122 -72
- mpflash/cli_group.py +20 -1
- mpflash/cli_list.py +5 -4
- mpflash/cli_main.py +5 -4
- mpflash/common.py +24 -9
- mpflash/config.py +5 -3
- mpflash/download.py +59 -13
- mpflash/flash.py +36 -24
- mpflash/flash_esp.py +11 -11
- mpflash/flash_stm32.py +1 -1
- mpflash/flash_stm32_dfu.py +4 -7
- mpflash/flash_uf2.py +1 -1
- mpflash/mpboard_id/api.py +52 -10
- mpflash/mpboard_id/board_info.csv +2036 -16
- mpflash/mpboard_id/board_info.json +19435 -1255
- mpflash/vendored/dfu.py +9 -8
- mpflash/vendored/pydfu.py +1 -1
- {mpflash-0.4.0.post2.dist-info → mpflash-0.4.2.dist-info}/METADATA +1 -1
- mpflash-0.4.2.dist-info/RECORD +35 -0
- mpflash/basic.py +0 -41
- mpflash/download_input.py +0 -68
- mpflash/inq.py +0 -66
- mpflash/mpboard_id/get_boardnames.py +0 -213
- mpflash-0.4.0.post2.dist-info/RECORD +0 -38
- {mpflash-0.4.0.post2.dist-info → mpflash-0.4.2.dist-info}/LICENSE +0 -0
- {mpflash-0.4.0.post2.dist-info → mpflash-0.4.2.dist-info}/WHEEL +0 -0
- {mpflash-0.4.0.post2.dist-info → mpflash-0.4.2.dist-info}/entry_points.txt +0 -0
mpflash/vendored/dfu.py
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
+
# sourcery skip: require-parameter-annotation
|
2
|
+
# sourcery skip: replace-interpolation-with-fstring
|
1
3
|
#!/usr/bin/python
|
2
4
|
|
3
5
|
# Written by Antonio Galea - 2010/11/18
|
4
6
|
# Distributed under Gnu LGPL 3.0
|
5
7
|
# see http://www.gnu.org/licenses/lgpl-3.0.txt
|
6
8
|
|
7
|
-
import
|
9
|
+
import os
|
10
|
+
import struct
|
11
|
+
import sys
|
12
|
+
import zlib
|
8
13
|
from optparse import OptionParser
|
9
14
|
|
10
15
|
DEFAULT_DEVICE = "0x0483:0xdf11"
|
@@ -34,9 +39,7 @@ def parse(file, dump_images=False):
|
|
34
39
|
prefix, data = consume("<5sBIB", data, "signature version size targets")
|
35
40
|
print("%(signature)s v%(version)d, image size: %(size)d, targets: %(targets)d" % prefix)
|
36
41
|
for t in range(prefix["targets"]):
|
37
|
-
tprefix, data = consume(
|
38
|
-
"<6sBI255s2I", data, "signature altsetting named name size elements"
|
39
|
-
)
|
42
|
+
tprefix, data = consume("<6sBI255s2I", data, "signature altsetting named name size elements")
|
40
43
|
tprefix["num"] = t
|
41
44
|
if tprefix["named"]:
|
42
45
|
tprefix["name"] = cstring(tprefix["name"])
|
@@ -74,7 +77,7 @@ def parse(file, dump_images=False):
|
|
74
77
|
|
75
78
|
def build(file, targets, device=DEFAULT_DEVICE):
|
76
79
|
data = b""
|
77
|
-
for
|
80
|
+
for _, target in enumerate(targets):
|
78
81
|
tdata = b""
|
79
82
|
for image in target:
|
80
83
|
# pad image to 8 bytes (needed at least for L476)
|
@@ -82,9 +85,7 @@ def build(file, targets, device=DEFAULT_DEVICE):
|
|
82
85
|
image["data"] = image["data"] + bytes(bytearray(8)[0:pad])
|
83
86
|
#
|
84
87
|
tdata += struct.pack("<2I", image["address"], len(image["data"])) + image["data"]
|
85
|
-
tdata = (
|
86
|
-
struct.pack("<6sBI255s2I", b"Target", 0, 1, b"ST...", len(tdata), len(target)) + tdata
|
87
|
-
)
|
88
|
+
tdata = struct.pack("<6sBI255s2I", b"Target", 0, 1, b"ST...", len(tdata), len(target)) + tdata
|
88
89
|
data += tdata
|
89
90
|
data = struct.pack("<5sBIB", b"DfuSe", 1, len(data) + 11, len(targets)) + data
|
90
91
|
v, d = map(lambda x: int(x, 0) & 0xFFFF, device.split(":", 1))
|
mpflash/vendored/pydfu.py
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Copyright (c) 2013/2014 Ibrahim Abdelkader <i.abdalkader@gmail.com>
|
4
4
|
# This work is licensed under the MIT license, see the file LICENSE for
|
5
5
|
# details.
|
6
|
-
|
6
|
+
# type: ignore
|
7
7
|
"""This module implements enough functionality to program the STM32F4xx over
|
8
8
|
DFU, without requiring dfu-util.
|
9
9
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
mpflash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
mpflash/ask_input.py,sha256=ZVTh_OO9K3y1YYSzZ-xMg1RA2feGI5S3M_FdWJitTis,5248
|
3
|
+
mpflash/cli_download.py,sha256=JDsSfpsx84eGIwXwBD2va1FkpzT8dfmf-zjyQu1OOec,2446
|
4
|
+
mpflash/cli_flash.py,sha256=IkU7w5ywWMZga7hVQLnRLk1twVbqZNM_2So2lpwItm4,7237
|
5
|
+
mpflash/cli_group.py,sha256=hdyFrxkA_ye5r5bAsOnPr99KV2pfzgDoNXGPjTvEpW0,1946
|
6
|
+
mpflash/cli_list.py,sha256=3xYHiWrDJfuXZ5JWcOg84U0NqrZ76SOZmprAO3Ijmug,2832
|
7
|
+
mpflash/cli_main.py,sha256=82SfeyqyZLgypW8stiiy4ufIMIpolAt8-ko0p8ZIlWA,529
|
8
|
+
mpflash/common.py,sha256=w06KZID4klKKrKPmgOE0LbiPix_lQ5ICGWc3LR-qrGU,5066
|
9
|
+
mpflash/config.py,sha256=G6TxliEGxoYXy1SHQYBKgywnKccz9QzD3mGq_Vv1frg,419
|
10
|
+
mpflash/download.py,sha256=rRMA9J3Nee-8RCQFukjbfgxeEJZhSE8DAMFO0Kh3DbI,10357
|
11
|
+
mpflash/flash.py,sha256=_RUnQX7o1EUu9Xd9pqnjM5K1K7PwfC1QqiR9eQvwmvk,5692
|
12
|
+
mpflash/flash_esp.py,sha256=TeGaKTIBD9NoE_VpRreLW_32XeRW6UYKBJf0DH1WCWo,2396
|
13
|
+
mpflash/flash_stm32.py,sha256=NszC1p256sy3OgpDx1v3CXKVGDaC1H5YAVzlnG6B12o,869
|
14
|
+
mpflash/flash_stm32_cube.py,sha256=GUzlcteZRkANO6j7KrHb-QqRX7SyDAph07McR2vE4bs,4010
|
15
|
+
mpflash/flash_stm32_dfu.py,sha256=GXk_dh5l1RreAmv8GdzRsKumm3t8RdYH1NXOmOMyFfA,2509
|
16
|
+
mpflash/flash_uf2.py,sha256=nTbp8MbSZeNVPWPPsQxN1ppTtBGESXMfwZ_qL4Bwkv0,2029
|
17
|
+
mpflash/flash_uf2_boardid.py,sha256=WZKucGu_hJ8ymb236uuZbiR6pD6AA_l4LA-7LwtQhq8,414
|
18
|
+
mpflash/flash_uf2_linux.py,sha256=LAGkzTImVq-wKo7LGUNlwkUHv1L4rGO7igR5dwxY07o,4298
|
19
|
+
mpflash/flash_uf2_windows.py,sha256=dcmA-koavH7duOuNwI0n2aDDbhF1_5ZZ-mXFAXgj8z4,1072
|
20
|
+
mpflash/logger.py,sha256=dI_H_a7EOdQJyvoeRHQuYeZuTKYVUS3DUPTLhE9rkdM,1098
|
21
|
+
mpflash/mpboard_id/api.py,sha256=m356OarUEG1kD4fAh68CJzhM-dLRTD4Lfr52IRi7jZA,3143
|
22
|
+
mpflash/mpboard_id/board_id.py,sha256=y_vdTrU0BAlkyXKpm4J6iRG9KnLIAcDAxYY6dXRma6w,1778
|
23
|
+
mpflash/mpboard_id/board_info.csv,sha256=KPWDo-zHWfrPGQn9oInsDH-5IdCzhBCs6K_YAmqqSpQ,96983
|
24
|
+
mpflash/mpboard_id/board_info.json,sha256=JtVyOMIO1O7vLKzJ0hyXQ4JSxXiQBJyay2hjdNLnZM0,674442
|
25
|
+
mpflash/mpremoteboard/__init__.py,sha256=JpFwECSiH_oxEnAkLayK9z8Jffwj0sshqbiK6lhF7pk,4726
|
26
|
+
mpflash/mpremoteboard/mpy_fw_info.py,sha256=6AQbN3jtQgllqWQYl4e-63KeEtV08EXk8_JnM6XBkvo,4554
|
27
|
+
mpflash/mpremoteboard/runner.py,sha256=G0LLqVS9ngB2y2pZoDvZK5d03RrK7gPo9Lo9dzq5NZA,4583
|
28
|
+
mpflash/vendored/dfu.py,sha256=oK_MRSOyDJrUuS6D24IMIsfL7oLcrvUq0yp_h4WIY2U,5739
|
29
|
+
mpflash/vendored/pydfu.py,sha256=_MdBRo1EeNeKDqFPSTB5tNL1jGSBJgsVeVjE5e7Pb8s,20542
|
30
|
+
mpflash/vendored/readme.md,sha256=iIIZxuLUIGHQ0KODzYVtMezsztvyxCXcNJp_AzwTIPk,86
|
31
|
+
mpflash-0.4.2.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
|
32
|
+
mpflash-0.4.2.dist-info/LICENSE,sha256=mWpNhsIxWzetYNnTpr4eb3HtgsxGIC8KcYWxXEcxQvE,1077
|
33
|
+
mpflash-0.4.2.dist-info/METADATA,sha256=cS8sPuKiztbPtxicWgvCq4rppSgufy3GadqX_HA5H3c,13796
|
34
|
+
mpflash-0.4.2.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
35
|
+
mpflash-0.4.2.dist-info/RECORD,,
|
mpflash/basic.py
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
from pathlib import Path
|
2
|
-
|
3
|
-
from .vendored import pydfu as pydfu
|
4
|
-
|
5
|
-
|
6
|
-
def main():
|
7
|
-
print("Hello, DFU!")
|
8
|
-
dfu_file = Path("/home/jos/projects/micropython/ports/stm32/build-PYBV11/firmware.dfu")
|
9
|
-
|
10
|
-
print("List ANY DFU devices...")
|
11
|
-
try:
|
12
|
-
pydfu.list_dfu_devices()
|
13
|
-
except ValueError as e:
|
14
|
-
print(f"Insuffient permissions to access usb DFU devices: {e}")
|
15
|
-
exit(1)
|
16
|
-
|
17
|
-
kwargs = {"idVendor": 0x0483, "idProduct": 0xDF11}
|
18
|
-
print("List SPECIFIED DFU devices...")
|
19
|
-
pydfu.list_dfu_devices(**kwargs)
|
20
|
-
|
21
|
-
# Needs to be a list of serial ports
|
22
|
-
print("Inititialize pydfu...")
|
23
|
-
pydfu.init(**kwargs)
|
24
|
-
|
25
|
-
# print("Mass erase...")
|
26
|
-
# pydfu.mass_erase()
|
27
|
-
|
28
|
-
print("Read DFU file...")
|
29
|
-
elements = pydfu.read_dfu_file(dfu_file)
|
30
|
-
if not elements:
|
31
|
-
print("No data in dfu file")
|
32
|
-
return
|
33
|
-
print("Writing memory...")
|
34
|
-
pydfu.write_elements(elements, False, progress=pydfu.cli_progress)
|
35
|
-
|
36
|
-
print("Exiting DFU...")
|
37
|
-
pydfu.exit_dfu()
|
38
|
-
|
39
|
-
|
40
|
-
if __name__ == "__main__":
|
41
|
-
main()
|
mpflash/download_input.py
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
"""Download input handling for mpflash."""
|
2
|
-
|
3
|
-
from dataclasses import dataclass, field
|
4
|
-
from pathlib import Path
|
5
|
-
from typing import List
|
6
|
-
|
7
|
-
from mpflash.mpboard_id.api import known_mp_boards, known_mp_ports
|
8
|
-
|
9
|
-
|
10
|
-
@dataclass
|
11
|
-
class DownloadParams:
|
12
|
-
destination: Path
|
13
|
-
ports: List[str] = field(default_factory=list)
|
14
|
-
boards: List[str] = field(default_factory=list)
|
15
|
-
versions: List[str] = field(default_factory=list)
|
16
|
-
force: bool = False
|
17
|
-
clean: bool = False
|
18
|
-
preview: bool = False
|
19
|
-
|
20
|
-
|
21
|
-
def ask_missing_params(params: DownloadParams) -> DownloadParams:
|
22
|
-
# import only when needed to reduce load time
|
23
|
-
import inquirer
|
24
|
-
|
25
|
-
# from inquirer.themes import BlueComposure, load_theme_from_dict
|
26
|
-
# theme = BlueComposure()
|
27
|
-
|
28
|
-
params.versions = list(params.versions)
|
29
|
-
params.preview = "preview" in params.versions
|
30
|
-
params.versions = [v for v in params.versions if v != "preview"]
|
31
|
-
questions = []
|
32
|
-
if not params.boards:
|
33
|
-
ask_port_board(questions)
|
34
|
-
|
35
|
-
answers = inquirer.prompt(questions)
|
36
|
-
assert answers is not None
|
37
|
-
# print(repr(answers))
|
38
|
-
if "port" in answers:
|
39
|
-
params.ports = [answers["port"]]
|
40
|
-
if "boards" in answers:
|
41
|
-
params.boards = answers["boards"]
|
42
|
-
# print(repr(inputs))
|
43
|
-
|
44
|
-
return params
|
45
|
-
|
46
|
-
|
47
|
-
# TODO Rename this here and in `complete_dl_inputs`
|
48
|
-
def ask_port_board(questions: list):
|
49
|
-
# import only when needed to reduce load time
|
50
|
-
import inquirer
|
51
|
-
|
52
|
-
action = "download"
|
53
|
-
questions.extend(
|
54
|
-
(
|
55
|
-
inquirer.List(
|
56
|
-
"port",
|
57
|
-
message=f"What port do you want to {action}?",
|
58
|
-
choices=known_mp_ports(),
|
59
|
-
autocomplete=True,
|
60
|
-
),
|
61
|
-
inquirer.Checkbox(
|
62
|
-
"boards",
|
63
|
-
message=f"What board do you want to {action}?",
|
64
|
-
choices=lambda answers: known_mp_boards(answers["port"]),
|
65
|
-
validate=lambda _, x: True if x else "Please select at least one board", # type: ignore
|
66
|
-
),
|
67
|
-
)
|
68
|
-
)
|
mpflash/inq.py
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import sys
|
3
|
-
from pprint import pprint
|
4
|
-
from typing import Dict, List, Tuple, Union
|
5
|
-
|
6
|
-
import rich_click as click
|
7
|
-
from rich.console import Console
|
8
|
-
|
9
|
-
from mpflash.mpboard_id.api import known_mp_boards, known_mp_ports
|
10
|
-
|
11
|
-
sys.path.append(os.path.realpath("."))
|
12
|
-
import inquirer # noqa
|
13
|
-
|
14
|
-
|
15
|
-
def port_choices(answers: dict) -> List[str]:
|
16
|
-
# return ["stm32", "esp32", "esp8266", ("nRF", "nrf"), "rp2", "samd"]
|
17
|
-
# TODO: remove ports we cannot flash?
|
18
|
-
return known_mp_ports()
|
19
|
-
|
20
|
-
|
21
|
-
def board_choices(answers: dict) -> Union[List[str], List[Tuple[str, str]]]:
|
22
|
-
return known_mp_boards(answers["port"])
|
23
|
-
|
24
|
-
|
25
|
-
action = "download"
|
26
|
-
|
27
|
-
questions = [
|
28
|
-
inquirer.List(
|
29
|
-
"port",
|
30
|
-
message=f"What port do you want to {action}?",
|
31
|
-
choices=port_choices,
|
32
|
-
autocomplete=True,
|
33
|
-
),
|
34
|
-
# inquirer.List(
|
35
|
-
# "board",
|
36
|
-
# message=f"What board do you want to {action}?",
|
37
|
-
# choices=board_choices,
|
38
|
-
# carousel=True,
|
39
|
-
# ),
|
40
|
-
inquirer.Checkbox(
|
41
|
-
"board",
|
42
|
-
message=f"What board do you want to {action}?",
|
43
|
-
choices=board_choices,
|
44
|
-
validate=lambda _, x: True if x else "Please select at least one board", # type: ignore
|
45
|
-
),
|
46
|
-
]
|
47
|
-
|
48
|
-
from inquirer.themes import BlueComposure, load_theme_from_dict
|
49
|
-
|
50
|
-
mytheme = load_theme_from_dict(
|
51
|
-
{
|
52
|
-
"Question": {
|
53
|
-
"mark_color": "yellow",
|
54
|
-
"brackets_color": "orange",
|
55
|
-
# ...
|
56
|
-
},
|
57
|
-
"List": {"selection_color": "bold_blue", "selection_cursor": "+=>"},
|
58
|
-
}
|
59
|
-
)
|
60
|
-
|
61
|
-
|
62
|
-
console = Console()
|
63
|
-
theme = BlueComposure()
|
64
|
-
|
65
|
-
answers = inquirer.prompt(questions, theme=theme)
|
66
|
-
console.print(answers)
|
@@ -1,213 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Collects board name and description information from MicroPython and writes it to JSON and CSV files.
|
3
|
-
"""
|
4
|
-
|
5
|
-
import json
|
6
|
-
import re
|
7
|
-
from dataclasses import asdict, dataclass, is_dataclass
|
8
|
-
from pathlib import Path
|
9
|
-
from typing import List, TypedDict
|
10
|
-
|
11
|
-
from tabulate import tabulate
|
12
|
-
|
13
|
-
import stubber.basicgit as git
|
14
|
-
|
15
|
-
|
16
|
-
@dataclass()
|
17
|
-
class Board:
|
18
|
-
"""MicroPython Board definition"""
|
19
|
-
|
20
|
-
description: str
|
21
|
-
port: str
|
22
|
-
board: str
|
23
|
-
board_name: str
|
24
|
-
mcu_name: str
|
25
|
-
path: Path
|
26
|
-
version: str = ""
|
27
|
-
|
28
|
-
|
29
|
-
class EnhancedJSONEncoder(json.JSONEncoder):
|
30
|
-
def default(self, o: object):
|
31
|
-
if is_dataclass(o):
|
32
|
-
return asdict(o)
|
33
|
-
elif isinstance(o, Path):
|
34
|
-
return o.as_posix()
|
35
|
-
return super().default(o)
|
36
|
-
|
37
|
-
|
38
|
-
# look for all mpconfigboard.h files and extract the board name
|
39
|
-
# from the #define MICROPY_HW_BOARD_NAME "PYBD_SF6"
|
40
|
-
# and the #define MICROPY_HW_MCU_NAME "STM32F767xx"
|
41
|
-
|
42
|
-
|
43
|
-
RE_BOARD_NAME = re.compile(r"#define\s+MICROPY_HW_BOARD_NAME\s+\"(.+)\"")
|
44
|
-
RE_MCU_NAME = re.compile(r"#define\s+MICROPY_HW_MCU_NAME\s+\"(.+)\"")
|
45
|
-
RE_CMAKE_BOARD_NAME = re.compile(r"MICROPY_HW_BOARD_NAME\s?=\s?\"(?P<variant>[\w\s\S]*)\"")
|
46
|
-
RE_CMAKE_MCU_NAME = re.compile(r"MICROPY_HW_MCU_NAME\s?=\s?\"(?P<variant>[\w\s\S]*)\"")
|
47
|
-
# TODO: normal make files
|
48
|
-
|
49
|
-
|
50
|
-
def collect_boardinfo(mpy_path: Path, version: str) -> List[Board]:
|
51
|
-
"""Collects board name and decriptions from mpconfigboard.h files.
|
52
|
-
|
53
|
-
Args:
|
54
|
-
mpy_path (Path): The path to the MicroPython repository.
|
55
|
-
version (str): The version of MicroPython.
|
56
|
-
|
57
|
-
Returns:
|
58
|
-
List[Board]: A list of Board objects containing the board information.
|
59
|
-
"""
|
60
|
-
board_list: List[Board] = []
|
61
|
-
# look in boards
|
62
|
-
for path in mpy_path.glob("ports/**/mpconfigboard.h"):
|
63
|
-
board = path.parent.name
|
64
|
-
port = path.parent.parent.parent.name
|
65
|
-
with open(path, "r") as f:
|
66
|
-
board_name = mcu_name = "-"
|
67
|
-
found = 0
|
68
|
-
for line in f:
|
69
|
-
if match := RE_BOARD_NAME.match(line):
|
70
|
-
board_name = match[1]
|
71
|
-
found += 1
|
72
|
-
elif match := RE_MCU_NAME.match(line):
|
73
|
-
mcu_name = match[1]
|
74
|
-
found += 1
|
75
|
-
if found == 2:
|
76
|
-
description = f"{board_name} with {mcu_name}" if mcu_name != "-" else board_name
|
77
|
-
board_list.append(
|
78
|
-
Board(
|
79
|
-
port=port,
|
80
|
-
board=board,
|
81
|
-
board_name=board_name,
|
82
|
-
mcu_name=mcu_name,
|
83
|
-
description=description,
|
84
|
-
path=path.relative_to(mpy_path),
|
85
|
-
version=version,
|
86
|
-
)
|
87
|
-
)
|
88
|
-
found = 0
|
89
|
-
if found == 1:
|
90
|
-
description = board_name
|
91
|
-
board_list.append(
|
92
|
-
Board(
|
93
|
-
port=port,
|
94
|
-
board=board,
|
95
|
-
board_name=board_name,
|
96
|
-
mcu_name=mcu_name,
|
97
|
-
description=description,
|
98
|
-
path=path.relative_to(mpy_path),
|
99
|
-
version=version,
|
100
|
-
)
|
101
|
-
)
|
102
|
-
# look for variants in the .cmake files
|
103
|
-
for path in mpy_path.glob("ports/**/mpconfigboard.cmake"):
|
104
|
-
board = path.parent.name
|
105
|
-
port = path.parent.parent.parent.name
|
106
|
-
with open(path, "r") as f:
|
107
|
-
board_name = mcu_name = "-"
|
108
|
-
found = 0
|
109
|
-
for line in f:
|
110
|
-
line = line.strip()
|
111
|
-
if match := RE_CMAKE_BOARD_NAME.match(line):
|
112
|
-
description = match["variant"]
|
113
|
-
board_list.append(
|
114
|
-
Board(
|
115
|
-
port=port,
|
116
|
-
board=board,
|
117
|
-
board_name=board_name,
|
118
|
-
mcu_name=mcu_name,
|
119
|
-
description=description,
|
120
|
-
path=path.relative_to(mpy_path),
|
121
|
-
version=version,
|
122
|
-
)
|
123
|
-
)
|
124
|
-
elif match := RE_CMAKE_MCU_NAME.match(line):
|
125
|
-
description = match["variant"]
|
126
|
-
board_list.append(
|
127
|
-
Board(
|
128
|
-
port=port,
|
129
|
-
board=board,
|
130
|
-
board_name=board_name,
|
131
|
-
mcu_name=mcu_name,
|
132
|
-
description=description,
|
133
|
-
path=path.relative_to(mpy_path),
|
134
|
-
version=version,
|
135
|
-
)
|
136
|
-
)
|
137
|
-
|
138
|
-
# look for variants in the Makefile files
|
139
|
-
|
140
|
-
return board_list
|
141
|
-
|
142
|
-
|
143
|
-
def write_files(board_list: List[Board], *, folder: Path):
|
144
|
-
"""Writes the board information to JSON and CSV files.
|
145
|
-
|
146
|
-
Args:
|
147
|
-
board_list (List[Board]): The list of Board objects.
|
148
|
-
"""
|
149
|
-
# write the list to json file
|
150
|
-
with open(folder / "board_info.json", "w") as f:
|
151
|
-
json.dump(board_list, f, indent=4, cls=EnhancedJSONEncoder)
|
152
|
-
|
153
|
-
# create a csv with only the board and the description of the board_list
|
154
|
-
with open(folder / "board_info.csv", "w") as f:
|
155
|
-
f.write("board,description\n")
|
156
|
-
for board in board_list:
|
157
|
-
f.write(f"{board.description},{board.board}\n")
|
158
|
-
|
159
|
-
|
160
|
-
def get_board_list(versions: List[str], mpy_path: Path):
|
161
|
-
"""Gets the list of boards for multiple versions of MicroPython.
|
162
|
-
|
163
|
-
Args:
|
164
|
-
versions (List[str]): The list of MicroPython versions.
|
165
|
-
mpy_path (Path): The path to the MicroPython repository.
|
166
|
-
|
167
|
-
Returns:
|
168
|
-
List[Board]: The list of Board objects.
|
169
|
-
"""
|
170
|
-
board_list: List[Board] = []
|
171
|
-
for version in versions:
|
172
|
-
print(git.checkout_tag(tag=version, repo=mpy_path))
|
173
|
-
new_ones = collect_boardinfo(mpy_path, version)
|
174
|
-
print(f"Found {len(new_ones)} board definitions for {version}.")
|
175
|
-
board_list += new_ones
|
176
|
-
|
177
|
-
# sort the board_list by description and board
|
178
|
-
print("Total number of boards found:", len(board_list))
|
179
|
-
seen = set()
|
180
|
-
board_list = [x for x in board_list if not (x.description in seen or seen.add(x.description))]
|
181
|
-
board_list.sort(key=lambda x: x.description.lower())
|
182
|
-
print("Unique board descriptions found:", len(board_list))
|
183
|
-
return board_list
|
184
|
-
|
185
|
-
|
186
|
-
def main():
|
187
|
-
"""Main function to collect and write board information."""
|
188
|
-
mpy_path = Path("repos/micropython")
|
189
|
-
versions = [
|
190
|
-
"v1.22.0",
|
191
|
-
"v1.21.0",
|
192
|
-
"v1.20.0",
|
193
|
-
"v1.19.1",
|
194
|
-
"v1.18",
|
195
|
-
"v1.17",
|
196
|
-
"v1.16",
|
197
|
-
"v1.15",
|
198
|
-
"v1.14",
|
199
|
-
"v1.13",
|
200
|
-
"v1.12",
|
201
|
-
"v1.11",
|
202
|
-
"v1.10",
|
203
|
-
]
|
204
|
-
# versions.reverse()
|
205
|
-
board_list = get_board_list(versions, mpy_path)
|
206
|
-
|
207
|
-
print(tabulate(board_list, headers="keys")) # type: ignore
|
208
|
-
write_files(board_list, folder=Path("src/stubber/data"))
|
209
|
-
write_files(board_list, folder=Path("src/stubber/board"))
|
210
|
-
|
211
|
-
|
212
|
-
if __name__ == "__main__":
|
213
|
-
main()
|
@@ -1,38 +0,0 @@
|
|
1
|
-
mpflash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
mpflash/basic.py,sha256=nrnv0ZAh1M-nTWuPmkLHFnbHr9Uy5YZRTqfD0P6DUC4,1065
|
3
|
-
mpflash/cli_download.py,sha256=9_3ynJRBgBsGIiSs0bQssCv_sq66dGyaW7GMEc50tVc,2299
|
4
|
-
mpflash/cli_flash.py,sha256=jEFlguvIiO3gwRUF7RA9xpckkqpFX9wmQE7-uz4s87k,5649
|
5
|
-
mpflash/cli_group.py,sha256=e2BVds9Z1FRnWLa2_O0fzeQX0NZBgYR5Oc8cgyvusaI,1493
|
6
|
-
mpflash/cli_list.py,sha256=-IzzFkv8dLHrffCRJI6lbDgIU4ezbuxncWJNh-FUcNQ,2839
|
7
|
-
mpflash/cli_main.py,sha256=eZdL_mcPWuDoSJv_DEfaJzURkCJjFsZS3ndua4uHlfg,518
|
8
|
-
mpflash/common.py,sha256=BaRVvqZCndZXckmrrjowT28aWG2y2AXwku_H2ultuDU,4396
|
9
|
-
mpflash/config.py,sha256=DahCDWx4V20ZIetaioA7Q91vZQFu0i7XmGE_iROMCE0,362
|
10
|
-
mpflash/download.py,sha256=2nj72Hhkb5H5hQ6oAfPNNAhkhvNRYeROEaNauHHIi-U,8523
|
11
|
-
mpflash/download_input.py,sha256=cCrCXcqm6v4Ef5uE_nq0QhNjnB0p0AGHwp2Aui7AO3U,2077
|
12
|
-
mpflash/flash.py,sha256=nTFNsYHAaGMQg7R6v3NAs9FRP4FGZUZVwCf8ivMMkPI,5463
|
13
|
-
mpflash/flash_esp.py,sha256=xdE5rSvW0gm2whSDh2xXuNK7GyneP9hRYSEp3wEyqsY,2284
|
14
|
-
mpflash/flash_stm32.py,sha256=Rg6yrjxT0FSjQ_FJib1yGMxlfSEtqBlP1Go90gfZN3Q,862
|
15
|
-
mpflash/flash_stm32_cube.py,sha256=GUzlcteZRkANO6j7KrHb-QqRX7SyDAph07McR2vE4bs,4010
|
16
|
-
mpflash/flash_stm32_dfu.py,sha256=InRITjyvbDe4fwJbNtLxN2JLozzi7G-n1WWs6V6kTtc,2511
|
17
|
-
mpflash/flash_uf2.py,sha256=uZTOIbYh06XWjMNwf4UM5g471CYhl0V_ZGjA7jE_Q7c,2022
|
18
|
-
mpflash/flash_uf2_boardid.py,sha256=WZKucGu_hJ8ymb236uuZbiR6pD6AA_l4LA-7LwtQhq8,414
|
19
|
-
mpflash/flash_uf2_linux.py,sha256=LAGkzTImVq-wKo7LGUNlwkUHv1L4rGO7igR5dwxY07o,4298
|
20
|
-
mpflash/flash_uf2_windows.py,sha256=dcmA-koavH7duOuNwI0n2aDDbhF1_5ZZ-mXFAXgj8z4,1072
|
21
|
-
mpflash/inq.py,sha256=hLWb6EqgrKEPuoxKTbaC29eA9D18XVT4E3qMCSA5m40,1690
|
22
|
-
mpflash/logger.py,sha256=dI_H_a7EOdQJyvoeRHQuYeZuTKYVUS3DUPTLhE9rkdM,1098
|
23
|
-
mpflash/mpboard_id/api.py,sha256=o1j7RvJImwqs7k7MFLj4tSV-r7Q0JrFlft8oJ2Y2dQE,1300
|
24
|
-
mpflash/mpboard_id/board_id.py,sha256=y_vdTrU0BAlkyXKpm4J6iRG9KnLIAcDAxYY6dXRma6w,1778
|
25
|
-
mpflash/mpboard_id/board_info.csv,sha256=K2VSmfR013fN-oJWkQUmiQ19w09dVwJHDquPy6QmMhY,8627
|
26
|
-
mpflash/mpboard_id/board_info.json,sha256=jyvBN5seoxx7Z7B3UpvMn7H8xWCpmG4VtFSPb8PjmZI,58939
|
27
|
-
mpflash/mpboard_id/get_boardnames.py,sha256=eKLvdyA8rAg4pgs9eATWBHbW8rCoaMM8y4xF4y353mA,7346
|
28
|
-
mpflash/mpremoteboard/__init__.py,sha256=JpFwECSiH_oxEnAkLayK9z8Jffwj0sshqbiK6lhF7pk,4726
|
29
|
-
mpflash/mpremoteboard/mpy_fw_info.py,sha256=6AQbN3jtQgllqWQYl4e-63KeEtV08EXk8_JnM6XBkvo,4554
|
30
|
-
mpflash/mpremoteboard/runner.py,sha256=G0LLqVS9ngB2y2pZoDvZK5d03RrK7gPo9Lo9dzq5NZA,4583
|
31
|
-
mpflash/vendored/dfu.py,sha256=LzWvyocRXjI6zwGdMP_Wl7hiF5R-2h3QaTrLjbn4Z74,5668
|
32
|
-
mpflash/vendored/pydfu.py,sha256=CHNMmhLYmk4C8O2-HG38Q72zDzGWI5YwAfcYtsHy1Bk,20528
|
33
|
-
mpflash/vendored/readme.md,sha256=iIIZxuLUIGHQ0KODzYVtMezsztvyxCXcNJp_AzwTIPk,86
|
34
|
-
mpflash-0.4.0.post2.dist-info/entry_points.txt,sha256=Jk_visOhYOsZIcSP2Ms9hKqfKy1iorR-6dYltSoWCpY,52
|
35
|
-
mpflash-0.4.0.post2.dist-info/LICENSE,sha256=mWpNhsIxWzetYNnTpr4eb3HtgsxGIC8KcYWxXEcxQvE,1077
|
36
|
-
mpflash-0.4.0.post2.dist-info/METADATA,sha256=o27Z2HihVIORn_KecjqbxWcCJUs3KPXlDye95QZzzm0,13802
|
37
|
-
mpflash-0.4.0.post2.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
38
|
-
mpflash-0.4.0.post2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|