鏡像自
https://github.com/trezor/trezor-firmware.git
synced 2025-07-04 13:52:35 +00:00
Revert "core: replace BITCOIN_ONLY with a constant only in src/trezor/utils.py"
This reverts commit b9e7e93bcf
.
Unfortunately this does not work, compiler cannot see it is a literal constant,
so it won't get optimized out, even when we use const(0). Also const(False)
is not supported at all.
This commit is contained in:
父節點
6a9d986e20
當前提交
d393fc6e85
@ -23,13 +23,11 @@ def generate(env):
|
|||||||
target = str(target[0])
|
target = str(target[0])
|
||||||
source = str(source[0])
|
source = str(source[0])
|
||||||
source_name = source.replace(env['source_dir'], '')
|
source_name = source.replace(env['source_dir'], '')
|
||||||
# set utils.BITCOIN_ONLY to constant in src/trezor/utils.py
|
# replace "utils.BITCOIN_ONLY" with literal constant (True/False)
|
||||||
if source == "src/trezor/utils.py":
|
# so the compiler can optimize out the things we don't want
|
||||||
btc_only = 'True' if env['bitcoin_only'] == '1' else 'False'
|
btc_only = 'True' if env['bitcoin_only'] == '1' else 'False'
|
||||||
interim = "%s.i" % target[:-4] # replace .mpy with .i
|
interim = "%s.i" % target[:-4] # replace .mpy with .i
|
||||||
return '$SED "s:^BITCOIN_ONLY = BITCOIN_ONLY$:BITCOIN_ONLY = %s:g" %s > %s && $MPY_CROSS -o %s -s %s %s' % (btc_only, source, interim, target, source_name, interim)
|
return '$SED "s:utils\.BITCOIN_ONLY:%s:g" %s > %s && $MPY_CROSS -o %s -s %s %s' % (btc_only, source, interim, target, source_name, interim)
|
||||||
else:
|
|
||||||
return '$MPY_CROSS -o %s -s %s %s' % (target, source_name, source)
|
|
||||||
|
|
||||||
env['BUILDERS']['FrozenModule'] = SCons.Builder.Builder(
|
env['BUILDERS']['FrozenModule'] = SCons.Builder.Builder(
|
||||||
generator=generate_frozen_module,
|
generator=generate_frozen_module,
|
||||||
|
@ -14,9 +14,6 @@ from trezorutils import ( # noqa: F401
|
|||||||
set_mode_unprivileged,
|
set_mode_unprivileged,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Don't remove! This line will be modified when freezing the module
|
|
||||||
BITCOIN_ONLY = BITCOIN_ONLY
|
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
if EMULATOR:
|
if EMULATOR:
|
||||||
import uos
|
import uos
|
||||||
|
載入中…
新增問題並參考
Block a user