aboutsummaryrefslogtreecommitdiffhomepage
path: root/pyecsca/codegen/builder.py
diff options
context:
space:
mode:
authorJ08nY2020-02-26 14:28:52 +0100
committerJ08nY2020-02-26 14:28:52 +0100
commitf78ff987ac2df62dbd8326ce33ae61c97673710e (patch)
tree9b63026e223254bc3c4e6af164bd3ae3bdcc0404 /pyecsca/codegen/builder.py
parent3892d994470b181f950703fabf719a9c963d1c20 (diff)
downloadpyecsca-codegen-f78ff987ac2df62dbd8326ce33ae61c97673710e.tar.gz
pyecsca-codegen-f78ff987ac2df62dbd8326ce33ae61c97673710e.tar.zst
pyecsca-codegen-f78ff987ac2df62dbd8326ce33ae61c97673710e.zip
Get stuff to work on STM32F0.
Diffstat (limited to 'pyecsca/codegen/builder.py')
-rw-r--r--pyecsca/codegen/builder.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/pyecsca/codegen/builder.py b/pyecsca/codegen/builder.py
index bf8e6be..1919c09 100644
--- a/pyecsca/codegen/builder.py
+++ b/pyecsca/codegen/builder.py
@@ -10,11 +10,11 @@ import click
from public import public
from pyecsca.ec.configuration import Multiplication, Squaring, Reduction, HashType, RandomMod
from pyecsca.ec.coordinates import CoordinateModel
-from pyecsca.ec.formula import (Formula, AdditionFormula)
-from pyecsca.ec.model import (CurveModel)
-from pyecsca.ec.mult import (ScalarMultiplier)
+from pyecsca.ec.formula import Formula, AdditionFormula
+from pyecsca.ec.model import CurveModel
+from pyecsca.ec.mult import ScalarMultiplier
-from pyecsca.codegen.render import render
+from .render import render
from .common import Platform, DeviceConfiguration, MULTIPLIERS, wrap_enum, get_model, get_coords
@@ -150,12 +150,10 @@ def build_impl(ctx, platform, hash, rand, mul, sqr, red, keygen, ecdh, ecdsa, st
platform, keygen, ecdh, ecdsa)
dir, elf_file, hex_file = render(config)
- res = subprocess.run(["make"], cwd=dir, capture_output=True)
- if verbose >= 1:
- click.echo(res.stdout.decode())
+ subprocess.run(["make"], cwd=dir, capture_output=not verbose)
if strip:
- subprocess.run(["strip", elf_file], cwd=dir)
+ subprocess.run(["make", "strip"], cwd=dir, capture_output=not verbose)
full_elf_path = path.join(dir, elf_file)
full_hex_path = path.join(dir, hex_file)
shutil.copy(full_elf_path, outdir)
@@ -231,14 +229,14 @@ def list_impl(model: Optional[CurveModel], coords: Optional[CoordinateModel],
subsequent_indent="\t"))
-@main.command()
+@main.command("flash")
@click.option("--platform", envvar="PLATFORM", required=True,
type=click.Choice(Platform.names()),
callback=wrap_enum(Platform),
help="The platform to flash.")
@click.argument("dir")
@public
-def flash(platform, dir): # pragma: no cover
+def flash_impl(platform, dir): # pragma: no cover
"""This command flashes a chip through the ChipWhisperer framework with the built implementation.
\b