Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build/docs: running emulator in valgrind #4280

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ stdenvNoCC.mkDerivation ({
shellcheck
gdb
openocd-stm
kcachegrind
] ++ lib.optionals (devTools && acceptJlink) [
nrfutil
nrfconnect
Expand Down
78 changes: 39 additions & 39 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ JOBS = $(shell sysctl -n hw.perflevel0.physicalcpu 2>/dev/null ||\
nproc 2>/dev/null ||\
echo 4)
MAKE = make -j $(JOBS)
SCONS = scons -Q -j $(JOBS)

BUILD_DIR = build
BOARDLOADER_BUILD_DIR = $(BUILD_DIR)/boardloader
Expand Down Expand Up @@ -40,6 +39,8 @@ PYTEST_TIMEOUT ?= 500
TEST_LANG ?= "en"
NEW_RENDERING ?= 1
THP ?= 0
TREZOR_EMULATOR_DEBUGGABLE ?= 0
QUIET_MODE ?= 0

# OpenOCD interface default. Alternative: ftdi/olimex-arm-usb-tiny-h
OPENOCD_INTERFACE ?= stlink
Expand Down Expand Up @@ -124,6 +125,30 @@ RUST_TARGET=$(shell rustc -vV | sed -n 's/host: //p')

MULTICORE ?= "auto"

SCONS_VARS = \
BITCOIN_ONLY="$(BITCOIN_ONLY)" \
BOOTLOADER_DEVEL="$(BOOTLOADER_DEVEL)" \
BOOTLOADER_QA="$(BOOTLOADER_QA)" \
CFLAGS="$(CFLAGS)" \
CMAKELISTS="$(CMAKELISTS)" \
DISABLE_OPTIGA="$(DISABLE_OPTIGA)" \
NEW_RENDERING="$(NEW_RENDERING)" \
PRODUCTION="$(PRODUCTION)" \
PYOPT="$(PYOPT)" \
THP="$(THP)" \
TREZOR_EMULATOR_ASAN="$(ADDRESS_SANITIZER)" \
TREZOR_EMULATOR_DEBUGGABLE=$(TREZOR_EMULATOR_DEBUGGABLE) \
TREZOR_MEMPERF="$(TREZOR_MEMPERF)" \
TREZOR_MODEL="$(TREZOR_MODEL)" \
QUIET_MODE="$(QUIET_MODE)"

SCONS_OPTS = -Q -j $(JOBS)
ifeq ($(QUIET_MODE),1)
SCONS_OPTS += --quiet
endif

SCONS = scons $(SCONS_OPTS) $(SCONS_VARS)

## help commands:

help: ## show this help
Expand Down Expand Up @@ -244,68 +269,43 @@ build: build_boardloader build_bootloader build_firmware build_prodtest build_un
build_embed: build_boardloader build_bootloader build_firmware # build boardloader, bootloader, firmware

build_boardloader: ## build boardloader
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" \
CMAKELISTS="$(CMAKELISTS)" NEW_RENDERING="$(NEW_RENDERING)" $(BOARDLOADER_BUILD_DIR)/boardloader.bin
$(SCONS) $(BOARDLOADER_BUILD_DIR)/boardloader.bin

build_bootloader: ## build bootloader
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" \
CMAKELISTS="$(CMAKELISTS)" BOOTLOADER_QA="$(BOOTLOADER_QA)" BOOTLOADER_DEVEL="$(BOOTLOADER_DEVEL)" \
NEW_RENDERING="$(NEW_RENDERING)" $(BOOTLOADER_BUILD_DIR)/bootloader.bin
$(SCONS) $(BOOTLOADER_BUILD_DIR)/bootloader.bin

build_bootloader_ci: ## build CI device testing bootloader
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" \
CMAKELISTS="$(CMAKELISTS)" $(BOOTLOADER_CI_BUILD_DIR)/bootloader.bin
$(SCONS) $(BOOTLOADER_CI_BUILD_DIR)/bootloader.bin

build_bootloader_emu: ## build the unix bootloader emulator
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" \
CMAKELISTS="$(CMAKELISTS)" NEW_RENDERING="$(NEW_RENDERING)" $(BOOTLOADER_EMU_BUILD_DIR)/bootloader.elf
$(SCONS) $(BOOTLOADER_EMU_BUILD_DIR)/bootloader.elf

build_bootloader_emu_debug: ## build the unix bootloader emulator
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" \
CMAKELISTS="$(CMAKELISTS)" NEW_RENDERING="$(NEW_RENDERING)" TREZOR_EMULATOR_DEBUGGABLE=1 \
$(BOOTLOADER_EMU_BUILD_DIR)/bootloader.elf
$(SCONS) TREZOR_EMULATOR_DEBUGGABLE=1 $(BOOTLOADER_EMU_BUILD_DIR)/bootloader.elf

build_prodtest: ## build production test firmware
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" \
CMAKELISTS="$(CMAKELISTS)" BOOTLOADER_DEVEL="$(BOOTLOADER_DEVEL)" $(PRODTEST_BUILD_DIR)/prodtest.bin
$(SCONS) $(PRODTEST_BUILD_DIR)/prodtest.bin

build_reflash: ## build reflash firmware + reflash image
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" \
CMAKELISTS="$(CMAKELISTS)" NEW_RENDERING="$(NEW_RENDERING)" $(REFLASH_BUILD_DIR)/reflash.bin
$(SCONS) $(REFLASH_BUILD_DIR)/reflash.bin
dd if=build/boardloader/boardloader.bin of=$(REFLASH_BUILD_DIR)/sdimage.bin bs=1 seek=0
dd if=build/bootloader/bootloader.bin of=$(REFLASH_BUILD_DIR)/sdimage.bin bs=1 seek=49152

build_kernel: ## build kernel image
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" \
TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" \
BOOTLOADER_QA="$(BOOTLOADER_QA)" BOOTLOADER_DEVEL="$(BOOTLOADER_DEVEL)" \
$(KERNEL_BUILD_DIR)/kernel.bin
$(SCONS) $(KERNEL_BUILD_DIR)/kernel.bin

build_firmware: templates build_cross build_kernel ## build firmware with frozen modules
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" \
TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" \
PYOPT="$(PYOPT)" BITCOIN_ONLY="$(BITCOIN_ONLY)" \
BOOTLOADER_QA="$(BOOTLOADER_QA)" BOOTLOADER_DEVEL="$(BOOTLOADER_DEVEL)" \
DISABLE_OPTIGA="$(DISABLE_OPTIGA)" THP="$(THP)" NEW_RENDERING="$(NEW_RENDERING)" \
$(FIRMWARE_BUILD_DIR)/firmware.bin
$(SCONS) $(FIRMWARE_BUILD_DIR)/firmware.bin

build_unix: templates ## build unix port
$(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/trezor-emu-core $(UNIX_PORT_OPTS) \
TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" THP="$(THP)" \
PYOPT="0" BITCOIN_ONLY="$(BITCOIN_ONLY)" TREZOR_EMULATOR_ASAN="$(ADDRESS_SANITIZER)" \
NEW_RENDERING="$(NEW_RENDERING)"
$(SCONS) $(UNIX_BUILD_DIR)/trezor-emu-core $(UNIX_PORT_OPTS)

build_unix_frozen: templates build_cross ## build unix port with frozen modules
$(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/trezor-emu-core $(UNIX_PORT_OPTS) \
TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" \
PYOPT="$(PYOPT)" BITCOIN_ONLY="$(BITCOIN_ONLY)" TREZOR_EMULATOR_ASAN="$(ADDRESS_SANITIZER)" \
TREZOR_MEMPERF="$(TREZOR_MEMPERF)" TREZOR_EMULATOR_FROZEN=1 NEW_RENDERING="$(NEW_RENDERING)"
$(SCONS) $(UNIX_BUILD_DIR)/trezor-emu-core $(UNIX_PORT_OPTS) TREZOR_EMULATOR_FROZEN=1

build_unix_debug: templates ## build unix port
$(SCONS) --max-drift=1 CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/trezor-emu-core $(UNIX_PORT_OPTS) \
TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" \
BITCOIN_ONLY="$(BITCOIN_ONLY)" TREZOR_EMULATOR_ASAN=1 TREZOR_EMULATOR_DEBUGGABLE=1 \
NEW_RENDERING="$(NEW_RENDERING)"
$(SCONS) --max-drift=1 $(UNIX_BUILD_DIR)/trezor-emu-core $(UNIX_PORT_OPTS) \
TREZOR_EMULATOR_ASAN=1 TREZOR_EMULATOR_DEBUGGABLE=1

build_cross: ## build mpy-cross port
$(MAKE) -C vendor/micropython/mpy-cross $(CROSS_PORT_OPTS)
Expand Down
10 changes: 6 additions & 4 deletions core/SConscript.boardloader
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ else:


env = Environment(ENV=os.environ,
CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')),
CONSTRAINTS=["limited_util_s"],
CPPDEFINES_IMPLICIT=[]
)
CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')),
CONSTRAINTS=["limited_util_s"],
CPPDEFINES_IMPLICIT=[],
CPPDEFPREFIX="-D'",
CPPDEFSUFFIX="'",
)

FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_WANTED, env, CPPDEFINES_HAL, SOURCE_HAL, PATH_HAL)

Expand Down
7 changes: 5 additions & 2 deletions core/SConscript.bootloader
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# pylint: disable=E0602

import os
import shlex
import tools, models, ui

TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
Expand Down Expand Up @@ -109,7 +110,9 @@ ui.init_ui(TREZOR_MODEL, "bootloader", CPPDEFINES_MOD, SOURCE_MOD, RUST_UI_FEATU
env = Environment(
ENV=os.environ,
CFLAGS=f"{ARGUMENTS.get('CFLAGS', '')} -DPRODUCTION={int(PRODUCTION)} -DBOOTLOADER_QA={int(BOOTLOADER_QA)}",
CPPDEFINES_IMPLICIT=[]
CPPDEFINES_IMPLICIT=[],
CPPDEFPREFIX="-D'",
CPPDEFSUFFIX="'",
)

FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_WANTED, env, CPPDEFINES_HAL, SOURCE_HAL, PATH_HAL)
Expand Down Expand Up @@ -232,7 +235,7 @@ def cargo_build():
bindgen_macros = tools.get_bindgen_defines(env.get("CPPDEFINES"), ALLPATHS)
build_dir = str(Dir('.').abspath)

return f'export BINDGEN_MACROS=\'{bindgen_macros}\'; export BUILD_DIR=\'{build_dir}\'; cd embed/rust; cargo build {profile} ' + ' '.join(cargo_opts)
return f'export BINDGEN_MACROS={shlex.quote(bindgen_macros)}; export BUILD_DIR=\'{build_dir}\'; cd embed/rust; cargo build {profile} ' + ' '.join(cargo_opts)

rust = env.Command(
target=RUST_LIBPATH,
Expand Down
9 changes: 6 additions & 3 deletions core/SConscript.bootloader_ci
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ SOURCE_NANOPB = [
ui.init_ui(TREZOR_MODEL, "bootloader", CPPDEFINES_MOD, SOURCE_MOD, RUST_UI_FEATURES)

env = Environment(
ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')),
CPPDEFINES_IMPLICIT=[]
)
ENV=os.environ,
CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')),
CPPDEFINES_IMPLICIT=[],
CPPDEFPREFIX="-D'",
CPPDEFSUFFIX="'",
)

FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_WANTED, env, CPPDEFINES_HAL, SOURCE_HAL, PATH_HAL)

Expand Down
10 changes: 8 additions & 2 deletions core/SConscript.bootloader_emu
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# pylint: disable=E0602

import os
import shlex
import tools, models, ui

TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
Expand Down Expand Up @@ -151,7 +152,12 @@ SOURCE_UNIX = [

ui.init_ui(TREZOR_MODEL, "bootloader", CPPDEFINES_MOD, SOURCE_MOD, RUST_UI_FEATURES)

env = Environment(ENV=os.environ, CFLAGS='%s -DCONFIDENTIAL= -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')))
env = Environment(
ENV=os.environ,
CFLAGS=ARGUMENTS.get('CFLAGS', '') + f" -DCONFIDENTIAL= -DPRODUCTION={ARGUMENTS.get('PRODUCTION', '0')}",
CPPDEFPREFIX="-D'",
CPPDEFSUFFIX="'",
)

FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_WANTED, env, CPPDEFINES_HAL, SOURCE_UNIX, PATH_HAL)

