1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 20:19:23 +00:00

chore(core): clean sconscripts

[no changelog]
This commit is contained in:
tychovrahe 2024-09-25 10:33:38 +02:00 committed by TychoVrahe
parent d412ce987e
commit 94af4d98f0
9 changed files with 21 additions and 74 deletions

View File

@ -9,18 +9,6 @@ HW_REVISION = ARGUMENTS.get('HW_REVISION', None)
NEW_RENDERING = ARGUMENTS.get('NEW_RENDERING', '1') == '1'
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
if TREZOR_MODEL in ('1', ):
# skip boardloader build
env = Environment()
def build_boardloader(target,source,env):
print(f'Boardloader: nothing to build for Model {TREZOR_MODEL}')
program_bin = env.Command(
target='boardloader.bin',
source=None,
action=build_boardloader
)
Return()
FEATURES_WANTED = ["sd_card"]
if NEW_RENDERING:

View File

@ -11,18 +11,6 @@ HW_REVISION = ARGUMENTS.get('HW_REVISION', None)
NEW_RENDERING = ARGUMENTS.get('NEW_RENDERING', '1') == '1' or TREZOR_MODEL in ('T3T1',)
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
if TREZOR_MODEL in ('1', ):
# skip bootloader build
env = Environment()
def build_bootloader(target,source,env):
print(f'Bootloader: nothing to build for Model {TREZOR_MODEL}')
program_bin = env.Command(
target='bootloader.bin',
source=None,
action=build_bootloader
)
Return()
FEATURES_WANTED = ["input", "rgb_led", "consumption_mask", "usb", "optiga", "dma2d"]
if NEW_RENDERING:
@ -258,9 +246,7 @@ def cargo_build():
profile = '--release'
else:
profile = ''
if TREZOR_MODEL in ("1",):
features = ["model_t1"]
elif TREZOR_MODEL in ("R", "T3B1"):
if TREZOR_MODEL in ("R", "T3B1"):
features = ["model_tr"]
elif TREZOR_MODEL in ("T3T1",):
features = ["model_mercury"]

View File

@ -9,18 +9,6 @@ HW_REVISION = ARGUMENTS.get('HW_REVISION', None)
NEW_RENDERING = ARGUMENTS.get('NEW_RENDERING', '1') == '1' or TREZOR_MODEL in ('T3T1',)
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
if TREZOR_MODEL in ('1', 'DISC1', 'DISC2'):
# skip bootloader_ci build
env = Environment()
def build_bootloader_ci(target,source,env):
print(f'Bootloader_ci: nothing to build for Model {TREZOR_MODEL}')
program_bin = env.Command(
target='bootloader.bin',
source=None,
action=build_bootloader_ci
)
Return()
FEATURES_WANTED = ["input", "rgb_led", "consumption_mask", "usb", "optiga"]
if NEW_RENDERING:
@ -35,7 +23,7 @@ CPPDEFINES_HAL = []
SOURCE_HAL = []
PATH_HAL = []
if TREZOR_MODEL in ('1', 'R', 'T3B1'):
if TREZOR_MODEL in ('R', 'T3B1'):
FONT_NORMAL='Font_PixelOperator_Regular_8'
FONT_DEMIBOLD=None
FONT_BOLD=None
@ -44,7 +32,7 @@ if TREZOR_MODEL in ('1', 'R', 'T3B1'):
FONT_NORMAL_UPPER='Font_PixelOperator_Regular_8_upper'
FONT_BOLD_UPPER=None
FONT_SUB=None
elif TREZOR_MODEL in ('T',):
elif TREZOR_MODEL in ('T', 'DISC1', 'DISC2'):
FONT_NORMAL='Font_Roboto_Regular_20'
FONT_DEMIBOLD=None
FONT_BOLD=None

View File

@ -8,7 +8,7 @@ CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
HW_REVISION = 'emulator'
NEW_RENDERING = ARGUMENTS.get('NEW_RENDERING', '1') == '1' or TREZOR_MODEL in ('T3T1',)
if TREZOR_MODEL in ('1', 'DISC1', 'DISC2'):
if not models.has_emulator(TREZOR_MODEL):
# skip bootloader build
env = Environment()
def build_bootloader(target,source,env):
@ -33,7 +33,7 @@ CPPDEFINES_MOD = []
SOURCE_MOD = []
SOURCE_MOD_CRYPTO = []
if TREZOR_MODEL in ('1', 'R', 'T3B1'):
if TREZOR_MODEL in ('R', 'T3B1'):
FONT_NORMAL='Font_PixelOperator_Regular_8'
FONT_DEMIBOLD='Font_PixelOperator_Regular_8'
FONT_BOLD='Font_PixelOperator_Bold_8'
@ -276,9 +276,7 @@ else:
RUST_LIBPATH = f'{RUST_LIBDIR}/lib{RUST_LIB}.a'
def cargo_build():
if TREZOR_MODEL in ("1",):
features = ["model_t1"]
elif TREZOR_MODEL in ("R", "T3B1"):
if TREZOR_MODEL in ("R", "T3B1"):
features = ["model_tr"]
elif TREZOR_MODEL in ("T3T1",):
features = ["model_mercury"]

View File

