1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-17 11:58:13 +00:00

chore(core): switch T3W1 support to U5

[no changelog]
This commit is contained in:
tychovrahe 2024-11-05 09:22:14 +01:00 committed by TychoVrahe
parent b94db1ff48
commit fa953d7296
11 changed files with 320 additions and 298 deletions

View File

@ -63,8 +63,8 @@ MCU = STM32U5
OPENOCD_TARGET = target/stm32u5x.cfg
MODEL_FEATURE = model_tr
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T3W1))
MCU = STM32F4
OPENOCD_TARGET = target/stm32f4x.cfg
MCU = STM32U5
OPENOCD_TARGET = target/stm32u5x.cfg
MODEL_FEATURE = model_tt
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),DISC1))
MCU = STM32F4

View File

@ -1,71 +0,0 @@
#ifndef _TREZOR_T3W1_H
#define _TREZOR_T3W1_H
#define HSE_8MHZ
#define DISPLAY_COLOR_MODE DMA2D_OUTPUT_RGB565
#define DISPLAY_LEGACY_HEADER "displays/st7789v.h"
#define DISPLAY_PANEL_LHS200KB_IF21 1
#define DISPLAY_I8080_16BIT_DW 1
// #define DISPLAY_PANEL_INIT_SEQ lhs200kb_if21_init_seq
// #define DISPLAY_PANEL_ROTATE lhs200kb_if21_rotate
// #define TRANSFORM_TOUCH_COORDS lhs200kb_if21_transform_touch_coords
#define BACKLIGHT_PWM_FREQ 50000
#define BACKLIGHT_PWM_TIM TIM1
#define BACKLIGHT_PWM_TIM_CLK_EN __HAL_RCC_TIM1_CLK_ENABLE
#define BACKLIGHT_PWM_TIM_AF GPIO_AF1_TIM1
#define BACKLIGHT_PWM_TIM_OCMODE TIM_OCMODE_PWM2
#define BACKLIGHT_PWM_TIM_CHANNEL TIM_CHANNEL_1
#define BACKLIGHT_PWM_TIM_CCR CCR1
#define BACKLIGHT_PWM_PIN GPIO_PIN_7
#define BACKLIGHT_PWM_PORT GPIOA
#define BACKLIGHT_PWM_PORT_CLK_EN __HAL_RCC_GPIOA_CLK_ENABLE
#define I2C_COUNT 1
#define I2C_INSTANCE_0 I2C2
#define I2C_INSTANCE_0_CLK_EN __HAL_RCC_I2C2_CLK_ENABLE
#define I2C_INSTANCE_0_CLK_DIS __HAL_RCC_I2C2_CLK_DISABLE
#define I2C_INSTANCE_0_PIN_AF GPIO_AF4_I2C2
#define I2C_INSTANCE_0_SDA_PORT GPIOB
#define I2C_INSTANCE_0_SDA_PIN GPIO_PIN_11
#define I2C_INSTANCE_0_SDA_CLK_EN __HAL_RCC_GPIOB_CLK_ENABLE
#define I2C_INSTANCE_0_SCL_PORT GPIOB
#define I2C_INSTANCE_0_SCL_PIN GPIO_PIN_10
#define I2C_INSTANCE_0_SCL_CLK_EN __HAL_RCC_GPIOB_CLK_ENABLE
#define I2C_INSTANCE_0_RESET_REG &RCC->APB1RSTR
#define I2C_INSTANCE_0_RESET_BIT RCC_APB1RSTR_I2C2RST
#define I2C_INSTANCE_0_EV_IRQHandler I2C2_EV_IRQHandler
#define I2C_INSTANCE_0_ER_IRQHandler I2C2_ER_IRQHandler
#define I2C_INSTANCE_0_EV_IRQn I2C2_EV_IRQn
#define I2C_INSTANCE_0_ER_IRQn I2C2_ER_IRQn
#define I2C_INSTANCE_0_GUARD_TIME 0
#define TOUCH_PANEL_LHS200KB_IF21 1
#define TOUCH_SENSITIVITY 0x06
#define TOUCH_I2C_INSTANCE 0
#define TOUCH_RST_PORT GPIOC
#define TOUCH_RST_PIN GPIO_PIN_5
#define TOUCH_INT_PORT GPIOC
#define TOUCH_INT_PIN GPIO_PIN_4
#define TOUCH_ON_PORT GPIOB
#define TOUCH_ON_PIN GPIO_PIN_8
#define SD_DETECT_PORT GPIOB
#define SD_DETECT_PIN GPIO_PIN_0
#define SD_ENABLE_PORT GPIOE
#define SD_ENABLE_PIN GPIO_PIN_1
#define GPIO_1_PORT GPIOC
#define GPIO_1_PIN GPIO_PIN_1
#define GPIO_2_PORT GPIOC
#define GPIO_2_PIN GPIO_PIN_6
#define GPIO_3_PORT GPIOC
#define GPIO_3_PIN GPIO_PIN_7
#define BTN_POWER_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE
#define BTN_POWER_PORT GPIOE
#define BTN_POWER_PIN GPIO_PIN_0
#endif //_TREZOR_T3W1_H

