1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 14:58:09 +00:00

refactor(core): make USE_xxx defines global

[no changelog]
This commit is contained in:
tychovrahe 2024-10-29 10:14:43 +01:00 committed by TychoVrahe
parent 9e28e96639
commit 42396dd007
37 changed files with 140 additions and 164 deletions

View File

@ -20,7 +20,7 @@ if not models.has_emulator(TREZOR_MODEL):
)
Return()
FEATURES_WANTED = ["input", "rgb_led", "dma2d", "optiga_hal"]
FEATURES_WANTED = ["input", "rgb_led", "dma2d", "optiga"]
if NEW_RENDERING:
FEATURES_WANTED.append("new_rendering")
@ -269,6 +269,7 @@ rust = env.Command(
env.Append(LINKFLAGS=f'-L{RUST_LIBDIR}')
env.Append(LINKFLAGS=f'-l{RUST_LIB}')
env.Append(LINKFLAGS='-lm')
env.Append(LINKFLAGS='-Wl,--gc-sections')
#
# Program objects

View File

@ -8,12 +8,6 @@
#define DISPLAY_COLOR_MODE DMA2D_OUTPUT_RGB565
#define DISPLAY_LEGACY_HEADER "displays/ltdc.h"
#define USE_I2C 1
#define USE_TOUCH 1
#define USE_SDRAM 1
#define USE_RGB_COLORS 1
#define USE_PVD 1
#define I2C_COUNT 1
#define I2C_INSTANCE_0 I2C3
#define I2C_INSTANCE_0_CLK_EN __HAL_RCC_I2C3_CLK_ENABLE

View File

@ -4,13 +4,6 @@
#define HSE_16MHZ
#define VDD_1V8 1
#define USE_I2C 1
#define USE_RGB_COLORS 1
#define USE_TOUCH 1
// #define USE_SBU 1
// #define USE_DISP_I8080_8BIT_DW 1
#define USE_HASH_PROCESSOR 1
#define DISPLAY_RESX 240
#define DISPLAY_RESY 240

View File

@ -1,10 +1,6 @@
#ifndef BOARDS_T2B1_UNIX_H
#define BOARDS_T2B1_UNIX_H
#define USE_BUTTON 1
#define USE_SBU 1
#define USE_OPTIGA 1
#define MAX_DISPLAY_RESX 128
#define MAX_DISPLAY_RESY 64
#define DISPLAY_RESX 128

View File

@ -3,12 +3,6 @@
#define HSE_8MHZ
#define USE_BUTTON 1
#define USE_SBU 1
#define USE_I2C 1
#define USE_CONSUMPTION_MASK 1
#define USE_PVD 1
#define DISPLAY_RESX 128
#define DISPLAY_RESY 64
#define DISPLAY_LEGACY_HEADER "displays/vg-2864ksweg01.h"

View File

@ -3,10 +3,6 @@
#define HSE_8MHZ
#define USE_BUTTON 1
#define USE_SBU 1
#define USE_PVD 1
#define DISPLAY_RESX 128
#define DISPLAY_RESY 128
#define DISPLAY_LEGACY_HEADER "displays/ug-2828tswig01.h"

View File

@ -3,10 +3,6 @@
#define HSE_8MHZ
#define USE_BUTTON 1
#define USE_SBU 1
#define USE_PVD 1
#define DISPLAY_RESX 128
#define DISPLAY_RESY 64
#define DISPLAY_LEGACY_HEADER "displays/vg-2864ksweg01.h"

View File

@ -3,10 +3,6 @@
#define HSE_8MHZ
#define USE_BUTTON 1
#define USE_SBU 1
#define USE_PVD 1
#define DISPLAY_RESX 128
#define DISPLAY_RESY 64
#define DISPLAY_LEGACY_HEADER "displays/vg-2864ksweg01.h"

View File

@ -1,12 +1,6 @@
#ifndef BOARDS_T2T1_UNIX_H
#define BOARDS_T2T1_UNIX_H
#define USE_TOUCH 1
#define USE_SD_CARD 1
#define USE_SBU 1
#define USE_RGB_COLORS 1
#define USE_BACKLIGHT 1
// ILI9341V, GC9307 and ST7789V drivers support 240px x 320px display resolution
#define MAX_DISPLAY_RESX 240
#define MAX_DISPLAY_RESY 320

View File

@ -3,15 +3,6 @@
#define HSE_8MHZ
#define USE_SD_CARD 1
#define USE_I2C 1
#define USE_TOUCH 1
#define USE_SBU 1
#define USE_RGB_COLORS 1
#define USE_BACKLIGHT 1
#define USE_DISP_I8080_8BIT_DW 1
#define USE_PVD 1
#define DISPLAY_RESX 240
#define DISPLAY_RESY 240
#define DISPLAY_COLOR_MODE DMA2D_OUTPUT_RGB565
@ -20,6 +11,7 @@
#define DISPLAY_IDENTIFY 1
#define DISPLAY_TE_PORT GPIOD
#define DISPLAY_TE_PIN GPIO_PIN_12
#define DISPLAY_I8080_8BIT_DW 1
#define BACKLIGHT_PWM_FREQ 10000
#define BACKLIGHT_PWM_TIM TIM1

View File

@ -1,10 +1,6 @@
#ifndef BOARDS_T3B1_UNIX_H
#define BOARDS_T3B1_UNIX_H
#define USE_BUTTON 1
#define USE_SBU 1
#define USE_OPTIGA 1
#define MAX_DISPLAY_RESX 128
#define MAX_DISPLAY_RESY 64
#define DISPLAY_RESX 128

View File

@ -6,13 +6,6 @@
#define VDD_3V3 1
#define USE_I2C 1
#define USE_BUTTON 1
#define USE_SBU 1
#define USE_HASH_PROCESSOR 1
#define USE_CONSUMPTION_MASK 1
#define USE_PVD 1
#define DISPLAY_LEGACY_HEADER "displays/vg-2864ksweg01.h"
#define BTN_LEFT_PIN GPIO_PIN_11

View File

@ -1,13 +1,6 @@
#ifndef BOARDS_T3T1_UNIX_H
#define BOARDS_T3T1_UNIX_H
#define USE_TOUCH 1
#define USE_SD_CARD 1
#define USE_SBU 1
#define USE_RGB_COLORS 1
#define USE_BACKLIGHT 1
#define USE_OPTIGA 1
#define MAX_DISPLAY_RESX 240
#define MAX_DISPLAY_RESY 240
#define DISPLAY_RESX 240

View File

@ -3,22 +3,12 @@
#define VDD_3V3 1
#define USE_SD_CARD 1
#define USE_I2C 1
#define USE_TOUCH 1
#define USE_SBU 1
#define USE_RGB_COLORS 1
#define USE_DISP_I8080_8BIT_DW 1
#define USE_HAPTIC 1
#define USE_BACKLIGHT 1
#define USE_HASH_PROCESSOR 1
#define USE_PVD 1
#define DISPLAY_RESX 240
#define DISPLAY_RESY 240
#define DISPLAY_LEGACY_HEADER "displays/st7789v.h"
#define DISPLAY_COLOR_MODE DMA2D_OUTPUT_RGB565
#define DISPLAY_PANEL_LX154A2482 1
#define DISPLAY_I8080_8BIT_DW 1
#define DISPLAY_IDENTIFY 1
#define DISPLAY_TE_PORT GPIOD

View File

@ -4,22 +4,12 @@
#define VDD_3V3 1
#define HSE_16MHZ 1
#define USE_SD_CARD 1
#define USE_I2C 1
#define USE_TOUCH 1
#define USE_SBU 1
#define USE_RGB_COLORS 1
#define USE_DISP_I8080_8BIT_DW 1
#define USE_HAPTIC 1
#define USE_BACKLIGHT 1
#define USE_HASH_PROCESSOR 1
#define USE_PVD 1
#define DISPLAY_RESX 240
#define DISPLAY_RESY 240
#define DISPLAY_LEGACY_HEADER "displays/st7789v.h"
#define DISPLAY_COLOR_MODE DMA2D_OUTPUT_RGB565
#define DISPLAY_PANEL_LX154A2482 1
#define DISPLAY_I8080_8BIT_DW 1
#define DISPLAY_IDENTIFY 1
#define DISPLAY_TE_PORT GPIOD

View File

@ -1,12 +1,6 @@
#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

View File

@ -3,21 +3,12 @@
#define HSE_8MHZ
#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 USE_BLE 1
#define DISPLAY_RESX 240
#define DISPLAY_RESY 320
#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

View File

@ -49,9 +49,9 @@ const volatile uint8_t DISPLAY_ST7789V_INVERT_COLORS = 1;
#define DISPLAY_MEMORY_BASE FMC_BANK1
#define DISPLAY_MEMORY_PIN 16
#ifdef USE_DISP_I8080_16BIT_DW
#ifdef DISPLAY_I8080_16BIT_DW
#define DISPLAY_ADDR_SHIFT 2
#elif USE_DISP_I8080_8BIT_DW
#elif DISPLAY_I8080_8BIT_DW
#define DISPLAY_ADDR_SHIFT 1
#endif
@ -314,10 +314,10 @@ void display_setup_fmc(void) {
external_display_data_sram.Init.NSBank = FMC_NORSRAM_BANK1;
external_display_data_sram.Init.DataAddressMux = FMC_DATA_ADDRESS_MUX_DISABLE;
external_display_data_sram.Init.MemoryType = FMC_MEMORY_TYPE_SRAM;
#ifdef USE_DISP_I8080_16BIT_DW
#ifdef DISPLAY_I8080_16BIT_DW
external_display_data_sram.Init.MemoryDataWidth =
FMC_NORSRAM_MEM_BUS_WIDTH_16;
#elif USE_DISP_I8080_8BIT_DW
#elif DISPLAY_I8080_8BIT_DW
external_display_data_sram.Init.MemoryDataWidth = FMC_NORSRAM_MEM_BUS_WIDTH_8;
#endif
external_display_data_sram.Init.BurstAccessMode =
@ -445,7 +445,7 @@ void display_init_all(void) {
// LCD_D4/PE7 LCD_D5/PE8 LCD_D6/PE9 LCD_D7/PE10
GPIO_InitStructure.Pin = GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10;
HAL_GPIO_Init(GPIOE, &GPIO_InitStructure);
#ifdef USE_DISP_I8080_16BIT_DW
#ifdef DISPLAY_I8080_16BIT_DW
// LCD_D8/PE11 LCD_D9/PE12 LCD_D10/PE13 LCD_D11/PE14
GPIO_InitStructure.Pin =
GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14;

View File

@ -16,9 +16,9 @@ typedef struct {
#define DISPLAY_COLOR_MODE DMA2D_OUTPUT_RGB565
#define TREZOR_FONT_BPP 4
#ifdef USE_DISP_I8080_16BIT_DW
#ifdef DISPLAY_I8080_16BIT_DW
#define DISP_MEM_TYPE uint16_t
#elif USE_DISP_I8080_8BIT_DW
#elif DISPLAY_I8080_8BIT_DW
#define DISP_MEM_TYPE uint8_t
#else
#error "Unsupported display interface"
@ -51,9 +51,9 @@ void display_efficient_clear(void);
#else
#ifdef USE_DISP_I8080_16BIT_DW
#ifdef DISPLAY_I8080_16BIT_DW
#define PIXELDATA(X) DATA(X)
#elif USE_DISP_I8080_8BIT_DW
#elif DISPLAY_I8080_8BIT_DW
#define PIXELDATA(X) \
DATA((X) & 0xFF); \
DATA((X) >> 8)

View File

@ -74,7 +74,7 @@ void display_io_init_gpio(void) {
// LCD_D4/PE7 LCD_D5/PE8 LCD_D6/PE9 LCD_D7/PE10
GPIO_InitStructure.Pin = GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10;
HAL_GPIO_Init(GPIOE, &GPIO_InitStructure);
#ifdef USE_DISP_I8080_16BIT_DW
#ifdef DISPLAY_I8080_16BIT_DW
// LCD_D8/PE11 LCD_D9/PE12 LCD_D10/PE13 LCD_D11/PE14
GPIO_InitStructure.Pin =
GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14;
@ -99,10 +99,10 @@ void display_io_init_fmc(void) {
external_display_data_sram.Init.NSBank = FMC_NORSRAM_BANK1;
external_display_data_sram.Init.DataAddressMux = FMC_DATA_ADDRESS_MUX_DISABLE;
external_display_data_sram.Init.MemoryType = FMC_MEMORY_TYPE_SRAM;
#ifdef USE_DISP_I8080_16BIT_DW
#ifdef DISPLAY_I8080_16BIT_DW
external_display_data_sram.Init.MemoryDataWidth =
FMC_NORSRAM_MEM_BUS_WIDTH_16;
#elif USE_DISP_I8080_8BIT_DW
#elif DISPLAY_I8080_8BIT_DW
external_display_data_sram.Init.MemoryDataWidth = FMC_NORSRAM_MEM_BUS_WIDTH_8;
#endif
external_display_data_sram.Init.BurstAccessMode =

View File

@ -34,10 +34,10 @@ void display_io_init_te_interrupt(void);
#define DISPLAY_MEMORY_BASE FMC_BANK1
#define DISPLAY_MEMORY_PIN 16
#ifdef USE_DISP_I8080_16BIT_DW
#ifdef DISPLAY_I8080_16BIT_DW
#define DISPLAY_ADDR_SHIFT 2
#define DISP_MEM_TYPE uint16_t
#elif USE_DISP_I8080_8BIT_DW
#elif DISPLAY_I8080_8BIT_DW
#define DISPLAY_ADDR_SHIFT 1
#define DISP_MEM_TYPE uint8_t
#else
@ -56,9 +56,9 @@ extern __IO DISP_MEM_TYPE *const DISPLAY_DATA_ADDRESS;
#define ISSUE_CMD_BYTE(X) (*(DISPLAY_CMD_ADDRESS) = (X))
#define ISSUE_DATA_BYTE(X) (*(DISPLAY_DATA_ADDRESS) = (X))
#ifdef USE_DISP_I8080_16BIT_DW
#ifdef DISPLAY_I8080_16BIT_DW
#define ISSUE_PIXEL_DATA(X) ISSUE_DATA_BYTE(X)
#elif USE_DISP_I8080_8BIT_DW
#elif DISPLAY_I8080_8BIT_DW
#define ISSUE_PIXEL_DATA(X) \
ISSUE_DATA_BYTE((X) & 0xFF); \
ISSUE_DATA_BYTE((X) >> 8)

View File

@ -53,11 +53,11 @@ def configure(
sources += [
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c"
]
sources += ["embed/trezorhal/stm32f4/sdram.c"]
sources += [
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c"
]
defines += ["USE_DMA2D"]
defines += ["USE_RGB_COLORS=1"]
defines += ["FRAMEBUFFER"]
features_available.append("dma2d")
features_available.append("framebuffer")
@ -68,10 +68,15 @@ def configure(
features_available.append("xframebuffer")
features_available.append("display_rgb565")
sources += ["embed/trezorhal/stm32f4/sdram.c"]
defines += ["USE_SDRAM=1"]
if "input" in features_wanted:
sources += ["embed/trezorhal/stm32f4/i2c_bus.c"]
sources += ["embed/trezorhal/stm32f4/touch/stmpe811.c"]
features_available.append("touch")
defines += ["USE_TOUCH=1"]
defines += ["USE_I2C=1"]
if "usb" in features_wanted:
sources += [
@ -87,4 +92,6 @@ def configure(
]
features_available.append("usb")
defines += ["USE_PVD=1"]
return features_available

View File

@ -57,18 +57,8 @@ def configure(
sources += ["embed/trezorhal/stm32u5/i2c_bus.c"]
sources += ["embed/trezorhal/stm32u5/touch/sitronix.c"]
features_available.append("touch")
# if "sd_card" in features_wanted:
# sources += ['embed/trezorhal/sdcard.c', ]
# sources += ['embed/extmod/modtrezorio/ff.c', ]
# sources += ['embed/extmod/modtrezorio/ffunicode.c', ]
# features_available.append("sd_card")
if "sbu" in features_wanted:
sources += [
"embed/trezorhal/stm32u5/sbu.c",
]
features_available.append("sbu")
defines += ["USE_TOUCH=1"]
defines += ["USE_I2C=1"]
if "usb" in features_wanted:
sources += [
@ -84,7 +74,13 @@ def configure(
]
features_available.append("usb")
defines += ["USE_DMA2D", "FRAMEBUFFER", "FRAMEBUFFER32BIT", "UI_COLOR_32BIT"]
defines += [
"USE_DMA2D",
"FRAMEBUFFER",
"FRAMEBUFFER32BIT",
"UI_COLOR_32BIT",
"USE_RGB_COLORS",
]
if "new_rendering" in features_wanted:
sources += ["embed/trezorhal/stm32u5/dma2d_bitblt.c"]
else:
@ -100,6 +96,8 @@ def configure(
features_available.append("xframebuffer")
features_available.append("display_rgba8888")
defines += ["USE_HASH_PROCESSOR=1"]
env.get("ENV")["LINKER_SCRIPT"] = linker_script
defs = env.get("CPPDEFINES_IMPLICIT")

View File

@ -32,17 +32,18 @@ def configure(
if "sbu" in features_wanted:
sources += ["embed/trezorhal/unix/sbu.c"]
if "optiga_hal" in features_wanted:
sources += ["embed/trezorhal/unix/optiga_hal.c"]
defines += ["USE_SBU=1"]
if "optiga" in features_wanted:
sources += ["embed/trezorhal/unix/optiga_hal.c"]
sources += ["embed/trezorhal/unix/optiga.c"]
features_available.append("optiga")
defines += ["USE_OPTIGA=1"]
if "input" in features_wanted:
sources += ["embed/trezorhal/unix/button.c"]
features_available.append("button")
defines += ["USE_BUTTON=1"]
sources += ["embed/trezorhal/stm32f4/layout.c"]

View File

@ -48,16 +48,20 @@ def configure(
if "input" in features_wanted:
sources += ["embed/trezorhal/stm32f4/button.c"]
features_available.append("button")
defines += ["USE_BUTTON=1"]
if "sbu" in features_wanted:
sources += ["embed/trezorhal/stm32f4/sbu.c"]
features_available.append("sbu")
defines += ["USE_SBU=1"]
if "consumption_mask" in features_wanted:
sources += ["embed/trezorhal/stm32f4/consumption_mask.c"]
sources += [
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c"
]
defines += ["USE_CONSUMPTION_MASK=1"]
if "usb" in features_wanted:
sources += [
"embed/trezorhal/stm32f4/usb/usb_class_hid.c",
@ -73,7 +77,6 @@ def configure(
features_available.append("usb")
if "optiga" in features_wanted:
defines += ["USE_OPTIGA=1"]
sources += ["embed/trezorhal/stm32f4/i2c_bus.c"]
sources += ["embed/trezorhal/stm32f4/optiga_hal.c"]
sources += ["embed/trezorhal/optiga/optiga.c"]
@ -81,5 +84,9 @@ def configure(
sources += ["embed/trezorhal/optiga/optiga_transport.c"]
sources += ["vendor/trezor-crypto/hash_to_curve.c"]
features_available.append("optiga")
defines += ["USE_OPTIGA=1"]
defines += ["USE_I2C=1"]
defines += ["USE_PVD=1"]
return features_available

View File

@ -48,6 +48,7 @@ def configure(
if "input" in features_wanted:
sources += ["embed/trezorhal/stm32f4/button.c"]
features_available.append("button")
defines += ["USE_BUTTON=1"]
if "rgb_led" in features_wanted:
sources += ["embed/trezorhal/stm32f4/rgb_led.c"]
@ -56,6 +57,7 @@ def configure(
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 += [
@ -71,4 +73,6 @@ def configure(
]
features_available.append("usb")
defines += ["USE_PVD=1"]
return features_available

View File

@ -48,10 +48,12 @@ def configure(
if "input" in features_wanted:
sources += ["embed/trezorhal/stm32f4/button.c"]
features_available.append("button")
defines += ["USE_BUTTON=1"]
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 += [
@ -67,4 +69,6 @@ def configure(
]
features_available.append("usb")
defines += ["USE_PVD=1"]
return features_available

View File

@ -48,10 +48,12 @@ def configure(
if "input" in features_wanted:
sources += ["embed/trezorhal/stm32f4/button.c"]
features_available.append("button")
defines += ["USE_BUTTON=1"]
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 += [
@ -67,4 +69,6 @@ def configure(
]
features_available.append("usb")
defines += ["USE_PVD=1"]
return features_available

View File

@ -20,6 +20,7 @@ def configure(
if "new_rendering" in features_wanted:
defines += ["DISPLAY_RGB565"]
features_available.append("display_rgb565")
defines += ["USE_RGB_COLORS"]
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"{board}\\"']
@ -46,15 +47,19 @@ def configure(
"embed/extmod/modtrezorio/ff.c",
"embed/extmod/modtrezorio/ffunicode.c",
]
defines += ["USE_SD_CARD=1"]
if "sbu" in features_wanted:
sources += ["embed/trezorhal/unix/sbu.c"]
defines += ["USE_SBU=1"]
if "input" in features_wanted:
sources += ["embed/trezorhal/unix/touch.c"]
features_available.append("touch")
defines += ["USE_TOUCH=1"]
features_available.append("backlight")
defines += ["USE_BACKLIGHT=1"]
sources += ["embed/trezorhal/stm32f4/layout.c"]

View File

@ -21,6 +21,7 @@ def configure(
if "new_rendering" in features_wanted:
defines += ["DISPLAY_RGB565"]
features_available.append("display_rgb565")
defines += ["USE_RGB_COLORS=1"]
mcu = "STM32F427xx"
@ -79,11 +80,14 @@ def configure(
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"]
features_available.append("touch")
defines += ["USE_TOUCH=1"]
defines += ["USE_I2C=1"]
if "sd_card" in features_wanted:
sources += ["embed/trezorhal/stm32f4/sdcard.c"]
@ -93,10 +97,12 @@ def configure(
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c"
]
features_available.append("sd_card")
defines += ["USE_SD_CARD=1"]
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 += [
@ -123,4 +129,6 @@ def configure(
]
features_available.append("dma2d")
defines += ["USE_PVD=1"]
return features_available

View File

@ -32,17 +32,18 @@ def configure(
if "sbu" in features_wanted:
sources += ["embed/trezorhal/unix/sbu.c"]
if "optiga_hal" in features_wanted:
sources += ["embed/trezorhal/unix/optiga_hal.c"]
defines += ["USE_SBU=1"]
if "optiga" in features_wanted:
sources += ["embed/trezorhal/unix/optiga_hal.c"]
sources += ["embed/trezorhal/unix/optiga.c"]
features_available.append("optiga")
defines += ["USE_OPTIGA=1"]
if "input" in features_wanted:
sources += ["embed/trezorhal/unix/button.c"]
features_available.append("button")
defines += ["USE_BUTTON=1"]
sources += ["embed/trezorhal/stm32u5/layout.c"]

View File

@ -49,10 +49,12 @@ def configure(
if "input" in features_wanted:
sources += ["embed/trezorhal/stm32u5/button.c"]
features_available.append("button")
defines += ["USE_BUTTON=1"]
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 += [
@ -69,7 +71,6 @@ def configure(
features_available.append("usb")
if "optiga" in features_wanted:
defines += ["USE_OPTIGA=1"]
sources += ["embed/trezorhal/stm32u5/i2c_bus.c"]
sources += ["embed/trezorhal/stm32u5/optiga_hal.c"]
sources += ["embed/trezorhal/optiga/optiga.c"]
@ -77,10 +78,16 @@ def configure(
sources += ["embed/trezorhal/optiga/optiga_transport.c"]
sources += ["vendor/trezor-crypto/hash_to_curve.c"]
features_available.append("optiga")
defines += ["USE_OPTIGA=1"]
defines += ["USE_I2C=1"]
if "consumption_mask" in features_wanted:
sources += ["embed/trezorhal/stm32u5/consumption_mask.c"]
sources += ["vendor/stm32u5xx_hal_driver/Src/stm32u5xx_hal_tim.c"]
defines += ["USE_CONSUMPTION_MASK=1"]
defines += ["USE_HASH_PROCESSOR=1"]
defines += ["USE_PVD=1"]
env.get("ENV")["TREZOR_BOARD"] = board
env.get("ENV")["MCU_TYPE"] = mcu

View File

@ -21,6 +21,7 @@ def configure(
defines += ["XFRAMEBUFFER", "DISPLAY_RGB565"]
features_available.append("xframebuffer")
features_available.append("display_rgb565")
defines += ["USE_RGB_COLORS=1"]
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"{board}\\"']
@ -48,22 +49,25 @@ def configure(
"embed/extmod/modtrezorio/ff.c",
"embed/extmod/modtrezorio/ffunicode.c",
]
defines += ["USE_SD_CARD=1"]
if "sbu" in features_wanted:
sources += ["embed/trezorhal/unix/sbu.c"]
if "optiga_hal" in features_wanted:
sources += ["embed/trezorhal/unix/optiga_hal.c"]
defines += ["USE_SBU=1"]
if "optiga" in features_wanted:
sources += ["embed/trezorhal/unix/optiga_hal.c"]
sources += ["embed/trezorhal/unix/optiga.c"]
features_available.append("optiga")
defines += ["USE_OPTIGA=1"]
if "input" in features_wanted:
sources += ["embed/trezorhal/unix/touch.c"]
features_available.append("touch")
defines += ["USE_TOUCH=1"]
features_available.append("backlight")
defines += ["USE_BACKLIGHT=1"]
sources += ["embed/trezorhal/stm32u5/layout.c"]

View File

@ -25,6 +25,7 @@ def configure(
features_available.append("display_rgb565")
defines += ["DISPLAY_RGB565"]
defines += ["XFRAMEBUFFER"]
defines += ["USE_RGB_COLORS=1"]
mcu = "STM32U585xx"
linker_script = """embed/trezorhal/stm32u5/linker/u58/{target}.ld"""
@ -60,18 +61,20 @@ def configure(
]
sources += ["embed/trezorhal/stm32u5/backlight_pwm.c"]
features_available.append("backlight")
defines += ["USE_BACKLIGHT=1"]
env_constraints = env.get("CONSTRAINTS")
if not (env_constraints and "limited_util_s" in env_constraints):
sources += ["embed/trezorhal/stm32u5/bg_copy.c"]
features_available.append("backlight")
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/lx154a2422cpt23.c"]
features_available.append("touch")
defines += ["USE_TOUCH=1"]
defines += ["USE_I2C=1"]
if "haptic" in features_wanted:
sources += [
@ -82,18 +85,21 @@ def configure(
"vendor/stm32u5xx_hal_driver/Src/stm32u5xx_hal_tim_ex.c",
]
features_available.append("haptic")
defines += ["USE_HAPTIC=1"]
if "sd_card" in features_wanted:
sources += ["embed/trezorhal/stm32u5/sdcard.c"]
sources += ["embed/extmod/modtrezorio/ff.c"]
sources += ["embed/extmod/modtrezorio/ffunicode.c"]
features_available.append("sd_card")
sources += ["vendor/stm32u5xx_hal_driver/Src/stm32u5xx_hal_sd.c"]
sources += ["vendor/stm32u5xx_hal_driver/Src/stm32u5xx_ll_sdmmc.c"]
features_available.append("sd_card")
defines += ["USE_SD_CARD=1"]
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 += [
@ -118,13 +124,16 @@ def configure(
features_available.append("dma2d")
if "optiga" in features_wanted:
defines += ["USE_OPTIGA=1"]
sources += ["embed/trezorhal/stm32u5/optiga_hal.c"]
sources += ["embed/trezorhal/optiga/optiga.c"]
sources += ["embed/trezorhal/optiga/optiga_commands.c"]
sources += ["embed/trezorhal/optiga/optiga_transport.c"]
sources += ["vendor/trezor-crypto/hash_to_curve.c"]
features_available.append("optiga")
defines += ["USE_OPTIGA=1"]
defines += ["USE_HASH_PROCESSOR=1"]
defines += ["USE_PVD=1"]
env.get("ENV")["TREZOR_BOARD"] = board
env.get("ENV")["MCU_TYPE"] = mcu

View File

@ -25,6 +25,7 @@ def configure(
features_available.append("display_rgb565")
defines += ["DISPLAY_RGB565"]
defines += ["XFRAMEBUFFER"]
defines += ["USE_RGB_COLORS=1"]
mcu = "STM32U585xx"
linker_script = """embed/trezorhal/stm32u5/linker/u58/{target}.ld"""
@ -43,9 +44,6 @@ def configure(
defines += [f'TREZOR_BOARD=\\"{board}\\"']
defines += [f"HW_MODEL={hw_model}"]
defines += [f"HW_REVISION={hw_revision}"]
sources += [
f"embed/trezorhal/stm32u5/displays/{display}",
]
if "new_rendering" in features_wanted:
sources += ["embed/trezorhal/xdisplay_legacy.c"]
@ -56,7 +54,6 @@ def configure(
sources += [
"embed/trezorhal/stm32u5/xdisplay/st-7789/panels/lx154a2482.c",
]
else:
sources += [f"embed/trezorhal/stm32u5/displays/{display}"]
sources += [
@ -64,17 +61,20 @@ def configure(
]
sources += ["embed/trezorhal/stm32u5/backlight_pwm.c"]
features_available.append("backlight")
defines += ["USE_BACKLIGHT=1"]
env_constraints = env.get("CONSTRAINTS")
if not (env_constraints and "limited_util_s" in env_constraints):
sources += ["embed/trezorhal/stm32u5/bg_copy.c"]
features_available.append("backlight")
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/lx154a2422cpt23.c"]
features_available.append("touch")
defines += ["USE_TOUCH=1"]
defines += ["USE_I2C=1"]
if "haptic" in features_wanted:
sources += [
@ -85,18 +85,21 @@ def configure(
"vendor/stm32u5xx_hal_driver/Src/stm32u5xx_hal_tim_ex.c",
]
features_available.append("haptic")
defines += ["USE_HAPTIC=1"]
if "sd_card" in features_wanted:
sources += ["embed/trezorhal/stm32u5/sdcard.c"]
sources += ["embed/extmod/modtrezorio/ff.c"]
sources += ["embed/extmod/modtrezorio/ffunicode.c"]
features_available.append("sd_card")
sources += ["vendor/stm32u5xx_hal_driver/Src/stm32u5xx_hal_sd.c"]
sources += ["vendor/stm32u5xx_hal_driver/Src/stm32u5xx_ll_sdmmc.c"]
features_available.append("sd_card")
defines += ["USE_SD_CARD=1"]
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 += [
@ -121,14 +124,19 @@ def configure(
features_available.append("dma2d")
if "optiga" in features_wanted:
defines += ["USE_OPTIGA=1"]
sources += ["embed/trezorhal/stm32u5/optiga_hal.c"]
sources += ["embed/trezorhal/optiga/optiga.c"]
sources += ["embed/trezorhal/optiga/optiga_commands.c"]
sources += ["embed/trezorhal/optiga/optiga_transport.c"]
sources += ["vendor/trezor-crypto/hash_to_curve.c"]
features_available.append("optiga")
defines += ["USE_OPTIGA=1"]
defines += ["USE_HASH_PROCESSOR=1"]
defines += ["USE_PVD=1"]
env.get("ENV")["TREZOR_BOARD"] = board
env.get("ENV")["MCU_TYPE"] = mcu
env.get("ENV")["LINKER_SCRIPT"] = linker_script
defs = env.get("CPPDEFINES_IMPLICIT")

View File

@ -21,6 +21,7 @@ def configure(
features_available.append("xframebuffer")
features_available.append("display_rgba8888")
features_available.append("ui_color_32bit")
defines += ["USE_RGB_COLORS=1"]
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"{board}\\"']
@ -43,19 +44,21 @@ def configure(
if "sbu" in features_wanted:
sources += ["embed/trezorhal/unix/sbu.c"]
if "optiga_hal" in features_wanted:
sources += ["embed/trezorhal/unix/optiga_hal.c"]
defines += ["USE_SBU=1"]
if "optiga" in features_wanted:
sources += ["embed/trezorhal/unix/optiga_hal.c"]
sources += ["embed/trezorhal/unix/optiga.c"]
features_available.append("optiga")
defines += ["USE_OPTIGA=1"]
if "input" in features_wanted:
sources += ["embed/trezorhal/unix/touch.c"]
features_available.append("touch")
defines += ["USE_TOUCH=1"]
features_available.append("backlight")
defines += ["USE_BACKLIGHT=1"]
sources += ["embed/trezorhal/stm32f4/layout.c"]

View File

@ -19,6 +19,7 @@ def configure(
defines += ["DISPLAY_RGB565"]
features_available.append("display_rgb565")
defines += ["USE_RGB_COLORS=1"]
mcu = "STM32F427xx"
@ -47,8 +48,8 @@ def configure(
]
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"]
@ -57,12 +58,16 @@ def configure(
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"]
@ -74,6 +79,7 @@ def configure(
# "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 += [
@ -83,6 +89,7 @@ def configure(
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 += [