@ -41,7 +41,7 @@ PATH_HAL = []
FROZEN = True
if TREZOR_MODEL in ('1', 'R', 'T3B1'):
if TREZOR_MODEL in ('R', 'T3B1'):
FONT_NORMAL='Font_PixelOperator_Regular_8'
FONT_DEMIBOLD='Font_Unifont_Bold_16'
FONT_BOLD='Font_PixelOperator_Bold_8'
@ -254,11 +254,7 @@ else:
CPPDEFINES_MOD += [
'TREZOR_UI2',
'TRANSLATIONS',
]
if TREZOR_MODEL not in ('1', ):
CPPDEFINES_MOD += [
'FANCY_FATAL_ERROR',
'FANCY_FATAL_ERROR',
]
# modtrezorutils
@ -442,7 +438,7 @@ SOURCE_FIRMWARE = [
if TREZOR_MODEL in ('T', 'DISC1', 'DISC2'):
UI_LAYOUT = 'UI_LAYOUT_TT'
ui_layout_feature = 'model_tt'
elif TREZOR_MODEL in ('1', 'R', 'T3B1'):
elif TREZOR_MODEL in ('R', 'T3B1'):
UI_LAYOUT = 'UI_LAYOUT_TR'
ui_layout_feature = 'model_tr'
elif TREZOR_MODEL in ('T3T1',):

View File

@ -10,17 +10,6 @@ BOOTLOADER_DEVEL = ARGUMENTS.get('BOOTLOADER_DEVEL', '0') == '1'
HW_REVISION = ARGUMENTS.get('HW_REVISION', None)
NEW_RENDERING = ARGUMENTS.get('NEW_RENDERING', '1') == '1'
if TREZOR_MODEL in ('DISC1', 'DISC2'):
# skip prodtest build
env = Environment()
def build_prodtest(target,source,env):
print(f'Prodtest: nothing to build for Model {TREZOR_MODEL}')
program_bin = env.Command(
target='prodtest.bin',
source=None,
action=build_prodtest)
Return()
FEATURES_WANTED = ["input", "sbu", "sd_card", "rdb_led", "usb", "consumption_mask", "optiga", "haptic"]
if NEW_RENDERING:
@ -39,7 +28,7 @@ CPPDEFINES_HAL = []
SOURCE_HAL = []
PATH_HAL = []
if TREZOR_MODEL in ('1', 'R', 'T3B1'):
if TREZOR_MODEL in ('R', 'T3B1'):
FONT_NORMAL=None
FONT_DEMIBOLD=None
FONT_BOLD='Font_PixelOperator_Bold_8'
@ -48,7 +37,7 @@ if TREZOR_MODEL in ('1', 'R', 'T3B1'):
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER=None
FONT_SUB=None
elif TREZOR_MODEL in ('T',):
elif TREZOR_MODEL in ('T', 'DISC1', 'DISC2'):
FONT_NORMAL=None
FONT_DEMIBOLD=None
FONT_BOLD='Font_Roboto_Bold_20'

View File

@ -33,7 +33,7 @@ CPPDEFINES_HAL = []
SOURCE_HAL = []
PATH_HAL = []
if TREZOR_MODEL in ('1', 'R', 'T3B1'):
if TREZOR_MODEL in ('R', 'T3B1'):
FONT_NORMAL=None
FONT_DEMIBOLD=None
FONT_BOLD='Font_PixelOperator_Bold_8'

View File

@ -17,7 +17,7 @@ FEATURES_WANTED = ["input", "sd_card", "dma2d", "optiga", "sbu"]
if NEW_RENDERING:
FEATURES_WANTED.append("new_rendering")
if TREZOR_MODEL in ('DISC1', 'DISC2'):
if not models.has_emulator(TREZOR_MODEL):
# skip unix build
env = Environment()
def build_unix(target,source,env):
@ -47,7 +47,7 @@ PYOPT = ARGUMENTS.get('PYOPT', '1')
FROZEN = ARGUMENTS.get('TREZOR_EMULATOR_FROZEN', 0)
RASPI = os.getenv('TREZOR_EMULATOR_RASPI') == '1'
if TREZOR_MODEL in ('1', 'R', 'T3B1'):
if TREZOR_MODEL in ('R', 'T3B1'):
FONT_NORMAL='Font_PixelOperator_Regular_8'
FONT_DEMIBOLD='Font_Unifont_Bold_16'
FONT_BOLD='Font_PixelOperator_Bold_8'
@ -264,10 +264,7 @@ else:
CPPDEFINES_MOD += [
'TREZOR_UI2',
'TRANSLATIONS',
]
if TREZOR_MODEL not in ('1', ):
CPPDEFINES_MOD += [
'FANCY_FATAL_ERROR',
'FANCY_FATAL_ERROR',
]
if FROZEN:
@ -485,7 +482,7 @@ FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_
if TREZOR_MODEL in ('T',):
UI_LAYOUT = 'UI_LAYOUT_TT'
ui_layout_feature = 'model_tt'
elif TREZOR_MODEL in ('1', 'R', 'T3B1'):
elif TREZOR_MODEL in ('R', 'T3B1'):
UI_LAYOUT = 'UI_LAYOUT_TR'
ui_layout_feature = 'model_tr'
elif TREZOR_MODEL in ('T3T1',):

View File

@ -38,3 +38,8 @@ def get_model_identifier(model: str) -> str:
return "D002"
else:
return model
def has_emulator(model: str) -> bool:
imported_module = importlib.import_module("models." + get_model_identifier(model))
return hasattr(imported_module, "emulator")