parent
0e9fda35ec
commit
335f24e99a
Binary file not shown.
@ -0,0 +1 @@
|
||||
./memory_T.ld
|
@ -0,0 +1,30 @@
|
||||
#ifndef MODELS_MODEL_T3W1_H_
|
||||
#define MODELS_MODEL_T3W1_H_
|
||||
|
||||
#define MODEL_NAME "T3W1"
|
||||
#define MODEL_FULL_NAME "Trezor T3W1"
|
||||
#define MODEL_INTERNAL_NAME "T3W1"
|
||||
#define MODEL_INTERNAL_NAME_TOKEN T3W1
|
||||
#define MODEL_INTERNAL_NAME_QSTR MP_QSTR_T3W1
|
||||
|
||||
/*** Using DEV KEYS temorarily ***/
|
||||
#define MODEL_BOARDLOADER_KEYS \
|
||||
(const uint8_t *)"\xdb\x99\x5f\xe2\x51\x69\xd1\x41\xca\xb9\xbb\xba\x92\xba\xa0\x1f\x9f\x2e\x1e\xce\x7d\xf4\xcb\x2a\xc0\x51\x90\xf3\x7f\xcc\x1f\x9d", \
|
||||
(const uint8_t *)"\x21\x52\xf8\xd1\x9b\x79\x1d\x24\x45\x32\x42\xe1\x5f\x2e\xab\x6c\xb7\xcf\xfa\x7b\x6a\x5e\xd3\x00\x97\x96\x0e\x06\x98\x81\xdb\x12", \
|
||||
(const uint8_t *)"\x22\xfc\x29\x77\x92\xf0\xb6\xff\xc0\xbf\xcf\xdb\x7e\xdb\x0c\x0a\xa1\x4e\x02\x5a\x36\x5e\xc0\xe3\x42\xe8\x6e\x38\x29\xcb\x74\xb6",
|
||||
|
||||
#define MODEL_BOOTLOADER_KEYS \
|
||||
(const uint8_t *)"\xd7\x59\x79\x3b\xbc\x13\xa2\x81\x9a\x82\x7c\x76\xad\xb6\xfb\xa8\xa4\x9a\xee\x00\x7f\x49\xf2\xd0\x99\x2d\x99\xb8\x25\xad\x2c\x48", \
|
||||
(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 BOARDLOADER_START 0x08000000
|
||||
#define BOOTLOADER_START 0x08020000
|
||||
#define FIRMWARE_START 0x08040000
|
||||
|
||||
#define IMAGE_CHUNK_SIZE (128 * 1024)
|
||||
#define BOOTLOADER_IMAGE_MAXSIZE (128 * 1024 * 1) // 128 KB
|
||||
#define FIRMWARE_IMAGE_MAXSIZE (128 * 1024 * 13) // 1664 KB
|
||||
#define NORCOW_SECTOR_SIZE (64 * 1024)
|
||||
|
||||
#endif
|
@ -0,0 +1,82 @@
|
||||
#include "flash.h"
|
||||
#include "model.h"
|
||||
|
||||
const flash_area_t STORAGE_AREAS[STORAGE_AREAS_COUNT] = {
|
||||
{
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = 4,
|
||||
.num_sectors = 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = 16,
|
||||
.num_sectors = 1,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t BOARDLOADER_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = 0,
|
||||
.num_sectors = 3,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t BOOTLOADER_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = 5,
|
||||
.num_sectors = 1,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t FIRMWARE_AREA = {
|
||||
.num_subareas = 2,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = 6,
|
||||
.num_sectors = 6,
|
||||
},
|
||||
.subarea[1] =
|
||||
{
|
||||
.first_sector = 17,
|
||||
.num_sectors = 7,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t WIPE_AREA = {
|
||||
.num_subareas = 3,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = 4,
|
||||
.num_sectors = 1,
|
||||
},
|
||||
.subarea[1] =
|
||||
{
|
||||
.first_sector = 6,
|
||||
.num_sectors =
|
||||
9, // sector 15 skipped due to bootloader MPU settings
|
||||
},
|
||||
.subarea[2] =
|
||||
{
|
||||
.first_sector = 16,
|
||||
.num_sectors = 8,
|
||||
},
|
||||
};
|
||||
|
||||
const flash_area_t ALL_WIPE_AREA = {
|
||||
.num_subareas = 1,
|
||||
.subarea[0] =
|
||||
{
|
||||
.first_sector = 3,
|
||||
.num_sectors = 21,
|
||||
},
|
||||
};
|
@ -0,0 +1,71 @@
|
||||
#ifndef _TREZOR_T3W1_H
|
||||
#define _TREZOR_T3W1_H
|
||||
|
||||
#define DISPLAY_RESX 240
|
||||
#define DISPLAY_RESY 320
|
||||
|
||||
#define USE_SD_CARD 1
|
||||
#define USE_I2C 1
|
||||
#define USE_TOUCH 1
|
||||
#define USE_BUTTON 1
|
||||
#define USE_SBU 1
|
||||
#define USE_RGB_COLORS 1
|
||||
#define USE_BACKLIGHT 1
|
||||
#define USE_DISP_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
|
||||
|
||||
#include "displays/panels/lhs200kb-if21.h"
|
||||
#include "displays/st7789v.h"
|
||||
|
||||
#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_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 GPIOB
|
||||
#define I2C_INSTANCE_1_SDA_PIN GPIO_PIN_11
|
||||
#define I2C_INSTANCE_1_SDA_CLK_EN __HAL_RCC_GPIOB_CLK_ENABLE
|
||||
#define I2C_INSTANCE_1_SCL_PORT GPIOB
|
||||
#define I2C_INSTANCE_1_SCL_PIN GPIO_PIN_10
|
||||
#define I2C_INSTANCE_1_SCL_CLK_EN __HAL_RCC_GPIOB_CLK_ENABLE
|
||||
#define I2C_INSTANCE_1_RESET_FLG RCC_APB1RSTR_I2C2RST
|
||||
|
||||
#define TOUCH_I2C_NUM 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
|
@ -0,0 +1,151 @@
|
||||
|
||||
#include TREZOR_BOARD
|
||||
#include "display_interface.h"
|
||||
#include "displays/st7789v.h"
|
||||
#include "touch.h"
|
||||
|
||||
void lhs200kb_if21_init_seq() {
|
||||
CMD(0x36);
|
||||
DATA(0x00);
|
||||
|
||||
CMD(0x35);
|
||||
DATA(0x00);
|
||||
|
||||
CMD(0x3A);
|
||||
DATA(0x05);
|
||||
|
||||
CMD(0xB2);
|
||||
DATA(0x0C);
|
||||
DATA(0x0C);
|
||||
DATA(0x00);
|
||||
DATA(0x33);
|
||||
DATA(0x33);
|
||||
|
||||
CMD(0xB7);
|
||||
DATA(0x78);
|
||||
|
||||
CMD(0xBB);
|
||||
DATA(0x2F);
|
||||
|
||||
CMD(0xC0);
|
||||
DATA(0x2C);
|
||||
|
||||
CMD(0xC2);
|
||||
DATA(0x01);
|
||||
|
||||
CMD(0xC3);
|
||||
DATA(0x19);
|
||||
|
||||
CMD(0xC4);
|
||||
DATA(0x20);
|
||||
|
||||
CMD(0xC6);
|
||||
DATA(0x0F);
|
||||
|
||||
CMD(0xD0);
|
||||
DATA(0xA4);
|
||||
DATA(0xA1);
|
||||
|
||||
CMD(0xD6);
|
||||
DATA(0xA1);
|
||||
|
||||
CMD(0xE0);
|
||||
DATA(0xF0);
|
||||
DATA(0x08);
|
||||
DATA(0x0F);
|
||||
DATA(0x0B);
|
||||
DATA(0x0B);
|
||||
DATA(0x07);
|
||||
DATA(0x34);
|
||||
DATA(0x43);
|
||||
DATA(0x4B);
|
||||
DATA(0x38);
|
||||
DATA(0x14);
|
||||
DATA(0x13);
|
||||
DATA(0x2C);
|
||||
DATA(0x31);
|
||||
|
||||
CMD(0xE1);
|
||||
DATA(0xF0);
|
||||
DATA(0x0C);
|
||||
DATA(0x11);
|
||||
DATA(0x09);
|
||||
DATA(0x08);
|
||||
DATA(0x24);
|
||||
DATA(0x34);
|
||||
DATA(0x33);
|
||||
DATA(0x4A);
|
||||
DATA(0x3A);
|
||||
DATA(0x16);
|
||||
DATA(0x16);
|
||||
DATA(0x2E);
|
||||
DATA(0x32);
|
||||
|
||||
CMD(0x21);
|
||||
|
||||
CMD(0x29);
|
||||
}
|
||||
|
||||
void lhs200kb_if21_rotate(int degrees, buffer_offset_t* offset) {
|
||||
uint16_t shift = 0;
|
||||
char BX = 0, BY = 0;
|
||||
|
||||
#define RGB (1 << 3)
|
||||
#define ML (1 << 4) // vertical refresh order
|
||||
#define MH (1 << 2) // horizontal refresh order
|
||||
#define MV (1 << 5)
|
||||
#define MX (1 << 6)
|
||||
#define MY (1 << 7)
|
||||
// MADCTL: Memory Data Access Control - reference:
|
||||
// section 8.12 in the ST7789V manual
|
||||
uint8_t display_command_parameter = 0;
|
||||
switch (degrees) {
|
||||
case 0:
|
||||
display_command_parameter = 0;
|
||||
BY = 0;
|
||||
break;
|
||||
case 90:
|
||||
display_command_parameter = MV | MX | MH | ML;
|
||||
BX = 1;
|
||||
shift = 1;
|
||||
break;
|
||||
case 180:
|
||||
display_command_parameter = MX | MY | MH | ML;
|
||||
BY = 0;
|
||||
shift = 1;
|
||||
break;
|
||||
case 270:
|
||||
display_command_parameter = MV | MY;
|
||||
BX = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
CMD(0x36);
|
||||
DATA(display_command_parameter);
|
||||
|
||||
if (shift) {
|
||||
// GATECTRL: Gate Control; NL = 320 gate lines, first scan line is
|
||||
// gate 0.; gate scan direction 319 -> 0
|
||||
CMD(0xE4);
|
||||
DATA(0x27);
|
||||
DATA(0x00);
|
||||
DATA(0x10);
|
||||
} else {
|
||||
// GATECTRL: Gate Control; NL = 320 gate lines, first scan line is
|
||||
// gate 0.; gate scan direction 319 -> 0
|
||||
CMD(0xE4);
|
||||
DATA(0x27);
|
||||
DATA(0x00);
|
||||
DATA(0x10);
|
||||
}
|
||||
|
||||
// reset the column and page extents
|
||||
display_set_window(0, 0, DISPLAY_RESX - 1, DISPLAY_RESY - 1);
|
||||
|
||||
offset->x = BX ? (MAX_DISPLAY_RESY - DISPLAY_RESY) : 0;
|
||||
offset->y = BY ? (MAX_DISPLAY_RESY - DISPLAY_RESY) : 0;
|
||||
}
|
||||
|
||||
uint32_t lhs200kb_if21_transform_touch_coords(uint16_t x, uint16_t y) {
|
||||
return touch_pack_xy(y, MAX_DISPLAY_RESY - x);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
|
||||
#ifndef CORE_LHS200KB_IF21_H
|
||||
#define CORE_LHS200KB_IF21_H
|
||||
// ST7789_V IC controller
|
||||
|
||||
#include "displays/st7789v.h"
|
||||
|
||||
void lhs200kb_if21_init_seq(void);
|
||||
void lhs200kb_if21_rotate(int degrees, buffer_offset_t* offset);
|
||||
uint32_t lhs200kb_if21_transform_touch_coords(uint16_t x, uint16_t y);
|
||||
|
||||
#endif // CORE_LHS200KB_IF21_H
|
@ -1,7 +1,11 @@
|
||||
#ifndef LX154A2422_H_
|
||||
#define LX154A2422_H_
|
||||
|
||||
#include "displays/st7789v.h"
|
||||
|
||||
void lx154a2422_init_seq(void);
|
||||
void lx154a2422_gamma(void);
|
||||
void lx154a2422_rotate(int degrees, buffer_offset_t* offset);
|
||||
uint32_t lx154a2422_transform_touch_coords(uint16_t x, uint16_t y);
|
||||
|
||||
#endif
|
||||
|
@ -1,8 +1,9 @@
|
||||
#ifndef TT_OLD1_H_
|
||||
#define TT_OLD1_H_
|
||||
#ifndef TF15411A_H_
|
||||
#define TF15411A_H_
|
||||
|
||||
// GC9307 IC controller
|
||||
|
||||
void tf15411a_init_seq(void);
|
||||
void tf15411a_rotate(int degrees, buffer_offset_t* offset);
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"header_len": 4608,
|
||||
"text": "DEV ONLY, DO NOT USE!",
|
||||
"hw_model": null,
|
||||
"expiry": 0,
|
||||
"version": [0, 0],
|
||||
"sig_m": 2,
|
||||
"trust": {
|
||||
"allow_run_with_secret": false,
|
||||
"show_vendor_string": false,
|
||||
"require_user_click": false,
|
||||
"red_background": false,
|
||||
"delay": 0
|
||||
},
|
||||
"pubkeys": [
|
||||
"e28a8970753332bd72fef413e6b0b2ef1b4aadda7aa2c141f233712a6876b351",
|
||||
"d4eec1869fb1b8a4e817516ad5a931557cb56805c3eb16e8f3a803d647df7869",
|
||||
"772c8a442b7db06e166cfbc1ccbcbcde6f3eba76a4e98ef3ffc519502237d6ef"
|
||||
]
|
||||
}
|
Binary file not shown.
@ -0,0 +1,20 @@
|
||||
{
|
||||
"header_len": 4608,
|
||||
"text": "UNSAFE, DO NOT USE!",
|
||||
"hw_model": "T3W1",
|
||||
"expiry": 0,
|
||||
"version": [0, 1],
|
||||
"sig_m": 2,
|
||||
"trust": {
|
||||
"allow_run_with_secret": false,
|
||||
"show_vendor_string": true,
|
||||
"require_user_click": true,
|
||||
"red_background": true,
|
||||
"delay": 1
|
||||
},
|
||||
"pubkeys": [
|
||||
"e28a8970753332bd72fef413e6b0b2ef1b4aadda7aa2c141f233712a6876b351",
|
||||
"d4eec1869fb1b8a4e817516ad5a931557cb56805c3eb16e8f3a803d647df7869",
|
||||
"772c8a442b7db06e166cfbc1ccbcbcde6f3eba76a4e98ef3ffc519502237d6ef"
|
||||
]
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,90 @@
|
||||
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 = "trezor_t3w1_d1.h"
|
||||
display = "st7789v.c"
|
||||
hw_model = get_hw_model_as_number("T3W1")
|
||||
hw_revision = 0
|
||||
features_available.append("disp_i8080_16bit_dw")
|
||||
|
||||
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=\\"boards/{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
sources += [
|
||||
"embed/models/model_T3W1_layout.c",
|
||||
]
|
||||
sources += [f"embed/trezorhal/stm32f4/displays/{display}"]
|
||||
sources += ["embed/trezorhal/stm32f4/backlight_pwm.c"]
|
||||
sources += ["embed/trezorhal/stm32f4/displays/panels/lhs200kb-if21.c"]
|
||||
features_available.append("backlight")
|
||||
|
||||
if "input" in features_wanted:
|
||||
sources += ["embed/lib/touch.c"]
|
||||
sources += ["embed/trezorhal/stm32f4/i2c.c"]
|
||||
sources += ["embed/trezorhal/stm32f4/touch/ft6x36.c"]
|
||||
features_available.append("touch")
|
||||
sources += ["embed/trezorhal/stm32f4/button.c"]
|
||||
features_available.append("button")
|
||||
|
||||
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")
|
||||
|
||||
if "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")
|
||||
|
||||
if "usb" in features_wanted:
|
||||
sources += [
|
||||
"embed/trezorhal/stm32f4/usb.c",
|
||||
"embed/trezorhal/stm32f4/usbd_conf.c",
|
||||
"embed/trezorhal/stm32f4/usbd_core.c",
|
||||
"embed/trezorhal/stm32f4/usbd_ctlreq.c",
|
||||
"embed/trezorhal/stm32f4/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/stm32f4/dma2d.c"]
|
||||
sources += [
|
||||
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c",
|
||||
]
|
||||
features_available.append("dma2d")
|
||||
|
||||
env.get("ENV")["TREZOR_BOARD"] = board
|
||||
env.get("ENV")["MCU_TYPE"] = mcu
|
||||
|
||||
return features_available
|
Loading…
Reference in new issue