mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-05 04:50:57 +00:00
chore(core): add ability for emu launcher to launch tropic model
This commit is contained in:
parent
b80527c558
commit
3f0ebcd979
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@ __pycache__/
|
||||
proto.gv*
|
||||
.DS_Store
|
||||
crypto/tests/libtrezor-crypto.so.dSYM/
|
||||
tropic-model/
|
||||
|
@ -112,6 +112,7 @@ def _from_env(name: str) -> bool:
|
||||
@click.option("-G", "--alloc-profiling/--no-alloc-profiling", default=_from_env("TREZOR_MEMPERF"), help="Profile memory allocation (requires special micropython build)")
|
||||
@click.option("-h", "--headless", is_flag=True, help="Headless mode (no display, disables animation)")
|
||||
@click.option("--heap-size", metavar="SIZE", default="20M", help="Configure heap size")
|
||||
@click.option("-m", "--tropic-model", is_flag=True, help="Start the Tropic Square model, needed for running the Tropic tests. Needs to be installed first.")
|
||||
@click.option("--main", help="Path to python main file")
|
||||
@click.option("--mnemonic", "mnemonics", multiple=True, help="Initialize device with given mnemonic. Specify multiple times for Shamir shares.")
|
||||
@click.option("--log-memory/--no-log-memory", default=_from_env("TREZOR_LOG_MEMORY"), help="Print memory usage after workflows")
|
||||
@ -139,6 +140,7 @@ def cli(
|
||||
alloc_profiling: bool,
|
||||
headless: bool,
|
||||
heap_size: str,
|
||||
tropic_model: bool,
|
||||
main: str,
|
||||
mnemonics: list[str],
|
||||
log_memory: bool,
|
||||
@ -177,7 +179,7 @@ def cli(
|
||||
if command and not run_command:
|
||||
raise click.ClickException("Extra arguments found. Did you mean to use -c?")
|
||||
|
||||
if watch and (command or debugger):
|
||||
if watch and (command or debugger or tropic_model):
|
||||
raise click.ClickException("Cannot use -w together with -c or -D")
|
||||
|
||||
if watch and inotify is None:
|
||||
@ -297,6 +299,10 @@ def cli(
|
||||
emulator.client, record_dir, report_func=print
|
||||
)
|
||||
|
||||
if tropic_model:
|
||||
run_command = True
|
||||
command = "./tropic-model.sh"
|
||||
|
||||
if run_command:
|
||||
ret = run_command_with_emulator(emulator, command)
|
||||
elif watch:
|
||||
|
20
core/tropic-model.sh
Executable file
20
core/tropic-model.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -d "tropic-model" ]; then
|
||||
echo "================================================="
|
||||
echo "Please install the Tropic model to the tropic-model/ directory first, using the steps below!"
|
||||
echo "1. mkdir tropic-model && python3 -mvenv tropic-model/venv && source tropic-model/venv/bin/activate"
|
||||
echo "2. Follow instructions here: https://github.com/tropicsquare/ts-tvl/tree/master?tab=readme-ov-file#installing"
|
||||
echo " (basically, download the tvl-XXX.whl and pip install it under the venv created above - which should be already activated)"
|
||||
echo "3. Get config files for the model from https://github.com/tropicsquare/ts-tvl/tree/master/tvl/server/model_config"
|
||||
echo " i. model_config.yml"
|
||||
echo " ii. tropic01_ese_certificate_1.pem"
|
||||
echo " iii.tropic01_ese_private_key_1.pem"
|
||||
echo " iv. tropic01_ese_public_key_1.pem"
|
||||
echo "================================================="
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd tropic-model
|
||||
source venv/bin/activate
|
||||
model_server tcp -vv -c model_config.yml
|
Loading…
Reference in New Issue
Block a user