mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
2e578572dd
Squashed commit of the following: commit 060563458fbc3b4a17f4d77ba5cd62d0c265c806 Author: matejcik <ja@matejcik.cz> Date: Fri May 10 16:16:19 2019 +0200 skip t1 in eos test commit f759089fef29501467b62bf1540715132a72c4cf Author: matejcik <ja@matejcik.cz> Date: Fri May 10 15:55:20 2019 +0200 make style commit 3ecdd5f77b331d7a6e5a46a10c79d80f214f31bd Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Thu May 9 22:05:41 2019 +0300 Refinements in asset to to string conversion function according to code review and test cases for amounts less than 1 commit 72e44a35bada76abdd94ab866c2113a6d9d85191 Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Wed May 8 00:27:45 2019 +0300 Moved to input_flow rest of the tests, cleanup and styling commit 92f9acbabcbef44a6912b074a309393450f0c8de Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Tue May 7 21:47:12 2019 +0300 Fix for amounts less then 1 commit 8a0154f7432ab78e69a123202a97194d34c2a3cb Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Mon May 6 23:26:24 2019 +0300 removed unnecessary peace of code commit b25c15de3eb1df863760e81ca69f09094349c26e Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Mon May 6 23:16:57 2019 +0300 Fixed validate path parameters commit f0f6e7036a8b88d9c5c6b702a8d851e9a9bd3378 Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Mon May 6 23:04:58 2019 +0300 Fixes commit 0c64d3814300df86d452975b2bd46fea13f512d2 Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Mon May 6 22:19:51 2019 +0300 Fixed styling commit 41d1e77231e7da78fade9b2efa1b7d1980f0d3a8 Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Mon May 6 22:13:58 2019 +0300 Changes to core, added CURVE to path validation commit c045b4554ee8e058dbfe35f715b003d0d85ab1d4 Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Mon May 6 22:07:37 2019 +0300 Changes according to review commit 3f0e6cfd40e7d87dc3287bc3a0b2b9db5dea5377 Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Mon Apr 29 21:37:16 2019 +0300 Added change to make expiration date timezone agnostic commit efdf44c326cc3f3137c447e798db5439b57c91fa Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Thu Apr 18 00:14:30 2019 +0300 changes according to code review commit 3b3723da8f8f536c7c370a14236ea81aac25080a Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Tue Apr 16 23:44:50 2019 +0300 Merged python to monorepo commit da6b0c683c29388e15c889ecea6e7f7471961a19 Author: Andriy Tkachyshyn <atkachyshyn@gmail.com> Date: Tue Apr 16 23:13:42 2019 +0300 Merged core to monorepo
446 lines
14 KiB
Plaintext
446 lines
14 KiB
Plaintext
# pylint: disable=E0602
|
|
|
|
import os
|
|
|
|
CCFLAGS_MOD = ''
|
|
CPPPATH_MOD = []
|
|
CPPDEFINES_MOD = []
|
|
SOURCE_MOD = []
|
|
SOURCE_MOD_SECP256K1_ZKP = []
|
|
|
|
PYOPT = '1'
|
|
|
|
# modtrezorconfig
|
|
CPPPATH_MOD += [
|
|
'embed/extmod/modtrezorconfig',
|
|
'vendor/trezor-storage',
|
|
]
|
|
SOURCE_MOD += [
|
|
'embed/extmod/modtrezorconfig/modtrezorconfig.c',
|
|
'vendor/trezor-storage/norcow.c',
|
|
'vendor/trezor-storage/storage.c',
|
|
]
|
|
|
|
# modtrezorcrypto
|
|
CCFLAGS_MOD += '-Wno-sequence-point '
|
|
CPPPATH_MOD += [
|
|
'vendor/trezor-crypto',
|
|
]
|
|
CPPDEFINES_MOD += [
|
|
'AES_128',
|
|
'AES_192',
|
|
('USE_KECCAK', '1'),
|
|
('USE_ETHEREUM', '1'),
|
|
('USE_MONERO', '1'),
|
|
('USE_CARDANO', '1'),
|
|
('USE_NEM', '1'),
|
|
('USE_EOS', '1'),
|
|
]
|
|
SOURCE_MOD += [
|
|
'embed/extmod/modtrezorcrypto/modtrezorcrypto.c',
|
|
'embed/extmod/modtrezorcrypto/crc.c',
|
|
'vendor/trezor-crypto/address.c',
|
|
'vendor/trezor-crypto/aes/aescrypt.c',
|
|
'vendor/trezor-crypto/aes/aeskey.c',
|
|
'vendor/trezor-crypto/aes/aes_modes.c',
|
|
'vendor/trezor-crypto/aes/aestab.c',
|
|
'vendor/trezor-crypto/base58.c',
|
|
'vendor/trezor-crypto/base32.c',
|
|
'vendor/trezor-crypto/bignum.c',
|
|
'vendor/trezor-crypto/bip32.c',
|
|
'vendor/trezor-crypto/bip39.c',
|
|
'vendor/trezor-crypto/blake256.c',
|
|
'vendor/trezor-crypto/blake2b.c',
|
|
'vendor/trezor-crypto/blake2s.c',
|
|
'vendor/trezor-crypto/curves.c',
|
|
'vendor/trezor-crypto/ecdsa.c',
|
|
'vendor/trezor-crypto/chacha20poly1305/chacha20poly1305.c',
|
|
'vendor/trezor-crypto/chacha20poly1305/chacha_merged.c',
|
|
'vendor/trezor-crypto/chacha20poly1305/poly1305-donna.c',
|
|
'vendor/trezor-crypto/chacha20poly1305/rfc7539.c',
|
|
'vendor/trezor-crypto/ed25519-donna/curve25519-donna-32bit.c',
|
|
'vendor/trezor-crypto/ed25519-donna/curve25519-donna-helpers.c',
|
|
'vendor/trezor-crypto/ed25519-donna/curve25519-donna-scalarmult-base.c',
|
|
'vendor/trezor-crypto/ed25519-donna/ed25519.c',
|
|
'vendor/trezor-crypto/ed25519-donna/ed25519-donna-32bit-tables.c',
|
|
'vendor/trezor-crypto/ed25519-donna/ed25519-donna-basepoint-table.c',
|
|
'vendor/trezor-crypto/ed25519-donna/ed25519-donna-impl-base.c',
|
|
'vendor/trezor-crypto/ed25519-donna/ed25519-keccak.c',
|
|
'vendor/trezor-crypto/ed25519-donna/ed25519-sha3.c',
|
|
'vendor/trezor-crypto/ed25519-donna/modm-donna-32bit.c',
|
|
'vendor/trezor-crypto/monero/base58.c',
|
|
'vendor/trezor-crypto/monero/serialize.c',
|
|
'vendor/trezor-crypto/monero/xmr.c',
|
|
'vendor/trezor-crypto/groestl.c',
|
|
'vendor/trezor-crypto/hasher.c',
|
|
'vendor/trezor-crypto/hmac.c',
|
|
'vendor/trezor-crypto/memzero.c',
|
|
'vendor/trezor-crypto/nem.c',
|
|
'vendor/trezor-crypto/nist256p1.c',
|
|
'vendor/trezor-crypto/pbkdf2.c',
|
|
'vendor/trezor-crypto/rand.c',
|
|
'vendor/trezor-crypto/ripemd160.c',
|
|
'vendor/trezor-crypto/secp256k1.c',
|
|
'vendor/trezor-crypto/sha2.c',
|
|
'vendor/trezor-crypto/sha3.c',
|
|
'vendor/trezor-crypto/shamir.c',
|
|
]
|
|
|
|
# libsecp256k1-zkp
|
|
CPPPATH_MOD += [
|
|
'vendor/secp256k1-zkp',
|
|
'vendor/secp256k1-zkp/src',
|
|
'vendor/secp256k1-zkp/include',
|
|
]
|
|
CPPDEFINES_MOD += [
|
|
'SECP256K1_BUILD',
|
|
'USE_NUM_NONE',
|
|
'USE_FIELD_INV_BUILTIN',
|
|
'USE_SCALAR_INV_BUILTIN',
|
|
'USE_FIELD_10X26',
|
|
'USE_SCALAR_8X32',
|
|
'USE_ECMULT_STATIC_PRECOMPUTATION',
|
|
'USE_EXTERNAL_DEFAULT_CALLBACKS',
|
|
('ECMULT_WINDOW_SIZE', '8'),
|
|
'ENABLE_MODULE_GENERATOR',
|
|
'ENABLE_MODULE_RANGEPROOF',
|
|
'ENABLE_MODULE_RECOVERY',
|
|
'ENABLE_MODULE_ECDH',
|
|
]
|
|
SOURCE_MOD_SECP256K1_ZKP += [
|
|
'vendor/secp256k1-zkp/src/secp256k1.c',
|
|
]
|
|
|
|
# modtrezorio
|
|
SOURCE_MOD += [
|
|
'embed/extmod/modtrezorio/modtrezorio.c',
|
|
]
|
|
|
|
# modtrezorui
|
|
CPPDEFINES_MOD += [
|
|
'TREZOR_FONT_BOLD_ENABLE',
|
|
'TREZOR_FONT_NORMAL_ENABLE',
|
|
'TREZOR_FONT_MONO_ENABLE',
|
|
'TREZOR_FONT_MONO_BOLD_ENABLE',
|
|
]
|
|
SOURCE_MOD += [
|
|
'embed/extmod/modtrezorui/display.c',
|
|
'embed/extmod/modtrezorui/inflate.c',
|
|
'embed/extmod/modtrezorui/font_bitmap.c',
|
|
'embed/extmod/modtrezorui/font_roboto_bold_20.c',
|
|
'embed/extmod/modtrezorui/font_roboto_regular_20.c',
|
|
'embed/extmod/modtrezorui/font_robotomono_bold_20.c',
|
|
'embed/extmod/modtrezorui/font_robotomono_regular_20.c',
|
|
'embed/extmod/modtrezorui/modtrezorui.c',
|
|
'embed/extmod/modtrezorui/qr-code-generator/qrcodegen.c',
|
|
]
|
|
if ARGUMENTS.get('TREZOR_EMULATOR_NOUI', 0):
|
|
CPPDEFINES_MOD += ['TREZOR_EMULATOR_NOUI']
|
|
if ARGUMENTS.get('TREZOR_EMULATOR_RASPI', 0):
|
|
CPPDEFINES_MOD += ['TREZOR_EMULATOR_RASPI']
|
|
if ARGUMENTS.get('TREZOR_EMULATOR_FROZEN', 0):
|
|
CPPDEFINES_MOD += ['TREZOR_EMULATOR_FROZEN']
|
|
|
|
# modtrezorutils
|
|
SOURCE_MOD += [
|
|
'embed/extmod/modtrezorutils/modtrezorutils.c',
|
|
]
|
|
|
|
# modutime
|
|
SOURCE_MOD += [
|
|
'vendor/micropython/ports/unix/modtime.c',
|
|
]
|
|
|
|
SOURCE_MICROPYTHON = [
|
|
'vendor/micropython/extmod/modubinascii.c',
|
|
'vendor/micropython/extmod/moductypes.c',
|
|
'vendor/micropython/extmod/moduheapq.c',
|
|
'vendor/micropython/extmod/modutimeq.c',
|
|
'vendor/micropython/extmod/utime_mphal.c',
|
|
'vendor/micropython/lib/mp-readline/readline.c',
|
|
'vendor/micropython/ports/unix/modos.c',
|
|
'vendor/micropython/py/argcheck.c',
|
|
'vendor/micropython/py/asmarm.c',
|
|
'vendor/micropython/py/asmbase.c',
|
|
'vendor/micropython/py/asmthumb.c',
|
|
'vendor/micropython/py/asmx64.c',
|
|
'vendor/micropython/py/asmx86.c',
|
|
'vendor/micropython/py/asmxtensa.c',
|
|
'vendor/micropython/py/bc.c',
|
|
'vendor/micropython/py/binary.c',
|
|
'vendor/micropython/py/builtinevex.c',
|
|
'vendor/micropython/py/builtinhelp.c',
|
|
'vendor/micropython/py/builtinimport.c',
|
|
'vendor/micropython/py/compile.c',
|
|
'vendor/micropython/py/emitbc.c',
|
|
'vendor/micropython/py/emitcommon.c',
|
|
'vendor/micropython/py/emitglue.c',
|
|
'vendor/micropython/py/emitinlinethumb.c',
|
|
'vendor/micropython/py/emitinlinextensa.c',
|
|
'vendor/micropython/py/emitnarm.c',
|
|
'vendor/micropython/py/emitnative.c',
|
|
'vendor/micropython/py/emitnthumb.c',
|
|
'vendor/micropython/py/emitnx64.c',
|
|
'vendor/micropython/py/emitnx86.c',
|
|
'vendor/micropython/py/emitnxtensa.c',
|
|
'vendor/micropython/py/formatfloat.c',
|
|
'vendor/micropython/py/frozenmod.c',
|
|
'vendor/micropython/py/gc.c',
|
|
'vendor/micropython/py/lexer.c',
|
|
'vendor/micropython/py/malloc.c',
|
|
'vendor/micropython/py/map.c',
|
|
'vendor/micropython/py/modarray.c',
|
|
'vendor/micropython/py/modbuiltins.c',
|
|
'vendor/micropython/py/modcmath.c',
|
|
'vendor/micropython/py/modcollections.c',
|
|
'vendor/micropython/py/modgc.c',
|
|
'vendor/micropython/py/modio.c',
|
|
'vendor/micropython/py/modmath.c',
|
|
'vendor/micropython/py/modmicropython.c',
|
|
'vendor/micropython/py/modstruct.c',
|
|
'vendor/micropython/py/modsys.c',
|
|
'vendor/micropython/py/modthread.c',
|
|
'vendor/micropython/py/moduerrno.c',
|
|
'vendor/micropython/py/mpprint.c',
|
|
'vendor/micropython/py/mpstate.c',
|
|
'vendor/micropython/py/mpz.c',
|
|
'vendor/micropython/py/nativeglue.c',
|
|
'vendor/micropython/py/nlr.c',
|
|
'vendor/micropython/py/nlrsetjmp.c',
|
|
'vendor/micropython/py/nlrthumb.c',
|
|
'vendor/micropython/py/nlrx64.c',
|
|
'vendor/micropython/py/nlrx86.c',
|
|
'vendor/micropython/py/nlrxtensa.c',
|
|
'vendor/micropython/py/obj.c',
|
|
'vendor/micropython/py/objarray.c',
|
|
'vendor/micropython/py/objattrtuple.c',
|
|
'vendor/micropython/py/objbool.c',
|
|
'vendor/micropython/py/objboundmeth.c',
|
|
'vendor/micropython/py/objcell.c',
|
|
'vendor/micropython/py/objclosure.c',
|
|
'vendor/micropython/py/objcomplex.c',
|
|
'vendor/micropython/py/objdeque.c',
|
|
'vendor/micropython/py/objdict.c',
|
|
'vendor/micropython/py/objenumerate.c',
|
|
'vendor/micropython/py/objexcept.c',
|
|
'vendor/micropython/py/objfilter.c',
|
|
'vendor/micropython/py/objfloat.c',
|
|
'vendor/micropython/py/objfun.c',
|
|
'vendor/micropython/py/objgenerator.c',
|
|
'vendor/micropython/py/objgetitemiter.c',
|
|
'vendor/micropython/py/objint.c',
|
|
'vendor/micropython/py/objint_longlong.c',
|
|
'vendor/micropython/py/objint_mpz.c',
|
|
'vendor/micropython/py/objlist.c',
|
|
'vendor/micropython/py/objmap.c',
|
|
'vendor/micropython/py/objmodule.c',
|
|
'vendor/micropython/py/objnamedtuple.c',
|
|
'vendor/micropython/py/objnone.c',
|
|
'vendor/micropython/py/objobject.c',
|
|
'vendor/micropython/py/objpolyiter.c',
|
|
'vendor/micropython/py/objproperty.c',
|
|
'vendor/micropython/py/objrange.c',
|
|
'vendor/micropython/py/objreversed.c',
|
|
'vendor/micropython/py/objset.c',
|
|
'vendor/micropython/py/objsingleton.c',
|
|
'vendor/micropython/py/objslice.c',
|
|
'vendor/micropython/py/objstr.c',
|
|
'vendor/micropython/py/objstringio.c',
|
|
'vendor/micropython/py/objstrunicode.c',
|
|
'vendor/micropython/py/objtuple.c',
|
|
'vendor/micropython/py/objtype.c',
|
|
'vendor/micropython/py/objzip.c',
|
|
'vendor/micropython/py/opmethods.c',
|
|
'vendor/micropython/py/parse.c',
|
|
'vendor/micropython/py/parsenum.c',
|
|
'vendor/micropython/py/parsenumbase.c',
|
|
'vendor/micropython/py/persistentcode.c',
|
|
'vendor/micropython/py/pystack.c',
|
|
'vendor/micropython/py/qstr.c',
|
|
'vendor/micropython/py/reader.c',
|
|
'vendor/micropython/py/repl.c',
|
|
'vendor/micropython/py/runtime.c',
|
|
'vendor/micropython/py/runtime_utils.c',
|
|
'vendor/micropython/py/scheduler.c',
|
|
'vendor/micropython/py/scope.c',
|
|
'vendor/micropython/py/sequence.c',
|
|
'vendor/micropython/py/showbc.c',
|
|
'vendor/micropython/py/smallint.c',
|
|
'vendor/micropython/py/stackctrl.c',
|
|
'vendor/micropython/py/stream.c',
|
|
'vendor/micropython/py/unicode.c',
|
|
'vendor/micropython/py/vm.c',
|
|
'vendor/micropython/py/vstr.c',
|
|
'vendor/micropython/py/warning.c',
|
|
]
|
|
|
|
SOURCE_UNIX = [
|
|
'vendor/micropython/ports/unix/gccollect.c',
|
|
'vendor/micropython/ports/unix/unix_mphal.c',
|
|
'vendor/micropython/ports/unix/input.c',
|
|
'vendor/micropython/ports/unix/alloc.c',
|
|
'embed/unix/common.c',
|
|
'embed/unix/profile.c',
|
|
'embed/unix/flash.c',
|
|
'embed/unix/main.c',
|
|
'embed/unix/rng.c',
|
|
'embed/unix/sdcard.c',
|
|
'embed/unix/sbu.c',
|
|
'embed/unix/touch.c',
|
|
'embed/unix/usb.c',
|
|
]
|
|
|
|
SOURCE_QSTR = SOURCE_MOD + SOURCE_MICROPYTHON + SOURCE_UNIX
|
|
|
|
env = Environment(ENV=os.environ, CFLAGS='%s -DPYOPT=%s' % (ARGUMENTS.get('CFLAGS', ''), PYOPT))
|
|
|
|
env.Tool('micropython')
|
|
|
|
env.Replace(
|
|
CC=os.getenv('CC') or 'gcc',
|
|
SED='sed',
|
|
AS='as',
|
|
AR='ar',
|
|
LINK='ld',
|
|
SIZE='size',
|
|
STRIP='strip',
|
|
OBJCOPY='objcopy', )
|
|
|
|
if env.get('ENV').get('DEBUG_BUILD', 0):
|
|
import platform
|
|
platsys = platform.system()
|
|
env.Replace(
|
|
OPTIMIZE='-O0',
|
|
LINKFLAGS='-Wl,-no_pie' if platsys == "Darwin" else '-Wl,-no-pie'
|
|
)
|
|
|
|
env.Replace(
|
|
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'), )
|
|
|
|
env.Replace(
|
|
COPT=env.get('OPTIMIZE', env.get('ENV').get('OPTIMIZE', '-Os')),
|
|
CCFLAGS='$COPT '
|
|
'-g3 '
|
|
'-std=gnu99 -Wall -Werror -Wuninitialized '
|
|
'-fdata-sections -ffunction-sections ' + CCFLAGS_MOD,
|
|
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
|
|
LIBS=['m'],
|
|
CPPPATH=[
|
|
'.',
|
|
'embed/unix',
|
|
'embed/extmod/modtrezorui',
|
|
'vendor/micropython',
|
|
'vendor/micropython/ports/unix',
|
|
'vendor/micropython/lib/mp-readline',
|
|
] + CPPPATH_MOD,
|
|
CPPDEFINES=[
|
|
'TREZOR_EMULATOR',
|
|
('TREZOR_MODEL', '$TREZOR_MODEL'),
|
|
'MICROPY_USE_READLINE',
|
|
('MP_CONFIGFILE', '\\"embed/unix/mpconfigport.h\\"'),
|
|
] + CPPDEFINES_MOD,
|
|
ASPPFLAGS='$CFLAGS $CCFLAGS', )
|
|
|
|
if not ARGUMENTS.get('TREZOR_EMULATOR_NOUI', 0):
|
|
env.ParseConfig('pkg-config --cflags --libs sdl2 SDL2_image || :')
|
|
|
|
env.Replace(
|
|
PYTHON='python',
|
|
MAKEQSTRDATA='$PYTHON vendor/micropython/py/makeqstrdata.py',
|
|
MAKEVERSIONHDR='$PYTHON vendor/micropython/py/makeversionhdr.py',
|
|
MPY_TOOL='$PYTHON vendor/micropython/tools/mpy-tool.py',
|
|
MPY_CROSS='vendor/micropython/mpy-cross/mpy-cross -O' + PYOPT
|
|
)
|
|
|
|
#
|
|
# Micropython version
|
|
#
|
|
|
|
hdr_version = env.Command(
|
|
target='genhdr/mpversion.h',
|
|
source='',
|
|
action='$MAKEVERSIONHDR $TARGET', )
|
|
|
|
#
|
|
# Qstrings
|
|
#
|
|
|
|
qstr_micropython = 'vendor/micropython/py/qstrdefs.h'
|
|
|
|
qstr_collected = env.CollectQstr(
|
|
target='genhdr/qstrdefs.collected.h', source=SOURCE_QSTR)
|
|
|
|
qstr_preprocessed = env.PreprocessQstr(
|
|
target='genhdr/qstrdefs.preprocessed.h',
|
|
source=[qstr_micropython, qstr_collected])
|
|
|
|
qstr_generated = env.GenerateQstrDefs(
|
|
target='genhdr/qstrdefs.generated.h', source=qstr_preprocessed)
|
|
|
|
env.Ignore(qstr_collected, qstr_generated)
|
|
|
|
#
|
|
# Frozen modules
|
|
#
|
|
|
|
if ARGUMENTS.get('TREZOR_EMULATOR_FROZEN', 0):
|
|
if env.get('TREZOR_MODEL') == '1':
|
|
SOURCE_PY_DIR = 'src1/'
|
|
else:
|
|
SOURCE_PY_DIR = 'src/'
|
|
|
|
# TODO: recursive Glob
|
|
SOURCE_PY = Glob(SOURCE_PY_DIR + '*.py')
|
|
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*.py'))
|
|
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*/*.py'))
|
|
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*/*/*.py'))
|
|
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + '*/*/*/*/*.py'))
|
|
|
|
source_mpy = env.FrozenModule(source=SOURCE_PY, source_dir=SOURCE_PY_DIR)
|
|
|
|
source_mpyc = env.FrozenCFile(
|
|
target='frozen_mpy.c', source=source_mpy, qstr_header=qstr_preprocessed)
|
|
|
|
env.Depends(source_mpyc, qstr_generated)
|
|
|
|
#
|
|
# static secp256-zkp ecmult context
|
|
#
|
|
|
|
host_env = Environment(ENV=os.environ)
|
|
host_env.Replace(
|
|
CC=os.getenv('CC_FOR_BUILD') or 'gcc',
|
|
COPT='-O2',
|
|
CPPPATH='vendor/secp256k1-zkp',
|
|
)
|
|
gen_context = host_env.Program(
|
|
target='vendor/secp256k1-zkp/gen_context',
|
|
source='vendor/secp256k1-zkp/src/gen_context.c',
|
|
)
|
|
|
|
secp256k1_zkp_ecmult_static_context = host_env.Command(
|
|
target='vendor/secp256k1-zkp/src/ecmult_static_context.h',
|
|
source='vendor/secp256k1-zkp/gen_context',
|
|
action='cd ${SOURCE.dir}; ./gen_context',
|
|
)
|
|
|
|
#
|
|
# Program objects
|
|
#
|
|
|
|
obj_program = []
|
|
obj_program.extend(env.Object(source=SOURCE_MOD))
|
|
obj_program.extend(env.Object(source=SOURCE_MOD_SECP256K1_ZKP, CCFLAGS='$CCFLAGS -Wno-unused-function'))
|
|
obj_program.extend(env.Object(source=SOURCE_MICROPYTHON))
|
|
obj_program.extend(env.Object(source=SOURCE_UNIX))
|
|
if ARGUMENTS.get('TREZOR_EMULATOR_FROZEN', 0):
|
|
obj_program.extend(env.Object(source=source_mpyc))
|
|
|
|
env.Depends(obj_program, qstr_generated)
|
|
env.Depends(obj_program, secp256k1_zkp_ecmult_static_context)
|
|
|
|
program = env.Command(
|
|
target='micropython',
|
|
source=obj_program,
|
|
action='$CC -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $LINKFLAGS', )
|