1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 20:38:10 +00:00

refactor(core): reorganize model-specific files in embed/models

[no changelog]
This commit is contained in:
tychovrahe 2024-04-15 11:17:14 +02:00 committed by TychoVrahe
parent 0b5e8ed480
commit 9166dc330e
54 changed files with 3124 additions and 61 deletions

View File

@ -45,28 +45,28 @@ OPENOCD_TRANSPORT ?= hla_swd
ifeq ($(TREZOR_MODEL), 1)
MCU = STM32F2
LAYOUT_FILE = embed/models/model_T1B1.h
LAYOUT_FILE = embed/models/T1B1/model_T1B1.h
OPENOCD_TARGET = target/stm32f2x.cfg
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T))
MCU = STM32F4
LAYOUT_FILE = embed/models/model_T2T1.h
LAYOUT_FILE = embed/models/T2T1/model_T2T1.h
OPENOCD_TARGET = target/stm32f4x.cfg
MODEL_FEATURE = model_tt
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),R))
MCU = STM32F4
LAYOUT_FILE = embed/models/model_T2B1.h
LAYOUT_FILE = embed/models/T2B1/model_T2B1.h
OPENOCD_TARGET = target/stm32f4x.cfg
MODEL_FEATURE = model_tr
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T3T1))
MCU = STM32U5
OPENOCD_TARGET = target/stm32u5x.cfg
LAYOUT_FILE = embed/models/model_T3T1.h
LAYOUT_FILE = embed/models/T3T1/model_T3T1.h
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),DISC1))
MCU = STM32F4
LAYOUT_FILE = embed/models/model_D001.h
LAYOUT_FILE = embed/models/D001/model_D001.h
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),DISC2))
MCU = STM32U5
LAYOUT_FILE = embed/models/model_D002.h
LAYOUT_FILE = embed/models/D002/model_D002.h
OPENOCD_TARGET = target/stm32u5x.cfg
else
$(error Unknown TREZOR_MODEL: $(TREZOR_MODEL))

View File

@ -0,0 +1 @@
../T2T1/model_T2T1_layout.c

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -16,7 +16,7 @@
#define ORIENTATION_NS 1
#define BACKGROUND_FILE "background_1.h"
#define BACKGROUND_FILE "T1B1/background_1.h"
#define BACKGROUND_NAME background_1_jpg
#endif // BOARDS_T1B1_UNIX_H

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -18,7 +18,7 @@
#define ORIENTATION_NS 1
#define BACKGROUND_FILE "background_T2B1.h"
#define BACKGROUND_NAME background_T2B1_jpg
#define BACKGROUND_FILE "T2B1/background_T2B1.h"
#define BACKGROUND_NAME background_T2B1_png
#endif // BOARDS_T2B1_UNIX_H

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -31,7 +31,7 @@
#define TOUCH_OFFSET_X 80
#define TOUCH_OFFSET_Y 110
#define BACKGROUND_FILE "background_T.h"
#define BACKGROUND_FILE "T2T1/background_T.h"
#define BACKGROUND_NAME background_T_jpg
#endif

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -21,7 +21,7 @@
#define ORIENTATION_NSEW 1
#define BACKGROUND_FILE "background_T.h"
#define BACKGROUND_NAME background_T_jpg
#define BACKGROUND_FILE "T3T1/background_T3T1.h"
#define BACKGROUND_NAME background_T3T1_jpg
#endif // BOARDS_T3T1_UNIX_H

View File

@ -4,17 +4,17 @@
#include "layout_common.h"
#if defined TREZOR_MODEL_1
#include "model_T1B1.h"
#include "T1B1/model_T1B1.h"
#elif defined TREZOR_MODEL_T
#include "model_T2T1.h"
#include "T2T1/model_T2T1.h"
#elif defined TREZOR_MODEL_R
#include "model_T2B1.h"
#include "T2B1/model_T2B1.h"
#elif defined TREZOR_MODEL_T3T1
#include "model_T3T1.h"
#include "T3T1/model_T3T1.h"
#elif defined TREZOR_MODEL_DISC1
#include "model_D001.h"
#include "D001/model_D001.h"
#elif defined TREZOR_MODEL_DISC2
#include "model_D002.h"
#include "D002/model_D002.h"
#else
#error Unknown Trezor model
#endif

View File

@ -1 +0,0 @@
model_T2T1_layout.c

View File

