From 7912a7d0d35e1d90854aafec0ac7fb10e1aa3016 Mon Sep 17 00:00:00 2001 From: TychoVrahe <37884576+TychoVrahe@users.noreply.github.com> Date: Tue, 26 Apr 2022 13:47:40 +0200 Subject: [PATCH] build(core,storage): fix conditional compilation for different Trezor models * build(core,storage) - Fix conditional compilation for different trezor models * build(core) - Rename MODEL_* macro to TREZOR_MODEL_*, remove the original TREZOR_MODEL macro (replaced by conditional compilation for QSTR generation) * build(core) - fixed missing TREZOR_MODEL to TREZOR_MODEL_x changes [no changelog] --- core/SConscript.boardloader | 2 +- core/SConscript.bootloader | 2 +- core/SConscript.bootloader_ci | 2 +- core/SConscript.firmware | 2 +- core/SConscript.prodtest | 2 +- core/SConscript.reflash | 2 +- core/SConscript.unix | 2 +- .../extmod/modtrezorconfig/norcow_config.h | 4 ++-- .../extmod/modtrezorio/modtrezorio-poll.h | 4 ++-- core/embed/extmod/modtrezorio/modtrezorio.c | 6 ++--- core/embed/extmod/modtrezorui/display-unix.h | 10 ++++----- core/embed/extmod/modtrezorui/display.c | 22 +++++++++---------- core/embed/extmod/modtrezorui/display.h | 4 ++-- .../extmod/modtrezorutils/modtrezorutils.c | 11 ++++++---- core/embed/firmware/header.S | 4 ++-- core/embed/firmware/main.c | 8 +++---- core/embed/firmware/startup.S | 6 ++--- core/embed/trezorhal/flash.c | 4 ++-- core/embed/trezorhal/flash.h | 8 +++---- core/embed/unix/flash.c | 4 ++-- core/embed/unix/touch.c | 4 ++-- storage/tests/c/norcow_config.h | 4 ++-- 22 files changed, 60 insertions(+), 57 deletions(-) diff --git a/core/SConscript.boardloader b/core/SConscript.boardloader index a5c5b5fa4..a6ea8b691 100644 --- a/core/SConscript.boardloader +++ b/core/SConscript.boardloader @@ -130,7 +130,7 @@ env.Replace( 'vendor/micropython/lib/cmsis/inc', ] + CPPPATH_MOD, CPPDEFINES=[ - ('TREZOR_MODEL', '$TREZOR_MODEL'), + 'TREZOR_MODEL_'+TREZOR_MODEL, CPU_MODEL, 'USE_HAL_DRIVER', ('STM32_HAL_H', '""'), diff --git a/core/SConscript.bootloader b/core/SConscript.bootloader index 317b467dc..ce981550c 100644 --- a/core/SConscript.bootloader +++ b/core/SConscript.bootloader @@ -158,7 +158,7 @@ env.Replace( 'vendor/nanopb', ] + CPPPATH_MOD, CPPDEFINES=[ - ('TREZOR_MODEL', '$TREZOR_MODEL'), + 'TREZOR_MODEL_'+TREZOR_MODEL, CPU_MODEL, 'USE_HAL_DRIVER', ('STM32_HAL_H', '""'), diff --git a/core/SConscript.bootloader_ci b/core/SConscript.bootloader_ci index cb947fc81..27096570b 100644 --- a/core/SConscript.bootloader_ci +++ b/core/SConscript.bootloader_ci @@ -158,7 +158,7 @@ env.Replace( 'vendor/nanopb', ] + CPPPATH_MOD, CPPDEFINES=[ - ('TREZOR_MODEL', '$TREZOR_MODEL'), + 'TREZOR_MODEL_'+TREZOR_MODEL, CPU_MODEL, 'USE_HAL_DRIVER', ('STM32_HAL_H', '""'), diff --git a/core/SConscript.firmware b/core/SConscript.firmware index abe70463f..b3b0e1bae 100644 --- a/core/SConscript.firmware +++ b/core/SConscript.firmware @@ -471,7 +471,7 @@ env.Replace( 'vendor/micropython/lib/cmsis/inc', ] + CPPPATH_MOD, CPPDEFINES=[ - ('TREZOR_MODEL', '$TREZOR_MODEL'), + 'TREZOR_MODEL_'+TREZOR_MODEL, CPU_MODEL, 'USE_HAL_DRIVER', ('STM32_HAL_H', '""'), diff --git a/core/SConscript.prodtest b/core/SConscript.prodtest index eefeb884f..3b7560285 100644 --- a/core/SConscript.prodtest +++ b/core/SConscript.prodtest @@ -133,7 +133,7 @@ env.Replace( 'vendor/micropython/lib/cmsis/inc', ] + CPPPATH_MOD, CPPDEFINES=[ - ('TREZOR_MODEL', '$TREZOR_MODEL'), + 'TREZOR_MODEL_'+TREZOR_MODEL, CPU_MODEL, 'USE_HAL_DRIVER', ('STM32_HAL_H', '""'), diff --git a/core/SConscript.reflash b/core/SConscript.reflash index f322265b4..404c34c94 100644 --- a/core/SConscript.reflash +++ b/core/SConscript.reflash @@ -127,7 +127,7 @@ env.Replace( 'vendor/micropython/lib/cmsis/inc', ] + CPPPATH_MOD, CPPDEFINES=[ - ('TREZOR_MODEL', '$TREZOR_MODEL'), + 'TREZOR_MODEL_'+TREZOR_MODEL, CPU_MODEL, 'USE_HAL_DRIVER', ('STM32_HAL_H', '""'), diff --git a/core/SConscript.unix b/core/SConscript.unix index 5b8d19b4e..18c921f0e 100644 --- a/core/SConscript.unix +++ b/core/SConscript.unix @@ -431,7 +431,7 @@ env.Replace( ] + CPPPATH_MOD, CPPDEFINES=[ 'TREZOR_EMULATOR', - ('TREZOR_MODEL', '$TREZOR_MODEL'), + 'TREZOR_MODEL_'+TREZOR_MODEL, ('MP_CONFIGFILE', '\\"embed/unix/mpconfigport.h\\"'), ] + CPPDEFINES_MOD, ASPPFLAGS='$CFLAGS $CCFLAGS', ) diff --git a/core/embed/extmod/modtrezorconfig/norcow_config.h b/core/embed/extmod/modtrezorconfig/norcow_config.h index 422a81d09..3e802dec7 100644 --- a/core/embed/extmod/modtrezorconfig/norcow_config.h +++ b/core/embed/extmod/modtrezorconfig/norcow_config.h @@ -25,9 +25,9 @@ #define NORCOW_HEADER_LEN 0 #define NORCOW_SECTOR_COUNT 2 -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T #define NORCOW_SECTOR_SIZE (64 * 1024) -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 #define NORCOW_SECTOR_SIZE (16 * 1024) #else #error Unknown Trezor model diff --git a/core/embed/extmod/modtrezorio/modtrezorio-poll.h b/core/embed/extmod/modtrezorio/modtrezorio-poll.h index 5fa1508f5..403492201 100644 --- a/core/embed/extmod/modtrezorio/modtrezorio-poll.h +++ b/core/embed/extmod/modtrezorio/modtrezorio-poll.h @@ -74,7 +74,7 @@ STATIC mp_obj_t mod_trezorio_poll(mp_obj_t ifaces, mp_obj_t list_ref, if (false) { } -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T else if (iface == TOUCH_IFACE) { const uint32_t evt = touch_read(); if (evt) { @@ -110,7 +110,7 @@ STATIC mp_obj_t mod_trezorio_poll(mp_obj_t ifaces, mp_obj_t list_ref, return mp_const_true; } } -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 else if (iface == BUTTON_IFACE) { const uint32_t evt = button_read(); if (evt & (BTN_EVT_DOWN | BTN_EVT_UP)) { diff --git a/core/embed/extmod/modtrezorio/modtrezorio.c b/core/embed/extmod/modtrezorio/modtrezorio.c index 70b96ad41..a9933f085 100644 --- a/core/embed/extmod/modtrezorio/modtrezorio.c +++ b/core/embed/extmod/modtrezorio/modtrezorio.c @@ -44,7 +44,7 @@ #include "modtrezorio-webusb.h" #include "modtrezorio-usb.h" // clang-format on -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T #include "modtrezorio-fatfs.h" #include "modtrezorio-sbu.h" #include "modtrezorio-sdcard.h" @@ -72,7 +72,7 @@ STATIC const mp_rom_map_elem_t mp_module_trezorio_globals_table[] = { {MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezorio)}, -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T {MP_ROM_QSTR(MP_QSTR_fatfs), MP_ROM_PTR(&mod_trezorio_fatfs_module)}, {MP_ROM_QSTR(MP_QSTR_SBU), MP_ROM_PTR(&mod_trezorio_SBU_type)}, {MP_ROM_QSTR(MP_QSTR_sdcard), MP_ROM_PTR(&mod_trezorio_sdcard_module)}, @@ -81,7 +81,7 @@ STATIC const mp_rom_map_elem_t mp_module_trezorio_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_TOUCH_START), MP_ROM_INT((TOUCH_START >> 24) & 0xFFU)}, {MP_ROM_QSTR(MP_QSTR_TOUCH_MOVE), MP_ROM_INT((TOUCH_MOVE >> 24) & 0xFFU)}, {MP_ROM_QSTR(MP_QSTR_TOUCH_END), MP_ROM_INT((TOUCH_END >> 24) & 0xFFU)}, -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 {MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_INT(BUTTON_IFACE)}, {MP_ROM_QSTR(MP_QSTR_BUTTON_PRESSED), MP_ROM_INT((BTN_EVT_DOWN >> 24) & 0x3U)}, diff --git a/core/embed/extmod/modtrezorui/display-unix.h b/core/embed/extmod/modtrezorui/display-unix.h index 0a454f7ff..dce5682be 100644 --- a/core/embed/extmod/modtrezorui/display-unix.h +++ b/core/embed/extmod/modtrezorui/display-unix.h @@ -25,7 +25,7 @@ #define EMULATOR_BORDER 16 -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T #ifdef TREZOR_EMULATOR_RASPI #define WINDOW_WIDTH 480 @@ -39,7 +39,7 @@ #define TOUCH_OFFSET_Y 110 #endif -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 #define WINDOW_WIDTH 200 #define WINDOW_HEIGHT 340 @@ -76,7 +76,7 @@ static struct { #define PIXELDATA_DIRTY() void PIXELDATA(uint16_t c) { -#if TREZOR_MODEL == 1 +#if defined TREZOR_MODEL_1 // set to white if highest bits of all R, G, B values are set to 1 // bin(10000 100000 10000) = hex(0x8410) // otherwise set to black @@ -173,11 +173,11 @@ void display_init(void) { RENDERER, SDL_RWFromMem(background_raspi_jpg, background_raspi_jpg_len), 0); #else -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T #include "background_T.h" BACKGROUND = IMG_LoadTexture_RW( RENDERER, SDL_RWFromMem(background_T_jpg, background_T_jpg_len), 0); -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 #include "background_1.h" BACKGROUND = IMG_LoadTexture_RW( RENDERER, SDL_RWFromMem(background_1_jpg, background_1_jpg_len), 0); diff --git a/core/embed/extmod/modtrezorui/display.c b/core/embed/extmod/modtrezorui/display.c index 3abe5a1f2..42dcf05d8 100644 --- a/core/embed/extmod/modtrezorui/display.c +++ b/core/embed/extmod/modtrezorui/display.c @@ -28,7 +28,7 @@ #include "font_bitmap.h" -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T // TT new rust UI #if TREZOR_UI2 @@ -75,7 +75,7 @@ #endif -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 #ifdef TREZOR_FONT_NORMAL_ENABLE #include "font_pixeloperator_regular_8.h" @@ -115,9 +115,9 @@ static struct { int x, y; } DISPLAY_OFFSET; #ifdef TREZOR_EMULATOR #include "display-unix.h" #else -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T #include "display-stm32_T.h" -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 #include "display-stm32_1.h" #else #error Unknown Trezor model @@ -261,7 +261,7 @@ static void uzlib_prepare(struct uzlib_uncomp *decomp, uint8_t *window, void display_image(int x, int y, int w, int h, const void *data, uint32_t datalen) { -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T x += DISPLAY_OFFSET.x; y += DISPLAY_OFFSET.y; int x0 = 0, y0 = 0, x1 = 0, y1 = 0; @@ -302,7 +302,7 @@ void display_image(int x, int y, int w, int h, const void *data, void display_avatar(int x, int y, const void *data, uint32_t datalen, uint16_t fgcolor, uint16_t bgcolor) { -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T x += DISPLAY_OFFSET.x; y += DISPLAY_OFFSET.y; int x0 = 0, y0 = 0, x1 = 0, y1 = 0; @@ -426,14 +426,14 @@ bool display_toif_info(const uint8_t *data, uint32_t len, uint16_t *out_w, return true; } -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T #include "loader.h" #endif void display_loader(uint16_t progress, bool indeterminate, int yoffset, uint16_t fgcolor, uint16_t bgcolor, const uint8_t *icon, uint32_t iconlen, uint16_t iconfgcolor) { -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T uint16_t colortable[16] = {0}, iconcolortable[16] = {0}; set_color_table(colortable, fgcolor, bgcolor); if (icon) { @@ -915,9 +915,9 @@ void display_offset(int set_xy[2], int *get_x, int *get_y) { int display_orientation(int degrees) { if (degrees != DISPLAY_ORIENTATION) { -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T if (degrees == 0 || degrees == 90 || degrees == 180 || degrees == 270) { -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 if (degrees == 0 || degrees == 180) { #else #error Unknown Trezor model @@ -930,7 +930,7 @@ int display_orientation(int degrees) { } int display_backlight(int val) { -#if TREZOR_MODEL == 1 +#if defined TREZOR_MODEL_1 val = 255; #endif if (DISPLAY_BACKLIGHT != val && val >= 0 && val <= 255) { diff --git a/core/embed/extmod/modtrezorui/display.h b/core/embed/extmod/modtrezorui/display.h index 3cb1096b4..cdbca62ea 100644 --- a/core/embed/extmod/modtrezorui/display.h +++ b/core/embed/extmod/modtrezorui/display.h @@ -23,7 +23,7 @@ #include #include -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T // ILI9341V, GC9307 and ST7789V drivers support 240px x 320px display resolution #define MAX_DISPLAY_RESX 240 @@ -32,7 +32,7 @@ #define DISPLAY_RESY 240 #define TREZOR_FONT_BPP 4 -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 #define MAX_DISPLAY_RESX 128 #define MAX_DISPLAY_RESY 64 diff --git a/core/embed/extmod/modtrezorutils/modtrezorutils.c b/core/embed/extmod/modtrezorutils/modtrezorutils.c index 5c456fc9c..1dd73c859 100644 --- a/core/embed/extmod/modtrezorutils/modtrezorutils.c +++ b/core/embed/extmod/modtrezorutils/modtrezorutils.c @@ -120,9 +120,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_trezorutils_halt_obj, 0, 1, STATIC mp_obj_str_t mod_trezorutils_revision_obj = { {&mp_type_bytes}, 0, sizeof(SCM_REVISION) - 1, (const byte *)SCM_REVISION}; -#define PASTER(s) MP_QSTR_##s -#define MP_QSTR(s) PASTER(s) - /// SCM_REVISION: bytes /// VERSION_MAJOR: int /// VERSION_MINOR: int @@ -142,7 +139,13 @@ STATIC const mp_rom_map_elem_t mp_module_trezorutils_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_VERSION_MAJOR), MP_ROM_INT(VERSION_MAJOR)}, {MP_ROM_QSTR(MP_QSTR_VERSION_MINOR), MP_ROM_INT(VERSION_MINOR)}, {MP_ROM_QSTR(MP_QSTR_VERSION_PATCH), MP_ROM_INT(VERSION_PATCH)}, - {MP_ROM_QSTR(MP_QSTR_MODEL), MP_ROM_QSTR(MP_QSTR(TREZOR_MODEL))}, +#if defined TREZOR_MODEL_1 + {MP_ROM_QSTR(MP_QSTR_MODEL), MP_ROM_QSTR(MP_QSTR_1)}, +#elif defined TREZOR_MODEL_T + {MP_ROM_QSTR(MP_QSTR_MODEL), MP_ROM_QSTR(MP_QSTR_T)}, +#else +#error Unknown Trezor model +#endif #ifdef TREZOR_EMULATOR {MP_ROM_QSTR(MP_QSTR_EMULATOR), mp_const_true}, MEMINFO_DICT_ENTRIES diff --git a/core/embed/firmware/header.S b/core/embed/firmware/header.S index 858719042..667e92915 100644 --- a/core/embed/firmware/header.S +++ b/core/embed/firmware/header.S @@ -26,12 +26,12 @@ g_header: . = . + 8 // reserved . = . + 512 // hash1 ... hash16 -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T // model T header specifics . = . + 415 // reserved .byte 0 // sigmask . = . + 64 // sig -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 // model 1 header specifics . = . + 64 // sig1 . = . + 64 // sig2 diff --git a/core/embed/firmware/main.c b/core/embed/firmware/main.c index 612e48690..0370744d4 100644 --- a/core/embed/firmware/main.c +++ b/core/embed/firmware/main.c @@ -65,7 +65,7 @@ int main(void) { #endif // reinitialize HAL for Trezor One -#if TREZOR_MODEL == 1 +#if defined TREZOR_MODEL_1 HAL_Init(); #endif @@ -75,7 +75,7 @@ int main(void) { enable_systemview(); #endif -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T #if PRODUCTION check_and_replace_bootloader(); #endif @@ -86,12 +86,12 @@ int main(void) { // Init peripherals pendsv_init(); -#if TREZOR_MODEL == 1 +#if defined TREZOR_MODEL_1 display_init(); button_init(); #endif -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T // display_init_seq(); sdcard_init(); touch_init(); diff --git a/core/embed/firmware/startup.S b/core/embed/firmware/startup.S index d715f75ee..454475349 100644 --- a/core/embed/firmware/startup.S +++ b/core/embed/firmware/startup.S @@ -10,7 +10,7 @@ reset_handler: // or the firmware was properly signed. All other variants end up in hard fault due to MPU // (cf mpu_config_firmware in legacy bootloader) -#if TREZOR_MODEL == 1 +#if defined TREZOR_MODEL_1 cpsid if ldr r0, =0xE000ED08 // r0 = VTOR address ldr r1, =0x08010400 // r1 = FLASH_APP_START @@ -48,9 +48,9 @@ reset_handler: // according to "ARM Cortex-M Programming Guide to Memory Barrier Instructions" Application Note 321, section 4.7: // "If it is not necessary to ensure that a pended interrupt is recognized immediately before // subsequent operations, it is not necessary to insert a memory barrier instruction." -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T cpsie f -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 cpsie if #endif diff --git a/core/embed/trezorhal/flash.c b/core/embed/trezorhal/flash.c index 8808a6794..ad232cdee 100644 --- a/core/embed/trezorhal/flash.c +++ b/core/embed/trezorhal/flash.c @@ -39,7 +39,7 @@ static const uint32_t FLASH_SECTOR_TABLE[FLASH_SECTOR_COUNT + 1] = { [9] = 0x080A0000, // - 0x080BFFFF | 128 KiB [10] = 0x080C0000, // - 0x080DFFFF | 128 KiB [11] = 0x080E0000, // - 0x080FFFFF | 128 KiB -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T [12] = 0x08100000, // - 0x08103FFF | 16 KiB [13] = 0x08104000, // - 0x08107FFF | 16 KiB [14] = 0x08108000, // - 0x0810BFFF | 16 KiB @@ -53,7 +53,7 @@ static const 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 TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 [12] = 0x08100000, // last element - not a valid sector #else #error Unknown Trezor model diff --git a/core/embed/trezorhal/flash.h b/core/embed/trezorhal/flash.h index 50e5f6210..b19b318d8 100644 --- a/core/embed/trezorhal/flash.h +++ b/core/embed/trezorhal/flash.h @@ -26,9 +26,9 @@ // see docs/memory.md for more information -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T #define FLASH_SECTOR_COUNT 24 -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 #define FLASH_SECTOR_COUNT 12 #else #error Unknown Trezor model @@ -40,10 +40,10 @@ // 3 -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T #define FLASH_SECTOR_STORAGE_1 4 #define FLASH_SECTOR_STORAGE_2 16 -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 #define FLASH_SECTOR_STORAGE_1 2 #define FLASH_SECTOR_STORAGE_2 3 #else diff --git a/core/embed/unix/flash.c b/core/embed/unix/flash.c index 7af3e11bf..49298dbc7 100644 --- a/core/embed/unix/flash.c +++ b/core/embed/unix/flash.c @@ -47,7 +47,7 @@ static const uint32_t FLASH_SECTOR_TABLE[FLASH_SECTOR_COUNT + 1] = { [9] = 0x080A0000, // - 0x080BFFFF | 128 KiB [10] = 0x080C0000, // - 0x080DFFFF | 128 KiB [11] = 0x080E0000, // - 0x080FFFFF | 128 KiB -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T [12] = 0x08100000, // - 0x08103FFF | 16 KiB [13] = 0x08104000, // - 0x08107FFF | 16 KiB [14] = 0x08108000, // - 0x0810BFFF | 16 KiB @@ -61,7 +61,7 @@ static const 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 TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 [12] = 0x08100000, // last element - not a valid sector #else #error Unknown Trezor model diff --git a/core/embed/unix/touch.c b/core/embed/unix/touch.c index e2c829ebd..0467b5df6 100644 --- a/core/embed/unix/touch.c +++ b/core/embed/unix/touch.c @@ -46,7 +46,7 @@ static bool handle_emulator_events(const SDL_Event *event) { return false; } -#if TREZOR_MODEL == T +#if defined TREZOR_MODEL_T #include "touch.h" @@ -102,7 +102,7 @@ uint32_t touch_read(void) { return 0; } -#elif TREZOR_MODEL == 1 +#elif defined TREZOR_MODEL_1 #include "button.h" diff --git a/storage/tests/c/norcow_config.h b/storage/tests/c/norcow_config.h index 00f37e520..257c5291c 100644 --- a/storage/tests/c/norcow_config.h +++ b/storage/tests/c/norcow_config.h @@ -31,9 +31,9 @@ * The length of the sector header in bytes. The header is preserved between * sector erasures. */ -#if TREZOR_MODEL == T +#if defined MODEL_T #define NORCOW_HEADER_LEN 0 -#elif TREZOR_MODEL == 1 +#elif defined MODEL_1 #define NORCOW_HEADER_LEN (0x100) #else #error Unknown Trezor model