Expand Down Expand Up @@ -261,7 +267,7 @@ def cargo_build():
bindgen_macros = tools.get_bindgen_defines(env.get("CPPDEFINES"), ALLPATHS)
build_dir = str(Dir('.').abspath)

return f'export BINDGEN_MACROS=\'{bindgen_macros}\'; export BUILD_DIR=\'{build_dir}\'; cd embed/rust; cargo build --profile {RUST_PROFILE} ' + ' '.join(cargo_opts)
return f'export BINDGEN_MACROS={shlex.quote(bindgen_macros)}; export BUILD_DIR=\'{build_dir}\'; cd embed/rust; cargo build --profile {RUST_PROFILE} ' + ' '.join(cargo_opts)

rust = env.Command(
target=RUST_LIBPATH,
Expand Down
7 changes: 5 additions & 2 deletions core/SConscript.firmware
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# fmt: off

import os
import shlex
import tools, models, ui

BITCOIN_ONLY = ARGUMENTS.get('BITCOIN_ONLY', '0')
Expand Down Expand Up @@ -383,7 +384,9 @@ SOURCE_QSTR = SOURCE_MOD + SOURCE_MICROPYTHON + SOURCE_MICROPYTHON_SPEED
env = Environment(
ENV=os.environ,
CFLAGS=f"{ARGUMENTS.get('CFLAGS', '')} -DPRODUCTION={int(PRODUCTION)} -DPYOPT={PYOPT} -DBOOTLOADER_QA={int(BOOTLOADER_QA)} -DBITCOIN_ONLY={BITCOIN_ONLY}",
CPPDEFINES_IMPLICIT=[]
CPPDEFINES_IMPLICIT=[],
CPPDEFPREFIX="-D'",
CPPDEFSUFFIX="'",
)

FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_WANTED, env, CPPDEFINES_HAL, SOURCE_HAL, PATH_HAL)
Expand Down Expand Up @@ -766,7 +769,7 @@ def cargo_build():
bindgen_macros = tools.get_bindgen_defines(env.get("CPPDEFINES"), ALLPATHS)
build_dir = str(Dir('.').abspath)

