123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- CMD_ECHO =
- BUILD_DIR = ./Build
- TOOLCHAIN ?= /opt/gcc-arm-none-eabi/bin/arm-none-eabi-
- CC = $(TOOLCHAIN)gcc
- AS = $(CC)
- LD = $(CC)
- AR = $(TOOLCHAIN)ar
- NM = $(TOOLCHAIN)nm
- OBJCOPY ?= $(TOOLCHAIN)objcopy
- OBJDUMP ?= $(TOOLCHAIN)objdump
- SIZE ?= $(TOOLCHAIN)size
- USER_SETTINGS_DIR ?= ./Header
- INC = -I$(USER_SETTINGS_DIR) \
- -I../..
- DEF = -DWOLFSSL_USER_SETTINGS
- ARCHFLAGS ?= -mcpu=cortex-m4 -mthumb -mabi=aapcs -DUSE_WOLF_ARM_STARTUP
- ASFLAGS ?= $(ARCHFLAGS)
- CFLAGS_EXTRA ?= -Wno-cpp
- CFLAGS ?= $(ARCHFLAGS) -std=gnu99 -Wall $(CFLAGS_EXTRA)
- LDFLAGS ?= $(ARCHFLAGS)
- FIPS?=1
- LDFLAGS += --specs=nosys.specs
- LDFLAGS += --specs=nano.specs
- LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(BIN).map
- LDFLAGS += -Wl,-ereset_handler
- LIBS = -lm
- SRC_LD = -T./linker.ld
- CFLAGS += -Os -ffunction-sections -fdata-sections -fno-builtin
- LDFLAGS += -Wl,--gc-sections -flto
- CFLAGS += $(DBGFLAGS)
- LDFLAGS += $(DBGFLAGS)
- ifndef NO_EXAMPLES
- SRC_C += ./Source/wolf_main.c
- SRC_C += ./Source/armtarget.c
- SRC_C += ../../wolfcrypt/test/test.c
- SRC_C += ../../wolfcrypt/benchmark/benchmark.c
- endif
- SRC_C += ../../src/bio.c
- SRC_C += ../../src/crl.c
- SRC_C += ../../src/internal.c
- SRC_C += ../../src/keys.c
- SRC_C += ../../src/ocsp.c
- SRC_C += ../../src/sniffer.c
- SRC_C += ../../src/ssl.c
- SRC_C += ../../src/tls.c
- SRC_C += ../../src/tls13.c
- SRC_C += ../../src/wolfio.c
- ifeq "$(FIPS)" "1"
- SRC_C += ../../wolfcrypt/src/wolfcrypt_first.c
- endif
- SRC_C += ../../wolfcrypt/src/aes.c
- SRC_C += ../../wolfcrypt/src/cmac.c
- SRC_C += ../../wolfcrypt/src/des3.c
- SRC_C += ../../wolfcrypt/src/dh.c
- SRC_C += ../../wolfcrypt/src/ecc.c
- SRC_C += ../../wolfcrypt/src/hmac.c
- SRC_C += ../../wolfcrypt/src/kdf.c
- SRC_C += ../../wolfcrypt/src/random.c
- SRC_C += ../../wolfcrypt/src/rsa.c
- SRC_C += ../../wolfcrypt/src/sha.c
- SRC_C += ../../wolfcrypt/src/sha256.c
- SRC_C += ../../wolfcrypt/src/sha512.c
- SRC_C += ../../wolfcrypt/src/sha3.c
- ifeq "$(FIPS)" "1"
- SRC_C += ../../wolfcrypt/src/fips.c
- SRC_C += ../../wolfcrypt/src/fips_test.c
- SRC_C += ../../wolfcrypt/src/wolfcrypt_last.c
- endif
- SRC_C += ../../wolfcrypt/src/asm.c
- SRC_C += ../../wolfcrypt/src/asn.c
- SRC_C += ../../wolfcrypt/src/blake2s.c
- SRC_C += ../../wolfcrypt/src/chacha.c
- SRC_C += ../../wolfcrypt/src/chacha20_poly1305.c
- SRC_C += ../../wolfcrypt/src/coding.c
- SRC_C += ../../wolfcrypt/src/compress.c
- SRC_C += ../../wolfcrypt/src/cpuid.c
- SRC_C += ../../wolfcrypt/src/cryptocb.c
- SRC_C += ../../wolfcrypt/src/curve25519.c
- SRC_C += ../../wolfcrypt/src/curve448.c
- SRC_C += ../../wolfcrypt/src/ecc_fp.c
- SRC_C += ../../wolfcrypt/src/eccsi.c
- SRC_C += ../../wolfcrypt/src/ed25519.c
- SRC_C += ../../wolfcrypt/src/ed448.c
- SRC_C += ../../wolfcrypt/src/error.c
- SRC_C += ../../wolfcrypt/src/evp.c
- SRC_C += ../../wolfcrypt/src/fe_448.c
- SRC_C += ../../wolfcrypt/src/fe_low_mem.c
- SRC_C += ../../wolfcrypt/src/fe_operations.c
- SRC_C += ../../wolfcrypt/src/ge_448.c
- SRC_C += ../../wolfcrypt/src/ge_low_mem.c
- SRC_C += ../../wolfcrypt/src/ge_operations.c
- SRC_C += ../../wolfcrypt/src/hash.c
- SRC_C += ../../wolfcrypt/src/integer.c
- SRC_C += ../../wolfcrypt/src/logging.c
- SRC_C += ../../wolfcrypt/src/md5.c
- SRC_C += ../../wolfcrypt/src/memory.c
- SRC_C += ../../wolfcrypt/src/misc.c
- SRC_C += ../../wolfcrypt/src/pkcs12.c
- SRC_C += ../../wolfcrypt/src/pkcs7.c
- SRC_C += ../../wolfcrypt/src/poly1305.c
- SRC_C += ../../wolfcrypt/src/pwdbased.c
- SRC_C += ../../wolfcrypt/src/rc2.c
- SRC_C += ../../wolfcrypt/src/sakke.c
- SRC_C += ../../wolfcrypt/src/signature.c
- SRC_C += ../../wolfcrypt/src/srp.c
- SRC_C += ../../wolfcrypt/src/sp_arm32.c
- SRC_C += ../../wolfcrypt/src/sp_arm64.c
- SRC_C += ../../wolfcrypt/src/sp_armthumb.c
- SRC_C += ../../wolfcrypt/src/sp_c32.c
- SRC_C += ../../wolfcrypt/src/sp_c64.c
- SRC_C += ../../wolfcrypt/src/sp_cortexm.c
- SRC_C += ../../wolfcrypt/src/sp_dsp32.c
- SRC_C += ../../wolfcrypt/src/sp_int.c
- SRC_C += ../../wolfcrypt/src/sp_x86_64.c
- SRC_C += ../../wolfcrypt/src/tfm.c
- SRC_C += ../../wolfcrypt/src/wc_dsp.c
- SRC_C += ../../wolfcrypt/src/wc_encrypt.c
- SRC_C += ../../wolfcrypt/src/wc_pkcs11.c
- SRC_C += ../../wolfcrypt/src/wc_port.c
- SRC_C += ../../wolfcrypt/src/wolfevent.c
- SRC_C += ../../wolfcrypt/src/wolfmath.c
- ifeq "$(ASYNC)" "1"
- SRC_C += ../../wolfcrypt/src/async.c
- endif
- ifeq "$(SELFTEST)" "1"
- SRC_C += ../../wolfcrypt/src/selftest.c
- endif
- SRC_C += ../../wolfcrypt/src/arc4.c
- SRC_C += ../../wolfcrypt/src/blake2b.c
- SRC_C += ../../wolfcrypt/src/camellia.c
- SRC_C += ../../wolfcrypt/src/dsa.c
- SRC_C += ../../wolfcrypt/src/md2.c
- SRC_C += ../../wolfcrypt/src/md4.c
- SRC_C += ../../wolfcrypt/src/ripemd.c
- FILENAMES_C = $(notdir $(SRC_C))
- FILENAMES_C := $(filter-out evp.c, $(FILENAMES_C))
- OBJS_C = $(addprefix $(BUILD_DIR)/, $(FILENAMES_C:.c=.o))
- vpath %.c $(dir $(SRC_C))
- build_hex: $(BUILD_DIR) $(BUILD_DIR)/$(BIN).hex
- @echo ""
- $(CMD_ECHO) $(SIZE) $(BUILD_DIR)/$(BIN).elf
- build_static: $(BUILD_DIR) $(BUILD_DIR)/$(BIN).a
- @echo ""
- $(CMD_ECHO) $(SIZE) $(BUILD_DIR)/$(BIN).a
- $(BUILD_DIR):
- $(CMD_ECHO) mkdir -p $(BUILD_DIR)
- $(BUILD_DIR)/$(BIN).hex: $(BUILD_DIR)/$(BIN).elf
- @echo "Generating HEX binary: $(notdir $@)"
- $(CMD_ECHO) $(OBJCOPY) -O ihex $< $@
- $(BUILD_DIR)/%.o: %.s
- @echo "Compiling ASM file: $(notdir $<)"
- $(CMD_ECHO) $(AS) $(ASFLAGS) $(DEF) $(INC) -c -o $@ $<
- $(BUILD_DIR)/%.o: %.c
- @echo "Compiling C file: $(notdir $<)"
- $(CMD_ECHO) $(CC) $(CFLAGS) $(DEF) $(INC) -c -o $@ $<
- $(BUILD_DIR)/$(BIN).elf: $(OBJS_ASM) $(OBJS_C)
- @echo "Linking ELF binary: $(notdir $@)"
- $(CMD_ECHO) $(LD) $(LDFLAGS) $(SRC_LD) -o $@ $^ $(LIBS)
- @echo "Generating name list: $(BIN).sym"
- $(CMD_ECHO) $(NM) -n $@ > $(BUILD_DIR)/$(BIN).sym
- @echo "Showing final size:"
- $(CMD_ECHO) ls -la $@
- @echo "Generating disassembly: $(BIN).disasm"
- $(CMD_ECHO) $(OBJDUMP) -S $@ > $(BUILD_DIR)/$(BIN).disasm
- $(BUILD_DIR)/$(BIN).a: $(OBJS_ASM) $(OBJS_C)
- @echo "Building static library: $(notdir $@)"
- $(CMD_ECHO) $(AR) -r $@ $^
- @echo "Generating name list: $(BIN).sym"
- $(CMD_ECHO) $(NM) -n $@ > $(BUILD_DIR)/$(BIN).sym
- @echo "Showing final size:"
- $(CMD_ECHO) ls -la $@
- @echo "Generating disassembly: $(BIN).disasm"
- $(CMD_ECHO) $(OBJDUMP) -S $@ > $(BUILD_DIR)/$(BIN).disasm
- clean:
- rm -f $(BUILD_DIR)/*.elf $(BUILD_DIR)/*.hex $(BUILD_DIR)/*.map
- rm -f $(BUILD_DIR)/*.o $(BUILD_DIR)/*.a $(BUILD_DIR)/*.sym $(BUILD_DIR)/*.disasm
|