View File

@ -0,0 +1,101 @@
#ifndef TREZOR_T3W1_REVA_H_
#define TREZOR_T3W1_REVA_H_
#define HSE_32MHZ
#define VDD_1V8 1
#define DISPLAY_COLOR_MODE DMA2D_OUTPUT_RGB565
#define BACKLIGHT_PWM_FREQ 1000
#define BACKLIGHT_PWM_TIM TIM17
#define BACKLIGHT_PWM_TIM_CLK_EN __HAL_RCC_TIM17_CLK_ENABLE
#define BACKLIGHT_PWM_TIM_AF GPIO_AF14_TIM17
#define BACKLIGHT_PWM_TIM_OCMODE TIM_OCMODE_PWM1
#define BACKLIGHT_PWM_TIM_CHANNEL TIM_CHANNEL_1
#define BACKLIGHT_PWM_TIM_CCR CCR1
#define BACKLIGHT_PWM_PIN GPIO_PIN_9
#define BACKLIGHT_PWM_PORT GPIOB
#define BACKLIGHT_PWM_PORT_CLK_EN __HAL_RCC_GPIOB_CLK_ENABLE
#define NPM1300_I2C_INSTANCE 0
#define I2C_COUNT 4
#define I2C_INSTANCE_0 I2C1
#define I2C_INSTANCE_0_CLK_EN __HAL_RCC_I2C1_CLK_ENABLE
#define I2C_INSTANCE_0_CLK_DIS __HAL_RCC_I2C1_CLK_DISABLE
#define I2C_INSTANCE_0_PIN_AF GPIO_AF4_I2C1
#define I2C_INSTANCE_0_SDA_PORT GPIOG
#define I2C_INSTANCE_0_SDA_PIN GPIO_PIN_13
#define I2C_INSTANCE_0_SDA_CLK_EN __HAL_RCC_GPIOG_CLK_ENABLE
#define I2C_INSTANCE_0_SCL_PORT GPIOG
#define I2C_INSTANCE_0_SCL_PIN GPIO_PIN_14
#define I2C_INSTANCE_0_SCL_CLK_EN __HAL_RCC_GPIOG_CLK_ENABLE
#define I2C_INSTANCE_0_RESET_REG &RCC->APB1RSTR1
#define I2C_INSTANCE_0_RESET_BIT RCC_APB1RSTR1_I2C1RST
#define I2C_INSTANCE_0_EV_IRQHandler I2C1_EV_IRQHandler
#define I2C_INSTANCE_0_ER_IRQHandler I2C1_ER_IRQHandler
#define I2C_INSTANCE_0_EV_IRQn I2C1_EV_IRQn
#define I2C_INSTANCE_0_ER_IRQn I2C1_ER_IRQn
#define I2C_INSTANCE_0_GUARD_TIME 0
#define I2C_INSTANCE_1 I2C2
#define I2C_INSTANCE_1_CLK_EN __HAL_RCC_I2C2_CLK_ENABLE
#define I2C_INSTANCE_1_CLK_DIS __HAL_RCC_I2C2_CLK_DISABLE
#define I2C_INSTANCE_1_PIN_AF GPIO_AF4_I2C2
#define I2C_INSTANCE_1_SDA_PORT GPIOF
#define I2C_INSTANCE_1_SDA_PIN GPIO_PIN_0
#define I2C_INSTANCE_1_SDA_CLK_EN __HAL_RCC_GPIOF_CLK_ENABLE
#define I2C_INSTANCE_1_SCL_PORT GPIOF
#define I2C_INSTANCE_1_SCL_PIN GPIO_PIN_1
#define I2C_INSTANCE_1_SCL_CLK_EN __HAL_RCC_GPIOF_CLK_ENABLE
#define I2C_INSTANCE_1_RESET_REG &RCC->APB1RSTR1
#define I2C_INSTANCE_1_RESET_BIT RCC_APB1RSTR1_I2C2RST
#define I2C_INSTANCE_1_EV_IRQHandler I2C2_EV_IRQHandler
#define I2C_INSTANCE_1_ER_IRQHandler I2C2_ER_IRQHandler
#define I2C_INSTANCE_1_EV_IRQn I2C2_EV_IRQn
#define I2C_INSTANCE_1_ER_IRQn I2C2_ER_IRQn
#define I2C_INSTANCE_1_GUARD_TIME 0
#define I2C_INSTANCE_2 I2C3
#define I2C_INSTANCE_2_CLK_EN __HAL_RCC_I2C3_CLK_ENABLE
#define I2C_INSTANCE_2_CLK_DIS __HAL_RCC_I2C3_CLK_DISABLE
#define I2C_INSTANCE_2_PIN_AF GPIO_AF4_I2C3
#define I2C_INSTANCE_2_SDA_PORT GPIOC
#define I2C_INSTANCE_2_SDA_PIN GPIO_PIN_1
#define I2C_INSTANCE_2_SDA_CLK_EN __HAL_RCC_GPIOC_CLK_ENABLE
#define I2C_INSTANCE_2_SCL_PORT GPIOC
#define I2C_INSTANCE_2_SCL_PIN GPIO_PIN_0
#define I2C_INSTANCE_2_SCL_CLK_EN __HAL_RCC_GPIOC_CLK_ENABLE
#define I2C_INSTANCE_2_RESET_REG &RCC->APB3RSTR
#define I2C_INSTANCE_2_RESET_BIT RCC_APB3RSTR_I2C3RST
#define I2C_INSTANCE_2_EV_IRQHandler I2C3_EV_IRQHandler
#define I2C_INSTANCE_2_ER_IRQHandler I2C3_ER_IRQHandler
#define I2C_INSTANCE_2_EV_IRQn I2C3_EV_IRQn
#define I2C_INSTANCE_2_ER_IRQn I2C3_ER_IRQn
#define I2C_INSTANCE_2_GUARD_TIME 0
#define I2C_INSTANCE_3 I2C4
#define I2C_INSTANCE_3_CLK_EN __HAL_RCC_I2C4_CLK_ENABLE
#define I2C_INSTANCE_3_CLK_DIS __HAL_RCC_I2C4_CLK_DISABLE
#define I2C_INSTANCE_3_PIN_AF GPIO_AF4_I2C4
#define I2C_INSTANCE_3_SDA_PORT GPIOD
#define I2C_INSTANCE_3_SDA_PIN GPIO_PIN_13
#define I2C_INSTANCE_3_SDA_CLK_EN __HAL_RCC_GPIOD_CLK_ENABLE
#define I2C_INSTANCE_3_SCL_PORT GPIOD
#define I2C_INSTANCE_3_SCL_PIN GPIO_PIN_12
#define I2C_INSTANCE_3_SCL_CLK_EN __HAL_RCC_GPIOD_CLK_ENABLE
#define I2C_INSTANCE_3_RESET_REG &RCC->APB1RSTR2
#define I2C_INSTANCE_3_RESET_BIT RCC_APB1RSTR2_I2C4RST
#define I2C_INSTANCE_3_EV_IRQHandler I2C4_EV_IRQHandler
#define I2C_INSTANCE_3_ER_IRQHandler I2C4_ER_IRQHandler
#define I2C_INSTANCE_3_EV_IRQn I2C4_EV_IRQn
#define I2C_INSTANCE_3_ER_IRQn I2C4_ER_IRQn
#define I2C_INSTANCE_3_GUARD_TIME 0
#define TOUCH_SENSITIVITY 0x40
#define TOUCH_I2C_INSTANCE 2
#define TOUCH_INT_PORT GPIOC
#define TOUCH_INT_PIN GPIO_PIN_3
#endif // TREZOR_T3W1_REVA_H_

