chore(style): apply black and isort style lints for site_scons python files

[no changelog]
pull/3142/head
grdddj 11 months ago committed by Jiří Musil
parent 8beaf653b9
commit 7df3219a7a

@ -3,12 +3,13 @@ from __future__ import annotations
from . import get_hw_model_as_number
from .stm32f4_common import stm32f4_common_files
def configure(
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
) -> list[str]:
features_available: list[str] = []
board = "stm32f429i-disc1.h"
@ -20,9 +21,13 @@ def configure(
stm32f4_common_files(env, defines, sources, paths)
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'
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"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
@ -45,12 +50,12 @@ def configure(
if "usb" in features_wanted:
sources += [
'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',
"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",
]
features_available.append("usb")

@ -3,58 +3,56 @@ from __future__ import annotations
def stm32f4_common_files(env, defines, sources, paths):
defines += [
('STM32_HAL_H', '"<stm32f4xx.h>"'),
]
("STM32_HAL_H", '"<stm32f4xx.h>"'),
]
paths += [
'embed/trezorhal/stm32f4',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Inc',
'vendor/micropython/lib/stm32lib/CMSIS/STM32F4xx/Include',
"embed/trezorhal/stm32f4",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Inc",
"vendor/micropython/lib/stm32lib/CMSIS/STM32F4xx/Include",
]
sources += [
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_ltdc.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c',
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c',
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_ltdc.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c",
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c",
]
sources += [
'embed/trezorhal/stm32f4/board_capabilities.c',
'embed/trezorhal/stm32f4/common.c',
'embed/trezorhal/stm32f4/image.c',
'embed/trezorhal/stm32f4/flash.c',
'embed/trezorhal/stm32f4/lowlevel.c',
'embed/trezorhal/stm32f4/mpu.c',
'embed/trezorhal/stm32f4/platform.c',
'embed/trezorhal/stm32f4/systick.c',
'embed/trezorhal/stm32f4/random_delays.c',
'embed/trezorhal/stm32f4/rng.c',
'embed/trezorhal/stm32f4/util.s',
'embed/trezorhal/stm32f4/vectortable.s',
"embed/trezorhal/stm32f4/board_capabilities.c",
"embed/trezorhal/stm32f4/common.c",
"embed/trezorhal/stm32f4/image.c",
"embed/trezorhal/stm32f4/flash.c",
"embed/trezorhal/stm32f4/lowlevel.c",
"embed/trezorhal/stm32f4/mpu.c",
"embed/trezorhal/stm32f4/platform.c",
"embed/trezorhal/stm32f4/systick.c",
"embed/trezorhal/stm32f4/random_delays.c",
"embed/trezorhal/stm32f4/rng.c",
"embed/trezorhal/stm32f4/util.s",
"embed/trezorhal/stm32f4/vectortable.s",
]
env.get("ENV")["RUST_INCLUDES"] = \
"-I../trezorhal/stm32f4;" \
"-I../../vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Inc;"\
"-I../../vendor/micropython/lib/stm32lib/CMSIS/STM32F4xx/Include;"\
env.get("ENV")["RUST_INCLUDES"] = (
"-I../trezorhal/stm32f4;"
"-I../../vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Inc;"
"-I../../vendor/micropython/lib/stm32lib/CMSIS/STM32F4xx/Include;"
"-DSTM32_HAL_H=<stm32f4xx.h>"
)

@ -5,11 +5,11 @@ from .stm32f4_common import stm32f4_common_files
def configure(
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
) -> list[str]:
features_available: list[str] = []
board = "trezor_1.h"
@ -21,9 +21,11 @@ def configure(
stm32f4_common_files(env, defines, sources, paths)
env.get("ENV")['CPU_ASFLAGS'] = '-mthumb -mcpu=cortex-m3 -mfloat-abi=soft'
env.get("ENV")['CPU_CCFLAGS'] = '-mthumb -mtune=cortex-m3 -mcpu=cortex-m3 -mfloat-abi=soft '
env.get("ENV")['RUST_TARGET'] = 'thumbv7m-none-eabi'
env.get("ENV")["CPU_ASFLAGS"] = "-mthumb -mcpu=cortex-m3 -mfloat-abi=soft"
env.get("ENV")[
"CPU_CCFLAGS"
] = "-mthumb -mtune=cortex-m3 -mcpu=cortex-m3 -mfloat-abi=soft "
env.get("ENV")["RUST_TARGET"] = "thumbv7m-none-eabi"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
@ -37,12 +39,12 @@ def configure(
if "usb" in features_wanted:
sources += [
'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',
"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",
]
features_available.append("usb")

@ -5,11 +5,11 @@ from .stm32f4_common import stm32f4_common_files
def configure(
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
) -> list[str]:
features_available: list[str] = []
hw_model = get_hw_model_as_number("T2B1")
@ -21,9 +21,13 @@ def configure(
stm32f4_common_files(env, defines, sources, paths)
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'
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"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
@ -43,17 +47,19 @@ def configure(
if "consumption_mask" in features_wanted:
sources += ["embed/trezorhal/stm32f4/consumption_mask.c"]
sources += ["vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c"]
sources += [
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c"
]
sources += ["embed/trezorhal/stm32f4/dma.c"]
if "usb" in features_wanted:
sources += [
'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',
"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",
]
features_available.append("usb")

@ -5,11 +5,11 @@ from .stm32f4_common import stm32f4_common_files
def configure(
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
) -> list[str]:
features_available: list[str] = []
hw_model = get_hw_model_as_number("T2B1")
@ -21,9 +21,13 @@ def configure(
stm32f4_common_files(env, defines, sources, paths)
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'
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"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
@ -45,12 +49,12 @@ def configure(
if "usb" in features_wanted:
sources += [
'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',
"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",
]
features_available.append("usb")

@ -5,11 +5,11 @@ from .stm32f4_common import stm32f4_common_files
def configure(
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
) -> list[str]:
features_available: list[str] = []
hw_model = get_hw_model_as_number("T2B1")
@ -21,9 +21,13 @@ def configure(
stm32f4_common_files(env, defines, sources, paths)
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'
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"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
@ -41,12 +45,12 @@ def configure(
if "usb" in features_wanted:
sources += [
'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',
"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",
]
features_available.append("usb")

@ -5,11 +5,11 @@ from .stm32f4_common import stm32f4_common_files
def configure(
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
env: dict,
features_wanted: list[str],
defines: list[str | tuple[str, str]],
sources: list[str],
paths: list[str],
) -> list[str]:
features_available: list[str] = []
hw_model = get_hw_model_as_number("T2B1")
@ -21,9 +21,13 @@ def configure(
stm32f4_common_files(env, defines, sources, paths)
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'
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"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
@ -41,12 +45,12 @@ def configure(
if "usb" in features_wanted:
sources += [
'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',
"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",
]
features_available.append("usb")

@ -22,9 +22,13 @@ def configure(
stm32f4_common_files(env, defines, sources, paths)
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'
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"
defines += [mcu]
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"']
@ -32,10 +36,18 @@ def configure(
defines += [f"HW_REVISION={hw_revision}"]
sources += [f"embed/trezorhal/stm32f4/displays/{display}"]
sources += [f"embed/trezorhal/stm32f4/backlight_pwm.c"]
sources += [f'embed/trezorhal/stm32f4/displays/panels/tf15411a.c', ]
sources += [f'embed/trezorhal/stm32f4/displays/panels/154a.c', ]
sources += [f'embed/trezorhal/stm32f4/displays/panels/lx154a2411.c', ]
sources += [f'embed/trezorhal/stm32f4/displays/panels/lx154a2422.c', ]
sources += [
f"embed/trezorhal/stm32f4/displays/panels/tf15411a.c",
]
sources += [
f"embed/trezorhal/stm32f4/displays/panels/154a.c",
]
sources += [
f"embed/trezorhal/stm32f4/displays/panels/lx154a2411.c",
]
sources += [
f"embed/trezorhal/stm32f4/displays/panels/lx154a2422.c",
]
features_available.append("backlight")
@ -49,7 +61,9 @@ def configure(
sources += ["embed/trezorhal/stm32f4/sdcard.c"]
sources += ["embed/extmod/modtrezorio/ff.c"]
sources += ["embed/extmod/modtrezorio/ffunicode.c"]
sources += ["vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c"]
sources += [
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c"
]
sources += ["embed/trezorhal/stm32f4/dma.c"]
features_available.append("sd_card")
@ -59,12 +73,12 @@ def configure(
if "usb" in features_wanted:
sources += [
'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',
"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",
]
features_available.append("usb")

@ -4,52 +4,61 @@ import SCons.Builder
def generate(env):
env.SetDefault(
QSTRCOL='site_scons/site_tools/micropython/qstrdefs.py',
MODULECOL='site_scons/site_tools/micropython/moduledefs.py', )
QSTRCOL="site_scons/site_tools/micropython/qstrdefs.py",
MODULECOL="site_scons/site_tools/micropython/moduledefs.py",
)
env['BUILDERS']['CollectQstr'] = SCons.Builder.Builder(
action='$CC -E $CCFLAGS_QSTR $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES'
' | $PYTHON $QSTRCOL > $TARGET')
env["BUILDERS"]["CollectQstr"] = SCons.Builder.Builder(
action="$CC -E $CCFLAGS_QSTR $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
" | $PYTHON $QSTRCOL > $TARGET"
)
env['BUILDERS']['PreprocessQstr'] = SCons.Builder.Builder(
env["BUILDERS"]["PreprocessQstr"] = SCons.Builder.Builder(
action="cat $SOURCES"
" | $SED 's/^Q(.*)/\"&\"/'"
" | $CC -E $CFLAGS $CCFLAGS $_CCCOMCOM -"
" | $SED 's/^\"\\(Q(.*)\\)\"/\\1/' > $TARGET", )
" | $SED 's/^\"\\(Q(.*)\\)\"/\\1/' > $TARGET",
)
env['BUILDERS']['GenerateQstrDefs'] = SCons.Builder.Builder(
action='$MAKEQSTRDATA $SOURCE > $TARGET', )
env["BUILDERS"]["GenerateQstrDefs"] = SCons.Builder.Builder(
action="$MAKEQSTRDATA $SOURCE > $TARGET",
)
env['BUILDERS']['CollectModules'] = SCons.Builder.Builder(
action='$CC -E $CCFLAGS_QSTR $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES'
' | $PYTHON $MODULECOL > $TARGET')
env["BUILDERS"]["CollectModules"] = SCons.Builder.Builder(
action="$CC -E $CCFLAGS_QSTR $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
" | $PYTHON $MODULECOL > $TARGET"
)
def generate_frozen_module(source, target, env, for_signature):
target = str(target[0])
source = str(source[0])
source_name = source.replace(env['source_dir'], '')
source_name = source.replace(env["source_dir"], "")
# replace "utils.BITCOIN_ONLY" with literal constant (True/False)
# so the compiler can optimize out the things we don't want
btc_only = env['bitcoin_only'] == '1'
backlight = env['backlight']
btc_only = env["bitcoin_only"] == "1"
backlight = env["backlight"]
interim = f"{target[:-4]}.i" # replace .mpy with .i
sed_scripts = " ".join([
rf"-e 's/utils\.BITCOIN_ONLY/{btc_only}/g'",
rf"-e 's/utils\.USE_BACKLIGHT/{backlight}/g'",
r"-e 's/if TYPE_CHECKING/if False/'",
r"-e 's/import typing/# \0/'",
r"-e '/from typing import (/,/^\s*)/ {s/^/# /}'",
r"-e 's/from typing import/# \0/'"
])
return f'$SED {sed_scripts} {source} > {interim} && $MPY_CROSS -o {target} -s {source_name} {interim}'
env['BUILDERS']['FrozenModule'] = SCons.Builder.Builder(
sed_scripts = " ".join(
[
rf"-e 's/utils\.BITCOIN_ONLY/{btc_only}/g'",
rf"-e 's/utils\.USE_BACKLIGHT/{backlight}/g'",
r"-e 's/if TYPE_CHECKING/if False/'",
r"-e 's/import typing/# \0/'",
r"-e '/from typing import (/,/^\s*)/ {s/^/# /}'",
r"-e 's/from typing import/# \0/'",
]
)
return f"$SED {sed_scripts} {source} > {interim} && $MPY_CROSS -o {target} -s {source_name} {interim}"
env["BUILDERS"]["FrozenModule"] = SCons.Builder.Builder(
generator=generate_frozen_module,
suffix='.mpy',
single_source=True, )
suffix=".mpy",
single_source=True,
)
env['BUILDERS']['FrozenCFile'] = SCons.Builder.Builder(
action='$MPY_TOOL -f -q $qstr_header $SOURCES > $TARGET', )
env["BUILDERS"]["FrozenCFile"] = SCons.Builder.Builder(
action="$MPY_TOOL -f -q $qstr_header $SOURCES > $TARGET",
)
def exists(env):

@ -1,9 +1,17 @@
from __future__ import annotations
import subprocess
from pathlib import Path
import subprocess
from boards import trezor_1, trezor_r_v3, trezor_r_v4, trezor_t, trezor_r_v6, trezor_r_v10, discovery
from boards import (
discovery,
trezor_1,
trezor_r_v3,
trezor_r_v4,
trezor_r_v6,
trezor_r_v10,
trezor_t,
)
HERE = Path(__file__).parent.resolve()
@ -43,11 +51,11 @@ def configure_board(
return trezor_r_v3.configure(env, features_wanted, defines, sources, paths)
elif model_r_version == 4:
return trezor_r_v4.configure(env, features_wanted, defines, sources, paths)
elif model_r_version == 6:
elif model_r_version == 6:
return trezor_r_v6.configure(env, features_wanted, defines, sources, paths)
elif model_r_version == 10:
return trezor_r_v10.configure(env, features_wanted, defines, sources, paths)
elif model in ('DISC1',):
elif model in ("DISC1",):
return discovery.configure(env, features_wanted, defines, sources, paths)
else:
raise Exception("Unknown model")
@ -60,7 +68,7 @@ def get_model_identifier(model: str) -> str:
return "T2T1"
elif model == "R":
return "T2B1"
elif model == 'DISC1':
elif model == "DISC1":
return "D001"
else:
raise Exception("Unknown model")

Loading…
Cancel
Save