mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-08 22:40:59 +00:00
firmware: introduce PYOPT, use it consistently in mpy-cross and in runtime, set it to 1 by default
This commit is contained in:
parent
fa697ba322
commit
2fe0ce542f
@ -7,6 +7,8 @@ CPPPATH_MOD = []
|
||||
CPPDEFINES_MOD = []
|
||||
SOURCE_MOD = []
|
||||
|
||||
PYOPT = '1'
|
||||
|
||||
# modtrezorconfig
|
||||
SOURCE_MOD += [
|
||||
'embed/extmod/modtrezorconfig/modtrezorconfig.c',
|
||||
@ -286,7 +288,7 @@ SOURCE_PY.extend(Glob('src/*/*/*/*.py'))
|
||||
SOURCE_PY.extend(Glob('src/*/*/*/*/*.py'))
|
||||
SOURCE_PY_DIR = 'src/'
|
||||
|
||||
env = Environment(ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')))
|
||||
env = Environment(ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s -DPYOPT=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0'), PYOPT))
|
||||
|
||||
env.Tool('micropython')
|
||||
|
||||
@ -341,7 +343,7 @@ env.Replace(
|
||||
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',
|
||||
MPY_CROSS='vendor/micropython/mpy-cross/mpy-cross -O' + PYOPT
|
||||
)
|
||||
|
||||
#
|
||||
|
@ -45,6 +45,9 @@ int main(void)
|
||||
mp_obj_list_init(mp_sys_path, 0);
|
||||
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_)); // current dir (or base dir of the script)
|
||||
|
||||
// Set optimization level
|
||||
MP_STATE_VM(mp_optimise_value) = PYOPT;
|
||||
|
||||
// Execute the main script
|
||||
printf("CORE: Executing main script\n");
|
||||
pyexec_frozen_module("main.py");
|
||||
|
Loading…
Reference in New Issue
Block a user