View File

@ -1,53 +1,48 @@
/* Auto-generated file, do not edit.*/
NORCOW_SECTOR_SIZE = 0x10000;
FLASH_START = 0x8000000;
BOARDLOADER_START = 0x8000000;
BOARDLOADER_MAXSIZE = 0xc000;
BOARDLOADER_SECTOR_START = 0x0;
BOARDLOADER_SECTOR_END = 0x2;
BOARDCAPS_START = 0x800bf00;
FLASH_START = 0xc004000;
NORCOW_SECTOR_SIZE = 0x20000;
SECRET_START = 0xc000000;
SECRET_MAXSIZE = 0x4000;
SECRET_SECTOR_START = 0x0;
SECRET_SECTOR_END = 0x1;
BHK_START = 0xc002000;
BHK_MAXSIZE = 0x2000;
BHK_SECTOR_START = 0x1;
BHK_SECTOR_END = 0x1;
BOARDLOADER_START = 0xc004000;
BOARDLOADER_MAXSIZE = 0x10000;
BOARDLOADER_SECTOR_START = 0x2;
BOARDLOADER_SECTOR_END = 0x9;
BOARDCAPS_START = 0xc013f00;
BOARDCAPS_MAXSIZE = 0x100;
UNUSED_1_START = 0x800c000;
UNUSED_1_MAXSIZE = 0x4000;
UNUSED_1_SECTOR_START = 0x3;
UNUSED_1_SECTOR_END = 0x3;
STORAGE_1_START = 0x8010000;
STORAGE_1_MAXSIZE = 0x10000;
STORAGE_1_SECTOR_START = 0x4;
STORAGE_1_SECTOR_END = 0x4;
BOOTLOADER_START = 0x8020000;
BOOTLOADER_MAXSIZE = 0x20000;
BOOTLOADER_SECTOR_START = 0x5;
BOOTLOADER_SECTOR_END = 0x5;
FIRMWARE_START = 0x8040000;
FIRMWARE_MAXSIZE = 0x1a0000;
FIRMWARE_P1_START = 0x8040000;
FIRMWARE_P1_MAXSIZE = 0xc0000;
FIRMWARE_P1_SECTOR_START = 0x6;
FIRMWARE_P1_SECTOR_END = 0xb;
KERNEL_START = 0x8040000;
BOOTLOADER_START = 0xc014000;
BOOTLOADER_MAXSIZE = 0x30000;
BOOTLOADER_SECTOR_START = 0xa;
BOOTLOADER_SECTOR_END = 0x21;
STORAGE_1_START = 0xc044000;
STORAGE_1_MAXSIZE = 0x20000;
STORAGE_1_SECTOR_START = 0x22;
STORAGE_1_SECTOR_END = 0x31;
STORAGE_2_START = 0xc064000;
STORAGE_2_MAXSIZE = 0x20000;
STORAGE_2_SECTOR_START = 0x32;
STORAGE_2_SECTOR_END = 0x41;
FIRMWARE_START = 0xc084000;
FIRMWARE_MAXSIZE = 0x36c000;
FIRMWARE_SECTOR_START = 0x42;
FIRMWARE_SECTOR_END = 0x1f7;
KERNEL_START = 0xc084000;
KERNEL_MAXSIZE = 0x80000;
ASSETS_START = 0x8100000;
ASSETS_MAXSIZE = 0xc000;
ASSETS_SECTOR_START = 0xc;
ASSETS_SECTOR_END = 0xe;
UNUSED_2_START = 0x810c000;
UNUSED_2_MAXSIZE = 0x4000;
UNUSED_2_SECTOR_START = 0xf;
UNUSED_2_SECTOR_END = 0xf;
STORAGE_2_START = 0x8110000;
STORAGE_2_MAXSIZE = 0x10000;
STORAGE_2_SECTOR_START = 0x10;
STORAGE_2_SECTOR_END = 0x10;
FIRMWARE_P2_START = 0x8120000;
FIRMWARE_P2_MAXSIZE = 0xe0000;
FIRMWARE_P2_SECTOR_START = 0x11;
FIRMWARE_P2_SECTOR_END = 0x17;
KERNEL_STACK_SIZE = 0x2000;
KERNEL_CCMRAM_SIZE = 0x4000;
KERNEL_FRAMEBUFFER_SIZE = 0x0;
KERNEL_SRAM_SIZE = 0x400;
KERNEL_U_FLASH_SIZE = 0x200;
ASSETS_START = 0xc3f0000;
ASSETS_MAXSIZE = 0x10000;
ASSETS_SECTOR_START = 0x1f8;
ASSETS_SECTOR_END = 0x1ff;
KERNEL_U_RAM_SIZE = 0x200;
KERNEL_SRAM1_SIZE = 0x4000;
KERNEL_SRAM2_SIZE = 0x2400;
KERNEL_SRAM3_SIZE = 0xbb800;
BOOTARGS_SIZE = 0x100;
CODE_ALIGNMENT = 0x200;
CODE_ALIGNMENT = 0x400;
COREAPP_ALIGNMENT = 0x2000;