@ -12,7 +12,7 @@ def configure(
paths: list[str],
) -> list[str]:
features_available: list[str] = []
board = "stm32f429i-disc1.h"
board = "D001/boards/stm32f429i-disc1.h"
display = "ltdc.c"
hw_model = get_hw_model_as_number("D001")
hw_revision = 0
@ -30,11 +30,11 @@ def configure(
env.get("ENV")["RUST_TARGET"] = "thumbv7em-none-eabihf"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
sources += [
"embed/models/model_D001_layout.c",
"embed/models/D001/model_D001_layout.c",
]
if "new_rendering" in features_wanted:

View File

@ -12,7 +12,7 @@ def configure(
paths: list[str],
) -> list[str]:
features_available: list[str] = []
board = "stm32u5a9j-dk.h"
board = "D002/boards/stm32u5a9j-dk.h"
display = "dsi.c"
hw_model = get_hw_model_as_number("D002")
hw_revision = 0
@ -32,7 +32,7 @@ def configure(
defines += [mcu]
defines += [
f'TREZOR_BOARD=\\"boards/{board}\\"',
f'TREZOR_BOARD=\\"{board}\\"',
]
defines += [
f"HW_MODEL={hw_model}",
@ -41,7 +41,7 @@ def configure(
f"HW_REVISION={hw_revision}",
]
sources += [
"embed/models/model_D002_layout.c",
"embed/models/D002/model_D002_layout.c",
]
if "new_rendering" in features_wanted:

View File

@ -12,7 +12,7 @@ def configure(
) -> list[str]:
features_available: list[str] = []
board = "t1b1-unix.h"
board = "T1B1/boards/t1b1-unix.h"
hw_model = get_hw_model_as_number("T1B1")
hw_revision = 0
mcu = "STM32F405xx"
@ -23,7 +23,7 @@ def configure(
features_available.append("display_mono")
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
defines += [f"MCU_TYPE={mcu}"]
@ -33,6 +33,6 @@ def configure(
if "input" in features_wanted:
features_available.append("button")
sources += ["embed/models/model_T1B1_layout.c"]
sources += ["embed/models/T1B1/model_T1B1_layout.c"]
return features_available

View File

@ -12,7 +12,7 @@ def configure(
paths: list[str],
) -> list[str]:
features_available: list[str] = []
board = "trezor_1.h"
board = "T1B1/boards/trezor_1.h"
display = "vg-2864ksweg01.c"
hw_model = get_hw_model_as_number("T1B1")
hw_revision = 0
@ -28,11 +28,11 @@ def configure(
env.get("ENV")["RUST_TARGET"] = "thumbv7m-none-eabi"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
sources += [
"embed/models/model_T1B1_layout.c",
"embed/models/T1B1/model_T1B1_layout.c",
]
sources += [f"embed/trezorhal/stm32f4/displays/{display}"]

View File

@ -12,7 +12,7 @@ def configure(
) -> list[str]:
features_available: list[str] = []
board = "t2b1-unix.h"
board = "T2B1/boards/t2b1-unix.h"
hw_model = get_hw_model_as_number("T2B1")
hw_revision = 0
mcu = "STM32F427xx"
@ -23,7 +23,7 @@ def configure(
features_available.append("display_mono")
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
defines += [f"MCU_TYPE={mcu}"]
@ -43,6 +43,6 @@ def configure(
if "input" in features_wanted:
features_available.append("button")
sources += ["embed/models/model_T2B1_layout.c"]
sources += ["embed/models/T2B1/model_T2B1_layout.c"]
return features_available

View File

@ -14,7 +14,7 @@ def configure(
features_available: list[str] = []
hw_model = get_hw_model_as_number("T2B1")
hw_revision = 10
board = "trezor_r_v10.h"
board = "T2B1/boards/trezor_r_v10.h"
display = "vg-2864ksweg01.c"
if "new_rendering" in features_wanted:
@ -35,11 +35,11 @@ def configure(
env.get("ENV")["RUST_TARGET"] = "thumbv7em-none-eabihf"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
sources += [
"embed/models/model_T2B1_layout.c",
"embed/models/T2B1/model_T2B1_layout.c",
]
if "new_rendering" in features_wanted:

View File

@ -14,7 +14,7 @@ def configure(
features_available: list[str] = []
hw_model = get_hw_model_as_number("T2B1")
hw_revision = 3
board = "trezor_r_v3.h"
board = "T2B1/boards/trezor_r_v3.h"
display = "ug-2828tswig01.c"
if "new_rendering" in features_wanted:
@ -35,11 +35,11 @@ def configure(
env.get("ENV")["RUST_TARGET"] = "thumbv7em-none-eabihf"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
sources += [
"embed/models/model_T2B1_layout.c",
"embed/models/T2B1/model_T2B1_layout.c",
]
if "new_rendering" in features_wanted:

View File

@ -14,7 +14,7 @@ def configure(
features_available: list[str] = []
hw_model = get_hw_model_as_number("T2B1")
hw_revision = 4
board = "trezor_r_v4.h"
board = "T2B1/boards/trezor_r_v4.h"
display = "vg-2864ksweg01.c"
if "new_rendering" in features_wanted:
@ -35,11 +35,11 @@ def configure(
env.get("ENV")["RUST_TARGET"] = "thumbv7em-none-eabihf"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
sources += [
"embed/models/model_T2B1_layout.c",
"embed/models/T2B1/model_T2B1_layout.c",
]
if "new_rendering" in features_wanted:

View File

@ -14,7 +14,7 @@ def configure(
features_available: list[str] = []
hw_model = get_hw_model_as_number("T2B1")
hw_revision = 6
board = "trezor_r_v6.h"
board = "T2B1/boards/trezor_r_v6.h"
display = "vg-2864ksweg01.c"
if "new_rendering" in features_wanted:
@ -35,11 +35,11 @@ def configure(
env.get("ENV")["RUST_TARGET"] = "thumbv7em-none-eabihf"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
sources += [
"embed/models/model_T2B1_layout.c",
"embed/models/T2B1/model_T2B1_layout.c",
]
if "new_rendering" in features_wanted:

View File

@ -12,7 +12,7 @@ def configure(
) -> list[str]:
features_available: list[str] = []
board = "t2t1-unix.h"
board = "T2T1/boards/t2t1-unix.h"
hw_model = get_hw_model_as_number("T2T1")
hw_revision = 0
mcu = "STM32F427xx"
@ -22,7 +22,7 @@ def configure(
features_available.append("display_rgb565")
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
defines += [f"MCU_TYPE={mcu}"]
@ -55,6 +55,6 @@ def configure(
features_available.append("backlight")
sources += ["embed/models/model_T2T1_layout.c"]
sources += ["embed/models/T2T1/model_T2T1_layout.c"]
return features_available

View File

@ -12,7 +12,7 @@ def configure(
paths: list[str],
) -> list[str]:
features_available: list[str] = []
board = "trezor_t.h"
board = "T2T1/boards/trezor_t.h"
display = "st7789v.c"
hw_model = get_hw_model_as_number("T2T1")
hw_revision = 0
@ -34,11 +34,11 @@ def configure(
env.get("ENV")["RUST_TARGET"] = "thumbv7em-none-eabihf"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
sources += [
"embed/models/model_T2T1_layout.c",
"embed/models/T2T1/model_T2T1_layout.c",
]
if "new_rendering" in features_wanted:
sources += ["embed/trezorhal/xdisplay_legacy.c"]

View File

@ -12,7 +12,7 @@ def configure(
) -> list[str]:
features_available: list[str] = []
board = "t3t1-unix.h"
board = "T3T1/boards/t3t1-unix.h"
hw_model = get_hw_model_as_number("T3T1")
hw_revision = 0
mcu = "STM32FU585xx"
@ -23,7 +23,7 @@ def configure(
features_available.append("display_rgb565")
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
defines += [f"MCU_TYPE={mcu}"]
@ -63,6 +63,6 @@ def configure(
features_available.append("backlight")
sources += ["embed/models/model_T3T1_layout.c"]
sources += ["embed/models/T3T1/model_T3T1_layout.c"]
return features_available

View File

@ -12,7 +12,7 @@ def configure(
paths: list[str],
) -> list[str]:
features_available: list[str] = []
board = "trezor_t3t1_revE.h"
board = "T3T1/boards/trezor_t3t1_revE.h"
display = "st7789v.c"
hw_model = get_hw_model_as_number("T3T1")
hw_revision = 0
@ -39,11 +39,11 @@ def configure(
env.get("ENV")["RUST_TARGET"] = "thumbv8m.main-none-eabihf"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
sources += [
"embed/models/model_T3T1_layout.c",
"embed/models/T3T1/model_T3T1_layout.c",
]
if "new_rendering" in features_wanted:

View File

@ -12,7 +12,7 @@ def configure(
paths: list[str],
) -> list[str]:
features_available: list[str] = []
board = "trezor_t3t1_v4.h"
board = "T3T1/boards/trezor_t3t1_v4.h"
display = "st7789v.c"
hw_model = get_hw_model_as_number("T3T1")
hw_revision = 0
@ -39,11 +39,11 @@ def configure(
env.get("ENV")["RUST_TARGET"] = "thumbv8m.main-none-eabihf"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
sources += [
"embed/models/model_T3T1_layout.c",
"embed/models/T3T1/model_T3T1_layout.c",
]
sources += [f"embed/trezorhal/stm32u5/displays/{display}"]