2023-06-23 14:50:13 +00:00
|
|
|
from __future__ import annotations
|
2023-02-09 22:56:03 +00:00
|
|
|
|
2023-06-23 14:50:13 +00:00
|
|
|
from . import get_hw_model_as_number
|
|
|
|
from .stm32f4_common import stm32f4_common_files
|
2023-02-09 22:56:03 +00:00
|
|
|
|
2023-07-17 14:07:31 +00:00
|
|
|
|
2023-06-23 14:50:13 +00:00
|
|
|
def configure(
|
2023-07-17 14:07:31 +00:00
|
|
|
env: dict,
|
|
|
|
features_wanted: list[str],
|
|
|
|
defines: list[str | tuple[str, str]],
|
|
|
|
sources: list[str],
|
|
|
|
paths: list[str],
|
2023-06-23 14:50:13 +00:00
|
|
|
) -> list[str]:
|
|
|
|
features_available: list[str] = []
|
2023-02-09 22:56:03 +00:00
|
|
|
board = "stm32f429i-disc1.h"
|
|
|
|
display = "ltdc.c"
|
|
|
|
hw_model = get_hw_model_as_number("D001")
|
|
|
|
hw_revision = 0
|
|
|
|
|
2023-06-27 22:10:46 +00:00
|
|
|
mcu = "STM32F429xx"
|
|
|
|
|
|
|
|
stm32f4_common_files(env, defines, sources, paths)
|
2023-06-23 14:50:13 +00:00
|
|
|
|
2023-07-17 14:07:31 +00:00
|
|
|
env.get("ENV")[
|
|
|
|
"CPU_ASFLAGS"
|
|
|
|
] = "-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16"
|
|
|
|
env.get("ENV")[
|
|
|
|
"CPU_CCFLAGS"
|
|
|
|
] = "-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mtune=cortex-m4 "
|
|
|
|
env.get("ENV")["RUST_TARGET"] = "thumbv7em-none-eabihf"
|
2023-06-23 14:50:13 +00:00
|
|
|
|
2023-06-27 22:10:46 +00:00
|
|
|
defines += [mcu]
|
2023-02-09 22:56:03 +00:00
|
|
|
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
|
|
|
|
defines += [f"HW_MODEL={hw_model}"]
|
|
|
|
defines += [f"HW_REVISION={hw_revision}"]
|
2023-06-30 10:12:55 +00:00
|
|
|
sources += [
|
|
|
|
"embed/models/model_D001_layout.c",
|
|
|
|
]
|
2024-04-16 13:52:17 +00:00
|
|
|
|
|
|
|
if "new_rendering" in features_wanted:
|
|
|
|
sources += [
|
|
|
|
"embed/trezorhal/xdisplay_legacy.c",
|
|
|
|
"embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_driver.c",
|
|
|
|
"embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/display_ltdc.c",
|
|
|
|
"embed/trezorhal/stm32f4/xdisplay/stm32f429i-disc1/ili9341_spi.c",
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
sources += [f"embed/trezorhal/stm32f4/displays/{display}"]
|
|
|
|
sources += ["embed/trezorhal/stm32f4/displays/ili9341_spi.c"]
|
|
|
|
|
2023-09-20 12:15:50 +00:00
|
|
|
sources += ["embed/trezorhal/stm32f4/dma2d.c"]
|
2024-04-16 13:52:17 +00:00
|
|
|
sources += ["embed/trezorhal/stm32f4/dma2d_bitblt.c"]
|
2023-09-20 12:15:50 +00:00
|
|
|
sources += [
|
|
|
|
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c"
|
|
|
|
]
|
2023-06-23 14:50:13 +00:00
|
|
|
sources += ["embed/trezorhal/stm32f4/sdram.c"]
|
2023-07-18 10:47:45 +00:00
|
|
|
sources += [
|
|
|
|
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c"
|
|
|
|
]
|
2023-09-20 12:15:50 +00:00
|
|
|
defines += ["USE_DMA2D"]
|
|
|
|
defines += ["FRAMEBUFFER"]
|
|
|
|
features_available.append("dma2d")
|
|
|
|
features_available.append("framebuffer")
|
2023-02-09 22:56:03 +00:00
|
|
|
|
2024-04-16 13:52:17 +00:00
|
|
|
if "new_rendering" in features_wanted:
|
|
|
|
defines += ["XFRAMEBUFFER"]
|
|
|
|
features_available.append("xframebuffer")
|
|
|
|
features_available.append("display_rgb565")
|
|
|
|
|
2023-02-09 22:56:03 +00:00
|
|
|
if "input" in features_wanted:
|
2023-06-23 14:50:13 +00:00
|
|
|
sources += ["embed/trezorhal/stm32f4/i2c.c"]
|
|
|
|
sources += ["embed/trezorhal/stm32f4/touch/stmpe811.c"]
|
|
|
|
sources += ["embed/lib/touch.c"]
|
2023-02-09 22:56:03 +00:00
|
|
|
features_available.append("touch")
|
|
|
|
|
2023-06-23 14:50:13 +00:00
|
|
|
if "usb" in features_wanted:
|
|
|
|
sources += [
|
2023-07-17 14:07:31 +00:00
|
|
|
"embed/trezorhal/stm32f4/usb.c",
|
|
|
|
"embed/trezorhal/stm32f4/usbd_conf.c",
|
|
|
|
"embed/trezorhal/stm32f4/usbd_core.c",
|
|
|
|
"embed/trezorhal/stm32f4/usbd_ctlreq.c",
|
|
|
|
"embed/trezorhal/stm32f4/usbd_ioreq.c",
|
|
|
|
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c",
|
2023-06-23 14:50:13 +00:00
|
|
|
]
|
|
|
|
features_available.append("usb")
|
|
|
|
|
2023-02-09 22:56:03 +00:00
|
|
|
return features_available
|