├── third_party ├── include │ ├── user_config.h │ ├── arch │ │ ├── sys_arch.h │ │ └── perf.h │ ├── ssl │ │ ├── ssl_version.h │ │ ├── app │ │ │ └── espconn_secure.h │ │ ├── ssl_os_int.h │ │ └── ssl_cert.h │ ├── lwip │ │ ├── icmp.h │ │ ├── netif.h │ │ ├── puck_def.h │ │ ├── app │ │ │ ├── espconn_buf.h │ │ │ ├── time.h │ │ │ ├── ping.h │ │ │ └── espconn_udp.h │ │ └── sntp.h │ ├── mbedtls │ │ ├── mbedtls_debug.h │ │ ├── havege.h │ │ └── entropy_poll.h │ └── netif │ │ └── wlan_lwip_if.h ├── lwip │ ├── api │ │ ├── netbuf.c │ │ ├── tcpip.c │ │ └── Makefile │ ├── core │ │ ├── ipv4 │ │ │ ├── icmp.c │ │ │ ├── Makefile │ │ │ └── inet.c │ │ ├── sys_arch.c │ │ ├── Makefile │ │ └── sys.c │ ├── app │ │ └── Makefile │ ├── netif │ │ └── Makefile │ └── Makefile ├── make_lib.sh ├── mbedtls │ ├── library │ │ ├── version.c │ │ └── Makefile │ ├── app │ │ └── Makefile │ ├── platform │ │ ├── Makefile │ │ └── esp_hardware.c │ └── Makefile └── json │ └── Makefile ├── License ├── lib ├── libc.a ├── libat.a ├── libgcc.a ├── libhal.a ├── libphy.a ├── libpp.a ├── libpwm.a ├── libssl.a ├── libwpa.a ├── libwps.a ├── libcrypto.a ├── libdriver.a ├── libespnow.a ├── libjson.a ├── liblwip.a ├── libmain.a ├── libwpa2.a ├── libairkiss.a ├── liblwip_536.a ├── libmbedtls.a ├── libnet80211.a ├── libupgrade.a ├── libsmartconfig.a ├── strip_libc_funcs.txt ├── strip_libgcc_funcs.txt └── readme.md ├── bin ├── blank.bin ├── boot_v1.2.bin ├── boot_v1.6.bin ├── boot_v1.7.bin ├── at │ ├── 512+512 │ │ ├── user1.1024.new.2.bin │ │ └── user2.1024.new.2.bin │ ├── 1024+1024 │ │ ├── user1.2048.new.5.bin │ │ └── user2.2048.new.5.bin │ └── README.md ├── esp_init_data_default_v05.bin ├── esp_init_data_default_v08.bin └── at_sdio │ ├── 1024+1024 │ ├── user1.2048.new.5.bin │ └── user2.2048.new.5.bin │ └── README.md ├── examples ├── readme.txt ├── at │ ├── !!!readme!!!.txt │ ├── user │ │ └── Makefile │ └── include │ │ └── user_config.h ├── at_nano │ ├── !!!readme!!!.txt │ ├── user │ │ └── Makefile │ └── include │ │ └── user_config.h ├── at_espconn │ ├── !!!readme!!!.txt │ ├── user │ │ └── Makefile │ └── include │ │ └── user_config.h ├── smart_config │ ├── model two-dimension code.rar │ ├── !!!readme!!!.txt │ ├── include │ │ └── user_config.h │ └── user │ │ └── Makefile ├── wpa2_enterprise │ ├── include │ │ ├── wpa2_pki │ │ │ ├── str2hex │ │ │ ├── certs │ │ │ │ ├── ca.der │ │ │ │ ├── client.p12 │ │ │ │ ├── server.p12 │ │ │ │ ├── dh │ │ │ │ ├── ca.key │ │ │ │ ├── ca.pem │ │ │ │ ├── client.key │ │ │ │ └── server.key │ │ │ └── import_ca_crt_key.sh │ │ └── user_config.h │ └── user │ │ └── Makefile ├── esp_mqtt_proj │ ├── include │ │ ├── user_config.h │ │ ├── mqtt │ │ │ ├── utils.h │ │ │ ├── typedef.h │ │ │ ├── debug.h │ │ │ ├── ringbuf.h │ │ │ ├── proto.h │ │ │ └── queue.h │ │ ├── modules │ │ │ ├── wifi.h │ │ │ └── config.h │ │ └── mqtt_config.h │ ├── mqtt │ │ ├── include │ │ │ ├── utils.h │ │ │ ├── typedef.h │ │ │ ├── debug.h │ │ │ ├── ringbuf.h │ │ │ ├── proto.h │ │ │ └── queue.h │ │ ├── Makefile │ │ ├── ringbuf.c │ │ └── queue.c │ ├── user │ │ └── Makefile │ ├── modules │ │ ├── Makefile │ │ └── wifi.c │ └── README.md ├── at_sdio │ ├── gen_misc.bat │ ├── include │ │ ├── version.h │ │ ├── user_config.h │ │ └── driver │ │ │ └── sdio_slv.h │ ├── driver │ │ └── Makefile │ └── user │ │ └── Makefile ├── gen_patch_bin │ ├── gen_bin.sh │ ├── gen_patch_bin.py │ ├── include │ │ └── user_config.h │ ├── gen_misc.sh │ └── user │ │ └── Makefile ├── wps │ ├── include │ │ ├── user_config.h │ │ └── driver │ │ │ └── key.h │ ├── driver │ │ └── Makefile │ └── user │ │ └── Makefile ├── peripheral_test │ ├── include │ │ ├── user_config.h │ │ └── spi_test.h │ └── user │ │ └── Makefile └── simple_pair │ ├── include │ └── user_config.h │ └── user │ └── Makefile ├── documents └── readme.txt ├── tools ├── rmfile.sh ├── make_cacert.py ├── README.md └── make_cert.py ├── include ├── version.h ├── os_type.h ├── smartconfig.h ├── sntp.h ├── ping.h ├── pwm.h ├── spi_flash.h ├── simple_pair.h ├── upgrade.h ├── espnow.h ├── wpa2_enterprise.h └── json │ └── json.h ├── driver_lib ├── make_lib.sh ├── README.md ├── include │ └── driver │ │ ├── gpio16.h │ │ ├── sdio_slv.h │ │ ├── key.h │ │ ├── hw_timer.h │ │ └── spi.h └── driver │ ├── Makefile │ ├── system_patch_apply.c │ └── gpio16.c └── VERSION /third_party/include/user_config.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /third_party/include/arch/sys_arch.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/License -------------------------------------------------------------------------------- /third_party/include/ssl/ssl_version.h: -------------------------------------------------------------------------------- 1 | #define AXTLS_VERSION "1.4.9" 2 | -------------------------------------------------------------------------------- /lib/libc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libc.a -------------------------------------------------------------------------------- /lib/libat.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libat.a -------------------------------------------------------------------------------- /lib/libgcc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libgcc.a -------------------------------------------------------------------------------- /lib/libhal.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libhal.a -------------------------------------------------------------------------------- /lib/libphy.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libphy.a -------------------------------------------------------------------------------- /lib/libpp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libpp.a -------------------------------------------------------------------------------- /lib/libpwm.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libpwm.a -------------------------------------------------------------------------------- /lib/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libssl.a -------------------------------------------------------------------------------- /lib/libwpa.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libwpa.a -------------------------------------------------------------------------------- /lib/libwps.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libwps.a -------------------------------------------------------------------------------- /bin/blank.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/bin/blank.bin -------------------------------------------------------------------------------- /lib/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libcrypto.a -------------------------------------------------------------------------------- /lib/libdriver.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libdriver.a -------------------------------------------------------------------------------- /lib/libespnow.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libespnow.a -------------------------------------------------------------------------------- /lib/libjson.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libjson.a -------------------------------------------------------------------------------- /lib/liblwip.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/liblwip.a -------------------------------------------------------------------------------- /lib/libmain.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libmain.a -------------------------------------------------------------------------------- /lib/libwpa2.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libwpa2.a -------------------------------------------------------------------------------- /bin/boot_v1.2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/bin/boot_v1.2.bin -------------------------------------------------------------------------------- /bin/boot_v1.6.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/bin/boot_v1.6.bin -------------------------------------------------------------------------------- /bin/boot_v1.7.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/bin/boot_v1.7.bin -------------------------------------------------------------------------------- /lib/libairkiss.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libairkiss.a -------------------------------------------------------------------------------- /lib/liblwip_536.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/liblwip_536.a -------------------------------------------------------------------------------- /lib/libmbedtls.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libmbedtls.a -------------------------------------------------------------------------------- /lib/libnet80211.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libnet80211.a -------------------------------------------------------------------------------- /lib/libupgrade.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libupgrade.a -------------------------------------------------------------------------------- /examples/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/examples/readme.txt -------------------------------------------------------------------------------- /lib/libsmartconfig.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/lib/libsmartconfig.a -------------------------------------------------------------------------------- /examples/at/!!!readme!!!.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/examples/at/!!!readme!!!.txt -------------------------------------------------------------------------------- /third_party/lwip/api/netbuf.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/third_party/lwip/api/netbuf.c -------------------------------------------------------------------------------- /third_party/lwip/api/tcpip.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/third_party/lwip/api/tcpip.c -------------------------------------------------------------------------------- /third_party/include/lwip/icmp.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/third_party/include/lwip/icmp.h -------------------------------------------------------------------------------- /third_party/include/lwip/netif.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/third_party/include/lwip/netif.h -------------------------------------------------------------------------------- /bin/at/512+512/user1.1024.new.2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/bin/at/512+512/user1.1024.new.2.bin -------------------------------------------------------------------------------- /bin/at/512+512/user2.1024.new.2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/bin/at/512+512/user2.1024.new.2.bin -------------------------------------------------------------------------------- /bin/esp_init_data_default_v05.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/bin/esp_init_data_default_v05.bin -------------------------------------------------------------------------------- /bin/esp_init_data_default_v08.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/bin/esp_init_data_default_v08.bin -------------------------------------------------------------------------------- /examples/at_nano/!!!readme!!!.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/examples/at_nano/!!!readme!!!.txt -------------------------------------------------------------------------------- /third_party/lwip/core/ipv4/icmp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/third_party/lwip/core/ipv4/icmp.c -------------------------------------------------------------------------------- /bin/at/1024+1024/user1.2048.new.5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/bin/at/1024+1024/user1.2048.new.5.bin -------------------------------------------------------------------------------- /bin/at/1024+1024/user2.2048.new.5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/bin/at/1024+1024/user2.2048.new.5.bin -------------------------------------------------------------------------------- /examples/at_espconn/!!!readme!!!.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/examples/at_espconn/!!!readme!!!.txt -------------------------------------------------------------------------------- /bin/at_sdio/1024+1024/user1.2048.new.5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/bin/at_sdio/1024+1024/user1.2048.new.5.bin -------------------------------------------------------------------------------- /bin/at_sdio/1024+1024/user2.2048.new.5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/bin/at_sdio/1024+1024/user2.2048.new.5.bin -------------------------------------------------------------------------------- /examples/smart_config/model two-dimension code.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/examples/smart_config/model two-dimension code.rar -------------------------------------------------------------------------------- /examples/wpa2_enterprise/include/wpa2_pki/str2hex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/examples/wpa2_enterprise/include/wpa2_pki/str2hex -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/include/user_config.h: -------------------------------------------------------------------------------- 1 | #ifndef __USER_CONFIG_H__ 2 | #define __USER_CONFIG_H__ 3 | 4 | #define USE_OPTIMIZE_PRINTF 5 | 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /examples/wpa2_enterprise/include/wpa2_pki/certs/ca.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/examples/wpa2_enterprise/include/wpa2_pki/certs/ca.der -------------------------------------------------------------------------------- /examples/wpa2_enterprise/include/wpa2_pki/certs/client.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/examples/wpa2_enterprise/include/wpa2_pki/certs/client.p12 -------------------------------------------------------------------------------- /examples/wpa2_enterprise/include/wpa2_pki/certs/server.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/espressif/ESP8266_NONOS_SDK/HEAD/examples/wpa2_enterprise/include/wpa2_pki/certs/server.p12 -------------------------------------------------------------------------------- /documents/readme.txt: -------------------------------------------------------------------------------- 1 | SDK Development Guide @ https://espressif.com/sites/default/files/documentation/2a-esp8266-sdk_getting_started_guide_en.pdf 2 | All documentations @ https://espressif.com/en/support/download/documents?keys=&field_type_tid%5B%5D=14 3 | -------------------------------------------------------------------------------- /tools/rmfile.sh: -------------------------------------------------------------------------------- 1 | rm *.pem -rf 2 | rm *.srl -rf 3 | rm *.h -rf 4 | rm *.cer -rf 5 | rm *.key_1024 -rf 6 | rm *.req -rf 7 | rm *.conf -rf 8 | rm *.bak -rf 9 | 10 | rm ca/ -rf 11 | rm bin/ -rf 12 | rm server/ -rf 13 | rm client/ -rf 14 | rm include/ -rf 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /examples/wpa2_enterprise/include/wpa2_pki/certs/dh: -------------------------------------------------------------------------------- 1 | -----BEGIN DH PARAMETERS----- 2 | MIGHAoGBAKmGKli1HkbNwmB1UpSJpiAb45AZwO49b3fL0H1XAq3z6bU+ghYhRpZj 3 | gR3zxZ05pMksz/JA1SK2BNg19mIberZMIxr/2SI+Qx/VB4EMR+8UZ0zbOGj3flDM 4 | 0lMGKm8EYPPaOdx0ckMostVsND5XwxKPVFvW3f3Fh4fyVwNVA/XDAgEC 5 | -----END DH PARAMETERS----- 6 | -------------------------------------------------------------------------------- /include/version.h: -------------------------------------------------------------------------------- 1 | #ifndef ESP_SDK_VERSION_H 2 | #define ESP_SDK_VERSION_H 3 | 4 | #define ESP_SDK_VERSION_MAJOR 3 5 | #define ESP_SDK_VERSION_MINOR 0 6 | #define ESP_SDK_VERSION_PATCH 4 7 | 8 | #define ESP_SDK_VERSION_NUMBER 0x030004 9 | #define ESP_SDK_VERSION_STRING "3.0.4" 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /third_party/lwip/core/sys_arch.c: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2010 - 2011 espressif system 3 | */ 4 | 5 | #include "c_types.h" 6 | #include "ets_sys.h" 7 | #include "osapi.h" 8 | #include "os_type.h" 9 | 10 | #include "lwip/opt.h" 11 | #include "lwip/sys.h" 12 | 13 | #include "eagle_soc.h" 14 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/include/mqtt/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTILS_H_ 2 | #define _UTILS_H_ 3 | 4 | #include "c_types.h" 5 | 6 | uint32_t ICACHE_FLASH_ATTR UTILS_Atoh(const int8_t *s); 7 | uint8_t ICACHE_FLASH_ATTR UTILS_StrToIP(const int8_t* str, void *ip); 8 | uint8_t ICACHE_FLASH_ATTR UTILS_IsIPV4 (int8_t *str); 9 | #endif 10 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/mqtt/include/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTILS_H_ 2 | #define _UTILS_H_ 3 | 4 | #include "c_types.h" 5 | 6 | uint32_t ICACHE_FLASH_ATTR UTILS_Atoh(const int8_t *s); 7 | uint8_t ICACHE_FLASH_ATTR UTILS_StrToIP(const int8_t* str, void *ip); 8 | uint8_t ICACHE_FLASH_ATTR UTILS_IsIPV4 (int8_t *str); 9 | #endif 10 | -------------------------------------------------------------------------------- /driver_lib/make_lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | echo "make_lib.sh version 20160307" 4 | echo "" 5 | 6 | touch include/user_config.h 7 | 8 | cd $1 9 | make clean 10 | make COMPILE=gcc 11 | cp .output/eagle/debug/lib/lib$1.a ../../lib/lib$1.a 12 | xtensa-lx106-elf-strip --strip-unneeded ../../lib/lib$1.a 13 | cd .. 14 | rm include/user_config.h 15 | -------------------------------------------------------------------------------- /lib/strip_libc_funcs.txt: -------------------------------------------------------------------------------- 1 | OPEN libc.a 2 | DELETE lib_a-bzero.o 3 | DELETE lib_a-memcmp.o 4 | DELETE lib_a-memcpy.o 5 | DELETE lib_a-memmove.o 6 | DELETE lib_a-memset.o 7 | DELETE lib_a-rand.o 8 | DELETE lib_a-strcmp.o 9 | DELETE lib_a-strcpy.o 10 | DELETE lib_a-strlen.o 11 | DELETE lib_a-strncmp.o 12 | DELETE lib_a-strncpy.o 13 | DELETE lib_a-strstr.o 14 | SAVE 15 | END -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/include/mqtt/typedef.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * Standard Types definition 4 | */ 5 | 6 | #ifndef _TYPE_DEF_H_ 7 | #define _TYPE_DEF_H_ 8 | 9 | typedef char I8; 10 | typedef unsigned char U8; 11 | typedef short I16; 12 | typedef unsigned short U16; 13 | typedef long I32; 14 | typedef unsigned long U32; 15 | typedef unsigned long long U64; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/mqtt/include/typedef.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * Standard Types definition 4 | */ 5 | 6 | #ifndef _TYPE_DEF_H_ 7 | #define _TYPE_DEF_H_ 8 | 9 | typedef char I8; 10 | typedef unsigned char U8; 11 | typedef short I16; 12 | typedef unsigned short U16; 13 | typedef long I32; 14 | typedef unsigned long U32; 15 | typedef unsigned long long U64; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/include/modules/wifi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wifi.h 3 | * 4 | * Created on: Dec 30, 2014 5 | * Author: Minh 6 | */ 7 | 8 | #ifndef USER_WIFI_H_ 9 | #define USER_WIFI_H_ 10 | #include "os_type.h" 11 | typedef void (*WifiCallback)(uint8_t); 12 | void ICACHE_FLASH_ATTR WIFI_Connect(uint8_t* ssid, uint8_t* pass, WifiCallback cb); 13 | 14 | 15 | #endif /* USER_WIFI_H_ */ 16 | -------------------------------------------------------------------------------- /examples/smart_config/!!!readme!!!.txt: -------------------------------------------------------------------------------- 1 | if you want to use AIRKISS2.0 LAN discovery, should include airkiss.h and include libairkiss.a in makefile. 2 | 3 | you can follow the steps below to achieve the function of LAN discovery. 4 | 1.scan the two-dimension code in your wechat. 5 | 2.running this smartconfig example. 6 | 3.wait device connect to AP and LAN discovery. 7 | 8 | More detailed introduction refer to wechat. -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/include/mqtt/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * debug.h 3 | * 4 | * Created on: Dec 4, 2014 5 | * Author: Minh 6 | */ 7 | 8 | #ifndef USER_DEBUG_H_ 9 | #define USER_DEBUG_H_ 10 | 11 | #if defined(GLOBAL_DEBUG_ON) 12 | #define MQTT_DEBUG_ON 13 | #endif 14 | #if defined(MQTT_DEBUG_ON) 15 | #define INFO( format, ... ) os_printf( format, ## __VA_ARGS__ ) 16 | #else 17 | #define INFO( format, ... ) 18 | #endif 19 | // #ifndef INFO 20 | // #define INFO os_printf 21 | // #endif 22 | 23 | #endif /* USER_DEBUG_H_ */ 24 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/mqtt/include/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * debug.h 3 | * 4 | * Created on: Dec 4, 2014 5 | * Author: Minh 6 | */ 7 | 8 | #ifndef USER_DEBUG_H_ 9 | #define USER_DEBUG_H_ 10 | 11 | #if defined(GLOBAL_DEBUG_ON) 12 | #define MQTT_DEBUG_ON 13 | #endif 14 | #if defined(MQTT_DEBUG_ON) 15 | #define INFO( format, ... ) os_printf( format, ## __VA_ARGS__ ) 16 | #else 17 | #define INFO( format, ... ) 18 | #endif 19 | // #ifndef INFO 20 | // #define INFO os_printf 21 | // #endif 22 | 23 | #endif /* USER_DEBUG_H_ */ 24 | -------------------------------------------------------------------------------- /lib/strip_libgcc_funcs.txt: -------------------------------------------------------------------------------- 1 | OPEN libgcc.a 2 | DELETE _addsubdf3.o 3 | DELETE _addsubsf3.o 4 | DELETE _divdf3.o 5 | DELETE _divdi3.o 6 | DELETE _divsi3.o 7 | DELETE _extendsfdf2.o 8 | DELETE _fixdfsi.o 9 | DELETE _fixunsdfsi.o 10 | DELETE _fixunssfsi.o 11 | DELETE _floatsidf.o 12 | DELETE _floatsisf.o 13 | DELETE _floatunsidf.o 14 | DELETE _floatunsisf.o 15 | DELETE _muldf3.o 16 | DELETE _muldi3.o 17 | DELETE _mulsf3.o 18 | DELETE _truncdfsf2.o 19 | DELETE _udivdi3.o 20 | DELETE _udivsi3.o 21 | DELETE _umoddi3.o 22 | DELETE _umodsi3.o 23 | DELETE _umulsidi3.o 24 | SAVE 25 | END -------------------------------------------------------------------------------- /third_party/make_lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | export SDK_PATH=$(dirname $(pwd)) 5 | 6 | echo "make_lib.sh version 20150924" 7 | echo "" 8 | 9 | if [ $SDK_PATH ]; then 10 | echo "SDK_PATH:" 11 | echo "$SDK_PATH" 12 | echo "" 13 | else 14 | echo "ERROR: Please export SDK_PATH in make_lib.sh firstly, exit!!!" 15 | exit 16 | fi 17 | 18 | cd $1 19 | make clean 20 | make COMPILE=gcc 21 | 22 | # Make sure the lib folder is exist. 23 | 24 | cp .output/eagle/debug/lib/lib$1.a ../../lib/lib$1.a 25 | xtensa-lx106-elf-strip --strip-unneeded ../../lib/lib$1.a 26 | cd .. 27 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | gwen: 2 | at : 865fa65 3 | crypto : 865fa65 4 | espnow : 865fa65 5 | main : 072755c 6 | net80211 : 072755c 7 | pp : 865fa65 8 | ssl : 865fa65 9 | upgrade : 81bde69 10 | wpa : 1cef03c 11 | wpa2 : 865fa65 12 | wps : 865fa65 13 | 14 | phy: 15 | phy : 1156_0 16 | 17 | gitlab: 18 | driver : 13cf853c 19 | json : f55d5fee 20 | lwip : 3c984cd8 21 | mbedtls : 82b93fe5 22 | smartconfig : ea1d4a13(v2.5.5) 23 | -------------------------------------------------------------------------------- /driver_lib/README.md: -------------------------------------------------------------------------------- 1 | # driver_lib 2 | ## method 1 3 | Generate libdriver.a in SDK/lib, in driver_lib folder, run: 4 | 5 | ./make_lib.sh driver 6 | 7 | ## method 2 8 | * STEP 1: 9 | 10 | Copy driver folder to your project sub-folder, such as app folder. Unused drivers can be removed in your project. 11 | 12 | * STEP 2: 13 | 14 | Modify Makefile in app folder. 15 | 16 | 1). Search SUBDIRS, add driver as subdir, such as: 17 | 18 | SUBDIRS = user driver 19 | 20 | 2). Search COMPONENTS_eagle.app.v6, add libdriver.a, such as: 21 | 22 | COMPONENTS_eagle.app.v6 = user/libuser.a driver/libdriver.a -------------------------------------------------------------------------------- /third_party/include/mbedtls/mbedtls_debug.h: -------------------------------------------------------------------------------- 1 | #ifndef _MBEDTLS_DEBUG_H_ 2 | #define _MBEDTLS_DEBUG_H_ 3 | 4 | #include "osapi.h" 5 | 6 | #define MBEDTLS_SSL_DEBUG_MSG( level, args ) os_printf args; 7 | #define MBEDTLS_SSL_DEBUG_RET( level, ... ) os_printf (__VA_ARGS__); 8 | #define MBEDTLS_SSL_DEBUG_BUF( level, ... ) os_printf (__VA_ARGS__); 9 | #define MBEDTLS_SSL_DEBUG_MPI( level, text, X ) do { } while( 0 ) 10 | #define MBEDTLS_SSL_DEBUG_ECP( level, text, X ) do { } while( 0 ) 11 | #define MBEDTLS_SSL_DEBUG_CRT( level, text, crt ) do { } while( 0 ) 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/include/mqtt/ringbuf.h: -------------------------------------------------------------------------------- 1 | #ifndef _RING_BUF_H_ 2 | #define _RING_BUF_H_ 3 | 4 | #include 5 | #include 6 | #include "typedef.h" 7 | 8 | typedef struct{ 9 | U8* p_o; /**< Original pointer */ 10 | U8* volatile p_r; /**< Read pointer */ 11 | U8* volatile p_w; /**< Write pointer */ 12 | volatile I32 fill_cnt; /**< Number of filled slots */ 13 | I32 size; /**< Buffer size */ 14 | }RINGBUF; 15 | 16 | I16 ICACHE_FLASH_ATTR RINGBUF_Init(RINGBUF *r, U8* buf, I32 size); 17 | I16 ICACHE_FLASH_ATTR RINGBUF_Put(RINGBUF *r, U8 c); 18 | I16 ICACHE_FLASH_ATTR RINGBUF_Get(RINGBUF *r, U8* c); 19 | #endif 20 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/mqtt/include/ringbuf.h: -------------------------------------------------------------------------------- 1 | #ifndef _RING_BUF_H_ 2 | #define _RING_BUF_H_ 3 | 4 | #include 5 | #include 6 | #include "typedef.h" 7 | 8 | typedef struct{ 9 | U8* p_o; /**< Original pointer */ 10 | U8* volatile p_r; /**< Read pointer */ 11 | U8* volatile p_w; /**< Write pointer */ 12 | volatile I32 fill_cnt; /**< Number of filled slots */ 13 | I32 size; /**< Buffer size */ 14 | }RINGBUF; 15 | 16 | I16 ICACHE_FLASH_ATTR RINGBUF_Init(RINGBUF *r, U8* buf, I32 size); 17 | I16 ICACHE_FLASH_ATTR RINGBUF_Put(RINGBUF *r, U8 c); 18 | I16 ICACHE_FLASH_ATTR RINGBUF_Get(RINGBUF *r, U8* c); 19 | #endif 20 | -------------------------------------------------------------------------------- /examples/wpa2_enterprise/include/wpa2_pki/import_ca_crt_key.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CA_FILE=./certs/ca.pem 4 | CRT_FILE=./certs/client.crt 5 | KEY_FILE=./certs/client.key 6 | 7 | if [ -f $CA_FILE ];then 8 | echo "unsigned char ca[] = {" > ./ca.h 9 | ./str2hex $CA_FILE >> ./ca.h 10 | echo "0x00, };" >> ./ca.h 11 | fi 12 | 13 | if [ -f $CRT_FILE ];then 14 | echo "unsigned char client_cert[] = {" > ./client_crt.h 15 | ./str2hex $CRT_FILE >> ./client_crt.h 16 | echo "0x00, };" >> ./client_crt.h 17 | fi 18 | 19 | if [ -f $KEY_FILE ];then 20 | echo "unsigned char client_key[] = {" > ./client_key.h 21 | ./str2hex $KEY_FILE >> ./client_key.h 22 | echo "0x00, };" >> ./client_key.h 23 | fi 24 | -------------------------------------------------------------------------------- /third_party/include/netif/wlan_lwip_if.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2011 Espressif System 3 | * 4 | */ 5 | 6 | #ifndef _WLAN_LWIP_IF_H_ 7 | #define _WLAN_LWIP_IF_H_ 8 | 9 | #define LWIP_IF0_PRIO 28 10 | #define LWIP_IF1_PRIO 29 11 | 12 | enum { 13 | SIG_LWIP_RX = 0, 14 | }; 15 | 16 | struct netif * eagle_lwip_if_alloc(struct ieee80211_conn *conn, const uint8 *macaddr, struct ip_info *info); 17 | struct netif * eagle_lwip_getif(uint8 index); 18 | 19 | #ifndef IOT_SIP_MODE 20 | sint8 ieee80211_output_pbuf(struct netif *ifp, struct pbuf* pb); 21 | #else 22 | sint8 ieee80211_output_pbuf(struct ieee80211_conn *conn, esf_buf *eb); 23 | #endif 24 | 25 | #endif /* _WLAN_LWIP_IF_H_ */ 26 | -------------------------------------------------------------------------------- /examples/wpa2_enterprise/include/wpa2_pki/certs/ca.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALpWR23fn/TmHxsX 3 | sHdrydzPSd17fZkc71WsaicgQR661tIVYb22UWGfj9KPM8THMsV74ew4ZkaQ39qv 4 | U0iuQIRrKARFHFok+vbaecgWMeWevGIqdnmyB9gJYaFOKgtSkfXsu2ddsqdvLYwc 5 | Dbczrq8X9yEXpN6mnxXeCcPG4F0pAgMBAAECgYAzCTqbL2rCSt0uMHjW3KD3Z5cV 6 | oKMv8qrizkxs1vq/DfGUrOKOcYcss+VSiIJnXR/c0yd36aKppTiKzwaCm6dzpNTL 7 | XhHyvxAk293OXq6ov7LSfpuQTSW0d/bsLceMSD7jm6hnlYhGDg5I5nLaTsiQjedZ 8 | OoLlfqcg5+qAbm6T2QJBAPbHOhJqQ8H0SIYZzYN6te18KAlZ8lNw/jVUvSqWn9g0 9 | iinGqbbNsmxYp72Y1sb8AtOQkRypE+BUZlZ7LdMRpzcCQQDBTNlU7w82hDb8gzPB 10 | kLdJ8bom2AfNLOtgBlQkNRAItbt6OHA2BzhLMPs8CDDPPBwEKqzR4RC4l2uvcQe/ 11 | n46fAkAPtLBKeb7kOjLfbgb5Zjbr7Wny5mmYy+kx5bnAWyPDM9zTOdSVUNQZNy89 12 | zttkgKeBZYMGyu/76AM3X9GTzFzTAkAwyZGs8y12yAYM05yThVANlLo0JaBKc8Tw 13 | lohUHyRt3lh0L5x6tnXJ3JH8g+C13WkA0DiQPGr4/BbM0A1xmvbnAkBBbe+FdY/a 14 | dTY6cgg8ywgGaWp8d2DV9gjio9Sm1/EIHkewFRt8/q8OE3VtaZ7t0gNVSKDfb8XU 15 | 71a+s4Jqqq8i 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/include/mqtt/proto.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: proto.h 3 | * Author: ThuHien 4 | * 5 | * Created on November 23, 2012, 8:57 AM 6 | */ 7 | 8 | #ifndef _PROTO_H_ 9 | #define _PROTO_H_ 10 | #include 11 | #include "typedef.h" 12 | #include "ringbuf.h" 13 | 14 | typedef void(PROTO_PARSE_CALLBACK)(); 15 | 16 | typedef struct{ 17 | U8 *buf; 18 | U16 bufSize; 19 | U16 dataLen; 20 | U8 isEsc; 21 | U8 isBegin; 22 | PROTO_PARSE_CALLBACK* callback; 23 | }PROTO_PARSER; 24 | 25 | I8 ICACHE_FLASH_ATTR PROTO_Init(PROTO_PARSER *parser, PROTO_PARSE_CALLBACK *completeCallback, U8 *buf, U16 bufSize); 26 | I8 ICACHE_FLASH_ATTR PROTO_Parse(PROTO_PARSER *parser, U8 *buf, U16 len); 27 | I16 ICACHE_FLASH_ATTR PROTO_Add(U8 *buf, const U8 *packet, I16 bufSize); 28 | I16 ICACHE_FLASH_ATTR PROTO_AddRb(RINGBUF *rb, const U8 *packet, I16 len); 29 | I8 ICACHE_FLASH_ATTR PROTO_ParseByte(PROTO_PARSER *parser, U8 value); 30 | I16 ICACHE_FLASH_ATTR PROTO_ParseRb(RINGBUF *rb, U8 *bufOut, U16* len, U16 maxBufLen); 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/mqtt/include/proto.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: proto.h 3 | * Author: ThuHien 4 | * 5 | * Created on November 23, 2012, 8:57 AM 6 | */ 7 | 8 | #ifndef _PROTO_H_ 9 | #define _PROTO_H_ 10 | #include 11 | #include "typedef.h" 12 | #include "ringbuf.h" 13 | 14 | typedef void(PROTO_PARSE_CALLBACK)(); 15 | 16 | typedef struct{ 17 | U8 *buf; 18 | U16 bufSize; 19 | U16 dataLen; 20 | U8 isEsc; 21 | U8 isBegin; 22 | PROTO_PARSE_CALLBACK* callback; 23 | }PROTO_PARSER; 24 | 25 | I8 ICACHE_FLASH_ATTR PROTO_Init(PROTO_PARSER *parser, PROTO_PARSE_CALLBACK *completeCallback, U8 *buf, U16 bufSize); 26 | I8 ICACHE_FLASH_ATTR PROTO_Parse(PROTO_PARSER *parser, U8 *buf, U16 len); 27 | I16 ICACHE_FLASH_ATTR PROTO_Add(U8 *buf, const U8 *packet, I16 bufSize); 28 | I16 ICACHE_FLASH_ATTR PROTO_AddRb(RINGBUF *rb, const U8 *packet, I16 len); 29 | I8 ICACHE_FLASH_ATTR PROTO_ParseByte(PROTO_PARSER *parser, U8 value); 30 | I16 ICACHE_FLASH_ATTR PROTO_ParseRb(RINGBUF *rb, U8 *bufOut, U16* len, U16 maxBufLen); 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /examples/at_sdio/gen_misc.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set BACKPATH=%PATH% 3 | set PATH=%BACKPATH%;%CD%\..\tools 4 | @echo on 5 | 6 | del /F ..\bin\eagle.app.v6.flash.bin ..\bin\eagle.app.v6.irom0text.bin ..\bin\eagle.app.v6.dump ..\bin\eagle.app.v6.S 7 | 8 | cd .output\eagle\debug\image 9 | 10 | xt-objdump -x -s eagle.app.v6.out > ..\..\..\..\..\bin\eagle.app.v6.dump 11 | xt-objdump -S eagle.app.v6.out > ..\..\..\..\..\bin\eagle.app.v6.S 12 | 13 | xt-objcopy --only-section .text -O binary eagle.app.v6.out eagle.app.v6.text.bin 14 | xt-objcopy --only-section .data -O binary eagle.app.v6.out eagle.app.v6.data.bin 15 | xt-objcopy --only-section .rodata -O binary eagle.app.v6.out eagle.app.v6.rodata.bin 16 | xt-objcopy --only-section .irom0.text -O binary eagle.app.v6.out eagle.app.v6.irom0text.bin 17 | 18 | gen_appbin.py eagle.app.v6.out v6 19 | 20 | xcopy /y eagle.app.v6.irom0text.bin ..\..\..\..\..\bin\ 21 | xcopy /y eagle.app.v6.flash.bin ..\..\..\..\..\bin\ 22 | 23 | cd ..\..\..\..\ 24 | 25 | @echo off 26 | set PATH=%BACKPATH% 27 | @echo on 28 | -------------------------------------------------------------------------------- /examples/gen_patch_bin/gen_bin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -r latest 4 | cp -r .output latest 5 | 6 | if [ ! -d "bin" ]; then 7 | mkdir bin 8 | fi 9 | 10 | rm bin/eagle.app.v6.flash.bin bin/eagle.app.v6.irom0text.bin bin/eagle.app.v6.dump bin/eagle.app.v6.S 11 | 12 | cd latest/eagle/debug/image 13 | 14 | xtensa-lx106-elf-objdump -x -s eagle.app.v6.out > ../../../../bin/eagle.app.v6.dump 15 | xtensa-lx106-elf-objdump -S eagle.app.v6.out > ../../../../bin/eagle.app.v6.S 16 | 17 | 18 | xtensa-lx106-elf-objcopy --only-section .text -O binary eagle.app.v6.out eagle.app.v6.text.bin 19 | xtensa-lx106-elf-objcopy --only-section .data -O binary eagle.app.v6.out eagle.app.v6.data.bin 20 | xtensa-lx106-elf-objcopy --only-section .rodata -O binary eagle.app.v6.out eagle.app.v6.rodata.bin 21 | xtensa-lx106-elf-objcopy --only-section .irom0.text -O binary eagle.app.v6.out eagle.app.v6.irom0text.bin 22 | 23 | python2 ../../../../tools/gen_appbin_user.py eagle.app.v6.out 0 24 | cp eagle.app.v6.irom0text.bin ../../../../bin/ 25 | cp eagle.app.flash.bin ../../../../bin/eagle.app.v6.flash.bin 26 | 27 | cd ../../../../ 28 | -------------------------------------------------------------------------------- /lib/readme.md: -------------------------------------------------------------------------------- 1 | # About libc.a and libgcc.a 2 | 3 | In order to reduce the size of **.text**, we remove the functions which already in rom code. 4 | 5 | The removed functions in libgcc.a: 6 | 7 | ``` 8 | __addsubdf3 9 | __addsubsf3 10 | __divdf3 11 | __divdi3 12 | __divsi3 13 | __extendsfdf2 14 | __fixdfsi 15 | __fixunsdfsi 16 | __fixunssfsi 17 | __floatsidf 18 | __floatsisf 19 | __floatunsidf 20 | __floatunsisf 21 | __muldf3 22 | __muldi3 23 | __mulsf3 24 | __truncdfsf2 25 | __udivdi3 26 | __udivsi3 27 | __umoddi3 28 | __umodsi3 29 | __umulsidi3 30 | ``` 31 | 32 | The removed functions in libc.a: 33 | 34 | ``` 35 | bzero 36 | memcmp 37 | memcpy 38 | memmove 39 | memset 40 | strcmp 41 | strcpy 42 | strlen 43 | strncmp 44 | strncpy 45 | strstr 46 | ``` 47 | 48 | ## How to remove the functions in those two lib. 49 | 50 | The libc.a in SDK is compiled from newlib v2.0.0, libgcc.a is compiled from gcc v4.8.5. 51 | If you use other version gcc and newlib, you can follow those commands to strip the functions. 52 | 53 | ``` 54 | cp $(TOOLCHAIN)/lib/gcc/xtensa-lx106-elf//libgcc.a . 55 | xtensa-lx106-elf-ar -M < strip_libgcc_funcs.txt 56 | 57 | cp $(TOOLCHAIN)/xtensa-lx106-elf/lib/libc.a . 58 | xtensa-lx106-elf-ar -M < strip_libc_funcs.txt 59 | ``` -------------------------------------------------------------------------------- /examples/gen_patch_bin/gen_patch_bin.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | if os.path.exists("./patch_array.h"): 4 | os.remove("./patch_array.h") 5 | 6 | if os.system("./gen_misc.sh") != 0: 7 | print("Run gen_misc.sh failed") 8 | exit(-1) 9 | 10 | if os.system("./gen_bin.sh") != 0: 11 | print("Run gen_bin.sh failed") 12 | exit(-1) 13 | 14 | with open("bin/eagle.app.v6.flash.bin","r") as fd: 15 | with open("./patch_array.h","w+") as patch_fd: 16 | patch_fd.write("// This file is a patch for th25q16\r\n\r\n") 17 | patch_fd.write("#include \"os_type.h\"\r\n\r\n") 18 | patch_fd.write("const uint8 patch_data[] STORE_ATTR = {\r\n") 19 | mystr = fd.read() 20 | len1 = len(mystr) 21 | Hex_Str = "" 22 | offset = 0 23 | for i in range(0, len1,1): 24 | Hex_Str += "0x"+(hex(ord(mystr[i])).replace('0x','').zfill(2)).upper()+ "," 25 | offset += 1 26 | if offset == 16: 27 | print Hex_Str 28 | patch_fd.write(" {}\r\n".format(Hex_Str)) 29 | Hex_Str = "" 30 | offset = 0 31 | 32 | if Hex_Str != "": 33 | print Hex_Str 34 | patch_fd.write(" {}\r\n".format(Hex_Str)) 35 | patch_fd.write("};\r\n") 36 | 37 | -------------------------------------------------------------------------------- /examples/at_sdio/include/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | -------------------------------------------------------------------------------- /third_party/include/lwip/puck_def.h: -------------------------------------------------------------------------------- 1 | /* 2 | * puck_def.h 3 | * 4 | * Created on: Jul 22, 2010 5 | * Author: dtoma 6 | */ 7 | 8 | #ifndef PUCK_DEF_H_ 9 | #define PUCK_DEF_H_ 10 | 11 | 12 | 13 | #define INSTRUMENT_PORT 8760 14 | 15 | #define INSTRUMENT_LENGTH 80 16 | 17 | #define MDNS_NAME_LENGTH 68 //68 18 | 19 | char* PUCK_SERVICE = NULL; 20 | //#define PUCK_SERVICE "_Escpressif._tcp.local" 21 | #define DNS_SD_SERVICE "_services._dns-sd._udp.local" 22 | #define SERVICE_DESCRIPTION "PUCK PROTOCOL" 23 | #define PUCK_SERVICE_LENGTH 30 24 | 25 | #define UUID_LEN 16 26 | #define DS_VERS_LEN 2 27 | #define DS_SIZE_LEN 2 28 | #define MAN_ID_LEN 4 29 | #define MAN_MODEL_LEN 2 30 | #define MAN_VERS_LEN 2 31 | #define SER_NUM_LEN 4 32 | #define NAME_LEN 64 33 | #define PUCK_DATASHEET_SIZE 96 34 | 35 | #define UUID_OFFSET 0 36 | #define DS_VERS_OFFSET UUID_LEN + UUID_OFFSET 37 | #define DS_SIZE_OFFSET DS_VERS_LEN + DS_VERS_OFFSET 38 | #define MAN_ID_OFFSET DS_SIZE_LEN + DS_SIZE_OFFSET 39 | #define MAN_MODEL_OFFSET MAN_ID_LEN + MAN_ID_OFFSET 40 | #define MAN_VERS_OFFSET MAN_MODEL_LEN + MAN_MODEL_OFFSET 41 | #define SER_NUM_OFFSET MAN_VERS_LEN + MAN_VERS_OFFSET 42 | #define NAME_OFFSET SER_NUM_LEN + SER_NUM_OFFSET 43 | 44 | #endif /* __PUCK_DEF_H__ */ 45 | -------------------------------------------------------------------------------- /examples/wps/include/user_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __USER_CONFIG_H__ 26 | #define __USER_CONFIG_H__ 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /examples/gen_patch_bin/include/user_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __USER_CONFIG_H__ 26 | #define __USER_CONFIG_H__ 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /examples/peripheral_test/include/user_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __USER_CONFIG_H__ 26 | #define __USER_CONFIG_H__ 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /examples/simple_pair/include/user_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __USER_CONFIG_H__ 26 | #define __USER_CONFIG_H__ 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /examples/smart_config/include/user_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __USER_CONFIG_H__ 26 | #define __USER_CONFIG_H__ 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /examples/wpa2_enterprise/include/user_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __USER_CONFIG_H__ 26 | #define __USER_CONFIG_H__ 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /examples/gen_patch_bin/gen_misc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "gen_misc.sh version 20150511" 4 | echo "" 5 | 6 | echo "Please follow below steps(1-5) to generate specific bin(s):" 7 | echo "STEP 1: choose boot version(0=boot_v1.1, 1=boot_v1.2+, 2=none)" 8 | 9 | boot=none 10 | 11 | echo "boot mode: $boot" 12 | echo "" 13 | 14 | echo "STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)" 15 | echo "enter (0/1/2, default 0):" 16 | app=0 17 | echo "generate bin: eagle.flash.bin+eagle.irom0text.bin" 18 | echo "" 19 | 20 | echo "STEP 3: choose spi speed(0=20MHz, 1=26.7MHz, 2=40MHz, 3=80MHz)" 21 | echo "enter (0/1/2/3, default 2):" 22 | spi_speed=40 23 | 24 | echo "spi speed: $spi_speed MHz" 25 | echo "" 26 | 27 | echo "STEP 4: choose spi mode(0=QIO, 1=QOUT, 2=DIO, 3=DOUT)" 28 | echo "enter (0/1/2/3, default 0):" 29 | spi_mode=QIO 30 | 31 | 32 | echo "spi mode: $spi_mode" 33 | echo "" 34 | 35 | echo "STEP 5: choose spi size and map" 36 | echo " 0= 512KB( 256KB+ 256KB)" 37 | echo " 2=1024KB( 512KB+ 512KB)" 38 | echo " 3=2048KB( 512KB+ 512KB)" 39 | echo " 4=4096KB( 512KB+ 512KB)" 40 | echo " 5=2048KB(1024KB+1024KB)" 41 | echo " 6=4096KB(1024KB+1024KB)" 42 | spi_size_map=0 43 | echo "spi size: 512KB" 44 | echo "spi ota map: 256KB + 256KB" 45 | 46 | echo "" 47 | echo "" 48 | echo "start..." 49 | echo "" 50 | 51 | make COMPILE=gcc BOOT=$boot APP=$app SPI_SPEED=$spi_speed SPI_MODE=$spi_mode SPI_SIZE_MAP=$spi_size_map 52 | -------------------------------------------------------------------------------- /examples/wpa2_enterprise/include/wpa2_pki/certs/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIID3DCCA0WgAwIBAgIJAMnlgL1czsmjMA0GCSqGSIb3DQEBCwUAMIGTMQswCQYD 3 | VQQGEwJGUjEPMA0GA1UECAwGUmFkaXVzMRIwEAYDVQQHDAlTb21ld2hlcmUxFTAT 4 | BgNVBAoMDEV4YW1wbGUgSW5jLjEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBs 5 | ZS5jb20xJjAkBgNVBAMMHUV4YW1wbGUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4X 6 | DTE3MDYwNzA4MDY0OVoXDTI3MDYwNTA4MDY0OVowgZMxCzAJBgNVBAYTAkZSMQ8w 7 | DQYDVQQIDAZSYWRpdXMxEjAQBgNVBAcMCVNvbWV3aGVyZTEVMBMGA1UECgwMRXhh 8 | bXBsZSBJbmMuMSAwHgYJKoZIhvcNAQkBFhFhZG1pbkBleGFtcGxlLmNvbTEmMCQG 9 | A1UEAwwdRXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwgZ8wDQYJKoZIhvcN 10 | AQEBBQADgY0AMIGJAoGBALpWR23fn/TmHxsXsHdrydzPSd17fZkc71WsaicgQR66 11 | 1tIVYb22UWGfj9KPM8THMsV74ew4ZkaQ39qvU0iuQIRrKARFHFok+vbaecgWMeWe 12 | vGIqdnmyB9gJYaFOKgtSkfXsu2ddsqdvLYwcDbczrq8X9yEXpN6mnxXeCcPG4F0p 13 | AgMBAAGjggE0MIIBMDAdBgNVHQ4EFgQUgigpdAUpONoDq0pQ3yfxrslCSpcwgcgG 14 | A1UdIwSBwDCBvYAUgigpdAUpONoDq0pQ3yfxrslCSpehgZmkgZYwgZMxCzAJBgNV 15 | BAYTAkZSMQ8wDQYDVQQIDAZSYWRpdXMxEjAQBgNVBAcMCVNvbWV3aGVyZTEVMBMG 16 | A1UECgwMRXhhbXBsZSBJbmMuMSAwHgYJKoZIhvcNAQkBFhFhZG1pbkBleGFtcGxl 17 | LmNvbTEmMCQGA1UEAwwdRXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCCQDJ 18 | 5YC9XM7JozAMBgNVHRMEBTADAQH/MDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly93 19 | d3cuZXhhbXBsZS5jb20vZXhhbXBsZV9jYS5jcmwwDQYJKoZIhvcNAQELBQADgYEA 20 | euxOBPInSJRKAIseMxPmAabtAqKNslZSmpG4He3lkKt+HM3jfznUt3psmD7j1hFW 21 | S4l7KXzzajvaGYybDq5N9MqrDjhGn3VXZqOLMUNDL7OQq96TzgqsTBT1dmVSbNlt 22 | PQgiAeKAk3tmH4lRRi9MTBSyJ6I92JYcS5H6Bs4ZwCc= 23 | -----END CERTIFICATE----- 24 | -------------------------------------------------------------------------------- /third_party/include/lwip/app/espconn_buf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ringbuf.h 3 | * 4 | * Created on: Apr 22, 2016 5 | * Author: liuhan 6 | */ 7 | 8 | #ifndef _ESPCONN_BUF_H_ 9 | #define _ESPCONN_BUF_H_ 10 | 11 | /* 12 | * ringbuffer.c 13 | * 14 | * Created on: Apr 22, 2016 15 | * Author: liuhan 16 | */ 17 | #include "c_types.h" 18 | 19 | #include "ets_sys.h" 20 | #include "os_type.h" 21 | 22 | typedef struct ringbuf_t { 23 | uint8_t *buf; 24 | uint8_t *head, *tail; 25 | size_t size; 26 | } ringbuf, *ringbuf_t; 27 | 28 | ringbuf_t ringbuf_new(size_t capacity); 29 | 30 | size_t ringbuf_buffer_size(const struct ringbuf_t *rb); 31 | 32 | void ringbuf_reset(ringbuf_t rb); 33 | 34 | void ringbuf_free(ringbuf_t *rb); 35 | 36 | size_t ringbuf_capacity(const struct ringbuf_t *rb); 37 | 38 | size_t ringbuf_bytes_free(const struct ringbuf_t *rb); 39 | 40 | size_t ringbuf_bytes_used(const struct ringbuf_t *rb); 41 | 42 | int ringbuf_is_full(const struct ringbuf_t *rb); 43 | 44 | int ringbuf_is_empty(const struct ringbuf_t *rb); 45 | 46 | const void* ringbuf_tail(const struct ringbuf_t *rb); 47 | 48 | const void* ringbuf_head(const struct ringbuf_t *rb); 49 | 50 | static uint8_t *ringbuf_nextp(ringbuf_t rb, const uint8_t *p); 51 | 52 | size_t ringbuf_findchr(const struct ringbuf_t *rb, int c, size_t offset); 53 | 54 | size_t ringbuf_memset(ringbuf_t dst, int c, size_t len); 55 | 56 | void *ringbuf_memcpy_into(ringbuf_t dst, const void *src, size_t count); 57 | 58 | void *ringbuf_memcpy_from(void *dst, ringbuf_t src, size_t count); 59 | 60 | #endif /* RINGBUF_H_ */ 61 | -------------------------------------------------------------------------------- /driver_lib/include/driver/gpio16.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __GPIO16_H__ 26 | #define __GPIO16_H__ 27 | #include "ets_sys.h" 28 | void gpio16_output_conf(void); 29 | void gpio16_output_set(uint8_t value); 30 | void gpio16_input_conf(void); 31 | uint8_t gpio16_input_get(void); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /third_party/mbedtls/library/version.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Version information 3 | * 4 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 5 | * SPDX-License-Identifier: Apache-2.0 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 8 | * not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * This file is part of mbed TLS (https://tls.mbed.org) 20 | */ 21 | 22 | #if !defined(MBEDTLS_CONFIG_FILE) 23 | #include "mbedtls/config.h" 24 | #else 25 | #include MBEDTLS_CONFIG_FILE 26 | #endif 27 | 28 | #if defined(MBEDTLS_VERSION_C) 29 | 30 | #include "mbedtls/version.h" 31 | #include 32 | 33 | unsigned int mbedtls_version_get_number() 34 | { 35 | return( MBEDTLS_VERSION_NUMBER ); 36 | } 37 | 38 | void mbedtls_version_get_string( char *string ) 39 | { 40 | memcpy( string, MBEDTLS_VERSION_STRING, 41 | sizeof( MBEDTLS_VERSION_STRING ) ); 42 | } 43 | 44 | void mbedtls_version_get_string_full( char *string ) 45 | { 46 | memcpy( string, MBEDTLS_VERSION_STRING_FULL, 47 | sizeof( MBEDTLS_VERSION_STRING_FULL ) ); 48 | } 49 | 50 | #endif /* MBEDTLS_VERSION_C */ 51 | -------------------------------------------------------------------------------- /driver_lib/driver/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libdriver.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | PDIR := ../$(PDIR) 43 | sinclude $(PDIR)Makefile 44 | 45 | -------------------------------------------------------------------------------- /include/os_type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef _OS_TYPES_H_ 26 | #define _OS_TYPES_H_ 27 | 28 | #include "ets_sys.h" 29 | 30 | #define os_signal_t ETSSignal 31 | #define os_param_t ETSParam 32 | #define os_event_t ETSEvent 33 | #define os_task_t ETSTask 34 | #define os_timer_t ETSTimer 35 | #define os_timer_func_t ETSTimerFunc 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /examples/at_sdio/driver/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libdriver.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | PDIR := ../$(PDIR) 43 | sinclude $(PDIR)Makefile 44 | 45 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libmqtt.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | PDIR := ../$(PDIR) 43 | sinclude $(PDIR)Makefile 44 | 45 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/user/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | PDIR := ../$(PDIR) 43 | sinclude $(PDIR)Makefile 44 | 45 | -------------------------------------------------------------------------------- /examples/wps/driver/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser_driver.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | PDIR := ../$(PDIR) 43 | sinclude $(PDIR)Makefile 44 | 45 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/modules/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libmodules.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | PDIR := ../$(PDIR) 43 | sinclude $(PDIR)Makefile 44 | 45 | -------------------------------------------------------------------------------- /third_party/mbedtls/app/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = libapp.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /third_party/mbedtls/library/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = liblibrary.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /third_party/mbedtls/platform/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = libplatform.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /examples/at/user/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | INCLUDES += -I ../../include/ets 43 | PDIR := ../$(PDIR) 44 | sinclude $(PDIR)Makefile 45 | 46 | -------------------------------------------------------------------------------- /examples/at_nano/user/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | INCLUDES += -I ../../include/ets 43 | PDIR := ../$(PDIR) 44 | sinclude $(PDIR)Makefile 45 | 46 | -------------------------------------------------------------------------------- /examples/at_sdio/user/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | INCLUDES += -I ../../include/ets 43 | PDIR := ../$(PDIR) 44 | sinclude $(PDIR)Makefile 45 | 46 | -------------------------------------------------------------------------------- /examples/wps/user/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | INCLUDES += -I ../../include/ets 43 | PDIR := ../$(PDIR) 44 | sinclude $(PDIR)Makefile 45 | 46 | -------------------------------------------------------------------------------- /examples/at_espconn/user/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | INCLUDES += -I ../../include/ets 43 | PDIR := ../$(PDIR) 44 | sinclude $(PDIR)Makefile 45 | 46 | -------------------------------------------------------------------------------- /examples/simple_pair/user/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | INCLUDES += -I ../../include/ets 43 | PDIR := ../$(PDIR) 44 | sinclude $(PDIR)Makefile 45 | 46 | -------------------------------------------------------------------------------- /examples/smart_config/user/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | INCLUDES += -I ../../include/ets 43 | PDIR := ../$(PDIR) 44 | sinclude $(PDIR)Makefile 45 | 46 | -------------------------------------------------------------------------------- /examples/peripheral_test/user/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | INCLUDES += -I ../../include/ets 43 | PDIR := ../$(PDIR) 44 | sinclude $(PDIR)Makefile 45 | 46 | -------------------------------------------------------------------------------- /examples/wpa2_enterprise/user/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | INCLUDES += -I ../../include/ets 43 | PDIR := ../$(PDIR) 44 | sinclude $(PDIR)Makefile 45 | 46 | -------------------------------------------------------------------------------- /third_party/lwip/api/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = liblwipapi.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /third_party/lwip/app/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = liblwipapp.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /third_party/lwip/core/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = liblwipcore.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /third_party/lwip/core/ipv4/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = liblwipipv4.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /third_party/lwip/netif/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | 16 | GEN_LIBS = liblwipnetif.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | 30 | ############################################################# 31 | # Recursion Magic - Don't touch this!! 32 | # 33 | # Each subtree potentially has an include directory 34 | # corresponding to the common APIs applicable to modules 35 | # rooted at that subtree. Accordingly, the INCLUDE PATH 36 | # of a module can only contain the include directories up 37 | # its parent path, and not its siblings 38 | # 39 | # Required for each makefile to inherit from the parent 40 | # 41 | 42 | INCLUDES := $(INCLUDES) -I $(PDIR)include 43 | INCLUDES += -I ./ 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /third_party/json/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | UP_EXTRACT_DIR = .. 16 | GEN_LIBS = libjson.a 17 | 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | #DEFINES += 29 | CCFLAGS += -DJSON_FORMAT 30 | 31 | ############################################################# 32 | # Recursion Magic - Don't touch this!! 33 | # 34 | # Each subtree potentially has an include directory 35 | # corresponding to the common APIs applicable to modules 36 | # rooted at that subtree. Accordingly, the INCLUDE PATH 37 | # of a module can only contain the include directories up 38 | # its parent path, and not its siblings 39 | # 40 | # Required for each makefile to inherit from the parent 41 | # 42 | 43 | INCLUDES := $(INCLUDES) -I $(PDIR)include 44 | INCLUDES += -I ./ 45 | PDIR := ../$(PDIR) 46 | sinclude $(PDIR)Makefile 47 | 48 | -------------------------------------------------------------------------------- /examples/gen_patch_bin/user/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | GEN_LIBS = libuser.a 16 | endif 17 | 18 | 19 | ############################################################# 20 | # Configuration i.e. compile options etc. 21 | # Target specific stuff (defines etc.) goes in here! 22 | # Generally values applying to a tree are captured in the 23 | # makefile at its root level - these are then overridden 24 | # for a subtree within the makefile rooted therein 25 | # 26 | #DEFINES += 27 | 28 | ############################################################# 29 | # Recursion Magic - Don't touch this!! 30 | # 31 | # Each subtree potentially has an include directory 32 | # corresponding to the common APIs applicable to modules 33 | # rooted at that subtree. Accordingly, the INCLUDE PATH 34 | # of a module can only contain the include directories up 35 | # its parent path, and not its siblings 36 | # 37 | # Required for each makefile to inherit from the parent 38 | # 39 | 40 | INCLUDES := $(INCLUDES) -I $(PDIR)include 41 | INCLUDES += -I ./ 42 | INCLUDES += -I ../../rom/include 43 | INCLUDES += -I ../../include/ets 44 | PDIR := ../$(PDIR) 45 | sinclude $(PDIR)Makefile 46 | 47 | -------------------------------------------------------------------------------- /third_party/include/lwip/sntp.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_SNTP_H 2 | #define LWIP_SNTP_H 3 | 4 | #include "lwip/opt.h" 5 | #include "lwip/ip_addr.h" 6 | 7 | #include 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /** The maximum number of SNTP servers that can be set */ 14 | #ifndef SNTP_MAX_SERVERS 15 | #define SNTP_MAX_SERVERS 3 16 | #endif 17 | 18 | /** Set this to 1 to implement the callback function called by dhcp when 19 | * NTP servers are received. */ 20 | #ifndef SNTP_GET_SERVERS_FROM_DHCP 21 | #define SNTP_GET_SERVERS_FROM_DHCP 0//LWIP_DHCP_GET_NTP_SRV 22 | #endif 23 | 24 | /* Set this to 1 to support DNS names (or IP address strings) to set sntp servers */ 25 | #ifndef SNTP_SERVER_DNS 26 | #define SNTP_SERVER_DNS 1 27 | #endif 28 | 29 | bool sntp_get_timetype(void); 30 | void sntp_set_receive_time_size(void); 31 | /** One server address/name can be defined as default if SNTP_SERVER_DNS == 1: 32 | * #define SNTP_SERVER_ADDRESS "pool.ntp.org" 33 | */ 34 | uint64 sntp_get_current_timestamp(); 35 | char* sntp_get_real_time(long t); 36 | 37 | void sntp_init(void); 38 | void sntp_stop(void); 39 | 40 | sint8 sntp_get_timezone(void); 41 | bool sntp_set_timezone(sint8 timezone); 42 | void sntp_setserver(u8_t idx, ip_addr_t *addr); 43 | ip_addr_t sntp_getserver(u8_t idx); 44 | 45 | #if SNTP_SERVER_DNS 46 | void sntp_setservername(u8_t idx, char *server); 47 | char *sntp_getservername(u8_t idx); 48 | #endif /* SNTP_SERVER_DNS */ 49 | 50 | #if SNTP_GET_SERVERS_FROM_DHCP 51 | void sntp_servermode_dhcp(int set_servers_from_dhcp); 52 | #else /* SNTP_GET_SERVERS_FROM_DHCP */ 53 | #define sntp_servermode_dhcp(x) 54 | #endif /* SNTP_GET_SERVERS_FROM_DHCP */ 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif /* LWIP_SNTP_H */ 61 | -------------------------------------------------------------------------------- /examples/at_sdio/include/user_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __USER_CONFIG_H__ 26 | #define __USER_CONFIG_H__ 27 | 28 | #define AT_CUSTOM_UPGRADE 29 | 30 | #ifdef AT_CUSTOM_UPGRADE 31 | #ifndef AT_UPGRADE_SUPPORT 32 | #error "upgrade is not supported when eagle.flash.bin+eagle.irom0text.bin!!!" 33 | #endif 34 | #endif 35 | 36 | #define CONFIG_AT_SMARTCONFIG_COMMAND_ENABLE 37 | // #define CONFIG_AT_WPA2_ENTERPRISE_COMMAND_ENABLE 38 | #define CONFIG_ENABLE_IRAM_MEMORY 1 39 | #endif 40 | -------------------------------------------------------------------------------- /examples/at_espconn/include/user_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __USER_CONFIG_H__ 26 | #define __USER_CONFIG_H__ 27 | 28 | #define AT_CUSTOM_UPGRADE 29 | 30 | #ifdef AT_CUSTOM_UPGRADE 31 | #ifndef AT_UPGRADE_SUPPORT 32 | #error "upgrade is not supported when eagle.flash.bin+eagle.irom0text.bin!!!" 33 | #endif 34 | #endif 35 | 36 | #define CONFIG_AT_SMARTCONFIG_COMMAND_ENABLE 37 | // #define CONFIG_AT_WPA2_ENTERPRISE_COMMAND_ENABLE 38 | #define CONFIG_ENABLE_IRAM_MEMORY 1 39 | #endif 40 | -------------------------------------------------------------------------------- /examples/wpa2_enterprise/include/wpa2_pki/certs/client.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEA0va+cqWrLlYM3fI7LHzgXQVArwyM84IM0Bg0tON9X40KPqp5 3 | AvmWrRAA7FHp3D/76rBX60jHyu/oBavuP2a6XJ5/QIWfJaDg43zPtuYx9f0kA8j0 4 | +9ik85IpBapVQ4D3PhMQQzqJJL7YAYbRaXNEffi5RitrUdARMUsGrp9F+hIXDO9q 5 | +tD3NkbrLttOIEYBM6yx90rmGD1TItzoShJ4ES/kO5K91wdayYFdSFjID5vppA+7 6 | ibGtOAdvk9CmElb5B0jSIy+jqZOwEQonTEgKjXBBaHZ63bxUw0IzsHv2rh/nlV4R 7 | yvK0S1y6R2Tw89eHlX+TBqFyyYESpbePnX7R7wIDAQABAoIBAQC5PncO3tBIeMEF 8 | pu007FZq9/DLhP7D2B9+HrMxX0y4uXUUf8aQyS74ukPFP0xV3U1M0BnzfU4KscyQ 9 | Jl+nBoKAT6C3vF15wiGXQAJ4vPuD4Ate03fjKWH2ixJAakhCZR01QbIXBnBkdrvf 10 | 401BBjlPUDcIGZo8FbLzEMlGTo84vE9v3Qmkbi+PzPCh2YC+NDmsOcIW1zpmwyYC 11 | ZYCpoWgl4++kqXXn0NGhuaOgB0JLsJOBpx/hOOjBU/wXCKaXZ1vchYqfbvvx2gf2 12 | WX4P0CiTH1z7MEAHanaZkcnNyxV/oF1EIMY5p0vDDzgrKtppvPOqspjydje03+CE 13 | t0wKGPi5AoGBAPAG2Y4efgwLcoWdPjKZtsHLhDhLJnvxkqnNkzdPnLZojNi8pKkV 14 | /Yu++pPemJZZa4YAp+OnqyEfhcha+HYqKMwRC8t3YrEVOlRQTfW/OoSrp059JIRV 15 | jTvq/u7DdYGJRRgMLUJiEI+7xj1WbTc2EceJAgn0qfKvbvBtVJP0LH1TAoGBAOEA 16 | xZB7SwyX+zDGRTugqMYg+sYobbQHJ7utLyoX+ckeG+sPEjEYLpQQfshET/gwF8ZK 17 | 4aILkACx/tna799xCjQdmyyc338NO9WULlY1xF+65WfeaxrtTAsqVikX3p19McRI 18 | ijX8k7Msy3gYWJXev3MCtPT2+g68IgbL/W2wY+l1AoGAT7xGy0Jv5vpqid5pig+s 19 | OYatHrJAT445hXUIQaiNy77Bg0JvhMgMWT8RKMwabl+4K2TOYP8TB0bcf2lQ/pgU 20 | w22qOGYpf+AoZ1fh/hAPlYEcbCOAXQG6kDwJgjGmOGjsbgelhVbkX4smWLv8PgoV 21 | L+7goYQIbNlAhlgbb6b+nIcCgYBB7Zr2Cdpkt0en9ACnRx0M6O7yDziNzqbqzAUM 22 | 3XeYYZUmnATlk8NaKTcs8S9JdrYQqTJR6/dm7MDTDt7IZvPpb19fhBvMu5DztPaa 23 | 1ihTMI01kStq+WsVvnL+mXrmRJ/HdsXgqcCReKep6eBTEbChP4LMYG3G0YNa4HzC 24 | njO4XQKBgQDRnbqqg2CNTnS94BN2D3uzzELtwsIG6aVCtl09ZsLnGaBKVVDtP6BI 25 | j2hGD7xw4g5JeSPIJU5J03nALTY3hz1JyI7AJCX7+JRtUTX2A8C4mlbeul7ilGaU 26 | A7MFT8GqhjYYa84GzNcA1mK8ynlixpL8+yzTT/8lWInWRBa69SkktA== 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /examples/wpa2_enterprise/include/wpa2_pki/certs/server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEAydji4HWRg4fYyIDGIE3pFCQwmDNT+lYO7JpDf4epIpQmBses 3 | tdnsVQaBtw3JJFFJ+kf7S0787XWK4SgyvMXgTEXEWGAVZx5rQBk/8KuSYZItcRAu 4 | 8uu8gS9aO3TKX/3g7tHZB2psIMAHiLSLD60eyU98EZg3iRXeJLERGnyXSs/zyMt5 5 | npzDcdqmlJf1lf1hBkTiPxJDCx0zSJHSzk+Xoe1qMMddmLVuCrdP2QPsgHYJsECh 6 | oa+rKlnED1YivL4UvhjfEH1dIr/lBHd6dWs+620goadg1PGHnZ9gudPbLCX0kUrx 7 | 0kDloRCIoEFamEDKFdfj5j7AatVGsrSQtK474wIDAQABAoIBAQC2kGDEPBJdMSW2 8 | VCLfXRiPixwYzXQLXIMrJWwfkQg9qlmqkDd6U50aWkRA2UswegW7RhfYSZ0i+cmf 9 | VMhvTVpOIlwwwtcY6b5/v1bBy60eaySGuuh79xQMlFO8qynQIMStvUfbGTqrdIRb 10 | 9VBB4YeS9T12fILejtTZwv2BQ2dj1Y1SCay6Ri85UzJqSClRKgHISybvVdLNjPvP 11 | 0TRFBr57zyjL6WE8teKiKchzQko2u86No5uBCdKGsrAkrsdcR0YqlM/pZxd3VKNm 12 | +eny0k+dZZlvcPxzkzP4hEp9+Rw5rP9/s3s/cCwvuuC5JO32ATBWKCbTvPv/XPDb 13 | MdSJtOshAoGBAPzk0eswkcbFYtpnpBNmBAr1dtAdW1lfjUI2ucMMwt7Wns0P/tt+ 14 | gq6Hi1wTaGP0l/dIECgeHwjtWj31ZJjQtFJ1y/kafxo4o9cA8vCydpdvSZaldAfg 15 | sbLlDTDYzEpelaDIbNQBBXFoC5U9JlBhBsIFCL5Z8ZuIeFPsb7t5wwuHAoGBAMxT 16 | jyWfNm1uNxp1xgCnrRsLPQPVnURrSFAqcHrECqRu3F7sozTN7q/cZViemxPvVDGQ 17 | p9c+9bHwaYvW4trO5qDHJ++gGwm5L52bMAY1VUfeTt67fqrey43XpdmzcTX1V9Uj 18 | QWawPUCSDzFjL1MjfCIejtyYf5ash53vj+T8r/vFAoGAA/OPVB1uKazr3n3AEo2F 19 | gqZTNO1AgCT+EArK3EFWyiSQVqPpV4SihheYFdg3yVgJB9QYbIgL9BfBUTaEW97m 20 | 8mLkzP+c/Mvlw3ZAVYJ0V+llPPVY2saoACOUES9SAdd4fwqiqK1baGo3xB0wfBEI 21 | CgAKIu9E1ylKuAT5ufQtGAECgYEAtP/kU5h5N3El4QupTdU7VDSdZTMqsHw0v8cI 22 | gsf9AXKvRmtrnBA8u46KPHmruHoO5CVXeSZtsaXdaaH+rYQQ6yXg67WxnehtFLlv 23 | TmCaXiLBTS9cYvMf8FOyuGnsBLeEietEOTov2G5KhR5uwsAxa2wUc7endor5S9/2 24 | YQuyvV0CgYALbiFpILd5l1ip65eE6JdA3hfttUbV2j2NSW12ej69vqbeOfaSgNse 25 | uYCcXFsBbQPhNPwA+4d1oCe8SyXZg1f7gE812z2Tyr/3vdVnNZlitoxhsHmGiyS7 26 | gZdaTYCb78l9z0EBdaCVvA16owEle4SR6f9eCwzSI0WPOUra+x/hrA== 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /examples/at/include/user_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #pragma once 26 | 27 | // #define AT_ESP_UPGRADE 28 | 29 | #ifndef AT_ESP_UPGRADE 30 | #define AT_CUSTOM_UPGRADE 31 | #endif 32 | 33 | #ifdef AT_CUSTOM_UPGRADE 34 | #ifndef AT_UPGRADE_SUPPORT 35 | #error "upgrade is not supported when eagle.flash.bin+eagle.irom0text.bin!!!" 36 | #endif 37 | #endif 38 | 39 | #define CONFIG_AT_SMARTCONFIG_COMMAND_ENABLE 40 | // #define CONFIG_AT_WPA2_ENTERPRISE_COMMAND_ENABLE 41 | 42 | #define CONFIG_ENABLE_IRAM_MEMORY 1 43 | 44 | #define ESP_AT_FW_VERSION "Bin version(Wroom 02):1.7.6" 45 | -------------------------------------------------------------------------------- /driver_lib/include/driver/sdio_slv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __SDIO_SLAVE_H__ 26 | #define __SDIO_SLAVE_H__ 27 | #include "ets_sys.h" 28 | #include "c_types.h" 29 | 30 | #include "user_interface.h" 31 | 32 | #define RX_AVAILIBLE 2 33 | #define TX_AVAILIBLE 1 34 | #define INIT_STAGE 0 35 | 36 | void sdio_slave_init(void); 37 | 38 | int32_t sdio_load_data(const uint8_t *data, uint32_t len); 39 | typedef void (*sdio_recv_data_callback_t)(uint8_t *data, uint32_t len); 40 | 41 | bool sdio_register_recv_cb(sdio_recv_data_callback_t cb); 42 | #endif 43 | -------------------------------------------------------------------------------- /examples/at_nano/include/user_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #pragma once 26 | 27 | // #define AT_ESP_UPGRADE 28 | 29 | #ifndef AT_ESP_UPGRADE 30 | #define AT_CUSTOM_UPGRADE 31 | #endif 32 | 33 | #ifdef AT_CUSTOM_UPGRADE 34 | #ifndef AT_UPGRADE_SUPPORT 35 | #error "upgrade is not supported when eagle.flash.bin+eagle.irom0text.bin!!!" 36 | #endif 37 | #endif 38 | 39 | #define CONFIG_AT_SMARTCONFIG_COMMAND_ENABLE 40 | // #define CONFIG_AT_WPA2_ENTERPRISE_COMMAND_ENABLE 41 | 42 | #define CONFIG_ENABLE_IRAM_MEMORY 1 43 | 44 | #define ESP_AT_FW_VERSION "Bin version(Wroom 02):1.7.6" 45 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/mqtt/ringbuf.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * Ring Buffer library 4 | */ 5 | 6 | #include "ringbuf.h" 7 | 8 | 9 | /** 10 | * \brief init a RINGBUF object 11 | * \param r pointer to a RINGBUF object 12 | * \param buf pointer to a byte array 13 | * \param size size of buf 14 | * \return 0 if successfull, otherwise failed 15 | */ 16 | I16 ICACHE_FLASH_ATTR RINGBUF_Init(RINGBUF *r, U8* buf, I32 size) 17 | { 18 | if(r == NULL || buf == NULL || size < 2) return -1; 19 | 20 | r->p_o = r->p_r = r->p_w = buf; 21 | r->fill_cnt = 0; 22 | r->size = size; 23 | 24 | return 0; 25 | } 26 | /** 27 | * \brief put a character into ring buffer 28 | * \param r pointer to a ringbuf object 29 | * \param c character to be put 30 | * \return 0 if successfull, otherwise failed 31 | */ 32 | I16 ICACHE_FLASH_ATTR RINGBUF_Put(RINGBUF *r, U8 c) 33 | { 34 | if(r->fill_cnt>=r->size)return -1; // ring buffer is full, this should be atomic operation 35 | 36 | 37 | r->fill_cnt++; // increase filled slots count, this should be atomic operation 38 | 39 | 40 | *r->p_w++ = c; // put character into buffer 41 | 42 | if(r->p_w >= r->p_o + r->size) // rollback if write pointer go pass 43 | r->p_w = r->p_o; // the physical boundary 44 | 45 | return 0; 46 | } 47 | /** 48 | * \brief get a character from ring buffer 49 | * \param r pointer to a ringbuf object 50 | * \param c read character 51 | * \return 0 if successfull, otherwise failed 52 | */ 53 | I16 ICACHE_FLASH_ATTR RINGBUF_Get(RINGBUF *r, U8* c) 54 | { 55 | if(r->fill_cnt<=0)return -1; // ring buffer is empty, this should be atomic operation 56 | 57 | 58 | r->fill_cnt--; // decrease filled slots count 59 | 60 | 61 | *c = *r->p_r++; // get the character out 62 | 63 | if(r->p_r >= r->p_o + r->size) // rollback if write pointer go pass 64 | r->p_r = r->p_o; // the physical boundary 65 | 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /examples/at_sdio/include/driver/sdio_slv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __SDIO_SLAVE_H__ 26 | #define __SDIO_SLAVE_H__ 27 | #include "slc_register.h" 28 | #include "c_types.h" 29 | #include "user_interface.h" 30 | 31 | //#define SDIO_DEBUG 32 | 33 | #define RX_AVAILIBLE 2 34 | #define TX_AVAILIBLE 1 35 | #define INIT_STAGE 0 36 | 37 | void sdio_slave_init(void); 38 | 39 | int32 sdio_load_data(const uint8* data,uint32 len); 40 | typedef uint32 (*sdio_recv_data_callback_t)(uint8* data,uint32 len); 41 | 42 | bool sdio_register_recv_cb(sdio_recv_data_callback_t cb); 43 | #endif 44 | -------------------------------------------------------------------------------- /third_party/lwip/core/ipv4/inet.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Functions common to all TCP/IPv4 modules, such as the byte order functions. 4 | * 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Adam Dunkels 36 | * 37 | */ 38 | 39 | #include "lwip/opt.h" 40 | 41 | #include "lwip/inet.h" 42 | 43 | -------------------------------------------------------------------------------- /third_party/lwip/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | UP_EXTRACT_DIR = .. 16 | GEN_LIBS = liblwip.a 17 | COMPONENTS_liblwip = api/liblwipapi.a \ 18 | app/liblwipapp.a \ 19 | core/liblwipcore.a \ 20 | core/ipv4/liblwipipv4.a \ 21 | netif/liblwipnetif.a 22 | endif 23 | 24 | 25 | ############################################################# 26 | # Configuration i.e. compile options etc. 27 | # Target specific stuff (defines etc.) goes in here! 28 | # Generally values applying to a tree are captured in the 29 | # makefile at its root level - these are then overridden 30 | # for a subtree within the makefile rooted therein 31 | # 32 | #DEFINES += 33 | CCFLAGS += -DPBUF_RSV_FOR_WLAN -DEBUF_LWIP 34 | 35 | ############################################################# 36 | # Recursion Magic - Don't touch this!! 37 | # 38 | # Each subtree potentially has an include directory 39 | # corresponding to the common APIs applicable to modules 40 | # rooted at that subtree. Accordingly, the INCLUDE PATH 41 | # of a module can only contain the include directories up 42 | # its parent path, and not its siblings 43 | # 44 | # Required for each makefile to inherit from the parent 45 | # 46 | 47 | INCLUDES := $(INCLUDES) -I $(PDIR)include 48 | INCLUDES += -I ./ 49 | PDIR := ../$(PDIR) 50 | sinclude $(PDIR)Makefile 51 | 52 | -------------------------------------------------------------------------------- /third_party/mbedtls/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ############################################################# 3 | # Required variables for each makefile 4 | # Discard this section from all parent makefiles 5 | # Expected variables (with automatic defaults): 6 | # CSRCS (all "C" files in the dir) 7 | # SUBDIRS (all subdirs with a Makefile) 8 | # GEN_LIBS - list of libs to be generated () 9 | # GEN_IMAGES - list of images to be generated () 10 | # COMPONENTS_xxx - a list of libs/objs in the form 11 | # subdir/lib to be extracted and rolled up into 12 | # a generated lib/image xxx.a () 13 | # 14 | ifndef PDIR 15 | UP_EXTRACT_DIR = .. 16 | GEN_LIBS = libmbedtls.a 17 | COMPONENTS_libmbedtls = library/liblibrary.a platform/libplatform.a app/libapp.a 18 | endif 19 | 20 | 21 | ############################################################# 22 | # Configuration i.e. compile options etc. 23 | # Target specific stuff (defines etc.) goes in here! 24 | # Generally values applying to a tree are captured in the 25 | # makefile at its root level - these are then overridden 26 | # for a subtree within the makefile rooted therein 27 | # 28 | DEFINES += -DMBEDTLS_CONFIG_FILE='"config_esp.h"' 29 | #CCFLAGS += --rename-section .text=.irom0.text --rename-section .literal=.irom0.literal 30 | 31 | ############################################################# 32 | # Recursion Magic - Don't touch this!! 33 | # 34 | # Each subtree potentially has an include directory 35 | # corresponding to the common APIs applicable to modules 36 | # rooted at that subtree. Accordingly, the INCLUDE PATH 37 | # of a module can only contain the include directories up 38 | # its parent path, and not its siblings 39 | # 40 | # Required for each makefile to inherit from the parent 41 | # 42 | 43 | INCLUDES := $(INCLUDES) -I $(PDIR)include 44 | INCLUDES += -I ../$(PDIR)include/lwip/posix 45 | INCLUDES += -I ../$(PDIR)include/mbedtls 46 | INCLUDES += -I ./ 47 | PDIR := ../$(PDIR) 48 | sinclude $(PDIR)Makefile 49 | 50 | -------------------------------------------------------------------------------- /third_party/include/lwip/app/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * time.h 3 | * 4 | * Created on: May 31, 2016 5 | * Author: liuhan 6 | */ 7 | 8 | #ifndef TIME_H_ 9 | #define TIME_H_ 10 | #include "osapi.h" 11 | #include "os_type.h" 12 | #include "lwip/sntp.h" 13 | #include 14 | 15 | /***************************RTC TIME OPTION***************************************/ 16 | // daylight settings 17 | // Base calculated with value obtained from NTP server (64 bits) 18 | #define sntp_base (*((uint64_t*)RTC_STORE0)) 19 | // Timer value when base was obtained 20 | #define TIM_REF_SET(value) WRITE_PERI_REG(RTC_STORE2, value) 21 | #define TIM_REF_GET() READ_PERI_REG(RTC_STORE2) 22 | 23 | // Setters and getters for CAL, TZ and DST. 24 | #define RTC_CAL_SET(val) do {uint32 value = READ_PERI_REG(RTC_STORE3);\ 25 | value |= ((val) & 0x0000FFFF);\ 26 | WRITE_PERI_REG(RTC_STORE3, value);\ 27 | }while(0) 28 | #define RTC_DST_SET(val) do {uint32 value = READ_PERI_REG(RTC_STORE3);\ 29 | value |= (((val)<<16) & 0x00010000);\ 30 | WRITE_PERI_REG(RTC_STORE3, value);\ 31 | }while(0) 32 | #define RTC_TZ_SET(val) do {uint32 value = READ_PERI_REG(RTC_STORE3);\ 33 | value |= (((val)<<24) & 0xFF000000);\ 34 | WRITE_PERI_REG(RTC_STORE3, value);\ 35 | }while(0) 36 | 37 | #define RTC_CAL_GET() (READ_PERI_REG(RTC_STORE3) & 0x0000FFFF) 38 | #define RTC_DST_GET() ((READ_PERI_REG(RTC_STORE3) & 0x00010000)>>16) 39 | #define RTC_TZ_GET() ((((int)READ_PERI_REG(RTC_STORE3)) & ((int)0xFF000000))>>24) 40 | void system_update_rtc(time_t t, uint32_t us); 41 | time_t sntp_get_rtc_time(sint32_t *us); 42 | int sntp_update_rtc(time_t sec, u32_t us); 43 | 44 | int gettimeofday(struct timeval* t, void* timezone); 45 | void updateTime(uint32 ms); 46 | bool configTime(int timezone, int daylightOffset, char *server1, char *server2, char *server3, bool enable); 47 | time_t time(time_t *t); 48 | unsigned long millis(void); 49 | unsigned long micros(void); 50 | #endif /* TIME_H_ */ 51 | -------------------------------------------------------------------------------- /driver_lib/driver/system_patch_apply.c: -------------------------------------------------------------------------------- 1 | #include "osapi.h" 2 | #include "patch_array.h" 3 | #include "mem.h" 4 | #include "eagle_soc.h" 5 | 6 | #if 0 7 | typedef int (*__ets_printf_t)(const char *fmt, ...); 8 | #define ROM_PRINTF(_fmt, ...) ((__ets_printf_t)(0x400024cc))(_fmt, ##__VA_ARGS__) 9 | #else 10 | #define ROM_PRINTF(_fmt, ...) ets_printf(_fmt, ##__VA_ARGS__) 11 | #endif 12 | 13 | extern void call_user_start(void); 14 | extern char _heap_start; 15 | 16 | int patch_apply(void) 17 | { 18 | uint32_t flash_id; 19 | int ret = __INT_MAX__; 20 | 21 | WRITE_PERI_REG(0x60000240, 0); 22 | WRITE_PERI_REG(0x60000200, 0x01 << 28); 23 | while(READ_PERI_REG(0x60000200) != 0); 24 | flash_id = READ_PERI_REG(0x60000240) & 0xffffff; 25 | ROM_PRINTF("flash_id=0x%x\r\n", flash_id); 26 | if (flash_id == 0x1560eb) { 27 | ROM_PRINTF("apply...\r\n"); 28 | uint32 len = 0; 29 | uint8* data = patch_data + 8; 30 | uint32* addr = 0; 31 | uint8 loop = 0; 32 | 33 | ROM_PRINTF("data %p %d...\r\n", data, patch_data[1]); 34 | for (loop = 0; loop < patch_data[1] && (data - patch_data < sizeof(patch_data) - 8); loop++) { 35 | addr = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3]<<24); 36 | len = data[4] | (data[5] << 8) | (data[6] << 16) | (data[7]<<24); 37 | data += 8; 38 | ets_memcpy(addr, data, len); 39 | data += len; 40 | ROM_PRINTF("addr=0x%x, len=%d\r\n",addr, len); 41 | } 42 | int (*apply_patch)(uint8_t *buffer1024); 43 | apply_patch = patch_data[4] | (patch_data[5] << 8) | (patch_data[6] << 16) | (patch_data[7]<<24); 44 | ROM_PRINTF("apply_patch=0x%08x...\r\n", *(uint32*)apply_patch); 45 | ret = apply_patch(&_heap_start); 46 | ROM_PRINTF("apply done...\r\n"); 47 | } 48 | return ret; 49 | } 50 | 51 | void call_user_start1(void) 52 | { 53 | int32 ret = patch_apply(); 54 | ROM_PRINTF("ret=%d\r\n", ret); 55 | call_user_start(); 56 | } 57 | -------------------------------------------------------------------------------- /examples/peripheral_test/include/spi_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2015 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP32 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | #ifndef __SPI_TEST_H__ 25 | #define __SPI_TEST_H__ 26 | 27 | 28 | //***************************************************************************** 29 | // 30 | // Make sure all of the definitions in this header have a C binding. 31 | // 32 | //***************************************************************************** 33 | 34 | #ifdef __cplusplus 35 | extern "C" 36 | { 37 | #endif 38 | 39 | /** 40 | * @brief test spi module function. 41 | * 42 | * @param [in] None. 43 | * 44 | * @return void. 45 | */ 46 | void spi_interface_test(void); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif // __SPI_TEST_H__ 53 | -------------------------------------------------------------------------------- /third_party/include/arch/perf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | */ 34 | #ifndef __PERF_H__ 35 | #define __PERF_H__ 36 | 37 | #define PERF_START /* null definition */ 38 | #define PERF_STOP(x) /* null definition */ 39 | 40 | #endif /* __PERF_H__ */ 41 | -------------------------------------------------------------------------------- /bin/at_sdio/README.md: -------------------------------------------------------------------------------- 1 | # BOOT MODE 2 | ## download 3 | ### Flash size 16Mbit-C1: 1024KB+1024KB 4 | boot_v1.2+.bin 0x00000 5 | user1.2048.new.5.bin 0x01000 6 | esp_init_data_default.bin 0x1fc000 7 | blank.bin 0xfe000 & 0x1fe000 8 | 9 | ### Flash size 32Mbit-C1: 1024KB+1024KB 10 | boot_v1.2+.bin 0x00000 11 | user1.2048.new.5.bin 0x01000 12 | esp_init_data_default.bin 0x3fc000 13 | blank.bin 0xfe000 & 0x3fe000 14 | 15 | # NON-BOOT MODE 16 | ## download 17 | eagle.flash.bin 0x00000 18 | eagle.irom0text.bin 0x10000 19 | blank.bin 20 | Flash size 8Mbit: 0x7e000 & 0xfe000 21 | Flash size 16Mbit: 0x7e000 & 0x1fe000 22 | Flash size 16Mbit-C1: 0xfe000 & 0x1fe000 23 | Flash size 32Mbit: 0x7e000 & 0x3fe000 24 | Flash size 32Mbit-C1: 0xfe000 & 0x3fe000 25 | esp_init_data_default.bin 26 | Flash size 8Mbit: 0xfc000 27 | Flash size 16Mbit: 0x1fc000 28 | Flash size 16Mbit-C1: 0x1fc000 29 | Flash size 32Mbit: 0x3fc000 30 | Flash size 32Mbit-C1: 0x3fc000 31 | 32 | ## compile 33 | modify eagle.app.v6.ld, as 34 | irom0_0_seg : org = 0x40210000, len = 0x6C000 35 | 36 | 37 | > NOTICE: UPDATE is not supported in non-boot mode; 4Mbit Flash is not supported in non-boot mode; 38 | 39 | # Update steps 40 | 1.Make sure TE(terminal equipment) is in sta or sta+ap mode 41 | 42 | AT+CWMODE=3 43 | OK 44 | 45 | 2.Make sure TE got ip address 46 | 47 | AT+CWJAP="ssid","12345678" 48 | OK 49 | 50 | AT+CIFSR 51 | 192.168.1.134 52 | 53 | 3.Let's update 54 | 55 | AT+CIUPDATE 56 | +CIPUPDATE:1 found server 57 | +CIPUPDATE:2 connect server 58 | +CIPUPDATE:3 got edition 59 | +CIPUPDATE:4 start start 60 | 61 | OK 62 | 63 | > NOTICE: If there are mistakes in the updating, then break update and print ERROR. -------------------------------------------------------------------------------- /examples/wps/include/driver/key.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __KEY_H__ 26 | #define __KEY_H__ 27 | 28 | #include "gpio.h" 29 | 30 | typedef void (* key_function)(void); 31 | 32 | struct single_key_param { 33 | uint8 key_level; 34 | uint8 gpio_id; 35 | uint8 gpio_func; 36 | uint32 gpio_name; 37 | os_timer_t key_5s; 38 | os_timer_t key_50ms; 39 | key_function short_press; 40 | key_function long_press; 41 | }; 42 | 43 | struct keys_param { 44 | uint8 key_num; 45 | struct single_key_param **single_key; 46 | }; 47 | 48 | struct single_key_param *key_init_single(uint8 gpio_id, uint32 gpio_name, uint8 gpio_func, key_function long_press, key_function short_press); 49 | void key_init(struct keys_param *key); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/smartconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __SMARTCONFIG_H__ 26 | #define __SMARTCONFIG_H__ 27 | 28 | typedef enum { 29 | SC_STATUS_WAIT = 0, 30 | SC_STATUS_FIND_CHANNEL, 31 | SC_STATUS_GETTING_SSID_PSWD, 32 | SC_STATUS_LINK, 33 | SC_STATUS_LINK_OVER, 34 | } sc_status; 35 | 36 | typedef enum { 37 | SC_TYPE_ESPTOUCH = 0, 38 | SC_TYPE_AIRKISS, 39 | SC_TYPE_ESPTOUCH_AIRKISS, 40 | } sc_type; 41 | 42 | typedef void (*sc_callback_t)(sc_status status, void *pdata); 43 | 44 | const char *smartconfig_get_version(void); 45 | bool smartconfig_start(sc_callback_t cb, ...); 46 | bool smartconfig_stop(void); 47 | bool esptouch_set_timeout(uint8 time_s); //15s~255s, offset:45s 48 | bool smartconfig_set_type(sc_type type); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /driver_lib/include/driver/key.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __KEY_H__ 26 | #define __KEY_H__ 27 | #include "ets_sys.h" 28 | #include "gpio.h" 29 | #include "os_type.h" 30 | typedef void (* key_function)(void); 31 | 32 | struct single_key_param { 33 | uint8_t key_level; 34 | uint8_t gpio_id; 35 | uint8_t gpio_func; 36 | uint32_t gpio_name; 37 | os_timer_t key_5s; 38 | os_timer_t key_50ms; 39 | key_function short_press; 40 | key_function long_press; 41 | }; 42 | 43 | struct keys_param { 44 | uint8_t key_num; 45 | struct single_key_param **single_key; 46 | }; 47 | 48 | struct single_key_param *key_init_single(uint8_t gpio_id, uint32_t gpio_name, uint8_t gpio_func, key_function long_press, key_function short_press); 49 | void key_init(struct keys_param *key); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /third_party/mbedtls/platform/esp_hardware.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRSSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #if !defined(MBEDTLS_CONFIG_FILE) 26 | #include "mbedtls/config.h" 27 | #else 28 | #include MBEDTLS_CONFIG_FILE 29 | #endif 30 | 31 | #include 32 | #include "osapi.h" 33 | 34 | #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT) 35 | /** 36 | * \brief Entropy poll callback for a hardware source 37 | * 38 | * \warning This is not provided by mbed TLS! 39 | * See \c MBEDTLS_ENTROPY_HARDWARE_ALT in config.h. 40 | * 41 | * \note This must accept NULL as its first argument. 42 | */ 43 | int mbedtls_hardware_poll( void *data, 44 | unsigned char *output, size_t len, size_t *olen ) 45 | { 46 | os_get_random(output, len); 47 | *olen = len; 48 | return 0; 49 | } 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /third_party/include/mbedtls/havege.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file havege.h 3 | * 4 | * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion 5 | * 6 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 7 | * SPDX-License-Identifier: Apache-2.0 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * This file is part of mbed TLS (https://tls.mbed.org) 22 | */ 23 | #ifndef MBEDTLS_HAVEGE_H 24 | #define MBEDTLS_HAVEGE_H 25 | 26 | #include 27 | 28 | #define MBEDTLS_HAVEGE_COLLECT_SIZE 1024 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /** 35 | * \brief HAVEGE state structure 36 | */ 37 | typedef struct 38 | { 39 | int PT1, PT2, offset[2]; 40 | int pool[MBEDTLS_HAVEGE_COLLECT_SIZE]; 41 | int WALK[8192]; 42 | } 43 | mbedtls_havege_state; 44 | 45 | /** 46 | * \brief HAVEGE initialization 47 | * 48 | * \param hs HAVEGE state to be initialized 49 | */ 50 | void mbedtls_havege_init( mbedtls_havege_state *hs ); 51 | 52 | /** 53 | * \brief Clear HAVEGE state 54 | * 55 | * \param hs HAVEGE state to be cleared 56 | */ 57 | void mbedtls_havege_free( mbedtls_havege_state *hs ); 58 | 59 | /** 60 | * \brief HAVEGE rand function 61 | * 62 | * \param p_rng A HAVEGE state 63 | * \param output Buffer to fill 64 | * \param len Length of buffer 65 | * 66 | * \return 0 67 | */ 68 | int mbedtls_havege_random( void *p_rng, unsigned char *output, size_t len ); 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | 74 | #endif /* havege.h */ 75 | -------------------------------------------------------------------------------- /driver_lib/include/driver/hw_timer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * ESPRESSIF MIT License 4 | * 5 | * Copyright (c) 2016 6 | * 7 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 8 | * it is free of charge, to any person obtaining a copy of this software and associated 9 | * documentation files (the "Software"), to deal in the Software without restriction, including 10 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 12 | * to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all copies or 15 | * substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | #include "ets_sys.h" 26 | #ifndef __hw_timer_H__ 27 | #define __hw_timer_H__ 28 | //TIMER PREDIVED MODE 29 | typedef enum { 30 | DIVDED_BY_1 = 0, //timer clock 31 | DIVDED_BY_16 = 4, //divided by 16 32 | DIVDED_BY_256 = 8, //divided by 256 33 | } time_predived_mode; 34 | 35 | typedef enum { //timer interrupt mode 36 | TM_LEVEL_INT = 1, // level interrupt 37 | TM_EDGE_INT = 0, //edge interrupt 38 | } time_int_mode; 39 | 40 | typedef enum { 41 | FRC1_SOURCE = 0, 42 | NMI_SOURCE = 1, 43 | } frc1_timer_source_type; 44 | 45 | 46 | void hw_timer_init(frc1_timer_source_type source_type, uint8_t req); 47 | 48 | void hw_timer_set_func(void (* user_hw_timer_cb_set)(void)) ; 49 | void hw_timer_arm(uint32_t val) ; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /third_party/include/ssl/app/espconn_secure.h: -------------------------------------------------------------------------------- 1 | #ifndef __ESPCONN_ENCRY_H__ 2 | #define __ESPCONN_ENCRY_H__ 3 | 4 | #include "lwip/app/espconn.h" 5 | #include "ssl/app/espconn_ssl.h" 6 | /****************************************************************************** 7 | * FunctionName : espconn_encry_connect 8 | * Description : The function given as connection 9 | * Parameters : espconn -- the espconn used to connect with the host 10 | * Returns : none 11 | *******************************************************************************/ 12 | 13 | sint8 espconn_secure_connect(struct espconn *espconn); 14 | 15 | /****************************************************************************** 16 | * FunctionName : espconn_encry_disconnect 17 | * Description : The function given as the disconnection 18 | * Parameters : espconn -- the espconn used to disconnect with the host 19 | * Returns : none 20 | *******************************************************************************/ 21 | 22 | extern sint8 espconn_secure_disconnect(struct espconn *espconn); 23 | 24 | /****************************************************************************** 25 | * FunctionName : espconn_encry_sent 26 | * Description : sent data for client or server 27 | * Parameters : espconn -- espconn to set for client or server 28 | * psent -- data to send 29 | * length -- length of data to send 30 | * Returns : none 31 | *******************************************************************************/ 32 | 33 | extern sint8 espconn_secure_sent(struct espconn *espconn, uint8 *psent, uint16 length); 34 | 35 | /****************************************************************************** 36 | * FunctionName : espconn_secure_accept 37 | * Description : The function given as the listen 38 | * Parameters : espconn -- the espconn used to listen the connection 39 | * Returns : none 40 | *******************************************************************************/ 41 | 42 | extern sint8 espconn_secure_accept(struct espconn *espconn); 43 | 44 | #endif 45 | 46 | 47 | -------------------------------------------------------------------------------- /include/sntp.h: -------------------------------------------------------------------------------- 1 | #ifndef __SNTP_H__ 2 | #define __SNTP_H__ 3 | 4 | #include "os_type.h" 5 | #ifdef LWIP_OPEN_SRC 6 | #include "lwip/ip_addr.h" 7 | #else 8 | #include "ip_addr.h" 9 | #endif 10 | /** 11 | * get the seconds since Jan 01, 1970, 00:00 (GMT + 8) 12 | */ 13 | uint32 sntp_get_current_timestamp(); 14 | /** 15 | * get real time (GTM + 8 time zone) 16 | */ 17 | char* sntp_get_real_time(long t); 18 | /** 19 | * SNTP get time_zone default GMT + 8 20 | */ 21 | sint8 sntp_get_timezone(void); 22 | /** 23 | * SNTP set time_zone (default GMT + 8) 24 | */ 25 | bool sntp_set_timezone(sint8 timezone); 26 | /** 27 | * Initialize this module. 28 | * Send out request instantly or after SNTP_STARTUP_DELAY(_FUNC). 29 | */ 30 | void sntp_init(void); 31 | /** 32 | * Stop this module. 33 | */ 34 | void sntp_stop(void); 35 | /** 36 | * Initialize one of the NTP servers by IP address 37 | * 38 | * @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS 39 | * @param dnsserver IP address of the NTP server to set 40 | */ 41 | void sntp_setserver(unsigned char idx, ip_addr_t *addr); 42 | /** 43 | * Obtain one of the currently configured by IP address (or DHCP) NTP servers 44 | * 45 | * @param numdns the index of the NTP server 46 | * @return IP address of the indexed NTP server or "ip_addr_any" if the NTP 47 | * server has not been configured by address (or at all). 48 | */ 49 | ip_addr_t sntp_getserver(unsigned char idx); 50 | /** 51 | * Initialize one of the NTP servers by name 52 | * 53 | * @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS,now sdk support SNTP_MAX_SERVERS = 3 54 | * @param dnsserver DNS name of the NTP server to set, to be resolved at contact time 55 | */ 56 | void sntp_setservername(unsigned char idx, char *server); 57 | /** 58 | * Obtain one of the currently configured by name NTP servers. 59 | * 60 | * @param numdns the index of the NTP server 61 | * @return IP address of the indexed NTP server or NULL if the NTP 62 | * server has not been configured by name (or at all) 63 | */ 64 | char *sntp_getservername(unsigned char idx); 65 | 66 | #define sntp_servermode_dhcp(x) 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /include/ping.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __PING_H__ 26 | #define __PING_H__ 27 | 28 | 29 | typedef void (* ping_recv_function)(void* arg, void *pdata); 30 | typedef void (* ping_sent_function)(void* arg, void *pdata); 31 | 32 | struct ping_option{ 33 | uint32 count; 34 | uint32 ip; 35 | uint32 coarse_time; 36 | ping_recv_function recv_function; 37 | ping_sent_function sent_function; 38 | void* reverse; 39 | }; 40 | 41 | struct ping_resp{ 42 | uint32 total_count; 43 | uint32 resp_time; 44 | uint32 seqno; 45 | uint32 timeout_count; 46 | uint32 bytes; 47 | uint32 total_bytes; 48 | uint32 total_time; 49 | sint8 ping_err; 50 | }; 51 | 52 | bool ping_start(struct ping_option *ping_opt); 53 | bool ping_regist_recv(struct ping_option *ping_opt, ping_recv_function ping_recv); 54 | bool ping_regist_sent(struct ping_option *ping_opt, ping_sent_function ping_sent); 55 | 56 | #endif /* __PING_H__ */ 57 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/include/mqtt/queue.h: -------------------------------------------------------------------------------- 1 | /* str_queue.h -- 2 | * 3 | * Copyright (c) 2014-2015, Tuan PM 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef USER_QUEUE_H_ 32 | #define USER_QUEUE_H_ 33 | #include "os_type.h" 34 | #include "ringbuf.h" 35 | typedef struct { 36 | uint8_t *buf; 37 | RINGBUF rb; 38 | } QUEUE; 39 | 40 | void ICACHE_FLASH_ATTR QUEUE_Init(QUEUE *queue, int bufferSize); 41 | int32_t ICACHE_FLASH_ATTR QUEUE_Puts(QUEUE *queue, uint8_t* buffer, uint16_t len); 42 | int32_t ICACHE_FLASH_ATTR QUEUE_Gets(QUEUE *queue, uint8_t* buffer, uint16_t* len, uint16_t maxLen); 43 | BOOL ICACHE_FLASH_ATTR QUEUE_IsEmpty(QUEUE *queue); 44 | #endif /* USER_QUEUE_H_ */ 45 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/mqtt/include/queue.h: -------------------------------------------------------------------------------- 1 | /* str_queue.h -- 2 | * 3 | * Copyright (c) 2014-2015, Tuan PM 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef USER_QUEUE_H_ 32 | #define USER_QUEUE_H_ 33 | #include "os_type.h" 34 | #include "ringbuf.h" 35 | typedef struct { 36 | uint8_t *buf; 37 | RINGBUF rb; 38 | } QUEUE; 39 | 40 | void ICACHE_FLASH_ATTR QUEUE_Init(QUEUE *queue, int bufferSize); 41 | int32_t ICACHE_FLASH_ATTR QUEUE_Puts(QUEUE *queue, uint8_t* buffer, uint16_t len); 42 | int32_t ICACHE_FLASH_ATTR QUEUE_Gets(QUEUE *queue, uint8_t* buffer, uint16_t* len, uint16_t maxLen); 43 | BOOL ICACHE_FLASH_ATTR QUEUE_IsEmpty(QUEUE *queue); 44 | #endif /* USER_QUEUE_H_ */ 45 | -------------------------------------------------------------------------------- /third_party/include/lwip/app/ping.h: -------------------------------------------------------------------------------- 1 | #ifndef __PING_H__ 2 | #define __PING_H__ 3 | #include "lwip/ip_addr.h" 4 | #include "lwip/icmp.h" 5 | /** 6 | * PING_USE_SOCKETS: Set to 1 to use sockets, otherwise the raw api is used 7 | */ 8 | #ifndef PING_USE_SOCKETS 9 | #define PING_USE_SOCKETS LWIP_SOCKET 10 | #endif 11 | 12 | /** 13 | * PING_DEBUG: Enable debugging for PING. 14 | */ 15 | #ifndef PING_DEBUG 16 | #define PING_DEBUG LWIP_DBG_OFF 17 | #endif 18 | 19 | /** ping receive timeout - in milliseconds */ 20 | #ifndef PING_RCV_TIMEO 21 | #define PING_RCV_TIMEO 1000 22 | #endif 23 | 24 | /** ping delay - in milliseconds */ 25 | #ifndef PING_COARSE 26 | #define PING_COARSE 1000 27 | #endif 28 | 29 | /** ping identifier - must fit on a u16_t */ 30 | #ifndef PING_ID 31 | #define PING_ID 0xAFAF 32 | #endif 33 | 34 | /** ping additional data size to include in the packet */ 35 | #ifndef PING_DATA_SIZE 36 | #define PING_DATA_SIZE 32 37 | #endif 38 | 39 | /** ping result action - no default action */ 40 | #ifndef PING_RESULT 41 | #define PING_RESULT(ping_ok) 42 | #endif 43 | 44 | #define DEFAULT_PING_MAX_COUNT 4 45 | #define PING_TIMEOUT_MS 1000 46 | 47 | typedef void (* ping_recv_function)(void* arg, void *pdata); 48 | typedef void (* ping_sent_function)(void* arg, void *pdata); 49 | 50 | struct ping_option{ 51 | uint32 count; 52 | uint32 ip; 53 | uint32 coarse_time; 54 | ping_recv_function recv_function; 55 | ping_sent_function sent_function; 56 | void* reverse; 57 | }; 58 | 59 | struct ping_msg{ 60 | struct ping_option *ping_opt; 61 | struct raw_pcb *ping_pcb; 62 | uint32 ping_start; 63 | uint32 ping_sent; 64 | uint32 timeout_count; 65 | uint32 max_count; 66 | uint32 sent_count; 67 | uint32 coarse_time; 68 | }; 69 | 70 | struct ping_resp{ 71 | uint32 total_count; 72 | uint32 resp_time; 73 | uint32 seqno; 74 | uint32 timeout_count; 75 | uint32 bytes; 76 | uint32 total_bytes; 77 | uint32 total_time; 78 | sint8 ping_err; 79 | }; 80 | 81 | bool ping_start(struct ping_option *ping_opt); 82 | bool ping_regist_recv(struct ping_option *ping_opt, ping_recv_function ping_recv); 83 | bool ping_regist_sent(struct ping_option *ping_opt, ping_sent_function ping_sent); 84 | 85 | uint32 system_relative_time(uint32 time); 86 | int system_get_time(void); 87 | 88 | #endif /* __PING_H__ */ 89 | -------------------------------------------------------------------------------- /include/pwm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __PWM_H__ 26 | #define __PWM_H__ 27 | 28 | /*pwm.h: function and macro definition of PWM API , driver level */ 29 | /*user_light.h: user interface for light API, user level*/ 30 | /*user_light_adj: API for color changing and lighting effects, user level*/ 31 | 32 | 33 | /*NOTE!! : DO NOT CHANGE THIS FILE*/ 34 | 35 | /*SUPPORT UP TO 8 PWM CHANNEL*/ 36 | #define PWM_CHANNEL_NUM_MAX 8 37 | 38 | struct pwm_param { 39 | uint32 period; 40 | uint32 freq; 41 | uint32 duty[PWM_CHANNEL_NUM_MAX]; //PWM_CHANNEL<=8 42 | }; 43 | 44 | 45 | /* pwm_init should be called only once, for now */ 46 | void pwm_init(uint32 period, uint32 *duty,uint32 pwm_channel_num,uint32 (*pin_info_list)[3]); 47 | void pwm_start(void); 48 | 49 | void pwm_set_duty(uint32 duty, uint8 channel); 50 | uint32 pwm_get_duty(uint8 channel); 51 | void pwm_set_period(uint32 period); 52 | uint32 pwm_get_period(void); 53 | 54 | uint32 get_pwm_version(void); 55 | void set_pwm_debug_en(uint8 print_en); 56 | 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/include/modules/config.h: -------------------------------------------------------------------------------- 1 | /* config.h 2 | * 3 | * Copyright (c) 2014-2015, Tuan PM 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef USER_CONFIG_H_ 32 | #define USER_CONFIG_H_ 33 | #include "os_type.h" 34 | #include "user_config.h" 35 | typedef struct{ 36 | uint32_t cfg_holder; 37 | uint8_t device_id[32]; 38 | 39 | uint8_t sta_ssid[64]; 40 | uint8_t sta_pwd[64]; 41 | uint32_t sta_type; 42 | 43 | uint8_t mqtt_host[64]; 44 | uint32_t mqtt_port; 45 | uint8_t mqtt_user[32]; 46 | uint8_t mqtt_pass[32]; 47 | uint32_t mqtt_keepalive; 48 | uint8_t security; 49 | } SYSCFG; 50 | 51 | typedef struct { 52 | uint8 flag; 53 | uint8 pad[3]; 54 | } SAVE_FLAG; 55 | 56 | void ICACHE_FLASH_ATTR CFG_Save(); 57 | void ICACHE_FLASH_ATTR CFG_Load(); 58 | 59 | extern SYSCFG sysCfg; 60 | 61 | #endif /* USER_CONFIG_H_ */ 62 | -------------------------------------------------------------------------------- /include/spi_flash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef SPI_FLASH_H 26 | #define SPI_FLASH_H 27 | 28 | typedef enum { 29 | SPI_FLASH_RESULT_OK, 30 | SPI_FLASH_RESULT_ERR, 31 | SPI_FLASH_RESULT_TIMEOUT 32 | } SpiFlashOpResult; 33 | 34 | typedef struct{ 35 | uint32 deviceId; 36 | uint32 chip_size; // chip size in byte 37 | uint32 block_size; 38 | uint32 sector_size; 39 | uint32 page_size; 40 | uint32 status_mask; 41 | } SpiFlashChip; 42 | 43 | #define SPI_FLASH_SEC_SIZE 4096 44 | 45 | uint32 spi_flash_get_id(void); 46 | SpiFlashOpResult spi_flash_erase_sector(uint16 sec); 47 | SpiFlashOpResult spi_flash_write(uint32 des_addr, uint32 *src_addr, uint32 size); 48 | SpiFlashOpResult spi_flash_read(uint32 src_addr, uint32 *des_addr, uint32 size); 49 | 50 | typedef SpiFlashOpResult (* user_spi_flash_read)( 51 | SpiFlashChip *spi, 52 | uint32 src_addr, 53 | uint32 *des_addr, 54 | uint32 size); 55 | 56 | void spi_flash_set_read_func(user_spi_flash_read read); 57 | 58 | bool spi_flash_erase_protect_enable(void); 59 | bool spi_flash_erase_protect_disable(void); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /third_party/include/ssl/ssl_os_int.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, Cameron Rich 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * * Neither the name of the axTLS project nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 22 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /** 32 | * @file os_int.h 33 | * 34 | * Ensure a consistent bit size 35 | */ 36 | 37 | #ifndef HEADER_OS_INT_H 38 | #define HEADER_OS_INT_H 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | #if defined(WIN32) 45 | typedef UINT8 uint8_t; 46 | typedef INT8 int8_t; 47 | typedef UINT16 uint16_t; 48 | typedef INT16 int16_t; 49 | typedef UINT32 uint32_t; 50 | typedef INT32 int32_t; 51 | typedef UINT64 uint64_t; 52 | typedef INT64 int64_t; 53 | #else /* Not Win32 */ 54 | 55 | #ifdef CONFIG_PLATFORM_SOLARIS 56 | #include 57 | #else 58 | //#include 59 | #endif /* Not Solaris */ 60 | 61 | #endif /* Not Win32 */ 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /third_party/lwip/core/sys.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * lwIP Operating System abstraction 4 | * 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Adam Dunkels 36 | * 37 | */ 38 | 39 | #include "lwip/opt.h" 40 | 41 | #include "lwip/sys.h" 42 | 43 | /* Most of the functions defined in sys.h must be implemented in the 44 | * architecture-dependent file sys_arch.c */ 45 | 46 | #if !NO_SYS 47 | 48 | /** 49 | * Sleep for some ms. Timeouts are NOT processed while sleeping. 50 | * 51 | * @param ms number of milliseconds to sleep 52 | */ 53 | void 54 | sys_msleep(u32_t ms) 55 | { 56 | if (ms > 0) { 57 | sys_sem_t delaysem; 58 | err_t err = sys_sem_new(&delaysem, 0); 59 | if (err == ERR_OK) { 60 | sys_arch_sem_wait(&delaysem, ms); 61 | sys_sem_free(&delaysem); 62 | } 63 | } 64 | } 65 | 66 | #endif /* !NO_SYS */ 67 | -------------------------------------------------------------------------------- /bin/at/README.md: -------------------------------------------------------------------------------- 1 | # Notice: 2 | AT firmware becomes larger since it supports more functions. So, we provide two firmwares here: 3 | 4 | * 1024+1024: Normal AT, which is compiled from ESP8266_NONOS_SDK/examples/at, and uses mbedTLS lib. 5 | * 512+512: Nano AT, which is compiled from ESP8266_NONOS_SDK/examples/at_nano, and uses SSL lib that supports less cipher suites. 6 | It is suggested to use normal AT(1024+1024), if your flash size is 2MB or larger. 7 | 8 | # BOOT MODE 9 | ## download 10 | 11 | ### Flash size 8Mbit: 512KB+512KB 12 | boot_v1.2+.bin 0x00000 13 | user1.1024.new.2.bin 0x01000 14 | esp_init_data_default.bin 0xfc000 15 | blank.bin 0x7e000 & 0xfe000 16 | 17 | 18 | ### Flash size 16Mbit-C1: 1024KB+1024KB 19 | boot_v1.2+.bin 0x00000 20 | user1.2048.new.5.bin 0x01000 21 | esp_init_data_default.bin 0x1fc000 22 | blank.bin 0xfe000 & 0x1fe000 23 | 24 | # NON-BOOT MODE 25 | ## download 26 | eagle.flash.bin 0x00000 27 | eagle.irom0text.bin 0x10000 28 | blank.bin 29 | Flash size 8Mbit: 0x7e000 & 0xfe000 30 | Flash size 16Mbit: 0x7e000 & 0x1fe000 31 | Flash size 16Mbit-C1: 0xfe000 & 0x1fe000 32 | Flash size 32Mbit: 0x7e000 & 0x3fe000 33 | Flash size 32Mbit-C1: 0xfe000 & 0x3fe000 34 | esp_init_data_default.bin 35 | Flash size 8Mbit: 0xfc000 36 | Flash size 16Mbit: 0x1fc000 37 | Flash size 16Mbit-C1: 0x1fc000 38 | Flash size 32Mbit: 0x3fc000 39 | Flash size 32Mbit-C1: 0x3fc000 40 | 41 | ## compile 42 | modify eagle.app.v6.ld, as 43 | irom0_0_seg : org = 0x40210000, len = 0x6C000 44 | 45 | 46 | > NOTICE: UPDATE is not supported in non-boot mode; 4Mbit Flash is not supported in non-boot mode; 47 | 48 | # Update steps 49 | 1.Make sure TE(terminal equipment) is in sta or sta+ap mode 50 | 51 | AT+CWMODE=3 52 | OK 53 | 54 | 2.Make sure TE got ip address 55 | 56 | AT+CWJAP="ssid","12345678" 57 | OK 58 | 59 | AT+CIFSR 60 | 192.168.1.134 61 | 62 | 3.Let's update 63 | 64 | AT+CIUPDATE 65 | +CIPUPDATE:1 found server 66 | +CIPUPDATE:2 connect server 67 | +CIPUPDATE:3 got edition 68 | +CIPUPDATE:4 start start 69 | 70 | OK 71 | 72 | > NOTICE: If there are mistakes in the updating, then break update and print ERROR. 73 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/mqtt/queue.c: -------------------------------------------------------------------------------- 1 | /* str_queue.c 2 | * 3 | * Copyright (c) 2014-2015, Tuan PM 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #include "queue.h" 31 | 32 | #include "user_interface.h" 33 | #include "osapi.h" 34 | #include "os_type.h" 35 | #include "mem.h" 36 | #include "proto.h" 37 | void ICACHE_FLASH_ATTR QUEUE_Init(QUEUE *queue, int bufferSize) 38 | { 39 | queue->buf = (uint8_t*)os_zalloc(bufferSize); 40 | RINGBUF_Init(&queue->rb, queue->buf, bufferSize); 41 | } 42 | int32_t ICACHE_FLASH_ATTR QUEUE_Puts(QUEUE *queue, uint8_t* buffer, uint16_t len) 43 | { 44 | return PROTO_AddRb(&queue->rb, buffer, len); 45 | } 46 | int32_t ICACHE_FLASH_ATTR QUEUE_Gets(QUEUE *queue, uint8_t* buffer, uint16_t* len, uint16_t maxLen) 47 | { 48 | 49 | return PROTO_ParseRb(&queue->rb, buffer, len, maxLen); 50 | } 51 | 52 | BOOL ICACHE_FLASH_ATTR QUEUE_IsEmpty(QUEUE *queue) 53 | { 54 | if(queue->rb.fill_cnt<=0) 55 | return TRUE; 56 | return FALSE; 57 | } 58 | -------------------------------------------------------------------------------- /tools/make_cacert.py: -------------------------------------------------------------------------------- 1 | # 2 | # ESPRESSIF MIT License 3 | # 4 | # Copyright (c) 2016 5 | # 6 | # Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | # it is free of charge, to any person obtaining a copy of this software and associated 8 | # documentation files (the "Software"), to deal in the Software without restriction, including 9 | # without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | # and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | # to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all copies or 14 | # substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | # 23 | 24 | import os 25 | 26 | 27 | class Cert(object): 28 | def __init__(self, name, buff): 29 | self.name = name 30 | self.len = len(buff) 31 | self.buff = buff 32 | pass 33 | 34 | def __str__(self): 35 | out_str = ['\0']*32 36 | for i in range(len(self.name)): 37 | out_str[i] = self.name[i] 38 | out_str = "".join(out_str) 39 | out_str += str(chr(self.len & 0xFF)) 40 | out_str += str(chr((self.len & 0xFF00) >> 8)) 41 | out_str += self.buff 42 | return out_str 43 | pass 44 | 45 | 46 | def main(): 47 | cert_list = [] 48 | file_list = os.listdir(os.getcwd()) 49 | cert_file_list = [] 50 | for _file in file_list: 51 | if _file.endswith(".cer"): 52 | cert_file_list.append(_file) 53 | print cert_file_list 54 | for cert_file in cert_file_list: 55 | with open(cert_file, 'rb') as f: 56 | buff = f.read() 57 | cert_list.append(Cert(cert_file, buff)) 58 | with open('esp_ca_cert.bin', 'wb+') as f: 59 | for _cert in cert_list: 60 | f.write("%s" % _cert) 61 | pass 62 | if __name__ == '__main__': 63 | main() 64 | 65 | -------------------------------------------------------------------------------- /include/simple_pair.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __SIMPLE_PAIR_H__ 26 | #define __SIMPLE_PAIR_H__ 27 | 28 | typedef enum { 29 | SP_ST_STA_FINISH = 0, 30 | SP_ST_AP_FINISH = 0, 31 | SP_ST_AP_RECV_NEG, 32 | SP_ST_STA_AP_REFUSE_NEG, 33 | /* all following is err */ 34 | SP_ST_WAIT_TIMEOUT, 35 | SP_ST_SEND_ERROR, 36 | SP_ST_KEY_INSTALL_ERR, 37 | SP_ST_KEY_OVERLAP_ERR, //means the same macaddr has two different keys 38 | SP_ST_OP_ERROR, 39 | SP_ST_UNKNOWN_ERROR, 40 | SP_ST_MAX, 41 | } SP_ST_t; 42 | 43 | 44 | typedef void (*simple_pair_status_cb_t)(u8 *sa, u8 status); 45 | 46 | int register_simple_pair_status_cb(simple_pair_status_cb_t cb); 47 | void unregister_simple_pair_status_cb(void); 48 | 49 | int simple_pair_init(void); 50 | void simple_pair_deinit(void); 51 | 52 | int simple_pair_state_reset(void); 53 | int simple_pair_ap_enter_announce_mode(void); 54 | int simple_pair_sta_enter_scan_mode(void); 55 | 56 | int simple_pair_sta_start_negotiate(void); 57 | int simple_pair_ap_start_negotiate(void); 58 | int simple_pair_ap_refuse_negotiate(void); 59 | 60 | int simple_pair_set_peer_ref(u8 *peer_mac, u8 *tmp_key, u8 *ex_key); 61 | int simple_pair_get_peer_ref(u8 *peer_mac, u8 *tmp_key, u8 *ex_key); 62 | 63 | 64 | #endif /* __SIMPLE_PAIR_H__ */ 65 | -------------------------------------------------------------------------------- /tools/README.md: -------------------------------------------------------------------------------- 1 | ## SSL tools 2 | Refer to [ESP8266 Non-OS SDK SSL User Manual](http://espressif.com/en/support/download/documents?keys=&field_type_tid%5B%5D=14) 3 | 4 | ## certificate generation 5 | you **must** choose one of a,b,c to generate your certificate file 6 | ### a) if you does not have any certificate file which issued by trusted CA 7 | 8 | we would generate self-signed CA certificate,and generate certificate and private key with self-signed CA. 9 | 10 | - **change your CN field in your makefile.sh** to your IP address 11 | 12 | run the command as the following: 13 | 14 | **makefile.sh:** 15 | ``` 16 | $./makefile.sh 17 | ``` 18 | generate all of your cert and private key files. 19 | 20 | **rmfile.sh** 21 | ``` 22 | $./rmfile.sh 23 | ``` 24 | 25 | delete all of your cert and private key files. 26 | 27 | the certificate files to flash are under the directory bin/ 28 | 29 | ### b) if you just have CA certificate: ca.crt which issued by trusted CA 30 | 31 | we would generate CA bin:esp_ca_cert.bin for one-way authentication 32 | 33 | - **[important]**if CA certificate file is not called ca.crt, please rename it to ca.crt 34 | - ensure the CA certificate file is in **PEM** format 35 | - copy your ca.crt to tools/ directory 36 | 37 | run the command as the following: 38 | 39 | **makefile.sh:** 40 | 41 | ``` 42 | $./makefile.sh 43 | ``` 44 | 45 | the command would generate your CA certificate bin 46 | 47 | **rmfile.sh** 48 | 49 | ``` 50 | $./rmfile.sh 51 | ``` 52 | 53 | delete all of your generated files 54 | 55 | the certificate file to flash is under the directory bin/ 56 | 57 | ### c) if you have both CA certificate:ca.crt and client certificate:client.crt and client key:client.key which issued by trusted CA 58 | 59 | we would generate CA bin:esp_ca_cert.bin and client certificate/private key bin:esp_cert_private_key.bin for two-way authentication 60 | 61 | - **[important]**if their filename is not called ca.crt,client.crt,client.key, please rename it to ca.crt,client.crt,client.key 62 | - ensure the ca.crt,client.crt,client.key are in **PEM** format 63 | - copy your ca.crt,client.crt,client.key to tools/ directory 64 | 65 | run the command as the following: 66 | 67 | **makefile.sh:** 68 | 69 | ``` 70 | $./makefile.sh 71 | ``` 72 | 73 | the command would generate all of your CA certificate bin:esp_ca_cert.bin and client bin:esp_cert_private_key.bin. 74 | 75 | **rmfile.sh** 76 | 77 | ``` 78 | $./rmfile.sh 79 | ``` 80 | 81 | delete all of your generated files. 82 | 83 | the certificate file to flash is under directory bin/ 84 | 85 | -------------------------------------------------------------------------------- /include/upgrade.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __UPGRADE_H__ 26 | #define __UPGRADE_H__ 27 | 28 | #define SPI_FLASH_SEC_SIZE 4096 29 | #define LIMIT_ERASE_SIZE 0x10000 30 | 31 | #define USER_BIN1 0x00 32 | #define USER_BIN2 0x01 33 | 34 | #define UPGRADE_FLAG_IDLE 0x00 35 | #define UPGRADE_FLAG_START 0x01 36 | #define UPGRADE_FLAG_FINISH 0x02 37 | 38 | #define UPGRADE_FW_BIN1 0x00 39 | #define UPGRADE_FW_BIN2 0x01 40 | 41 | typedef void (*upgrade_states_check_callback)(void * arg); 42 | 43 | //#define UPGRADE_SSL_ENABLE 44 | 45 | struct upgrade_server_info { 46 | uint8 ip[4]; 47 | uint16 port; 48 | 49 | uint8 upgrade_flag; 50 | 51 | uint8 pre_version[16]; 52 | uint8 upgrade_version[16]; 53 | 54 | uint32 check_times; 55 | uint8 *url; 56 | 57 | upgrade_states_check_callback check_cb; 58 | struct espconn *pespconn; 59 | }; 60 | 61 | #define UPGRADE_FLAG_IDLE 0x00 62 | #define UPGRADE_FLAG_START 0x01 63 | #define UPGRADE_FLAG_FINISH 0x02 64 | 65 | void system_upgrade_init(); 66 | void system_upgrade_deinit(); 67 | bool system_upgrade(uint8 *data, uint16 len); 68 | 69 | #ifdef UPGRADE_SSL_ENABLE 70 | bool system_upgrade_start_ssl(struct upgrade_server_info *server); // not supported now 71 | #else 72 | bool system_upgrade_start(struct upgrade_server_info *server); 73 | #endif 74 | #endif 75 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/modules/wifi.c: -------------------------------------------------------------------------------- 1 | /* 2 | * wifi.c 3 | * 4 | * Created on: Dec 30, 2014 5 | * Author: Minh 6 | */ 7 | #include "wifi.h" 8 | #include "user_interface.h" 9 | #include "osapi.h" 10 | #include "espconn.h" 11 | #include "os_type.h" 12 | #include "mem.h" 13 | #include "mqtt_msg.h" 14 | #include "debug.h" 15 | #include "user_config.h" 16 | #include "config.h" 17 | 18 | static ETSTimer WiFiLinker; 19 | WifiCallback wifiCb = NULL; 20 | static uint8_t wifiStatus = STATION_IDLE, lastWifiStatus = STATION_IDLE; 21 | static void ICACHE_FLASH_ATTR wifi_check_ip(void *arg) 22 | { 23 | struct ip_info ipConfig; 24 | 25 | os_timer_disarm(&WiFiLinker); 26 | wifi_get_ip_info(STATION_IF, &ipConfig); 27 | wifiStatus = wifi_station_get_connect_status(); 28 | if (wifiStatus == STATION_GOT_IP && ipConfig.ip.addr != 0) 29 | { 30 | 31 | os_timer_setfn(&WiFiLinker, (os_timer_func_t *)wifi_check_ip, NULL); 32 | os_timer_arm(&WiFiLinker, 2000, 0); 33 | 34 | 35 | } 36 | else 37 | { 38 | if(wifi_station_get_connect_status() == STATION_WRONG_PASSWORD) 39 | { 40 | 41 | INFO("STATION_WRONG_PASSWORD\r\n"); 42 | wifi_station_connect(); 43 | 44 | 45 | } 46 | else if(wifi_station_get_connect_status() == STATION_NO_AP_FOUND) 47 | { 48 | 49 | INFO("STATION_NO_AP_FOUND\r\n"); 50 | wifi_station_connect(); 51 | 52 | 53 | } 54 | else if(wifi_station_get_connect_status() == STATION_CONNECT_FAIL) 55 | { 56 | 57 | INFO("STATION_CONNECT_FAIL\r\n"); 58 | wifi_station_connect(); 59 | 60 | } 61 | else 62 | { 63 | INFO("STATION_IDLE\r\n"); 64 | } 65 | 66 | os_timer_setfn(&WiFiLinker, (os_timer_func_t *)wifi_check_ip, NULL); 67 | os_timer_arm(&WiFiLinker, 500, 0); 68 | } 69 | if(wifiStatus != lastWifiStatus){ 70 | lastWifiStatus = wifiStatus; 71 | if(wifiCb) 72 | wifiCb(wifiStatus); 73 | } 74 | } 75 | 76 | void ICACHE_FLASH_ATTR WIFI_Connect(uint8_t* ssid, uint8_t* pass, WifiCallback cb) 77 | { 78 | struct station_config stationConf; 79 | 80 | INFO("WIFI_INIT\r\n"); 81 | wifi_set_opmode_current(STATION_MODE); 82 | 83 | //wifi_station_set_auto_connect(FALSE); 84 | wifiCb = cb; 85 | 86 | os_memset(&stationConf, 0, sizeof(struct station_config)); 87 | 88 | os_sprintf(stationConf.ssid, "%s", ssid); 89 | os_sprintf(stationConf.password, "%s", pass); 90 | 91 | wifi_station_set_config_current(&stationConf); 92 | 93 | os_timer_disarm(&WiFiLinker); 94 | os_timer_setfn(&WiFiLinker, (os_timer_func_t *)wifi_check_ip, NULL); 95 | os_timer_arm(&WiFiLinker, 1000, 0); 96 | 97 | //wifi_station_set_auto_connect(TRUE); 98 | wifi_station_connect(); 99 | } 100 | 101 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Simple MQTT Client Demo 3 | 4 | This example implement: 5 | - MQTT Publish the Message 6 | - MQTT Subscribe the Topic 7 | - MQTT works with SSL/TLS 8 | - MQTT works with one-way anthentication 9 | - MQTT works with two-way anthentication 10 | 11 | # How to make the Demo work 12 | 13 | ### Step 1: Start the MQTT broker 14 | 15 | you could choose [mosquitto](https://mosquitto.org) or [EMQTT](https://github.com/emqtt/emqttd) as your MQTT broker 16 | 17 | ### Step 2: Configurate your demo 18 | 19 | All you need to configurate are in mqtt_config.h, please according to the comment to modify: 20 | - CFG_HOLDER 21 | - MQTT_HOST 22 | - MQTT_PORT 23 | - MQTT_CLIENT_ID 24 | - MQTT_USER 25 | - MQTT_PASS 26 | - STA_SSID 27 | - STA_PASS 28 | - DEFAULT_SECURITY 29 | - CA_CERT_FLASH_ADDRESS 30 | - CLIENT_CERT_FLASH_ADDRESS 31 | 32 | ### Step 3(optional): Generate your certificate for SSL/TLS 33 | 34 | if you configurate DEFAULT_SECURITY to ONE_WAY_ANTHENTICATION or TWO_WAY_ANTHENTICATION, please according to [tools/README.txt](../../tools/README.md) to generate your certificate 35 | 36 | ### Step 4: Build your demo 37 | 38 | ``` 39 | $./gen_misc.sh 40 | ``` 41 | 42 | compile options: 1 1 2 0 5, or others if you are familar to it. 43 | 44 | ### Step 5: Flash your demo 45 | 46 | Any way is OK,such as: 47 | ``` 48 | $~/esp/esp-idf/components/esptool_py/esptool/esptool.py --port /dev/ttyUSB0 --baud 921600 write_flash 0x00000 ~/ESP8266_NONOS_SDK/bin/boot_v1.6.bin 0x1000 ../bin/upgrade/user1.2048.new.5.bin 0x1fe000 ~/ESP8266_NONOS_SDK/bin/blank.bin 0x1fc000 ~/ESP8266_NONOS_SDK/bin/esp_init_data_default.bin 49 | ``` 50 | 51 | ### Step 6(optional): Flash your certificate 52 | 53 | Any way is OK, but your flashing address is same as the Step 2,such as: 54 | 55 | ``` 56 | $~/esp/esp-idf/components/esptool_py/esptool/esptool.py --port /dev/ttyUSB0 --baud 921600 write_flash 0x77000 ~/ESP8266_NONOS_SDK/tools/bin/esp_ca_cert.bin 57 | $~/esp/esp-idf/components/esptool_py/esptool/esptool.py --port /dev/ttyUSB0 --baud 921600 write_flash 0x78000 ~/MQTTESP8266/tools/bin/esp_cert_private_key.bin 58 | ``` 59 | ### Run the demo and Result Shows 60 | 61 | when the demo starts up: 62 | - it would subscribe the topic `/mqtt/topic/0` , `/mqtt/topic/1` , `/mqtt/topic/2` 63 | - it would publish the topic `/mqtt/topic/0` , `/mqtt/topic/1` , `/mqtt/topic/2` 64 | - MQTT broker would receive subscribe and publish 65 | 66 | ### Troubleshooting 67 | 68 | **why the demo connect the WiFi failed?** 69 | - try to modify CFG_HOLDER 70 | 71 | **why the handshake failed?** 72 | 73 | - try to uncomment espconn_secure_set_size and modify memory allocate 74 | - make sure your MQTT broker SSL/TLS certificate configurate valid 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /include/espnow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __ESPNOW_H__ 26 | #define __ESPNOW_H__ 27 | 28 | enum esp_now_role { 29 | ESP_NOW_ROLE_IDLE = 0, 30 | ESP_NOW_ROLE_CONTROLLER, 31 | ESP_NOW_ROLE_SLAVE, 32 | ESP_NOW_ROLE_COMBO, 33 | ESP_NOW_ROLE_MAX, 34 | }; 35 | 36 | typedef void (*esp_now_recv_cb_t)(u8 *mac_addr, u8 *data, u8 len); 37 | typedef void (*esp_now_send_cb_t)(u8 *mac_addr, u8 status); 38 | 39 | int esp_now_init(void); 40 | int esp_now_deinit(void); 41 | 42 | int esp_now_register_send_cb(esp_now_send_cb_t cb); 43 | int esp_now_unregister_send_cb(void); 44 | 45 | int esp_now_register_recv_cb(esp_now_recv_cb_t cb); 46 | int esp_now_unregister_recv_cb(void); 47 | 48 | int esp_now_send(u8 *da, u8 *data, int len); 49 | 50 | int esp_now_add_peer(u8 *mac_addr, u8 role, u8 channel, u8 *key, u8 key_len); 51 | int esp_now_del_peer(u8 *mac_addr); 52 | 53 | int esp_now_set_self_role(u8 role); 54 | int esp_now_get_self_role(void); 55 | 56 | int esp_now_set_peer_role(u8 *mac_addr, u8 role); 57 | int esp_now_get_peer_role(u8 *mac_addr); 58 | 59 | int esp_now_set_peer_channel(u8 *mac_addr, u8 channel); 60 | int esp_now_get_peer_channel(u8 *mac_addr); 61 | 62 | int esp_now_set_peer_key(u8 *mac_addr, u8 *key, u8 key_len); 63 | int esp_now_get_peer_key(u8 *mac_addr, u8 *key, u8 *key_len); 64 | 65 | u8 *esp_now_fetch_peer(bool restart); 66 | 67 | int esp_now_is_peer_exist(u8 *mac_addr); 68 | 69 | int esp_now_get_cnt_info(u8 *all_cnt, u8 *encrypt_cnt); 70 | 71 | int esp_now_set_kok(u8 *key, u8 len); 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /include/wpa2_enterprise.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef __WPA2_ENTERPRISE_H__ 26 | #define __WPA2_ENTERPRISE_H__ 27 | 28 | typedef long os_time_t; 29 | 30 | struct os_time { 31 | os_time_t sec; 32 | os_time_t usec; 33 | }; 34 | 35 | typedef int (* get_time_func_t)(struct os_time *t); 36 | 37 | int wifi_station_set_wpa2_enterprise_auth(int enable); 38 | 39 | int wifi_station_set_enterprise_cert_key(u8 *client_cert, int client_cert_len, 40 | u8 *private_key, int private_key_len, 41 | u8 *private_key_passwd, int private_key_passwd_len); 42 | void wifi_station_clear_enterprise_cert_key(void); 43 | 44 | int wifi_station_set_enterprise_ca_cert(u8 *ca_cert, int ca_cert_len); 45 | void wifi_station_clear_enterprise_ca_cert(void); 46 | 47 | int wifi_station_set_enterprise_identity(u8 *identity, int len); 48 | void wifi_station_clear_enterprise_identity(void); 49 | 50 | int wifi_station_set_enterprise_username(u8 *username, int len); 51 | void wifi_station_clear_enterprise_username(void); 52 | 53 | int wifi_station_set_enterprise_password(u8 *password, int len); 54 | void wifi_station_clear_enterprise_password(void); 55 | 56 | int wifi_station_set_enterprise_new_password(u8 *new_password, int len); 57 | void wifi_station_clear_enterprise_new_password(void); 58 | 59 | void wifi_station_set_enterprise_disable_time_check(bool disable); 60 | bool wifi_station_get_enterprise_disable_time_check(void); 61 | 62 | void wpa2_enterprise_set_user_get_time(get_time_func_t cb); 63 | 64 | 65 | #endif /* __WPA2_ENTERPRISE_H__ */ 66 | -------------------------------------------------------------------------------- /include/json/json.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2012, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the Contiki operating system. 30 | */ 31 | 32 | /** 33 | * \file 34 | * A few JSON defines used for parsing and generating JSON. 35 | * \author 36 | * Niclas Finne 37 | * Joakim Eriksson 38 | */ 39 | 40 | #ifndef __JSON_H__ 41 | #define __JSON_H__ 42 | 43 | #define JSON_TYPE_ARRAY '[' 44 | #define JSON_TYPE_OBJECT '{' 45 | #define JSON_TYPE_PAIR ':' 46 | #define JSON_TYPE_PAIR_NAME 'N' /* for N:V pairs */ 47 | #define JSON_TYPE_STRING '"' 48 | #define JSON_TYPE_INT 'I' 49 | #define JSON_TYPE_NUMBER '0' 50 | #define JSON_TYPE_ERROR 0 51 | 52 | /* how should we handle null vs false - both can be 0? */ 53 | #define JSON_TYPE_NULL 'n' 54 | #define JSON_TYPE_TRUE 't' 55 | #define JSON_TYPE_FALSE 'f' 56 | 57 | #define JSON_TYPE_CALLBACK 'C' 58 | 59 | enum { 60 | JSON_ERROR_OK, 61 | JSON_ERROR_SYNTAX, 62 | JSON_ERROR_UNEXPECTED_ARRAY, 63 | JSON_ERROR_UNEXPECTED_END_OF_ARRAY, 64 | JSON_ERROR_UNEXPECTED_OBJECT, 65 | JSON_ERROR_UNEXPECTED_STRING 66 | }; 67 | 68 | #define JSON_CONTENT_TYPE "application/json" 69 | 70 | #endif /* __JSON_H__ */ 71 | -------------------------------------------------------------------------------- /tools/make_cert.py: -------------------------------------------------------------------------------- 1 | # 2 | # ESPRESSIF MIT License 3 | # 4 | # Copyright (c) 2016 5 | # 6 | # Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | # it is free of charge, to any person obtaining a copy of this software and associated 8 | # documentation files (the "Software"), to deal in the Software without restriction, including 9 | # without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | # and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | # to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all copies or 14 | # substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | # 23 | 24 | import os 25 | 26 | 27 | class Cert(object): 28 | def __init__(self, name, buff): 29 | self.name = name 30 | self.len = len(buff) 31 | self.buff = buff 32 | pass 33 | 34 | def __str__(self): 35 | out_str = ['\0']*32 36 | for i in range(len(self.name)): 37 | out_str[i] = self.name[i] 38 | out_str = "".join(out_str) 39 | out_str += str(chr(self.len & 0xFF)) 40 | out_str += str(chr((self.len & 0xFF00) >> 8)) 41 | out_str += self.buff 42 | return out_str 43 | pass 44 | 45 | 46 | def main(): 47 | cert_list = [] 48 | file_list = os.listdir(os.getcwd()) 49 | cert_file_list = [] 50 | for _file in file_list: 51 | pos = _file.find(".key_1024") 52 | if pos != -1: 53 | cert_file_list.append(_file[:pos]) 54 | 55 | pos = _file.find(".cer") 56 | if pos!= -1: 57 | cert_file_list.append(_file[:pos]) 58 | 59 | for cert_file in cert_file_list: 60 | if cert_file == 'private_key': 61 | with open(cert_file+".key_1024", 'rb') as f: 62 | buff = f.read() 63 | cert_list.append(Cert(cert_file, buff)) 64 | 65 | if cert_file == 'certificate': 66 | with open(cert_file+".cer", 'rb') as f: 67 | buff = f.read() 68 | cert_list.append(Cert(cert_file, buff)) 69 | 70 | with open('esp_cert_private_key.bin', 'wb+') as f: 71 | for _cert in cert_list: 72 | f.write("%s" % _cert) 73 | pass 74 | if __name__ == '__main__': 75 | main() 76 | 77 | -------------------------------------------------------------------------------- /driver_lib/include/driver/spi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef SPI_APP_H 26 | #define SPI_APP_H 27 | 28 | #include "spi_register.h" 29 | #include "ets_sys.h" 30 | #include "osapi.h" 31 | #include "uart.h" 32 | #include "os_type.h" 33 | #include "spi_flash.h" 34 | 35 | #define SPI_FLASH_BYTES_LEN 24 36 | #define IODATA_START_ADDR BIT0 37 | #define SPI_BUFF_BYTE_NUM 32 38 | 39 | /*SPI number define*/ 40 | #define SPI 0 41 | #define HSPI 1 42 | 43 | void cache_flush(void); 44 | //spi master init funtion 45 | void spi_master_init(uint8_t spi_no); 46 | 47 | //lcd drive function 48 | void spi_lcd_9bit_write(uint8_t spi_no, uint8_t high_bit, uint8_t low_8bit); 49 | //use spi send 8bit data 50 | void spi_mast_byte_write(uint8_t spi_no, uint8_t data); 51 | 52 | //transmit data to esp8266 slave buffer,which needs 16bit transmission , 53 | //first byte is master command 0x04, second byte is master data 54 | void spi_byte_write_espslave(uint8_t spi_no, uint8_t data); 55 | //read data from esp8266 slave buffer,which needs 16bit transmission , 56 | //first byte is master command 0x06, second byte is to read slave data 57 | void spi_byte_read_espslave(uint8_t spi_no, uint8_t *data); 58 | 59 | //esp8266 slave mode initial 60 | void spi_slave_init(uint8_t spi_no, uint8_t data_len); 61 | //esp8266 slave isr handle funtion,tiggered when any transmission is finished. 62 | //the function is registered in spi_slave_init. 63 | void spi_slave_isr_handler(void *para); 64 | 65 | 66 | //hspi test function, used to test esp8266 spi slave 67 | void hspi_master_readwrite_repeat(void); 68 | 69 | 70 | void spi_test_init(void); 71 | 72 | 73 | #endif 74 | 75 | -------------------------------------------------------------------------------- /driver_lib/driver/gpio16.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ESPRESSIF MIT License 3 | * 4 | * Copyright (c) 2016 5 | * 6 | * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, 7 | * it is free of charge, to any person obtaining a copy of this software and associated 8 | * documentation files (the "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished 11 | * to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or 14 | * substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #include "ets_sys.h" 26 | #include "osapi.h" 27 | #include "driver/gpio16.h" 28 | 29 | void ICACHE_FLASH_ATTR 30 | gpio16_output_conf(void) 31 | { 32 | WRITE_PERI_REG(PAD_XPD_DCDC_CONF, 33 | (READ_PERI_REG(PAD_XPD_DCDC_CONF) & 0xffffffbc) | (uint32_t)0x1); // mux configuration for XPD_DCDC to output rtc_gpio0 34 | 35 | WRITE_PERI_REG(RTC_GPIO_CONF, 36 | (READ_PERI_REG(RTC_GPIO_CONF) & (uint32_t)0xfffffffe) | (uint32_t)0x0); //mux configuration for out enable 37 | 38 | WRITE_PERI_REG(RTC_GPIO_ENABLE, 39 | (READ_PERI_REG(RTC_GPIO_ENABLE) & (uint32_t)0xfffffffe) | (uint32_t)0x1); //out enable 40 | } 41 | 42 | void ICACHE_FLASH_ATTR 43 | gpio16_output_set(uint8_t value) 44 | { 45 | WRITE_PERI_REG(RTC_GPIO_OUT, 46 | (READ_PERI_REG(RTC_GPIO_OUT) & (uint32_t)0xfffffffe) | (uint32_t)(value & 1)); 47 | } 48 | 49 | void ICACHE_FLASH_ATTR 50 | gpio16_input_conf(void) 51 | { 52 | WRITE_PERI_REG(PAD_XPD_DCDC_CONF, 53 | (READ_PERI_REG(PAD_XPD_DCDC_CONF) & 0xffffffbc) | (uint32_t)0x1); // mux configuration for XPD_DCDC and rtc_gpio0 connection 54 | 55 | WRITE_PERI_REG(RTC_GPIO_CONF, 56 | (READ_PERI_REG(RTC_GPIO_CONF) & (uint32_t)0xfffffffe) | (uint32_t)0x0); //mux configuration for out enable 57 | 58 | WRITE_PERI_REG(RTC_GPIO_ENABLE, 59 | READ_PERI_REG(RTC_GPIO_ENABLE) & (uint32_t)0xfffffffe); //out disable 60 | } 61 | 62 | uint8_t ICACHE_FLASH_ATTR 63 | gpio16_input_get(void) 64 | { 65 | return (uint8_t)(READ_PERI_REG(RTC_GPIO_IN_DATA) & 1); 66 | } 67 | -------------------------------------------------------------------------------- /third_party/include/lwip/app/espconn_udp.h: -------------------------------------------------------------------------------- 1 | #ifndef __ESPCONN_UDP_H__ 2 | #define __ESPCONN_UDP_H__ 3 | 4 | #ifndef ESPCONN_UDP_DEBUG 5 | #define ESPCONN_UDP_DEBUG LWIP_DBG_OFF 6 | #endif 7 | 8 | #include "lwip/app/espconn.h" 9 | 10 | /****************************************************************************** 11 | * FunctionName : espconn_udp_client 12 | * Description : Initialize the client: set up a PCB and bind it to the port 13 | * Parameters : pespconn -- the espconn used to build client 14 | * Returns : none 15 | *******************************************************************************/ 16 | 17 | extern sint8 espconn_udp_client(struct espconn *pespconn); 18 | 19 | /****************************************************************************** 20 | * FunctionName : espconn_udp_disconnect 21 | * Description : A new incoming connection has been disconnected. 22 | * Parameters : espconn -- the espconn used to disconnect with host 23 | * Returns : none 24 | *******************************************************************************/ 25 | 26 | extern void espconn_udp_disconnect(espconn_msg *pdiscon); 27 | 28 | /****************************************************************************** 29 | * FunctionName : espconn_udp_server 30 | * Description : Initialize the server: set up a PCB and bind it to the port 31 | * Parameters : pespconn -- the espconn used to build server 32 | * Returns : none 33 | *******************************************************************************/ 34 | 35 | extern sint8 espconn_udp_server(struct espconn *espconn); 36 | 37 | /****************************************************************************** 38 | * FunctionName : espconn_udp_sent 39 | * Description : sent data for client or server 40 | * Parameters : void *arg -- client or server to send 41 | * uint8* psent -- Data to send 42 | * uint16 length -- Length of data to send 43 | * Returns : none 44 | *******************************************************************************/ 45 | 46 | extern err_t espconn_udp_sent(void *arg, uint8 *psent, uint16 length); 47 | 48 | /****************************************************************************** 49 | * FunctionName : espconn_udp_sendto 50 | * Description : sent data for UDP 51 | * Parameters : void *arg -- UDP to send 52 | * uint8* psent -- Data to send 53 | * uint16 length -- Length of data to send 54 | * Returns : return espconn error code. 55 | * - ESPCONN_OK. Successful. No error occured. 56 | * - ESPCONN_MEM. Out of memory. 57 | * - ESPCONN_RTE. Could not find route to destination address. 58 | * - More errors could be returned by lower protocol layers. 59 | *******************************************************************************/ 60 | extern err_t espconn_udp_sendto(void *arg, uint8 *psent, uint16 length); 61 | 62 | #endif /* __ESPCONN_UDP_H__ */ 63 | 64 | 65 | -------------------------------------------------------------------------------- /third_party/include/mbedtls/entropy_poll.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file entropy_poll.h 3 | * 4 | * \brief Platform-specific and custom entropy polling functions 5 | * 6 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 7 | * SPDX-License-Identifier: Apache-2.0 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | * not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * This file is part of mbed TLS (https://tls.mbed.org) 22 | */ 23 | #ifndef MBEDTLS_ENTROPY_POLL_H 24 | #define MBEDTLS_ENTROPY_POLL_H 25 | 26 | #if !defined(MBEDTLS_CONFIG_FILE) 27 | #include "config.h" 28 | #else 29 | #include MBEDTLS_CONFIG_FILE 30 | #endif 31 | 32 | #include 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /* 39 | * Default thresholds for built-in sources, in bytes 40 | */ 41 | #define MBEDTLS_ENTROPY_MIN_PLATFORM 32 /**< Minimum for platform source */ 42 | #define MBEDTLS_ENTROPY_MIN_HAVEGE 32 /**< Minimum for HAVEGE */ 43 | #define MBEDTLS_ENTROPY_MIN_HARDCLOCK 4 /**< Minimum for mbedtls_timing_hardclock() */ 44 | #define MBEDTLS_ENTROPY_MIN_HARDWARE 32 /**< Minimum for the hardware source */ 45 | 46 | #if !defined(MBEDTLS_NO_PLATFORM_ENTROPY) 47 | /** 48 | * \brief Platform-specific entropy poll callback 49 | */ 50 | int mbedtls_platform_entropy_poll( void *data, 51 | unsigned char *output, size_t len, size_t *olen ); 52 | #endif 53 | 54 | #if defined(MBEDTLS_HAVEGE_C) 55 | /** 56 | * \brief HAVEGE based entropy poll callback 57 | * 58 | * Requires an HAVEGE state as its data pointer. 59 | */ 60 | int mbedtls_havege_poll( void *data, 61 | unsigned char *output, size_t len, size_t *olen ); 62 | #endif 63 | 64 | #if defined(MBEDTLS_TIMING_C) 65 | /** 66 | * \brief mbedtls_timing_hardclock-based entropy poll callback 67 | */ 68 | int mbedtls_hardclock_poll( void *data, 69 | unsigned char *output, size_t len, size_t *olen ); 70 | #endif 71 | 72 | #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT) 73 | /** 74 | * \brief Entropy poll callback for a hardware source 75 | * 76 | * \warning This is not provided by mbed TLS! 77 | * See \c MBEDTLS_ENTROPY_HARDWARE_ALT in config.h. 78 | * 79 | * \note This must accept NULL as its first argument. 80 | */ 81 | int mbedtls_hardware_poll( void *data, 82 | unsigned char *output, size_t len, size_t *olen ); 83 | #endif 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /* entropy_poll.h */ 90 | -------------------------------------------------------------------------------- /examples/esp_mqtt_proj/include/mqtt_config.h: -------------------------------------------------------------------------------- 1 | #ifndef __MQTT_CONFIG_H__ 2 | #define __MQTT_CONFIG_H__ 3 | 4 | typedef enum{ 5 | NO_TLS = 0, // 0: disable SSL/TLS, there must be no certificate verify between MQTT server and ESP8266 6 | TLS_WITHOUT_AUTHENTICATION = 1, // 1: enable SSL/TLS, but there is no a certificate verify 7 | ONE_WAY_ANTHENTICATION = 2, // 2: enable SSL/TLS, ESP8266 would verify the SSL server certificate at the same time 8 | TWO_WAY_ANTHENTICATION = 3, // 3: enable SSL/TLS, ESP8266 would verify the SSL server certificate and SSL server would verify ESP8266 certificate 9 | }TLS_LEVEL; 10 | 11 | 12 | /*IMPORTANT: the following configuration maybe need modified*/ 13 | /***********************************************************************************************************************/ 14 | #define CFG_HOLDER 0x00FF55A4 /* Change this value to load default configurations */ 15 | 16 | /*DEFAULT CONFIGURATIONS*/ 17 | 18 | #define MQTT_HOST "192.168.1.100" // the IP address or domain name of your MQTT server or MQTT broker ,such as "mqtt.yourdomain.com" 19 | #define MQTT_PORT 1883 // the listening port of your MQTT server or MQTT broker 20 | #define MQTT_CLIENT_ID "Device_ID" // the ID of yourself, any string is OK,client would use this ID register itself to MQTT server 21 | #define MQTT_USER "Device_Name" // your MQTT login name, if MQTT server allow anonymous login,any string is OK, otherwise, please input valid login name which you had registered 22 | #define MQTT_PASS "Device_Passwd" // you MQTT login password, same as above 23 | #define STA_SSID "AP_SSID" // your AP/router SSID to config your device networking 24 | #define STA_PASS "AP_Passwd" // your AP/router password 25 | 26 | #define DEFAULT_SECURITY NO_TLS // very important: you must config DEFAULT_SECURITY for SSL/TLS 27 | 28 | #define CA_CERT_FLASH_ADDRESS 0x77 // CA certificate address in flash to read, 0x77 means address 0x77000 29 | #define CLIENT_CERT_FLASH_ADDRESS 0x78 // client certificate and private key address in flash to read, 0x78 means address 0x78000 30 | /***********************************************************************************************************************/ 31 | 32 | 33 | /*Please Keep the following configuration if you have no very deep understanding of ESP SSL/TLS*/ 34 | #define CFG_LOCATION 0x79 /* Please don't change or if you know what you doing */ 35 | #define MQTT_BUF_SIZE 1024 36 | #define MQTT_KEEPALIVE 120 /*second*/ 37 | #define MQTT_RECONNECT_TIMEOUT 5 /*second*/ 38 | #define MQTT_SSL_ENABLE //* Please don't change or if you know what you doing */ 39 | 40 | #define STA_TYPE AUTH_WPA2_PSK 41 | #define QUEUE_BUFFER_SIZE 2048 42 | 43 | #define PROTOCOL_NAMEv31 /*MQTT version 3.1 compatible with Mosquitto v0.15*/ 44 | //PROTOCOL_NAMEv311 /*MQTT version 3.11 compatible with https://eclipse.org/paho/clients/testing/*/ 45 | 46 | #endif // __MQTT_CONFIG_H__ 47 | -------------------------------------------------------------------------------- /third_party/include/ssl/ssl_cert.h: -------------------------------------------------------------------------------- 1 | unsigned char default_certificate[] = { 2 | 0x30, 0x82, 0x01, 0xd7, 0x30, 0x82, 0x01, 0x40, 0x02, 0x09, 0x00, 0xab, 3 | 0x08, 0x18, 0xa7, 0x03, 0x07, 0x27, 0xfd, 0x30, 0x0d, 0x06, 0x09, 0x2a, 4 | 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x34, 5 | 0x31, 0x32, 0x30, 0x30, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x29, 0x61, 6 | 0x78, 0x54, 0x4c, 0x53, 0x20, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 7 | 0x20, 0x44, 0x6f, 0x64, 0x67, 0x79, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 8 | 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 9 | 0x72, 0x69, 0x74, 0x79, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, 0x31, 0x32, 10 | 0x32, 0x36, 0x32, 0x32, 0x33, 0x33, 0x33, 0x39, 0x5a, 0x17, 0x0d, 0x32, 11 | 0x34, 0x30, 0x39, 0x30, 0x33, 0x32, 0x32, 0x33, 0x33, 0x33, 0x39, 0x5a, 12 | 0x30, 0x2c, 0x31, 0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 13 | 0x0d, 0x61, 0x78, 0x54, 0x4c, 0x53, 0x20, 0x50, 0x72, 0x6f, 0x6a, 0x65, 14 | 0x63, 0x74, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 15 | 0x09, 0x31, 0x32, 0x37, 0x2e, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x81, 16 | 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 17 | 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 18 | 0x81, 0x81, 0x00, 0xcd, 0xfd, 0x89, 0x48, 0xbe, 0x36, 0xb9, 0x95, 0x76, 19 | 0xd4, 0x13, 0x30, 0x0e, 0xbf, 0xb2, 0xed, 0x67, 0x0a, 0xc0, 0x16, 0x3f, 20 | 0x51, 0x09, 0x9d, 0x29, 0x2f, 0xb2, 0x6d, 0x3f, 0x3e, 0x6c, 0x2f, 0x90, 21 | 0x80, 0xa1, 0x71, 0xdf, 0xbe, 0x38, 0xc5, 0xcb, 0xa9, 0x9a, 0x40, 0x14, 22 | 0x90, 0x0a, 0xf9, 0xb7, 0x07, 0x0b, 0xe1, 0xda, 0xe7, 0x09, 0xbf, 0x0d, 23 | 0x57, 0x41, 0x86, 0x60, 0xa1, 0xc1, 0x27, 0x91, 0x5b, 0x0a, 0x98, 0x46, 24 | 0x1b, 0xf6, 0xa2, 0x84, 0xf8, 0x65, 0xc7, 0xce, 0x2d, 0x96, 0x17, 0xaa, 25 | 0x91, 0xf8, 0x61, 0x04, 0x50, 0x70, 0xeb, 0xb4, 0x43, 0xb7, 0xdc, 0x9a, 26 | 0xcc, 0x31, 0x01, 0x14, 0xd4, 0xcd, 0xcc, 0xc2, 0x37, 0x6d, 0x69, 0x82, 27 | 0xd6, 0xc6, 0xc4, 0xbe, 0xf2, 0x34, 0xa5, 0xc9, 0xa6, 0x19, 0x53, 0x32, 28 | 0x7a, 0x86, 0x0e, 0x91, 0x82, 0x0f, 0xa1, 0x42, 0x54, 0xaa, 0x01, 0x02, 29 | 0x03, 0x01, 0x00, 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 30 | 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x40, 31 | 0xb4, 0x94, 0x9a, 0xa8, 0x89, 0x72, 0x1d, 0x07, 0xe5, 0xb3, 0x6b, 0x88, 32 | 0x21, 0xc2, 0x38, 0x36, 0x9e, 0x7a, 0x8c, 0x49, 0x48, 0x68, 0x0c, 0x06, 33 | 0xe8, 0xdb, 0x1f, 0x4e, 0x05, 0xe6, 0x31, 0xe3, 0xfd, 0xe6, 0x0d, 0x6b, 34 | 0xd8, 0x13, 0x17, 0xe0, 0x2d, 0x0d, 0xb8, 0x7e, 0xcb, 0x20, 0x6c, 0xa8, 35 | 0x73, 0xa7, 0xfd, 0xe3, 0xa7, 0xfa, 0xf3, 0x02, 0x60, 0x78, 0x1f, 0x13, 36 | 0x40, 0x45, 0xee, 0x75, 0xf5, 0x10, 0xfd, 0x8f, 0x68, 0x74, 0xd4, 0xac, 37 | 0xae, 0x04, 0x09, 0x55, 0x2c, 0xdb, 0xd8, 0x07, 0x07, 0x65, 0x69, 0x27, 38 | 0x6e, 0xbf, 0x5e, 0x61, 0x40, 0x56, 0x8b, 0xd7, 0x33, 0x3b, 0xff, 0x6e, 39 | 0x53, 0x7e, 0x9d, 0x3f, 0xc0, 0x40, 0x3a, 0xab, 0xa0, 0x50, 0x4e, 0x80, 40 | 0x47, 0x46, 0x0d, 0x1e, 0xdb, 0x4c, 0xf1, 0x1b, 0x5d, 0x3c, 0x2a, 0x54, 41 | 0xa7, 0x4d, 0xfa, 0x7b, 0x72, 0x66, 0xc5 42 | }; 43 | unsigned int default_certificate_len = 475; 44 | --------------------------------------------------------------------------------