1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-29 19:08:12 +00:00

scons: fix FrozenModule, simplify usage

This commit is contained in:
Jan Pochyla 2017-08-02 23:42:04 +02:00
parent 684892f1ed
commit 9b03a16b43
2 changed files with 17 additions and 10 deletions

View File

@ -456,7 +456,6 @@ SOURCE_PY = [
] ]
env = Environment( env = Environment(
VARIANT_DIR='build',
SED='sed', SED='sed',
AS='arm-none-eabi-as', AS='arm-none-eabi-as',
AR='arm-none-eabi-ar', AR='arm-none-eabi-ar',
@ -518,15 +517,19 @@ hdr_version = env.Command(
# Qstrings # Qstrings
# #
qstr_micropython = 'vendor/micropython/py/qstrdefs.h'
qstr_collected = env.CollectQstr( qstr_collected = env.CollectQstr(
target='genhdr/qstrdefs.collected.h', source=SOURCE_QSTR) target='genhdr/qstrdefs.collected.h',
source=SOURCE_QSTR)
qstr_preprocessed = env.PreprocessQstr( qstr_preprocessed = env.PreprocessQstr(
target='genhdr/qstrdefs.preprocessed.h', target='genhdr/qstrdefs.preprocessed.h',
source=['vendor/micropython/py/qstrdefs.h', qstr_collected]) source=[qstr_micropython, qstr_collected])
qstr_generated = env.GenerateQstrDefs( qstr_generated = env.GenerateQstrDefs(
target='genhdr/qstrdefs.generated.h', source=qstr_preprocessed) target='genhdr/qstrdefs.generated.h',
source=qstr_preprocessed)
env.Ignore(qstr_collected, qstr_generated) env.Ignore(qstr_collected, qstr_generated)
@ -534,10 +537,12 @@ env.Ignore(qstr_collected, qstr_generated)
# Frozen modules # Frozen modules
# #
source_mpy = env.FrozenModule(source=SOURCE_PY, suffix='.mpy') source_mpy = env.FrozenModule(source=SOURCE_PY)
source_mpyc = env.FrozenSource( source_mpyc = env.FrozenCFile(
target='frozen_mpy.c', source=source_mpy, qstr_header=qstr_preprocessed) target='frozen_mpy.c',
source=source_mpy,
qstr_header=qstr_preprocessed)
env.Depends(source_mpyc, qstr_generated) env.Depends(source_mpyc, qstr_generated)

View File

@ -20,10 +20,12 @@ def generate(env):
action='$MAKEQSTRDATA $SOURCE > $TARGET', ) action='$MAKEQSTRDATA $SOURCE > $TARGET', )
env['BUILDERS']['FrozenModule'] = SCons.Builder.Builder( env['BUILDERS']['FrozenModule'] = SCons.Builder.Builder(
action='$MPY_CROSS -o $TARGET -s $SOURCE $SOURCE', suffix='.mpy') action='$MPY_CROSS -o $TARGET -s $SOURCE $SOURCE',
suffix='.mpy',
single_source=True, )
env['BUILDERS']['FrozenSource'] = SCons.Builder.Builder( env['BUILDERS']['FrozenCFile'] = SCons.Builder.Builder(
action='$MPY_TOOL -f -q $qstr_header $SOURCES > $TARGET') action='$MPY_TOOL -f -q $qstr_header $SOURCES > $TARGET', )
def exists(env): def exists(env):