diff --git a/micropython/bootloader/main.c b/micropython/bootloader/main.c index da5c81204b..1faba54925 100644 --- a/micropython/bootloader/main.c +++ b/micropython/bootloader/main.c @@ -39,10 +39,10 @@ void display_vendor(const uint8_t *vimg, const char *vstr, uint32_t vstr_len, ui display_text_center(120, 192, vstr, vstr_len, FONT_BOLD, COLOR_WHITE, COLOR_BLACK); char ver_str[32]; mini_snprintf(ver_str, sizeof(ver_str), "%d.%d.%d.%d", - fw_version & 0xFF, - (fw_version >> 8) & 0xFF, - (fw_version >> 16) & 0xFF, - (fw_version >> 24) & 0xFF + (int)(fw_version & 0xFF), + (int)((fw_version >> 8) & 0xFF), + (int)((fw_version >> 16) & 0xFF), + (int)((fw_version >> 24) & 0xFF) ); display_text_center(120, 215, ver_str, -1, FONT_BOLD, COLOR_GRAY64, COLOR_BLACK); display_refresh(); diff --git a/micropython/extmod/modtrezorui/display.h b/micropython/extmod/modtrezorui/display.h index 2803865abc..841ba598a2 100644 --- a/micropython/extmod/modtrezorui/display.h +++ b/micropython/extmod/modtrezorui/display.h @@ -54,7 +54,7 @@ void display_icon(int x, int y, int w, int h, const void *data, int datalen, uin #ifndef TREZOR_PRINT_DISABLE void display_print_color(uint16_t fgcolor, uint16_t bgcolor); void display_print(const char *text, int textlen); -void display_printf(const char *fmt, ...); +void display_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2))); #endif void display_text(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor); diff --git a/micropython/trezorhal/mini_printf.h b/micropython/trezorhal/mini_printf.h index 97e7c1170f..92f982ed13 100644 --- a/micropython/trezorhal/mini_printf.h +++ b/micropython/trezorhal/mini_printf.h @@ -37,8 +37,8 @@ extern "C" { #include -int mini_vsnprintf(char* buffer, unsigned int buffer_len, const char *fmt, va_list va); -int mini_snprintf(char* buffer, unsigned int buffer_len, const char *fmt, ...); +int mini_vsnprintf(char* buffer, unsigned int buffer_len, const char *fmt, va_list va) __attribute__ ((__format__ (__printf__, 3, 0))); +int mini_snprintf(char* buffer, unsigned int buffer_len, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); #ifdef __cplusplus } diff --git a/micropython/trezorhal/stm32_it.c b/micropython/trezorhal/stm32_it.c index 22981dd919..e3e5218ed3 100644 --- a/micropython/trezorhal/stm32_it.c +++ b/micropython/trezorhal/stm32_it.c @@ -105,25 +105,25 @@ void HardFault_C_Handler(ExceptionRegisters_t *regs) { display_printf("HardFault\n"); - display_printf("R0 %08x\n", regs->r0); - display_printf("R1 %08x\n", regs->r1); - display_printf("R2 %08x\n", regs->r2); - display_printf("R3 %08x\n", regs->r3); - display_printf("R12 %08x\n", regs->r12); - display_printf("SP %08x\n", (uint32_t)regs); - display_printf("LR %08x\n", regs->lr); - display_printf("PC %08x\n", regs->pc); - display_printf("XPSR %08x\n", regs->xpsr); + display_printf("R0 %08x\n", (unsigned int)regs->r0); + display_printf("R1 %08x\n", (unsigned int)regs->r1); + display_printf("R2 %08x\n", (unsigned int)regs->r2); + display_printf("R3 %08x\n", (unsigned int)regs->r3); + display_printf("R12 %08x\n", (unsigned int)regs->r12); + display_printf("SP %08x\n", (unsigned int)regs); + display_printf("LR %08x\n", (unsigned int)regs->lr); + display_printf("PC %08x\n", (unsigned int)regs->pc); + display_printf("XPSR %08x\n", (unsigned int)regs->xpsr); uint32_t cfsr = SCB->CFSR; - display_printf("HFSR %08x\n", SCB->HFSR); - display_printf("CFSR %08x\n", cfsr); + display_printf("HFSR %08x\n", (unsigned int)SCB->HFSR); + display_printf("CFSR %08x\n", (unsigned int)cfsr); if (cfsr & 0x80) { - display_printf("MMFAR %08x\n", SCB->MMFAR); + display_printf("MMFAR %08x\n", (unsigned int)SCB->MMFAR); } if (cfsr & 0x8000) { - display_printf("BFAR %08x\n", SCB->BFAR); + display_printf("BFAR %08x\n", (unsigned int)SCB->BFAR); } if ((void*)&_ram_start <= (void*)regs && (void*)regs < (void*)&_ram_end) { @@ -134,7 +134,7 @@ void HardFault_C_Handler(ExceptionRegisters_t *regs) { stack_top = (uint32_t*)regs + 32; } for (uint32_t *sp = (uint32_t*)regs; sp < stack_top; ++sp) { - display_printf(" %08x %08x\n", (uint32_t)sp, *sp); + display_printf(" %08x %08x\n", (unsigned int)sp, (unsigned int)*sp); } }