1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

scons: fix frozen module names

This commit is contained in:
Jan Pochyla 2017-08-05 10:17:16 +02:00
parent d431e0b983
commit 2d69930317
2 changed files with 23 additions and 14 deletions

View File

@ -455,6 +455,7 @@ SOURCE_PY = [
'src/trezor/wire/codec_v2.py',
'src/trezor/workflow.py',
]
SOURCE_PY_DIR = 'src/'
env = Environment()
@ -543,7 +544,7 @@ env.Ignore(qstr_collected, qstr_generated)
# Frozen modules
#
source_mpy = env.FrozenModule(source=SOURCE_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)
@ -555,19 +556,20 @@ env.Depends(source_mpyc, qstr_generated)
#
obj_program = []
obj_program += env.Object(source=SOURCE_MOD)
obj_program += env.Object(source=SOURCE_FIRMWARE)
obj_program += env.Object(source=SOURCE_MICROPYTHON)
obj_program += env.Object(source=SOURCE_STMHAL)
obj_program += env.Object(source=SOURCE_TREZORHAL)
obj_program += env.Object(source=source_mpyc)
obj_program.extend(env.Object(source=SOURCE_MOD))
obj_program.extend(env.Object(source=SOURCE_FIRMWARE))
obj_program.extend(env.Object(source=SOURCE_MICROPYTHON))
obj_program.extend(env.Object(source=SOURCE_STMHAL))
obj_program.extend(env.Object(source=SOURCE_TREZORHAL))
obj_program.extend(env.Object(source=source_mpyc))
obj_program += env.Command(
target='embed/firmware/vendorheader.o',
source='embed/firmware/vendorheader.bin',
action='$OBJCOPY -I binary -O elf32-littlearm -B arm'
' --rename-section .data=.vendorheader,alloc,load,readonly,contents'
' $SOURCE $TARGET', )
obj_program.extend(
env.Command(
target='embed/firmware/vendorheader.o',
source='embed/firmware/vendorheader.bin',
action='$OBJCOPY -I binary -O elf32-littlearm -B arm'
' --rename-section .data=.vendorheader,alloc,load,readonly,contents'
' $SOURCE $TARGET', ))
env.Depends(obj_program, qstr_generated)

View File

@ -19,8 +19,15 @@ def generate(env):
env['BUILDERS']['GenerateQstrDefs'] = SCons.Builder.Builder(
action='$MAKEQSTRDATA $SOURCE > $TARGET', )
def generate_frozen_module(source, target, env, for_signature):
target = str(target[0])
source = str(source[0])
source_name = source.replace(env['source_dir'], '')
return '$MPY_CROSS -o %s -s %s %s' % (target, source_name, source)
env['BUILDERS']['FrozenModule'] = SCons.Builder.Builder(
action='$MPY_CROSS -o $TARGET $SOURCE',
# action='$MPY_CROSS -o $TARGET -s $SOURCE $SOURCE',
generator=generate_frozen_module,
suffix='.mpy',
single_source=True, )