1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-27 00:28:10 +00:00

scons: compile vm.c and gc.c with -O3 on stm32

This commit is contained in:
Jan Pochyla 2017-08-15 21:04:12 +02:00
parent 50c63d728f
commit ddd079f131
2 changed files with 10 additions and 5 deletions

View File

@ -141,7 +141,6 @@ SOURCE_MICROPYTHON = [
'vendor/micropython/py/emitinlinextensa.c', 'vendor/micropython/py/emitinlinextensa.c',
'vendor/micropython/py/formatfloat.c', 'vendor/micropython/py/formatfloat.c',
'vendor/micropython/py/frozenmod.c', 'vendor/micropython/py/frozenmod.c',
'vendor/micropython/py/gc.c',
'vendor/micropython/py/lexer.c', 'vendor/micropython/py/lexer.c',
'vendor/micropython/py/malloc.c', 'vendor/micropython/py/malloc.c',
'vendor/micropython/py/map.c', 'vendor/micropython/py/map.c',
@ -221,7 +220,6 @@ SOURCE_MICROPYTHON = [
'vendor/micropython/py/stackctrl.c', 'vendor/micropython/py/stackctrl.c',
'vendor/micropython/py/stream.c', 'vendor/micropython/py/stream.c',
'vendor/micropython/py/unicode.c', 'vendor/micropython/py/unicode.c',
'vendor/micropython/py/vm.c',
'vendor/micropython/py/vstr.c', 'vendor/micropython/py/vstr.c',
'vendor/micropython/py/warning.c', 'vendor/micropython/py/warning.c',
'vendor/micropython/stmhal/gccollect.c', 'vendor/micropython/stmhal/gccollect.c',
@ -231,6 +229,11 @@ SOURCE_MICROPYTHON = [
'vendor/micropython/stmhal/systick.c', 'vendor/micropython/stmhal/systick.c',
] ]
SOURCE_MICROPYTHON_SPEED = [
'vendor/micropython/py/gc.c',
'vendor/micropython/py/vm.c',
]
SOURCE_STMHAL = [ SOURCE_STMHAL = [
'vendor/micropython/stmhal/hal/f4/src/stm32f4xx_hal_adc_ex.c', 'vendor/micropython/stmhal/hal/f4/src/stm32f4xx_hal_adc_ex.c',
'vendor/micropython/stmhal/hal/f4/src/stm32f4xx_hal_adc.c', 'vendor/micropython/stmhal/hal/f4/src/stm32f4xx_hal_adc.c',
@ -286,7 +289,7 @@ SOURCE_TREZORHAL = [
'embed/trezorhal/hal/stm32f4xx_ll_fsmc.c', 'embed/trezorhal/hal/stm32f4xx_ll_fsmc.c',
] ]
SOURCE_QSTR = SOURCE_MOD + SOURCE_MICROPYTHON SOURCE_QSTR = SOURCE_MOD + SOURCE_MICROPYTHON + SOURCE_MICROPYTHON_SPEED
# TODO: recursive Glob # TODO: recursive Glob
SOURCE_PY = Glob('src/*.py') SOURCE_PY = Glob('src/*.py')
@ -311,7 +314,8 @@ env.Replace(
OBJCOPY='arm-none-eabi-objcopy', ) OBJCOPY='arm-none-eabi-objcopy', )
env.Replace( env.Replace(
CCFLAGS='-Os ' COPT='-Os',
CCFLAGS='$COPT '
'-g3 ' '-g3 '
'-nostdlib ' '-nostdlib '
'-std=gnu99 -Wall -Werror -Wdouble-promotion -Wpointer-arith ' '-std=gnu99 -Wall -Werror -Wdouble-promotion -Wpointer-arith '
@ -319,6 +323,7 @@ env.Replace(
'-fsingle-precision-constant -fdata-sections -ffunction-sections ' + '-fsingle-precision-constant -fdata-sections -ffunction-sections ' +
CCFLAGS_MOD, CCFLAGS_MOD,
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB', CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
CCFLAGS_OPT='-O3',
LINKFLAGS='-nostdlib -T embed/firmware/memory.ld --gc-sections', LINKFLAGS='-nostdlib -T embed/firmware/memory.ld --gc-sections',
CPPPATH=[ CPPPATH=[
'.', '.',
@ -394,6 +399,7 @@ obj_program = []
obj_program.extend(env.Object(source=SOURCE_MOD)) obj_program.extend(env.Object(source=SOURCE_MOD))
obj_program.extend(env.Object(source=SOURCE_FIRMWARE)) obj_program.extend(env.Object(source=SOURCE_FIRMWARE))
obj_program.extend(env.Object(source=SOURCE_MICROPYTHON)) obj_program.extend(env.Object(source=SOURCE_MICROPYTHON))
obj_program.extend(env.Object(source=SOURCE_MICROPYTHON_SPEED, COPT='-O3'))
obj_program.extend(env.Object(source=SOURCE_STMHAL)) obj_program.extend(env.Object(source=SOURCE_STMHAL))
obj_program.extend(env.Object(source=SOURCE_TREZORHAL)) obj_program.extend(env.Object(source=SOURCE_TREZORHAL))
obj_program.extend(env.Object(source=source_mpyc)) obj_program.extend(env.Object(source=source_mpyc))

View File

@ -26,7 +26,6 @@ def generate(env):
return '$MPY_CROSS -o %s -s %s %s' % (target, source_name, source) return '$MPY_CROSS -o %s -s %s %s' % (target, source_name, source)
env['BUILDERS']['FrozenModule'] = SCons.Builder.Builder( env['BUILDERS']['FrozenModule'] = SCons.Builder.Builder(
# action='$MPY_CROSS -o $TARGET -s $SOURCE $SOURCE',
generator=generate_frozen_module, generator=generate_frozen_module,
suffix='.mpy', suffix='.mpy',
single_source=True, ) single_source=True, )