1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-06 12:51:21 +00:00

build(core): allow printing Rust types' sizes during build

https://nnethercote.github.io/perf-book/type-sizes.html#measuring-type-sizes

[no changelog]
This commit is contained in:
Roman Zeyde 2025-01-22 16:14:40 +02:00 committed by Roman Zeyde
parent 5e71ea355c
commit 830f038360
2 changed files with 6 additions and 0 deletions

View File

@ -44,6 +44,7 @@ TREZOR_EMULATOR_DEBUGGABLE ?= 0
QUIET_MODE ?= 0
TREZOR_DISABLE_ANIMATION ?= $(if $(filter 0,$(PYOPT)),1,0)
STORAGE_INSECURE_TESTING_MODE ?= 0
RUST_PRINT_TYPES_SIZES ?= 0
# OpenOCD interface default. Alternative: ftdi/olimex-arm-usb-tiny-h
OPENOCD_INTERFACE ?= stlink
@ -122,6 +123,7 @@ SCONS_VARS = \
PRODUCTION="$(PRODUCTION)" \
PYOPT="$(PYOPT)" \
QUIET_MODE="$(QUIET_MODE)" \
RUST_PRINT_TYPES_SIZES="$(RUST_PRINT_TYPES_SIZES)" \
SCM_REVISION="$(SCM_REVISION)" \
STORAGE_INSECURE_TESTING_MODE="$(STORAGE_INSECURE_TESTING_MODE)" \
THP="$(THP)" \

View File

@ -790,6 +790,10 @@ def cargo_build():
env.get('ENV')['TREZOR_MODEL'] = TREZOR_MODEL
if ARGUMENTS.get('RUST_PRINT_TYPES_SIZES', '0') == '1':
# see https://nnethercote.github.io/perf-book/type-sizes.html#measuring-type-sizes for more details
env.Append(ENV={'RUSTFLAGS': '-Z print-type-sizes'})
bindgen_macros = tools.get_bindgen_defines(env.get("CPPDEFINES"), ALLPATHS)
build_dir = str(Dir('.').abspath)