return f'export BINDGEN_MACROS=\'{bindgen_macros}\'; export BUILD_DIR=\'{build_dir}\'; cd embed/rust; cargo build {profile} ' + ' '.join(cargo_opts)
return f'export BINDGEN_MACROS={shlex.quote(bindgen_macros)}; export BUILD_DIR=\'{build_dir}\'; cd embed/rust; cargo build {profile} ' + ' '.join(cargo_opts)

rust = env.Command(
target=RUST_LIBPATH,
Expand Down
6 changes: 4 additions & 2 deletions core/SConscript.kernel
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,10 @@ if THP:
env = Environment(
ENV=os.environ,
CFLAGS=f"{ARGUMENTS.get('CFLAGS', '')} -DPRODUCTION={int(PRODUCTION)} -DPYOPT={PYOPT} -DBOOTLOADER_QA={int(BOOTLOADER_QA)} -DBITCOIN_ONLY={BITCOIN_ONLY}",
CPPDEFINES_IMPLICIT=[]
)
CPPDEFINES_IMPLICIT=[],
CPPDEFPREFIX="-D'",
CPPDEFSUFFIX="'",
)

FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_WANTED, env, CPPDEFINES_HAL, SOURCE_HAL, PATH_HAL)

Expand Down
5 changes: 4 additions & 1 deletion core/SConscript.prodtest
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ ui.init_ui(TREZOR_MODEL, "prodtest", CPPDEFINES_MOD, SOURCE_MOD, RUST_UI_FEATURE
env = Environment(
ENV=os.environ,
CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')),
CPPDEFINES_IMPLICIT=[])
CPPDEFINES_IMPLICIT=[],
CPPDEFPREFIX="-D'",
CPPDEFSUFFIX="'",
)

FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_WANTED, env, CPPDEFINES_HAL, SOURCE_HAL, PATH_HAL)

Expand Down
6 changes: 4 additions & 2 deletions core/SConscript.reflash
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ ui.init_ui(TREZOR_MODEL, "prodtest", CPPDEFINES_MOD, SOURCE_MOD, RUST_UI_FEATURE
env = Environment(
ENV=os.environ,
CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')),
CPPDEFINES_IMPLICIT=[]
)
CPPDEFINES_IMPLICIT=[],
CPPDEFPREFIX="-D'",
CPPDEFSUFFIX="'",
)

FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_WANTED, env, CPPDEFINES_HAL, SOURCE_HAL, PATH_HAL)

Expand Down
14 changes: 10 additions & 4 deletions core/SConscript.unix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# fmt: off

import os
import shlex
import tools, models, ui

BITCOIN_ONLY = ARGUMENTS.get('BITCOIN_ONLY', '0')
Expand Down Expand Up @@ -437,7 +438,12 @@ if PYOPT == '0' or not FROZEN:
else:
STATIC=""

env = Environment(ENV=os.environ, CFLAGS='%s -DCONFIDENTIAL= -DPYOPT=%s -DBITCOIN_ONLY=%s %s' % (ARGUMENTS.get('CFLAGS', ''), PYOPT, BITCOIN_ONLY, STATIC))
env = Environment(
ENV=os.environ,
CFLAGS=ARGUMENTS.get("CFLAGS", "") + f" -DCONFIDENTIAL= -DPYOPT={PYOPT} -DBITCOIN_ONLY={BITCOIN_ONLY} {STATIC}",
CPPDEFPREFIX="-D'",
CPPDEFSUFFIX="'",
)

FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_WANTED, env, CPPDEFINES_HAL, SOURCE_UNIX, PATH_HAL)

Expand Down Expand Up @@ -495,7 +501,7 @@ if ARGUMENTS.get('TREZOR_EMULATOR_DEBUGGABLE', '0') == '1':

if ARGUMENTS.get('TREZOR_MEMPERF', '0') == '1':
CPPDEFINES_MOD += [
('MICROPY_TREZOR_MEMPERF', '\(1\)')
('MICROPY_TREZOR_MEMPERF', '(1)')
]

env.Replace(
Expand Down Expand Up @@ -525,7 +531,7 @@ env.Replace(
CPPDEFINES=[
'TREZOR_EMULATOR',
'TREZOR_MODEL_'+TREZOR_MODEL,
('MP_CONFIGFILE', '\\"embed/unix/mpconfigport.h\\"'),
('MP_CONFIGFILE', '"embed/unix/mpconfigport.h"'),
ui.get_ui_layout(TREZOR_MODEL),
] + CPPDEFINES_MOD + CPPDEFINES_HAL,
ASPPFLAGS='$CFLAGS $CCFLAGS', )
Expand Down Expand Up @@ -835,7 +841,7 @@ def cargo_build():
bindgen_macros = tools.get_bindgen_defines(env.get("CPPDEFINES"), ALLPATHS)
build_dir = str(Dir('.').abspath)

return f'export BINDGEN_MACROS=\'{bindgen_macros}\'; export BUILD_DIR=\'{build_dir}\'; cd embed/rust; cargo build --profile {RUST_PROFILE} --target-dir=../../build/unix/rust --no-default-features --features "{" ".join(features)}" --target {TARGET}'
return f'export BINDGEN_MACROS={shlex.quote(bindgen_macros)}; export BUILD_DIR=\'{build_dir}\'; cd embed/rust; cargo build --profile {RUST_PROFILE} --target-dir=../../build/unix/rust --no-default-features --features "{" ".join(features)}" --target {TARGET}'

rust = env.Command(
target=RUST_LIBPATH,
Expand Down
3 changes: 3 additions & 0 deletions core/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ SConscript('SConscript.firmware', variant_dir='build/firmware', duplicate=False)
SConscript('SConscript.prodtest', variant_dir='build/prodtest', duplicate=False)
SConscript('SConscript.reflash', variant_dir='build/reflash', duplicate=False)
SConscript('SConscript.unix', variant_dir='build/unix', duplicate=False)

if ARGUMENTS.get('QUIET_MODE', '1'):
Progress('$TARGET\r', overwrite=True)
Loading
Loading