pull/25/head
Pavol Rusnak 11 years ago
parent 92f070498f
commit 638cf2310b

@ -21,7 +21,6 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
#include "bignum.h"
#include "secp256k1.h"
@ -504,16 +503,3 @@ void bn_divmod58(const bignum256 *a, bignum256 *q, uint32_t *r)
*r = rem.val[0];
}
void bn_print(const bignum256 *a)
{
printf("%04x", a->val[8] & 0x0000FFFF);
printf("%08x", (a->val[7] << 2) | ((a->val[6] & 0x30000000) >> 28));
printf("%07x", a->val[6] & 0x0FFFFFFF);
printf("%08x", (a->val[5] << 2) | ((a->val[4] & 0x30000000) >> 28));
printf("%07x", a->val[4] & 0x0FFFFFFF);
printf("%08x", (a->val[3] << 2) | ((a->val[2] & 0x30000000) >> 28));
printf("%07x", a->val[2] & 0x0FFFFFFF);
printf("%08x", (a->val[1] << 2) | ((a->val[0] & 0x30000000) >> 28));
printf("%07x", a->val[0] & 0x0FFFFFFF);
}

@ -80,6 +80,4 @@ void bn_substract_noprime(const bignum256 *a, const bignum256 *b, bignum256 *res
void bn_divmod58(const bignum256 *a, bignum256 *q, uint32_t *r);
void bn_print(const bignum256 *a);
#endif

@ -1,9 +1,16 @@
NAME = speed
OBJS += bignum.o
OBJS += ecdsa.o
NAME = speed
OBJS += rand.o
OBJS += secp256k1.o
OBJS += hmac.o
OBJS += sha2.o
OBJS += speed.o
OBJS += ../bignum.o
OBJS += ../bip32.o
OBJS += ../ecdsa.o
OBJS += ../hmac.o
OBJS += ../ripemd160.o
OBJS += ../secp256k1.o
OBJS += ../sha2.o
include Makefile.include
CFLAGS += -I..

@ -1,30 +1,66 @@
PREFIX ?= arm-none-eabi
CC = $(PREFIX)-gcc
LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
FLASH = $(shell which st-flash)
TOOLCHAIN_DIR ?= ../../../STM/libopencm3
CFLAGS += -Os -g \
-Wall -Wextra -Wimplicit-function-declaration -Wredundant-decls -Wstrict-prototypes -Wundef -Wshadow \
-fno-common -mcpu=cortex-m3 -mthumb -msoft-float -MD -DSTM32F2 \
-I$(TOOLCHAIN_DIR)/include
LDSCRIPT ?= $(NAME).ld
LDFLAGS += --static -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group \
-L$(TOOLCHAIN_DIR)/lib -L$(TOOLCHAIN_DIR)/lib/stm32/f2 \
-T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections \
-mthumb -march=armv7 -mfix-cortex-m3-ldrd -msoft-float
OBJS += $(NAME).o
all: images
images: $(NAME).bin
APPIFY ?= 0
PREFIX ?= arm-none-eabi-
CC = $(PREFIX)gcc
LD = $(PREFIX)gcc
OBJCOPY = $(PREFIX)objcopy
OBJDUMP = $(PREFIX)objdump
FLASH = st-flash
OPENOCD = openocd
TOP_DIR = /home/stick/work/trezor/trezor-mcu
TOOLCHAIN_DIR = /home/stick/work/STM/libopencm3
OPTFLAGS = -Os -g
CFLAGS += $(OPTFLAGS) \
-Wall \
-Wextra \
-Wimplicit-function-declaration \
-Wredundant-decls \
-Wstrict-prototypes \
-Wundef \
-Wshadow \
-fno-common \
-mcpu=cortex-m3 \
-mthumb \
-msoft-float \
-DSTM32F2 \
-I$(TOOLCHAIN_DIR)/include \
-I$(TOP_DIR) \
-DAPPIFY=$(APPIFY)
LDSCRIPT = $(TOP_DIR)/layout$(APPIFY).ld
LDFLAGS += --static \
-Wl,--start-group \
-lc \
-lgcc \
-lnosys \
-Wl,--end-group \
-L$(TOP_DIR) \
-L$(TOOLCHAIN_DIR)/lib \
-L$(TOOLCHAIN_DIR)/lib/stm32/f2 \
-T$(LDSCRIPT) \
-nostartfiles \
-Wl,--gc-sections \
-mthumb \
-march=armv7 \
-mfix-cortex-m3-ldrd \
-msoft-float
all: $(NAME).bin
flash: $(NAME).bin
$(FLASH) write $(NAME).bin 0x8000000
flash2: $(NAME).hex
$(OPENOCD) -f board/stm32f4discovery.cfg \
-c "init" \
-c "reset init" \
-c "stm32f2x mass_erase 0" \
-c "flash write_image $(NAME).hex" \
-c "reset" \
-c "shutdown"
$(NAME).bin: $(NAME).elf
$(OBJCOPY) -Obinary $(NAME).elf $(NAME).bin
@ -44,6 +80,7 @@ $(NAME).elf: $(OBJS) $(LDSCRIPT) $(TOOLCHAIN_DIR)/lib/libopencm3_stm32f2.a
$(CC) $(CFLAGS) -o $@ -c $<
clean:
rm -f *.a
rm -f *.o
rm -f *.d
rm -f *.elf

@ -1 +0,0 @@
../bignum.c

@ -1 +0,0 @@
../bignum.h

@ -1 +0,0 @@
../ecdsa.c

@ -1 +0,0 @@
../ecdsa.h

@ -1 +0,0 @@
../hmac.c

@ -1 +0,0 @@
../hmac.h

@ -1 +0,0 @@
../rand.h

@ -1 +0,0 @@
../secp256k1.c

@ -1 +0,0 @@
../secp256k1.h

@ -1 +0,0 @@
../sha2.c

@ -1 +0,0 @@
../sha2.h
Loading…
Cancel
Save