1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 14:28:07 +00:00

refactor(core): restructure embed folder

[no changelog]
This commit is contained in:
cepetr 2024-11-15 10:07:01 +01:00 committed by cepetr
parent 82bc0ef186
commit 089db2cadf
624 changed files with 2165 additions and 2107 deletions

View File

@ -6,7 +6,7 @@ on:
workflow_dispatch:
# [Device tests](../tests/device-tests.md) that run against an actual physical Trezors.
# The device needs to have special bootloader, found in `core/embed/bootloader_ci`, that
# The device needs to have special bootloader, found in `core/embed/projects/bootloader_ci`, that
# makes it possible to flash firmware without confirmation on the touchscreen.
#
# All hardware tests are run nightly on the `main` branch,

View File

@ -38,7 +38,7 @@ before_script:
- . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh || true
- $NIX_SHELL --run "poetry install --sync"
- export LEGACY_VERSION=$($NIX_SHELL --run "./tools/version.sh legacy/firmware/version.h")
- export CORE_VERSION=$($NIX_SHELL --run "./tools/version.sh core/embed/firmware/version.h")
- export CORE_VERSION=$($NIX_SHELL --run "./tools/version.sh core/embed/projects/firmware/version.h")
include:
- ci/environment.yml

View File

@ -53,9 +53,9 @@ pystyle: ## apply code style on application sources and tests
changelog_check: ## check changelog format
./tools/generate-changelog.py --check core
./tools/generate-changelog.py --check core/embed/boardloader
./tools/generate-changelog.py --check core/embed/bootloader
./tools/generate-changelog.py --check core/embed/bootloader_ci
./tools/generate-changelog.py --check core/embed/projects/boardloader
./tools/generate-changelog.py --check core/embed/projects/bootloader
./tools/generate-changelog.py --check core/embed/projects/bootloader_ci
./tools/generate-changelog.py --check legacy/bootloader
./tools/generate-changelog.py --check legacy/firmware
./tools/generate-changelog.py --check legacy/intermediate_fw

View File

@ -5,10 +5,10 @@ set -u
base_branch=main
fail=0
subdirs="core
core/embed/boardloader
core/embed/bootloader
core/embed/bootloader_ci
core/embed/prodtest
core/embed/projects/boardloader
core/embed/projects/bootloader
core/embed/projects/bootloader_ci
core/embed/projects/prodtest
legacy/bootloader
legacy/firmware
legacy/intermediate_fw

View File

@ -12,7 +12,7 @@ release core fw regular deploy:
needs:
- core fw regular build
script:
- export VERSION=$(./tools/version.sh core/embed/firmware/version.h)
- export VERSION=$(./tools/version.sh core/embed/projects/firmware/version.h)
- export NAME="firmware-T2T1-$VERSION-$CI_COMMIT_SHORT_SHA.bin"
- echo "Deploying to ${DEPLOY_DIRECTORY}/$NAME"
- mkdir -p "${DEPLOY_BASE_DIR}/${DEPLOY_DIRECTORY}"
@ -34,7 +34,7 @@ release core fw btconly deploy:
needs:
- core fw btconly build
script:
- export VERSION=$(./tools/version.sh core/embed/firmware/version.h)
- export VERSION=$(./tools/version.sh core/embed/projects/firmware/version.h)
- export NAME="firmware-T2T1-btconly-$VERSION-$CI_COMMIT_SHORT_SHA.bin"
- echo "Deploying to ${DEPLOY_DIRECTORY}/$NAME"
- mkdir -p "${DEPLOY_BASE_DIR}/${DEPLOY_DIRECTORY}"
@ -56,7 +56,7 @@ release core fw regular debug deploy:
needs:
- core fw regular debug build
script:
- export VERSION=$(./tools/version.sh core/embed/firmware/version.h)
- export VERSION=$(./tools/version.sh core/embed/projects/firmware/version.h)
- export NAME="firmware-T2T1-debug-$VERSION-$CI_COMMIT_SHORT_SHA.bin"
- echo "Deploying to ${DEPLOY_DIRECTORY}/$NAME"
- mkdir -p "${DEPLOY_BASE_DIR}/${DEPLOY_DIRECTORY}"
@ -78,7 +78,7 @@ release core fw btconly debug deploy:
needs:
- core fw btconly debug build
script:
- export VERSION=$(./tools/version.sh core/embed/firmware/version.h)
- export VERSION=$(./tools/version.sh core/embed/projects/firmware/version.h)
- export NAME="firmware-T2T1-btconly-debug-$VERSION-$CI_COMMIT_SHORT_SHA.bin"
- echo "Deploying to ${DEPLOY_DIRECTORY}/$NAME"
- mkdir -p "${DEPLOY_BASE_DIR}/${DEPLOY_DIRECTORY}"
@ -193,7 +193,7 @@ release core unix debug deploy:
- core unix frozen debug build
- core unix frozen debug build arm
script:
- export VERSION=$(./tools/version.sh core/embed/firmware/version.h)
- export VERSION=$(./tools/version.sh core/embed/projects/firmware/version.h)
- DEST="$DEPLOY_PATH/trezor-emu-core-v$VERSION"
- DEST_ARM="$DEPLOY_PATH/arm/trezor-emu-core-v$VERSION-arm"
- echo "Deploying to $DEST and $DEST_ARM"

View File

@ -401,10 +401,10 @@ flash_erase_storage: ## erase storage sectors from flash
$(OPENOCD) -c "init; reset halt; flash erase_sector 0 $(STORAGE_1_SECTOR_START) $(STORAGE_1_SECTOR_END); flash erase_sector 0 $(STORAGE_2_SECTOR_START) $(STORAGE_2_SECTOR_END); exit"
flash_bootloader_jlink: $(BOOTLOADER_BUILD_DIR)/bootloader.bin ## flash bootloader using JLink
JLinkExe -nogui 1 -commanderscript embed/bootloader/bootloader_flash.jlink
JLinkExe -nogui 1 -commanderscript embed/projects/bootloader/bootloader_flash.jlink
flash_bootloader_ci_jlink: $(BOOTLOADER_CI_BUILD_DIR)/bootloader.bin ## flash CI bootloader using JLink
JLinkExe -nogui 1 -commanderscript embed/bootloader_ci/bootloader_flash.jlink
JLinkExe -nogui 1 -commanderscript embed/projects/bootloader_ci/bootloader_flash.jlink
flash_firmware_jlink: $(FIRMWARE_BUILD_DIR)/firmware.bin ## flash firmware using JLink. file names must end in .bin for JLink
cp -f $<.p1 $<.p1.bin
@ -412,7 +412,7 @@ flash_firmware_jlink: $(FIRMWARE_BUILD_DIR)/firmware.bin ## flash firmware using
## pad 2nd part so that FW integrity works after flash
## read&compare in flashing will avoid erasing unmodified sectors
truncate -s $(FIRMWARE_P2_MAXSIZE) $<.p2.bin
JLinkExe -nogui 1 -commanderscript embed/firmware/firmware_flash.jlink
JLinkExe -nogui 1 -commanderscript embed/projects/firmware/firmware_flash.jlink
## openocd debug commands:

View File

