diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..03ba8b58a --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.o +bin/ +Makefile.local +.DS_Store + diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..3af715f09 --- /dev/null +++ b/Makefile @@ -0,0 +1,69 @@ +include Makefile.local + +TOOLCHAIN_PREFIX := xtensa-lx106-elf- +CC := $(TOOLCHAIN_PREFIX)gcc +AR := $(TOOLCHAIN_PREFIX)ar +LD := $(TOOLCHAIN_PREFIX)gcc +OBJCOPY := $(TOOLCHAIN_PREFIX)objcopy + + +XTENSA_LIBS ?= $(shell $(CC) -print-sysroot) + + +OBJ_FILES := \ + crypto/aes.o \ + crypto/bigint.o \ + crypto/hmac.o \ + crypto/md2.o \ + crypto/md5.o \ + crypto/rc4.o \ + crypto/rsa.o \ + crypto/sha1.o \ + ssl/asn1.o \ + ssl/gen_cert.o \ + ssl/loader.o \ + ssl/os_port.o \ + ssl/p12.o \ + ssl/tls1.o \ + ssl/tls1_clnt.o \ + ssl/tls1_svr.o \ + ssl/x509.o \ + crypto/crypto_misc.o \ + + +CPPFLAGS += -I$(XTENSA_LIBS)/include \ + -I$(SDK_BASE)/include \ + -Icrypto \ + -Issl + +LDFLAGS += -L$(XTENSA_LIBS)/lib \ + -L$(XTENSA_LIBS)/arch/lib \ + -L$(SDK_BASE)/lib + +CFLAGS+=-std=c99 -DESP8266 + +CFLAGS += -Os -g -O2 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mno-text-section-literals -D__ets__ -DICACHE_FLASH +BIN_DIR := bin +AXTLS_AR := $(BIN_DIR)/libaxtls.a + +all: $(AXTLS_AR) + +$(AXTLS_AR): | $(BIN_DIR) + +$(AXTLS_AR): $(OBJ_FILES) + for file in $(OBJ_FILES); do \ + $(OBJCOPY) \ + --rename-section .text=.irom0.text \ + --rename-section .literal=.irom0.literal \ + $$file; \ + done + $(AR) cru $@ $^ + +$(BIN_DIR): + mkdir -p $(BIN_DIR) + +clean: + rm -rf $(OBJ_FILES) $(LWIP_AR) + + +.PHONY: all clean diff --git a/Makefile.local.template b/Makefile.local.template new file mode 100644 index 000000000..937027f99 --- /dev/null +++ b/Makefile.local.template @@ -0,0 +1,3 @@ +# Set this to SDK path and save as Makefile.local +SDK_BASE := $(HOME)/esp8266/sdk + diff --git a/crypto/aes.o b/crypto/aes.o deleted file mode 100644 index 2d10e6d61..000000000 Binary files a/crypto/aes.o and /dev/null differ diff --git a/crypto/bigint.o b/crypto/bigint.o deleted file mode 100644 index f693e65a5..000000000 Binary files a/crypto/bigint.o and /dev/null differ diff --git a/crypto/hmac.o b/crypto/hmac.o deleted file mode 100644 index 69cf2c4ff..000000000 Binary files a/crypto/hmac.o and /dev/null differ diff --git a/crypto/md2.o b/crypto/md2.o deleted file mode 100644 index 46d054d9e..000000000 Binary files a/crypto/md2.o and /dev/null differ diff --git a/crypto/md5.o b/crypto/md5.o deleted file mode 100644 index 3bb00b7a4..000000000 Binary files a/crypto/md5.o and /dev/null differ diff --git a/crypto/rc4.o b/crypto/rc4.o deleted file mode 100644 index 104525cee..000000000 Binary files a/crypto/rc4.o and /dev/null differ diff --git a/crypto/rsa.o b/crypto/rsa.o deleted file mode 100644 index 320410453..000000000 Binary files a/crypto/rsa.o and /dev/null differ diff --git a/crypto/sha1.o b/crypto/sha1.o deleted file mode 100644 index ba9443f4f..000000000 Binary files a/crypto/sha1.o and /dev/null differ diff --git a/ssl/asn1.o b/ssl/asn1.o deleted file mode 100644 index 7f8f449c1..000000000 Binary files a/ssl/asn1.o and /dev/null differ diff --git a/ssl/gen_cert.o b/ssl/gen_cert.o deleted file mode 100644 index d31834c7a..000000000 Binary files a/ssl/gen_cert.o and /dev/null differ diff --git a/ssl/loader.o b/ssl/loader.o deleted file mode 100644 index 17758504e..000000000 Binary files a/ssl/loader.o and /dev/null differ diff --git a/ssl/os_port.o b/ssl/os_port.o deleted file mode 100644 index 6c20927b3..000000000 Binary files a/ssl/os_port.o and /dev/null differ diff --git a/ssl/p12.o b/ssl/p12.o deleted file mode 100644 index 8b874f138..000000000 Binary files a/ssl/p12.o and /dev/null differ