gadget-securevault/Makefile

75 lines
2.1 KiB
Makefile
Raw Permalink Normal View History

2019-10-27 07:30:03 +01:00
CROSS_COMPILE:=arm-none-eabi-
CC:=$(CROSS_COMPILE)gcc
LD:=$(CROSS_COMPILE)gcc
2019-11-08 11:13:17 +01:00
WOLFSSL:=$(HOME)/wolfssl
VERSION?=1
2019-10-27 07:30:03 +01:00
2019-11-04 15:38:49 +01:00
OBJS:=startup.o main.o system.o usecfs_dev_spi.o usecfs.o mem.o led.o \
2019-10-27 07:30:03 +01:00
i2c.o display.o font_twisted.o spi.o spi_flash.o button.o systick.o newlib.o uart.o ui.o \
2019-11-08 11:13:17 +01:00
sdcard.o random.o usb.o mutex.o fw_update.o
2019-10-27 07:30:03 +01:00
OBJS+= \
$(WOLFSSL)/wolfcrypt/src/sha256.o \
$(WOLFSSL)/wolfcrypt/src/chacha.o \
2019-11-04 15:38:49 +01:00
$(WOLFSSL)/wolfcrypt/src/aes.o \
2019-10-27 07:30:03 +01:00
$(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
2019-11-08 11:13:17 +01:00
CFLAGS:=-mcpu=cortex-m3 -mthumb -Wall -Wno-main -Wstack-usage=320 \
-ffreestanding -Wno-unused -DBLOCK_SIZE=4096 -I. -I$(WOLFSSL) -Ilib/unicore-mx/include \
-Iwolfboot/src -Iwolfboot/hal -Iwolfboot/include/wolfboot
2019-10-27 07:30:03 +01:00
CFLAGS+=-specs=nano.specs -lc -lg
CFLAGS+=$(UMXFLAGS)
2019-11-04 15:38:49 +01:00
CFLAGS+=-O2
#CFLAGS+=-g -ggdb3
2019-10-27 07:30:03 +01:00
CFLAGS+=-DWOLFSSL_USER_SETTINGS -DCRYPTO
2019-11-04 15:38:49 +01:00
ASFLAGS:=$(CFLAGS)
2019-10-27 07:30:03 +01:00
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 $@
2019-11-08 11:13:17 +01:00
wolfboot: wolfboot-align.bin
wolfboot-align.bin:
@rm -f wolfboot/.config
@rm -f $(WOLFSSL)/wolfcrypt/src/*.o
cp wolfboot.config wolfboot/.config
make -C wolfboot $@
2019-10-27 07:30:03 +01:00
$(UMX):
make -C lib/unicore-mx FP_FLAGS="-O3 -mfloat-abi=soft" TARGETS=stm32/f4
2019-11-08 11:13:17 +01:00
sign: image.bin
python3 wolfboot/tools/keytools/sign.py image.bin wolfboot/ecc256.der $(VERSION)
2019-10-27 07:30:03 +01:00
clean:
2019-11-04 15:38:49 +01:00
@rm -f image.bin image.elf *.o image.map $(WOLFSSL)/wolfcrypt/src/*.o $(USECFS)/src/*.o
make -C lib/unicore-mx clean
2019-11-08 11:13:17 +01:00
make -C wolfboot clean
.PHONY: wolfboot