From 96ddcf39df88201c9a81b14392183b533f70debe Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 2 Oct 2018 17:32:38 +0200 Subject: [PATCH] firmware: use separate source tree (src1) for T1 app code for now --- SConscript.firmware | 20 ++++++++++++-------- src1/main.py | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 src1/main.py diff --git a/SConscript.firmware b/SConscript.firmware index 0e109dbed7..6a2fd7b7c3 100644 --- a/SConscript.firmware +++ b/SConscript.firmware @@ -276,14 +276,6 @@ SOURCE_TREZORHAL = [ SOURCE_QSTR = SOURCE_MOD + SOURCE_MICROPYTHON + SOURCE_MICROPYTHON_SPEED -# TODO: recursive Glob -SOURCE_PY_DIR = 'src/' -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')) - env = Environment(ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s -DPYOPT=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0'), PYOPT)) env.Tool('micropython') @@ -385,6 +377,18 @@ env.Ignore(qstr_collected, qstr_generated) # Frozen modules # +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( diff --git a/src1/main.py b/src1/main.py new file mode 100644 index 0000000000..059565a479 --- /dev/null +++ b/src1/main.py @@ -0,0 +1,18 @@ +import trezorio as io +from trezorui import Display + +d = Display() + +d.clear() +d.backlight(255) + +i = 0 + +while True: + d.print('Loop %d\n' % i) + i += 1 + r = [0, 0] + if io.poll([io.TOUCH], r, 1000000): + print('TOUCH', r) + else: + print('NOTOUCH')