aboutsummaryrefslogtreecommitdiffhomepage
path: root/pyecsca/codegen/templates
diff options
context:
space:
mode:
authorJ08nY2020-02-26 14:28:52 +0100
committerJ08nY2020-02-26 14:28:52 +0100
commitf78ff987ac2df62dbd8326ce33ae61c97673710e (patch)
tree9b63026e223254bc3c4e6af164bd3ae3bdcc0404 /pyecsca/codegen/templates
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/templates')
-rw-r--r--pyecsca/codegen/templates/Makefile11
-rw-r--r--pyecsca/codegen/templates/main.c9
-rw-r--r--pyecsca/codegen/templates/mult.c2
3 files changed, 17 insertions, 5 deletions
diff --git a/pyecsca/codegen/templates/Makefile b/pyecsca/codegen/templates/Makefile
index 5d842c4..be1ab08 100644
--- a/pyecsca/codegen/templates/Makefile
+++ b/pyecsca/codegen/templates/Makefile
@@ -12,6 +12,17 @@ EXTRAINCDIRS += hash prng asn1 bn gen tommath
LDFLAGS += tommath/libtommath-{{ platform }}.a
+ifeq ($(PLATFORM),CW308_XMEGA)
+
+else ifeq ($(PLATFORM),CW308_STM32F0)
+CFLAGS += -DMP_NO_DEV_URANDOM -DMP_32BIT -DMP_LOW_MEM -DMP_PREC=10
+else ifeq ($(PLATFORM),CW308_STM32F3)
+CFLAGS += -DMP_NO_DEV_URANDOM -DMP_32BIT -DMP_LOW_MEM -DMP_PREC=10
+else ifeq ($(PLATFORM),HOST)
+CFLAGS += -DMP_NO_DEV_URANDOM -DMP_LOW_MEM -DMP_PREC=10
+else
+ $(error Invalid or empty PLATFORM: $(PLATFORM). Known platforms: $(KNOWN_PLATFORMS))
+endif
include simpleserial/Makefile.simpleserial
FIRMWAREPATH = .
diff --git a/pyecsca/codegen/templates/main.c b/pyecsca/codegen/templates/main.c
index b0f81f1..467a417 100644
--- a/pyecsca/codegen/templates/main.c
+++ b/pyecsca/codegen/templates/main.c
@@ -420,17 +420,20 @@ static uint8_t cmd_debug(uint8_t *data, uint16_t len) {
char *debug_string = "{{ ','.join((model.shortname, coords.name))}}";
size_t debug_len = strlen(debug_string);
+ simpleserial_put('r', len, data);
+
simpleserial_put('d', debug_len, (uint8_t *) debug_string);
return 0;
}
int main(void) {
- platform_init();
- prng_init();
- formulas_init();
+ platform_init();
init_uart();
trigger_setup();
+ prng_init();
+ formulas_init();
+
curve = curve_new();
pubkey = point_new();
bn_init(&privkey);
diff --git a/pyecsca/codegen/templates/mult.c b/pyecsca/codegen/templates/mult.c
index 896fdd8..f611e95 100644
--- a/pyecsca/codegen/templates/mult.c
+++ b/pyecsca/codegen/templates/mult.c
@@ -1,6 +1,4 @@
-#include "mult.h"
-
{%- if isinstance(scalarmult, LTRMultiplier) -%}
{% include "mult_ltr.c" %}