[no changelog]tychovrahe/t3b1/hw_support
parent
26ef82bd87
commit
eb47a75ea4
@ -1,2 +0,0 @@
|
||||
def get_hw_model_as_number(hw_model: str) -> int:
|
||||
return int.from_bytes(hw_model.encode(), "little")
|
@ -0,0 +1,16 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .discovery import configure
|
||||
|
||||
|
||||
def configure_board(
|
||||
revision: Optional[str],
|
||||
features_wanted: list[str],
|
||||
env: dict, # type: ignore
|
||||
defines: list[str | tuple[str, str]],
|
||||
sources: list[str],
|
||||
paths: list[str],
|
||||
):
|
||||
return configure(env, features_wanted, defines, sources, paths)
|
@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from . import get_hw_model_as_number
|
||||
from .stm32f4_common import stm32f4_common_files
|
||||
from .. import get_hw_model_as_number
|
||||
from ..stm32f4_common import stm32f4_common_files
|
||||
|
||||
|
||||
def configure(
|
@ -0,0 +1,16 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .discovery2 import configure
|
||||
|
||||
|
||||
def configure_board(
|
||||
revision: Optional[str],
|
||||
features_wanted: list[str],
|
||||
env: dict, # type: ignore
|
||||
defines: list[str | tuple[str, str]],
|
||||
sources: list[str],
|
||||
paths: list[str],
|
||||
):
|
||||
return configure(env, features_wanted, defines, sources, paths)
|
@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from . import get_hw_model_as_number
|
||||
from .stm32u5_common import stm32u5_common_files
|
||||
from .. import get_hw_model_as_number
|
||||
from ..stm32u5_common import stm32u5_common_files
|
||||
|
||||
|
||||
def configure(
|
@ -0,0 +1,16 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .trezor_1 import configure
|
||||
|
||||
|
||||
def configure_board(
|
||||
revision: Optional[str],
|
||||
features_wanted: list[str],
|
||||
env: dict, # type: ignore
|
||||
defines: list[str | tuple[str, str]],
|
||||
sources: list[str],
|
||||
paths: list[str],
|
||||
):
|
||||
return configure(env, features_wanted, defines, sources, paths)
|
@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from . import get_hw_model_as_number
|
||||
from .stm32f4_common import stm32f4_common_files
|
||||
from .. import get_hw_model_as_number
|
||||
from ..stm32f4_common import stm32f4_common_files
|
||||
|
||||
|
||||
def configure(
|
@ -0,0 +1,29 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .trezor_r_v3 import configure as configure_r3
|
||||
from .trezor_r_v4 import configure as configure_r4
|
||||
from .trezor_r_v6 import configure as configure_r6
|
||||
from .trezor_r_v10 import configure as configure_r10
|
||||
|
||||
|
||||
def configure_board(
|
||||
revision: Optional[int],
|
||||
features_wanted: list[str],
|
||||
env: dict, # type: ignore
|
||||
defines: list[str | tuple[str, str]],
|
||||
sources: list[str],
|
||||
paths: list[str],
|
||||
):
|
||||
if revision is None:
|
||||
revision = 10
|
||||
if revision == 3:
|
||||
return configure_r3(env, features_wanted, defines, sources, paths)
|
||||
elif revision == 4:
|
||||
return configure_r4(env, features_wanted, defines, sources, paths)
|
||||
elif revision == 6:
|
||||
return configure_r6(env, features_wanted, defines, sources, paths)
|
||||
elif revision == 10:
|
||||
return configure_r10(env, features_wanted, defines, sources, paths)
|
||||
raise Exception("Unknown model_r_version")
|
@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from . import get_hw_model_as_number
|
||||
from .stm32f4_common import stm32f4_common_files
|
||||
from .. import get_hw_model_as_number
|
||||
from ..stm32f4_common import stm32f4_common_files
|
||||
|
||||
|
||||
def configure(
|
@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from . import get_hw_model_as_number
|
||||
from .stm32f4_common import stm32f4_common_files
|
||||
from .. import get_hw_model_as_number
|
||||
from ..stm32f4_common import stm32f4_common_files
|
||||
|
||||
|
||||
def configure(
|
@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from . import get_hw_model_as_number
|
||||
from .stm32f4_common import stm32f4_common_files
|
||||
from .. import get_hw_model_as_number
|
||||
from ..stm32f4_common import stm32f4_common_files
|
||||
|
||||
|
||||
def configure(
|
@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from . import get_hw_model_as_number
|
||||
from .stm32f4_common import stm32f4_common_files
|
||||
from .. import get_hw_model_as_number
|
||||
from ..stm32f4_common import stm32f4_common_files
|
||||
|
||||
|
||||
def configure(
|
@ -0,0 +1,16 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .trezor_t import configure
|
||||
|
||||
|
||||
def configure_board(
|
||||
revision: Optional[str],
|
||||
features_wanted: list[str],
|
||||
env: dict, # type: ignore
|
||||
defines: list[str | tuple[str, str]],
|
||||
sources: list[str],
|
||||
paths: list[str],
|
||||
):
|
||||
return configure(env, features_wanted, defines, sources, paths)
|
@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from . import get_hw_model_as_number
|
||||
from .stm32f4_common import stm32f4_common_files
|
||||
from .. import get_hw_model_as_number
|
||||
from ..stm32f4_common import stm32f4_common_files
|
||||
|
||||
|
||||
def configure(
|
@ -0,0 +1,23 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .trezor_t3t1_revE import configure as configure_revE
|
||||
from .trezor_t3t1_v4 import configure as configure_v4
|
||||
|
||||
|
||||
def configure_board(
|
||||
revision: Optional[int | str],
|
||||
features_wanted: list[str],
|
||||
env: dict, # type: ignore
|
||||
defines: list[str | tuple[str, str]],
|
||||
sources: list[str],
|
||||
paths: list[str],
|
||||
):
|
||||
if revision is None:
|
||||
revision = "E"
|
||||
if revision == 4:
|
||||
return configure_v4(env, features_wanted, defines, sources, paths)
|
||||
elif revision == "E":
|
||||
return configure_revE(env, features_wanted, defines, sources, paths)
|
||||
raise Exception("Unknown model_t3t1_version")
|
@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from . import get_hw_model_as_number
|
||||
from .stm32u5_common import stm32u5_common_files
|
||||
from .. import get_hw_model_as_number
|
||||
from ..stm32u5_common import stm32u5_common_files
|
||||
|
||||
|
||||
def configure(
|
@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from . import get_hw_model_as_number
|
||||
from .stm32u5_common import stm32u5_common_files
|
||||
from .. import get_hw_model_as_number
|
||||
from ..stm32u5_common import stm32u5_common_files
|
||||
|
||||
|
||||
def configure(
|
@ -0,0 +1,40 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
from typing import Optional
|
||||
|
||||
|
||||
def get_hw_model_as_number(hw_model: str) -> int:
|
||||
return int.from_bytes(hw_model.encode(), "little")
|
||||
|
||||
|
||||
def configure_board(
|
||||
model: str,
|
||||
revision: Optional[str | int],
|
||||
features_wanted: list[str],
|
||||
env: dict, # type: ignore
|
||||
defines: list[str | tuple[str, str]],
|
||||
sources: list[str],
|
||||
paths: list[str],
|
||||
) -> list[str]:
|
||||
imported_module = importlib.import_module("models." + get_model_identifier(model))
|
||||
return imported_module.configure_board(
|
||||
revision, features_wanted, env, defines, sources, paths
|
||||
)
|
||||
|
||||
|
||||
def get_model_identifier(model: str) -> str:
|
||||
if model == "1":
|
||||
return "T1B1"
|
||||
elif model == "T":
|
||||
return "T2T1"
|
||||
elif model == "R":
|
||||
return "T2B1"
|
||||
elif model == "T3T1":
|
||||
return "T3T1"
|
||||
elif model == "DISC1":
|
||||
return "D001"
|
||||
elif model == "DISC2":
|
||||
return "D002"
|
||||
else:
|
||||
raise Exception("Unknown model")
|
Loading…
Reference in new issue