View File

@ -24,8 +24,8 @@
(const uint8_t *)"\x63\x55\x69\x1c\x17\x8a\x8f\xf9\x10\x07\xa7\x47\x8a\xfb\x95\x5e\xf7\x35\x2c\x63\xe7\xb2\x57\x03\x98\x4c\xf7\x8b\x26\xe2\x1a\x56", \
(const uint8_t *)"\xee\x93\xa4\xf6\x6f\x8d\x16\xb8\x19\xbb\x9b\xeb\x9f\xfc\xcd\xfc\xdc\x14\x12\xe8\x7f\xee\x6a\x32\x4c\x2a\x99\xa1\xe0\xe6\x71\x48",
#define IMAGE_CHUNK_SIZE (128 * 1024)
#define IMAGE_HASH_BLAKE2S
#define IMAGE_CHUNK_SIZE SIZE_256K
#define IMAGE_HASH_SHA256
#define DISPLAY_JUMP_BEHAVIOR DISPLAY_RESET_CONTENT
@ -37,74 +37,67 @@
#define DISPLAY_RESY 320
#endif
// SHARED WITH MAKEFILE
// common
#define NORCOW_SECTOR_SIZE (1 * 64 * 1024) // 64 kB
#define FLASH_START 0x08000000
// SHARED WITH MAKEFILE, LINKER SCRIPT etc.
// misc
#define FLASH_START 0x0C004000
#define NORCOW_SECTOR_SIZE (16 * 8 * 1024) // 128 kB
// FLASH layout
#define BOARDLOADER_START 0x08000000
#define BOARDLOADER_MAXSIZE (3 * 16 * 1024) // 48 kB
#define BOARDLOADER_SECTOR_START 0
#define BOARDLOADER_SECTOR_END 2
#define SECRET_START 0x0C000000
#define SECRET_MAXSIZE (2 * 8 * 1024) // 8 kB
#define SECRET_SECTOR_START 0x0
#define SECRET_SECTOR_END 0x1
#define BOARDCAPS_START 0x0800BF00
// overlaps with secret
#define BHK_START 0x0C002000
#define BHK_MAXSIZE (1 * 8 * 1024) // 8 kB
#define BHK_SECTOR_START 0x1
#define BHK_SECTOR_END 0x1
#define BOARDLOADER_START 0x0C004000
#define BOARDLOADER_MAXSIZE (8 * 8 * 1024) // 64 kB
#define BOARDLOADER_SECTOR_START 0x2
#define BOARDLOADER_SECTOR_END 0x9
#define BOARDCAPS_START 0x0C013F00
#define BOARDCAPS_MAXSIZE 0x100
#define UNUSED_1_START 0x0800C000
#define UNUSED_1_MAXSIZE (1 * 16 * 1024) // 16 kB
#define UNUSED_1_SECTOR_START 3
#define UNUSED_1_SECTOR_END 3
#define BOOTLOADER_START 0x0C014000
#define BOOTLOADER_MAXSIZE (24 * 8 * 1024) // 192 kB
#define BOOTLOADER_SECTOR_START 0x0A
#define BOOTLOADER_SECTOR_END 0x21
#define STORAGE_1_START 0x08010000
#define STORAGE_1_MAXSIZE (1 * 64 * 1024) // 64 kB
#define STORAGE_1_SECTOR_START 4
#define STORAGE_1_SECTOR_END 4
#define STORAGE_1_START 0x0C044000
#define STORAGE_1_MAXSIZE (16 * 8 * 1024) // 128 kB
#define STORAGE_1_SECTOR_START 0x22
#define STORAGE_1_SECTOR_END 0x31
#define BOOTLOADER_START 0x08020000
#define BOOTLOADER_MAXSIZE (1 * 128 * 1024) // 128 kB
#define BOOTLOADER_SECTOR_START 5
#define BOOTLOADER_SECTOR_END 5
#define STORAGE_2_START 0x0C064000
#define STORAGE_2_MAXSIZE (16 * 8 * 1024) // 128 kB
#define STORAGE_2_SECTOR_START 0x32
#define STORAGE_2_SECTOR_END 0x41
#define FIRMWARE_START 0x08040000
#define FIRMWARE_MAXSIZE (13 * 128 * 1024) // 1664 kB
#define FIRMWARE_P1_START 0x08040000
#define FIRMWARE_P1_MAXSIZE (6 * 128 * 1024)
#define FIRMWARE_P1_SECTOR_START 6
#define FIRMWARE_P1_SECTOR_END 11
// part of firmware P1
#define KERNEL_START 0x08040000
#define KERNEL_MAXSIZE (4 * 128 * 1024)
#define FIRMWARE_START 0x0C084000
#define FIRMWARE_MAXSIZE (438 * 8 * 1024) // 3504 kB
#define FIRMWARE_SECTOR_START 0x42
#define FIRMWARE_SECTOR_END 0x1F7
#define KERNEL_START 0x0C084000
#define KERNEL_MAXSIZE (512 * 1024) // 512 kB
#define KERNEL_U_FLASH_SIZE 512
#define ASSETS_START 0x08100000
#define ASSETS_MAXSIZE (3 * 16 * 1024) // 48 kB
#define ASSETS_SECTOR_START 12
#define ASSETS_SECTOR_END 14
#define UNUSED_2_START 0x0810C000
#define UNUSED_2_MAXSIZE (1 * 16 * 1024) // 16 kB
#define UNUSED_2_SECTOR_START 15
#define UNUSED_2_SECTOR_END 15
#define STORAGE_2_START 0x08110000
#define STORAGE_2_MAXSIZE (1 * 64 * 1024) // 64 kB
#define STORAGE_2_SECTOR_START 16
#define STORAGE_2_SECTOR_END 16
#define FIRMWARE_P2_START 0x08120000
#define FIRMWARE_P2_MAXSIZE (7 * 128 * 1024)
#define FIRMWARE_P2_SECTOR_START 17
#define FIRMWARE_P2_SECTOR_END 23
#define ASSETS_START 0x0C3F0000
#define ASSETS_MAXSIZE (8 * 8 * 1024) // 64 kB
#define ASSETS_SECTOR_START 0x1F8
#define ASSETS_SECTOR_END 0x1FF
// RAM layout
#define KERNEL_STACK_SIZE (8 * 1024)
#define KERNEL_CCMRAM_SIZE (16 * 1024)
#define KERNEL_FRAMEBUFFER_SIZE (0 * 1024)
#define KERNEL_SRAM_SIZE (1 * 1024)
#define KERNEL_U_RAM_SIZE 512
#define KERNEL_SRAM1_SIZE (16 * 1024)
#define KERNEL_SRAM2_SIZE (9 * 1024)
#define KERNEL_SRAM3_SIZE (750 * 1024)
#define BOOTARGS_SIZE 0x100
#define CODE_ALIGNMENT 0x200
#define CODE_ALIGNMENT 0x400
#define COREAPP_ALIGNMENT 0x2000
#endif

