gadget-securevault/Makefile
2019-11-02 14:44:45 +01:00

55 lines
1.6 KiB
Makefile

CROSS_COMPILE:=arm-none-eabi-
CC:=$(CROSS_COMPILE)gcc
LD:=$(CROSS_COMPILE)gcc
USECFS:=$(HOME)/src/usecfs
WOLFSSL:=$(HOME)/src/wolfssl
OBJS:=startup.o main.o system.o usecfs_dev_spi.o $(USECFS)/src/usecfs.o mem.o led.o \
i2c.o display.o font_twisted.o spi.o spi_flash.o button.o systick.o newlib.o uart.o ui.o \
sdcard.o random.o
OBJS+= \
$(WOLFSSL)/wolfcrypt/src/sha256.o \
$(WOLFSSL)/wolfcrypt/src/chacha.o \
$(WOLFSSL)/wolfcrypt/src/pwdbased.o \
$(WOLFSSL)/wolfcrypt/src/hash.o \
$(WOLFSSL)/wolfcrypt/src/hmac.o \
$(WOLFSSL)/wolfcrypt/src/sp_int.o \
$(WOLFSSL)/wolfcrypt/src/sp_cortexm.o \
$(WOLFSSL)/wolfcrypt/src/wolfmath.o \
$(WOLFSSL)/wolfcrypt/src/memory.o \
$(WOLFSSL)/wolfcrypt/src/random.o \
$(WOLFSSL)/wolfcrypt/src/wc_port.o
UMX:=lib/unicore-mx/lib/libucmx_stm32f4.a
UMXFLAGS:=-Ilib/unicore-mx/include/ -DSTM32F4
LIBS+=$(UMX)
LSCRIPT:=target.ld
OBJCOPY:=$(CROSS_COMPILE)objcopy
CFLAGS:=-mcpu=cortex-m3 -mthumb -Wall -Wno-main -Wstack-usage=200 -ffreestanding -Wno-unused -DBLOCK_SIZE=4096 -I$(USECFS)/src -I. -I$(WOLFSSL) -Ilib/unicore-mx/include
CFLAGS+=-specs=nano.specs -lc -lg
CFLAGS+=$(UMXFLAGS)
#CFLAGS+=-O2
CFLAGS+=-g -ggdb3
CFLAGS+=-DWOLFSSL_USER_SETTINGS -DCRYPTO
LDFLAGS:=-T $(LSCRIPT) -Wl,-gc-sections -Wl,-Map=image.map -mcpu=cortex-m3 -mthumb -nostartfiles
#all: image.bin
image.bin: image.elf
$(OBJCOPY) -O binary $^ $@
image.elf: $(LIBS) $(OBJS) $(LSCRIPT)
$(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
$(UMX):
make -C lib/unicore-mx FP_FLAGS="-O3 -mfloat-abi=soft" TARGETS=stm32/f4
clean:
rm -f image.bin image.elf *.o image.map $(WOLFSSL)/wolfcrypt/src/*.o $(USECFS)/src/*.o