Merge 738cbd940e
into 27f54eec9c
@ -0,0 +1 @@
|
||||
../T2T1/model_T2T1_layout.c
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,24 @@
|
||||
#ifndef BOARDS_T1B1_UNIX_H
|
||||
#define BOARDS_T1B1_UNIX_H
|
||||
|
||||
#define USE_BUTTON 1
|
||||
|
||||
#define MAX_DISPLAY_RESX 128
|
||||
#define MAX_DISPLAY_RESY 64
|
||||
#define DISPLAY_RESX 128
|
||||
#define DISPLAY_RESY 64
|
||||
#define TREZOR_FONT_BPP 1
|
||||
|
||||
#define WINDOW_WIDTH 200
|
||||
#define WINDOW_HEIGHT 340
|
||||
#define TOUCH_OFFSET_X 36
|
||||
#define TOUCH_OFFSET_Y 92
|
||||
|
||||
#define ORIENTATION_NS 1
|
||||
|
||||
#define BACKGROUND_FILE "T1B1/background_1.h"
|
||||
#define BACKGROUND_NAME background_1_jpg
|
||||
|
||||
#include "display-unix.h"
|
||||
|
||||
#endif // BOARDS_T1B1_UNIX_H
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -0,0 +1,26 @@
|
||||
#ifndef BOARDS_T2B1_UNIX_H
|
||||
#define BOARDS_T2B1_UNIX_H
|
||||
|
||||
#define USE_BUTTON 1
|
||||
#define USE_SBU 1
|
||||
#define USE_OPTIGA 1
|
||||
|
||||
#define MAX_DISPLAY_RESX 128
|
||||
#define MAX_DISPLAY_RESY 64
|
||||
#define DISPLAY_RESX 128
|
||||
#define DISPLAY_RESY 64
|
||||
#define TREZOR_FONT_BPP 1
|
||||
|
||||
#define WINDOW_WIDTH 193
|
||||
#define WINDOW_HEIGHT 339
|
||||
#define TOUCH_OFFSET_X 32
|
||||
#define TOUCH_OFFSET_Y 84
|
||||
|
||||
#define ORIENTATION_NS 1
|
||||
|
||||
#define BACKGROUND_FILE "T2B1/background_T2B1.h"
|
||||
#define BACKGROUND_NAME background_T2B1_png
|
||||
|
||||
#include "display-unix.h"
|
||||
|
||||
#endif // BOARDS_T2B1_UNIX_H
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
@ -0,0 +1,41 @@
|
||||
#ifndef BOARDS_T2T1_UNIX_H
|
||||
#define BOARDS_T2T1_UNIX_H
|
||||
|
||||
#define USE_TOUCH 1
|
||||
#define USE_SD_CARD 1
|
||||
#define USE_SBU 1
|
||||
#define USE_RGB_COLORS 1
|
||||
#define USE_BACKLIGHT 1
|
||||
|
||||
// ILI9341V, GC9307 and ST7789V drivers support 240px x 320px display resolution
|
||||
#define MAX_DISPLAY_RESX 240
|
||||
#define MAX_DISPLAY_RESY 320
|
||||
#define DISPLAY_RESX 240
|
||||
#define DISPLAY_RESY 240
|
||||
#define TREZOR_FONT_BPP 4
|
||||
|
||||
#ifdef TREZOR_EMULATOR_RASPI
|
||||
#define WINDOW_WIDTH 480
|
||||
#define WINDOW_HEIGHT 320
|
||||
#define TOUCH_OFFSET_X 110
|
||||
#define TOUCH_OFFSET_Y 40
|
||||
|
||||
#define ORIENTATION_NSEW 1
|
||||
|
||||
#define BACKGROUND_FILE "background_raspi.h"
|
||||
#define BACKGROUND_NAME background_raspi_jpg
|
||||
|
||||
#else
|
||||
#define WINDOW_WIDTH 400
|
||||
#define WINDOW_HEIGHT 600
|
||||
#define TOUCH_OFFSET_X 80
|
||||
#define TOUCH_OFFSET_Y 110
|
||||
|
||||
#define BACKGROUND_FILE "T2T1/background_T.h"
|
||||
#define BACKGROUND_NAME background_T_jpg
|
||||
|
||||
#endif
|
||||
|
||||
#include "display-unix.h"
|
||||
|
||||
#endif // BOARDS_T2T1_UNIX_H
|
After Width: | Height: | Size: 36 KiB |
@ -0,0 +1,29 @@
|
||||
#ifndef BOARDS_T3T1_UNIX_H
|
||||
#define BOARDS_T3T1_UNIX_H
|
||||
|
||||
#define USE_TOUCH 1
|
||||
#define USE_SD_CARD 1
|
||||
#define USE_SBU 1
|
||||
#define USE_RGB_COLORS 1
|
||||
#define USE_BACKLIGHT 1
|
||||
#define USE_OPTIGA 1
|
||||
|
||||
#define MAX_DISPLAY_RESX 240
|
||||
#define MAX_DISPLAY_RESY 240
|
||||
#define DISPLAY_RESX 240
|
||||
#define DISPLAY_RESY 240
|
||||
#define TREZOR_FONT_BPP 4
|
||||
|
||||
#define WINDOW_WIDTH 400
|
||||
#define WINDOW_HEIGHT 600
|
||||
#define TOUCH_OFFSET_X 80
|
||||
#define TOUCH_OFFSET_Y 110
|
||||
|
||||
#define ORIENTATION_NSEW 1
|
||||
|
||||
#define BACKGROUND_FILE "T3T1/background_T3T1.h"
|
||||
#define BACKGROUND_NAME background_T3T1_jpg
|
||||
|
||||
#include "display-unix.h"
|
||||
|
||||
#endif // BOARDS_T3T1_UNIX_H
|
@ -1 +0,0 @@
|
||||
model_T2T1_layout.c
|
@ -1,33 +0,0 @@
|
||||
#ifndef _BOARD_UNIX_H
|
||||
#define _BOARD_UNIX_H
|
||||
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#define USE_TOUCH 1
|
||||
#define USE_SD_CARD 1
|
||||
#define USE_SBU 1
|
||||
#define USE_RGB_COLORS 1
|
||||
#define USE_BACKLIGHT 1
|
||||
#endif
|
||||
|
||||
#ifdef TREZOR_MODEL_T3T1
|
||||
#define USE_TOUCH 1
|
||||
#define USE_SD_CARD 1
|
||||
#define USE_SBU 1
|
||||
#define USE_RGB_COLORS 1
|
||||
#define USE_BACKLIGHT 1
|
||||
#define USE_OPTIGA 1
|
||||
#endif
|
||||
|
||||
#ifdef TREZOR_MODEL_1
|
||||
#define USE_BUTTON 1
|
||||
#endif
|
||||
|
||||
#ifdef TREZOR_MODEL_R
|
||||
#define USE_BUTTON 1
|
||||
#define USE_SBU 1
|
||||
#define USE_OPTIGA 1
|
||||
#endif
|
||||
|
||||
#include "display-unix.h"
|
||||
|
||||
#endif //_BOARD_UNIX_H
|
@ -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)
|
@ -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)
|
@ -0,0 +1,20 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .emulator import configure as emul
|
||||
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],
|
||||
):
|
||||
if revision == "emulator":
|
||||
return emul(env, features_wanted, defines, sources, paths)
|
||||
else:
|
||||
return configure(env, features_wanted, defines, sources, paths)
|
@ -0,0 +1,33 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .. import get_hw_model_as_number
|
||||
|
||||
|
||||
def configure(
|
||||
env: dict,
|
||||
features_wanted: list[str],
|
||||
defines: list[str | tuple[str, str]],
|
||||
sources: list[str],
|
||||
paths: list[str],
|
||||
) -> list[str]:
|
||||
|
||||
board = "T1B1/boards/t1b1-unix.h"
|
||||
hw_model = get_hw_model_as_number("T1B1")
|
||||
hw_revision = 0
|
||||
mcu = "STM32F405xx"
|
||||
|
||||
features = []
|
||||
defines += [mcu]
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
defines += [f"MCU_TYPE={mcu}"]
|
||||
defines += ["FLASH_BIT_ACCESS=1"]
|
||||
defines += ["FLASH_BLOCK_WORDS=1"]
|
||||
|
||||
if "input" in features_wanted:
|
||||
features.append("button")
|
||||
|
||||
sources += ["embed/models/T1B1/model_T1B1_layout.c"]
|
||||
|
||||
return features
|
@ -0,0 +1,32 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .emulator import configure as emul
|
||||
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 == "emulator":
|
||||
return emul(env, features_wanted, defines, sources, paths)
|
||||
elif 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")
|
@ -0,0 +1,42 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .. import get_hw_model_as_number
|
||||
|
||||
|
||||
def configure(
|
||||
env: dict,
|
||||
features_wanted: list[str],
|
||||
defines: list[str | tuple[str, str]],
|
||||
sources: list[str],
|
||||
paths: list[str],
|
||||
) -> list[str]:
|
||||
|
||||
board = "T2B1/boards/t2b1-unix.h"
|
||||
hw_model = get_hw_model_as_number("T2B1")
|
||||
hw_revision = 0
|
||||
mcu = "STM32F427xx"
|
||||
|
||||
features = []
|
||||
defines += [mcu]
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
defines += [f"MCU_TYPE={mcu}"]
|
||||
defines += ["FLASH_BIT_ACCESS=1"]
|
||||
defines += ["FLASH_BLOCK_WORDS=1"]
|
||||
|
||||
if "sbu" in features_wanted:
|
||||
sources += ["embed/trezorhal/unix/sbu.c"]
|
||||
|
||||
if "optiga_hal" in features_wanted:
|
||||
sources += ["embed/trezorhal/unix/optiga_hal.c"]
|
||||
|
||||
if "optiga" in features_wanted:
|
||||
sources += ["embed/trezorhal/unix/optiga.c"]
|
||||
|
||||
if "input" in features_wanted:
|
||||
features.append("button")
|
||||
|
||||
sources += ["embed/models/T2B1/model_T2B1_layout.c"]
|
||||
|
||||
return features
|
@ -0,0 +1,20 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .emulator import configure as emul
|
||||
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],
|
||||
):
|
||||
if revision == "emulator":
|
||||
return emul(env, features_wanted, defines, sources, paths)
|
||||
else:
|
||||
return configure(env, features_wanted, defines, sources, paths)
|
@ -0,0 +1,51 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .. import get_hw_model_as_number
|
||||
|
||||
|
||||
def configure(
|
||||
env: dict,
|
||||
features_wanted: list[str],
|
||||
defines: list[str | tuple[str, str]],
|
||||
sources: list[str],
|
||||
paths: list[str],
|
||||
) -> list[str]:
|
||||
|
||||
board = "T2T1/boards/t2t1-unix.h"
|
||||
hw_model = get_hw_model_as_number("T2T1")
|
||||
hw_revision = 0
|
||||
mcu = "STM32F427xx"
|
||||
|
||||
features = []
|
||||
defines += [mcu]
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
defines += [f"MCU_TYPE={mcu}"]
|
||||
defines += ["FLASH_BIT_ACCESS=1"]
|
||||
defines += ["FLASH_BLOCK_WORDS=1"]
|
||||
|
||||
if "dma2d" in features_wanted:
|
||||
features.append("dma2d")
|
||||
sources += ["embed/lib/dma2d_emul.c"]
|
||||
defines += ["USE_DMA2D"]
|
||||
|
||||
if "sd_card" in features_wanted:
|
||||
features.append("sd_card")
|
||||
sources += [
|
||||
"embed/trezorhal/unix/sdcard.c",
|
||||
"embed/extmod/modtrezorio/ff.c",
|
||||
"embed/extmod/modtrezorio/ffunicode.c",
|
||||
]
|
||||
|
||||
if "sbu" in features_wanted:
|
||||
sources += ["embed/trezorhal/unix/sbu.c"]
|
||||
|
||||
if "input" in features_wanted:
|
||||
features.append("touch")
|
||||
|
||||
features.append("backlight")
|
||||
|
||||
sources += ["embed/models/T2T1/model_T2T1_layout.c"]
|
||||
|
||||
return features
|
@ -0,0 +1,26 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .emulator import configure as emul
|
||||
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 == "emulator":
|
||||
return emul(env, features_wanted, defines, sources, paths)
|
||||
elif 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")
|
@ -0,0 +1,58 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .. import get_hw_model_as_number
|
||||
|
||||
|
||||
def configure(
|
||||
env: dict,
|
||||
features_wanted: list[str],
|
||||
defines: list[str | tuple[str, str]],
|
||||
sources: list[str],
|
||||
paths: list[str],
|
||||
) -> list[str]:
|
||||
|
||||
board = "T3T1/boards/t3t1-unix.h"
|
||||
hw_model = get_hw_model_as_number("T3T1")
|
||||
hw_revision = 0
|
||||
mcu = "STM32FU585xx"
|
||||
|
||||
features = []
|
||||
defines += [mcu]
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
defines += [f"MCU_TYPE={mcu}"]
|
||||
# todo change to blockwise flash when implemented in unix
|
||||
defines += ["FLASH_BIT_ACCESS=1"]
|
||||
defines += ["FLASH_BLOCK_WORDS=1"]
|
||||
|
||||
if "dma2d" in features_wanted:
|
||||
features.append("dma2d")
|
||||
sources += ["embed/lib/dma2d_emul.c"]
|
||||
defines += ["USE_DMA2D"]
|
||||
|
||||
if "sd_card" in features_wanted:
|
||||
features.append("sd_card")
|
||||
sources += [
|
||||
"embed/trezorhal/unix/sdcard.c",
|
||||
"embed/extmod/modtrezorio/ff.c",
|
||||
"embed/extmod/modtrezorio/ffunicode.c",
|
||||
]
|
||||
|
||||
if "sbu" in features_wanted:
|
||||
sources += ["embed/trezorhal/unix/sbu.c"]
|
||||
|
||||
if "optiga_hal" in features_wanted:
|
||||
sources += ["embed/trezorhal/unix/optiga_hal.c"]
|
||||
|
||||
if "optiga" in features_wanted:
|
||||
sources += ["embed/trezorhal/unix/optiga.c"]
|
||||
|
||||
if "input" in features_wanted:
|
||||
features.append("touch")
|
||||
|
||||
features.append("backlight")
|
||||
|
||||
sources += ["embed/models/T3T1/model_T3T1_layout.c"]
|
||||
|
||||
return features
|
@ -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")
|