View File

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import Optional
from . import emulator, trezor_t3w1_d1
from . import emulator, trezor_t3w1_revA
def configure_board(
@ -14,12 +14,12 @@ def configure_board(
paths: list[str],
):
# Set default revision if None
revision = revision or "d1"
revision = revision or "A"
# Mapping of revisions to their respective configurations
revision_map = {
"emulator": emulator,
"d1": trezor_t3w1_d1,
"A": trezor_t3w1_revA,
}
module = revision_map.get(revision)

View File

@ -15,7 +15,7 @@ def configure(
board = "T3W1/boards/t3w1-unix.h"
hw_model = get_hw_model_as_number("T3W1")
hw_revision = 0
mcu = "STM32F427xx"
mcu = "STM32U5G9xx"
defines += ["FRAMEBUFFER", "DISPLAY_RGBA8888", "UI_COLOR_32BIT"]
features_available.append("framebuffer")
@ -57,6 +57,6 @@ def configure(
features_available.append("backlight")
defines += ["USE_BACKLIGHT=1"]
sources += ["embed/trezorhal/stm32f4/layout.c"]
sources += ["embed/trezorhal/stm32u5/layout.c"]
return features_available

View File

@ -1,114 +0,0 @@
from __future__ import annotations
from .. import get_hw_model_as_number
from ..stm32f4_common import stm32f4_common_files
def configure(
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
) -> list[str]:
features_available: list[str] = []
board = "T3W1/boards/trezor_t3w1_d1.h"
hw_model = get_hw_model_as_number("T3W1")
hw_revision = 0
defines += ["DISPLAY_RGB565"]
features_available.append("display_rgb565")
defines += ["USE_RGB_COLORS=1"]
mcu = "STM32F427xx"
stm32f4_common_files(env, defines, sources, paths)
env.get("ENV")[
"CPU_ASFLAGS"
] = "-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16"
env.get("ENV")[
"CPU_CCFLAGS"
] = "-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mtune=cortex-m4 "
env.get("ENV")["RUST_TARGET"] = "thumbv7em-none-eabihf"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
sources += ["embed/trezorhal/stm32f4/xdisplay/st-7789/display_nofb.c"]
sources += ["embed/trezorhal/stm32f4/xdisplay/st-7789/display_driver.c"]
sources += ["embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.c"]
sources += ["embed/trezorhal/stm32f4/xdisplay/st-7789/display_panel.c"]
sources += [
"embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lhs200kb-if21.c",
]
sources += ["embed/trezorhal/stm32f4/backlight_pwm.c"]
features_available.append("backlight")
defines += ["USE_BACKLIGHT=1"]
if "input" in features_wanted:
sources += ["embed/trezorhal/stm32f4/i2c_bus.c"]
sources += ["embed/trezorhal/stm32f4/touch/ft6x36.c"]
sources += ["embed/trezorhal/stm32f4/touch/panels/lhs200kb-if21.c"]
features_available.append("touch")
# sources += ["embed/trezorhal/stm32f4/button.c"]
# features_available.append("button")
defines += ["USE_TOUCH=1"]
defines += ["USE_I2C=1"]
# defines += ["USE_BUTTON=1"]
if "sd_card" in features_wanted:
sources += ["embed/trezorhal/stm32f4/sdcard.c"]
sources += ["embed/extmod/modtrezorio/ff.c"]
sources += ["embed/extmod/modtrezorio/ffunicode.c"]
features_available.append("sd_card")
defines += ["USE_SD_CARD=1"]
# if "ble" in features_wanted:
# sources += ["embed/trezorhal/stm32f4/ble/ble_hal.c"]
# sources += ["embed/trezorhal/stm32f4/ble/dfu.c"]
# sources += ["embed/trezorhal/stm32f4/ble/fwu.c"]
# sources += ["embed/trezorhal/stm32f4/ble/ble.c"]
# sources += ["embed/trezorhal/stm32f4/ble/messages.c"]
# sources += [
# "vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c"
# ]
# features_available.append("ble")
# defines += ["USE_BLE=1"]
if "ble" in features_wanted or "sd_card" in features_wanted:
sources += [
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c"
]
if "sbu" in features_wanted:
sources += ["embed/trezorhal/stm32f4/sbu.c"]
features_available.append("sbu")
defines += ["USE_SBU=1"]
if "usb" in features_wanted:
sources += [
"embed/trezorhal/stm32f4/usb/usb_class_hid.c",
"embed/trezorhal/stm32f4/usb/usb_class_vcp.c",
"embed/trezorhal/stm32f4/usb/usb_class_webusb.c",
"embed/trezorhal/stm32f4/usb/usb.c",
"embed/trezorhal/stm32f4/usb/usbd_conf.c",
"embed/trezorhal/stm32f4/usb/usbd_core.c",
"embed/trezorhal/stm32f4/usb/usbd_ctlreq.c",
"embed/trezorhal/stm32f4/usb/usbd_ioreq.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c",
]
features_available.append("usb")
if "dma2d" in features_wanted:
defines += ["USE_DMA2D"]
sources += ["embed/trezorhal/stm32u5/dma2d_bitblt.c"]
sources += [
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c",
]
features_available.append("dma2d")
return features_available

View File

@ -0,0 +1,118 @@
from __future__ import annotations
from .. import get_hw_model_as_number
from ..stm32u5_common import stm32u5_common_files
def configure(
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
) -> list[str]:
features_available: list[str] = []
board = "T3W1/boards/trezor_t3w1_revA.h"
hw_model = get_hw_model_as_number("T3W1")
hw_revision = 0
mcu = "STM32U5G9xx"
linker_script = """embed/trezorhal/stm32u5/linker/u5g/{target}.ld"""
stm32u5_common_files(env, defines, sources, paths)
env.get("ENV")[
"CPU_ASFLAGS"
] = "-mthumb -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 "
env.get("ENV")[
"CPU_CCFLAGS"
] = "-mthumb -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mtune=cortex-m33 -mcmse "
env.get("ENV")["RUST_TARGET"] = "thumbv8m.main-none-eabihf"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
sources += [
"embed/trezorhal/stm32u5/xdisplay/st7785ma/display_driver.c",
"embed/trezorhal/stm32u5/backlight_pwm.c",
]
defines += ["USE_BACKLIGHT=1"]
if "input" in features_wanted:
sources += ["embed/trezorhal/stm32u5/i2c_bus.c"]
sources += ["embed/trezorhal/stm32u5/touch/ft6x36.c"]
sources += ["embed/trezorhal/stm32u5/touch/panels/lhs200kb-if21.c"]
features_available.append("touch")
# sources += ["embed/trezorhal/stm32u5/button.c"]
# features_available.append("button")
defines += ["USE_TOUCH=1"]
defines += ["USE_I2C=1"]
# defines += ["USE_BUTTON=1"]
# if "ble" in features_wanted:
# sources += ["embed/trezorhal/stm32f4/ble/ble_hal.c"]
# sources += ["embed/trezorhal/stm32f4/ble/dfu.c"]
# sources += ["embed/trezorhal/stm32f4/ble/fwu.c"]
# sources += ["embed/trezorhal/stm32f4/ble/ble.c"]
# sources += ["embed/trezorhal/stm32f4/ble/messages.c"]
# sources += [
# "vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c"
# ]
# features_available.append("ble")
# defines += ["USE_BLE=1"]
if "ble" in features_wanted:
sources += [
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c"
]
if "sbu" in features_wanted:
sources += ["embed/trezorhal/stm32u5/sbu.c"]
features_available.append("sbu")
defines += ["USE_SBU=1"]
if "usb" in features_wanted:
sources += [
"embed/trezorhal/stm32u5/usb/usb_class_hid.c",
"embed/trezorhal/stm32u5/usb/usb_class_vcp.c",
"embed/trezorhal/stm32u5/usb/usb_class_webusb.c",
"embed/trezorhal/stm32u5/usb/usb.c",
"embed/trezorhal/stm32u5/usb/usbd_conf.c",
"embed/trezorhal/stm32u5/usb/usbd_core.c",
"embed/trezorhal/stm32u5/usb/usbd_ctlreq.c",
"embed/trezorhal/stm32u5/usb/usbd_ioreq.c",
"vendor/stm32u5xx_hal_driver/Src/stm32u5xx_ll_usb.c",
]
features_available.append("usb")
defines += [
"USE_DMA2D",
"USE_RGB_COLORS",
]
sources += ["embed/trezorhal/stm32u5/dma2d_bitblt.c"]
features_available.append("dma2d")
defines += ["FRAMEBUFFER"]
defines += ["DISPLAY_RGB565"]
features_available.append("framebuffer")
features_available.append("display_rgb565")
defines += [
"USE_HASH_PROCESSOR=1",
"USE_STORAGE_HWKEY=1",
"USE_TAMPER=1",
"USE_FLASH_BURST=1",
"USE_OEM_KEYS_CHECK=1",
"USE_RESET_TO_BOOT=1",
]
env.get("ENV")["LINKER_SCRIPT"] = linker_script
defs = env.get("CPPDEFINES_IMPLICIT")
defs += ["__ARM_FEATURE_CMSE=3"]
return features_available

View File

@ -300,8 +300,8 @@ T3B1_HASH_PARAMS = FirmwareHashParameters(
)
T3W1_HASH_PARAMS = FirmwareHashParameters(
hash_function=hashlib.blake2s,
chunk_size=1024 * 128,
hash_function=hashlib.sha256,
chunk_size=1024 * 256,
padding_byte=None,
)