diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 97ab41a2f5d..08686cd8dca 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -133,21 +133,23 @@ jobs: strategy: fail-fast: false matrix: - # model: [T1B1, T2T1, T2B1, T3B1, T3T1] # TODO update exprs below - model: ["1", "T", "R", T3B1, T3T1] + model: ["1", 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 == '1' && '--skip-core' || '--skip-legacy' }} --models ${{ matrix.model }} --targets bootloader,firmware,prodtest ${{ github.head_ref || github.ref_name }} - name: Show fingerprints run: | + echo "model **${{ matrix.model }}** commit \`${{ github.sha }}\` (fingerprint, sha256)" >> $GITHUB_STEP_SUMMARY + rm -rf build/*-bitcoinonly/bootloader for file in build/*/*/*.fingerprint; do if [ -f "$file" ]; then origfile="${file%.fingerprint}" fingerprint=$(tr -d '\n' < $file) - echo "\`$fingerprint\` $origfile" >> $GITHUB_STEP_SUMMARY + sha256=$(sha256sum $file | head -c 64) + echo "\`$fingerprint\` \`$sha256\` $origfile" >> $GITHUB_STEP_SUMMARY fi done cat $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/core-hw.yml b/.github/workflows/core-hw.yml index ffd5ff48b39..35b81f75f6b 100644 --- a/.github/workflows/core-hw.yml +++ b/.github/workflows/core-hw.yml @@ -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 == 'T2T1' }} PYTEST_TIMEOUT: 1200 PYOPT: 0 DISABLE_OPTIGA: 1 diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 795c69332c9..01f75e5c76c 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -54,7 +54,7 @@ jobs: strategy: fail-fast: false matrix: - model: [T2T1, T3B1, T3T1, T3W1] + model: [T2B1, T2T1, T3B1, T3T1, T3W1] coins: [universal, btconly] type: ${{ fromJSON(github.event_name == 'schedule' && '["normal", "debuglink", "production"]' || '["normal", "debuglink"]') }} include: @@ -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 == 'D001' && 'DISC1' || 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 diff --git a/build-docker.sh b/build-docker.sh index e24f31701dd..eb1fce6f8e3 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -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" diff --git a/core/Makefile b/core/Makefile index 50f037cf917..85536cb55c7 100644 --- a/core/Makefile +++ b/core/Makefile @@ -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 MODEL_FEATURE = model_ford -else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),R)) +else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T2B1)) MCU = STM32F4 OPENOCD_TARGET = target/stm32f4x.cfg MODEL_FEATURE = model_buick diff --git a/core/SConscript.boardloader b/core/SConscript.boardloader index 1e87eb20df4..01f23cdc67e 100644 --- a/core/SConscript.boardloader +++ b/core/SConscript.boardloader @@ -3,7 +3,7 @@ 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) diff --git a/core/SConscript.bootloader b/core/SConscript.bootloader index cba4646a7b4..b1e77920899 100644 --- a/core/SConscript.bootloader +++ b/core/SConscript.bootloader @@ -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)) BOOTLOADER_QA = ARGUMENTS.get('BOOTLOADER_QA', '0') == '1' PRODUCTION = 0 if BOOTLOADER_QA else ARGUMENTS.get('PRODUCTION', '0') == '1' diff --git a/core/SConscript.bootloader_ci b/core/SConscript.bootloader_ci index 7cb2d65baa3..4246c78cffe 100644 --- a/core/SConscript.bootloader_ci +++ b/core/SConscript.bootloader_ci @@ -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)) HW_REVISION = ARGUMENTS.get('HW_REVISION', None) MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL) diff --git a/core/SConscript.bootloader_emu b/core/SConscript.bootloader_emu index c86949e8b49..5371e6e8d7a 100644 --- a/core/SConscript.bootloader_emu +++ b/core/SConscript.bootloader_emu @@ -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' diff --git a/core/SConscript.firmware b/core/SConscript.firmware index 74c30734152..c7aba98c7fe 100644 --- a/core/SConscript.firmware +++ b/core/SConscript.firmware @@ -11,14 +11,14 @@ 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) +MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL) # TODO normalize always BENCHMARK = ARGUMENTS.get('BENCHMARK', '0') == '1' DISABLE_ANIMATION = ARGUMENTS.get('TREZOR_DISABLE_ANIMATION', '0') == '1' @@ -79,8 +79,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 +647,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 +661,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 +684,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')) @@ -818,7 +818,7 @@ 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" diff --git a/core/SConscript.kernel b/core/SConscript.kernel index 232052785ea..fef19dc36ca 100644 --- a/core/SConscript.kernel +++ b/core/SConscript.kernel @@ -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', @@ -365,7 +365,7 @@ 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" diff --git a/core/SConscript.prodtest b/core/SConscript.prodtest index 88a593d999e..70a005fb941 100644 --- a/core/SConscript.prodtest +++ b/core/SConscript.prodtest @@ -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' diff --git a/core/SConscript.reflash b/core/SConscript.reflash index 4d0ad53ff1d..2e2003c2b33 100644 --- a/core/SConscript.reflash +++ b/core/SConscript.reflash @@ -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)) HW_REVISION = ARGUMENTS.get('HW_REVISION', None) diff --git a/core/SConscript.unix b/core/SConscript.unix index e4f1ca56b08..a1aba1065c8 100644 --- a/core/SConscript.unix +++ b/core/SConscript.unix @@ -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') # FIXME also normalize 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')) diff --git a/core/embed/io/display/backlight/stm32/backlight_pwm.c b/core/embed/io/display/backlight/stm32/backlight_pwm.c index 5670e5b432e..8aeb40eb797 100644 --- a/core/embed/io/display/backlight/stm32/backlight_pwm.c +++ b/core/embed/io/display/backlight/stm32/backlight_pwm.c @@ -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 diff --git a/core/embed/io/display/st-7789/display_driver.c b/core/embed/io/display/st-7789/display_driver.c index c8165a727fa..967e8d29b60 100644 --- a/core/embed/io/display/st-7789/display_driver.c +++ b/core/embed/io/display/st-7789/display_driver.c @@ -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) { diff --git a/core/embed/io/display/st-7789/display_panel.c b/core/embed/io/display/st-7789/display_panel.c index 50466e8c2a1..51dbfe9a56d 100644 --- a/core/embed/io/display/st-7789/display_panel.c +++ b/core/embed/io/display/st-7789/display_panel.c @@ -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); diff --git a/core/embed/models/model_version.h b/core/embed/models/model_version.h index 25c1552a0af..072e4e2deda 100644 --- a/core/embed/models/model_version.h +++ b/core/embed/models/model_version.h @@ -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" diff --git a/core/embed/models/trezor_model.h b/core/embed/models/trezor_model.h index ac2ea0ea89d..f8e04cf6e8b 100644 --- a/core/embed/models/trezor_model.h +++ b/core/embed/models/trezor_model.h @@ -4,9 +4,9 @@ #include #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" diff --git a/core/embed/projects/bootloader/bootui.c b/core/embed/projects/bootloader/bootui.c index 3ce2d26f72d..45a71055d38 100644 --- a/core/embed/projects/bootloader/bootui.c +++ b/core/embed/projects/bootloader/bootui.c @@ -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 diff --git a/core/embed/projects/bootloader/header.S b/core/embed/projects/bootloader/header.S index 8945f4cd295..29f9a9fde43 100644 --- a/core/embed/projects/bootloader/header.S +++ b/core/embed/projects/bootloader/header.S @@ -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 diff --git a/core/embed/projects/bootloader_ci/header.S b/core/embed/projects/bootloader_ci/header.S index 8945f4cd295..29f9a9fde43 100644 --- a/core/embed/projects/bootloader_ci/header.S +++ b/core/embed/projects/bootloader_ci/header.S @@ -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 diff --git a/core/embed/projects/firmware/header.S b/core/embed/projects/firmware/header.S index 03341ba6f9f..18938da6822 100644 --- a/core/embed/projects/firmware/header.S +++ b/core/embed/projects/firmware/header.S @@ -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 diff --git a/core/embed/projects/prodtest/header.S b/core/embed/projects/prodtest/header.S index 2c101aa43c7..e41f02e8d24 100644 --- a/core/embed/projects/prodtest/header.S +++ b/core/embed/projects/prodtest/header.S @@ -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 diff --git a/core/embed/projects/prodtest/main.c b/core/embed/projects/prodtest/main.c index b7ff7c39068..ce886aa40b1 100644 --- a/core/embed/projects/prodtest/main.c +++ b/core/embed/projects/prodtest/main.c @@ -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 diff --git a/core/embed/projects/reflash/header.S b/core/embed/projects/reflash/header.S index 2c101aa43c7..e41f02e8d24 100644 --- a/core/embed/projects/reflash/header.S +++ b/core/embed/projects/reflash/header.S @@ -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 diff --git a/core/embed/rust/build.rs b/core/embed/rust/build.rs index 5322254513c..d2a3a313c7c 100644 --- a/core/embed/rust/build.rs +++ b/core/embed/rust/build.rs @@ -56,7 +56,7 @@ const DEFAULT_BINDGEN_MACROS_COMMON: &[&str] = &[ #[cfg(feature = "model_ford")] 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 = "model_buick")] const DEFAULT_BINDGEN_MACROS_T2B1: &[&str] = &[ "-DSTM32F427", - "-DTREZOR_MODEL_R", + "-DTREZOR_MODEL_T2B1", "-DFLASH_BIT_ACCESS=1", "-DFLASH_BLOCK_WORDS=1", "-DDISPLAY_RESX=128", diff --git a/core/embed/sec/optiga/unix/optiga.c b/core/embed/sec/optiga/unix/optiga.c index 33ca8c25288..069c2a3e8fa 100644 --- a/core/embed/sec/optiga/unix/optiga.c +++ b/core/embed/sec/optiga/unix/optiga.c @@ -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) diff --git a/core/embed/sys/startup/stm32/bootutils.c b/core/embed/sys/startup/stm32/bootutils.c index ec1e85045b9..1b69858749c 100644 --- a/core/embed/sys/startup/stm32/bootutils.c +++ b/core/embed/sys/startup/stm32/bootutils.c @@ -28,7 +28,7 @@ #include #include -#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); diff --git a/core/embed/sys/startup/stm32f4/startup_init.c b/core/embed/sys/startup/stm32f4/startup_init.c index c927df183e8..52634a030f0 100644 --- a/core/embed/sys/startup/stm32f4/startup_init.c +++ b/core/embed/sys/startup/stm32f4/startup_init.c @@ -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; diff --git a/core/embed/sys/startup/stm32f4/startup_init.h b/core/embed/sys/startup/stm32f4/startup_init.h index 97d13a97601..bc5af731210 100644 --- a/core/embed/sys/startup/stm32f4/startup_init.h +++ b/core/embed/sys/startup/stm32f4/startup_init.h @@ -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, diff --git a/core/embed/sys/task/stm32/system.c b/core/embed/sys/task/stm32/system.c index 1bf6f4072b2..a9a2b212c41 100644 --- a/core/embed/sys/task/stm32/system.c +++ b/core/embed/sys/task/stm32/system.c @@ -31,7 +31,7 @@ #include #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); diff --git a/core/embed/util/image/image.c b/core/embed/util/image/image.c index df20fd48248..553d8ae2560 100644 --- a/core/embed/util/image/image.c +++ b/core/embed/util/image/image.c @@ -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; diff --git a/core/embed/util/unit_properties/stm32/unit_properties.c b/core/embed/util/unit_properties/stm32/unit_properties.c index 527c48ce6bd..6457267449b 100644 --- a/core/embed/util/unit_properties/stm32/unit_properties.c +++ b/core/embed/util/unit_properties/stm32/unit_properties.c @@ -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; diff --git a/core/embed/util/unit_properties/unix/unit_properties.c b/core/embed/util/unit_properties/unix/unit_properties.c index c2de25732ea..c6585d2b562 100644 --- a/core/embed/util/unit_properties/unix/unit_properties.c +++ b/core/embed/util/unit_properties/unix/unit_properties.c @@ -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 diff --git a/core/site_scons/models/__init__.py b/core/site_scons/models/__init__.py index c239f336384..32e5fa9f60f 100644 --- a/core/site_scons/models/__init__.py +++ b/core/site_scons/models/__init__.py @@ -24,9 +24,9 @@ def configure_board( def get_model_identifier(model: str) -> str: - if model == "T": + if model == "T" or model == "T2T1": return "T2T1" - elif model == "R": + elif model == "R" or model == "T2B1": return "T2B1" elif model == "T3T1": return "T3T1" diff --git a/docs/core/build/emulator.md b/docs/core/build/emulator.md index 8803daf028f..28e04168f03 100644 --- a/docs/core/build/emulator.md +++ b/docs/core/build/emulator.md @@ -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 diff --git a/docs/core/embed_debug/index.md b/docs/core/embed_debug/index.md index 1091ccf691b..b3a681f5276 100644 --- a/docs/core/embed_debug/index.md +++ b/docs/core/embed_debug/index.md @@ -166,8 +166,8 @@ stm32lib): -DSTM32_HAL_H= - -DTREZOR_MODEL=T - -DTREZOR_MODEL_T=1 + -DTREZOR_MODEL=T2T1 + -DTREZOR_MODEL_T2T1=1 -DSTM32F427xx -DUSE_HAL_DRIVER -DSTM32_HAL_H="" diff --git a/storage/tests/c/Makefile b/storage/tests/c/Makefile index 8217c7ebb99..0349e9e91b6 100644 --- a/storage/tests/c/Makefile +++ b/storage/tests/c/Makefile @@ -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="" diff --git a/storage/tests/c/norcow_config.h b/storage/tests/c/norcow_config.h index e850c8fdc99..04792c335d0 100644 --- a/storage/tests/c/norcow_config.h +++ b/storage/tests/c/norcow_config.h @@ -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) diff --git a/storage/tests/c3/Makefile b/storage/tests/c3/Makefile index 706a08b48e5..0be336768bf 100644 --- a/storage/tests/c3/Makefile +++ b/storage/tests/c3/Makefile @@ -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 = diff --git a/storage/tests/c3/norcow_config.h b/storage/tests/c3/norcow_config.h index ea72a111572..2a00316fed3 100644 --- a/storage/tests/c3/norcow_config.h +++ b/storage/tests/c3/norcow_config.h @@ -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)