mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-10 15:30:55 +00:00
build(core): use internal model names everywhere
TREZOR_MODEL=T and TREZOR_MODEL=R no longer work, please use TREZOR_MODEL=T2T1 and TREZOR_MODEL=T2B1 [no changelog]
This commit is contained in:
parent
862c987779
commit
aa12e1ab3c
5
.github/workflows/common.yml
vendored
5
.github/workflows/common.yml
vendored
@ -133,14 +133,13 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# model: [T1B1, T2T1, T2B1, T3B1, T3T1] # TODO update exprs below
|
||||
model: ["1", "T", "R", T3B1, T3T1]
|
||||
model: [T1B1, T2T1, T2B1, T3B1, T3T1]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: git checkout ${{ github.head_ref || github.ref_name }}
|
||||
- run: ./build-docker.sh ${{ matrix.model == '1' && '--skip-core' || '--skip-legacy' }} --models ${{ matrix.model }} ${{ github.head_ref || github.ref_name }}
|
||||
- run: ./build-docker.sh ${{ matrix.model == 'T1B1' && '--skip-core' || '--skip-legacy' }} --models ${{ matrix.model }} --targets bootloader,firmware,prodtest ${{ github.head_ref || github.ref_name }}
|
||||
- name: Show fingerprints
|
||||
run: |
|
||||
for file in build/*/*/*.fingerprint; do
|
||||
|
4
.github/workflows/core-hw.yml
vendored
4
.github/workflows/core-hw.yml
vendored
@ -31,7 +31,7 @@ jobs:
|
||||
model: [T2T1, T2B1]
|
||||
coins: [universal, btconly]
|
||||
env:
|
||||
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || 'R' }}
|
||||
TREZOR_MODEL: ${{ matrix.model }}
|
||||
TREZOR_PYTEST_SKIP_ALTCOINS: ${{ matrix.coins == 'btconly' && '1' || '0' }}
|
||||
PYTEST_TIMEOUT: 1200
|
||||
PYOPT: 0
|
||||
@ -74,7 +74,7 @@ jobs:
|
||||
matrix:
|
||||
model: [T2T1, T2B1]
|
||||
env:
|
||||
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || 'R' }}
|
||||
TREZOR_MODEL: ${{ matrix.model }}
|
||||
PYTEST_TIMEOUT: 1200
|
||||
PYOPT: 0
|
||||
DISABLE_OPTIGA: 1
|
||||
|
14
.github/workflows/core.yml
vendored
14
.github/workflows/core.yml
vendored
@ -65,7 +65,7 @@ jobs:
|
||||
- model: T3W1
|
||||
type: production
|
||||
env:
|
||||
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model == 'D001' && 'DISC1' || matrix.model }}
|
||||
TREZOR_MODEL: ${{ matrix.model }}
|
||||
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
|
||||
PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }}
|
||||
PRODUCTION: ${{ matrix.type == 'production' && '1' || '0' }}
|
||||
@ -116,7 +116,7 @@ jobs:
|
||||
- type: normal
|
||||
asan: asan
|
||||
env:
|
||||
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }}
|
||||
TREZOR_MODEL: ${{ matrix.model }}
|
||||
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
|
||||
PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }}
|
||||
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
|
||||
@ -154,7 +154,7 @@ jobs:
|
||||
- type: normal
|
||||
asan: asan
|
||||
env:
|
||||
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }}
|
||||
TREZOR_MODEL: ${{ matrix.model }}
|
||||
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
|
||||
PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }}
|
||||
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
|
||||
@ -186,7 +186,7 @@ jobs:
|
||||
model: [T2T1, T3B1, T3T1, T3W1]
|
||||
asan: ${{ fromJSON(needs.param.outputs.asan) }}
|
||||
env:
|
||||
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }}
|
||||
TREZOR_MODEL: ${{ matrix.model }}
|
||||
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
|
||||
LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt"
|
||||
steps:
|
||||
@ -209,7 +209,7 @@ jobs:
|
||||
model: [T2T1, T3B1, T3T1, T3W1]
|
||||
asan: ${{ fromJSON(needs.param.outputs.asan) }}
|
||||
env:
|
||||
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }}
|
||||
TREZOR_MODEL: ${{ matrix.model }}
|
||||
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
|
||||
RUSTC_BOOTSTRAP: ${{ matrix.asan == 'asan' && '1' || '0' }}
|
||||
RUSTFLAGS: ${{ matrix.asan == 'asan' && '-Z sanitizer=address' || '' }}
|
||||
@ -262,7 +262,7 @@ jobs:
|
||||
lang: ${{ fromJSON(needs.param.outputs.test_lang) }}
|
||||
env:
|
||||
TREZOR_PROFILING: ${{ matrix.asan == 'noasan' && '1' || '0' }}
|
||||
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }}
|
||||
TREZOR_MODEL: ${{ matrix.model }}
|
||||
TREZOR_PYTEST_SKIP_ALTCOINS: ${{ matrix.coins == 'btconly' && '1' || '0' }}
|
||||
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
|
||||
PYTEST_TIMEOUT: ${{ matrix.asan == 'asan' && 600 || 400 }}
|
||||
@ -451,7 +451,7 @@ jobs:
|
||||
if: false # NOTE manual job, comment out to run
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TREZOR_MODEL: T
|
||||
TREZOR_MODEL: T2T1
|
||||
TREZOR_MEMPERF: 1
|
||||
PYOPT: 0
|
||||
PYTEST_TIMEOUT: 900
|
||||
|
@ -54,7 +54,7 @@ function help_and_die() {
|
||||
echo " --skip-legacy - do not build legacy"
|
||||
echo " --repository path/to/repo - checkout the repository from the given path/url"
|
||||
echo " --no-init - do not recreate docker environments"
|
||||
echo " --models - comma-separated list of models. default: --models R,T"
|
||||
echo " --models - comma-separated list of models. default: --models T2B1,T2T1,T3T1"
|
||||
echo " --targets - comma-separated list of targets for core build. default: --targets boardloader,bootloader,firmware"
|
||||
echo " --help"
|
||||
echo
|
||||
@ -69,7 +69,7 @@ OPT_BUILD_LEGACY=1
|
||||
OPT_BUILD_NORMAL=1
|
||||
OPT_BUILD_BITCOINONLY=1
|
||||
INIT=1
|
||||
MODELS=(R T T3T1)
|
||||
MODELS=(T2B1 T2T1 T3T1)
|
||||
CORE_TARGETS=(boardloader bootloader firmware)
|
||||
|
||||
REPOSITORY="file:///local"
|
||||
@ -324,6 +324,7 @@ for BITCOIN_ONLY in ${VARIANTS_legacy[@]}; do
|
||||
|
||||
DIRSUFFIX=${BITCOIN_ONLY/1/-bitcoinonly}
|
||||
DIRSUFFIX=${DIRSUFFIX/0/}
|
||||
DIRSUFFIX="-T1B1${DIRSUFFIX}"
|
||||
|
||||
SCRIPT_NAME=".build_legacy_$BITCOIN_ONLY.sh"
|
||||
cat <<EOF > "build/$SCRIPT_NAME"
|
||||
|
@ -32,7 +32,7 @@ BITCOIN_ONLY ?= 0
|
||||
BOOTLOADER_QA ?= 0
|
||||
BOOTLOADER_DEVEL ?= 0
|
||||
DISABLE_OPTIGA ?= 0
|
||||
TREZOR_MODEL ?= T
|
||||
TREZOR_MODEL ?= T2T1
|
||||
TREZOR_MEMPERF ?= 0
|
||||
ADDRESS_SANITIZER ?= 0
|
||||
CMAKELISTS ?= 0
|
||||
@ -50,11 +50,11 @@ OPENOCD_INTERFACE ?= stlink
|
||||
# OpenOCD transport default. Alternative: jtag
|
||||
OPENOCD_TRANSPORT ?= hla_swd
|
||||
|
||||
ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T))
|
||||
ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T2T1))
|
||||
MCU = STM32F4
|
||||
OPENOCD_TARGET = target/stm32f4x.cfg
|
||||
LAYOUT_FEATURE = layout_bolt
|
||||
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),R))
|
||||
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T2B1))
|
||||
MCU = STM32F4
|
||||
OPENOCD_TARGET = target/stm32f4x.cfg
|
||||
LAYOUT_FEATURE = layout_samson
|
||||
@ -70,10 +70,10 @@ else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T3W1))
|
||||
MCU = STM32U5
|
||||
OPENOCD_TARGET = target/stm32u5x.cfg
|
||||
LAYOUT_FEATURE = layout_bolt
|
||||
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),DISC1))
|
||||
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),D001))
|
||||
MCU = STM32F4
|
||||
OPENOCD_TARGET = target/stm32f4x.cfg
|
||||
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),DISC2))
|
||||
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),D002))
|
||||
MCU = STM32U5
|
||||
OPENOCD_TARGET = target/stm32u5x.cfg
|
||||
else
|
||||
|
@ -3,10 +3,9 @@
|
||||
import os
|
||||
import tools, models
|
||||
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T2T1')
|
||||
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
||||
HW_REVISION = ARGUMENTS.get('HW_REVISION', None)
|
||||
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
|
||||
|
||||
FEATURES_WANTED = ["sd_card"]
|
||||
|
||||
@ -163,7 +162,7 @@ obj_program += env.Object(source=SOURCE_HAL)
|
||||
|
||||
linkerscript_gen = env.Command(
|
||||
target='memory.ld',
|
||||
source=[f'embed/models/{MODEL_IDENTIFIER}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='boardloader')],
|
||||
source=[f'embed/models/{TREZOR_MODEL}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='boardloader')],
|
||||
action='$CAT $SOURCES > $TARGET',
|
||||
)
|
||||
|
||||
@ -176,7 +175,7 @@ program_elf = env.Command(
|
||||
|
||||
env.Depends(program_elf, linkerscript_gen)
|
||||
|
||||
BINARY_NAME = f"build/boardloader/boardloader-{models.get_model_identifier(TREZOR_MODEL)}"
|
||||
BINARY_NAME = f"build/boardloader/boardloader-{TREZOR_MODEL}"
|
||||
BINARY_NAME += "-" + tools.get_version('embed/projects/boardloader/version.h')
|
||||
BINARY_NAME += "-" + tools.get_git_revision_short_hash()
|
||||
BINARY_NAME += "-dirty" if tools.get_git_modified() else ""
|
||||
|
@ -4,12 +4,11 @@ import os
|
||||
import shlex
|
||||
import tools, models, ui
|
||||
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T2T1')
|
||||
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
||||
BOOTLOADER_QA = ARGUMENTS.get('BOOTLOADER_QA', '0') == '1'
|
||||
PRODUCTION = 0 if BOOTLOADER_QA else ARGUMENTS.get('PRODUCTION', '0') == '1'
|
||||
HW_REVISION = ARGUMENTS.get('HW_REVISION', None)
|
||||
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
|
||||
|
||||
FEATURES_WANTED = ["input", "rgb_led", "consumption_mask", "usb", "optiga", "dma2d"]
|
||||
|
||||
@ -246,7 +245,7 @@ obj_program += env.Object(source=SOURCE_HAL)
|
||||
|
||||
linkerscript_gen = env.Command(
|
||||
target='memory.ld',
|
||||
source=[f'embed/models/{MODEL_IDENTIFIER}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='bootloader')],
|
||||
source=[f'embed/models/{TREZOR_MODEL}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='bootloader')],
|
||||
action='$CAT $SOURCES > $TARGET',
|
||||
)
|
||||
|
||||
@ -262,7 +261,7 @@ env.Depends(program_elf, rust)
|
||||
|
||||
SUFFIX = '_qa' if BOOTLOADER_QA else ''
|
||||
|
||||
BINARY_NAME = f"build/bootloader/bootloader-{models.get_model_identifier(TREZOR_MODEL)}{SUFFIX}"
|
||||
BINARY_NAME = f"build/bootloader/bootloader-{TREZOR_MODEL}{SUFFIX}"
|
||||
BINARY_NAME += "-" + tools.get_version('embed/projects/bootloader/version.h')
|
||||
BINARY_NAME += "-" + tools.get_git_revision_short_hash()
|
||||
BINARY_NAME += "-dirty" if tools.get_git_modified() else ""
|
||||
|
@ -3,10 +3,9 @@
|
||||
import os
|
||||
import tools, models, ui
|
||||
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T2T1')
|
||||
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
||||
HW_REVISION = ARGUMENTS.get('HW_REVISION', None)
|
||||
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
|
||||
|
||||
FEATURES_WANTED = ["input", "rgb_led", "consumption_mask", "usb", "optiga"]
|
||||
|
||||
@ -190,7 +189,7 @@ obj_program += env.Object(source=SOURCE_HAL)
|
||||
|
||||
linkerscript_gen = env.Command(
|
||||
target='memory.ld',
|
||||
source=[f'embed/models/{MODEL_IDENTIFIER}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='bootloader')],
|
||||
source=[f'embed/models/{TREZOR_MODEL}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='bootloader')],
|
||||
action='$CAT $SOURCES > $TARGET',
|
||||
)
|
||||
|
||||
@ -203,7 +202,7 @@ program_elf = env.Command(
|
||||
|
||||
env.Depends(program_elf, linkerscript_gen)
|
||||
|
||||
BINARY_NAME = f"build/bootloader_ci/bootloader_ci-{models.get_model_identifier(TREZOR_MODEL)}"
|
||||
BINARY_NAME = f"build/bootloader_ci/bootloader_ci-{TREZOR_MODEL}"
|
||||
BINARY_NAME += "-" + tools.get_version('embed/projects/bootloader_ci/version.h')
|
||||
BINARY_NAME += "-" + tools.get_git_revision_short_hash()
|
||||
BINARY_NAME += "-dirty" if tools.get_git_modified() else ""
|
||||
|
@ -4,7 +4,7 @@ import os
|
||||
import shlex
|
||||
import tools, models, ui
|
||||
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T2T1')
|
||||
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
||||
HW_REVISION = 'emulator'
|
||||
|
||||
@ -151,8 +151,7 @@ env.Replace(
|
||||
PYTHON='python',
|
||||
MAKECMAKELISTS='$PYTHON tools/make_cmakelists.py', )
|
||||
|
||||
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
|
||||
MODEL_AS_NUMBER = str(models.get_hw_model_as_number(MODEL_IDENTIFIER))
|
||||
MODEL_AS_NUMBER = str(models.get_hw_model_as_number(TREZOR_MODEL))
|
||||
|
||||
ALLPATHS = ['embed/rust',
|
||||
'embed/projects/bootloader',
|
||||
|
@ -11,14 +11,13 @@ PRODUCTION = ARGUMENTS.get('PRODUCTION', '0') == '1'
|
||||
BOOTLOADER_QA = ARGUMENTS.get('BOOTLOADER_QA', '0') == '1'
|
||||
BOOTLOADER_DEVEL = ARGUMENTS.get('BOOTLOADER_DEVEL', '0') == '1'
|
||||
EVERYTHING = BITCOIN_ONLY != '1'
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T2T1')
|
||||
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
||||
PYOPT = ARGUMENTS.get('PYOPT', '1')
|
||||
DISABLE_OPTIGA = ARGUMENTS.get('DISABLE_OPTIGA', '0') == '1'
|
||||
HW_REVISION = ARGUMENTS.get('HW_REVISION', None)
|
||||
SCM_REVISION = ARGUMENTS.get('SCM_REVISION', None)
|
||||
THP = ARGUMENTS.get('THP', '0') == '1' # Trezor-Host Protocol
|
||||
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
|
||||
BENCHMARK = ARGUMENTS.get('BENCHMARK', '0') == '1'
|
||||
DISABLE_ANIMATION = ARGUMENTS.get('TREZOR_DISABLE_ANIMATION', '0') == '1'
|
||||
|
||||
@ -79,8 +78,8 @@ CPPDEFINES_MOD += [
|
||||
('USE_ETHEREUM', '1' if EVERYTHING else '0'),
|
||||
('USE_MONERO', '1' if EVERYTHING else '0'),
|
||||
('USE_CARDANO', '1' if EVERYTHING else '0'),
|
||||
('USE_NEM', '1' if (EVERYTHING and TREZOR_MODEL == "T") else '0'),
|
||||
('USE_EOS', '1' if (EVERYTHING and TREZOR_MODEL == "T") else '0'),
|
||||
('USE_NEM', '1' if (EVERYTHING and TREZOR_MODEL == "T2T1") else '0'),
|
||||
('USE_EOS', '1' if (EVERYTHING and TREZOR_MODEL == "T2T1") else '0'),
|
||||
('DISABLE_ANIMATION', '1' if DISABLE_ANIMATION else '0'),
|
||||
]
|
||||
SOURCE_MOD += [
|
||||
@ -647,7 +646,7 @@ if FROZEN:
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/cardano/*/*.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Cardano*.py'))
|
||||
|
||||
if TREZOR_MODEL == "T":
|
||||
if TREZOR_MODEL == "T2T1":
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/eos/*.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/eos/*/*.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Eos*.py'))
|
||||
@ -661,7 +660,7 @@ if FROZEN:
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/DebugMonero*.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Monero*.py'))
|
||||
|
||||
if TREZOR_MODEL == "T":
|
||||
if TREZOR_MODEL == "T2T1":
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nem/*.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nem/*/*.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/NEM*.py'))
|
||||
@ -684,7 +683,7 @@ if FROZEN:
|
||||
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/webauthn/*.py'))
|
||||
|
||||
if TREZOR_MODEL == "T":
|
||||
if TREZOR_MODEL == "T2T1":
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/bitcoin/sign_tx/decred.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/bitcoin/sign_tx/bitcoinlike.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/bitcoin/sign_tx/zcash_v4.py'))
|
||||
@ -807,8 +806,7 @@ env.Append(LINKFLAGS=f' -L{RUST_LIBDIR}')
|
||||
env.Append(LINKFLAGS=f' -l{RUST_LIB}')
|
||||
|
||||
|
||||
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
|
||||
BOOTLOADER_SUFFIX = MODEL_IDENTIFIER
|
||||
BOOTLOADER_SUFFIX = TREZOR_MODEL
|
||||
if BOOTLOADER_QA or BOOTLOADER_DEVEL:
|
||||
BOOTLOADER_SUFFIX += '_qa'
|
||||
|
||||
@ -818,14 +816,14 @@ if BOOTLOADER_QA or BOOTLOADER_DEVEL:
|
||||
elif not PRODUCTION:
|
||||
vendor = "unsafe_signed_prod"
|
||||
else:
|
||||
if TREZOR_MODEL in ('T',):
|
||||
if TREZOR_MODEL in ('T2T1',):
|
||||
vendor = "satoshilabs_signed_prod"
|
||||
elif BITCOIN_ONLY == '1':
|
||||
vendor = "trezor_btconly_signed_prod"
|
||||
else:
|
||||
vendor = "trezor_signed_prod"
|
||||
|
||||
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/vendorheader_{vendor}.bin'
|
||||
VENDORHEADER = f'embed/models/{TREZOR_MODEL}/vendorheader/vendorheader_{vendor}.bin'
|
||||
|
||||
tools.embed_raw_binary(
|
||||
obj_program,
|
||||
@ -849,7 +847,7 @@ env.Depends(obj_program, qstr_generated)
|
||||
|
||||
linkerscript_gen = env.Command(
|
||||
target='memory.ld',
|
||||
source=[f'embed/models/{MODEL_IDENTIFIER}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='firmware')],
|
||||
source=[f'embed/models/{TREZOR_MODEL}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='firmware')],
|
||||
action='$CAT $SOURCES > $TARGET',
|
||||
)
|
||||
|
||||
@ -866,7 +864,7 @@ if CMAKELISTS != 0:
|
||||
env.Depends(program_elf, cmake_gen)
|
||||
env.Depends(program_elf, rust)
|
||||
|
||||
BINARY_NAME = f"build/firmware/firmware-{MODEL_IDENTIFIER}"
|
||||
BINARY_NAME = f"build/firmware/firmware-{TREZOR_MODEL}"
|
||||
if not EVERYTHING:
|
||||
BINARY_NAME += "-btconly"
|
||||
BINARY_NAME += "-" + tools.get_version('embed/projects/firmware/version.h')
|
||||
|
@ -9,7 +9,7 @@ PRODUCTION = ARGUMENTS.get('PRODUCTION', '0') == '1'
|
||||
BOOTLOADER_QA = ARGUMENTS.get('BOOTLOADER_QA', '0') == '1'
|
||||
BOOTLOADER_DEVEL = ARGUMENTS.get('BOOTLOADER_DEVEL', '0') == '1'
|
||||
EVERYTHING = BITCOIN_ONLY != '1'
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T2T1')
|
||||
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
||||
PYOPT = ARGUMENTS.get('PYOPT', '1')
|
||||
DISABLE_OPTIGA = ARGUMENTS.get('DISABLE_OPTIGA', '0') == '1'
|
||||
@ -77,8 +77,8 @@ CPPDEFINES_MOD += [
|
||||
('USE_ETHEREUM', '1' if EVERYTHING else '0'),
|
||||
('USE_MONERO', '1' if EVERYTHING else '0'),
|
||||
('USE_CARDANO', '1' if EVERYTHING else '0'),
|
||||
('USE_NEM', '1' if (EVERYTHING and TREZOR_MODEL == "T") else '0'),
|
||||
('USE_EOS', '1' if (EVERYTHING and TREZOR_MODEL == "T") else '0'),
|
||||
('USE_NEM', '1' if (EVERYTHING and TREZOR_MODEL == "T2T1") else '0'),
|
||||
('USE_EOS', '1' if (EVERYTHING and TREZOR_MODEL == "T2T1") else '0'),
|
||||
]
|
||||
SOURCE_MOD_CRYPTO += [
|
||||
'vendor/trezor-crypto/address.c',
|
||||
@ -354,8 +354,7 @@ cmake_gen = env.Command(
|
||||
action='$MAKECMAKELISTS --sources $ALLSOURCES --dirs $CPPPATH --defs $ALLDEFS',
|
||||
)
|
||||
|
||||
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
|
||||
BOOTLOADER_SUFFIX = MODEL_IDENTIFIER
|
||||
BOOTLOADER_SUFFIX = TREZOR_MODEL
|
||||
if BOOTLOADER_QA:
|
||||
BOOTLOADER_SUFFIX += '_qa'
|
||||
|
||||
@ -365,14 +364,14 @@ if BOOTLOADER_QA or BOOTLOADER_DEVEL:
|
||||
elif not PRODUCTION:
|
||||
vendor = "unsafe_signed_prod"
|
||||
else:
|
||||
if TREZOR_MODEL in ('T',):
|
||||
if TREZOR_MODEL in ('T2T1',):
|
||||
vendor = "satoshilabs_signed_prod"
|
||||
elif BITCOIN_ONLY == '1':
|
||||
vendor = "trezor_btconly_signed_prod"
|
||||
else:
|
||||
vendor = "trezor_signed_prod"
|
||||
|
||||
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/vendorheader_{vendor}.bin'
|
||||
VENDORHEADER = f'embed/models/{TREZOR_MODEL}/vendorheader/vendorheader_{vendor}.bin'
|
||||
|
||||
|
||||
obj_program.extend(
|
||||
@ -388,14 +387,14 @@ tools.embed_compressed_binary(
|
||||
env,
|
||||
'bootloader',
|
||||
'embed/projects/bootloaders/bootloader.o',
|
||||
f'embed/models/{MODEL_IDENTIFIER}/bootloaders/bootloader_{BOOTLOADER_SUFFIX}.bin',
|
||||
f'embed/models/{TREZOR_MODEL}/bootloaders/bootloader_{BOOTLOADER_SUFFIX}.bin',
|
||||
'kernel',
|
||||
'bootloader',
|
||||
)
|
||||
|
||||
linkerscript_gen = env.Command(
|
||||
target='memory.ld',
|
||||
source=[f'embed/models/{MODEL_IDENTIFIER}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='kernel')],
|
||||
source=[f'embed/models/{TREZOR_MODEL}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='kernel')],
|
||||
action='$CAT $SOURCES > $TARGET',
|
||||
)
|
||||
|
||||
@ -411,7 +410,7 @@ env.Depends(program_elf, linkerscript_gen)
|
||||
if CMAKELISTS != 0:
|
||||
env.Depends(program_elf, cmake_gen)
|
||||
|
||||
BINARY_NAME = f"build/kernel/kernel-{models.get_model_identifier(TREZOR_MODEL)}"
|
||||
BINARY_NAME = f"build/kernel/kernel-{TREZOR_MODEL}"
|
||||
if not EVERYTHING:
|
||||
BINARY_NAME += "-btconly"
|
||||
BINARY_NAME += "-" + tools.get_version('embed/projects/kernel/version.h')
|
||||
|
@ -3,7 +3,7 @@
|
||||
import os
|
||||
import tools, models, ui
|
||||
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T2T1')
|
||||
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
||||
PRODUCTION = ARGUMENTS.get('PRODUCTION', '0') == '1'
|
||||
BOOTLOADER_DEVEL = ARGUMENTS.get('BOOTLOADER_DEVEL', '0') == '1'
|
||||
@ -185,8 +185,6 @@ obj_program.extend(env.Object(source=SOURCE_MOD_CRYPTO, CCFLAGS='$CCFLAGS -ftriv
|
||||
obj_program.extend(env.Object(source=SOURCE_PRODTEST))
|
||||
obj_program.extend(env.Object(source=SOURCE_HAL))
|
||||
|
||||
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
|
||||
|
||||
|
||||
if (vh := ARGUMENTS.get("VENDOR_HEADER", None)):
|
||||
VENDORHEADER = vh
|
||||
@ -195,13 +193,13 @@ elif (vh := os.environ.get("VENDOR_HEADER", None)):
|
||||
# of vendor header which does not affect reproducibility of the build. Nonetheless,
|
||||
# we should figure out a cleaner way to pass in this argument, without having to teach
|
||||
# the Makefile about it.
|
||||
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/{vh}'
|
||||
VENDORHEADER = f'embed/models/{TREZOR_MODEL}/vendorheader/{vh}'
|
||||
elif PRODUCTION:
|
||||
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/vendorheader_prodtest_signed_prod.bin'
|
||||
VENDORHEADER = f'embed/models/{TREZOR_MODEL}/vendorheader/vendorheader_prodtest_signed_prod.bin'
|
||||
elif BOOTLOADER_DEVEL:
|
||||
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/vendorheader_dev_DO_NOT_SIGN_signed_dev.bin'
|
||||
VENDORHEADER = f'embed/models/{TREZOR_MODEL}/vendorheader/vendorheader_dev_DO_NOT_SIGN_signed_dev.bin'
|
||||
else:
|
||||
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/vendorheader_unsafe_signed_prod.bin'
|
||||
VENDORHEADER = f'embed/models/{TREZOR_MODEL}/vendorheader/vendorheader_unsafe_signed_prod.bin'
|
||||
|
||||
|
||||
tools.embed_raw_binary(
|
||||
@ -214,7 +212,7 @@ tools.embed_raw_binary(
|
||||
|
||||
linkerscript_gen = env.Command(
|
||||
target='memory.ld',
|
||||
source=[f'embed/models/{MODEL_IDENTIFIER}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='prodtest')],
|
||||
source=[f'embed/models/{TREZOR_MODEL}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='prodtest')],
|
||||
action='$CAT $SOURCES > $TARGET',
|
||||
)
|
||||
|
||||
@ -227,7 +225,7 @@ program_elf = env.Command(
|
||||
|
||||
env.Depends(program_elf, linkerscript_gen)
|
||||
|
||||
BINARY_NAME = f"build/prodtest/prodtest-{models.get_model_identifier(TREZOR_MODEL)}"
|
||||
BINARY_NAME = f"build/prodtest/prodtest-{TREZOR_MODEL}"
|
||||
BINARY_NAME += "-" + tools.get_version('embed/projects/prodtest/version.h')
|
||||
BINARY_NAME += "-" + tools.get_git_revision_short_hash()
|
||||
BINARY_NAME += "-dirty" if tools.get_git_modified() else ""
|
||||
|
@ -3,11 +3,11 @@
|
||||
import os
|
||||
import tools, models, ui
|
||||
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T2T1')
|
||||
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
||||
HW_REVISION = ARGUMENTS.get('HW_REVISION', None)
|
||||
|
||||
if TREZOR_MODEL in ('DISC1', 'DISC2'):
|
||||
if TREZOR_MODEL in ('D001', 'D002'):
|
||||
# skip reflash build
|
||||
env = Environment()
|
||||
def build_reflash(target,source,env):
|
||||
@ -160,9 +160,7 @@ obj_program += env.Object(source=SOURCE_MOD_CRYPTO, CCFLAGS='$CCFLAGS -ftrivial-
|
||||
obj_program += env.Object(source=SOURCE_REFLASH)
|
||||
obj_program += env.Object(source=SOURCE_HAL)
|
||||
|
||||
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
|
||||
|
||||
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/vendorheader_' + ('unsafe_signed_dev.bin' if ARGUMENTS.get('PRODUCTION', '0') == '0' else 'satoshilabs_signed_prod.bin')
|
||||
VENDORHEADER = f'embed/models/{TREZOR_MODEL}/vendorheader/vendorheader_' + ('unsafe_signed_dev.bin' if ARGUMENTS.get('PRODUCTION', '0') == '0' else 'satoshilabs_signed_prod.bin')
|
||||
|
||||
tools.embed_raw_binary(
|
||||
obj_program,
|
||||
@ -174,7 +172,7 @@ tools.embed_raw_binary(
|
||||
|
||||
linkerscript_gen = env.Command(
|
||||
target='memory.ld',
|
||||
source=[f'embed/models/{MODEL_IDENTIFIER}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='prodtest')],
|
||||
source=[f'embed/models/{TREZOR_MODEL}/memory.ld', env.get('ENV')['LINKER_SCRIPT'].format(target='prodtest')],
|
||||
action='$CAT $SOURCES > $TARGET',
|
||||
)
|
||||
|
||||
@ -187,7 +185,7 @@ program_elf = env.Command(
|
||||
|
||||
env.Depends(program_elf, linkerscript_gen)
|
||||
|
||||
BINARY_NAME = f"build/reflash/reflash-{models.get_model_identifier(TREZOR_MODEL)}"
|
||||
BINARY_NAME = f"build/reflash/reflash-{TREZOR_MODEL}"
|
||||
BINARY_NAME += "-" + tools.get_version('embed/projects/reflash/version.h')
|
||||
BINARY_NAME += "-" + tools.get_git_revision_short_hash()
|
||||
BINARY_NAME += "-dirty" if tools.get_git_modified() else ""
|
||||
|
@ -7,7 +7,7 @@ import tools, models, ui
|
||||
|
||||
BITCOIN_ONLY = ARGUMENTS.get('BITCOIN_ONLY', '0')
|
||||
EVERYTHING = BITCOIN_ONLY != '1'
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T2T1')
|
||||
CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0))
|
||||
HW_REVISION ='emulator'
|
||||
THP = ARGUMENTS.get('THP', '0') == '1' # Trezor-Host Protocol
|
||||
@ -78,8 +78,8 @@ CPPDEFINES_MOD += [
|
||||
('USE_ETHEREUM', '1' if EVERYTHING else '0'),
|
||||
('USE_MONERO', '1' if EVERYTHING else '0'),
|
||||
('USE_CARDANO', '1' if EVERYTHING else '0'),
|
||||
('USE_NEM', '1' if (EVERYTHING and TREZOR_MODEL == "T") else '0'),
|
||||
('USE_EOS', '1' if (EVERYTHING and TREZOR_MODEL == "T") else '0'),
|
||||
('USE_NEM', '1' if (EVERYTHING and TREZOR_MODEL == "T2T1") else '0'),
|
||||
('USE_EOS', '1' if (EVERYTHING and TREZOR_MODEL == "T2T1") else '0'),
|
||||
]
|
||||
SOURCE_MOD += [
|
||||
'embed/upymod/trezorobj.c',
|
||||
@ -703,7 +703,7 @@ if FROZEN:
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/cardano/*/*.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Cardano*.py'))
|
||||
|
||||
if TREZOR_MODEL == "T":
|
||||
if TREZOR_MODEL == "T2T1":
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/eos/*.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/eos/*/*.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Eos*.py'))
|
||||
@ -717,7 +717,7 @@ if FROZEN:
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/DebugMonero*.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Monero*.py'))
|
||||
|
||||
if TREZOR_MODEL == "T":
|
||||
if TREZOR_MODEL == "T2T1":
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nem/*.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nem/*/*.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/NEM*.py'))
|
||||
@ -741,7 +741,7 @@ if FROZEN:
|
||||
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/webauthn/*.py'))
|
||||
|
||||
if TREZOR_MODEL == "T":
|
||||
if TREZOR_MODEL == "T2T1":
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/bitcoin/sign_tx/decred.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/bitcoin/sign_tx/bitcoinlike.py'))
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/bitcoin/sign_tx/zcash_v4.py'))
|
||||
|
@ -196,7 +196,7 @@ void backlight_pwm_deinit(backlight_action_t action) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
// This code is for backward compatibility with the older
|
||||
// bootloader/firmware on model T that used different
|
||||
// PWM settings and relies on proper settings from the
|
||||
|
@ -108,7 +108,7 @@ void display_deinit(display_content_mode_t mode) {
|
||||
backlight_pwm_deinit(mode == DISPLAY_RESET_CONTENT ? BACKLIGHT_RESET
|
||||
: BACKLIGHT_RETAIN);
|
||||
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
// This ensures backward compatibility with legacy bootloader/firmware
|
||||
// that relies on this hardware settings from the previous boot stage
|
||||
if (mode == DISPLAY_RESET_CONTENT) {
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "display_panel.h"
|
||||
#include "display_io.h"
|
||||
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
#include "panels/154a.h"
|
||||
#include "panels/lx154a2411.h"
|
||||
#include "panels/lx154a2422.h"
|
||||
@ -211,7 +211,7 @@ void display_panel_init(void) {
|
||||
HAL_Delay(120);
|
||||
|
||||
// identify the controller we will communicate with
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
uint32_t id = display_panel_identify();
|
||||
if (id == DISPLAY_ID_GC9307) {
|
||||
tf15411a_init_seq();
|
||||
@ -234,7 +234,7 @@ void display_panel_init(void) {
|
||||
void display_panel_reinit(void) {
|
||||
// reinitialization is needed due to original sequence is unchangable in
|
||||
// boardloader
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
// model TT has new gamma settings
|
||||
uint32_t id = display_panel_identify();
|
||||
if (id == DISPLAY_ID_ST7789V && display_panel_is_inverted()) {
|
||||
@ -243,14 +243,14 @@ void display_panel_reinit(void) {
|
||||
} else if (id == DISPLAY_ID_ST7789V) {
|
||||
lx154a2411_gamma();
|
||||
}
|
||||
#elif defined TREZOR_MODEL_T3T1
|
||||
#elif defined TREZOR_MODEL_T2T13T1
|
||||
// reduced touch-display interference in T3T1
|
||||
lx154a2482_init_seq();
|
||||
#endif
|
||||
}
|
||||
|
||||
void display_panel_rotate(int angle) {
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
uint32_t id = display_panel_identify();
|
||||
if (id == DISPLAY_ID_GC9307) {
|
||||
tf15411a_rotate(angle, &g_window_padding);
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef MODELS_MODEL_H_
|
||||
#define MODELS_MODEL_H_
|
||||
|
||||
#if defined TREZOR_MODEL_T
|
||||
#if defined TREZOR_MODEL_T2T1
|
||||
#include "T2T1/versions.h"
|
||||
#elif defined TREZOR_MODEL_R
|
||||
#elif defined TREZOR_MODEL_T2B1
|
||||
#include "T2B1/versions.h"
|
||||
#elif defined TREZOR_MODEL_T3T1
|
||||
#include "T3T1/versions.h"
|
||||
@ -11,9 +11,9 @@
|
||||
#include "T3B1/versions.h"
|
||||
#elif defined TREZOR_MODEL_T3W1
|
||||
#include "T3W1/versions.h"
|
||||
#elif defined TREZOR_MODEL_DISC1
|
||||
#elif defined TREZOR_MODEL_D001
|
||||
#include "D001/versions.h"
|
||||
#elif defined TREZOR_MODEL_DISC2
|
||||
#elif defined TREZOR_MODEL_D002
|
||||
#include "D002/versions.h"
|
||||
#else
|
||||
#error Unknown Trezor model
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include <util/flash_layout.h>
|
||||
#include "otp_layout.h"
|
||||
|
||||
#if defined TREZOR_MODEL_T
|
||||
#if defined TREZOR_MODEL_T2T1
|
||||
#include "T2T1/model_T2T1.h"
|
||||
#elif defined TREZOR_MODEL_R
|
||||
#elif defined TREZOR_MODEL_T2B1
|
||||
#include "T2B1/model_T2B1.h"
|
||||
#elif defined TREZOR_MODEL_T3T1
|
||||
#include "T3T1/model_T3T1.h"
|
||||
@ -14,9 +14,9 @@
|
||||
#include "T3B1/model_T3B1.h"
|
||||
#elif defined TREZOR_MODEL_T3W1
|
||||
#include "T3W1/model_T3W1.h"
|
||||
#elif defined TREZOR_MODEL_DISC1
|
||||
#elif defined TREZOR_MODEL_D001
|
||||
#include "D001/model_D001.h"
|
||||
#elif defined TREZOR_MODEL_DISC2
|
||||
#elif defined TREZOR_MODEL_D002
|
||||
#include "D002/model_D002.h"
|
||||
#else
|
||||
#error Unknown Trezor model
|
||||
|
@ -44,7 +44,7 @@
|
||||
#define COLOR_BL_GRAY COLOR_BL_FG
|
||||
#endif
|
||||
|
||||
#if !defined TREZOR_MODEL_R && !defined TREZOR_MODEL_T3B1
|
||||
#if !defined TREZOR_MODEL_T2B1 && !defined TREZOR_MODEL_T3B1
|
||||
#define BOOT_WAIT_HEIGHT 25
|
||||
#define BOOT_WAIT_Y_TOP (DISPLAY_RESY - BOOT_WAIT_HEIGHT)
|
||||
#else
|
||||
|
@ -10,7 +10,7 @@
|
||||
g_header:
|
||||
.byte 'T','R','Z','B' // magic
|
||||
.word g_header_end - g_header // hdrlen
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
.word 0 // expiry
|
||||
#else
|
||||
.word 1 // expiry
|
||||
|
@ -10,7 +10,7 @@
|
||||
g_header:
|
||||
.byte 'T','R','Z','B' // magic
|
||||
.word g_header_end - g_header // hdrlen
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
.word 0 // expiry
|
||||
#else
|
||||
.word 1 // expiry
|
||||
|
@ -13,7 +13,7 @@
|
||||
g_header:
|
||||
.byte 'T','R','Z','F' // magic
|
||||
.word g_header_end - g_header // hdrlen
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
.word 0 // expiry
|
||||
#else
|
||||
.word 1 // expiry
|
||||
|
@ -10,7 +10,7 @@
|
||||
g_header:
|
||||
.byte 'T','R','Z','F' // magic
|
||||
.word g_header_end - g_header // hdrlen
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
.word 0 // expiry
|
||||
#else
|
||||
.word 1 // expiry
|
||||
|
@ -93,7 +93,7 @@
|
||||
#include "stm32f4xx_ll_utils.h"
|
||||
#endif
|
||||
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
#define MODEL_IDENTIFIER "TREZOR2-"
|
||||
#else
|
||||
#define MODEL_IDENTIFIER MODEL_INTERNAL_NAME "-"
|
||||
@ -232,7 +232,7 @@ static void draw_border(int width, int padding) {
|
||||
}
|
||||
|
||||
static void draw_welcome_screen(void) {
|
||||
#if defined TREZOR_MODEL_R || defined TREZOR_MODEL_T3B1
|
||||
#if defined TREZOR_MODEL_T2B1 || defined TREZOR_MODEL_T3B1
|
||||
gfx_draw_bar(gfx_rect_wh(0, 0, DISPLAY_RESX, DISPLAY_RESY), COLOR_WHITE);
|
||||
display_refresh();
|
||||
#else
|
||||
|
@ -10,7 +10,7 @@
|
||||
g_header:
|
||||
.byte 'T','R','Z','F' // magic
|
||||
.word g_header_end - g_header // hdrlen
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
.word 0 // expiry
|
||||
#else
|
||||
.word 1 // expiry
|
||||
|
@ -56,7 +56,7 @@ const DEFAULT_BINDGEN_MACROS_COMMON: &[&str] = &[
|
||||
#[cfg(feature = "layout_bolt")]
|
||||
const DEFAULT_BINDGEN_MACROS_T2T1: &[&str] = &[
|
||||
"-DSTM32F427",
|
||||
"-DTREZOR_MODEL_T",
|
||||
"-DTREZOR_MODEL_T2T1",
|
||||
"-DFLASH_BIT_ACCESS=1",
|
||||
"-DFLASH_BLOCK_WORDS=1",
|
||||
"-DDISPLAY_RESX=240",
|
||||
@ -69,7 +69,7 @@ const DEFAULT_BINDGEN_MACROS_T2T1: &[&str] = &[];
|
||||
#[cfg(feature = "layout_samson")]
|
||||
const DEFAULT_BINDGEN_MACROS_T2B1: &[&str] = &[
|
||||
"-DSTM32F427",
|
||||
"-DTREZOR_MODEL_R",
|
||||
"-DTREZOR_MODEL_T2B1",
|
||||
"-DFLASH_BIT_ACCESS=1",
|
||||
"-DFLASH_BLOCK_WORDS=1",
|
||||
"-DDISPLAY_RESX=128",
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "rand.h"
|
||||
#include "storage.h"
|
||||
|
||||
#if defined(TREZOR_MODEL_R)
|
||||
#if defined(TREZOR_MODEL_T2B1)
|
||||
#include "certs/T2B1.h"
|
||||
#define DEVICE_CERT_CHAIN T2B1_der
|
||||
#elif defined(TREZOR_MODEL_T3T1)
|
||||
|
@ -340,7 +340,7 @@ mpu_mode_t mpu_reconfig(mpu_mode_t mode) {
|
||||
|
||||
// clang-format off
|
||||
switch (mode) {
|
||||
#ifdef TREZOR_MODEL_DISC1
|
||||
#ifdef TREZOR_MODEL_D001
|
||||
default:
|
||||
// All Peripherals (Unprivileged, Read-Write, Non-Executable)
|
||||
// SDRAM
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <sys/mpu.h>
|
||||
#include <util/image.h>
|
||||
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
#include "../stm32f4/startup_init.h"
|
||||
#endif
|
||||
|
||||
@ -212,7 +212,7 @@ void __attribute__((noreturn)) secure_shutdown(void) {
|
||||
}
|
||||
|
||||
void ensure_compatible_settings(void) {
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
// Early version of bootloader on T2T1 expects 168 MHz core clock.
|
||||
// So we need to set it here before handover to the bootloader.
|
||||
set_core_clock(CLOCK_168_MHZ);
|
||||
|
@ -52,7 +52,7 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
#if defined STM32F427xx || defined STM32F429xx
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
#define DEFAULT_FREQ 168U
|
||||
#define DEFAULT_PLLQ 7U
|
||||
#define DEFAULT_PLLP 0U // P = 2 (two bits, 00 means PLLP = 2)
|
||||
@ -183,7 +183,7 @@ void SystemInit(void) {
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
}
|
||||
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
void set_core_clock(clock_settings_t settings) {
|
||||
/* Enable HSI clock */
|
||||
RCC->CR |= RCC_CR_HSION;
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef TREZORHAL_STM32F4_STARTUP_INIT_H
|
||||
#define TREZORHAL_STM32F4_STARTUP_INIT_H
|
||||
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
|
||||
typedef enum {
|
||||
CLOCK_180_MHZ = 0,
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <sys/sdram.h>
|
||||
#endif
|
||||
|
||||
#if defined(TREZOR_MODEL_T) && (!defined(BOARDLOADER))
|
||||
#if defined(TREZOR_MODEL_T2T1) && (!defined(BOARDLOADER))
|
||||
#include "../stm32f4/startup_init.h"
|
||||
#endif
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
#ifdef KERNEL_MODE
|
||||
|
||||
void system_init(systask_error_handler_t error_handler) {
|
||||
#if defined(TREZOR_MODEL_T) && (!defined(BOARDLOADER))
|
||||
#if defined(TREZOR_MODEL_T2T1) && (!defined(BOARDLOADER))
|
||||
// Early boardloader versions on Model T initialized the CPU clock to 168MHz.
|
||||
// We need to set it to the STM32F429's maximum - 180MHz.
|
||||
set_core_clock(CLOCK_180_MHZ);
|
||||
|
@ -96,7 +96,7 @@ const image_header *read_image_header(const uint8_t *const data,
|
||||
secbool check_image_model(const image_header *const hdr) {
|
||||
// abusing expiry field to break compatibility of non-TT images with existing
|
||||
// bootloaders/boardloaders
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
if (hdr->expiry == 0 && hdr->hw_model == 0 && hdr->hw_revision == 0) {
|
||||
// images for model TT older than this check
|
||||
return sectrue;
|
||||
@ -195,7 +195,7 @@ secbool __wur read_vendor_header(const uint8_t *const data,
|
||||
}
|
||||
|
||||
secbool check_vendor_header_model(const vendor_header *const vhdr) {
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
if (vhdr->hw_model == 0) {
|
||||
// vendor headers for model T have this field set to 0
|
||||
return sectrue;
|
||||
|
@ -40,7 +40,7 @@ static unit_properties_driver_t g_unit_properties_driver = {
|
||||
.initialized = false,
|
||||
};
|
||||
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
|
||||
// Parse two digit number from the string.
|
||||
//
|
||||
@ -83,7 +83,7 @@ static bool get_production_date(int* year) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // TREZOR_MODEL_T
|
||||
#endif // TREZOR_MODEL_T2T1
|
||||
|
||||
// Reads and parses the unit properties from the OTP block.
|
||||
//
|
||||
@ -120,7 +120,7 @@ static bool detect_properties(unit_properties_t* props) {
|
||||
}
|
||||
|
||||
props->sd_hotswap_enabled = true;
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
// Early produced TTs have a HW bug that prevents hotswapping of the SD card,
|
||||
// lets check the build data and decide based on that.
|
||||
int production_year;
|
||||
|
@ -47,7 +47,7 @@ bool unit_properties_init(void) {
|
||||
memset(drv, 0, sizeof(unit_properties_driver_t));
|
||||
|
||||
drv->cache.sd_hotswap_enabled = true;
|
||||
#ifdef TREZOR_MODEL_T
|
||||
#ifdef TREZOR_MODEL_T2T1
|
||||
drv->cache.sd_hotswap_enabled = false;
|
||||
#endif
|
||||
|
||||
|
@ -17,39 +17,22 @@ def configure_board(
|
||||
sources: list[str],
|
||||
paths: list[str],
|
||||
) -> list[str]:
|
||||
imported_module = importlib.import_module("models." + get_model_identifier(model))
|
||||
imported_module = importlib.import_module(f"models.{model}")
|
||||
return imported_module.configure_board(
|
||||
revision, features_wanted, env, defines, sources, paths
|
||||
)
|
||||
|
||||
|
||||
def get_model_identifier(model: str) -> str:
|
||||
if model == "T":
|
||||
return "T2T1"
|
||||
elif model == "R":
|
||||
return "T2B1"
|
||||
elif model == "T3T1":
|
||||
return "T3T1"
|
||||
elif model == "T3B1":
|
||||
return "T3B1"
|
||||
elif model == "DISC1":
|
||||
return "D001"
|
||||
elif model == "DISC2":
|
||||
return "D002"
|
||||
else:
|
||||
return model
|
||||
|
||||
|
||||
def has_emulator(model: str) -> bool:
|
||||
imported_module = importlib.import_module("models." + get_model_identifier(model))
|
||||
imported_module = importlib.import_module(f"models.{model}")
|
||||
return hasattr(imported_module, "emulator")
|
||||
|
||||
|
||||
def get_model_ui(model: str) -> str:
|
||||
imported_module = importlib.import_module("models." + get_model_identifier(model))
|
||||
imported_module = importlib.import_module(f"models.{model}")
|
||||
return imported_module.get_model_ui()
|
||||
|
||||
|
||||
def get_model_ui_conf(model: str) -> str:
|
||||
imported_module = importlib.import_module("models." + get_model_identifier(model))
|
||||
imported_module = importlib.import_module(f"models.{model}")
|
||||
return imported_module.get_model_ui_conf()
|
||||
|
@ -67,14 +67,10 @@ def generate(env):
|
||||
r"-e 's/from typing import/# \0/'",
|
||||
]
|
||||
|
||||
MODEL_SYMS = {
|
||||
"T": "T2T1",
|
||||
"R": "T2B1",
|
||||
"T3T1": "T3T1",
|
||||
}
|
||||
MODELS = ["T2T1", "T2B1", "T3T1", "T3B1", "T3W1"]
|
||||
|
||||
for model_sym, internal_model in MODEL_SYMS.items():
|
||||
model_matches = env["TREZOR_MODEL"] == model_sym
|
||||
for internal_model in MODELS:
|
||||
model_matches = env["TREZOR_MODEL"] == internal_model
|
||||
sed_scripts.extend(
|
||||
(
|
||||
rf"-e 's/utils\.INTERNAL_MODEL == \"{internal_model}\"/{model_matches}/g'",
|
||||
|
@ -55,7 +55,7 @@ class TestUtils(unittest.TestCase):
|
||||
|
||||
def test_firmware_hash(self):
|
||||
if utils.INTERNAL_MODEL in ( # pylint: disable=internal-model-tuple-comparison
|
||||
"DISC2",
|
||||
"D002",
|
||||
"T3W1",
|
||||
):
|
||||
self.assertEqual(
|
||||
|
@ -7,19 +7,9 @@ CORE = HERE.parent.parent
|
||||
|
||||
MODELS_DIR = CORE / "embed" / "models"
|
||||
|
||||
MODELS_DICT = {
|
||||
"1": "T1B1",
|
||||
"T": "T2T1",
|
||||
"R": "T2B1",
|
||||
"DISC1": "D001",
|
||||
"DISC2": "D002",
|
||||
}
|
||||
|
||||
|
||||
def get_layout_for_model(model: str) -> Path:
|
||||
model = MODELS_DICT.get(model, model)
|
||||
return MODELS_DIR / model / f"model_{model}.h"
|
||||
|
||||
def get_linkerscript_for_model(model: str) -> Path:
|
||||
model = MODELS_DICT.get(model, model)
|
||||
return MODELS_DIR / model / f"memory.ld"
|
||||
|
@ -79,7 +79,7 @@ Run the build with:
|
||||
|
||||
```sh
|
||||
make build_unix # default
|
||||
make build_unix TREZOR_MODEL=R # different model
|
||||
make build_unix TREZOR_MODEL=T2B1 # different model
|
||||
```
|
||||
|
||||
## Run
|
||||
|
@ -166,8 +166,8 @@ stm32lib):
|
||||
|
||||
-DSTM32_HAL_H=<stm32f4xx.h>
|
||||
|
||||
-DTREZOR_MODEL=T
|
||||
-DTREZOR_MODEL_T=1
|
||||
-DTREZOR_MODEL=T2T1
|
||||
-DTREZOR_MODEL_T2T1=1
|
||||
-DSTM32F427xx
|
||||
-DUSE_HAL_DRIVER
|
||||
-DSTM32_HAL_H="<stm32f4xx.h>"
|
||||
|
@ -3,7 +3,7 @@ CC = cc
|
||||
CFLAGS = -Wall -Wshadow -Wextra -Wpedantic -Werror -Wno-missing-braces
|
||||
CFLAGS += -fPIC
|
||||
CFALGS += -fsanitize=address,undefined
|
||||
CFLAGS += -DTREZOR_MODEL_T
|
||||
CFLAGS += -DTREZOR_MODEL_T2T1
|
||||
CFLAGS += -DTREZOR_EMULATOR
|
||||
CFLAGS += -DUSE_INSECURE_PRNG
|
||||
CFLAGS += -DCONFIDENTIAL=""
|
||||
|
@ -30,7 +30,7 @@
|
||||
* The length of the sector header in bytes. The header is preserved between
|
||||
* sector erasures.
|
||||
*/
|
||||
#if defined TREZOR_MODEL_T
|
||||
#if defined TREZOR_MODEL_T2T1
|
||||
#define NORCOW_HEADER_LEN 0
|
||||
#elif defined TREZOR_MODEL_1
|
||||
#define NORCOW_HEADER_LEN (0x100)
|
||||
|
@ -3,7 +3,7 @@ CC = cc
|
||||
CFLAGS = -Wall -Wshadow -Wextra -Wpedantic -Werror -Wno-missing-braces
|
||||
CFLAGS += -fPIC
|
||||
CFALGS += -fsanitize=address,undefined
|
||||
CFLAGS += -DTREZOR_MODEL_T
|
||||
CFLAGS += -DTREZOR_MODEL_T2T1
|
||||
CFLAGS += -DUSE_INSECURE_PRNG
|
||||
|
||||
LIBS =
|
||||
|
@ -29,7 +29,7 @@
|
||||
* The length of the sector header in bytes. The header is preserved between
|
||||
* sector erasures.
|
||||
*/
|
||||
#if defined TREZOR_MODEL_T
|
||||
#if defined TREZOR_MODEL_T2T1
|
||||
#define NORCOW_HEADER_LEN 0
|
||||
#elif defined TREZOR_MODEL_1
|
||||
#define NORCOW_HEADER_LEN (0x100)
|
||||
|
Loading…
Reference in New Issue
Block a user