From 766538f5bd7bad1eef70c76876dee234cbd70280 Mon Sep 17 00:00:00 2001 From: cepetr Date: Fri, 1 Nov 2024 12:55:31 +0100 Subject: [PATCH] refactor(core): introduce global trezor_rtl/bsp/model headers [no changelog] --- core/embed/boardloader/main.c | 8 ++-- core/embed/bootloader/bootui.c | 4 +- core/embed/bootloader/bootui.h | 5 +-- core/embed/bootloader/emulator.c | 8 ++-- core/embed/bootloader/emulator.h | 5 +-- core/embed/bootloader/main.c | 8 ++-- core/embed/bootloader/messages.c | 6 +-- core/embed/bootloader/messages.h | 5 +-- core/embed/bootloader/version_check.c | 6 +-- core/embed/bootloader/version_check.h | 3 +- core/embed/bootloader_ci/bootui.c | 2 +- core/embed/bootloader_ci/bootui.h | 2 +- core/embed/bootloader_ci/main.c | 9 ++--- core/embed/bootloader_ci/messages.c | 6 +-- core/embed/bootloader_ci/messages.h | 4 +- .../extmod/modtrezorconfig/modtrezorconfig.c | 3 +- .../extmod/modtrezorconfig/norcow_config.h | 5 ++- core/embed/extmod/modtrezorcrypto/crc.h | 2 +- .../extmod/modtrezorcrypto/modtrezorcrypto.c | 8 +--- core/embed/extmod/modtrezorio/ff.c | 3 +- .../extmod/modtrezorio/modtrezorio-poll.h | 5 ++- core/embed/extmod/modtrezorio/modtrezorio.c | 7 ++-- core/embed/extmod/modtrezorui/modtrezorui.c | 4 +- .../modtrezorutils/modtrezorutils-meminfo.h | 5 +-- .../extmod/modtrezorutils/modtrezorutils.c | 7 ++-- core/embed/extmod/trezorobj.c | 2 +- core/embed/firmware/main.c | 8 +--- core/embed/firmware/mphalport.c | 3 +- core/embed/firmware/systemview.c | 5 ++- core/embed/kernel/main.c | 2 +- core/embed/lib/bl_check.c | 7 ++-- core/embed/lib/buffers.c | 3 +- core/embed/lib/buffers.h | 7 +--- core/embed/lib/colors.h | 3 +- core/embed/lib/common.h | 31 ++++++++++++++++ core/embed/lib/display_draw.c | 19 ++++------ core/embed/lib/display_draw.h | 5 +-- core/embed/lib/display_utils.c | 4 +- core/embed/lib/error_handling.c | 4 +- core/embed/lib/flash_utils.c | 8 ++-- core/embed/lib/flash_utils.h | 2 +- core/embed/lib/fonts/font_bitmap.h | 2 +- core/embed/lib/fonts/fonts.c | 6 +-- core/embed/lib/fonts/fonts.h | 1 - core/embed/lib/gfx_bitblt.h | 3 +- core/embed/lib/gfx_color.h | 2 +- core/embed/lib/gfx_draw.c | 3 +- core/embed/lib/image.c | 5 +-- core/embed/lib/image.h | 6 +-- core/embed/lib/image_hash_conf.h | 4 +- core/embed/lib/mini_printf.c | 4 +- core/embed/lib/mini_printf.h | 6 ++- core/embed/lib/terminal.c | 7 +--- core/embed/lib/translations.c | 10 ++--- core/embed/lib/translations.h | 3 +- .../{trezorhal/common.h => lib/trezor_rtl.h} | 21 +++++++---- core/embed/lib/trezor_types.h | 35 ++++++++++++++++++ core/embed/models/trezor_bsp.h | 36 ++++++++++++++++++ core/embed/models/{model.h => trezor_model.h} | 0 core/embed/prodtest/main.c | 37 ++++++++++--------- core/embed/prodtest/optiga_prodtest.c | 4 +- core/embed/prodtest/optiga_prodtest.h | 4 +- core/embed/prodtest/prodtest_common.h | 3 +- core/embed/reflash/main.c | 10 +---- core/embed/rust/rust_ui.h | 4 -- core/embed/rust/rust_ui_bootloader.h | 2 +- core/embed/rust/rust_ui_common.h | 2 +- core/embed/rust/trezorhal.h | 5 +-- core/embed/trezorhal/applet.h | 3 +- core/embed/trezorhal/bg_copy.h | 4 +- core/embed/trezorhal/board_capabilities.h | 2 +- core/embed/trezorhal/bootargs.h | 3 +- core/embed/trezorhal/bootutils.h | 3 +- core/embed/trezorhal/button.h | 2 +- core/embed/trezorhal/display.h | 6 +-- core/embed/trezorhal/dma2d.h | 2 +- core/embed/trezorhal/entropy.h | 2 +- core/embed/trezorhal/flash.h | 4 +- core/embed/trezorhal/flash_otp.h | 2 +- core/embed/trezorhal/fwutils.h | 4 +- core/embed/trezorhal/haptic.h | 3 +- core/embed/trezorhal/hash_processor.h | 2 +- core/embed/trezorhal/i2c_bus.h | 4 +- core/embed/trezorhal/monoctr.h | 5 +-- core/embed/trezorhal/mpu.h | 2 +- core/embed/trezorhal/optiga.h | 5 +-- core/embed/trezorhal/optiga/optiga.c | 5 ++- core/embed/trezorhal/optiga/optiga_commands.c | 5 ++- .../embed/trezorhal/optiga/optiga_transport.c | 10 ++--- core/embed/trezorhal/optiga_commands.h | 5 +-- core/embed/trezorhal/optiga_common.h | 2 +- core/embed/trezorhal/optiga_hal.h | 3 +- core/embed/trezorhal/optiga_transport.h | 5 +-- core/embed/trezorhal/option_bytes.h | 2 +- core/embed/trezorhal/random_delays.h | 2 +- core/embed/trezorhal/reset_flags.h | 2 +- core/embed/trezorhal/rgb_led.h | 2 +- core/embed/trezorhal/rng.h | 2 +- core/embed/trezorhal/sbu.h | 2 +- core/embed/trezorhal/sdcard.h | 3 +- core/embed/trezorhal/secret.h | 3 +- core/embed/trezorhal/secure_aes.h | 4 +- core/embed/trezorhal/stm32f4/applet.c | 2 +- core/embed/trezorhal/stm32f4/backlight_pwm.c | 9 ++--- .../trezorhal/stm32f4/board_capabilities.c | 5 +-- core/embed/trezorhal/stm32f4/bootutils.c | 8 ++-- core/embed/trezorhal/stm32f4/button.c | 6 ++- .../trezorhal/stm32f4/consumption_mask.c | 4 +- .../trezorhal/stm32f4/displays/ili9341_spi.c | 6 +-- core/embed/trezorhal/stm32f4/displays/ltdc.c | 9 ++--- core/embed/trezorhal/stm32f4/displays/ltdc.h | 2 +- .../trezorhal/stm32f4/displays/st7789v.c | 8 ++-- .../trezorhal/stm32f4/displays/st7789v.h | 5 +-- .../stm32f4/displays/ug-2828tswig01.c | 6 +-- .../stm32f4/displays/vg-2864ksweg01.c | 7 ++-- core/embed/trezorhal/stm32f4/dma2d.c | 5 ++- core/embed/trezorhal/stm32f4/dma2d_bitblt.c | 5 +-- core/embed/trezorhal/stm32f4/entropy.c | 6 +-- core/embed/trezorhal/stm32f4/flash.c | 6 +-- core/embed/trezorhal/stm32f4/flash_otp.c | 6 +-- core/embed/trezorhal/stm32f4/fwutils.c | 10 ++--- core/embed/trezorhal/stm32f4/i2c_bus.c | 8 ++-- core/embed/trezorhal/stm32f4/irq.h | 4 +- core/embed/trezorhal/stm32f4/layout.c | 6 +-- core/embed/trezorhal/stm32f4/monoctr.c | 7 ++-- core/embed/trezorhal/stm32f4/mpu.c | 9 ++--- core/embed/trezorhal/stm32f4/optiga_hal.c | 7 ++-- core/embed/trezorhal/stm32f4/option_bytes.c | 4 +- core/embed/trezorhal/stm32f4/pvd.c | 4 +- core/embed/trezorhal/stm32f4/random_delays.c | 5 +-- core/embed/trezorhal/stm32f4/reset_flags.c | 2 +- core/embed/trezorhal/stm32f4/rgb_led.c | 5 +-- core/embed/trezorhal/stm32f4/rng.c | 2 +- core/embed/trezorhal/stm32f4/sbu.c | 2 +- core/embed/trezorhal/stm32f4/sdcard.c | 6 +-- core/embed/trezorhal/stm32f4/sdram.h | 2 +- core/embed/trezorhal/stm32f4/secret.c | 8 ++-- core/embed/trezorhal/stm32f4/startup_init.c | 6 +-- core/embed/trezorhal/stm32f4/syscall.h | 2 +- .../trezorhal/stm32f4/syscall_dispatch.c | 4 +- core/embed/trezorhal/stm32f4/syscall_probe.c | 5 ++- core/embed/trezorhal/stm32f4/syscall_probe.h | 3 +- .../trezorhal/stm32f4/syscall_verifiers.c | 3 +- core/embed/trezorhal/stm32f4/systask.c | 7 +--- core/embed/trezorhal/stm32f4/system.c | 5 +-- core/embed/trezorhal/stm32f4/systick.c | 3 +- .../trezorhal/stm32f4/systick_internal.h | 2 +- core/embed/trezorhal/stm32f4/systimer.c | 3 +- core/embed/trezorhal/stm32f4/touch/ft6x36.c | 11 ++---- .../stm32f4/touch/panels/lhs200kb-if21.c | 6 +-- .../stm32f4/touch/panels/lhs200kb-if21.h | 2 +- .../stm32f4/touch/panels/lx154a2422cpt23.c | 6 +-- .../stm32f4/touch/panels/lx154a2422cpt23.h | 2 +- core/embed/trezorhal/stm32f4/touch/stmpe811.c | 9 +---- .../embed/trezorhal/stm32f4/unit_properties.c | 7 ++-- core/embed/trezorhal/stm32f4/usb/usb.c | 8 ++-- .../trezorhal/stm32f4/usb/usb_class_hid.c | 4 +- .../trezorhal/stm32f4/usb/usb_class_vcp.c | 2 +- .../trezorhal/stm32f4/usb/usb_class_webusb.c | 4 +- .../trezorhal/stm32f4/usb/usb_internal.h | 3 +- core/embed/trezorhal/stm32f4/usb/usbd_conf.c | 4 +- core/embed/trezorhal/stm32f4/usb/usbd_conf.h | 6 +-- .../stm32f4/xdisplay/st-7789/display_driver.c | 2 +- .../stm32f4/xdisplay/st-7789/display_fb.c | 8 +--- .../stm32f4/xdisplay/st-7789/display_fb.h | 2 +- .../xdisplay/st-7789/display_internal.h | 5 +-- .../stm32f4/xdisplay/st-7789/display_io.c | 4 +- .../stm32f4/xdisplay/st-7789/display_io.h | 4 +- .../stm32f4/xdisplay/st-7789/display_nofb.c | 3 +- .../stm32f4/xdisplay/st-7789/display_panel.h | 3 +- .../xdisplay/st-7789/panels/lhs200kb-if21.c | 4 +- .../xdisplay/st-7789/panels/lx154a2422.c | 3 +- .../xdisplay/st-7789/panels/lx154a2482.c | 4 +- .../xdisplay/st-7789/panels/tf15411a.c | 5 ++- .../stm32f429i-disc1/display_driver.c | 7 +--- .../stm32f429i-disc1/display_internal.h | 4 +- .../xdisplay/stm32f429i-disc1/display_ltdc.c | 7 +--- .../xdisplay/stm32f429i-disc1/ili9341_spi.c | 6 +-- .../stm32f4/xdisplay/ug-2828/display_driver.c | 7 +--- .../stm32f4/xdisplay/vg-2864/display_driver.c | 9 +---- core/embed/trezorhal/stm32u5/bg_copy.c | 4 +- .../trezorhal/stm32u5/consumption_mask.c | 3 +- core/embed/trezorhal/stm32u5/displays/dsi.c | 6 +-- core/embed/trezorhal/stm32u5/displays/dsi.h | 3 +- core/embed/trezorhal/stm32u5/entropy.c | 4 +- core/embed/trezorhal/stm32u5/flash.c | 9 ++--- core/embed/trezorhal/stm32u5/flash_otp.c | 6 +-- .../stm32u5/haptic/drv2625/drv2625.c | 9 +---- core/embed/trezorhal/stm32u5/hash_processor.c | 6 +-- core/embed/trezorhal/stm32u5/i2c_bus.c | 8 ++-- core/embed/trezorhal/stm32u5/layout.c | 6 +-- core/embed/trezorhal/stm32u5/monoctr.c | 5 ++- core/embed/trezorhal/stm32u5/mpu.c | 7 ++-- core/embed/trezorhal/stm32u5/option_bytes.c | 9 ++--- core/embed/trezorhal/stm32u5/reset_flags.c | 2 +- core/embed/trezorhal/stm32u5/sdcard.c | 6 +-- core/embed/trezorhal/stm32u5/secret.c | 10 ++--- core/embed/trezorhal/stm32u5/secure_aes.c | 12 +++--- core/embed/trezorhal/stm32u5/startup_init.c | 4 +- core/embed/trezorhal/stm32u5/tamper.c | 5 ++- core/embed/trezorhal/stm32u5/touch/sitronix.c | 8 ++-- core/embed/trezorhal/stm32u5/trustzone.c | 8 ++-- .../xdisplay/stm32u5a9j-dk/display_driver.c | 7 +--- .../xdisplay/stm32u5a9j-dk/display_fb.c | 7 +--- .../xdisplay/stm32u5a9j-dk/display_internal.h | 3 +- .../xdisplay/stm32u5a9j-dk/display_ltdc_dsi.c | 9 ++--- core/embed/trezorhal/systask.h | 4 +- core/embed/trezorhal/systick.h | 3 +- core/embed/trezorhal/systimer.h | 3 +- core/embed/trezorhal/tamper.h | 2 +- core/embed/trezorhal/time_estimate.h | 2 +- core/embed/trezorhal/touch.h | 4 +- core/embed/trezorhal/trustzone.h | 3 +- core/embed/trezorhal/unit_properties.h | 3 +- core/embed/trezorhal/unix/bootutils.c | 6 +-- core/embed/trezorhal/unix/button.c | 4 +- core/embed/trezorhal/unix/display-unix.c | 17 +++------ core/embed/trezorhal/unix/display_driver.c | 4 +- core/embed/trezorhal/unix/entropy.c | 2 +- core/embed/trezorhal/unix/flash.c | 7 ++-- core/embed/trezorhal/unix/flash_otp.c | 2 +- core/embed/trezorhal/unix/monoctr.c | 7 ++-- core/embed/trezorhal/unix/optiga.c | 5 ++- core/embed/trezorhal/unix/rng.c | 4 +- core/embed/trezorhal/unix/sdcard.c | 4 +- core/embed/trezorhal/unix/system.c | 5 +-- core/embed/trezorhal/unix/systick.c | 4 +- core/embed/trezorhal/unix/systimer.c | 2 +- core/embed/trezorhal/unix/touch.c | 6 +-- core/embed/trezorhal/unix/unit_properties.c | 6 +-- core/embed/trezorhal/unix/usb.c | 5 +-- core/embed/trezorhal/usb.h | 3 +- core/embed/trezorhal/usb_hid.h | 3 +- core/embed/trezorhal/usb_vcp.h | 3 +- core/embed/trezorhal/usb_webusb.h | 2 +- core/embed/trezorhal/xdisplay.h | 6 +-- core/embed/trezorhal/xdisplay_legacy.h | 5 ++- core/embed/unix/main.c | 8 +--- core/embed/unix/main_main.c | 3 +- core/embed/unix/profile.c | 4 +- 240 files changed, 607 insertions(+), 693 deletions(-) create mode 100644 core/embed/lib/common.h rename core/embed/{trezorhal/common.h => lib/trezor_rtl.h} (77%) create mode 100644 core/embed/lib/trezor_types.h create mode 100644 core/embed/models/trezor_bsp.h rename core/embed/models/{model.h => trezor_model.h} (100%) diff --git a/core/embed/boardloader/main.c b/core/embed/boardloader/main.c index dc33f4fb324..e429e0a483a 100644 --- a/core/embed/boardloader/main.c +++ b/core/embed/boardloader/main.c @@ -17,20 +17,18 @@ * along with this program. If not, see . */ -#include +#include +#include -#include TREZOR_BOARD #include "board_capabilities.h" #include "bootutils.h" #include "buffers.h" -#include "common.h" #include "compiler_traits.h" #include "display.h" #include "display_draw.h" #include "flash.h" #include "flash_utils.h" #include "image.h" -#include "model.h" #include "mpu.h" #include "pvd.h" #include "reset_flags.h" @@ -38,6 +36,7 @@ #include "rsod.h" #include "secret.h" #include "system.h" +#include "systick.h" #include "terminal.h" #ifdef USE_SD_CARD @@ -59,7 +58,6 @@ #endif #include "memzero.h" -#include "model.h" #include "monoctr.h" #include "option_bytes.h" #include "tamper.h" diff --git a/core/embed/bootloader/bootui.c b/core/embed/bootloader/bootui.c index cb1e2e320bd..594202f0830 100644 --- a/core/embed/bootloader/bootui.c +++ b/core/embed/bootloader/bootui.c @@ -17,9 +17,7 @@ * along with this program. If not, see . */ -#include - -#include TREZOR_BOARD +#include #include "bootui.h" #include "colors.h" diff --git a/core/embed/bootloader/bootui.h b/core/embed/bootloader/bootui.h index 4b29f01532b..a9922154af5 100644 --- a/core/embed/bootloader/bootui.h +++ b/core/embed/bootloader/bootui.h @@ -20,10 +20,9 @@ #ifndef __BOOTUI_H__ #define __BOOTUI_H__ +#include + #include "image.h" -#include "secbool.h" -#include "stdbool.h" -#include TREZOR_BOARD typedef enum { SCREEN_INTRO = 0, diff --git a/core/embed/bootloader/emulator.c b/core/embed/bootloader/emulator.c index 0fc61c68bb7..ac6791182c1 100644 --- a/core/embed/bootloader/emulator.c +++ b/core/embed/bootloader/emulator.c @@ -1,20 +1,20 @@ -#include +#include +#include + #include #include -#include TREZOR_BOARD #include "bootargs.h" #include "bootui.h" -#include "common.h" #include "display.h" #include "flash.h" #include "flash_otp.h" -#include "model.h" #include "rust_ui.h" #ifdef USE_OPTIGA #include "secret.h" #endif +#include "systick.h" #include "emulator.h" diff --git a/core/embed/bootloader/emulator.h b/core/embed/bootloader/emulator.h index ee589acb550..aa90a93f823 100644 --- a/core/embed/bootloader/emulator.h +++ b/core/embed/bootloader/emulator.h @@ -1,10 +1,9 @@ #ifndef __EMULATOR_H__ #define __EMULATOR_H__ -#undef FIRMWARE_START +#include -#include -#include +#undef FIRMWARE_START extern uint8_t *FIRMWARE_START; diff --git a/core/embed/bootloader/main.c b/core/embed/bootloader/main.c index fd1d83ea4de..553df46a472 100644 --- a/core/embed/bootloader/main.c +++ b/core/embed/bootloader/main.c @@ -17,12 +17,13 @@ * along with this program. If not, see . */ -#include +#include +#include + #include #include "bootargs.h" #include "bootutils.h" -#include "common.h" #include "display.h" #include "display_utils.h" #include "flash.h" @@ -35,9 +36,9 @@ #include "pvd.h" #include "random_delays.h" #include "rsod.h" -#include "secbool.h" #include "secret.h" #include "system.h" +#include "systick.h" #include "systimer.h" #ifdef USE_DMA2D @@ -66,7 +67,6 @@ #include "hash_processor.h" #endif -#include "model.h" #include "usb.h" #include "version.h" diff --git a/core/embed/bootloader/messages.c b/core/embed/bootloader/messages.c index 10cda4aff2d..eeeb50c71b1 100644 --- a/core/embed/bootloader/messages.c +++ b/core/embed/bootloader/messages.c @@ -17,7 +17,8 @@ * along with this program. If not, see . */ -#include +#include +#include #include #include @@ -25,11 +26,9 @@ #include "messages.pb.h" #include "bootargs.h" -#include "common.h" #include "flash.h" #include "flash_utils.h" #include "image.h" -#include "secbool.h" #include "secret.h" #include "unit_properties.h" #include "usb.h" @@ -41,7 +40,6 @@ #include "version_check.h" #include "memzero.h" -#include "model.h" #ifdef TREZOR_EMULATOR #include "emulator.h" diff --git a/core/embed/bootloader/messages.h b/core/embed/bootloader/messages.h index ad8e3f42113..c8fcb34c56a 100644 --- a/core/embed/bootloader/messages.h +++ b/core/embed/bootloader/messages.h @@ -20,10 +20,9 @@ #ifndef __MESSAGES_H__ #define __MESSAGES_H__ -#include +#include + #include "image.h" -#include "secbool.h" -#include TREZOR_BOARD #define USB_TIMEOUT 500 #define USB_PACKET_SIZE 64 diff --git a/core/embed/bootloader/version_check.c b/core/embed/bootloader/version_check.c index ae7d2251540..0d96c535132 100644 --- a/core/embed/bootloader/version_check.c +++ b/core/embed/bootloader/version_check.c @@ -17,13 +17,11 @@ * along with this program. If not, see . */ -#include +#include -#include "version_check.h" - -#include "error_handling.h" #include "model_version.h" #include "monoctr.h" +#include "version_check.h" void ensure_bootloader_min_version(void) { monoctr_write(MONOCTR_BOOTLOADER_VERSION, BOOTLOADER_MONOTONIC_VERSION); diff --git a/core/embed/bootloader/version_check.h b/core/embed/bootloader/version_check.h index a7011808b50..4572d3c8ec4 100644 --- a/core/embed/bootloader/version_check.h +++ b/core/embed/bootloader/version_check.h @@ -19,8 +19,7 @@ #pragma once -#include -#include "secbool.h" +#include // Protection against bootloader downgrade diff --git a/core/embed/bootloader_ci/bootui.c b/core/embed/bootloader_ci/bootui.c index 7b6a4e288ed..580bc13646c 100644 --- a/core/embed/bootloader_ci/bootui.c +++ b/core/embed/bootloader_ci/bootui.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include +#include #include "bootui.h" #include "display.h" diff --git a/core/embed/bootloader_ci/bootui.h b/core/embed/bootloader_ci/bootui.h index 4d71c5f8c7f..b63cfc24b0c 100644 --- a/core/embed/bootloader_ci/bootui.h +++ b/core/embed/bootloader_ci/bootui.h @@ -20,7 +20,7 @@ #ifndef __BOOTUI_H__ #define __BOOTUI_H__ -#include "secbool.h" +#include void ui_screen_welcome_third(void); diff --git a/core/embed/bootloader_ci/main.c b/core/embed/bootloader_ci/main.c index d44584f6638..bc4a8d4782b 100644 --- a/core/embed/bootloader_ci/main.c +++ b/core/embed/bootloader_ci/main.c @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -#include -#include +#include +#include +#include #include "bootutils.h" -#include "common.h" #include "display.h" #include "display_draw.h" #include "flash.h" @@ -32,8 +32,8 @@ #include "random_delays.h" #include "rng.h" #include "rsod.h" -#include "secbool.h" #include "system.h" +#include "systick.h" #ifdef USE_TOUCH #include "touch.h" #endif @@ -42,7 +42,6 @@ #include "bootui.h" #include "messages.h" -#include "model.h" #include "version_check.h" #ifdef USE_HASH_PROCESSOR diff --git a/core/embed/bootloader_ci/messages.c b/core/embed/bootloader_ci/messages.c index fd40c5fc330..e2b0a81d44d 100644 --- a/core/embed/bootloader_ci/messages.c +++ b/core/embed/bootloader_ci/messages.c @@ -17,19 +17,17 @@ * along with this program. If not, see . */ -#include +#include +#include #include #include #include #include "messages.pb.h" -#include "common.h" #include "flash.h" #include "flash_utils.h" #include "image.h" -#include "model.h" -#include "secbool.h" #include "usb.h" #include "version.h" diff --git a/core/embed/bootloader_ci/messages.h b/core/embed/bootloader_ci/messages.h index 0937f60627e..37656c58662 100644 --- a/core/embed/bootloader_ci/messages.h +++ b/core/embed/bootloader_ci/messages.h @@ -20,9 +20,9 @@ #ifndef __MESSAGES_H__ #define __MESSAGES_H__ -#include +#include + #include "image.h" -#include "secbool.h" #define USB_TIMEOUT 500 #define USB_PACKET_SIZE 64 diff --git a/core/embed/extmod/modtrezorconfig/modtrezorconfig.c b/core/embed/extmod/modtrezorconfig/modtrezorconfig.c index 10df09495ea..c535b4c7ab2 100644 --- a/core/embed/extmod/modtrezorconfig/modtrezorconfig.c +++ b/core/embed/extmod/modtrezorconfig/modtrezorconfig.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include +#include #include "py/mphal.h" #include "py/objstr.h" @@ -27,7 +27,6 @@ #include "embed/extmod/trezorobj.h" -#include "common.h" #include "entropy.h" #include "memzero.h" #include "storage.h" diff --git a/core/embed/extmod/modtrezorconfig/norcow_config.h b/core/embed/extmod/modtrezorconfig/norcow_config.h index f9233cb7e2e..e0bae4f4b76 100644 --- a/core/embed/extmod/modtrezorconfig/norcow_config.h +++ b/core/embed/extmod/modtrezorconfig/norcow_config.h @@ -20,9 +20,10 @@ #ifndef __NORCOW_CONFIG_H__ #define __NORCOW_CONFIG_H__ -#include TREZOR_BOARD +#include +#include + #include "flash.h" -#include "model.h" #define NORCOW_HEADER_LEN 0 #define NORCOW_SECTOR_COUNT 2 diff --git a/core/embed/extmod/modtrezorcrypto/crc.h b/core/embed/extmod/modtrezorcrypto/crc.h index 34347b52dee..2606b5f8f8d 100644 --- a/core/embed/extmod/modtrezorcrypto/crc.h +++ b/core/embed/extmod/modtrezorcrypto/crc.h @@ -20,7 +20,7 @@ #ifndef __CRC_H__ #define __CRC_H__ -#include +#include uint32_t checksum_crc32(const uint8_t *data, uint32_t length, uint32_t crc); diff --git a/core/embed/extmod/modtrezorcrypto/modtrezorcrypto.c b/core/embed/extmod/modtrezorcrypto/modtrezorcrypto.c index 13282bd93a1..e8e16a76fe4 100644 --- a/core/embed/extmod/modtrezorcrypto/modtrezorcrypto.c +++ b/core/embed/extmod/modtrezorcrypto/modtrezorcrypto.c @@ -17,16 +17,10 @@ * along with this program. If not, see . */ -#include -#include -#include - -#include "common.h" +#include #include "py/runtime.h" -#include TREZOR_BOARD - #if MICROPY_PY_TREZORCRYPTO static mp_obj_t ui_wait_callback = mp_const_none; diff --git a/core/embed/extmod/modtrezorio/ff.c b/core/embed/extmod/modtrezorio/ff.c index ae62e0efc2f..3fe3754aae8 100644 --- a/core/embed/extmod/modtrezorio/ff.c +++ b/core/embed/extmod/modtrezorio/ff.c @@ -21,7 +21,8 @@ /----------------------------------------------------------------------------*/ -#include +#include + #include "ff.h" /* Declarations of FatFs API */ #include "diskio.h" /* Declarations of device I/O functions */ diff --git a/core/embed/extmod/modtrezorio/modtrezorio-poll.h b/core/embed/extmod/modtrezorio/modtrezorio-poll.h index c07904e5600..e7bbc6603e8 100644 --- a/core/embed/extmod/modtrezorio/modtrezorio-poll.h +++ b/core/embed/extmod/modtrezorio/modtrezorio-poll.h @@ -17,11 +17,12 @@ * along with this program. If not, see . */ -#include +#include #include "button.h" -#include "common.h" #include "display.h" +#include "systick.h" + #include "embed/extmod/trezorobj.h" #ifdef TREZOR_EMULATOR diff --git a/core/embed/extmod/modtrezorio/modtrezorio.c b/core/embed/extmod/modtrezorio/modtrezorio.c index 74ad336ba76..75a5501c5e7 100644 --- a/core/embed/extmod/modtrezorio/modtrezorio.c +++ b/core/embed/extmod/modtrezorio/modtrezorio.c @@ -17,7 +17,9 @@ * along with this program. If not, see . */ -#include +#include + +#include #include "py/mphal.h" #include "py/objstr.h" @@ -25,9 +27,6 @@ #if MICROPY_PY_TREZORIO -#include - -#include TREZOR_BOARD #include "button.h" #include "touch.h" #include "usb.h" diff --git a/core/embed/extmod/modtrezorui/modtrezorui.c b/core/embed/extmod/modtrezorui/modtrezorui.c index ce587d597bb..e6a42cccac9 100644 --- a/core/embed/extmod/modtrezorui/modtrezorui.c +++ b/core/embed/extmod/modtrezorui/modtrezorui.c @@ -17,9 +17,7 @@ * along with this program. If not, see . */ -#include -#include -#include +#include #include "py/runtime.h" diff --git a/core/embed/extmod/modtrezorutils/modtrezorutils-meminfo.h b/core/embed/extmod/modtrezorutils/modtrezorutils-meminfo.h index bf2887ca264..55fdfd37700 100644 --- a/core/embed/extmod/modtrezorutils/modtrezorutils-meminfo.h +++ b/core/embed/extmod/modtrezorutils/modtrezorutils-meminfo.h @@ -22,6 +22,8 @@ #else +#include + #include "py/bc.h" #include "py/gc.h" #include "py/nlr.h" @@ -36,9 +38,6 @@ #include "embed/rust/librust.h" #include "embed/trezorhal/usb.h" -#include -#include - #define WORDS_PER_BLOCK ((MICROPY_BYTES_PER_GC_BLOCK) / MP_BYTES_PER_OBJ_WORD) #define BYTES_PER_BLOCK (MICROPY_BYTES_PER_GC_BLOCK) diff --git a/core/embed/extmod/modtrezorutils/modtrezorutils.c b/core/embed/extmod/modtrezorutils/modtrezorutils.c index ca04f00b412..89a8ed3df34 100644 --- a/core/embed/extmod/modtrezorutils/modtrezorutils.c +++ b/core/embed/extmod/modtrezorutils/modtrezorutils.c @@ -17,6 +17,9 @@ * along with this program. If not, see . */ +#include +#include + #include "py/objstr.h" #include "py/runtime.h" @@ -28,15 +31,11 @@ #include "embed/extmod/modtrezorutils/modtrezorutils-meminfo.h" #include "embed/extmod/trezorobj.h" -#include #include "blake2s.h" #include "bootutils.h" -#include "error_handling.h" #include "fwutils.h" #include "unit_properties.h" #include "usb.h" -#include TREZOR_BOARD -#include "model.h" #if USE_OPTIGA && !defined(TREZOR_EMULATOR) #include "secret.h" diff --git a/core/embed/extmod/trezorobj.c b/core/embed/extmod/trezorobj.c index 71166dec9c8..44c07c038ec 100644 --- a/core/embed/extmod/trezorobj.c +++ b/core/embed/extmod/trezorobj.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include +#include #include "memzero.h" #include "py/obj.h" diff --git a/core/embed/firmware/main.c b/core/embed/firmware/main.c index 99c29dba3d6..d59ace62577 100644 --- a/core/embed/firmware/main.c +++ b/core/embed/firmware/main.c @@ -17,11 +17,7 @@ * along with this program. If not, see . */ -#include STM32_HAL_H - -#include -#include -#include +#include #include "py/builtin.h" #include "py/compile.h" @@ -36,10 +32,8 @@ #include "ports/stm32/gccollect.h" #include "ports/stm32/pendsv.h" -#include "error_handling.h" #include "rsod.h" #include "rust_ui_common.h" -#include "secbool.h" #include "systask.h" #include "system.h" diff --git a/core/embed/firmware/mphalport.c b/core/embed/firmware/mphalport.c index 9509ca37d55..b3428c16a9d 100644 --- a/core/embed/firmware/mphalport.c +++ b/core/embed/firmware/mphalport.c @@ -17,7 +17,8 @@ * along with this program. If not, see . */ -#include "common.h" +#include + #include "py/mphal.h" #include "systick.h" diff --git a/core/embed/firmware/systemview.c b/core/embed/firmware/systemview.c index c89c5b95d37..ca171d65695 100644 --- a/core/embed/firmware/systemview.c +++ b/core/embed/firmware/systemview.c @@ -19,9 +19,10 @@ #ifdef SYSTEM_VIEW -#include "systemview.h" -#include +#include + #include "mpconfigport.h" +#include "systemview.h" #include "SEGGER_SYSVIEW.h" #include "SEGGER_SYSVIEW_Conf.h" diff --git a/core/embed/kernel/main.c b/core/embed/kernel/main.c index 47c8160ba50..b140a3c87c7 100644 --- a/core/embed/kernel/main.c +++ b/core/embed/kernel/main.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include +#include #include "applet.h" #include "bl_check.h" diff --git a/core/embed/lib/bl_check.c b/core/embed/lib/bl_check.c index 02fd7148060..3a62f6f8b77 100644 --- a/core/embed/lib/bl_check.c +++ b/core/embed/lib/bl_check.c @@ -17,15 +17,14 @@ * along with this program. If not, see . */ -#include -#include +#include +#include + #include "blake2s.h" #include "board_capabilities.h" -#include "common.h" #include "flash.h" #include "image.h" #include "memzero.h" -#include "model.h" #include "mpu.h" #include "uzlib.h" diff --git a/core/embed/lib/buffers.c b/core/embed/lib/buffers.c index cbf53a322af..eddaef56077 100644 --- a/core/embed/lib/buffers.c +++ b/core/embed/lib/buffers.c @@ -17,8 +17,9 @@ * along with this program. If not, see . */ +#include + #include "buffers.h" -#include "common.h" #include "fonts/fonts.h" #include "memzero.h" diff --git a/core/embed/lib/buffers.h b/core/embed/lib/buffers.h index 4203338a028..6eac01580da 100644 --- a/core/embed/lib/buffers.h +++ b/core/embed/lib/buffers.h @@ -20,11 +20,8 @@ #ifndef _BUFFERS_H #define _BUFFERS_H -#include - -#include "common.h" -#include "model.h" -#include TREZOR_BOARD +#include +#include #define BUFFER_PIXELS DISPLAY_RESX diff --git a/core/embed/lib/colors.h b/core/embed/lib/colors.h index 1451959c76e..7a92ca1761a 100644 --- a/core/embed/lib/colors.h +++ b/core/embed/lib/colors.h @@ -20,8 +20,7 @@ #ifndef _COLORS_H #define _COLORS_H -#include "common.h" -#include TREZOR_BOARD +#include #ifdef USE_RGB_COLORS #define RGB16(R, G, B) ((R & 0xF8) << 8) | ((G & 0xFC) << 3) | ((B & 0xF8) >> 3) diff --git a/core/embed/lib/common.h b/core/embed/lib/common.h new file mode 100644 index 00000000000..a2f5826dc13 --- /dev/null +++ b/core/embed/lib/common.h @@ -0,0 +1,31 @@ +/* + * This file is part of the Trezor project, https://trezor.io/ + * + * Copyright (c) SatoshiLabs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef LIB_COMMON_H + +// This header is included in storage modules that expect to find common +// functions like `ensure()`, `error_shutdown()`, or `hal_delay()`. +// +// Do not include this header or add dependencies to it unless required by +// storage. + +#include "error_handling.h" +#include "systick.h" + +#endif // LIB_COMMON_H diff --git a/core/embed/lib/display_draw.c b/core/embed/lib/display_draw.c index 289b2ce16c1..a90f3be3e59 100644 --- a/core/embed/lib/display_draw.c +++ b/core/embed/lib/display_draw.c @@ -19,22 +19,19 @@ #define _GNU_SOURCE -#include "display_draw.h" -#include "buffers.h" -#include "common.h" - -#ifdef USE_DMA2D -#include "dma2d.h" -#endif - -#include "fonts/fonts.h" +#include #include -#include +#include "buffers.h" +#include "display.h" +#include "display_draw.h" +#include "fonts/fonts.h" #include "memzero.h" -#include "display.h" +#ifdef USE_DMA2D +#include "dma2d.h" +#endif static struct { int x, y; diff --git a/core/embed/lib/display_draw.h b/core/embed/lib/display_draw.h index dcd046681d4..0facb5db141 100644 --- a/core/embed/lib/display_draw.h +++ b/core/embed/lib/display_draw.h @@ -20,13 +20,10 @@ #ifndef __DISPLAY_DRAW_H__ #define __DISPLAY_DRAW_H__ -#include -#include -#include +#include #include "buffers.h" #include "colors.h" -#include TREZOR_BOARD #include "fonts/fonts.h" // provided by common diff --git a/core/embed/lib/display_utils.c b/core/embed/lib/display_utils.c index 81846e00e1d..8fb4d126342 100644 --- a/core/embed/lib/display_utils.c +++ b/core/embed/lib/display_utils.c @@ -17,8 +17,10 @@ * along with this program. If not, see . */ -#include "common.h" +#include + #include "display.h" +#include "systick.h" void display_fade(int start, int end, int delay) { #ifdef USE_BACKLIGHT diff --git a/core/embed/lib/error_handling.c b/core/embed/lib/error_handling.c index 437dc439c09..6691d37e44d 100644 --- a/core/embed/lib/error_handling.c +++ b/core/embed/lib/error_handling.c @@ -17,10 +17,8 @@ * along with this program. If not, see . */ -#include -#include +#include -#include "error_handling.h" #include "system.h" #ifndef TREZOR_EMULATOR diff --git a/core/embed/lib/flash_utils.c b/core/embed/lib/flash_utils.c index 80112cf6c63..4e3c4bf346c 100644 --- a/core/embed/lib/flash_utils.c +++ b/core/embed/lib/flash_utils.c @@ -17,14 +17,12 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD +#include +#include -#include "flash_utils.h" -#include "common.h" #include "flash_area.h" -#include "model.h" +#include "flash_utils.h" #include "mpu.h" -#include "secbool.h" typedef struct { const flash_area_t* area; diff --git a/core/embed/lib/flash_utils.h b/core/embed/lib/flash_utils.h index 04f14d87922..bd973fb9f5e 100644 --- a/core/embed/lib/flash_utils.h +++ b/core/embed/lib/flash_utils.h @@ -20,7 +20,7 @@ #ifndef LIB_FLASH_UTILS_H #define LIB_FLASH_UTILS_H -#include "secbool.h" +#include #ifdef KERNEL_MODE diff --git a/core/embed/lib/fonts/font_bitmap.h b/core/embed/lib/fonts/font_bitmap.h index e9b9dd841d7..f8ab8e384d3 100644 --- a/core/embed/lib/fonts/font_bitmap.h +++ b/core/embed/lib/fonts/font_bitmap.h @@ -1,3 +1,3 @@ -#include +#include extern const uint8_t* const Font_Bitmap; diff --git a/core/embed/lib/fonts/fonts.c b/core/embed/lib/fonts/fonts.c index d2e6a739621..92617d99448 100644 --- a/core/embed/lib/fonts/fonts.c +++ b/core/embed/lib/fonts/fonts.c @@ -17,11 +17,9 @@ * along with this program. If not, see . */ +#include + #include "fonts.h" -#include -#include -#include -#include #ifdef TRANSLATIONS #include "librust_fonts.h" #endif diff --git a/core/embed/lib/fonts/fonts.h b/core/embed/lib/fonts/fonts.h index 2e4405e9035..fd4408103c6 100644 --- a/core/embed/lib/fonts/fonts.h +++ b/core/embed/lib/fonts/fonts.h @@ -23,7 +23,6 @@ #include #include "fonts/font_bitmap.h" -#include TREZOR_BOARD #ifdef USE_RGB_COLORS #define TREZOR_FONT_BPP 4 diff --git a/core/embed/lib/gfx_bitblt.h b/core/embed/lib/gfx_bitblt.h index f897d933b5d..88f5815526b 100644 --- a/core/embed/lib/gfx_bitblt.h +++ b/core/embed/lib/gfx_bitblt.h @@ -20,8 +20,7 @@ #ifndef GFX_BITBLT_H #define GFX_BITBLT_H -#include -#include +#include #include "gfx_color.h" diff --git a/core/embed/lib/gfx_color.h b/core/embed/lib/gfx_color.h index 5cbfd9f1ca8..c67998ae416 100644 --- a/core/embed/lib/gfx_color.h +++ b/core/embed/lib/gfx_color.h @@ -20,7 +20,7 @@ #ifndef GFX_COLOR_H #define GFX_COLOR_H -#include +#include #ifdef UI_COLOR_32BIT #define GFX_COLOR_32BIT diff --git a/core/embed/lib/gfx_draw.c b/core/embed/lib/gfx_draw.c index 070a4b310cd..ef731058548 100644 --- a/core/embed/lib/gfx_draw.c +++ b/core/embed/lib/gfx_draw.c @@ -17,8 +17,9 @@ * along with this program. If not, see . */ -#include +#include +#include "display.h" #include "display_draw.h" #include "fonts/fonts.h" #include "gfx_draw.h" diff --git a/core/embed/lib/image.c b/core/embed/lib/image.c index 874e9d39e7b..c2fd7bf8636 100644 --- a/core/embed/lib/image.c +++ b/core/embed/lib/image.c @@ -17,14 +17,13 @@ * along with this program. If not, see . */ -#include +#include +#include #include "ed25519-donna/ed25519.h" -#include "common.h" #include "flash.h" #include "image.h" -#include "model.h" _Static_assert(VENDOR_HEADER_MAX_SIZE + IMAGE_HEADER_SIZE <= IMAGE_CHUNK_SIZE, "The size of the firmware headers must be less than or equal to " diff --git a/core/embed/lib/image.h b/core/embed/lib/image.h index 9ca8c2209aa..a2d02dd1055 100644 --- a/core/embed/lib/image.h +++ b/core/embed/lib/image.h @@ -20,12 +20,12 @@ #ifndef __TREZORHAL_IMAGE_H__ #define __TREZORHAL_IMAGE_H__ -#include +#include +#include + #include "blake2s.h" #include "flash.h" #include "image_hash_conf.h" -#include "model.h" -#include "secbool.h" #define VENDOR_HEADER_MAX_SIZE (64 * 1024) #define IMAGE_HEADER_SIZE 0x400 // size of the bootloader or firmware header diff --git a/core/embed/lib/image_hash_conf.h b/core/embed/lib/image_hash_conf.h index e8108070c7c..e7acaa35649 100644 --- a/core/embed/lib/image_hash_conf.h +++ b/core/embed/lib/image_hash_conf.h @@ -1,8 +1,8 @@ #ifndef LIB_IMAGE_HASH_H_ #define LIB_IMAGE_HASH_H_ -#include "model.h" -#include TREZOR_BOARD +#include +#include #ifdef IMAGE_HASH_SHA256 #include "sha2.h" diff --git a/core/embed/lib/mini_printf.c b/core/embed/lib/mini_printf.c index 907dc50c240..8360d7ddc0c 100644 --- a/core/embed/lib/mini_printf.c +++ b/core/embed/lib/mini_printf.c @@ -43,8 +43,8 @@ * */ -#include -#include +#include + #include "mini_printf.h" static unsigned int diff --git a/core/embed/lib/mini_printf.h b/core/embed/lib/mini_printf.h index b3a21eab173..66baf4e7b07 100644 --- a/core/embed/lib/mini_printf.h +++ b/core/embed/lib/mini_printf.h @@ -33,12 +33,14 @@ #ifndef __MINI_PRINTF__ #define __MINI_PRINTF__ +#include + +#include + #ifdef __cplusplus extern "C" { #endif -#include - 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))); diff --git a/core/embed/lib/terminal.c b/core/embed/lib/terminal.c index 70f38153517..79f5f300cba 100644 --- a/core/embed/lib/terminal.c +++ b/core/embed/lib/terminal.c @@ -17,11 +17,8 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD - -#include -#include -#include +#include +#include #include "display.h" #include "fonts/fonts.h" diff --git a/core/embed/lib/translations.c b/core/embed/lib/translations.c index 5053538ef00..e9dcbb6c01d 100644 --- a/core/embed/lib/translations.c +++ b/core/embed/lib/translations.c @@ -1,11 +1,9 @@ -#include "translations.h" -#include -#include -#include -#include "common.h" +#include +#include + #include "flash.h" -#include "model.h" #include "mpu.h" +#include "translations.h" #ifdef KERNEL_MODE diff --git a/core/embed/lib/translations.h b/core/embed/lib/translations.h index 9e823650b57..6ea3c42da04 100644 --- a/core/embed/lib/translations.h +++ b/core/embed/lib/translations.h @@ -20,8 +20,7 @@ #ifndef LIB_TRANSLATIONS_H #define LIB_TRANSLATIONS_H -#include -#include +#include bool translations_write(const uint8_t* data, uint32_t offset, uint32_t len); diff --git a/core/embed/trezorhal/common.h b/core/embed/lib/trezor_rtl.h similarity index 77% rename from core/embed/trezorhal/common.h rename to core/embed/lib/trezor_rtl.h index c231f82a0c5..24f96875a32 100644 --- a/core/embed/trezorhal/common.h +++ b/core/embed/lib/trezor_rtl.h @@ -17,15 +17,22 @@ * along with this program. If not, see . */ -#ifndef __TREZORHAL_COMMON_H__ -#define __TREZORHAL_COMMON_H__ +#ifndef TREZOR_RTL_H +#define TREZOR_RTL_H -#include -#include -#include "secbool.h" +// `trezor_rtl.h` consolidates common includes for implementation files +// (.c files) and provides essential types and functions. +// +// Do not include `trezor_rtl.h` in interface headers to prevent global +// namespace pollution; use `trezor_types.h` instead. + +#include + +#include +#include +#include #include "error_handling.h" -#include "systick.h" #ifndef MIN_8bits #define MIN_8bits(a, b) \ @@ -54,4 +61,4 @@ #define ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) -#endif +#endif // TREZOR_RTL_H diff --git a/core/embed/lib/trezor_types.h b/core/embed/lib/trezor_types.h new file mode 100644 index 00000000000..03aed8fa5f1 --- /dev/null +++ b/core/embed/lib/trezor_types.h @@ -0,0 +1,35 @@ +/* + * This file is part of the Trezor project, https://trezor.io/ + * + * Copyright (c) SatoshiLabs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef TREZOR_TYPES_H +#define TREZOR_TYPES_H + +// `trezor_types.h` consolidates commonly needed includes for interface +// header files and provides essential types required in most files. +// +// Avoid adding additional includes here unless absolutely necessary, +// as it may pollute the global namespace across the project. + +#include +#include +#include + +#include "secbool.h" + +#endif // TREZOR_TYPES_H diff --git a/core/embed/models/trezor_bsp.h b/core/embed/models/trezor_bsp.h new file mode 100644 index 00000000000..d2e220c7941 --- /dev/null +++ b/core/embed/models/trezor_bsp.h @@ -0,0 +1,36 @@ +/* + * This file is part of the Trezor project, https://trezor.io/ + * + * Copyright (c) SatoshiLabs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef TREZOR_BSP_H +#define TREZOR_BSP_H + +// Trezor 'board support package' (BSP) header file that includes +// all necessary headers for the specific board including STM32 HAL and +// pin definitions. +// +// This file should be only included by driver implementations and +// should not be included by application code. + +#include TREZOR_BOARD + +#ifndef TREZOR_EMULATOR +#include STM32_HAL_H +#endif + +#endif // TREZOR_BOARD_H diff --git a/core/embed/models/model.h b/core/embed/models/trezor_model.h similarity index 100% rename from core/embed/models/model.h rename to core/embed/models/trezor_model.h diff --git a/core/embed/prodtest/main.c b/core/embed/prodtest/main.c index 5ced4334263..cbd888477ba 100644 --- a/core/embed/prodtest/main.c +++ b/core/embed/prodtest/main.c @@ -17,17 +17,17 @@ * along with this program. If not, see . */ +#include // required by #ifdef STM32U5 below (see #4306 issue) +#include +#include + #include #include -#include #include -#include STM32_HAL_H - #include "board_capabilities.h" #include "bootutils.h" #include "button.h" -#include "common.h" #include "display.h" #include "display_draw.h" #include "display_utils.h" @@ -35,15 +35,14 @@ #include "flash_otp.h" #include "fwutils.h" #include "image.h" -#include "model.h" #include "mpu.h" #include "prodtest_common.h" #include "random_delays.h" #include "rsod.h" #include "sbu.h" #include "sdcard.h" -#include "secbool.h" #include "system.h" +#include "systick.h" #include "systimer.h" #include "touch.h" #include "usb.h" @@ -246,13 +245,13 @@ static void test_display(const char *colors) { static secbool test_btn_press(uint32_t deadline, uint32_t btn) { while (button_read() != (btn | BTN_EVT_DOWN)) { - if (HAL_GetTick() > deadline) { + if (systick_ms() > deadline) { vcp_println("ERROR TIMEOUT"); return secfalse; } } while (button_read() != (btn | BTN_EVT_UP)) { - if (HAL_GetTick() > deadline) { + if (systick_ms() > deadline) { vcp_println("ERROR TIMEOUT"); return secfalse; } @@ -281,7 +280,7 @@ static secbool test_btn_all(uint32_t deadline) { if (left_pressed && right_pressed) { break; } - if (HAL_GetTick() > deadline) { + if (systick_ms() > deadline) { vcp_println("ERROR TIMEOUT"); return secfalse; } @@ -304,7 +303,7 @@ static secbool test_btn_all(uint32_t deadline) { if (!left_pressed && !right_pressed) { break; } - if (HAL_GetTick() > deadline) { + if (systick_ms() > deadline) { vcp_println("ERROR TIMEOUT"); return secfalse; } @@ -317,21 +316,21 @@ static void test_button(const char *args) { if (startswith(args, "LEFT ")) { timeout = args[5] - '0'; - uint32_t deadline = HAL_GetTick() + timeout * 1000; + uint32_t deadline = systick_ms() + timeout * 1000; secbool r = test_btn_press(deadline, BTN_LEFT); if (r == sectrue) vcp_println("OK"); } if (startswith(args, "RIGHT ")) { timeout = args[6] - '0'; - uint32_t deadline = HAL_GetTick() + timeout * 1000; + uint32_t deadline = systick_ms() + timeout * 1000; secbool r = test_btn_press(deadline, BTN_RIGHT); if (r == sectrue) vcp_println("OK"); } if (startswith(args, "BOTH ")) { timeout = args[5] - '0'; - uint32_t deadline = HAL_GetTick() + timeout * 1000; + uint32_t deadline = systick_ms() + timeout * 1000; secbool r = test_btn_all(deadline); if (r == sectrue) vcp_println("OK"); } @@ -341,16 +340,16 @@ static void test_button(const char *args) { #ifdef USE_TOUCH static secbool touch_click_timeout(uint32_t *touch, uint32_t timeout_ms) { - uint32_t deadline = HAL_GetTick() + timeout_ms; + uint32_t deadline = systick_ms() + timeout_ms; uint32_t r = 0; while (touch_get_event()) ; while ((touch_get_event() & TOUCH_START) == 0) { - if (HAL_GetTick() > deadline) return secfalse; + if (systick_ms() > deadline) return secfalse; } while (((r = touch_get_event()) & TOUCH_END) == 0) { - if (HAL_GetTick() > deadline) return secfalse; + if (systick_ms() > deadline) return secfalse; } while (touch_get_event()) ; @@ -608,7 +607,7 @@ static void test_sd(void) { vcp_println("ERROR sdcard_write_blocks (%d)", j); goto power_off; } - HAL_Delay(1000); + systick_delay_ms(1000); if (sectrue != sdcard_read_blocks(buf2, 0, BLOCK_SIZE / SDCARD_BLOCK_SIZE)) { vcp_println("ERROR sdcard_read_blocks (%d)", j); @@ -807,11 +806,15 @@ static void test_otp_write_device_variant(const char *args) { static void test_reboot(void) { reboot_device(); } void cpuid_read(void) { + mpu_mode_t mpu_mode = mpu_reconfig(MPU_MODE_OTP); + uint32_t cpuid[3]; cpuid[0] = LL_GetUID_Word0(); cpuid[1] = LL_GetUID_Word1(); cpuid[2] = LL_GetUID_Word2(); + mpu_restore(mpu_mode); + vcp_print("OK "); vcp_println_hex((uint8_t *)cpuid, sizeof(cpuid)); } diff --git a/core/embed/prodtest/optiga_prodtest.c b/core/embed/prodtest/optiga_prodtest.c index 577fb1fec0a..a05484aebff 100644 --- a/core/embed/prodtest/optiga_prodtest.c +++ b/core/embed/prodtest/optiga_prodtest.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include +#include #include "aes/aes.h" #include "buffer.h" @@ -33,8 +33,6 @@ #include "secret.h" #include "sha2.h" -#include TREZOR_BOARD - #ifdef USE_STORAGE_HWKEY #include "secure_aes.h" #endif diff --git a/core/embed/prodtest/optiga_prodtest.h b/core/embed/prodtest/optiga_prodtest.h index 375d642f0dc..135403b5656 100644 --- a/core/embed/prodtest/optiga_prodtest.h +++ b/core/embed/prodtest/optiga_prodtest.h @@ -20,9 +20,7 @@ #ifndef PRODTEST_OPTIGA_PRODTEST_H #define PRODTEST_OPTIGA_PRODTEST_H -#include -#include -#include +#include #define OID_CERT_INF (OPTIGA_OID_CERT + 0) #define OID_CERT_DEV (OPTIGA_OID_CERT + 1) diff --git a/core/embed/prodtest/prodtest_common.h b/core/embed/prodtest/prodtest_common.h index 221e16cd6bb..4c5fdb9e8f3 100644 --- a/core/embed/prodtest/prodtest_common.h +++ b/core/embed/prodtest/prodtest_common.h @@ -20,8 +20,7 @@ #ifndef PRODTEST_COMMON_H #define PRODTEST_COMMON_H -#include -#include +#include enum { VCP_IFACE = 0x00 }; diff --git a/core/embed/reflash/main.c b/core/embed/reflash/main.c index 0e7ef455802..851834df9be 100644 --- a/core/embed/reflash/main.c +++ b/core/embed/reflash/main.c @@ -17,24 +17,18 @@ * along with this program. If not, see . */ -#include -#include -#include - -#include STM32_HAL_H +#include +#include #include "bootutils.h" -#include "common.h" #include "display.h" #include "display_draw.h" #include "flash.h" #include "image.h" -#include "model.h" #include "rng.h" #include "rsod.h" #include "sbu.h" #include "sdcard.h" -#include "secbool.h" #include "system.h" #include "systimer.h" #include "terminal.h" diff --git a/core/embed/rust/rust_ui.h b/core/embed/rust/rust_ui.h index 897c6a33118..8a736eb04e9 100644 --- a/core/embed/rust/rust_ui.h +++ b/core/embed/rust/rust_ui.h @@ -1,6 +1,2 @@ -#include - -#include "common.h" - #include "rust_ui_bootloader.h" #include "rust_ui_common.h" diff --git a/core/embed/rust/rust_ui_bootloader.h b/core/embed/rust/rust_ui_bootloader.h index cdddb96a514..b0b4c223229 100644 --- a/core/embed/rust/rust_ui_bootloader.h +++ b/core/embed/rust/rust_ui_bootloader.h @@ -1,4 +1,4 @@ -#include "common.h" +#include uint32_t screen_install_confirm(const char* vendor_str, uint8_t vendor_str_len, const char* version_str, diff --git a/core/embed/rust/rust_ui_common.h b/core/embed/rust/rust_ui_common.h index 6c8a8b7dec0..b3af726a141 100644 --- a/core/embed/rust/rust_ui_common.h +++ b/core/embed/rust/rust_ui_common.h @@ -1,4 +1,4 @@ -#include "common.h" +#include void display_rsod_rust(const char* title, const char* message, const char* footer); diff --git a/core/embed/rust/trezorhal.h b/core/embed/rust/trezorhal.h index 48ab14222f9..014be2bd4aa 100644 --- a/core/embed/rust/trezorhal.h +++ b/core/embed/rust/trezorhal.h @@ -1,8 +1,7 @@ -#include TREZOR_BOARD +#include #include "buffers.h" #include "button.h" -#include "common.h" #include "display.h" #include "display_draw.h" #include "dma2d.h" @@ -12,10 +11,10 @@ #include "fonts/fonts.h" #include "gfx_bitblt.h" #include "haptic.h" -#include "model.h" #include "rgb_led.h" #include "secbool.h" #include "storage.h" +#include "systick.h" #include "touch.h" #include "translations.h" #include "usb.h" diff --git a/core/embed/trezorhal/applet.h b/core/embed/trezorhal/applet.h index 72f859cd706..a7fc04f8875 100644 --- a/core/embed/trezorhal/applet.h +++ b/core/embed/trezorhal/applet.h @@ -20,8 +20,7 @@ #ifndef TREZORHAL_APPLET_H #define TREZORHAL_APPLET_H -#include -#include +#include #ifdef SYSCALL_DISPATCH diff --git a/core/embed/trezorhal/bg_copy.h b/core/embed/trezorhal/bg_copy.h index dac9383d79d..8326f0254e9 100644 --- a/core/embed/trezorhal/bg_copy.h +++ b/core/embed/trezorhal/bg_copy.h @@ -2,9 +2,7 @@ #ifndef TREZORHAL_BG_COPY_H #define TREZORHAL_BG_COPY_H -#include -#include -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/board_capabilities.h b/core/embed/trezorhal/board_capabilities.h index 8d1bf43a9bf..184aaecde90 100644 --- a/core/embed/trezorhal/board_capabilities.h +++ b/core/embed/trezorhal/board_capabilities.h @@ -33,7 +33,7 @@ Simple key-tag-length-value structure at fixed boardloader address. Last tag must be terminator or all space used. */ -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/bootargs.h b/core/embed/trezorhal/bootargs.h index 1cfc5b97e8c..422fee0e47d 100644 --- a/core/embed/trezorhal/bootargs.h +++ b/core/embed/trezorhal/bootargs.h @@ -20,8 +20,7 @@ #ifndef TREZORHAL_BOOTARGS_H #define TREZORHAL_BOOTARGS_H -#include -#include +#include // Defines boot command processed in bootloader on next reboot typedef enum { diff --git a/core/embed/trezorhal/bootutils.h b/core/embed/trezorhal/bootutils.h index 683d2fae420..10b069e9137 100644 --- a/core/embed/trezorhal/bootutils.h +++ b/core/embed/trezorhal/bootutils.h @@ -20,8 +20,7 @@ #ifndef TREZORHAL_BOOTUTILS_H #define TREZORHAL_BOOTUTILS_H -#include -#include +#include // Immediately resets the device and initiates the normal boot sequence. void __attribute__((noreturn)) reboot_device(void); diff --git a/core/embed/trezorhal/button.h b/core/embed/trezorhal/button.h index fa54013bcb3..0f77b436baa 100644 --- a/core/embed/trezorhal/button.h +++ b/core/embed/trezorhal/button.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_BUTTON_H #define TREZORHAL_BUTTON_H -#include +#include #define BTN_EVT_DOWN (1U << 24) #define BTN_EVT_UP (1U << 25) diff --git a/core/embed/trezorhal/display.h b/core/embed/trezorhal/display.h index 34def49aa44..98afdf4fbcc 100644 --- a/core/embed/trezorhal/display.h +++ b/core/embed/trezorhal/display.h @@ -24,10 +24,8 @@ #include #else -#include -#include "common.h" - -#include TREZOR_BOARD +#include +#include #ifdef DISPLAY_LEGACY_HEADER #include DISPLAY_LEGACY_HEADER diff --git a/core/embed/trezorhal/dma2d.h b/core/embed/trezorhal/dma2d.h index 3f8d8f79b98..642e9e9ec4b 100644 --- a/core/embed/trezorhal/dma2d.h +++ b/core/embed/trezorhal/dma2d.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_DMA2D_H #define TREZORHAL_DMA2D_H -#include "common.h" +#include void dma2d_init(void); diff --git a/core/embed/trezorhal/entropy.h b/core/embed/trezorhal/entropy.h index c71d0aab4f0..290c2a11624 100644 --- a/core/embed/trezorhal/entropy.h +++ b/core/embed/trezorhal/entropy.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_ENTROPY_H #define TREZORHAL_ENTROPY_H -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/flash.h b/core/embed/trezorhal/flash.h index efcc610c373..0aeafae0be6 100644 --- a/core/embed/trezorhal/flash.h +++ b/core/embed/trezorhal/flash.h @@ -20,11 +20,9 @@ #ifndef TREZORHAL_FLASH_H #define TREZORHAL_FLASH_H -#include -#include +#include #include "flash_ll.h" -#include "secbool.h" void flash_init(void); diff --git a/core/embed/trezorhal/flash_otp.h b/core/embed/trezorhal/flash_otp.h index 56d05a237a2..e1003b36091 100644 --- a/core/embed/trezorhal/flash_otp.h +++ b/core/embed/trezorhal/flash_otp.h @@ -1,7 +1,7 @@ #ifndef TREZORHAL_FLASH_OTP_H #define TREZORHAL_FLASH_OTP_H -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/fwutils.h b/core/embed/trezorhal/fwutils.h index f29bc5ff638..69c77a2f2ca 100644 --- a/core/embed/trezorhal/fwutils.h +++ b/core/embed/trezorhal/fwutils.h @@ -20,9 +20,7 @@ #ifndef TREZORHAL_FWUTILS_H #define TREZORHAL_FWUTILS_H -#include - -#include "secbool.h" +#include // Callback function for firmware hash calculation. typedef void (*firmware_hash_callback_t)(void* context, uint32_t progress, diff --git a/core/embed/trezorhal/haptic.h b/core/embed/trezorhal/haptic.h index 6cb60ee9bbf..b6e1e26e3d1 100644 --- a/core/embed/trezorhal/haptic.h +++ b/core/embed/trezorhal/haptic.h @@ -20,8 +20,7 @@ #ifndef TREZORHAL_HAPTIC_H #define TREZORHAL_HAPTIC_H -#include -#include +#include typedef enum { // Effect at the start of a button press diff --git a/core/embed/trezorhal/hash_processor.h b/core/embed/trezorhal/hash_processor.h index c7a84a4e685..3a7c6ddf9b9 100644 --- a/core/embed/trezorhal/hash_processor.h +++ b/core/embed/trezorhal/hash_processor.h @@ -1,7 +1,7 @@ #ifndef TREZORHAL_HASH_PROCESSOR_H_ #define TREZORHAL_HASH_PROCESSOR_H_ -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/i2c_bus.h b/core/embed/trezorhal/i2c_bus.h index 2296a4d2c4d..9163218b4a6 100644 --- a/core/embed/trezorhal/i2c_bus.h +++ b/core/embed/trezorhal/i2c_bus.h @@ -20,9 +20,7 @@ #ifndef TREZORHAL_I2C_BUS_H #define TREZORHAL_I2C_BUS_H -#include -#include -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/monoctr.h b/core/embed/trezorhal/monoctr.h index e6394583f11..df6bd72032a 100644 --- a/core/embed/trezorhal/monoctr.h +++ b/core/embed/trezorhal/monoctr.h @@ -22,13 +22,12 @@ #ifdef KERNEL_MODE +#include + // Monoctr module provides monotonic counter functionality #define MONOCTR_MAX_VALUE 63 -#include -#include "secbool.h" - typedef enum { MONOCTR_BOOTLOADER_VERSION = 0, MONOCTR_FIRMWARE_VERSION = 1, diff --git a/core/embed/trezorhal/mpu.h b/core/embed/trezorhal/mpu.h index 657d311356e..dfe887b1470 100644 --- a/core/embed/trezorhal/mpu.h +++ b/core/embed/trezorhal/mpu.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_MPU_H #define TREZORHAL_MPU_H -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/optiga.h b/core/embed/trezorhal/optiga.h index b3a133a6297..1195a0b2454 100644 --- a/core/embed/trezorhal/optiga.h +++ b/core/embed/trezorhal/optiga.h @@ -20,9 +20,8 @@ #ifndef TREZORHAL_OPTIGA_H #define TREZORHAL_OPTIGA_H -#include -#include -#include +#include + #include "optiga_common.h" #include "storage.h" diff --git a/core/embed/trezorhal/optiga/optiga.c b/core/embed/trezorhal/optiga/optiga.c index d4fa2e2391a..b7ad7154dff 100644 --- a/core/embed/trezorhal/optiga/optiga.c +++ b/core/embed/trezorhal/optiga/optiga.c @@ -17,11 +17,12 @@ * along with this program. If not, see . */ -#include "optiga.h" -#include +#include + #include "hash_to_curve.h" #include "hmac.h" #include "memzero.h" +#include "optiga.h" #include "optiga_commands.h" #include "optiga_transport.h" #include "rand.h" diff --git a/core/embed/trezorhal/optiga/optiga_commands.c b/core/embed/trezorhal/optiga/optiga_commands.c index 1041adc887c..e25f5b7ccaa 100644 --- a/core/embed/trezorhal/optiga/optiga_commands.c +++ b/core/embed/trezorhal/optiga/optiga_commands.c @@ -23,13 +23,14 @@ * https://github.com/Infineon/optiga-trust-m/blob/develop/documents/Infineon_I2C_Protocol_v2.03.pdf */ -#include "optiga_commands.h" -#include +#include + #include "der.h" #include "ecdsa.h" #include "hmac.h" #include "memzero.h" #include "nist256p1.h" +#include "optiga_commands.h" #include "optiga_transport.h" #include "sha2.h" diff --git a/core/embed/trezorhal/optiga/optiga_transport.c b/core/embed/trezorhal/optiga/optiga_transport.c index 3ac1d820541..5a1413ea18c 100644 --- a/core/embed/trezorhal/optiga/optiga_transport.c +++ b/core/embed/trezorhal/optiga/optiga_transport.c @@ -22,19 +22,19 @@ * https://github.com/Infineon/optiga-trust-m/blob/develop/documents/Infineon_I2C_Protocol_v2.03.pdf */ -#include "optiga_transport.h" -#include +#include +#include + #include "aes/aesccm.h" -#include "common.h" #include "i2c_bus.h" #include "memzero.h" #include "optiga_hal.h" +#include "optiga_transport.h" +#include "systick.h" #include "tls_prf.h" #ifdef KERNEL_MODE -#include TREZOR_BOARD - // Maximum possible packet size that can be transmitted. #define OPTIGA_MAX_PACKET_SIZE (OPTIGA_DATA_REG_LEN - 5) diff --git a/core/embed/trezorhal/optiga_commands.h b/core/embed/trezorhal/optiga_commands.h index 61cd7d949fa..5fbaecb54bc 100644 --- a/core/embed/trezorhal/optiga_commands.h +++ b/core/embed/trezorhal/optiga_commands.h @@ -20,9 +20,8 @@ #ifndef TREZORHAL_OPTIGA_COMMANDS_H #define TREZORHAL_OPTIGA_COMMANDS_H -#include -#include -#include +#include + #include "optiga_common.h" // Data object identifiers. diff --git a/core/embed/trezorhal/optiga_common.h b/core/embed/trezorhal/optiga_common.h index 21d74aed689..6447e7ca1f9 100644 --- a/core/embed/trezorhal/optiga_common.h +++ b/core/embed/trezorhal/optiga_common.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_OPTIGA_COMMON_H #define TREZORHAL_OPTIGA_COMMON_H -#include "secbool.h" +#include typedef enum _optiga_result { OPTIGA_SUCCESS = 0, // Operation completed successfully. diff --git a/core/embed/trezorhal/optiga_hal.h b/core/embed/trezorhal/optiga_hal.h index e91bc03e2dd..c744c1c09b2 100644 --- a/core/embed/trezorhal/optiga_hal.h +++ b/core/embed/trezorhal/optiga_hal.h @@ -2,8 +2,7 @@ #ifndef CORE_OPTIGA_HAL_H #define CORE_OPTIGA_HAL_H -#include -#include "secbool.h" +#include void optiga_hal_init(void); diff --git a/core/embed/trezorhal/optiga_transport.h b/core/embed/trezorhal/optiga_transport.h index 041c88250b9..3d9b914f9c9 100644 --- a/core/embed/trezorhal/optiga_transport.h +++ b/core/embed/trezorhal/optiga_transport.h @@ -20,9 +20,8 @@ #ifndef TREZORHAL_OPTIGA_TRANSPORT_H #define TREZORHAL_OPTIGA_TRANSPORT_H -#include -#include -#include +#include + #include "optiga_common.h" // Maximum data register length supported by OPTIGA. diff --git a/core/embed/trezorhal/option_bytes.h b/core/embed/trezorhal/option_bytes.h index 802db911ba3..d48900a533c 100644 --- a/core/embed/trezorhal/option_bytes.h +++ b/core/embed/trezorhal/option_bytes.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_OPTION_BYTES_H #define TREZORHAL_OPTION_BYTES_H -#include "secbool.h" +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/random_delays.h b/core/embed/trezorhal/random_delays.h index 46d6e0e482a..0c73f8b9218 100644 --- a/core/embed/trezorhal/random_delays.h +++ b/core/embed/trezorhal/random_delays.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_RANDOM_DELAYS_H #define TREZORHAL_RANDOM_DELAYS_H -#include +#include /* Random delay interrupts (RDI) is a contermeasure against side channel attacks. diff --git a/core/embed/trezorhal/reset_flags.h b/core/embed/trezorhal/reset_flags.h index 52ae40d5571..ed294da9c5d 100644 --- a/core/embed/trezorhal/reset_flags.h +++ b/core/embed/trezorhal/reset_flags.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_RESET_FLAGS_H #define TREZORHAL_RESET_FLAGS_H -#include "secbool.h" +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/rgb_led.h b/core/embed/trezorhal/rgb_led.h index 1ad62d9b80c..65158b54951 100644 --- a/core/embed/trezorhal/rgb_led.h +++ b/core/embed/trezorhal/rgb_led.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_RGB_LED_H #define TREZORHAL_RGB_LED_H -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/rng.h b/core/embed/trezorhal/rng.h index 7c9dc69a18e..4b5dfb85105 100644 --- a/core/embed/trezorhal/rng.h +++ b/core/embed/trezorhal/rng.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_RNG_H #define TREZORHAL_RNG_H -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/sbu.h b/core/embed/trezorhal/sbu.h index fef077954bf..beee6062609 100644 --- a/core/embed/trezorhal/sbu.h +++ b/core/embed/trezorhal/sbu.h @@ -20,7 +20,7 @@ #ifndef __TREZORHAL_SBU_H__ #define __TREZORHAL_SBU_H__ -#include "secbool.h" +#include #if KERNEL_MODE diff --git a/core/embed/trezorhal/sdcard.h b/core/embed/trezorhal/sdcard.h index 730b33210fd..47853c5beca 100644 --- a/core/embed/trezorhal/sdcard.h +++ b/core/embed/trezorhal/sdcard.h @@ -46,8 +46,7 @@ #ifndef __TREZORHAL_SDCARD_H__ #define __TREZORHAL_SDCARD_H__ -#include -#include "secbool.h" +#include // this is a fixed size and should not be changed #define SDCARD_BLOCK_SIZE (512) diff --git a/core/embed/trezorhal/secret.h b/core/embed/trezorhal/secret.h index 5bb457bb6a5..3540ad1a74f 100644 --- a/core/embed/trezorhal/secret.h +++ b/core/embed/trezorhal/secret.h @@ -1,8 +1,7 @@ #ifndef TREZORHAL_SECRET_H #define TREZORHAL_SECRET_H -#include -#include "secbool.h" +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/secure_aes.h b/core/embed/trezorhal/secure_aes.h index 9849e68c037..8819fb0c051 100644 --- a/core/embed/trezorhal/secure_aes.h +++ b/core/embed/trezorhal/secure_aes.h @@ -20,9 +20,7 @@ #ifndef TREZOR_HAL_SECURE_AES_H #define TREZOR_HAL_SECURE_AES_H -#include -#include -#include +#include // only some of the keys are supported depending on execution environment typedef enum { diff --git a/core/embed/trezorhal/stm32f4/applet.c b/core/embed/trezorhal/stm32f4/applet.c index 7d81d066a7c..8945e8a9934 100644 --- a/core/embed/trezorhal/stm32f4/applet.c +++ b/core/embed/trezorhal/stm32f4/applet.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include +#include #include "applet.h" #include "display.h" diff --git a/core/embed/trezorhal/stm32f4/backlight_pwm.c b/core/embed/trezorhal/stm32f4/backlight_pwm.c index 47d88000b15..8f30ef9b71e 100644 --- a/core/embed/trezorhal/stm32f4/backlight_pwm.c +++ b/core/embed/trezorhal/stm32f4/backlight_pwm.c @@ -17,14 +17,11 @@ * along with this program. If not, see . */ -#include -#include +#include +#include #include "backlight_pwm.h" -#include "common.h" - -#include STM32_HAL_H -#include TREZOR_BOARD +#include "systick.h" // Requested PWM Timer clock frequency [Hz] #define TIM_FREQ 10000000 diff --git a/core/embed/trezorhal/stm32f4/board_capabilities.c b/core/embed/trezorhal/stm32f4/board_capabilities.c index 4cdcbf69994..509d7618c82 100644 --- a/core/embed/trezorhal/stm32f4/board_capabilities.c +++ b/core/embed/trezorhal/stm32f4/board_capabilities.c @@ -17,11 +17,10 @@ * along with this program. If not, see . */ -#include +#include +#include #include "board_capabilities.h" -#include "common.h" -#include "model.h" #include "mpu.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/bootutils.c b/core/embed/trezorhal/stm32f4/bootutils.c index f9bd6bb1a91..602aa0c23cd 100644 --- a/core/embed/trezorhal/stm32f4/bootutils.c +++ b/core/embed/trezorhal/stm32f4/bootutils.c @@ -17,17 +17,15 @@ * along with this program. If not, see . */ -#include STM32_HAL_H - -#include +#include +#include +#include #include "bootargs.h" #include "bootutils.h" -#include "common.h" #include "display.h" #include "image.h" #include "irq.h" -#include "model.h" #include "mpu.h" #ifdef TREZOR_MODEL_T diff --git a/core/embed/trezorhal/stm32f4/button.c b/core/embed/trezorhal/stm32f4/button.c index 544b8ba4824..66676aa4656 100644 --- a/core/embed/trezorhal/stm32f4/button.c +++ b/core/embed/trezorhal/stm32f4/button.c @@ -1,6 +1,8 @@ -#include STM32_HAL_H + +#include +#include + #include "button.h" -#include TREZOR_BOARD #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/consumption_mask.c b/core/embed/trezorhal/stm32f4/consumption_mask.c index 7263377d722..085961eeb3a 100644 --- a/core/embed/trezorhal/stm32f4/consumption_mask.c +++ b/core/embed/trezorhal/stm32f4/consumption_mask.c @@ -17,7 +17,9 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include +#include + #include "mpu.h" #include "rng.h" diff --git a/core/embed/trezorhal/stm32f4/displays/ili9341_spi.c b/core/embed/trezorhal/stm32f4/displays/ili9341_spi.c index 50a1f228c04..1b317c67528 100644 --- a/core/embed/trezorhal/stm32f4/displays/ili9341_spi.c +++ b/core/embed/trezorhal/stm32f4/displays/ili9341_spi.c @@ -1,9 +1,9 @@ -#include -#include TREZOR_BOARD +#include +#include + #include "ili9341_spi.h" -#include STM32_HAL_H /** * @brief ILI9341 chip IDs diff --git a/core/embed/trezorhal/stm32f4/displays/ltdc.c b/core/embed/trezorhal/stm32f4/displays/ltdc.c index 515106e74ab..24b54960a0f 100644 --- a/core/embed/trezorhal/stm32f4/displays/ltdc.c +++ b/core/embed/trezorhal/stm32f4/displays/ltdc.c @@ -17,13 +17,12 @@ * along with this program. If not, see . */ -#include -#include TREZOR_BOARD -#include "display.h" -#include "memzero.h" -#include STM32_HAL_H +#include +#include +#include "display.h" #include "ili9341_spi.h" +#include "memzero.h" #include "sdram.h" #define MAX_LAYER_NUMBER 2 diff --git a/core/embed/trezorhal/stm32f4/displays/ltdc.h b/core/embed/trezorhal/stm32f4/displays/ltdc.h index b07020a7572..34cb288a783 100644 --- a/core/embed/trezorhal/stm32f4/displays/ltdc.h +++ b/core/embed/trezorhal/stm32f4/displays/ltdc.h @@ -2,7 +2,7 @@ #ifndef _LTDC_H #define _LTDC_H -#include STM32_HAL_H +#include #define DISPLAY_FRAMEBUFFER_WIDTH DISPLAY_RESX #define DISPLAY_FRAMEBUFFER_HEIGHT DISPLAY_RESY diff --git a/core/embed/trezorhal/stm32f4/displays/st7789v.c b/core/embed/trezorhal/stm32f4/displays/st7789v.c index 5e27ea1c8f2..47c98c4972c 100644 --- a/core/embed/trezorhal/stm32f4/displays/st7789v.c +++ b/core/embed/trezorhal/stm32f4/displays/st7789v.c @@ -17,16 +17,14 @@ * along with this program. If not, see . */ -#include -#include -#include -#include TREZOR_BOARD +#include +#include + #include "backlight_pwm.h" #include "display.h" #include "irq.h" #include "memzero.h" #include "st7789v.h" -#include STM32_HAL_H #ifdef TREZOR_MODEL_T #include "displays/panels/154a.h" diff --git a/core/embed/trezorhal/stm32f4/displays/st7789v.h b/core/embed/trezorhal/stm32f4/displays/st7789v.h index 17b9ece346e..38851867deb 100644 --- a/core/embed/trezorhal/stm32f4/displays/st7789v.h +++ b/core/embed/trezorhal/stm32f4/displays/st7789v.h @@ -1,15 +1,14 @@ #ifndef _ST7789V_H #define _ST7789V_H -#include STM32_HAL_H +#include +#include typedef struct { uint16_t x; uint16_t y; } display_padding_t; -#include TREZOR_BOARD - // 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/trezorhal/stm32f4/displays/ug-2828tswig01.c b/core/embed/trezorhal/stm32f4/displays/ug-2828tswig01.c index 54c602e8000..18a1519065e 100644 --- a/core/embed/trezorhal/stm32f4/displays/ug-2828tswig01.c +++ b/core/embed/trezorhal/stm32f4/displays/ug-2828tswig01.c @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -#include -#include TREZOR_BOARD +#include +#include + #include "display.h" #include "memzero.h" -#include STM32_HAL_H // FSMC/FMC Bank 1 - NOR/PSRAM 1 #define DISPLAY_MEMORY_BASE 0x60000000 diff --git a/core/embed/trezorhal/stm32f4/displays/vg-2864ksweg01.c b/core/embed/trezorhal/stm32f4/displays/vg-2864ksweg01.c index a7166a070f5..c72173f217c 100644 --- a/core/embed/trezorhal/stm32f4/displays/vg-2864ksweg01.c +++ b/core/embed/trezorhal/stm32f4/displays/vg-2864ksweg01.c @@ -17,11 +17,10 @@ * along with this program. If not, see . */ -#include -#include -#include TREZOR_BOARD +#include +#include + #include "display.h" -#include STM32_HAL_H #ifdef USE_CONSUMPTION_MASK #include "consumption_mask.h" diff --git a/core/embed/trezorhal/stm32f4/dma2d.c b/core/embed/trezorhal/stm32f4/dma2d.c index c479d4b4c34..861eadd66ac 100644 --- a/core/embed/trezorhal/stm32f4/dma2d.c +++ b/core/embed/trezorhal/stm32f4/dma2d.c @@ -17,10 +17,11 @@ * along with this program. If not, see . */ -#include "dma2d.h" +#include + #include "colors.h" -#include STM32_HAL_H #include "display.h" +#include "dma2d.h" typedef enum { DMA2D_LAYER_FG = 1, diff --git a/core/embed/trezorhal/stm32f4/dma2d_bitblt.c b/core/embed/trezorhal/stm32f4/dma2d_bitblt.c index 87bc6452f67..3668ba2e0a0 100644 --- a/core/embed/trezorhal/stm32f4/dma2d_bitblt.c +++ b/core/embed/trezorhal/stm32f4/dma2d_bitblt.c @@ -17,9 +17,8 @@ * along with this program. If not, see . */ -#include STM32_HAL_H - -#include +#include +#include #include "dma2d_bitblt.h" #include "gfx_color.h" diff --git a/core/embed/trezorhal/stm32f4/entropy.c b/core/embed/trezorhal/stm32f4/entropy.c index 99fb0d69746..a2ce11ea772 100644 --- a/core/embed/trezorhal/stm32f4/entropy.c +++ b/core/embed/trezorhal/stm32f4/entropy.c @@ -17,13 +17,11 @@ * along with this program. If not, see . */ -#include - -#include "entropy.h" +#include +#include #include "entropy.h" #include "flash_otp.h" -#include "model.h" #include "mpu.h" #include "rand.h" diff --git a/core/embed/trezorhal/stm32f4/flash.c b/core/embed/trezorhal/stm32f4/flash.c index 5a0b2c5cb4d..42e78d62da0 100644 --- a/core/embed/trezorhal/stm32f4/flash.c +++ b/core/embed/trezorhal/stm32f4/flash.c @@ -17,11 +17,9 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include +#include -#include - -#include "common.h" #include "flash.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/flash_otp.c b/core/embed/trezorhal/stm32f4/flash_otp.c index 6260426994e..10226edb423 100644 --- a/core/embed/trezorhal/stm32f4/flash_otp.c +++ b/core/embed/trezorhal/stm32f4/flash_otp.c @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include +#include -#include "flash_otp.h" -#include "common.h" #include "flash.h" +#include "flash_otp.h" #include "mpu.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/fwutils.c b/core/embed/trezorhal/stm32f4/fwutils.c index 72172f23960..cd5fd055e47 100644 --- a/core/embed/trezorhal/stm32f4/fwutils.c +++ b/core/embed/trezorhal/stm32f4/fwutils.c @@ -17,19 +17,15 @@ * along with this program. If not, see . */ -#ifndef TREZOR_EMULATOR -#include STM32_HAL_H -#endif - -#include +#include +#include +#include #include "blake2s.h" -#include "error_handling.h" #include "flash.h" #include "flash_area.h" #include "fwutils.h" #include "image.h" -#include "model.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/i2c_bus.c b/core/embed/trezorhal/stm32f4/i2c_bus.c index 5e407e0291d..dc9136cce7d 100644 --- a/core/embed/trezorhal/stm32f4/i2c_bus.c +++ b/core/embed/trezorhal/stm32f4/i2c_bus.c @@ -17,16 +17,14 @@ * along with this program. If not, see . */ -#include STM32_HAL_H -#include TREZOR_BOARD +#include +#include -#include - -#include "common.h" #include "i2c_bus.h" #include "irq.h" #include "mpu.h" #include "systemview.h" +#include "systick.h" #include "systimer.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/irq.h b/core/embed/trezorhal/stm32f4/irq.h index 525bb92043e..fda030524f1 100644 --- a/core/embed/trezorhal/stm32f4/irq.h +++ b/core/embed/trezorhal/stm32f4/irq.h @@ -20,8 +20,8 @@ #ifndef TREZORHAL_IRQ_H #define TREZORHAL_IRQ_H -#include STM32_HAL_H -#include +#include +#include // Enables simple IRQ statistics for debugging #define IRQ_ENABLE_STATS (0) diff --git a/core/embed/trezorhal/stm32f4/layout.c b/core/embed/trezorhal/stm32f4/layout.c index 12c2a9530c0..75f6bb30842 100644 --- a/core/embed/trezorhal/stm32f4/layout.c +++ b/core/embed/trezorhal/stm32f4/layout.c @@ -17,13 +17,11 @@ * along with this program. If not, see . */ -#ifndef TREZOR_EMULATOR -#include STM32_HAL_H -#endif +#include +#include #include "flash.h" #include "layout_helpers.h" -#include "model.h" // Convert sector number to address // diff --git a/core/embed/trezorhal/stm32f4/monoctr.c b/core/embed/trezorhal/stm32f4/monoctr.c index 119b2070bf8..554255e5a3f 100644 --- a/core/embed/trezorhal/stm32f4/monoctr.c +++ b/core/embed/trezorhal/stm32f4/monoctr.c @@ -17,11 +17,12 @@ * along with this program. If not, see . */ -#include "monoctr.h" +#include +#include + #include "flash_otp.h" -#include "model.h" +#include "monoctr.h" #include "mpu.h" -#include "string.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/mpu.c b/core/embed/trezorhal/stm32f4/mpu.c index 230c5d625c8..6fb954a01ce 100644 --- a/core/embed/trezorhal/stm32f4/mpu.c +++ b/core/embed/trezorhal/stm32f4/mpu.c @@ -17,14 +17,11 @@ * along with this program. If not, see . */ -#include STM32_HAL_H -#include TREZOR_BOARD - -#include -#include +#include +#include +#include #include "irq.h" -#include "model.h" #include "mpu.h" #include "stm32f4xx_ll_cortex.h" diff --git a/core/embed/trezorhal/stm32f4/optiga_hal.c b/core/embed/trezorhal/stm32f4/optiga_hal.c index b1d60acfa53..e1efb966511 100644 --- a/core/embed/trezorhal/stm32f4/optiga_hal.c +++ b/core/embed/trezorhal/stm32f4/optiga_hal.c @@ -1,7 +1,8 @@ +#include +#include + #include "optiga_hal.h" -#include "common.h" -#include TREZOR_BOARD -#include STM32_HAL_H +#include "systick.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/option_bytes.c b/core/embed/trezorhal/stm32f4/option_bytes.c index be42e799adf..03707c25fb2 100644 --- a/core/embed/trezorhal/stm32f4/option_bytes.c +++ b/core/embed/trezorhal/stm32f4/option_bytes.c @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include -#include "option_bytes.h" #include "flash_otp.h" #include "mpu.h" +#include "option_bytes.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/pvd.c b/core/embed/trezorhal/stm32f4/pvd.c index 0f74ff9536a..5db6c32e657 100644 --- a/core/embed/trezorhal/stm32f4/pvd.c +++ b/core/embed/trezorhal/stm32f4/pvd.c @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD -#include STM32_HAL_H +#include +#include #include "bootutils.h" #include "irq.h" diff --git a/core/embed/trezorhal/stm32f4/random_delays.c b/core/embed/trezorhal/stm32f4/random_delays.c index 3861c1f8d82..0b3e25021f8 100644 --- a/core/embed/trezorhal/stm32f4/random_delays.c +++ b/core/embed/trezorhal/stm32f4/random_delays.c @@ -17,15 +17,14 @@ * along with this program. If not, see . */ -#include "random_delays.h" +#include #include -#include #include "chacha_drbg.h" -#include "common.h" #include "memzero.h" #include "rand.h" +#include "random_delays.h" #include "systimer.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/reset_flags.c b/core/embed/trezorhal/stm32f4/reset_flags.c index ce4a664b936..2525973c89b 100644 --- a/core/embed/trezorhal/stm32f4/reset_flags.c +++ b/core/embed/trezorhal/stm32f4/reset_flags.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include #include "reset_flags.h" diff --git a/core/embed/trezorhal/stm32f4/rgb_led.c b/core/embed/trezorhal/stm32f4/rgb_led.c index 8d0fbd37990..2eeca39630a 100644 --- a/core/embed/trezorhal/stm32f4/rgb_led.c +++ b/core/embed/trezorhal/stm32f4/rgb_led.c @@ -37,12 +37,11 @@ * bit is sent. */ -#include "common.h" +#include +#include #ifdef KERNEL_MODE -#include STM32_HAL_H - #define RESET_DATA_LEN 18 // >80us no pulse before sending data #define DATA_LEN 25 // 24 RGB bits and a final zero #define TIMER_PERIOD 832 // cca 200 KHz @ 180MHz diff --git a/core/embed/trezorhal/stm32f4/rng.c b/core/embed/trezorhal/stm32f4/rng.c index a6ae2b57c3c..ebc1dc73bb9 100644 --- a/core/embed/trezorhal/stm32f4/rng.c +++ b/core/embed/trezorhal/stm32f4/rng.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include #include "rng.h" diff --git a/core/embed/trezorhal/stm32f4/sbu.c b/core/embed/trezorhal/stm32f4/sbu.c index 0756c9e9e86..0ef93273b81 100644 --- a/core/embed/trezorhal/stm32f4/sbu.c +++ b/core/embed/trezorhal/stm32f4/sbu.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include #include "sbu.h" diff --git a/core/embed/trezorhal/stm32f4/sdcard.c b/core/embed/trezorhal/stm32f4/sdcard.c index 386ccef0369..02e01acd4fe 100644 --- a/core/embed/trezorhal/stm32f4/sdcard.c +++ b/core/embed/trezorhal/stm32f4/sdcard.c @@ -43,10 +43,8 @@ * THE SOFTWARE. */ -#include STM32_HAL_H -#include TREZOR_BOARD - -#include +#include +#include #include "irq.h" #include "mpu.h" diff --git a/core/embed/trezorhal/stm32f4/sdram.h b/core/embed/trezorhal/stm32f4/sdram.h index 78b4b6c0ec1..5b3fe48495c 100644 --- a/core/embed/trezorhal/stm32f4/sdram.h +++ b/core/embed/trezorhal/stm32f4/sdram.h @@ -25,7 +25,7 @@ extern "C" { #endif -#include STM32_HAL_H +#include /** @addtogroup BSP * @{ diff --git a/core/embed/trezorhal/stm32f4/secret.c b/core/embed/trezorhal/stm32f4/secret.c index de6dd3297ac..c2e6152e166 100644 --- a/core/embed/trezorhal/stm32f4/secret.c +++ b/core/embed/trezorhal/stm32f4/secret.c @@ -1,10 +1,10 @@ -#include "secret.h" -#include -#include "common.h" +#include +#include + #include "display_draw.h" #include "flash.h" -#include "model.h" #include "mpu.h" +#include "secret.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/startup_init.c b/core/embed/trezorhal/stm32f4/startup_init.c index 9b2d4be9861..7f7aae0d6da 100644 --- a/core/embed/trezorhal/stm32f4/startup_init.c +++ b/core/embed/trezorhal/stm32f4/startup_init.c @@ -17,12 +17,12 @@ * along with this program. If not, see . */ -#include STM32_HAL_H -#include TREZOR_BOARD +#include +#include -#include "startup_init.h" #include "bootutils.h" #include "rng.h" +#include "startup_init.h" #include "systick.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/syscall.h b/core/embed/trezorhal/stm32f4/syscall.h index 944cd2981df..aafdbc8f3f8 100644 --- a/core/embed/trezorhal/stm32f4/syscall.h +++ b/core/embed/trezorhal/stm32f4/syscall.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_SYSCALL_H #define TREZORHAL_SYSCALL_H -#include +#include #include "applet.h" #include "syscall_numbers.h" diff --git a/core/embed/trezorhal/stm32f4/syscall_dispatch.c b/core/embed/trezorhal/stm32f4/syscall_dispatch.c index f0bb5f92f77..9f61e417164 100644 --- a/core/embed/trezorhal/stm32f4/syscall_dispatch.c +++ b/core/embed/trezorhal/stm32f4/syscall_dispatch.c @@ -17,9 +17,7 @@ * along with this program. If not, see . */ -#include STM32_HAL_H - -#include TREZOR_BOARD +#include #include "syscall.h" diff --git a/core/embed/trezorhal/stm32f4/syscall_probe.c b/core/embed/trezorhal/stm32f4/syscall_probe.c index 525b396a1d2..6194c82eef0 100644 --- a/core/embed/trezorhal/stm32f4/syscall_probe.c +++ b/core/embed/trezorhal/stm32f4/syscall_probe.c @@ -17,9 +17,10 @@ * along with this program. If not, see . */ -#include "syscall_probe.h" +#include + #include "applet.h" -#include "model.h" +#include "syscall_probe.h" #ifdef SYSCALL_DISPATCH diff --git a/core/embed/trezorhal/stm32f4/syscall_probe.h b/core/embed/trezorhal/stm32f4/syscall_probe.h index b3353ef890e..f026d7e12c1 100644 --- a/core/embed/trezorhal/stm32f4/syscall_probe.h +++ b/core/embed/trezorhal/stm32f4/syscall_probe.h @@ -20,8 +20,7 @@ #ifndef TREZORHAL_SYSCALL_PROBE_H #define TREZORHAL_SYSCALL_PROBE_H -#include -#include +#include #include "system.h" diff --git a/core/embed/trezorhal/stm32f4/syscall_verifiers.c b/core/embed/trezorhal/stm32f4/syscall_verifiers.c index 6aaf7da0954..371fdea8ea4 100644 --- a/core/embed/trezorhal/stm32f4/syscall_verifiers.c +++ b/core/embed/trezorhal/stm32f4/syscall_verifiers.c @@ -17,9 +17,8 @@ * along with this program. If not, see . */ -#include +#include -#include "common.h" #include "syscall_probe.h" #include "syscall_verifiers.h" #include "systask.h" diff --git a/core/embed/trezorhal/stm32f4/systask.c b/core/embed/trezorhal/stm32f4/systask.c index 277cb2f406d..720ce6eada4 100644 --- a/core/embed/trezorhal/stm32f4/systask.c +++ b/core/embed/trezorhal/stm32f4/systask.c @@ -17,13 +17,10 @@ * along with this program. If not, see . */ -#include STM32_HAL_H - -#include -#include +#include +#include #include "bootutils.h" -#include "common.h" #include "irq.h" #include "mpu.h" #include "syscall.h" diff --git a/core/embed/trezorhal/stm32f4/system.c b/core/embed/trezorhal/stm32f4/system.c index 1083bf99fc0..1d44175dbda 100644 --- a/core/embed/trezorhal/stm32f4/system.c +++ b/core/embed/trezorhal/stm32f4/system.c @@ -17,9 +17,8 @@ * along with this program. If not, see . */ -#include STM32_HAL_H - -#include +#include +#include #include "bootutils.h" #include "mpu.h" diff --git a/core/embed/trezorhal/stm32f4/systick.c b/core/embed/trezorhal/stm32f4/systick.c index 359f3e27246..790949fbabb 100644 --- a/core/embed/trezorhal/stm32f4/systick.c +++ b/core/embed/trezorhal/stm32f4/systick.c @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#include -#include +#include #include "irq.h" #include "mpu.h" diff --git a/core/embed/trezorhal/stm32f4/systick_internal.h b/core/embed/trezorhal/stm32f4/systick_internal.h index 0f7a9a071ac..1b98fe196e9 100644 --- a/core/embed/trezorhal/stm32f4/systick_internal.h +++ b/core/embed/trezorhal/stm32f4/systick_internal.h @@ -1,7 +1,7 @@ #ifndef TREZORHAL_SYSTICK_INTERNAL_H #define TREZORHAL_SYSTICK_INTERNAL_H -#include +#include #include "systick.h" diff --git a/core/embed/trezorhal/stm32f4/systimer.c b/core/embed/trezorhal/stm32f4/systimer.c index 278958af823..f1215e6b76e 100644 --- a/core/embed/trezorhal/stm32f4/systimer.c +++ b/core/embed/trezorhal/stm32f4/systimer.c @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#include -#include +#include #include "irq.h" #include "systick_internal.h" diff --git a/core/embed/trezorhal/stm32f4/touch/ft6x36.c b/core/embed/trezorhal/stm32f4/touch/ft6x36.c index d6e419c37bd..d28c598b777 100644 --- a/core/embed/trezorhal/stm32f4/touch/ft6x36.c +++ b/core/embed/trezorhal/stm32f4/touch/ft6x36.c @@ -17,19 +17,14 @@ * along with this program. If not, see . */ -#include STM32_HAL_H -#include TREZOR_BOARD +#include +#include #ifdef KERNEL_MODE -#include -#include -#include - -#include "common.h" - #include "ft6x36.h" #include "i2c_bus.h" +#include "systick.h" #include "touch.h" #ifdef TOUCH_PANEL_LX154A2422CPT23 diff --git a/core/embed/trezorhal/stm32f4/touch/panels/lhs200kb-if21.c b/core/embed/trezorhal/stm32f4/touch/panels/lhs200kb-if21.c index 36405ee91af..73553e050d5 100644 --- a/core/embed/trezorhal/stm32f4/touch/panels/lhs200kb-if21.c +++ b/core/embed/trezorhal/stm32f4/touch/panels/lhs200kb-if21.c @@ -18,11 +18,11 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD +#include +#include +#include #include "lx154a2422cpt23.h" - -#include "model.h" #include "touch.h" void lhs200kb_if21_touch_correction(uint16_t x, uint16_t y, uint16_t *x_new, diff --git a/core/embed/trezorhal/stm32f4/touch/panels/lhs200kb-if21.h b/core/embed/trezorhal/stm32f4/touch/panels/lhs200kb-if21.h index 73c53961d10..cbd60d5b3e8 100644 --- a/core/embed/trezorhal/stm32f4/touch/panels/lhs200kb-if21.h +++ b/core/embed/trezorhal/stm32f4/touch/panels/lhs200kb-if21.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_TOUCH_LX154A2422CPT23_H #define TREZORHAL_TOUCH_LX154A2422CPT23_H -#include +#include // Performs touch coordinates correction needed for a specific panel // Input parameteres x, y represent original touch coordinates. diff --git a/core/embed/trezorhal/stm32f4/touch/panels/lx154a2422cpt23.c b/core/embed/trezorhal/stm32f4/touch/panels/lx154a2422cpt23.c index 1f412a0acbc..92bb1c88182 100644 --- a/core/embed/trezorhal/stm32f4/touch/panels/lx154a2422cpt23.c +++ b/core/embed/trezorhal/stm32f4/touch/panels/lx154a2422cpt23.c @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD +#include +#include +#include #include "lx154a2422cpt23.h" - -#include "model.h" #include "touch.h" void lx154a2422cpt23_touch_correction(uint16_t x, uint16_t y, uint16_t *x_new, diff --git a/core/embed/trezorhal/stm32f4/touch/panels/lx154a2422cpt23.h b/core/embed/trezorhal/stm32f4/touch/panels/lx154a2422cpt23.h index bb17bf5d2ac..8d6b0ea3edb 100644 --- a/core/embed/trezorhal/stm32f4/touch/panels/lx154a2422cpt23.h +++ b/core/embed/trezorhal/stm32f4/touch/panels/lx154a2422cpt23.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_TOUCH_LX154A2422CPT23_H #define TREZORHAL_TOUCH_LX154A2422CPT23_H -#include +#include // Performs touch coordinates correction needed for a specific panel // Input parameteres x, y represent original touch coordinates. diff --git a/core/embed/trezorhal/stm32f4/touch/stmpe811.c b/core/embed/trezorhal/stm32f4/touch/stmpe811.c index f3590f07b4a..8e882214b37 100644 --- a/core/embed/trezorhal/stm32f4/touch/stmpe811.c +++ b/core/embed/trezorhal/stm32f4/touch/stmpe811.c @@ -17,16 +17,11 @@ * along with this program. If not, see . */ -#include STM32_HAL_H -#include TREZOR_BOARD +#include +#include #ifdef KERNEL_MODE -#include - -#include "common.h" -#include "secbool.h" - #include "i2c_bus.h" #include "stmpe811.h" #include "touch.h" diff --git a/core/embed/trezorhal/stm32f4/unit_properties.c b/core/embed/trezorhal/stm32f4/unit_properties.c index 276e5994f0c..78f319c4476 100644 --- a/core/embed/trezorhal/stm32f4/unit_properties.c +++ b/core/embed/trezorhal/stm32f4/unit_properties.c @@ -17,12 +17,11 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD - -#include +#include +#include +#include #include "flash_otp.h" -#include "model.h" #include "unit_properties.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/usb/usb.c b/core/embed/trezorhal/stm32f4/usb/usb.c index 4875f34cc00..93dd689b18c 100644 --- a/core/embed/trezorhal/stm32f4/usb/usb.c +++ b/core/embed/trezorhal/stm32f4/usb/usb.c @@ -19,12 +19,12 @@ #ifdef KERNEL_MODE -#include STM32_HAL_H +#include +#include -#include "usb.h" -#include "common.h" #include "random_delays.h" -#include "secbool.h" +#include "systick.h" +#include "usb.h" #include "usb_internal.h" #define USB_MAX_CONFIG_DESC_SIZE 256 diff --git a/core/embed/trezorhal/stm32f4/usb/usb_class_hid.c b/core/embed/trezorhal/stm32f4/usb/usb_class_hid.c index 67512153afb..5cee8a829b3 100644 --- a/core/embed/trezorhal/stm32f4/usb/usb_class_hid.c +++ b/core/embed/trezorhal/stm32f4/usb/usb_class_hid.c @@ -19,9 +19,9 @@ #ifdef KERNEL_MODE -#include "common.h" -#include "random_delays.h" +#include +#include "random_delays.h" #include "usb_hid.h" #include "usb_internal.h" diff --git a/core/embed/trezorhal/stm32f4/usb/usb_class_vcp.c b/core/embed/trezorhal/stm32f4/usb/usb_class_vcp.c index 4559fef33ba..713e0c672a1 100644 --- a/core/embed/trezorhal/stm32f4/usb/usb_class_vcp.c +++ b/core/embed/trezorhal/stm32f4/usb/usb_class_vcp.c @@ -19,7 +19,7 @@ #ifdef KERNEL_MODE -#include "common.h" +#include #include "usb_internal.h" #include "usb_vcp.h" diff --git a/core/embed/trezorhal/stm32f4/usb/usb_class_webusb.c b/core/embed/trezorhal/stm32f4/usb/usb_class_webusb.c index 8d9765829fe..ce2d5e0730d 100644 --- a/core/embed/trezorhal/stm32f4/usb/usb_class_webusb.c +++ b/core/embed/trezorhal/stm32f4/usb/usb_class_webusb.c @@ -19,9 +19,9 @@ #ifdef KERNEL_MODE -#include "common.h" -#include "random_delays.h" +#include +#include "random_delays.h" #include "usb_internal.h" #include "usb_webusb.h" diff --git a/core/embed/trezorhal/stm32f4/usb/usb_internal.h b/core/embed/trezorhal/stm32f4/usb/usb_internal.h index adf0ffb6db3..2fa548a2eb6 100644 --- a/core/embed/trezorhal/stm32f4/usb/usb_internal.h +++ b/core/embed/trezorhal/stm32f4/usb/usb_internal.h @@ -20,7 +20,8 @@ #ifndef TREZORHAL_USBD_INTERNAL_H #define TREZORHAL_USBD_INTERNAL_H -#include +#include + #include "usbd_core.h" #define USB_EP_DIR_MASK 0x80 diff --git a/core/embed/trezorhal/stm32f4/usb/usbd_conf.c b/core/embed/trezorhal/stm32f4/usb/usbd_conf.c index 2db2a648843..5de7e078b85 100644 --- a/core/embed/trezorhal/stm32f4/usb/usbd_conf.c +++ b/core/embed/trezorhal/stm32f4/usb/usbd_conf.c @@ -54,7 +54,9 @@ #ifdef KERNEL_MODE /* Includes ------------------------------------------------------------------*/ -#include STM32_HAL_H +#include +#include + #include "usbd_core.h" #include "usb.h" #include "irq.h" diff --git a/core/embed/trezorhal/stm32f4/usb/usbd_conf.h b/core/embed/trezorhal/stm32f4/usb/usbd_conf.h index 6ff2c71c829..960d23f0e28 100644 --- a/core/embed/trezorhal/stm32f4/usb/usbd_conf.h +++ b/core/embed/trezorhal/stm32f4/usb/usbd_conf.h @@ -55,10 +55,8 @@ #define __USBD_CONF_H /* Includes ------------------------------------------------------------------*/ -#include STM32_HAL_H -#include -#include -#include +#include +#include /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ diff --git a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_driver.c b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_driver.c index ff59d1b60dd..c2013f4b53a 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_driver.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_driver.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include +#include #include diff --git a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_fb.c b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_fb.c index ebf0293800c..74bd79fa7f8 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_fb.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_fb.c @@ -17,12 +17,8 @@ * along with this program. If not, see . */ -#include -#include -#include - -#include TREZOR_BOARD -#include STM32_HAL_H +#include +#include #include "display_fb.h" #include "display_internal.h" diff --git a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_fb.h b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_fb.h index 0afa1de2d21..0bb6ee3d1ee 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_fb.h +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_fb.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_DISPLAY_FB_H #define TREZORHAL_DISPLAY_FB_H -#include +#include #ifdef XFRAMEBUFFER diff --git a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_internal.h b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_internal.h index a45ce390d64..d3803fca97d 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_internal.h +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_internal.h @@ -1,9 +1,8 @@ #ifndef TREZORHAL_DISPLAY_INTERNAL_H #define TREZORHAL_DISPLAY_INTERNAL_H -#include STM32_HAL_H - -#include +#include +#include #ifdef XFRAMEBUFFER 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 f9f5ad1bd8b..7b51894cc91 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.c @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD -#include STM32_HAL_H +#include +#include #include "display_io.h" #include "irq.h" 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 634651fe2c4..e50d8c910ea 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.h +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_io.h @@ -20,8 +20,8 @@ #ifndef TREZORHAL_DISPLAY_IO_H #define TREZORHAL_DISPLAY_IO_H -#include STM32_HAL_H -#include TREZOR_BOARD +#include +#include void display_io_init_gpio(void); void display_io_init_fmc(void); diff --git a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_nofb.c b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_nofb.c index 83eba001c84..232566dd129 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_nofb.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_nofb.c @@ -17,7 +17,8 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD +#include +#include #include diff --git a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_panel.h b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_panel.h index 79163c48946..4a19d540c52 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_panel.h +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/display_panel.h @@ -20,8 +20,7 @@ #ifndef TREZORHAL_ST7789_PANEL_H #define TREZORHAL_ST7789_PANEL_H -#include -#include +#include // section "9.1.3 RDDID (04h): Read Display ID" // of ST7789V datasheet diff --git a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lhs200kb-if21.c b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lhs200kb-if21.c index 565a690b9c2..c73609286a7 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lhs200kb-if21.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lhs200kb-if21.c @@ -1,7 +1,7 @@ +#include -#include "lhs200kb-if21.h" #include "../display_io.h" -#include "model.h" +#include "lhs200kb-if21.h" void lhs200kb_if21_gamma(void) { ISSUE_CMD_BYTE(0xE0); diff --git a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lx154a2422.c b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lx154a2422.c index cf9bac5adbc..9a97737e4fb 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lx154a2422.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lx154a2422.c @@ -17,10 +17,11 @@ * along with this program. If not, see . */ +#include + #include "lx154a2422.h" #include "../display_io.h" -#include "model.h" void lx154a2422_gamma(void) { // positive voltage correction diff --git a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lx154a2482.c b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lx154a2482.c index 5626adde3f4..916396f20fc 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lx154a2482.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/lx154a2482.c @@ -17,10 +17,10 @@ * along with this program. If not, see . */ -#include "lx154a2482.h" +#include #include "../display_io.h" -#include "model.h" +#include "lx154a2482.h" void lx154a2482_gamma(void) { // positive voltage correction diff --git a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/tf15411a.c b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/tf15411a.c index 2c45fb66e95..a6424f56fe3 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/tf15411a.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/st-7789/panels/tf15411a.c @@ -17,9 +17,10 @@ * along with this program. If not, see . */ -#include "tf15411a.h" +#include + #include "../display_io.h" -#include "model.h" +#include "tf15411a.h" void tf15411a_init_seq(void) { // Inter Register Enable1 diff --git a/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_driver.c b/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_driver.c index 78647ad1285..7a74431066a 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_driver.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_driver.c @@ -17,11 +17,8 @@ * along with this program. If not, see . */ -#include -#include - -#include TREZOR_BOARD -#include STM32_HAL_H +#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_internal.h b/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_internal.h index c19c63a653f..17371892def 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_internal.h +++ b/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_internal.h @@ -20,8 +20,8 @@ #ifndef TREZORHAL_DISPLAY_INTERNAL_H #define TREZORHAL_DISPLAY_INTERNAL_H -#include TREZOR_BOARD -#include STM32_HAL_H +#include +#include #include "sdram.h" diff --git a/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_ltdc.c b/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_ltdc.c index df3a752c3be..2d2fe7e62a4 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_ltdc.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_ltdc.c @@ -17,11 +17,8 @@ * along with this program. If not, see . */ -#include -#include - -#include TREZOR_BOARD -#include STM32_HAL_H +#include +#include #include "display_internal.h" #include "ili9341_spi.h" diff --git a/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/ili9341_spi.c b/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/ili9341_spi.c index 309fb3f0d2f..b42b50d1251 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/ili9341_spi.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/ili9341_spi.c @@ -1,9 +1,9 @@ -#include -#include TREZOR_BOARD +#include +#include + #include "ili9341_spi.h" -#include STM32_HAL_H /** * @brief ILI9341 chip IDs diff --git a/core/embed/trezorhal/stm32f4/xdisplay/ug-2828/display_driver.c b/core/embed/trezorhal/stm32f4/xdisplay/ug-2828/display_driver.c index 0aed268fd38..768a4f32540 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/ug-2828/display_driver.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/ug-2828/display_driver.c @@ -17,11 +17,8 @@ * along with this program. If not, see . */ -#include -#include - -#include TREZOR_BOARD -#include STM32_HAL_H +#include +#include #include "mpu.h" #include "xdisplay.h" diff --git a/core/embed/trezorhal/stm32f4/xdisplay/vg-2864/display_driver.c b/core/embed/trezorhal/stm32f4/xdisplay/vg-2864/display_driver.c index c3caeec7df0..08ea87c00b2 100644 --- a/core/embed/trezorhal/stm32f4/xdisplay/vg-2864/display_driver.c +++ b/core/embed/trezorhal/stm32f4/xdisplay/vg-2864/display_driver.c @@ -17,13 +17,8 @@ * along with this program. If not, see . */ -#include -#include -#include -#include - -#include TREZOR_BOARD -#include STM32_HAL_H +#include +#include #include "mpu.h" #include "sizedefs.h" diff --git a/core/embed/trezorhal/stm32u5/bg_copy.c b/core/embed/trezorhal/stm32u5/bg_copy.c index 9ea4b4d95c8..be25d3b92b9 100644 --- a/core/embed/trezorhal/stm32u5/bg_copy.c +++ b/core/embed/trezorhal/stm32u5/bg_copy.c @@ -1,10 +1,10 @@ +#include + #include "bg_copy.h" #include "irq.h" #include "mpu.h" #include "systemview.h" -#include STM32_HAL_H - #ifdef KERNEL_MODE #define MAX_DATA_SIZE 0xFFF0 diff --git a/core/embed/trezorhal/stm32u5/consumption_mask.c b/core/embed/trezorhal/stm32u5/consumption_mask.c index 80275063674..ec511fd346b 100644 --- a/core/embed/trezorhal/stm32u5/consumption_mask.c +++ b/core/embed/trezorhal/stm32u5/consumption_mask.c @@ -17,7 +17,8 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include + #include "rng.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32u5/displays/dsi.c b/core/embed/trezorhal/stm32u5/displays/dsi.c index 775a451a717..5734a3f2e4f 100644 --- a/core/embed/trezorhal/stm32u5/displays/dsi.c +++ b/core/embed/trezorhal/stm32u5/displays/dsi.c @@ -58,11 +58,11 @@ */ /* Includes ------------------------------------------------------------------*/ +#include +#include + #include "colors.h" #include "irq.h" -#include "stdint.h" -#include "string.h" -#include STM32_HAL_H /* Common Error codes */ #define BSP_ERROR_NONE 0 diff --git a/core/embed/trezorhal/stm32u5/displays/dsi.h b/core/embed/trezorhal/stm32u5/displays/dsi.h index acded2e8606..c23daf557db 100644 --- a/core/embed/trezorhal/stm32u5/displays/dsi.h +++ b/core/embed/trezorhal/stm32u5/displays/dsi.h @@ -1,7 +1,8 @@ #ifndef DSI_H_ #define DSI_H_ -#include STM32_HAL_H +#include +#include #define DISPLAY_COLOR_MODE DMA2D_OUTPUT_ARGB8888 #define DISPLAY_FRAMEBUFFER_WIDTH 768 diff --git a/core/embed/trezorhal/stm32u5/entropy.c b/core/embed/trezorhal/stm32u5/entropy.c index 695371d3048..398a1369cfb 100644 --- a/core/embed/trezorhal/stm32u5/entropy.c +++ b/core/embed/trezorhal/stm32u5/entropy.c @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -#include +#include +#include #include "entropy.h" #include "flash_otp.h" -#include "model.h" #include "mpu.h" #include "rand.h" diff --git a/core/embed/trezorhal/stm32u5/flash.c b/core/embed/trezorhal/stm32u5/flash.c index f25c2ba6c85..6461fb8cb3a 100644 --- a/core/embed/trezorhal/stm32u5/flash.c +++ b/core/embed/trezorhal/stm32u5/flash.c @@ -17,14 +17,11 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include +#include +#include -#include -#include - -#include "common.h" #include "flash.h" -#include "model.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32u5/flash_otp.c b/core/embed/trezorhal/stm32u5/flash_otp.c index 9486ccf7a44..0f94ecd9319 100644 --- a/core/embed/trezorhal/stm32u5/flash_otp.c +++ b/core/embed/trezorhal/stm32u5/flash_otp.c @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include +#include -#include "flash_otp.h" -#include "common.h" #include "flash.h" +#include "flash_otp.h" #include "mpu.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32u5/haptic/drv2625/drv2625.c b/core/embed/trezorhal/stm32u5/haptic/drv2625/drv2625.c index 7b1168c50b1..48729e69410 100644 --- a/core/embed/trezorhal/stm32u5/haptic/drv2625/drv2625.c +++ b/core/embed/trezorhal/stm32u5/haptic/drv2625/drv2625.c @@ -17,18 +17,13 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD +#include +#include -#include -#include - -#include "common.h" #include "drv2625.h" #include "haptic.h" #include "i2c_bus.h" -#include STM32_HAL_H - #ifdef KERNEL_MODE // Maximum amplitude of the vibration effect diff --git a/core/embed/trezorhal/stm32u5/hash_processor.c b/core/embed/trezorhal/stm32u5/hash_processor.c index d6568887b5b..89f34a51e43 100644 --- a/core/embed/trezorhal/stm32u5/hash_processor.c +++ b/core/embed/trezorhal/stm32u5/hash_processor.c @@ -1,7 +1,7 @@ +#include +#include + #include "hash_processor.h" -#include -#include -#include STM32_HAL_H #include "irq.h" #include "memzero.h" #include "mpu.h" diff --git a/core/embed/trezorhal/stm32u5/i2c_bus.c b/core/embed/trezorhal/stm32u5/i2c_bus.c index 579863eae25..65d9834b41c 100644 --- a/core/embed/trezorhal/stm32u5/i2c_bus.c +++ b/core/embed/trezorhal/stm32u5/i2c_bus.c @@ -17,16 +17,14 @@ * along with this program. If not, see . */ -#include STM32_HAL_H -#include TREZOR_BOARD +#include +#include -#include - -#include "common.h" #include "i2c_bus.h" #include "irq.h" #include "mpu.h" #include "systemview.h" +#include "systick.h" #include "systimer.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32u5/layout.c b/core/embed/trezorhal/stm32u5/layout.c index 89934a22011..b7527157e68 100644 --- a/core/embed/trezorhal/stm32u5/layout.c +++ b/core/embed/trezorhal/stm32u5/layout.c @@ -17,13 +17,11 @@ * along with this program. If not, see . */ -#ifndef TREZOR_EMULATOR -#include STM32_HAL_H -#endif +#include +#include #include "flash.h" #include "layout_helpers.h" -#include "model.h" // Convert sector number to address // diff --git a/core/embed/trezorhal/stm32u5/monoctr.c b/core/embed/trezorhal/stm32u5/monoctr.c index f44711b4ad2..e538021aaf5 100644 --- a/core/embed/trezorhal/stm32u5/monoctr.c +++ b/core/embed/trezorhal/stm32u5/monoctr.c @@ -17,9 +17,10 @@ * along with this program. If not, see . */ -#include "monoctr.h" +#include + #include "flash_area.h" -#include "model.h" +#include "monoctr.h" #include "mpu.h" #include "secret.h" diff --git a/core/embed/trezorhal/stm32u5/mpu.c b/core/embed/trezorhal/stm32u5/mpu.c index aac6e66a336..423ff03b2e2 100644 --- a/core/embed/trezorhal/stm32u5/mpu.c +++ b/core/embed/trezorhal/stm32u5/mpu.c @@ -17,13 +17,12 @@ * along with this program. If not, see . */ -#include STM32_HAL_H -#include +#include +#include +#include -#include "common.h" #include "image.h" #include "irq.h" -#include "model.h" #include "mpu.h" #include "sizedefs.h" diff --git a/core/embed/trezorhal/stm32u5/option_bytes.c b/core/embed/trezorhal/stm32u5/option_bytes.c index d3a95eb50ab..38fae4c05a6 100644 --- a/core/embed/trezorhal/stm32u5/option_bytes.c +++ b/core/embed/trezorhal/stm32u5/option_bytes.c @@ -17,15 +17,14 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include +#include +#include #ifdef KERNEL_MODE -#include "option_bytes.h" -#include "common.h" #include "flash.h" -#include "model.h" -#include TREZOR_BOARD +#include "option_bytes.h" #pragma GCC optimize( \ "no-stack-protector") // applies to all functions in this file diff --git a/core/embed/trezorhal/stm32u5/reset_flags.c b/core/embed/trezorhal/stm32u5/reset_flags.c index 675dc2dc54b..7649b82d8ae 100644 --- a/core/embed/trezorhal/stm32u5/reset_flags.c +++ b/core/embed/trezorhal/stm32u5/reset_flags.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include #include "reset_flags.h" diff --git a/core/embed/trezorhal/stm32u5/sdcard.c b/core/embed/trezorhal/stm32u5/sdcard.c index 4d83000ae15..d022441d869 100644 --- a/core/embed/trezorhal/stm32u5/sdcard.c +++ b/core/embed/trezorhal/stm32u5/sdcard.c @@ -43,10 +43,8 @@ * THE SOFTWARE. */ -#include STM32_HAL_H -#include TREZOR_BOARD - -#include +#include +#include #include "irq.h" #include "mpu.h" diff --git a/core/embed/trezorhal/stm32u5/secret.c b/core/embed/trezorhal/stm32u5/secret.c index fba10c91bbe..8019e4befff 100644 --- a/core/embed/trezorhal/stm32u5/secret.c +++ b/core/embed/trezorhal/stm32u5/secret.c @@ -1,16 +1,14 @@ -#include STM32_HAL_H +#include +#include +#include -#include "secret.h" -#include -#include #include "bootutils.h" -#include "common.h" #include "flash.h" #include "flash_utils.h" #include "memzero.h" -#include "model.h" #include "mpu.h" #include "rng.h" +#include "secret.h" #include "secure_aes.h" #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32u5/secure_aes.c b/core/embed/trezorhal/stm32u5/secure_aes.c index ee790624402..8b94516c3fd 100644 --- a/core/embed/trezorhal/stm32u5/secure_aes.c +++ b/core/embed/trezorhal/stm32u5/secure_aes.c @@ -17,14 +17,14 @@ * along with this program. If not, see . */ -#include -#include -#include STM32_HAL_H +#include +#include +#include -#include #include -#include -#include "model.h" + +#include "mpu.h" +#include "secure_aes.h" #include "syscall.h" #include "trustzone.h" diff --git a/core/embed/trezorhal/stm32u5/startup_init.c b/core/embed/trezorhal/stm32u5/startup_init.c index c08df7316b8..7b0d672a539 100644 --- a/core/embed/trezorhal/stm32u5/startup_init.c +++ b/core/embed/trezorhal/stm32u5/startup_init.c @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD -#include STM32_HAL_H +#include +#include #include "rng.h" diff --git a/core/embed/trezorhal/stm32u5/tamper.c b/core/embed/trezorhal/stm32u5/tamper.c index 4f6cfb605df..ec02ef09f25 100644 --- a/core/embed/trezorhal/stm32u5/tamper.c +++ b/core/embed/trezorhal/stm32u5/tamper.c @@ -17,11 +17,12 @@ * along with this program. If not, see . */ -#include +#include +#include + #include #include #include -#include STM32_HAL_H #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/stm32u5/touch/sitronix.c b/core/embed/trezorhal/stm32u5/touch/sitronix.c index bc951bde82e..03fdec7a8de 100644 --- a/core/embed/trezorhal/stm32u5/touch/sitronix.c +++ b/core/embed/trezorhal/stm32u5/touch/sitronix.c @@ -1,9 +1,8 @@ -#include STM32_HAL_H -#include TREZOR_BOARD +#include +#include #ifdef KERNEL_MODE -#include "common.h" #include "i2c_bus.h" #include "irq.h" @@ -1207,7 +1206,8 @@ static int32_t SITRONIX_Probe(uint32_t Instance) { * @} */ -#include +#include + #include "touch.h" // Touch driver diff --git a/core/embed/trezorhal/stm32u5/trustzone.c b/core/embed/trezorhal/stm32u5/trustzone.c index a72aa5a55ac..ba766eb247c 100644 --- a/core/embed/trezorhal/stm32u5/trustzone.c +++ b/core/embed/trezorhal/stm32u5/trustzone.c @@ -17,14 +17,12 @@ * along with this program. If not, see . */ -#include STM32_HAL_H +#include +#include +#include -#include - -#include "common.h" #include "image.h" #include "irq.h" -#include "model.h" #include "sizedefs.h" #include "trustzone.h" diff --git a/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_driver.c b/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_driver.c index ea011796b64..ad95f44c5ad 100644 --- a/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_driver.c +++ b/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_driver.c @@ -17,11 +17,8 @@ * along with this program. If not, see . */ -#include -#include - -#include TREZOR_BOARD -#include STM32_HAL_H +#include +#include #include "display_internal.h" #include "mpu.h" diff --git a/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_fb.c b/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_fb.c index 0e21e336466..75195aa8fa0 100644 --- a/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_fb.c +++ b/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_fb.c @@ -17,11 +17,8 @@ * along with this program. If not, see . */ -#include -#include - -#include TREZOR_BOARD -#include STM32_HAL_H +#include +#include #include #include "display_internal.h" diff --git a/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_internal.h b/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_internal.h index 7696b379f2a..0a0c24ebe17 100644 --- a/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_internal.h +++ b/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_internal.h @@ -20,8 +20,7 @@ #ifndef TREZOR_HAL_DISPLAY_INTERNAL_H #define TREZOR_HAL_DISPLAY_INTERNAL_H -#include -#include +#include #include "sizedefs.h" #include "trustzone.h" diff --git a/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_ltdc_dsi.c b/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_ltdc_dsi.c index e2964798134..49d3f79a3be 100644 --- a/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_ltdc_dsi.c +++ b/core/embed/trezorhal/stm32u5/xdisplay/stm32u5a9j-dk/display_ltdc_dsi.c @@ -58,13 +58,10 @@ */ /* Includes ------------------------------------------------------------------*/ -#include "colors.h" -#include "stdint.h" -#include "string.h" - -#include TREZOR_BOARD -#include STM32_HAL_H +#include +#include +#include "colors.h" #include "display_internal.h" #include "irq.h" diff --git a/core/embed/trezorhal/systask.h b/core/embed/trezorhal/systask.h index b802ec2f7c4..b830fa4da80 100644 --- a/core/embed/trezorhal/systask.h +++ b/core/embed/trezorhal/systask.h @@ -20,9 +20,7 @@ #ifndef TREZORHAL_SYSTASK_H #define TREZORHAL_SYSTASK_H -#include -#include -#include +#include #include "mpu.h" diff --git a/core/embed/trezorhal/systick.h b/core/embed/trezorhal/systick.h index 71403c06f79..e78bec1a6cf 100644 --- a/core/embed/trezorhal/systick.h +++ b/core/embed/trezorhal/systick.h @@ -20,8 +20,7 @@ #ifndef TREZORHAL_SYSTICK_H #define TREZORHAL_SYSTICK_H -#include -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/systimer.h b/core/embed/trezorhal/systimer.h index 058e585b20a..65633065d56 100644 --- a/core/embed/trezorhal/systimer.h +++ b/core/embed/trezorhal/systimer.h @@ -20,8 +20,7 @@ #ifndef TREZORHAL_SYSTIMER_H #define TREZORHAL_SYSTIMER_H -#include -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/tamper.h b/core/embed/trezorhal/tamper.h index abfbe812668..17f52e4b48b 100644 --- a/core/embed/trezorhal/tamper.h +++ b/core/embed/trezorhal/tamper.h @@ -20,7 +20,7 @@ #ifndef TREZOR_HAL_TAMPER_H #define TREZOR_HAL_TAMPER_H -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/time_estimate.h b/core/embed/trezorhal/time_estimate.h index 68baa3098db..b23396c6db1 100644 --- a/core/embed/trezorhal/time_estimate.h +++ b/core/embed/trezorhal/time_estimate.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_TIME_ESTIMATE_H #define TREZORHAL_TIME_ESTIMATE_H -#include +#include uint32_t time_estimate_pbkdf2_ms(uint32_t iterations); diff --git a/core/embed/trezorhal/touch.h b/core/embed/trezorhal/touch.h index ff5738eecf6..d95cfdb75ad 100644 --- a/core/embed/trezorhal/touch.h +++ b/core/embed/trezorhal/touch.h @@ -1,9 +1,7 @@ #ifndef TREZOR_HAL_TOUCH_H #define TREZOR_HAL_TOUCH_H -#include -#include -#include "secbool.h" +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/trustzone.h b/core/embed/trezorhal/trustzone.h index 8e19a0beca8..ce9c081832d 100644 --- a/core/embed/trezorhal/trustzone.h +++ b/core/embed/trezorhal/trustzone.h @@ -20,8 +20,7 @@ #ifndef TREZORHAL_TRUSTZONE #define TREZORHAL_TRUSTZONE -#include -#include +#include #ifdef BOARDLOADER diff --git a/core/embed/trezorhal/unit_properties.h b/core/embed/trezorhal/unit_properties.h index 5011c6bbfb4..21d80e0c3dd 100644 --- a/core/embed/trezorhal/unit_properties.h +++ b/core/embed/trezorhal/unit_properties.h @@ -20,8 +20,7 @@ #ifndef TREZORHAL_UNIT_PROPERTIES_H #define TREZORHAL_UNIT_PROPERTIES_H -#include -#include +#include #ifdef KERNEL_MODE diff --git a/core/embed/trezorhal/unix/bootutils.c b/core/embed/trezorhal/unix/bootutils.c index 8f8a0f68778..69d2b11e461 100644 --- a/core/embed/trezorhal/unix/bootutils.c +++ b/core/embed/trezorhal/unix/bootutils.c @@ -17,13 +17,13 @@ * along with this program. If not, see . */ -#include +#include + #include -#include -#include #include "bootargs.h" #include "bootutils.h" +#include "systick.h" // Holds the 'command' for the next reboot. static boot_command_t g_boot_command; diff --git a/core/embed/trezorhal/unix/button.c b/core/embed/trezorhal/unix/button.c index 01a096ff261..6f1c4473418 100644 --- a/core/embed/trezorhal/unix/button.c +++ b/core/embed/trezorhal/unix/button.c @@ -17,12 +17,12 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD +#include +#include #include #include "button.h" -#include "common.h" static char last_left = 0, last_right = 0; diff --git a/core/embed/trezorhal/unix/display-unix.c b/core/embed/trezorhal/unix/display-unix.c index 937ef7565ca..7fd62fb3fbd 100644 --- a/core/embed/trezorhal/unix/display-unix.c +++ b/core/embed/trezorhal/unix/display-unix.c @@ -18,23 +18,18 @@ */ #define _GNU_SOURCE -#include -#include +#include +#include + #include #include -#include -#include -#include -#include -#include -#include -#include "common.h" +#include +#include + #include "display.h" #include "profile.h" -#include TREZOR_BOARD - #define EMULATOR_BORDER 16 static SDL_Window *WINDOW; diff --git a/core/embed/trezorhal/unix/display_driver.c b/core/embed/trezorhal/unix/display_driver.c index e0d3dcaf5d5..2ad3e56525b 100644 --- a/core/embed/trezorhal/unix/display_driver.c +++ b/core/embed/trezorhal/unix/display_driver.c @@ -19,14 +19,14 @@ #define _GNU_SOURCE -#include TREZOR_BOARD +#include +#include #include #include #include -#include "common.h" #include "profile.h" #define EMULATOR_BORDER 16 diff --git a/core/embed/trezorhal/unix/entropy.c b/core/embed/trezorhal/unix/entropy.c index a7a091b6895..c2bcb1cdf26 100644 --- a/core/embed/trezorhal/unix/entropy.c +++ b/core/embed/trezorhal/unix/entropy.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include +#include #include "entropy.h" diff --git a/core/embed/trezorhal/unix/flash.c b/core/embed/trezorhal/unix/flash.c index acd967aba30..b91fa00f53a 100644 --- a/core/embed/trezorhal/unix/flash.c +++ b/core/embed/trezorhal/unix/flash.c @@ -17,6 +17,9 @@ * along with this program. If not, see . */ +#include +#include + #include #include #include @@ -24,11 +27,7 @@ #include #include -#include - -#include "common.h" #include "flash.h" -#include "model.h" #include "profile.h" #ifndef FLASH_FILE diff --git a/core/embed/trezorhal/unix/flash_otp.c b/core/embed/trezorhal/unix/flash_otp.c index 1369e092937..8e926394599 100644 --- a/core/embed/trezorhal/unix/flash_otp.c +++ b/core/embed/trezorhal/unix/flash_otp.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include +#include #include "../flash_otp.h" diff --git a/core/embed/trezorhal/unix/monoctr.c b/core/embed/trezorhal/unix/monoctr.c index a8a140db60e..1feff33ba46 100644 --- a/core/embed/trezorhal/unix/monoctr.c +++ b/core/embed/trezorhal/unix/monoctr.c @@ -17,10 +17,11 @@ * along with this program. If not, see . */ -#include "monoctr.h" +#include +#include + #include "flash_otp.h" -#include "model.h" -#include "string.h" +#include "monoctr.h" static int get_otp_block(monoctr_type_t type) { switch (type) { diff --git a/core/embed/trezorhal/unix/optiga.c b/core/embed/trezorhal/unix/optiga.c index 8a5fe94c670..5396e7441c3 100644 --- a/core/embed/trezorhal/unix/optiga.c +++ b/core/embed/trezorhal/unix/optiga.c @@ -17,10 +17,11 @@ * along with this program. If not, see . */ -#include "optiga.h" -#include +#include + #include "ecdsa.h" #include "nist256p1.h" +#include "optiga.h" #include "optiga_common.h" #include "rand.h" #include "storage.h" diff --git a/core/embed/trezorhal/unix/rng.c b/core/embed/trezorhal/unix/rng.c index a2d6750c4a8..bc790ddf989 100644 --- a/core/embed/trezorhal/unix/rng.c +++ b/core/embed/trezorhal/unix/rng.c @@ -17,10 +17,8 @@ * along with this program. If not, see . */ -#include -#include +#include -#include "common.h" #include "rng.h" uint32_t rng_get(void) { diff --git a/core/embed/trezorhal/unix/sdcard.c b/core/embed/trezorhal/unix/sdcard.c index 5d3cd352919..a357f841026 100644 --- a/core/embed/trezorhal/unix/sdcard.c +++ b/core/embed/trezorhal/unix/sdcard.c @@ -17,15 +17,15 @@ * along with this program. If not, see . */ +#include + #include #include -#include #include #include #include #include -#include "common.h" #include "profile.h" #include "sdcard.h" diff --git a/core/embed/trezorhal/unix/system.c b/core/embed/trezorhal/unix/system.c index 73307b0f036..eab9d53b82c 100644 --- a/core/embed/trezorhal/unix/system.c +++ b/core/embed/trezorhal/unix/system.c @@ -17,12 +17,11 @@ * along with this program. If not, see . */ -#include +#include + #include -#include #include "bootutils.h" -#include "common.h" #include "system.h" #include "systick.h" #include "systimer.h" diff --git a/core/embed/trezorhal/unix/systick.c b/core/embed/trezorhal/unix/systick.c index 7515884fd04..923ea435b6a 100644 --- a/core/embed/trezorhal/unix/systick.c +++ b/core/embed/trezorhal/unix/systick.c @@ -17,10 +17,8 @@ * along with this program. If not, see . */ -#include -#include +#include -#include #include #include diff --git a/core/embed/trezorhal/unix/systimer.c b/core/embed/trezorhal/unix/systimer.c index 1088f96bbd2..6f56cc0327d 100644 --- a/core/embed/trezorhal/unix/systimer.c +++ b/core/embed/trezorhal/unix/systimer.c @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#include +#include #include "systimer.h" diff --git a/core/embed/trezorhal/unix/touch.c b/core/embed/trezorhal/unix/touch.c index 194ee6c45c7..f9008540ca2 100644 --- a/core/embed/trezorhal/unix/touch.c +++ b/core/embed/trezorhal/unix/touch.c @@ -17,13 +17,11 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD +#include +#include #include -#include -#include -#include "common.h" #include "touch.h" extern int sdl_display_res_x, sdl_display_res_y; diff --git a/core/embed/trezorhal/unix/unit_properties.c b/core/embed/trezorhal/unix/unit_properties.c index 76de8598cfb..5fd1881f695 100644 --- a/core/embed/trezorhal/unix/unit_properties.c +++ b/core/embed/trezorhal/unix/unit_properties.c @@ -17,12 +17,10 @@ * along with this program. If not, see . */ -#include TREZOR_BOARD - -#include +#include +#include #include "flash_otp.h" -#include "model.h" #include "unit_properties.h" // Unit properties driver structure diff --git a/core/embed/trezorhal/unix/usb.c b/core/embed/trezorhal/unix/usb.c index e57f5120cb7..eedf6182026 100644 --- a/core/embed/trezorhal/unix/usb.c +++ b/core/embed/trezorhal/unix/usb.c @@ -17,17 +17,16 @@ * along with this program. If not, see . */ +#include + #include -#include #include #include -#include #include #include #include #include -#include "error_handling.h" #include "profile.h" #include "usb.h" diff --git a/core/embed/trezorhal/usb.h b/core/embed/trezorhal/usb.h index c68c9f4c121..d1967a2a013 100644 --- a/core/embed/trezorhal/usb.h +++ b/core/embed/trezorhal/usb.h @@ -20,8 +20,7 @@ #ifndef __TREZORHAL_USB_H__ #define __TREZORHAL_USB_H__ -#include -#include "secbool.h" +#include #include "usb_hid.h" #include "usb_vcp.h" diff --git a/core/embed/trezorhal/usb_hid.h b/core/embed/trezorhal/usb_hid.h index 54b99b05d8b..6ab8f6440c5 100644 --- a/core/embed/trezorhal/usb_hid.h +++ b/core/embed/trezorhal/usb_hid.h @@ -20,8 +20,7 @@ #ifndef TREZORHAL_USB_CLASS_HID_H #define TREZORHAL_USB_CLASS_HID_H -#include -#include "secbool.h" +#include /* usb_hid_info_t contains all information for setting up a HID interface. All * passed pointers need to live at least until the interface is disabled diff --git a/core/embed/trezorhal/usb_vcp.h b/core/embed/trezorhal/usb_vcp.h index 8759a11a5c9..623d99f4609 100644 --- a/core/embed/trezorhal/usb_vcp.h +++ b/core/embed/trezorhal/usb_vcp.h @@ -20,8 +20,7 @@ #ifndef TREZORHAL_USB_CLASS_VCP_H #define TREZORHAL_USB_CLASS_VCP_H -#include -#include "secbool.h" +#include /* usb_vcp_info_t contains all information for setting up a VCP interface. All * passed pointers need to live at least until the interface is disabled diff --git a/core/embed/trezorhal/usb_webusb.h b/core/embed/trezorhal/usb_webusb.h index 216c3d6b576..0cc873f0b92 100644 --- a/core/embed/trezorhal/usb_webusb.h +++ b/core/embed/trezorhal/usb_webusb.h @@ -20,7 +20,7 @@ #ifndef TREZORHAL_USB_CLASS_WEBUSB_H #define TREZORHAL_USB_CLASS_WEBUSB_H -#include "secbool.h" +#include /* usb_webusb_info_t contains all information for setting up a WebUSB interface. * All passed pointers need to live at least until the interface is disabled diff --git a/core/embed/trezorhal/xdisplay.h b/core/embed/trezorhal/xdisplay.h index 5b4041ee4f4..dfd3cf75df3 100644 --- a/core/embed/trezorhal/xdisplay.h +++ b/core/embed/trezorhal/xdisplay.h @@ -20,11 +20,9 @@ #ifndef TREZORHAL_XDISPLAY_H #define TREZORHAL_XDISPLAY_H -#include -#include -#include "gfx_bitblt.h" +#include -#include TREZOR_BOARD +#include "gfx_bitblt.h" // This is a universal API for controlling different types of display // controllers. diff --git a/core/embed/trezorhal/xdisplay_legacy.h b/core/embed/trezorhal/xdisplay_legacy.h index fddec1e7e4b..39766895e5e 100644 --- a/core/embed/trezorhal/xdisplay_legacy.h +++ b/core/embed/trezorhal/xdisplay_legacy.h @@ -20,8 +20,9 @@ #ifndef TREZORHAL_DISPLAY_LEGACY_H #define TREZORHAL_DISPLAY_LEGACY_H -#include -#include +#include + +#include "buffers.h" // These declarations will be removed after the final cleanup // of display drivers. They are here just to simplify integration diff --git a/core/embed/unix/main.c b/core/embed/unix/main.c index b0796320978..8f935f438cd 100644 --- a/core/embed/unix/main.c +++ b/core/embed/unix/main.c @@ -24,22 +24,18 @@ * THE SOFTWARE. */ +#include + #include #include #include #include #include -#include -#include -#include -#include -#include #include #include #include -#include "common.h" #include "display.h" #include "extmod/misc.h" #include "extmod/vfs_posix.h" diff --git a/core/embed/unix/main_main.c b/core/embed/unix/main_main.c index bdc9d561ab3..7f8ee7d9b12 100644 --- a/core/embed/unix/main_main.c +++ b/core/embed/unix/main_main.c @@ -1,3 +1,5 @@ +#include + #include "py/mpthread.h" #include "py/runtime.h" #include "py/stackctrl.h" @@ -5,7 +7,6 @@ #include "zkp_context.h" #endif -#include "common.h" #include "entropy.h" MP_NOINLINE int main_(int argc, char **argv); diff --git a/core/embed/unix/profile.c b/core/embed/unix/profile.c index 6e2e0ac4c6c..e661fae1e59 100644 --- a/core/embed/unix/profile.c +++ b/core/embed/unix/profile.c @@ -18,7 +18,9 @@ */ #define _GNU_SOURCE -#include + +#include + #include #include "profile.h"