From 8a56c7a95e662862cfe78b834ccb091e95d5372f Mon Sep 17 00:00:00 2001 From: J08nY Date: Mon, 25 Nov 2019 17:45:35 +0100 Subject: Add libtommath, HOST build, and a simple PRNG. --- pyecsca/codegen/hal/host/Makefile.host | 10 ++++++++++ pyecsca/codegen/hal/host/host_hal.c | 2 ++ pyecsca/codegen/hal/host/host_hal.h | 14 ++++++++++++++ pyecsca/codegen/hal/host/uart.c | 7 +++++++ pyecsca/codegen/hal/host/uart.h | 13 +++++++++++++ 5 files changed, 46 insertions(+) create mode 100644 pyecsca/codegen/hal/host/Makefile.host create mode 100644 pyecsca/codegen/hal/host/host_hal.c create mode 100644 pyecsca/codegen/hal/host/host_hal.h create mode 100644 pyecsca/codegen/hal/host/uart.c create mode 100644 pyecsca/codegen/hal/host/uart.h (limited to 'pyecsca/codegen/hal/host') diff --git a/pyecsca/codegen/hal/host/Makefile.host b/pyecsca/codegen/hal/host/Makefile.host new file mode 100644 index 0000000..933c899 --- /dev/null +++ b/pyecsca/codegen/hal/host/Makefile.host @@ -0,0 +1,10 @@ +VPATH += :$(HALPATH)/host +SRC += uart.c host_hal.c +EXTRAINCDIRS += $(HALPATH)/host + +CC = gcc +OBJCOPY = objcopy +OBJDUMP = objdump +SIZE = size +AR = ar rcs +NM = nm \ No newline at end of file diff --git a/pyecsca/codegen/hal/host/host_hal.c b/pyecsca/codegen/hal/host/host_hal.c new file mode 100644 index 0000000..fe71aab --- /dev/null +++ b/pyecsca/codegen/hal/host/host_hal.c @@ -0,0 +1,2 @@ + +void platform_init(void) {} \ No newline at end of file diff --git a/pyecsca/codegen/hal/host/host_hal.h b/pyecsca/codegen/hal/host/host_hal.h new file mode 100644 index 0000000..b78172c --- /dev/null +++ b/pyecsca/codegen/hal/host/host_hal.h @@ -0,0 +1,14 @@ +#ifndef HOST_HAL_H_ +#define HOST_HAL_H_ + +#include "uart.h" + +#define trigger_setup() +#define trigger_high() +#define trigger_low() + +#define init_uart init_uart0 +#define putch output_ch_0 +#define getch input_ch_0 + +#endif //HOST_HAL_H_ diff --git a/pyecsca/codegen/hal/host/uart.c b/pyecsca/codegen/hal/host/uart.c new file mode 100644 index 0000000..3931d6d --- /dev/null +++ b/pyecsca/codegen/hal/host/uart.c @@ -0,0 +1,7 @@ +#include "uart.h" + +void init_uart0(void) {} + +char input_ch_0(void) { return getchar(); } + +void output_ch_0(char data) { putchar(data); } \ No newline at end of file diff --git a/pyecsca/codegen/hal/host/uart.h b/pyecsca/codegen/hal/host/uart.h new file mode 100644 index 0000000..d6063bc --- /dev/null +++ b/pyecsca/codegen/hal/host/uart.h @@ -0,0 +1,13 @@ +#ifndef UART_H_ +#define UART_H_ + +#include + + +void init_uart0(void); + +char input_ch_0(void); + +void output_ch_0(char data); + +#endif //UART_H_ \ No newline at end of file -- cgit v1.3.1