1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-09 15:00:58 +00:00
This commit is contained in:
Martin Milata 2025-01-07 21:55:00 +01:00
parent d06382e298
commit 46294cbf02
38 changed files with 74 additions and 71 deletions

View File

@ -140,14 +140,17 @@ jobs:
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

View File

@ -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_tt
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_tr

View File

@ -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)

View File

@ -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'

View File

@ -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)

View File

@ -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'

View File

@ -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"

View File

@ -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"

View File

@ -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'

View File

@ -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)

View File

@ -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'))

View File

@ -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

View File

@ -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) {

View File

@ -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);

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -56,7 +56,7 @@ const DEFAULT_BINDGEN_MACROS_COMMON: &[&str] = &[
#[cfg(feature = "model_tt")]
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_tr")]
const DEFAULT_BINDGEN_MACROS_T2B1: &[&str] = &[
"-DSTM32F427",
"-DTREZOR_MODEL_R",
"-DTREZOR_MODEL_T2B1",
"-DFLASH_BIT_ACCESS=1",
"-DFLASH_BLOCK_WORDS=1",
"-DDISPLAY_RESX=128",

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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,

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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"

View File

@ -167,7 +167,7 @@ stm32lib):
-DSTM32_HAL_H=<stm32f4xx.h>
-DTREZOR_MODEL=T
-DTREZOR_MODEL_T=1
-DTREZOR_MODEL_T2T1=1
-DSTM32F427xx
-DUSE_HAL_DRIVER
-DSTM32_HAL_H="<stm32f4xx.h>"

View File

@ -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=""

View File

@ -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)

View File

@ -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 =

View File

@ -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)