From d211e3af07c74f57bb3d32ca4fc001360bf7e998 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 11 Mar 2021 12:24:47 +0100 Subject: [PATCH] fix(core): switch define to invert display colors into const volatile using define causes compiler to over-optimize the code in display_init_seq leading to larger differences in the resulting binaries when the flag changes we want to keep the difference to minimum (1 byte) and using const volatile instead of define achieves that --- core/embed/extmod/modtrezorui/display-stm32_T.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/embed/extmod/modtrezorui/display-stm32_T.h b/core/embed/extmod/modtrezorui/display-stm32_T.h index 973f47ff93..1745a8be7e 100644 --- a/core/embed/extmod/modtrezorui/display-stm32_T.h +++ b/core/embed/extmod/modtrezorui/display-stm32_T.h @@ -19,7 +19,12 @@ #include STM32_HAL_H -#define DISPLAY_ST7789V_INVERT_COLORS 0 +// using const volatile instead of #define results in binaries that change +// only in 1-byte when the flag changes. +// using #define leads compiler to over-optimize the code leading to bigger +// differencies in the resulting binaries. + +const volatile uint8_t DISPLAY_ST7789V_INVERT_COLORS = 0; // FSMC/FMC Bank 1 - NOR/PSRAM 1 #define DISPLAY_MEMORY_BASE 0x60000000