mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
feat(core): add T3W1 emulator build
[no changelog]
This commit is contained in:
parent
a0c885d244
commit
d71d9e9c34
@ -72,7 +72,6 @@ CPPPATH_MOD += [
|
||||
|
||||
SOURCE_MOD += [
|
||||
'embed/extmod/modtrezorcrypto/rand.c',
|
||||
'embed/lib/buffers.c',
|
||||
'embed/lib/colors.c',
|
||||
'embed/lib/display_utils.c',
|
||||
'embed/lib/error_handling.c',
|
||||
|
@ -204,7 +204,6 @@ CPPPATH_MOD += [
|
||||
]
|
||||
SOURCE_MOD += [
|
||||
'embed/extmod/modtrezorui/modtrezorui.c',
|
||||
'embed/lib/buffers.c',
|
||||
'embed/lib/colors.c',
|
||||
'embed/lib/display_utils.c',
|
||||
'embed/lib/error_handling.c',
|
||||
|
26
core/embed/models/T3W1/boards/t3w1-unix.h
Normal file
26
core/embed/models/T3W1/boards/t3w1-unix.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef BOARDS_T3W1_UNIX_H
|
||||
#define BOARDS_T3W1_UNIX_H
|
||||
|
||||
#define USE_TOUCH 1
|
||||
#define USE_SBU 1
|
||||
#define USE_RGB_COLORS 1
|
||||
#define USE_BACKLIGHT 1
|
||||
#define USE_OPTIGA 1
|
||||
|
||||
#define MAX_DISPLAY_RESX 380
|
||||
#define MAX_DISPLAY_RESY 520
|
||||
#define DISPLAY_RESX 380
|
||||
#define DISPLAY_RESY 520
|
||||
#define TREZOR_FONT_BPP 4
|
||||
|
||||
#define WINDOW_WIDTH 400
|
||||
#define WINDOW_HEIGHT 600
|
||||
#define TOUCH_OFFSET_X 80
|
||||
#define TOUCH_OFFSET_Y 102
|
||||
|
||||
#define ORIENTATION_NS 1
|
||||
|
||||
// #define BACKGROUND_FILE "T3W1/background_T3W1.h"
|
||||
// #define BACKGROUND_NAME background_T3W1_jpg
|
||||
|
||||
#endif // BOARDS_T3W1_UNIX_H
|
@ -122,12 +122,14 @@ void display_init(display_content_mode_t mode) {
|
||||
SDL_PumpEvents();
|
||||
SDL_SetWindowSize(drv->window, WINDOW_WIDTH, WINDOW_HEIGHT);
|
||||
#endif
|
||||
#ifdef BACKGROUND_FILE
|
||||
#include BACKGROUND_FILE
|
||||
#define CONCAT_LEN_HELPER(name) name##_len
|
||||
#define CONCAT_LEN(name) CONCAT_LEN_HELPER(name)
|
||||
drv->background = IMG_LoadTexture_RW(
|
||||
drv->renderer,
|
||||
SDL_RWFromMem(BACKGROUND_NAME, CONCAT_LEN(BACKGROUND_NAME)), 0);
|
||||
#endif
|
||||
if (drv->background) {
|
||||
SDL_SetTextureBlendMode(drv->background, SDL_BLENDMODE_NONE);
|
||||
sdl_touch_offset_x = TOUCH_OFFSET_X;
|
||||
|
@ -35,16 +35,16 @@
|
||||
#define FLASH_FILE profile_flash_path()
|
||||
#endif
|
||||
|
||||
#if defined TREZOR_MODEL_T || defined TREZOR_MODEL_R
|
||||
#if defined STM32F427xx || defined STM32F429xx
|
||||
#define FLASH_SECTOR_COUNT 24
|
||||
#elif defined TREZOR_MODEL_T3T1 || defined TREZOR_MODEL_T3B1
|
||||
#elif defined STM32U585xx || defined STM32U5A9xx
|
||||
#define FLASH_SECTOR_COUNT 256
|
||||
#else
|
||||
#error Unknown MCU
|
||||
#endif
|
||||
|
||||
static uint32_t FLASH_SECTOR_TABLE[FLASH_SECTOR_COUNT + 1] = {
|
||||
#if defined TREZOR_MODEL_T || defined TREZOR_MODEL_R
|
||||
#if defined STM32F427xx || defined STM32F429xx
|
||||
[0] = 0x08000000, // - 0x08003FFF | 16 KiB
|
||||
[1] = 0x08004000, // - 0x08007FFF | 16 KiB
|
||||
[2] = 0x08008000, // - 0x0800BFFF | 16 KiB
|
||||
@ -70,7 +70,7 @@ static uint32_t FLASH_SECTOR_TABLE[FLASH_SECTOR_COUNT + 1] = {
|
||||
[22] = 0x081C0000, // - 0x081DFFFF | 128 KiB
|
||||
[23] = 0x081E0000, // - 0x081FFFFF | 128 KiB
|
||||
[24] = 0x08200000, // last element - not a valid sector
|
||||
#elif defined TREZOR_MODEL_T3T1 || defined TREZOR_MODEL_T3B1
|
||||
#elif defined STM32U585xx || defined STM32U5A9xx
|
||||
[0] = 0x08000000, // - 0x08001FFF | 8 KiB
|
||||
// rest is initialized in flash_init
|
||||
#else
|
||||
|
@ -34,6 +34,9 @@
|
||||
#elif defined(TREZOR_MODEL_T3B1)
|
||||
#include "certs/T2B1.h"
|
||||
#define DEVICE_CERT_CHAIN T2B1_der
|
||||
#elif defined(TREZOR_MODEL_T3W1)
|
||||
#include "certs/T2B1.h"
|
||||
#define DEVICE_CERT_CHAIN T2B1_der
|
||||
#else
|
||||
#error "Cert chain for specified model is not available."
|
||||
#endif
|
||||
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from . import trezor_t3w1_d1
|
||||
from . import emulator, trezor_t3w1_d1
|
||||
|
||||
|
||||
def configure_board(
|
||||
@ -18,6 +18,7 @@ def configure_board(
|
||||
|
||||
# Mapping of revisions to their respective configurations
|
||||
revision_map = {
|
||||
"emulator": emulator,
|
||||
"d1": trezor_t3w1_d1,
|
||||
}
|
||||
|
||||
|
61
core/site_scons/models/T3W1/emulator.py
Normal file
61
core/site_scons/models/T3W1/emulator.py
Normal file
@ -0,0 +1,61 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .. import get_hw_model_as_number
|
||||
|
||||
|
||||
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/t3w1-unix.h"
|
||||
hw_model = get_hw_model_as_number("T3W1")
|
||||
hw_revision = 0
|
||||
mcu = "STM32F427xx"
|
||||
|
||||
defines += ["XFRAMEBUFFER", "DISPLAY_RGB585"]
|
||||
features_available.append("xframebuffer")
|
||||
features_available.append("display_rgb565")
|
||||
|
||||
defines += [mcu]
|
||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||
defines += [f"HW_MODEL={hw_model}"]
|
||||
defines += [f"HW_REVISION={hw_revision}"]
|
||||
defines += [f"MCU_TYPE={mcu}"]
|
||||
# todo change to blockwise flash when implemented in unix
|
||||
defines += ["FLASH_BIT_ACCESS=1"]
|
||||
defines += ["FLASH_BLOCK_WORDS=1"]
|
||||
|
||||
if "dma2d" in features_wanted:
|
||||
features_available.append("dma2d")
|
||||
if "new_rendering" in features_wanted:
|
||||
sources += [
|
||||
"embed/trezorhal/unix/dma2d_bitblt.c",
|
||||
]
|
||||
else:
|
||||
sources += ["embed/lib/dma2d_emul.c"]
|
||||
defines += ["USE_DMA2D"]
|
||||
|
||||
if "sbu" in features_wanted:
|
||||
sources += ["embed/trezorhal/unix/sbu.c"]
|
||||
|
||||
if "optiga_hal" in features_wanted:
|
||||
sources += ["embed/trezorhal/unix/optiga_hal.c"]
|
||||
|
||||
if "optiga" in features_wanted:
|
||||
sources += ["embed/trezorhal/unix/optiga.c"]
|
||||
features_available.append("optiga")
|
||||
|
||||
if "input" in features_wanted:
|
||||
sources += ["embed/trezorhal/unix/touch.c"]
|
||||
features_available.append("touch")
|
||||
|
||||
features_available.append("backlight")
|
||||
|
||||
sources += ["embed/trezorhal/stm32f4/layout.c"]
|
||||
|
||||
return features_available
|
Loading…
Reference in New Issue
Block a user