From 42396dd0074b2ef9d22162390e588f174ebbe82d Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Tue, 29 Oct 2024 10:14:43 +0100 Subject: [PATCH] refactor(core): make USE_xxx defines global [no changelog] --- core/SConscript.bootloader_emu | 3 ++- .../models/D001/boards/stm32f429i-disc1.h | 6 ----- core/embed/models/D002/boards/stm32u5a9j-dk.h | 7 ------ core/embed/models/T2B1/boards/t2b1-unix.h | 4 ---- core/embed/models/T2B1/boards/trezor_r_v10.h | 6 ----- core/embed/models/T2B1/boards/trezor_r_v3.h | 4 ---- core/embed/models/T2B1/boards/trezor_r_v4.h | 4 ---- core/embed/models/T2B1/boards/trezor_r_v6.h | 4 ---- core/embed/models/T2T1/boards/t2t1-unix.h | 6 ----- core/embed/models/T2T1/boards/trezor_t.h | 10 +------- core/embed/models/T3B1/boards/t3b1-unix.h | 4 ---- .../models/T3B1/boards/trezor_t3b1_revB.h | 7 ------ core/embed/models/T3T1/boards/t3t1-unix.h | 7 ------ .../models/T3T1/boards/trezor_t3t1_revE.h | 12 +--------- .../embed/models/T3T1/boards/trezor_t3t1_v4.h | 12 +--------- core/embed/models/T3W1/boards/t3w1-unix.h | 6 ----- .../embed/models/T3W1/boards/trezor_t3w1_d1.h | 11 +-------- .../trezorhal/stm32f4/displays/st7789v.c | 10 ++++---- .../trezorhal/stm32f4/displays/st7789v.h | 8 +++---- .../stm32f4/xdisplay/st-7789/display_io.c | 6 ++--- .../stm32f4/xdisplay/st-7789/display_io.h | 8 +++---- core/site_scons/models/D001/discovery.py | 9 ++++++- core/site_scons/models/D002/discovery2.py | 24 +++++++++---------- core/site_scons/models/T2B1/emulator.py | 7 +++--- core/site_scons/models/T2B1/trezor_r_v10.py | 9 ++++++- core/site_scons/models/T2B1/trezor_r_v3.py | 4 ++++ core/site_scons/models/T2B1/trezor_r_v4.py | 4 ++++ core/site_scons/models/T2B1/trezor_r_v6.py | 4 ++++ core/site_scons/models/T2T1/emulator.py | 5 ++++ core/site_scons/models/T2T1/trezor_t.py | 8 +++++++ core/site_scons/models/T3B1/emulator.py | 7 +++--- .../models/T3B1/trezor_t3b1_revB.py | 9 ++++++- core/site_scons/models/T3T1/emulator.py | 10 +++++--- .../models/T3T1/trezor_t3t1_revE.py | 17 +++++++++---- core/site_scons/models/T3T1/trezor_t3t1_v4.py | 24 ++++++++++++------- core/site_scons/models/T3W1/emulator.py | 9 ++++--- core/site_scons/models/T3W1/trezor_t3w1_d1.py | 9 ++++++- 37 files changed, 140 insertions(+), 164 deletions(-) diff --git a/core/SConscript.bootloader_emu b/core/SConscript.bootloader_emu index 509baf204c..f651eefdba 100644 --- a/core/SConscript.bootloader_emu +++ b/core/SConscript.bootloader_emu @@ -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 diff --git a/core/embed/models/D001/boards/stm32f429i-disc1.h b/core/embed/models/D001/boards/stm32f429i-disc1.h index 30620b3697..be2d02e849 100644 --- a/core/embed/models/D001/boards/stm32f429i-disc1.h +++ b/core/embed/models/D001/boards/stm32f429i-disc1.h @@ -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 diff --git a/core/embed/models/D002/boards/stm32u5a9j-dk.h b/core/embed/models/D002/boards/stm32u5a9j-dk.h index 059fac72b0..fe25056fff 100644 --- a/core/embed/models/D002/boards/stm32u5a9j-dk.h +++ b/core/embed/models/D002/boards/stm32u5a9j-dk.h @@ -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 diff --git a/core/embed/models/T2B1/boards/t2b1-unix.h b/core/embed/models/T2B1/boards/t2b1-unix.h index c1ae569781..e4bdfdfbd7 100644 --- a/core/embed/models/T2B1/boards/t2b1-unix.h +++ b/core/embed/models/T2B1/boards/t2b1-unix.h @@ -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 diff --git a/core/embed/models/T2B1/boards/trezor_r_v10.h b/core/embed/models/T2B1/boards/trezor_r_v10.h index 9dae64582d..3dbe4c42e8 100644 --- a/core/embed/models/T2B1/boards/trezor_r_v10.h +++ b/core/embed/models/T2B1/boards/trezor_r_v10.h @@ -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" diff --git a/core/embed/models/T2B1/boards/trezor_r_v3.h b/core/embed/models/T2B1/boards/trezor_r_v3.h index d8cfb1ee5a..47d350338f 100644 --- a/core/embed/models/T2B1/boards/trezor_r_v3.h +++ b/core/embed/models/T2B1/boards/trezor_r_v3.h @@ -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" diff --git a/core/embed/models/T2B1/boards/trezor_r_v4.h b/core/embed/models/T2B1/boards/trezor_r_v4.h index ac7ba7ca95..f2646ef2ac 100644 --- a/core/embed/models/T2B1/boards/trezor_r_v4.h +++ b/core/embed/models/T2B1/boards/trezor_r_v4.h @@ -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" diff --git a/core/embed/models/T2B1/boards/trezor_r_v6.h b/core/embed/models/T2B1/boards/trezor_r_v6.h index 561df4d297..00e561659e 100644 --- a/core/embed/models/T2B1/boards/trezor_r_v6.h +++ b/core/embed/models/T2B1/boards/trezor_r_v6.h @@ -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" diff --git a/core/embed/models/T2T1/boards/t2t1-unix.h b/core/embed/models/T2T1/boards/t2t1-unix.h index 6cc10c6713..a239e372b9 100644 --- a/core/embed/models/T2T1/boards/t2t1-unix.h +++ b/core/embed/models/T2T1/boards/t2t1-unix.h @@ -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 diff --git a/core/embed/models/T2T1/boards/trezor_t.h b/core/embed/models/T2T1/boards/trezor_t.h index 42f5a91370..c04da4860e 100644 --- a/core/embed/models/T2T1/boards/trezor_t.h +++ b/core/embed/models/T2T1/boards/trezor_t.h @@ -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 diff --git a/core/embed/models/T3B1/boards/t3b1-unix.h b/core/embed/models/T3B1/boards/t3b1-unix.h index ee0871d40c..103c4e5b92 100644 --- a/core/embed/models/T3B1/boards/t3b1-unix.h +++ b/core/embed/models/T3B1/boards/t3b1-unix.h @@ -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 diff --git a/core/embed/models/T3B1/boards/trezor_t3b1_revB.h b/core/embed/models/T3B1/boards/trezor_t3b1_revB.h index 6949dcb005..dcfb2313ae 100644 --- a/core/embed/models/T3B1/boards/trezor_t3b1_revB.h +++ b/core/embed/models/T3B1/boards/trezor_t3b1_revB.h @@ -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 diff --git a/core/embed/models/T3T1/boards/t3t1-unix.h b/core/embed/models/T3T1/boards/t3t1-unix.h index 26be4fec37..4fbca63fae 100644 --- a/core/embed/models/T3T1/boards/t3t1-unix.h +++ b/core/embed/models/T3T1/boards/t3t1-unix.h @@ -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 diff --git a/core/embed/models/T3T1/boards/trezor_t3t1_revE.h b/core/embed/models/T3T1/boards/trezor_t3t1_revE.h index 6bd33e03f1..8a4c0761ea 100644 --- a/core/embed/models/T3T1/boards/trezor_t3t1_revE.h +++ b/core/embed/models/T3T1/boards/trezor_t3t1_revE.h @@ -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 diff --git a/core/embed/models/T3T1/boards/trezor_t3t1_v4.h b/core/embed/models/T3T1/boards/trezor_t3t1_v4.h index b3a570d850..20247814ed 100644 --- a/core/embed/models/T3T1/boards/trezor_t3t1_v4.h +++ b/core/embed/models/T3T1/boards/trezor_t3t1_v4.h @@ -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 diff --git a/core/embed/models/T3W1/boards/t3w1-unix.h b/core/embed/models/T3W1/boards/t3w1-unix.h index 4ba457ffaf..5dcb0ac598 100644 --- a/core/embed/models/T3W1/boards/t3w1-unix.h +++ b/core/embed/models/T3W1/boards/t3w1-unix.h @@ -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 diff --git a/core/embed/models/T3W1/boards/trezor_t3w1_d1.h b/core/embed/models/T3W1/boards/trezor_t3w1_d1.h index 6bfc122b75..242f0eb8ae 100644 --- a/core/embed/models/T3W1/boards/trezor_t3w1_d1.h +++ b/core/embed/models/T3W1/boards/trezor_t3w1_d1.h @@ -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 diff --git a/core/embed/trezorhal/stm32f4/displays/st7789v.c b/core/embed/trezorhal/stm32f4/displays/st7789v.c index 9d9bce4ed9..5e27ea1c8f 100644 --- a/core/embed/trezorhal/stm32f4/displays/st7789v.c +++ b/core/embed/trezorhal/stm32f4/displays/st7789v.c @@ -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; diff --git a/core/embed/trezorhal/stm32f4/displays/st7789v.h b/core/embed/trezorhal/stm32f4/displays/st7789v.h index 4f8a816ffd..3a9740092b 100644 --- a/core/embed/trezorhal/stm32f4/displays/st7789v.h +++ b/core/embed/trezorhal/stm32f4/displays/st7789v.h @@ -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) diff --git a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.c b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.c index 5f237af58d..f9f5ad1bd8 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.c @@ -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 = diff --git a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.h b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.h index 0113ba1e61..634651fe2c 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.h +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.h @@ -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) diff --git a/core/site_scons/models/D001/discovery.py b/core/site_scons/models/D001/discovery.py index a943539086..581f0dbbff 100644 --- a/core/site_scons/models/D001/discovery.py +++ b/core/site_scons/models/D001/discovery.py @@ -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 diff --git a/core/site_scons/models/D002/discovery2.py b/core/site_scons/models/D002/discovery2.py index 8ca76fb7bb..ea9f6116c7 100644 --- a/core/site_scons/models/D002/discovery2.py +++ b/core/site_scons/models/D002/discovery2.py @@ -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") diff --git a/core/site_scons/models/T2B1/emulator.py b/core/site_scons/models/T2B1/emulator.py index 16a6137d69..d2feaa2711 100644 --- a/core/site_scons/models/T2B1/emulator.py +++ b/core/site_scons/models/T2B1/emulator.py @@ -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"] diff --git a/core/site_scons/models/T2B1/trezor_r_v10.py b/core/site_scons/models/T2B1/trezor_r_v10.py index 2289d8fa46..398bea69fa 100644 --- a/core/site_scons/models/T2B1/trezor_r_v10.py +++ b/core/site_scons/models/T2B1/trezor_r_v10.py @@ -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 diff --git a/core/site_scons/models/T2B1/trezor_r_v3.py b/core/site_scons/models/T2B1/trezor_r_v3.py index c72a596f3d..5520232ee0 100644 --- a/core/site_scons/models/T2B1/trezor_r_v3.py +++ b/core/site_scons/models/T2B1/trezor_r_v3.py @@ -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 diff --git a/core/site_scons/models/T2B1/trezor_r_v4.py b/core/site_scons/models/T2B1/trezor_r_v4.py index c578517c4a..d785c03ad5 100644 --- a/core/site_scons/models/T2B1/trezor_r_v4.py +++ b/core/site_scons/models/T2B1/trezor_r_v4.py @@ -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 diff --git a/core/site_scons/models/T2B1/trezor_r_v6.py b/core/site_scons/models/T2B1/trezor_r_v6.py index 6062ab7dc0..c7e1476bf1 100644 --- a/core/site_scons/models/T2B1/trezor_r_v6.py +++ b/core/site_scons/models/T2B1/trezor_r_v6.py @@ -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 diff --git a/core/site_scons/models/T2T1/emulator.py b/core/site_scons/models/T2T1/emulator.py index 9d10e1c6b7..9b67ea2f5e 100644 --- a/core/site_scons/models/T2T1/emulator.py +++ b/core/site_scons/models/T2T1/emulator.py @@ -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"] diff --git a/core/site_scons/models/T2T1/trezor_t.py b/core/site_scons/models/T2T1/trezor_t.py index b428bd05db..68b6b8e113 100644 --- a/core/site_scons/models/T2T1/trezor_t.py +++ b/core/site_scons/models/T2T1/trezor_t.py @@ -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 diff --git a/core/site_scons/models/T3B1/emulator.py b/core/site_scons/models/T3B1/emulator.py index 493c3353d5..9fa9c4fe5d 100644 --- a/core/site_scons/models/T3B1/emulator.py +++ b/core/site_scons/models/T3B1/emulator.py @@ -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"] diff --git a/core/site_scons/models/T3B1/trezor_t3b1_revB.py b/core/site_scons/models/T3B1/trezor_t3b1_revB.py index 3c5a5973b5..5ddb81ccc5 100644 --- a/core/site_scons/models/T3B1/trezor_t3b1_revB.py +++ b/core/site_scons/models/T3B1/trezor_t3b1_revB.py @@ -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 diff --git a/core/site_scons/models/T3T1/emulator.py b/core/site_scons/models/T3T1/emulator.py index 972dd0fb63..38a2a1277e 100644 --- a/core/site_scons/models/T3T1/emulator.py +++ b/core/site_scons/models/T3T1/emulator.py @@ -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"] diff --git a/core/site_scons/models/T3T1/trezor_t3t1_revE.py b/core/site_scons/models/T3T1/trezor_t3t1_revE.py index 412c8f77ad..803a11c71b 100644 --- a/core/site_scons/models/T3T1/trezor_t3t1_revE.py +++ b/core/site_scons/models/T3T1/trezor_t3t1_revE.py @@ -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 diff --git a/core/site_scons/models/T3T1/trezor_t3t1_v4.py b/core/site_scons/models/T3T1/trezor_t3t1_v4.py index c6b712bb6b..952d4c1fc3 100644 --- a/core/site_scons/models/T3T1/trezor_t3t1_v4.py +++ b/core/site_scons/models/T3T1/trezor_t3t1_v4.py @@ -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") diff --git a/core/site_scons/models/T3W1/emulator.py b/core/site_scons/models/T3W1/emulator.py index a5ef2c9424..e6ec19fff4 100644 --- a/core/site_scons/models/T3W1/emulator.py +++ b/core/site_scons/models/T3W1/emulator.py @@ -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"] diff --git a/core/site_scons/models/T3W1/trezor_t3w1_d1.py b/core/site_scons/models/T3W1/trezor_t3w1_d1.py index a371e3e989..ff765f6db4 100644 --- a/core/site_scons/models/T3W1/trezor_t3w1_d1.py +++ b/core/site_scons/models/T3W1/trezor_t3w1_d1.py @@ -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 += [