diff --git a/core/Makefile b/core/Makefile index de6c937d5e..0fb674efea 100644 --- a/core/Makefile +++ b/core/Makefile @@ -327,7 +327,7 @@ build_kernel: ## build kernel image $(SCONS) $(KERNEL_BUILD_DIR)/kernel.bin build_firmware: MICROPY_ENABLE_SOURCE_LINE ?= 0 -build_firmware: templates build_cross build_secmon build_kernel ## build firmware with frozen modules +build_firmware: templates build_cross $(if $(or $(filter 1,$(PRODUCTION)),$(filter 1,$(UNSAFE_FW))),,build_secmon) build_kernel ## build firmware with frozen modules $(SCONS) $(FIRMWARE_BUILD_DIR)/firmware.bin build_unix: MICROPY_ENABLE_SOURCE_LINE ?= 1 diff --git a/core/SConscript.kernel b/core/SConscript.kernel index 735374fa1a..97dea9fb7c 100644 --- a/core/SConscript.kernel +++ b/core/SConscript.kernel @@ -8,6 +8,7 @@ BITCOIN_ONLY = ARGUMENTS.get('BITCOIN_ONLY', '0') PRODUCTION = ARGUMENTS.get('PRODUCTION', '0') == '1' BOOTLOADER_QA = ARGUMENTS.get('BOOTLOADER_QA', '0') == '1' BOOTLOADER_DEVEL = ARGUMENTS.get('BOOTLOADER_DEVEL', '0') == '1' +UNSAFE_FW = ARGUMENTS.get('UNSAFE_FW', '0') == '1' EVERYTHING = BITCOIN_ONLY != '1' TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T2T1') CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0)) @@ -400,6 +401,18 @@ else: VENDORHEADER = f'embed/models/{TREZOR_MODEL}/vendorheader/vendorheader_{vendor}.bin' +if BOOTLOADER_DEVEL: + if UNSAFE_FW: + SECMON = f'embed/models/{TREZOR_MODEL}/secmon/secmon_DEV.bin' + SECMON_API = f'embed/models/{TREZOR_MODEL}/secmon/secmon_api_DEV.o' + else: + SECMON = f'build/secmon/secmon.bin' + SECMON_API = f'build/secmon/secmon_api.o' +else: + SECMON = f'embed/models/{TREZOR_MODEL}/secmon/secmon.bin' + SECMON_API = f'embed/models/{TREZOR_MODEL}/secmon/secmon_api.o' + + obj_program.extend( env.Command( @@ -415,7 +428,7 @@ if "secmon_layout" in FEATURES_AVAILABLE: env, 'secmon', 'build/secmon/secmon.o', - f'build/secmon/secmon.bin', + SECMON, ) linkerscript_gen = env.Command( @@ -440,7 +453,7 @@ rust = tools.add_rust_lib( if "secmon_layout" in FEATURES_AVAILABLE: - SECMON_LIB = 'build/secmon/secmon_api.o' + SECMON_LIB = SECMON_API else: SECMON_LIB = '' diff --git a/core/SConscript.secmon b/core/SConscript.secmon index c8a526771b..2857cca04d 100644 --- a/core/SConscript.secmon +++ b/core/SConscript.secmon @@ -8,6 +8,7 @@ BITCOIN_ONLY = ARGUMENTS.get('BITCOIN_ONLY', '0') PRODUCTION = ARGUMENTS.get('PRODUCTION', '0') == '1' BOOTLOADER_QA = ARGUMENTS.get('BOOTLOADER_QA', '0') == '1' BOOTLOADER_DEVEL = ARGUMENTS.get('BOOTLOADER_DEVEL', '0') == '1' +UNSAFE_FW = ARGUMENTS.get('UNSAFE_FW', '0') == '1' EVERYTHING = BITCOIN_ONLY != '1' TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T2T1') CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0)) diff --git a/core/embed/models/T3W1/secmon/secmon_DEV.bin b/core/embed/models/T3W1/secmon/secmon_DEV.bin new file mode 100755 index 0000000000..79a8a74ab0 Binary files /dev/null and b/core/embed/models/T3W1/secmon/secmon_DEV.bin differ diff --git a/core/embed/models/T3W1/secmon/secmon_api_DEV.o b/core/embed/models/T3W1/secmon/secmon_api_DEV.o new file mode 100644 index 0000000000..5c803095f8 Binary files /dev/null and b/core/embed/models/T3W1/secmon/secmon_api_DEV.o differ