@ -52,20 +52,21 @@ CPPPATH_MOD += [
'vendor/micropython/lib/uzlib',
]
SOURCE_MOD += [
'embed/lib/display_utils.c',
'embed/lib/error_handling.c',
'embed/lib/flash_utils.c',
'embed/lib/fonts/font_bitmap.c',
'embed/lib/fonts/fonts.c',
'embed/lib/gfx_color.c',
'embed/lib/gfx_bitblt_rgb565.c',
'embed/lib/gfx_bitblt_rgba8888.c',
'embed/lib/gfx_bitblt_mono8.c',
'embed/lib/image.c',
'embed/lib/mini_printf.c',
'embed/lib/rsod.c',
'embed/lib/terminal.c',
'embed/lib/gfx_draw.c'
'embed/gfx/bitblt/gfx_bitblt.c',
'embed/gfx/bitblt/gfx_bitblt_rgb565.c',
'embed/gfx/bitblt/gfx_bitblt_rgba8888.c',
'embed/gfx/bitblt/gfx_bitblt_mono8.c',
'embed/gfx/fonts/font_bitmap.c',
'embed/gfx/fonts/fonts.c',
'embed/gfx/gfx_color.c',
'embed/gfx/gfx_draw.c',
'embed/gfx/terminal.c',
'embed/io/display/display_utils.c',
'embed/util/flash/flash_utils.c',
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/rtl/error_handling.c',
'embed/rtl/mini_printf.c',
]
env = Environment(ENV=os.environ,
@ -79,8 +80,8 @@ FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_
FILE_SUFFIX= env.get('ENV')['SUFFIX']
SOURCE_BOARDLOADER = [
f"embed/trezorhal/{FILE_SUFFIX}/startup_stage_0.s",
'embed/boardloader/main.c',
f"embed/sys/startup/{FILE_SUFFIX}/startup_stage_0.s",
'embed/projects/boardloader/main.c',
]
@ -113,11 +114,18 @@ env.Replace(
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
LINKFLAGS="-T build/boardloader/memory.ld -Wl,--gc-sections -Wl,-Map=build/boardloader/boardloader.map -Wl,--warn-common -Wl,--print-memory-usage",
CPPPATH=[
'embed/boardloader',
'embed/lib',
'embed/projects/boardloader',
'embed/rtl/inc',
'embed/models',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'embed/upymod/modtrezorui',
'embed/gfx/inc',
'embed/io/button/inc',
'embed/io/haptic/inc',
'embed/io/touch/inc',
'embed/io/usb/inc',
'embed/sys/bsp/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
'vendor/micropython/lib/cmsis/inc',
] + CPPPATH_MOD + PATH_HAL,
CPPDEFINES=[
@ -165,7 +173,7 @@ program_elf = env.Command(
env.Depends(program_elf, linkerscript_gen)
BINARY_NAME = f"build/boardloader/boardloader-{models.get_model_identifier(TREZOR_MODEL)}"
BINARY_NAME += "-" + tools.get_version('embed/boardloader/version.h')
BINARY_NAME += "-" + tools.get_version('embed/projects/boardloader/version.h')
BINARY_NAME += "-" + tools.get_git_revision_short_hash()
BINARY_NAME += "-dirty" if tools.get_git_modified() else ""
BINARY_NAME += ".bin"

View File

@ -61,21 +61,22 @@ CPPPATH_MOD += [
]
SOURCE_MOD += [
'embed/extmod/modtrezorcrypto/rand.c',
'embed/lib/display_utils.c',
'embed/lib/error_handling.c',
'embed/lib/flash_utils.c',
'embed/lib/fonts/font_bitmap.c',
'embed/lib/fonts/fonts.c',
'embed/lib/gfx_color.c',
'embed/lib/gfx_bitblt_mono8.c',
'embed/lib/gfx_bitblt_rgb565.c',
'embed/lib/gfx_bitblt_rgba8888.c',
'embed/lib/image.c',
'embed/lib/mini_printf.c',
'embed/lib/rsod.c',
'embed/lib/terminal.c',
'embed/lib/gfx_draw.c',
'embed/upymod/modtrezorcrypto/rand.c',
'embed/gfx/bitblt/gfx_bitblt.c',
'embed/gfx/bitblt/gfx_bitblt_mono8.c',
'embed/gfx/bitblt/gfx_bitblt_rgb565.c',
'embed/gfx/bitblt/gfx_bitblt_rgba8888.c',
'embed/gfx/fonts/font_bitmap.c',
'embed/gfx/fonts/fonts.c',
'embed/gfx/gfx_color.c',
'embed/gfx/gfx_draw.c',
'embed/gfx/terminal.c',
'embed/io/display/display_utils.c',
'embed/util/flash/flash_utils.c',
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/rtl/error_handling.c',
'embed/rtl/mini_printf.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
'vendor/micropython/lib/uzlib/tinflate.c',
@ -100,13 +101,13 @@ FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_
FILE_SUFFIX= env.get('ENV')['SUFFIX']
SOURCE_BOOTLOADER = [
f'embed/trezorhal/{FILE_SUFFIX}/startup_stage_1.s',
'embed/bootloader/header.S',
'embed/bootloader/bootui.c',
'embed/bootloader/main.c',
'embed/bootloader/messages.c',
'embed/bootloader/protob/messages.pb.c',
'embed/bootloader/version_check.c',
f'embed/sys/startup/{FILE_SUFFIX}/startup_stage_1.s',
'embed/projects/bootloader/header.S',
'embed/projects/bootloader/bootui.c',
'embed/projects/bootloader/main.c',
'embed/projects/bootloader/messages.c',
'embed/projects/bootloader/protob/messages.pb.c',
'embed/projects/bootloader/version_check.c',
]
@ -128,13 +129,17 @@ env.Replace(
ALLPATHS = [
'embed/rust',
'embed/bootloader',
'embed/bootloader/nanopb',
'embed/bootloader/protob',
'embed/lib',
'embed/projects/bootloader',
'embed/projects/bootloader/nanopb',
'embed/projects/bootloader/protob',
'embed/rtl/inc',
'embed/models',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'embed/sys/bsp/inc',
'embed/gfx/inc',
'embed/util/translations/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
'embed/upymod/modtrezorui',
'vendor/nanopb',
] + CPPPATH_MOD + PATH_HAL
@ -253,7 +258,7 @@ env.Depends(program_elf, rust)
SUFFIX = '_qa' if BOOTLOADER_QA else ''
BINARY_NAME = f"build/bootloader/bootloader-{models.get_model_identifier(TREZOR_MODEL)}{SUFFIX}"
BINARY_NAME += "-" + tools.get_version('embed/bootloader/version.h')
BINARY_NAME += "-" + tools.get_version('embed/projects/bootloader/version.h')
BINARY_NAME += "-" + tools.get_git_revision_short_hash()
BINARY_NAME += "-dirty" if tools.get_git_modified() else ""
BINARY_NAME += ".bin"

View File

@ -56,21 +56,22 @@ CPPPATH_MOD += [
'vendor/micropython/lib/uzlib',
]
SOURCE_MOD += [
'embed/extmod/modtrezorcrypto/rand.c',
'embed/lib/display_utils.c',
'embed/lib/error_handling.c',
'embed/lib/flash_utils.c',
'embed/lib/fonts/font_bitmap.c',
'embed/lib/fonts/fonts.c',
'embed/lib/gfx_color.c',
'embed/lib/gfx_bitblt_mono8.c',
'embed/lib/gfx_bitblt_rgb565.c',
'embed/lib/gfx_bitblt_rgba8888.c',
'embed/lib/image.c',
'embed/lib/mini_printf.c',
'embed/lib/rsod.c',
'embed/lib/terminal.c',
'embed/lib/gfx_draw.c',
'embed/upymod/modtrezorcrypto/rand.c',
'embed/gfx/bitblt/gfx_bitblt.c',
'embed/gfx/bitblt/gfx_bitblt_mono8.c',
'embed/gfx/bitblt/gfx_bitblt_rgb565.c',
'embed/gfx/bitblt/gfx_bitblt_rgba8888.c',
'embed/gfx/fonts/font_bitmap.c',
'embed/gfx/fonts/fonts.c',
'embed/gfx/gfx_color.c',
'embed/gfx/gfx_draw.c',
'embed/gfx/terminal.c',
'embed/io/display/display_utils.c',
'embed/util/flash/flash_utils.c',
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/rtl/error_handling.c',
'embed/rtl/mini_printf.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
'vendor/micropython/lib/uzlib/tinflate.c',
@ -94,13 +95,13 @@ FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_
FILE_SUFFIX= env.get('ENV')['SUFFIX']
SOURCE_BOOTLOADER = [
f'embed/trezorhal/{FILE_SUFFIX}/startup_stage_1.s',
'embed/bootloader_ci/header.S',
'embed/bootloader_ci/bootui.c',
'embed/bootloader_ci/main.c',
'embed/bootloader_ci/messages.c',
'embed/bootloader_ci/protob/messages.pb.c',
'embed/bootloader_ci/version_check.c',
f'embed/sys/startup/{FILE_SUFFIX}/startup_stage_1.s',
'embed/projects/bootloader_ci/header.S',
'embed/projects/bootloader_ci/bootui.c',
'embed/projects/bootloader_ci/main.c',
'embed/projects/bootloader_ci/messages.c',
'embed/projects/bootloader_ci/protob/messages.pb.c',
'embed/projects/bootloader_ci/version_check.c',
]
env.Replace(
@ -132,13 +133,16 @@ env.Replace(
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
LINKFLAGS=f'-T build/bootloader_ci/memory.ld -Wl,--gc-sections -Wl,-Map=build/bootloader_ci/bootloader.map -Wl,--warn-common',
CPPPATH=[
'embed/bootloader_ci',
'embed/bootloader_ci/nanopb',
'embed/bootloader_ci/protob',
'embed/lib',
'embed/projects/bootloader_ci',
'embed/projects/bootloader_ci/nanopb',
'embed/projects/bootloader_ci/protob',
'embed/rtl/inc',
'embed/models',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'embed/gfx/inc',
'embed/sys/bsp/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
'embed/upymod/modtrezorui',
'vendor/nanopb',
] + CPPPATH_MOD + PATH_HAL,
CPPDEFINES=[
@ -195,7 +199,7 @@ program_elf = env.Command(
env.Depends(program_elf, linkerscript_gen)
BINARY_NAME = f"build/bootloader_ci/bootloader_ci-{models.get_model_identifier(TREZOR_MODEL)}"
BINARY_NAME += "-" + tools.get_version('embed/bootloader_ci/version.h')
BINARY_NAME += "-" + tools.get_version('embed/projects/bootloader_ci/version.h')
BINARY_NAME += "-" + tools.get_git_revision_short_hash()
BINARY_NAME += "-dirty" if tools.get_git_modified() else ""
BINARY_NAME += ".bin"

View File

@ -67,21 +67,22 @@ CPPPATH_MOD += [
]
SOURCE_MOD += [
'embed/extmod/modtrezorcrypto/rand.c',
'embed/lib/display_utils.c',
'embed/lib/error_handling.c',
'embed/lib/flash_utils.c',
'embed/lib/fonts/font_bitmap.c',
'embed/lib/fonts/fonts.c',
'embed/lib/gfx_color.c',
'embed/lib/gfx_bitblt_mono8.c',
'embed/lib/gfx_bitblt_rgb565.c',
'embed/lib/gfx_bitblt_rgba8888.c',
'embed/lib/image.c',
'embed/lib/mini_printf.c',
'embed/lib/rsod.c',
'embed/lib/terminal.c',
'embed/lib/gfx_draw.c',
'embed/upymod/modtrezorcrypto/rand.c',
'embed/gfx/bitblt/gfx_bitblt.c',
'embed/gfx/bitblt/gfx_bitblt_mono8.c',
'embed/gfx/bitblt/gfx_bitblt_rgb565.c',
'embed/gfx/bitblt/gfx_bitblt_rgba8888.c',
'embed/gfx/fonts/font_bitmap.c',
'embed/gfx/fonts/fonts.c',
'embed/gfx/gfx_color.c',
'embed/gfx/gfx_draw.c',
'embed/gfx/terminal.c',
'embed/io/display/display_utils.c',
'embed/util/flash/flash_utils.c',
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/rtl/error_handling.c',
'embed/rtl/mini_printf.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
'vendor/micropython/lib/uzlib/tinflate.c',
@ -95,33 +96,33 @@ SOURCE_NANOPB = [
]
SOURCE_BOOTLOADER = [
'embed/bootloader/bootui.c',
'embed/bootloader/main.c',
'embed/bootloader/messages.c',
'embed/bootloader/emulator.c',
'embed/bootloader/version_check.c',
'embed/bootloader/protob/messages.pb.c',
'embed/projects/bootloader/bootui.c',
'embed/projects/bootloader/main.c',
'embed/projects/bootloader/messages.c',
'embed/projects/bootloader/emulator.c',
'embed/projects/bootloader/version_check.c',
'embed/projects/bootloader/protob/messages.pb.c',
]
SOURCE_TREZORHAL = [
'embed/trezorhal/unix/bootutils.c',
'embed/trezorhal/unix/flash.c',
'embed/trezorhal/unix/flash_otp.c',
'embed/trezorhal/unix/mpu.c',
'embed/trezorhal/unix/monoctr.c',
'embed/trezorhal/unix/random_delays.c',
'embed/trezorhal/unix/rng.c',
'embed/trezorhal/unix/secret.c',
'embed/trezorhal/unix/system.c',
'embed/trezorhal/unix/systick.c',
'embed/trezorhal/unix/systimer.c',
'embed/trezorhal/unix/unit_properties.c',
'embed/trezorhal/unix/usb.c',
'embed/trezorhal/unix/display_driver.c',
'embed/io/display/unix/display_driver.c',
'embed/io/usb/unix/usb.c',
'embed/sec/monoctr/unix/monoctr.c',
'embed/sec/random_delays/unix/random_delays.c',
'embed/sec/rng/unix/rng.c',
'embed/sec/secret/unix/secret.c',
'embed/sys/mpu/unix/mpu.c',
'embed/sys/startup/unix/bootutils.c',
'embed/sys/task/unix/system.c',
'embed/sys/time/unix/systick.c',
'embed/sys/time/unix/systimer.c',
'embed/util/flash/unix/flash.c',
'embed/util/flash/unix/flash_otp.c',
'embed/util/unit_properties/unix/unit_properties.c',
]
SOURCE_UNIX = [
'embed/unix/profile.c',
'embed/projects/unix/profile.c',
]
ui.init_ui(TREZOR_MODEL, "bootloader", CPPDEFINES_MOD, SOURCE_MOD, RUST_UI_FEATURES)
@ -136,6 +137,7 @@ env.Replace(
AR='ar',
CC='gcc',
LINK='ld',
SIZE='size',
STRIP='strip',
OBJCOPY='objcopy',
@ -146,15 +148,32 @@ MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
MODEL_AS_NUMBER = str(models.get_hw_model_as_number(MODEL_IDENTIFIER))
ALLPATHS = ['embed/rust',
'embed/bootloader',
'embed/bootloader/nanopb',
'embed/bootloader/protob',
'embed/lib',
'embed/projects/bootloader',
'embed/projects/bootloader/nanopb',
'embed/projects/bootloader/protob',
'embed/rtl/inc',
'embed/models',
'embed/trezorhal',
'embed/trezorhal/unix',
'embed/unix',
'embed/extmod/modtrezorui',
'embed/projects/unix',
'embed/upymod/modtrezorui',
'embed/gfx/inc',
'embed/io/display/inc',
'embed/io/usb/inc',
'embed/sec/entropy/inc',
'embed/sec/monoctr/inc',
'embed/sec/random_delays/inc',
'embed/sec/rng/inc',
'embed/sec/secret/inc',
'embed/sys/bsp/inc',
'embed/sys/irq/inc',
'embed/sys/mpu/inc',
'embed/sys/startup/inc',
'embed/sys/task/inc',
'embed/sys/time/inc',
'embed/util/flash/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
'embed/util/translations/inc',
'embed/util/unit_properties/inc',
'vendor/nanopb',
] + CPPPATH_MOD + PATH_HAL

View File

@ -46,11 +46,11 @@ FROZEN = True
# modtrezorconfig
CPPPATH_MOD += [
'embed/extmod/modtrezorconfig',
'embed/upymod/modtrezorconfig',
'vendor/trezor-storage',
]
SOURCE_MOD += [
'embed/extmod/modtrezorconfig/modtrezorconfig.c',
'embed/upymod/modtrezorconfig/modtrezorconfig.c',
]
# modtrezorcrypto
@ -70,10 +70,10 @@ CPPDEFINES_MOD += [
('USE_EOS', '1' if (EVERYTHING and TREZOR_MODEL == "T") else '0'),
]
SOURCE_MOD += [
'embed/extmod/trezorobj.c',
'embed/extmod/modtrezorcrypto/crc.c',
'embed/extmod/modtrezorcrypto/modtrezorcrypto.c',
'embed/extmod/modtrezorcrypto/rand.c',
'embed/upymod/trezorobj.c',
'embed/upymod/modtrezorcrypto/crc.c',
'embed/upymod/modtrezorcrypto/modtrezorcrypto.c',
'embed/upymod/modtrezorcrypto/rand.c',
]
SOURCE_MOD_CRYPTO += [
'vendor/trezor-crypto/address.c',
@ -185,7 +185,7 @@ if FEATURE_FLAGS["AES_GCM"]:
# modtrezorio
SOURCE_MOD += [
'embed/extmod/modtrezorio/modtrezorio.c',
'embed/upymod/modtrezorio/modtrezorio.c',
]
# modtrezorui
@ -193,21 +193,22 @@ CPPPATH_MOD += [
'vendor/micropython/lib/uzlib',
]
SOURCE_MOD += [
'embed/extmod/modtrezorui/modtrezorui.c',
'embed/lib/display_utils.c',
'embed/lib/error_handling.c',
'embed/lib/fonts/font_bitmap.c',
'embed/lib/fonts/fonts.c',
'embed/lib/gfx_color.c',
'embed/lib/gfx_bitblt_rgb565.c',
'embed/lib/gfx_bitblt_rgba8888.c',
'embed/lib/gfx_bitblt_mono8.c',
'embed/lib/image.c',
'embed/lib/mini_printf.c',
'embed/lib/rsod.c',
'embed/lib/terminal.c',
'embed/lib/translations.c',
'embed/lib/gfx_draw.c',
'embed/upymod/modtrezorui/modtrezorui.c',
'embed/gfx/bitblt/gfx_bitblt.c',
'embed/gfx/bitblt/gfx_bitblt_rgb565.c',
'embed/gfx/bitblt/gfx_bitblt_rgba8888.c',
'embed/gfx/bitblt/gfx_bitblt_mono8.c',
'embed/gfx/fonts/font_bitmap.c',
'embed/gfx/fonts/fonts.c',
'embed/gfx/gfx_color.c',
'embed/gfx/gfx_draw.c',
'embed/gfx/terminal.c',
'embed/io/display/display_utils.c',
'embed/util/image/image.c',
'embed/util/translations/translations.c',
'embed/util/rsod/rsod.c',
'embed/rtl/error_handling.c',
'embed/rtl/mini_printf.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
'vendor/micropython/lib/uzlib/tinflate.c',
@ -220,17 +221,17 @@ CPPDEFINES_MOD += [
# modtrezorutils
SOURCE_MOD += [
'embed/extmod/modtrezorutils/modtrezorutils.c',
'embed/upymod/modtrezorutils/modtrezorutils.c',
]
# rust mods
SOURCE_MOD += [
'embed/extmod/rustmods.c',
'embed/upymod/rustmods.c',
]
# modutime
SOURCE_MOD += [
'embed/extmod/modutime.c',
'embed/upymod/modutime.c',
]
SOURCE_MICROPYTHON = [
@ -380,11 +381,11 @@ FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_
FILE_SUFFIX= env.get('ENV')['SUFFIX']
SOURCE_FIRMWARE = [
'embed/firmware/header.S',
'embed/firmware/main.c',
'embed/firmware/mphalport.c',
'embed/firmware/nlrthumb.c',
f'embed/trezorhal/{FILE_SUFFIX}/startup_stage_4.s',
'embed/projects/firmware/header.S',
'embed/projects/firmware/main.c',
'embed/projects/firmware/mphalport.c',
'embed/projects/firmware/nlrthumb.c',
f'embed/sys/startup/{FILE_SUFFIX}/startup_stage_4.s',
]
if 'sd_card' in FEATURES_AVAILABLE:
@ -413,11 +414,15 @@ env.Replace(
ALLPATHS = [
'.',
'embed/rust',
'embed/firmware',
'embed/lib',
'embed/projects/firmware',
'embed/rtl/inc',
'embed/models',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'embed/gfx/inc',
'embed/sys/bsp/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
'embed/util/translations/inc',
'embed/upymod/modtrezorui',
'vendor/micropython',
] + CPPPATH_MOD + PATH_HAL
@ -802,7 +807,7 @@ tools.embed_raw_binary(
obj_program,
env,
'vendorheader',
'embed/firmware/vendorheader.o',
'embed/projects/firmware/vendorheader.o',
VENDORHEADER,
)
@ -840,7 +845,7 @@ env.Depends(program_elf, rust)
BINARY_NAME = f"build/firmware/firmware-{MODEL_IDENTIFIER}"
if not EVERYTHING:
BINARY_NAME += "-btconly"
BINARY_NAME += "-" + tools.get_version('embed/firmware/version.h')
BINARY_NAME += "-" + tools.get_version('embed/projects/firmware/version.h')
BINARY_NAME += "-" + tools.get_git_revision_short_hash()
BINARY_NAME += "-dirty" if tools.get_git_modified() else ""
BINARY_NAME += ".bin"

View File

@ -40,12 +40,12 @@ FROZEN = True
# modtrezorconfig
CPPPATH_MOD += [
'embed/extmod/modtrezorconfig',
'embed/upymod/modtrezorconfig',
'vendor/trezor-storage',
'vendor/micropython/lib/uzlib',
]
SOURCE_MOD += [
# 'embed/extmod/modtrezorconfig/modtrezorconfig.c',
# 'embed/upymod/modtrezorconfig/modtrezorconfig.c',
'vendor/trezor-storage/norcow.c',
'vendor/trezor-storage/storage.c',
'vendor/trezor-storage/storage_utils.c',
@ -179,22 +179,21 @@ if FEATURE_FLAGS["AES_GCM"]:
]
SOURCE_MOD += [
'embed/lib/bl_check.c',
# 'embed/lib/display_utils.c',
'embed/lib/error_handling.c',
'embed/lib/fonts/font_bitmap.c',
# 'embed/lib/fonts/fonts.c',
'embed/lib/gfx_color.c',
'embed/lib/gfx_bitblt_rgb565.c',
'embed/lib/gfx_bitblt_rgba8888.c',
'embed/lib/gfx_bitblt_mono8.c',
'embed/lib/image.c',
'embed/lib/mini_printf.c',
'embed/lib/rsod.c',
'embed/lib/terminal.c',
'embed/lib/translations.c',
'embed/lib/gfx_draw.c',
'embed/extmod/modtrezorcrypto/rand.c',
'embed/gfx/bitblt/gfx_bitblt.c',
'embed/gfx/bitblt/gfx_bitblt_rgb565.c',
'embed/gfx/bitblt/gfx_bitblt_rgba8888.c',
'embed/gfx/bitblt/gfx_bitblt_mono8.c',
'embed/gfx/fonts/font_bitmap.c',
'embed/gfx/gfx_color.c',
'embed/gfx/gfx_draw.c',
'embed/gfx/terminal.c',
'embed/util/bl_check/bl_check.c',
'embed/util/translations/translations.c',
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/rtl/error_handling.c',
'embed/rtl/mini_printf.c',
'embed/upymod/modtrezorcrypto/rand.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
'vendor/micropython/lib/uzlib/tinflate.c',
@ -210,16 +209,17 @@ if FEATURE_FLAGS["RDI"]:
if FEATURE_FLAGS["SYSTEM_VIEW"]:
SOURCE_MOD += [
'embed/segger/Config/SEGGER_SYSVIEW_Config_NoOS.c',
'embed/segger/SEGGER/SEGGER_SYSVIEW.c',
'embed/segger/SEGGER/SEGGER_RTT.c',
'embed/segger/SEGGER/SEGGER_RTT_ASM_ARMv7M.S',
'embed/segger/SEGGER/Syscalls/SEGGER_RTT_Syscalls_GCC.c',
'embed/firmware/systemview.c',
'embed/sys/systemview/stm32/config/SEGGER_SYSVIEW_Config_NoOS.c',
'embed/sys/systemview/stm32/segger/SEGGER_SYSVIEW.c',
'embed/sys/systemview/stm32/segger/SEGGER_RTT.c',
'embed/sys/systemview/stm32/segger/SEGGER_RTT_ASM_ARMv7M.S',
'embed/sys/systemview/stm32/segger/Syscalls/SEGGER_RTT_Syscalls_GCC.c',
'embed/sys/systemview/systemview.c',
]
CPPPATH_MOD += [
'embed/segger/SEGGER/',
'embed/segger/Config/',
'embed/sys/systemview/inc',
'embed/sys/systemview/stm32/config',
'embed/sys/systemview/stm32/segger',
]
CPPDEFINES_MOD += ['SYSTEM_VIEW']
CCFLAGS_MOD += '-DSYSTEM_VIEW '
@ -247,8 +247,8 @@ FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_
FILE_SUFFIX= env.get('ENV')['SUFFIX']
SOURCE_FIRMWARE = [
'embed/kernel/main.c',
f'embed/trezorhal/{FILE_SUFFIX}/startup_stage_2.s',
'embed/projects/kernel/main.c',
f'embed/sys/startup/{FILE_SUFFIX}/startup_stage_2.s',
]
if 'sd_card' in FEATURES_AVAILABLE:
@ -274,10 +274,15 @@ env.Replace(
ALLPATHS = [
'.',
'embed/firmware',
'embed/lib',
'embed/projects/firmware',
'embed/rtl/inc',
'embed/models',
'embed/trezorhal',
'embed/gfx/inc',
'embed/sys/bsp/inc',
'embed/util/bl_check/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
'embed/util/translations/inc',
] + CPPPATH_MOD + PATH_HAL
env.Replace(
@ -357,7 +362,7 @@ VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/vendorheader_{vend
obj_program.extend(
env.Command(
target='embed/kernel/vendorheader.o',
target='embed/projects/kernel/vendorheader.o',
source=VENDORHEADER,
action='$OBJCOPY -I binary -O elf32-littlearm -B arm'
' --rename-section .data=.vendorheader,alloc,load,readonly,contents'
@ -367,7 +372,7 @@ tools.embed_compressed_binary(
obj_program,
env,
'bootloader',
'embed/bootloaders/bootloader.o',
'embed/projects/bootloaders/bootloader.o',
f'embed/models/{MODEL_IDENTIFIER}/bootloaders/bootloader_{BOOTLOADER_SUFFIX}.bin',
'kernel'
)
@ -393,7 +398,7 @@ if CMAKELISTS != 0:
BINARY_NAME = f"build/kernel/kernel-{models.get_model_identifier(TREZOR_MODEL)}"
if not EVERYTHING:
BINARY_NAME += "-btconly"
BINARY_NAME += "-" + tools.get_version('embed/kernel/version.h')
BINARY_NAME += "-" + tools.get_version('embed/projects/kernel/version.h')
BINARY_NAME += "-" + tools.get_git_revision_short_hash()
BINARY_NAME += "-dirty" if tools.get_git_modified() else ""
BINARY_NAME += ".bin"

View File

@ -62,20 +62,21 @@ CPPPATH_MOD += [
]
SOURCE_MOD += [
'embed/lib/display_utils.c',
'embed/lib/error_handling.c',
'embed/lib/fonts/font_bitmap.c',
'embed/lib/fonts/fonts.c',
'embed/lib/gfx_color.c',
'embed/lib/gfx_bitblt_rgb565.c',
'embed/lib/gfx_bitblt_rgba8888.c',
'embed/lib/gfx_bitblt_mono8.c',
'embed/lib/image.c',
'embed/lib/mini_printf.c',
'embed/lib/rsod.c',
'embed/lib/qr-code-generator/qrcodegen.c',
'embed/lib/terminal.c',
'embed/lib/gfx_draw.c',
'embed/gfx/bitblt/gfx_bitblt.c',
'embed/gfx/bitblt/gfx_bitblt_rgb565.c',
'embed/gfx/bitblt/gfx_bitblt_rgba8888.c',
'embed/gfx/bitblt/gfx_bitblt_mono8.c',
'embed/gfx/fonts/font_bitmap.c',
'embed/gfx/fonts/fonts.c',
'embed/gfx/gfx_color.c',
'embed/gfx/gfx_draw.c',
'embed/gfx/terminal.c',
'embed/gfx/qrcode/qrcodegen.c',
'embed/io/display/display_utils.c',
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/rtl/error_handling.c',
'embed/rtl/mini_printf.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
'vendor/micropython/lib/uzlib/tinflate.c',
@ -94,15 +95,15 @@ FILE_SUFFIX= env.get('ENV')['SUFFIX']
SOURCE_PRODTEST = [
f'embed/trezorhal/{FILE_SUFFIX}/startup_stage_2.s',
'embed/prodtest/header.S',
'embed/prodtest/main.c',
'embed/prodtest/prodtest_common.c',
f'embed/sys/startup/{FILE_SUFFIX}/startup_stage_2.s',
'embed/projects/prodtest/header.S',
'embed/projects/prodtest/main.c',
'embed/projects/prodtest/prodtest_common.c',
]
if 'optiga' in FEATURES_AVAILABLE:
SOURCE_PRODTEST += [
'embed/prodtest/optiga_prodtest.c',
'embed/projects/prodtest/optiga_prodtest.c',
]
env.Replace(
@ -134,11 +135,14 @@ env.Replace(
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
LINKFLAGS=f'-T build/prodtest/memory.ld -Wl,--gc-sections -Wl,-Map=build/prodtest/prodtest.map -Wl,--warn-common',
CPPPATH=[
'embed/prodtest',
'embed/lib',
'embed/projects/prodtest',
'embed/rtl/inc',
'embed/models',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'embed/gfx/inc',
'embed/sys/bsp/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
'embed/upymod/modtrezorui',
] + CPPPATH_MOD + PATH_HAL,
CPPDEFINES=[
'TREZOR_PRODTEST',
@ -199,7 +203,7 @@ tools.embed_raw_binary(
obj_program,
env,
'vendorheader',
'embed/firmware/vendorheader.o',
'embed/projects/firmware/vendorheader.o',
VENDORHEADER,
)
@ -219,7 +223,7 @@ program_elf = env.Command(
env.Depends(program_elf, linkerscript_gen)
BINARY_NAME = f"build/prodtest/prodtest-{models.get_model_identifier(TREZOR_MODEL)}"
BINARY_NAME += "-" + tools.get_version('embed/prodtest/version.h')
BINARY_NAME += "-" + tools.get_version('embed/projects/prodtest/version.h')
BINARY_NAME += "-" + tools.get_git_revision_short_hash()
BINARY_NAME += "-dirty" if tools.get_git_modified() else ""
BINARY_NAME += ".bin"

View File

@ -48,19 +48,20 @@ CPPPATH_MOD += [
'vendor/micropython/lib/uzlib',
]
SOURCE_MOD += [
'embed/lib/display_utils.c',
'embed/lib/error_handling.c',
'embed/lib/fonts/font_bitmap.c',
'embed/lib/fonts/fonts.c',
'embed/lib/gfx_color.c',
'embed/lib/gfx_bitblt_mono8.c',
'embed/lib/gfx_bitblt_rgb565.c',
'embed/lib/gfx_bitblt_rgba8888.c',
'embed/lib/image.c',
'embed/lib/mini_printf.c',
'embed/lib/rsod.c',
'embed/lib/terminal.c',
'embed/lib/gfx_draw.c',
'embed/gfx/bitblt/gfx_bitblt.c',
'embed/gfx/bitblt/gfx_bitblt_mono8.c',
'embed/gfx/bitblt/gfx_bitblt_rgb565.c',
'embed/gfx/bitblt/gfx_bitblt_rgba8888.c',
'embed/gfx/fonts/font_bitmap.c',
'embed/gfx/fonts/fonts.c',
'embed/gfx/gfx_color.c',
'embed/gfx/gfx_draw.c',
'embed/gfx/terminal.c',
'embed/io/display/display_utils.c',
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/rtl/error_handling.c',
'embed/rtl/mini_printf.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
'vendor/micropython/lib/uzlib/tinflate.c',
@ -80,9 +81,9 @@ FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_
FILE_SUFFIX= env.get('ENV')['SUFFIX']
SOURCE_REFLASH = [
f'embed/trezorhal/{FILE_SUFFIX}/startup_stage_2.s',
'embed/reflash/header.S',
'embed/reflash/main.c',
f'embed/sys/startup/{FILE_SUFFIX}/startup_stage_2.s',
'embed/projects/reflash/header.S',
'embed/projects/reflash/main.c',
]
env.Replace(
@ -114,11 +115,14 @@ env.Replace(
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
LINKFLAGS=f'-T build/reflash/memory.ld -Wl,--gc-sections -Wl,-Map=build/reflash/reflash.map -Wl,--warn-common',
CPPPATH=[
'embed/reflash',
'embed/lib',
'embed/projects/reflash',
'embed/rtl/inc',
'embed/models',
'embed/trezorhal',
'embed/extmod/modtrezorui',
'embed/gfx/inc',
'embed/sys/bsp/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
'embed/upymod/modtrezorui',
] + CPPPATH_MOD + PATH_HAL,
CPPDEFINES=[
'TREZOR_MODEL_'+TREZOR_MODEL,
@ -160,7 +164,7 @@ tools.embed_raw_binary(
obj_program,
env,
'vendorheader',
'embed/firmware/vendorheader.o',
'embed/projects/firmware/vendorheader.o',
VENDORHEADER,
)
@ -180,7 +184,7 @@ program_elf = env.Command(
env.Depends(program_elf, linkerscript_gen)
BINARY_NAME = f"build/reflash/reflash-{models.get_model_identifier(TREZOR_MODEL)}"
BINARY_NAME += "-" + tools.get_version('embed/reflash/version.h')
BINARY_NAME += "-" + tools.get_version('embed/projects/reflash/version.h')
BINARY_NAME += "-" + tools.get_git_revision_short_hash()
BINARY_NAME += "-dirty" if tools.get_git_modified() else ""
BINARY_NAME += ".bin"

View File

@ -51,11 +51,11 @@ RUST_UI_FEATURES = []
# modtrezorconfig
CPPPATH_MOD += [
'embed/extmod/modtrezorconfig',
'embed/upymod/modtrezorconfig',
'vendor/trezor-storage',
]
SOURCE_MOD += [
'embed/extmod/modtrezorconfig/modtrezorconfig.c',
'embed/upymod/modtrezorconfig/modtrezorconfig.c',
'vendor/trezor-storage/norcow.c',
'vendor/trezor-storage/storage.c',
'vendor/trezor-storage/storage_utils.c',
@ -81,9 +81,9 @@ CPPDEFINES_MOD += [
('USE_EOS', '1' if (EVERYTHING and TREZOR_MODEL == "T") else '0'),
]
SOURCE_MOD += [
'embed/extmod/trezorobj.c',
'embed/extmod/modtrezorcrypto/crc.c',
'embed/extmod/modtrezorcrypto/modtrezorcrypto.c',
'embed/upymod/trezorobj.c',
'embed/upymod/modtrezorcrypto/crc.c',
'embed/upymod/modtrezorcrypto/modtrezorcrypto.c',
]
SOURCE_MOD_CRYPTO += [
'vendor/trezor-crypto/address.c',
@ -196,7 +196,7 @@ if THP:
# modtrezorio
SOURCE_MOD += [
'embed/extmod/modtrezorio/modtrezorio.c',
'embed/upymod/modtrezorio/modtrezorio.c',
]
# modtrezorui
@ -204,21 +204,22 @@ CPPPATH_MOD += [
'vendor/micropython/lib/uzlib',
]
SOURCE_MOD += [
'embed/extmod/modtrezorui/modtrezorui.c',
'embed/lib/display_utils.c',
'embed/lib/error_handling.c',
'embed/lib/fonts/font_bitmap.c',
'embed/lib/fonts/fonts.c',
'embed/lib/gfx_color.c',
'embed/lib/gfx_bitblt_rgb565.c',
'embed/lib/gfx_bitblt_rgba8888.c',
'embed/lib/gfx_bitblt_mono8.c',
'embed/lib/image.c',
'embed/lib/mini_printf.c',
'embed/lib/rsod.c',
'embed/lib/terminal.c',
'embed/lib/translations.c',
'embed/lib/gfx_draw.c',
'embed/upymod/modtrezorui/modtrezorui.c',
'embed/gfx/bitblt/gfx_bitblt.c',
'embed/gfx/bitblt/gfx_bitblt_rgb565.c',
'embed/gfx/bitblt/gfx_bitblt_rgba8888.c',
'embed/gfx/bitblt/gfx_bitblt_mono8.c',
'embed/gfx/fonts/font_bitmap.c',
'embed/gfx/fonts/fonts.c',
'embed/gfx/gfx_color.c',
'embed/gfx/gfx_draw.c',
'embed/gfx/terminal.c',
'embed/io/display/display_utils.c',
'embed/util/image/image.c',
'embed/util/translations/translations.c',
'embed/util/rsod/rsod.c',
'embed/rtl/error_handling.c',
'embed/rtl/mini_printf.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
'vendor/micropython/lib/uzlib/tinflate.c',
@ -236,17 +237,17 @@ if RASPI:
# modtrezorutils
SOURCE_MOD += [
'embed/extmod/modtrezorutils/modtrezorutils.c',
'embed/upymod/modtrezorutils/modtrezorutils.c',
]
# rust mods
SOURCE_MOD += [
'embed/extmod/rustmods.c',
'embed/upymod/rustmods.c',
]
# modutime
SOURCE_MOD += [
'embed/extmod/modutime.c',
'embed/upymod/modutime.c',
]
SOURCE_MICROPYTHON = [
@ -376,24 +377,24 @@ SOURCE_MICROPYTHON = [
]
SOURCE_UNIX = [
'embed/trezorhal/unix/bootutils.c',
'embed/trezorhal/unix/entropy.c',
'embed/trezorhal/unix/flash_otp.c',
'embed/trezorhal/unix/flash.c',
'embed/trezorhal/unix/fwutils.c',
'embed/trezorhal/unix/mpu.c',
'embed/trezorhal/unix/random_delays.c',
'embed/trezorhal/unix/rng.c',
'embed/trezorhal/unix/system.c',
'embed/trezorhal/unix/systick.c',
'embed/trezorhal/unix/systimer.c',
'embed/trezorhal/unix/time_estimate.c',
'embed/trezorhal/unix/unit_properties.c',
'embed/trezorhal/unix/usb.c',
'embed/trezorhal/unix/display_driver.c',
'embed/unix/main_main.c',
'embed/unix/main.c',
'embed/unix/profile.c',
'embed/io/display/unix/display_driver.c',
'embed/io/usb/unix/usb.c',
'embed/sec/entropy/unix/entropy.c',
'embed/sec/random_delays/unix/random_delays.c',
'embed/sec/rng/unix/rng.c',
'embed/sec/time_estimate/unix/time_estimate.c',
'embed/sys/mpu/unix/mpu.c',
'embed/sys/startup/unix/bootutils.c',
'embed/sys/task/unix/system.c',
'embed/sys/time/unix/systick.c',
'embed/sys/time/unix/systimer.c',
'embed/util/flash/unix/flash.c',
'embed/util/flash/unix/flash_otp.c',
'embed/util/fwutils/fwutils.c',
'embed/util/unit_properties/unix/unit_properties.c',
'embed/projects/unix/main_main.c',
'embed/projects/unix/main.c',
'embed/projects/unix/profile.c',
'vendor/micropython/ports/unix/alloc.c',
'vendor/micropython/ports/unix/gccollect.c',
'vendor/micropython/ports/unix/input.c',
@ -469,12 +470,28 @@ env.Replace(
ALLPATHS=['.',
'embed/rust',
'embed/lib',
'embed/rtl/inc',
'embed/models',
'embed/unix',
'embed/trezorhal',
'embed/trezorhal/unix',
'embed/extmod/modtrezorui',
'embed/projects/unix',
'embed/upymod/modtrezorui',
'embed/gfx/inc',
'embed/io/display/inc',
'embed/io/usb/inc',
'embed/sec/entropy/inc',
'embed/sec/random_delays/inc',
'embed/sec/time_estimate/inc',
'embed/sys/bsp/inc',
'embed/sec/rng/inc',
'embed/sys/mpu/inc',
'embed/sys/startup/inc',
'embed/sys/task/inc',
'embed/sys/time/inc',
'embed/util/flash/inc',
'embed/util/fwutils/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
'embed/util/translations/inc',
'embed/util/unit_properties/inc',
'vendor/micropython',
'vendor/micropython/ports/unix',
'vendor/micropython/lib/mp-readline',
@ -491,7 +508,7 @@ env.Replace(
CPPDEFINES=[
'TREZOR_EMULATOR',
'TREZOR_MODEL_'+TREZOR_MODEL,
('MP_CONFIGFILE', '\\"embed/unix/mpconfigport.h\\"'),
('MP_CONFIGFILE', '\\"embed/projects/unix/mpconfigport.h\\"'),
ui.get_ui_layout(TREZOR_MODEL),
] + CPPDEFINES_MOD + CPPDEFINES_HAL,
ASPPFLAGS='$CFLAGS $CCFLAGS', )

View File

@ -1 +0,0 @@
../../../tools/towncrier.template.md

View File

@ -1 +0,0 @@
../../../tools/generate-changelog-unreleased.sh

View File

@ -1 +0,0 @@
../../../tools/towncrier.toml

View File

@ -1 +0,0 @@
../../../tools/towncrier.template.md

View File

@ -1 +0,0 @@
../../../tools/generate-changelog-unreleased.sh

View File

@ -1 +0,0 @@
../../../tools/towncrier.toml

View File

@ -1 +0,0 @@
../../../tools/towncrier.template.md

View File

@ -1 +0,0 @@
../../../tools/generate-changelog-unreleased.sh

View File

@ -1 +0,0 @@
../../../tools/towncrier.toml

View File

@ -20,7 +20,7 @@
#ifndef TREZORHAL_DMA2D_BITBLT_H
#define TREZORHAL_DMA2D_BITBLT_H
#include "gfx_bitblt.h"
#include <gfx/gfx_bitblt.h>
// Initializes DMA2D peripheral
void dma2d_init(void);

View File

@ -0,0 +1,32 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "dma2d_bitblt.h"
void gfx_bitblt_init(void) {
#if defined(USE_DMA2D) && !defined(TREZOR_EMULATOR)
dma2d_init();
#endif
}
void gfx_bitblt_wait(void) {
#if defined(USE_DMA2D) && !defined(TREZOR_EMULATOR)
dma2d_wait();
#endif
}

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gfx_bitblt.h"
#include <gfx/gfx_bitblt.h>
void gfx_mono8_fill(const gfx_bitblt_t* bb) {
uint8_t* dst_ptr = (uint8_t*)bb->dst_row + bb->dst_x;

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gfx_bitblt.h"
#include <gfx/gfx_bitblt.h>
#if USE_DMA2D
#include "dma2d_bitblt.h"

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gfx_bitblt.h"
#include <gfx/gfx_bitblt.h>
#if USE_DMA2D
#include "dma2d_bitblt.h"

View File

@ -20,8 +20,9 @@
#include <trezor_bsp.h>
#include <trezor_rtl.h>
#include "dma2d_bitblt.h"
#include "gfx_color.h"
#include <gfx/gfx_color.h>
#include "../dma2d_bitblt.h"
static DMA2D_HandleTypeDef dma2d_handle = {
.Instance = (DMA2D_TypeDef*)DMA2D_BASE,

View File

@ -22,7 +22,7 @@
#include <stdbool.h>
#include "fonts/font_bitmap.h"
#include "font_bitmap.h"
#ifdef USE_RGB_COLORS
#define TREZOR_FONT_BPP 4

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gfx_color.h"
#include <gfx/gfx_color.h>
const gfx_color16_t* gfx_color16_gradient_a4(gfx_color_t fg_color,
gfx_color_t bg_color) {

View File

@ -20,9 +20,9 @@
#include <trezor_model.h>
#include <trezor_rtl.h>
#include "display.h"
#include "fonts/fonts.h"
#include "gfx_draw.h"
#include <gfx/fonts.h>
#include <gfx/gfx_draw.h>
#include <io/display.h>
typedef struct {
int16_t dst_x;
@ -249,7 +249,7 @@ void gfx_draw_text(gfx_offset_t pos, const char* text, size_t maxlen,
#ifdef TREZOR_PRODTEST
#include "qr-code-generator/qrcodegen.h"
#include "qrcode/qrcodegen.h"
#define QR_MAX_VERSION 9
void gfx_draw_qrcode(gfx_offset_t offset, uint8_t scale, const char* data) {

View File

@ -17,8 +17,4 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dma2d_bitblt.h"
void dma2d_init(void) {}
void dma2d_wait(void) {}
#include "../../fonts/fonts.h"

View File

@ -22,7 +22,7 @@
#include <trezor_types.h>
#include "gfx_color.h"
#include <gfx/gfx_color.h>
// These module provides low-level bit block transfer (bitblt)
// operations on different bitmap/framebuffer types.
@ -75,6 +75,12 @@ typedef struct {
} gfx_bitblt_t;
// Initializes bitblt operations
void gfx_bitblt_init(void);
// If the bitblt operation is asynchronous, waits until it's finished
void gfx_bitblt_wait(void);
// Functions for RGB565 bitmap/framebuffer
// Fills a rectangle with a solid color

View File

@ -20,7 +20,7 @@
#ifndef GFX_DRAW_H
#define GFX_DRAW_H
#include "gfx_color.h"
#include <gfx/gfx_color.h>
// 2D rectangle coordinates
//

View File

@ -20,7 +20,7 @@
#ifndef LIB_TERMINAL_H
#define LIB_TERMINAL_H
#include "gfx_color.h"
#include <gfx/gfx_color.h>
void term_set_color(gfx_color_t fgcolor, gfx_color_t bgcolor);
void term_print(const char *text, int textlen);

View File

@ -20,11 +20,11 @@
#include <trezor_model.h>
#include <trezor_rtl.h>
#include "display.h"
#include "fonts/fonts.h"
#include "gfx_draw.h"
#include "mini_printf.h"
#include "terminal.h"
#include <gfx/fonts.h>
#include <gfx/gfx_draw.h>
#include <gfx/terminal.h>
#include <io/display.h>
#include <rtl/mini_printf.h>
#define TERMINAL_COLS (DISPLAY_RESX / 6)
#define TERMINAL_ROWS (DISPLAY_RESY / 8)

View File

@ -20,7 +20,7 @@
#include <trezor_bsp.h>
#include <trezor_rtl.h>
#include "button.h"
#include <io/button.h>
#ifdef KERNEL_MODE

View File

@ -22,7 +22,7 @@
#include <SDL.h>
#include "button.h"
#include <io/button.h>
// Button driver state
typedef struct {

View File

@ -20,8 +20,9 @@
#include <trezor_bsp.h>
#include <trezor_rtl.h>
#include "backlight_pwm.h"
#include "systick.h"
#include <sys/systick.h>
#include "../backlight/backlight_pwm.h"
// Requested PWM Timer clock frequency [Hz]
#define TIM_FREQ 10000000

View File

@ -1,9 +1,9 @@
#include <trezor_bsp.h>
#include "bg_copy.h"
#include "irq.h"
#include "mpu.h"
#include "systemview.h"
#include <sys/irq.h>
#include <sys/mpu.h>
#include "../bg_copy/bg_copy.h"
#ifdef KERNEL_MODE
@ -37,7 +37,8 @@ void HAL_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma) {
}
void GPDMA1_Channel0_IRQHandler(void) {
SEGGER_SYSVIEW_RecordEnterISR();
IRQ_LOG_ENTER();
mpu_mode_t mpu_mode = mpu_reconfig(MPU_MODE_DEFAULT);
if ((DMA_Handle.Instance->CSR & DMA_CSR_TCF) == 0) {
@ -62,7 +63,8 @@ void GPDMA1_Channel0_IRQHandler(void) {
}
mpu_restore(mpu_mode);
SEGGER_SYSVIEW_RecordExitISR();
IRQ_LOG_EXIT();
}
bool bg_copy_pending(void) { return dma_transfer_remaining > 0; }

View File

@ -19,8 +19,8 @@
#include <trezor_rtl.h>
#include "display.h"
#include "systick.h"
#include <io/display.h>
#include <sys/systick.h>
void display_fade(int start, int end, int delay) {
#ifdef USE_BACKLIGHT

View File

@ -22,7 +22,7 @@
#include <trezor_types.h>
#include "gfx_bitblt.h"
#include <gfx/gfx_bitblt.h>
// This is a universal API for controlling different types of display
// controllers.

View File

@ -19,17 +19,18 @@
#include <trezor_rtl.h>
#include <display.h>
#include <io/display.h>
#include <sys/mpu.h>
#include "backlight_pwm.h"
#include "display_fb.h"
#include "display_internal.h"
#include "display_io.h"
#include "display_panel.h"
#include "mpu.h"
#include "../backlight/backlight_pwm.h"
#ifndef BOARDLOADER
#include "bg_copy.h"
#include "../bg_copy/bg_copy.h"
#endif
#define INTERNAL_FB_WIDTH 240

View File

@ -21,21 +21,24 @@
#include <trezor_model.h>
#include <trezor_rtl.h>
#include "display.h"
#include <gfx/gfx_bitblt.h>
#include <io/display.h>
#include <sys/irq.h>
#include <sys/mpu.h>
#include "display_fb.h"
#include "display_internal.h"
#include "display_io.h"
#include "display_panel.h"
#include "gfx_bitblt.h"
#include "irq.h"
#include "mpu.h"
#include "sizedefs.h"
#include "systemview.h"
#include "trustzone.h"
#include <rtl/sizedefs.h>
#ifdef USE_TRUSTZONE
#include <sys/trustzone.h>
#endif
#ifndef BOARDLOADER
#include "bg_copy.h"
#include "../bg_copy/bg_copy.h"
#endif
#ifndef STM32U5
@ -165,11 +168,11 @@ static void display_te_interrupt_handler(void) {
}
void DISPLAY_TE_INTERRUPT_HANDLER(void) {
SEGGER_SYSVIEW_RecordEnterISR();
IRQ_LOG_ENTER();
mpu_mode_t mpu_mode = mpu_reconfig(MPU_MODE_DEFAULT);
display_te_interrupt_handler();
mpu_restore(mpu_mode);
SEGGER_SYSVIEW_RecordExitISR();
IRQ_LOG_EXIT();
}
#endif

View File

@ -20,9 +20,9 @@
#include <trezor_bsp.h>
#include <trezor_rtl.h>
#include <sys/irq.h>
#include <sys/mpu.h>
#include "display_io.h"
#include "irq.h"
#include "mpu.h"
__IO DISP_MEM_TYPE *const DISPLAY_CMD_ADDRESS =
(__IO DISP_MEM_TYPE *const)((uint32_t)DISPLAY_MEMORY_BASE);

View File

@ -20,7 +20,7 @@
#include <trezor_bsp.h>
#include <trezor_rtl.h>
#include <display.h>
#include <io/display.h>
#include "display_io.h"
#include "display_panel.h"

Some files were not shown because too many files have changed in this diff Show More