diff --git a/.gitignore b/.gitignore index f61a9a6d4a..998ac8f419 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,10 @@ build/windows/launcher/launch4j build/windows/WinAVR-*.zip hardware/arduino/avr/libraries/Bridge/examples/XivelyClient/passwords.h avr-toolchain-*.zip +/hardware/tools/esp8266/utils/ +/hardware/tools/esp8266/xtensa-lx106-elf +/hardware/tools/esp8266/esptool.exe +/hardware/tools/avr/ +/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/ +/hardware/tools/bossac.exe +/hardware/tools/listComPorts.exe diff --git a/README.md b/README.md index ad1c571f8d..61ff9be15a 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,6 @@ more than 20 milliseconds is not recommended. ```Serial``` object works much the same way as on a regular Arduino. Apart from hardware FIFO (128 bytes for TX and RX) HardwareSerial has additional 256-byte TX and RX buffers. Both transmit and receive is interrupt-driven. Write and read functions only block the sketch execution when the respective FIFO/buffers are full/empty. -Only 8n1 mode is supported right now. - By default the diagnostic output from WiFi libraries is disabled when you call ```Serial.begin```. To enable debug output again, call ```Serial.setDebugOutput(true);``` #### WiFi(ESP8266WiFi library) #### diff --git a/app/src/processing/app/AbstractMonitor.java b/app/src/processing/app/AbstractMonitor.java index 146a8c25e2..03a438f5de 100644 --- a/app/src/processing/app/AbstractMonitor.java +++ b/app/src/processing/app/AbstractMonitor.java @@ -135,7 +135,7 @@ public void actionPerformed(ActionEvent event) { String[] serialRateStrings = { "300", "1200", "2400", "4800", "9600", - "19200", "38400", "57600", "115200" + "19200", "38400", "57600", "74880", "115200" }; serialRates = new JComboBox(); diff --git a/build/build.xml b/build/build.xml index 6ec61ff44c..967c24431b 100644 --- a/build/build.xml +++ b/build/build.xml @@ -47,6 +47,9 @@ + + + @@ -729,30 +732,6 @@ - - - @@ -935,15 +914,21 @@ dir="windows/work" spawn="true"/> - + - - - - - - + + + + + + + + + + + + + #include +#include "stdlib_noniso.h" #include "binary.h" #include "pgmspace.h" - - void yield(void); #define HIGH 0x1 @@ -46,6 +45,7 @@ void yield(void); #define INPUT 0x0 #define OUTPUT 0x1 #define INPUT_PULLUP 0x2 +#define INPUT_PULLDOWN 0x3 #define OUTPUT_OPEN_DRAIN 0x4 #define PI 3.1415926535897932384626433832795 diff --git a/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp b/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp index da84aeb24e..3d70d61fe1 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp +++ b/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp @@ -24,9 +24,11 @@ extern "C" { #include "user_interface.h" } -extern "C" void ets_wdt_enable (void); -extern "C" void ets_wdt_disable (void); -extern "C" void wdt_feed (void); + +//extern "C" void ets_wdt_init(uint32_t val); +extern "C" void ets_wdt_enable(void); +extern "C" void ets_wdt_disable(void); +extern "C" void wdt_feed(void); EspClass ESP; @@ -35,11 +37,17 @@ EspClass::EspClass() } -void EspClass::wdtEnable(int) +void EspClass::wdtEnable(uint32_t timeout_ms) { + //todo find doku for ets_wdt_init may set the timeout ets_wdt_enable(); } +void EspClass::wdtEnable(WDTO_t timeout_ms) +{ + wdtEnable((uint32_t) timeout_ms); +} + void EspClass::wdtDisable(void) { ets_wdt_disable(); @@ -70,3 +78,33 @@ uint16_t EspClass::getVCC(void) { return system_get_vdd33(); } + +uint32_t EspClass::getFreeHeap(void) +{ + return system_get_free_heap_size(); +} + +uint32_t EspClass::getChipId(void) +{ + return system_get_chip_id(); +} + +const char * EspClass::getSDKversion(void) +{ + return system_get_sdk_version(); +} + +uint8_t EspClass::getBootVersion(void) +{ + return system_get_boot_version(); +} + +uint8_t EspClass::getBootMode(void) +{ + return system_get_boot_mode(); +} + +uint8_t EspClass::getCPUfreqMHz(void) +{ + return system_get_cpu_freq(); +} diff --git a/hardware/esp8266com/esp8266/cores/esp8266/Esp.h b/hardware/esp8266com/esp8266/cores/esp8266/Esp.h index b3ff106da6..f4d6b652b1 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/Esp.h +++ b/hardware/esp8266com/esp8266/cores/esp8266/Esp.h @@ -20,7 +20,27 @@ #ifndef ESP_H #define ESP_H +/** + * AVR macros for WDT managment + */ +typedef enum { + WDTO_0MS = 0, //!< WDTO_0MS + WDTO_15MS = 15, //!< WDTO_15MS + WDTO_30MS = 30, //!< WDTO_30MS + WDTO_60MS = 60, //!< WDTO_60MS + WDTO_120MS = 120, //!< WDTO_120MS + WDTO_250MS = 250, //!< WDTO_250MS + WDTO_500MS = 500, //!< WDTO_500MS + WDTO_1S = 1000,//!< WDTO_1S + WDTO_2S = 2000,//!< WDTO_2S + WDTO_4S = 4000,//!< WDTO_4S + WDTO_8S = 8000 //!< WDTO_8S +} WDTO_t; + +#define wdt_enable(time) ESP.wdtEnable(time) +#define wdt_disable() ESP.wdtDisable() +#define wdt_reset() ESP.wdtFeed() enum WakeMode { WAKE_RF_DEFAULT = 0, // RF_CAL or not after deep-sleep wake up, depends on init data byte 108. @@ -33,8 +53,10 @@ class EspClass { public: EspClass(); - void wdtEnable(int timeout_ms = 0); // TODO: figure out how to set WDT timeout + void wdtEnable(uint32_t timeout_ms = 0); + void wdtEnable(WDTO_t timeout_ms = WDTO_0MS); + void wdtDisable(void); void wdtFeed(void); @@ -44,6 +66,17 @@ class EspClass { void reset(void); void restart(void); uint16_t getVCC(void); + uint32_t getFreeHeap(void); + + uint32_t getChipId(void); + + const char * getSDKversion(void); + + uint8_t getBootVersion(void); + uint8_t getBootMode(void); + + uint8_t getCPUfreqMHz(void); + }; extern EspClass ESP; diff --git a/hardware/esp8266com/esp8266/cores/esp8266/HardwareSerial.cpp b/hardware/esp8266com/esp8266/cores/esp8266/HardwareSerial.cpp index 17bf697463..46a9c28f36 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/HardwareSerial.cpp +++ b/hardware/esp8266com/esp8266/cores/esp8266/HardwareSerial.cpp @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Modified 31 March 2015 by Markus Sattler (rewrite the code for UART0 + UART1 support in ESP8266) - + Modified 25 April 2015 by Thomas Flayols (add configuration different from 8N1 in ESP8266) */ #include @@ -86,7 +86,7 @@ void uart_disarm_tx_interrupt(uart_t* uart); void uart_set_baudrate(uart_t* uart, int baud_rate); int uart_get_baudrate(uart_t* uart); -uart_t* uart_init(UARTnr_t uart_nr, int baudrate); +uart_t* uart_init(UARTnr_t uart_nr, int baudrate, byte config); void uart_uninit(uart_t* uart); void uart_swap(uart_t* uart); @@ -101,7 +101,7 @@ UARTnr_t uart_get_debug(); // #################################################################################################### // #################################################################################################### -void ICACHE_FLASH_ATTR uart_interrupt_handler(uart_t* uart) { +void uart_interrupt_handler(uart_t* uart) { // -------------- UART 0 -------------- uint32_t status = READ_PERI_REG(UART_INT_ST(0)); @@ -278,7 +278,7 @@ int ICACHE_FLASH_ATTR uart_get_baudrate(uart_t* uart) { return uart->baud_rate; } -uart_t* ICACHE_FLASH_ATTR uart_init(UARTnr_t uart_nr, int baudrate) { +uart_t* ICACHE_FLASH_ATTR uart_init(UARTnr_t uart_nr, int baudrate, byte config) { uint32_t conf1 = 0x00000000; uart_t* uart = (uart_t*) os_malloc(sizeof(uart_t)); @@ -314,7 +314,7 @@ uart_t* ICACHE_FLASH_ATTR uart_init(UARTnr_t uart_nr, int baudrate) { break; } uart_set_baudrate(uart, baudrate); - WRITE_PERI_REG(UART_CONF0(uart->uart_nr), 0x3 << UART_BIT_NUM_S); // 8n1 + WRITE_PERI_REG(UART_CONF0(uart->uart_nr), config); uart_flush(uart); uart_interrupt_enable(uart); @@ -453,7 +453,7 @@ void ICACHE_FLASH_ATTR uart1_write_char(char c) { } } -static UARTnr_t s_uart_debug_nr = UART_NO; +static UARTnr_t s_uart_debug_nr = UART0; void ICACHE_FLASH_ATTR uart_set_debug(UARTnr_t uart_nr) { s_uart_debug_nr = uart_nr; switch(s_uart_debug_nr) { @@ -493,7 +493,7 @@ void ICACHE_FLASH_ATTR HardwareSerial::begin(unsigned long baud, byte config) { uart_set_debug(UART_NO); } - _uart = uart_init(_uart_nr, baud); + _uart = uart_init(_uart_nr, baud, config); if(_uart == 0) { return; diff --git a/hardware/esp8266com/esp8266/cores/esp8266/HardwareSerial.h b/hardware/esp8266com/esp8266/cores/esp8266/HardwareSerial.h index b8387c8bfa..56c20fa43d 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/HardwareSerial.h +++ b/hardware/esp8266com/esp8266/cores/esp8266/HardwareSerial.h @@ -21,6 +21,7 @@ Modified 3 December 2013 by Matthijs Kooijman Modified 18 December 2014 by Ivan Grokhotkov (esp8266 platform support) Modified 31 March 2015 by Markus Sattler (rewrite the code for UART0 + UART1 support in ESP8266) + Modified 25 April 2015 by Thomas Flayols (add configuration different from 8N1 in ESP8266) */ #ifndef HardwareSerial_h @@ -33,31 +34,31 @@ #define SERIAL_TX_BUFFER_SIZE 256 #define SERIAL_RX_BUFFER_SIZE 256 -// // Define config for Serial.begin(baud, config); -// #define SERIAL_5N1 0x00 -// #define SERIAL_6N1 0x02 -// #define SERIAL_7N1 0x04 -// #define SERIAL_8N1 0x06 -// #define SERIAL_5N2 0x08 -// #define SERIAL_6N2 0x0A -// #define SERIAL_7N2 0x0C -// #define SERIAL_8N2 0x0E -// #define SERIAL_5E1 0x20 -// #define SERIAL_6E1 0x22 -// #define SERIAL_7E1 0x24 -// #define SERIAL_8E1 0x26 -// #define SERIAL_5E2 0x28 -// #define SERIAL_6E2 0x2A -// #define SERIAL_7E2 0x2C -// #define SERIAL_8E2 0x2E -// #define SERIAL_5O1 0x30 -// #define SERIAL_6O1 0x32 -// #define SERIAL_7O1 0x34 -// #define SERIAL_8O1 0x36 -// #define SERIAL_5O2 0x38 -// #define SERIAL_6O2 0x3A -// #define SERIAL_7O2 0x3C -// #define SERIAL_8O2 0x3E +// Define config for Serial.begin(baud, config); +#define SERIAL_5N1 0x10 +#define SERIAL_6N1 0x14 +#define SERIAL_7N1 0x18 +#define SERIAL_8N1 0x1c +#define SERIAL_5N2 0x30 +#define SERIAL_6N2 0x34 +#define SERIAL_7N2 0x38 +#define SERIAL_8N2 0x3c +#define SERIAL_5E1 0x12 +#define SERIAL_6E1 0x16 +#define SERIAL_7E1 0x1a +#define SERIAL_8E1 0x1e +#define SERIAL_5E2 0x32 +#define SERIAL_6E2 0x36 +#define SERIAL_7E2 0x3a +#define SERIAL_8E2 0x3e +#define SERIAL_5O1 0x13 +#define SERIAL_6O1 0x17 +#define SERIAL_7O1 0x1b +#define SERIAL_8O1 0x1f +#define SERIAL_5O2 0x33 +#define SERIAL_6O2 0x37 +#define SERIAL_7O2 0x3b +#define SERIAL_8O2 0x3f class cbuf; @@ -79,7 +80,7 @@ class HardwareSerial: public Stream { HardwareSerial(UARTnr_t uart_nr); void begin(unsigned long baud) { - begin(baud, 0); + begin(baud, SERIAL_8N1); } void begin(unsigned long, uint8_t); void end(); diff --git a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c index ab17f7ef3d..ca63d01ac5 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c +++ b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c @@ -81,7 +81,12 @@ extern void __pinMode(uint8_t pin, uint8_t mode) { PIN_PULLUP_DIS(mux); } else if(mode == INPUT_PULLUP) { gpio_output_set(0, 0, 0, 1 << pin); + PIN_PULLDWN_DIS(mux); PIN_PULLUP_EN(mux); + } else if(mode == INPUT_PULLDOWN) { + gpio_output_set(0, 0, 0, 1 << pin); + PIN_PULLUP_DIS(mux); + PIN_PULLDWN_EN(mux); } else if(mode == OUTPUT) { gpio_output_set(0, 0, 1 << pin, 0); } else if(mode == OUTPUT_OPEN_DRAIN) { diff --git a/hardware/esp8266com/esp8266/cores/esp8266/libc_replacements.c b/hardware/esp8266com/esp8266/cores/esp8266/libc_replacements.c index f8a941506a..0554184d5b 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/libc_replacements.c +++ b/hardware/esp8266com/esp8266/cores/esp8266/libc_replacements.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "ets_sys.h" #include "os_type.h" @@ -115,6 +116,13 @@ char* strncpy(char * dest, const char * src, size_t n) { return ets_strncpy(dest, src, n); } +size_t strnlen(const char *s, size_t len) { + // there is no ets_strnlen + const char *cp; + for (cp = s; len != 0 && *cp != '\0'; cp++, len--); + return (size_t)(cp - s); +} + char* strstr(const char *haystack, const char *needle) { return ets_strstr(haystack, needle); } diff --git a/hardware/esp8266com/esp8266/cores/esp8266/pgmspace.h b/hardware/esp8266com/esp8266/cores/esp8266/pgmspace.h index 4b0b0dd728..506c8f8d35 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/pgmspace.h +++ b/hardware/esp8266com/esp8266/cores/esp8266/pgmspace.h @@ -1,14 +1,24 @@ #ifndef __PGMSPACE_H_ #define __PGMSPACE_H_ +#ifdef __cplusplus +extern "C" { +#endif #include +#include +#include "ets_sys.h" +#include "osapi.h" +#ifdef __cplusplus +} +#endif #define PROGMEM #define PGM_P const char * #define PSTR(str) (str) -#define vsnprintf_P(...) vsnprintf( __VA_ARGS__ ) +#define vsnprintf_P(...) ets_vsnprintf( __VA_ARGS__ ) #define snprintf_P(...) snprintf( __VA_ARGS__ ) +#define printf_P(...) os_printf(__VA_ARGS__) #define _SFR_BYTE(n) (n) @@ -28,6 +38,12 @@ typedef uint32_t prog_uint32_t; #define strcmp_P(a, b) strcmp((a), (b)) #define strstr_P(a, b) strstr((a), (b)) #define strlen_P(s) strlen((const char *)(s)) +#define strcasecmp_P(a, b) strcasecmp((a), (b)) +#define strncpy_P(dest, src, size) strncpy((dest), (src), (size)) +#define strncat_P(dest, src, size) strncat((dest), (src), (size)) +#define strncmp_P(a, b, size) strncmp((a), (b), (size)) +#define strnlen_P(s, size) strnlen((const char *)(s), (size)) +#define strncasecmp_P(a, b, size) strncasecmp((a), (b), (size)) #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) #define pgm_read_word(addr) (*(const unsigned short *)(addr)) diff --git a/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp b/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp index 2e27d53dcf..5fb4b4db82 100644 --- a/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp +++ b/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp @@ -143,6 +143,16 @@ void ESP8266WiFiClass::softAP(const char* ssid, const char* passphrase, int chan ETS_UART_INTR_ENABLE(); } +void ESP8266WiFiClass::softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet) +{ + struct ip_info info; + info.ip.addr = static_cast(local_ip); + info.gw.addr = static_cast(gateway); + info.netmask.addr = static_cast(subnet); + wifi_softap_dhcps_stop(); + wifi_set_ip_info(SOFTAP_IF, &info); + wifi_softap_dhcps_start(); +} uint8_t* ESP8266WiFiClass::macAddress(uint8_t* mac) { diff --git a/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.h b/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.h index 7267662db3..66f9e9dde2 100644 --- a/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.h +++ b/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.h @@ -83,6 +83,14 @@ class ESP8266WiFiClass */ void config(IPAddress local_ip, IPAddress gateway, IPAddress subnet); + /* Configure access point + * + * param local_ip: access point IP + * param gateway: gateway IP + * param subnet: subnet mask + */ + void softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet); + /* * Disconnect from the network * diff --git a/hardware/tools/esp8266/sdk/License b/hardware/tools/esp8266/sdk/License new file mode 100644 index 0000000000..dcd0fcc3c8 --- /dev/null +++ b/hardware/tools/esp8266/sdk/License @@ -0,0 +1,68 @@ +ESPRESSIF GENERAL PUBLIC LICENSE + +PREAMBLE + +The Espressif General Public License is a free, copyleft license for software and other kinds of works. +The Espressif General Public License is intended to guarantee your freedom to share and change all versions of a program released by ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD, to make sure it remains free software for all its users. We use the Espressif General Public License for all of our open-source software. +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. +Developers that use the Espressif GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. + +TERMS AND CONDITIONS + +0. Definitions. +¡°This License¡± refers to the Espressif Public License. + +¡°The Program¡± refers to any copyrightable work licensed under this License. Each licensee is addressed as ¡°you¡±. ¡°Licensees¡± and ¡°recipients¡± may be individuals or organizations. +To ¡°modify¡± a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a ¡°modified version¡± of the earlier work or a work ¡°based on¡± the earlier work. +A ¡°covered work¡± means either the unmodified Program or a work based on the Program. +To ¡°propagate¡± a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. +To ¡°convey¡± a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. +1. Basic Permissions. +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. +Conveying under any other circumstances is permitted solely under the conditions stated below. + +2. Protecting Users' Legal Rights From Anti-Circumvention Law. +No covered work shall be deemed part of an effective technological measure under any applicable law prohibiting or restricting circumvention of such measures. +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. + +3. Conveying Verbatim Copies. +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License applies to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. + +4. Conveying Modified Source Versions. +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 3, provided that you also meet all of these conditions: +a) The work must carry prominent notices stating that you modified it, and giving a relevant date. +b) The work must carry prominent notices stating that it is released under this License. This requirement modifies the requirement in section 3 to ¡°keep intact all notices¡±. +c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + +5. Termination. +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License. +However, if you cease all violation of this License, then your license is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license. +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 7. + +6. Acceptance Not Required for Having Copies. +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. + +7. Automatic Licensing of Downstream Recipients. +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +8. No Surrender of Others' Freedom. +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. +9. Revised Versions of this License. +ESPRESSIF SYSTEMS (SHANGHAI) PTE LED may publish revised and/or new versions of the ESPRESSIF General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the Espressif General Public License ¡°or any later version¡± applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD. If the Program does not specify a version number of the Espressif General Public License, you may choose any version ever published. + +10. Disclaimer of Warranty. +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ¡°AS IS¡± WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +11. Limitation of Liability. +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + +12. Interpretation of Sections 10 and 11. +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS diff --git a/hardware/tools/esp8266/sdk/changelog.txt b/hardware/tools/esp8266/sdk/changelog.txt new file mode 100644 index 0000000000..12e9aa55ef --- /dev/null +++ b/hardware/tools/esp8266/sdk/changelog.txt @@ -0,0 +1,267 @@ +esp_iot_sdk_v1.0.1_15_04_24 Release Note +------------------------------------------- + +Resolved Issues(Bugs below are eligible for Bug Bounty Program): +1. SSL connection may fail if SSL packet size larger than 2kBytes [PeteW ] +2. UDP remote IP to be 0.0.0.0 may cause reset [Jerry S] +3. Optimize wifi_get_ip_info to fix loss of wireless connectivity problem +4. Air-Kiss restart [Orgmar] + +Optimization: +1. Optimized IOT_Espressif_EspTouch.APK (apply for access from Espressif) for improved compatibility. [???] +2. TCP server can not open again immediately with the same port [624908539] +3. Update UART driver for parity bit value may be incorrect [1062583993] +4. Add define of “ICACHE_RODATA_ATTR” for Symbol 'ICACHE_RODATA_ATTR' could not be resolved. [???] +5. Add API wifi_softap_dhcps_set_offer_option to enable/disable ESP8266 softAP DHCP server default gateway. [xyz769] +6. AT register_uart_rx_intr may enter callback twice. [???] +7.optimize document that WPA password length range : 8 ~ 64 bytes [785057041] +8. ESP8266 softAP DHCP server record 8 DHCP client's IP at most [ygjeon] +9. To set static IP (wifi_set_ip_info) has to disable DHCP first(wifi_softap_dhcps_stop or wifi_station_dhcpc_stop) +10.Add example of wifi_softap_set_dhcps_lease +11. smartconfig_start can only be called in ESP8266 station mode + +Added APIs: +1. Wi-Fi related APIs: +wifi_station_set_reconnect_policy: enable/disable reconnect when ESP8266 disconnect from router,default to be enable reconnect. +wifi_set_event_handler_cb: set event handler of ESP8266 softAP or station status change. +wifi_softap_dhcps_set_offer_option: enable/disable get router information from ESP8266 softAP, default to be enable. +2. SNTP APIs: +sntp_get_current_timestamp: get current timestamp from Jan 01, 1970, 00:00 (GMT) +sntp_get_real_time: char,get real time (GTM + 8 time zone) +sntp_init: initialize SNTP +sntp_stop: stop SNTP +sntp_setserver: set SNTP server by IP +sntp_getserver: get SNTP server IP +sntp_setservername: set SNTP server by domain name +sntp_getservername: get domain name of SNTP server set by sntp_setservername +3. MDNS APIs: +espconn_mdns_init: initialize mDNS +espconn_mdns_close: close mDNS +espconn_mdns_server_register: register mDNS server +espconn_mdns_server_unregister: unregister mDNS server +espconn_mdns_get_servername: get mDNS server name +espconn_mdns_set_servername: set mDNS server name +espconn_mdns_set_hostname: get mDNS host name +espconn_mdns_get_hostname: set mDNS host name +espconn_mdns_disable: disable mDNS +espconn_mdns_enable: endisable mDNS + +AT_v0.23 Release Note: +Optimized: +1.AT+CWJAP add parameter "bssid", for several APs may have the same SSID + +New AT commands: +1. AT+CIPSENDBUF: write data into TCP-send-buffer; non-blocking. Background task automatically handles transmission. Has much higher throughput. +2. AT+CIPBUFRESET: resets segment count in TCP-send-buffer +3. AT+CIPBUFSTATUS: checks status of TCP-send-buffer +4. AT+CIPCHECKSEGID: checks if a specific segment in TCP-send-buffer has sent successfully + + + +esp_iot_sdk_v1.0.1_b2_15_04_10 release note +------------------------------------------- + +Fix bugs: +1.Call espconn_sent to send UDP packet in user_init cause reset.[BBP#2 reporter (????)] +2.UART & FlowControl issue: send data to FIFO without CTS flag will cause WDT [BBP#11 reporter (pvxx)] +3.SSL issue,add an API (espconn_secure_set_size) to set SSL buffer size [BBP#29 reporter (PeteW)] +4.UDP broadcast issue in WEP + +Optimize: +1.Add more details about measure ADC & VDD3P3 in appendix of document“2C-SDK-Espressif IoT SDK Programming Guide”[BBP#15 reporter (DarkByte)] +2.Can not do any WiFi related operation if WiFi mode is in NULL_MODE [BBP#23 reporter (hao.wang)] +3.start_ip and end_ip won't change through API wifi_softap_set_dhcps_lease [BBP#37 reporter (glb)] +4.AT get into busy state [BBP#35 reporter (tommy_hk)] +5.ssid + password length limitation when using AirKiss [BBP#45 reporter (zhchbin)] + +Add APIs: +1.espconn_secure_set_size:set buffer size for SSL packet +2.espconn_secure_get_size:get SSL buffer size +3.at_register_uart_rx_intr:set UART0 to be used by user or AT commands + +Add AT command: +1.AT+SLEEP: set ESP8266 sleep mode + +esp_iot_sdk_v1.0.1_b1_15_04_02 Release note +------------------------------------------- + +Fix bugs: +1. Connect to ESP8266 softAP fail after SmartConfig; +2. SmartConfig loses one bit of SSID + +Optimize: +1. espconn_set_opt: set configuration of TCP connection,add parameter for TCP keep-alive + +Add APIs: +1. espconn_clear_opt: clear configuration of TCP connection +2. espconn_set_keepalive: set configuration of TCP keep-alive to detect if TCP connection broke +3. espconn_get_keepalive: get configuration of TCP keep-alive + +AT_v0.23_b1 release note +Note: AT added some functions so flash size need to be 1024KB or more than that. + +Fix bug: +1. Always "busy" if TCP connection abnormally broke during AT+CIPSEND + +Optimize: +1. Add UDP transparent transmission +2. Optimize the initial value of AT+CWDHCP? +3. Add TCP keep-alive function in AT+CIPSTART + +Add AT command: +1. Add AT+CIPSENDEX which support quit from sending mode by "\0" (so an useful "\0" need to be "\\0") + +esp_iot_sdk_v1.0.0_15_03_20 Release Note +---------------------------------------- + +Optimize: +1. Optimize smartconfig to version v1.0; Please don't call any other APIs during SmartConfig. +2. Optimize AT to version 0.22.0.0; +3. Optimize the protection of system parameters, and add error-check about it; +4. Optimize beacon delay of ESP8266 softAP; +5. Optimize boot to version 1.3(b3); + - Add API system_restart_enhance: for factory test, support to load and run program in any specific address; + - Add APIs to get boot version and start address of current user bin; + - Fix compatibility problem of dual flash; +6. Optimize sniffer, structure sniffer_buf changed, please refer to document; +7. Optimize espconn; +8. Optimize pwm; +9. Other optimize to make the software more reliable; + +Add APIs: +1. system_update_cpu_freq: change CPU frequency; +2. wifi_promiscuous_set_mac: set a mac address filter during sniffer; +3. wifi_set_broadcast_if : set which interface will UDP broadcast send from; + +Fix bugs: +1. Interrupt during flash erasing will cause wdt reset; +2. Read/write rtc memory; +3. If router disconnect to ESP8266, ESP8266 won't reconnect; +4. Connect to router which hid its SSID + +AT_v0.22 release note + +Fix bug: +1. Wrong return value of AT+CIPSTATUS; +2. wdt rest after "0,CONNECT FAIL"; + +Add AT commands: +1. Change AT commands of which configuration will store into flash to two kinds: + XXX_CUR: current, only set configuration won't save it into Flash; + XXX_DEF: default, set configuration and save it to Flash +2. Add SmartConfig in AT: + AT+CWSTARTSMART/AT+CWSTOPSMART: start / stop SmartConfig + Notice: please refer to the document, call "AT+CWSTOPSMART" to stop SmartConfig first since "AT+CWSTARTSMART", then call other AT commands. Don't call any other AT commands during SmartConfig. +2. AT+SAVETRANSLINK: save transparent transmission link to Flash; + Note:AT+CIPMODE=1 set to enter transparent transmission mode, won't save to Flash. + + +Add AT APIs +1. at_customLinkMax: set the max link that allowed, most can be 10; if you want to set it, please set it before at_init; if you didn't set it, the max link allowed is 5 by default. +2. at_enter_special_state/ at_leave_special_state:Enter/leave AT processing state. In processing state, AT core will return "busy" for any further AT commands. +3. at_set_custom_info:set custom version information of AT which can be got by AT+GMR; +4. at_get_version:get version information of AT lib . + +Optimize +1. Add UDP remote ip and remote port is allowed to be parameters of "AT+CIPSEND" +2. Move "AT+CIUPDATE" from lib to AT "demo\esp_iot_sdk\examples\at", AT demo shows how to upgrade AT firmware from a local server. Notice that AT upgrade the bin files name have to be "user1.bin" and "user2.bin". +3. Optimize "AT+CIPSTA", add gateway and netmask as parameters +4. Optimize transparent transmission. + +esp_iot_sdk_v0.9.5_15_01_22 Release Note +---------------------------------------- + +AT becomes a lib attached to esp_iot_sdk, programming guide in "document" shows APIs for user to define their own AT commands, AT bin files are in \esp_iot_sdk\bin\at + +Fix bugs: +1. Incorrect status got by API : wifi_station_get_connect_status; +2. Sniffer can not quit without restart; +3. wifi_station_ap_change always return true; +4. TCP connection issues + +Add APIs: +1. system_deep_sleep_set_option: set what the chip will do when deep-sleep wake up; +2. wifi_status_led_uninstall; +3. wifi_station_ap_get_info: get information of AP that ESP8266 station connected. +4. wifi_station_dhcpc_status & wifi_softap_dhcps_status : get DHCP status +5. smart config APIs, more details in documents. +6. add beacon_interval parameter in struct softap_config +7. espconn_recv_hold and espconn_recv_unhold to block TCP receiving data and unblock it. +8. AT APIs to let user define their own AT, more details in documents. + +Optimize: +1. light sleep, modem sleep, deep sleep +2. compile method: ./gen_misc.sh, then follow the tips and steps. +3. when no buffer for os_malloc, return NULL instead of malloc assert. +4. users can enable #define USE_OPTIMIZE_PRINTF in user_config.h to remove strings of os_printf from ram to irom +5. faster the re-connection of ESP8266 station to router after deep-sleep. +6. update to boot v1.2 to support new format user.bin; +7. update ARP +8. update SSL +9. revised system_deep_sleep,system_deep_sleep(0),set no wake up timer,connect a GPIO to pin RST, the chip will wake up by a falling-edge on pin RST + +esp_iot_sdk_v0.9.4_14_12_19 Release Note +---------------------------------------- + +1. Update sniffer to support capture HT20/HT40 packet; +2. Add APIs to set and get sleep type; +3. Add APIs to get version info of sdk, delete version.h; +4. RAW in LWIP is open source now, add API of function ping; +5. Update spi driver; +6. Optimize APIs related to espconn; +7. Fix some bugs to make the software more reliable; + +Known Issue: +1. exception of small probability occured while recving multi-client data in softap +2. restart of small probability occured while tcp client reconnecting + +So sorry that we have some known issues here, we will solve it ASAP. + +esp_iot_sdk_v0.9.3_14_11_21 Release Note +---------------------------------------- + +1. Add license documentation of ESPRESSIF SDK +2. Add APIs to read and write RTC memory, and APIs to get RTC time. +3. Add APIs to swap UART0 +4. Add API to read ADC, delete adc.c. +5. Add API to read spi flash id +6. Revise struct station_config, add bssid parameters to distinguish different AP with same ssid ; + Note: if station_config.bssid_set == 1 , station_config.bssid has to be set, or connection will fail. So in general, station_config.bssid_set need to be 0. +7. Revise struct scan_config, add scan_config.show_hidden to set whether scan APs which ssid is hidden or not; not scan, set scan_config.show_hidden to be 0. + Add bss_info.is_hidden in struct bss_info to show if this APTs ssid is hidden. +8. Revise struct softap_config, add softap_config.ssid_len. If softap_config.ssid_len == 0, check ssid till find a termination characters; otherwise it depends on softap_config.ssid_len. +9. Revise API "wifi_softap_set_config" to take effect immediately, needs not restart to make the configuration enable any more. +10. Add APIs to set and get physical layer mode(802.11b/g/n) +11. Add APIs to enable and disable DHCP server of ESP8266 softAP +12. Add APIs to enable and disable DHCP client of ESP8266 station +13. Add API to set range of ip address that get from DHCP server +14. Add APIs to set and get how many TCP connections allowed at max. +15. Add APIs to set and get how many TCP clients allowed at max to a TCP server. +16. Revise "wifi_set_ip_info" and "wifi_set_macaddr" to take effect immediately. +17. Fix some bugs to make the software more reliable. + +ESP8266EX: Fix A Potential Error For UART RX in esp_iot_sdk_v0.9.2_14_10_24 +--------------------------------------------------------------------------- + +The previously released SDK for ESP8266EX inadvertently introduced a bug that may cause a little packet loss when transferring packet by Uart RX. +So for now,I will release the patch for this bug.Please download the patch from the attachment,and refer to the following steps: +Following Commands: +1. REPLACE LIBPHY.A IN SDK/LIB +2. ADD LIBPP.A TO SDK/LIB +3. MODIFY SDK/APP/MAKEFILE +4. ADD "-lpp \" AS BELOW +-lgcc +-lhal +-lpp +-lphy +-lnet80211 +-llwip +-lwpa +-lmain +-lssc +-lssl + +esp_iot_sdk_v0.9.2_14_10_24 Release Note +---------------------------------------- + +Initial version for public, can be compiled on both windows and lubuntu. diff --git a/hardware/tools/esp8266/sdk/include/c_types.h b/hardware/tools/esp8266/sdk/include/c_types.h index 2747e0834b..d9f00fbbb1 100644 --- a/hardware/tools/esp8266/sdk/include/c_types.h +++ b/hardware/tools/esp8266/sdk/include/c_types.h @@ -7,6 +7,7 @@ #define _C_TYPES_H_ #include #include +#include typedef signed char sint8_t; typedef signed short sint16_t; diff --git a/hardware/tools/esp8266/sdk/include/eagle_soc.h b/hardware/tools/esp8266/sdk/include/eagle_soc.h index fbcea84557..59214159e4 100644 --- a/hardware/tools/esp8266/sdk/include/eagle_soc.h +++ b/hardware/tools/esp8266/sdk/include/eagle_soc.h @@ -244,6 +244,7 @@ #define PERIPHS_IO_MUX_SD_DATA0_U (PERIPHS_IO_MUX + 0x20) #define FUNC_SDDATA0 0 #define FUNC_SPIQ_MISO 1 +#define FUNC_SPIQ 1 #define FUNC_GPIO7 3 #define FUNC_U1TXD 4 #define FUNC_UART1_TXD 4 @@ -251,9 +252,11 @@ #define PERIPHS_IO_MUX_SD_DATA1_U (PERIPHS_IO_MUX + 0x24) #define FUNC_SDDATA1 0 #define FUNC_SPID_MOSI 1 +#define FUNC_SPID 1 #define FUNC_GPIO8 3 #define FUNC_U1RXD 4 #define FUNC_UART1_RXD 4 +#define FUNC_SDDATA1_U1RXD 7 #define PERIPHS_IO_MUX_SD_DATA2_U (PERIPHS_IO_MUX + 0x28) #define FUNC_SDDATA2 0 diff --git a/hardware/tools/esp8266/sdk/include/espconn.h b/hardware/tools/esp8266/sdk/include/espconn.h index 71718cbe22..0107349213 100644 --- a/hardware/tools/esp8266/sdk/include/espconn.h +++ b/hardware/tools/esp8266/sdk/include/espconn.h @@ -93,9 +93,41 @@ enum espconn_option{ ESPCONN_REUSEADDR = 0x01, ESPCONN_NODELAY = 0x02, ESPCONN_COPY = 0x04, + ESPCONN_KEEPALIVE = 0x08, ESPCONN_END }; +enum espconn_level{ + ESPCONN_KEEPIDLE, + ESPCONN_KEEPINTVL, + ESPCONN_KEEPCNT +}; + +enum { + ESPCONN_IDLE = 0, + ESPCONN_CLIENT, + ESPCONN_SERVER, + ESPCONN_BOTH, + ESPCONN_MAX +}; + +struct espconn_packet{ + uint16 sent_length; /* sent length successful*/ + uint16 snd_buf_size; /* Available buffer size for sending */ + uint16 snd_queuelen; /* Available buffer space for sending */ + uint16 total_queuelen; /* total Available buffer space for sending */ + uint32 packseqno; /* seqno to be sent */ + uint32 packseq_nxt; /* seqno expected */ + uint32 packnum; +}; + +struct mdns_info { + char *host_name; + char *server_name; + uint16 server_port; + unsigned long ipAddr; + char *txt_data; +}; /****************************************************************************** * FunctionName : espconn_connect * Description : The function given as the connect @@ -198,6 +230,16 @@ sint8 espconn_regist_time(struct espconn *espconn, uint32 interval, uint8 type_f sint8 espconn_get_connection_info(struct espconn *pespconn, remot_info **pcon_info, uint8 typeflags); +/****************************************************************************** + * FunctionName : espconn_get_packet_info + * Description : get the packet info with host + * Parameters : espconn -- the espconn used to disconnect the connection + * infoarg -- the packet info + * Returns : the errur code +*******************************************************************************/ + +sint8 espconn_get_packet_info(struct espconn *espconn, struct espconn_packet* infoarg); + /****************************************************************************** * FunctionName : espconn_regist_sentcb * Description : Used to specify the function that should be called when data @@ -296,6 +338,40 @@ uint32 espconn_port(void); sint8 espconn_set_opt(struct espconn *espconn, uint8 opt); +/****************************************************************************** + * FunctionName : espconn_clear_opt + * Description : clear the option for connections so that we don't end up bouncing + * all connections at the same time . + * Parameters : espconn -- the espconn used to set the connection + * opt -- the option for clear + * Returns : the result +*******************************************************************************/ + +sint8 espconn_clear_opt(struct espconn *espconn, uint8 opt); + +/****************************************************************************** + * FunctionName : espconn_set_keepalive + * Description : access level value for connection so that we set the value for + * keep alive + * Parameters : espconn -- the espconn used to set the connection + * level -- the connection's level + * value -- the value of time(s) + * Returns : access port value +*******************************************************************************/ + +sint8 espconn_set_keepalive(struct espconn *espconn, uint8 level, void* optarg); + +/****************************************************************************** + * FunctionName : espconn_get_keepalive + * Description : access level value for connection so that we get the value for + * keep alive + * Parameters : espconn -- the espconn used to get the connection + * level -- the connection's level + * Returns : access keep alive value +*******************************************************************************/ + +sint8 espconn_get_keepalive(struct espconn *espconn, uint8 level, void *optarg); + /****************************************************************************** * TypedefName : dns_found_callback * Description : Callback which is invoked when a hostname is found. @@ -358,6 +434,27 @@ sint8 espconn_secure_disconnect(struct espconn *espconn); sint8 espconn_secure_sent(struct espconn *espconn, uint8 *psent, uint16 length); +/****************************************************************************** + * FunctionName : espconn_secure_set_size + * Description : set the buffer size for client or server + * Parameters : level -- set for client or server + * 1: client,2:server,3:client and server + * size -- buffer size + * Returns : true or false +*******************************************************************************/ + +bool espconn_secure_set_size(uint8 level, uint16 size); + +/****************************************************************************** + * FunctionName : espconn_secure_get_size + * Description : get buffer size for client or server + * Parameters : level -- set for client or server + * 1: client,2:server,3:client and server + * Returns : buffer size for client or server +*******************************************************************************/ + +sint16 espconn_secure_get_size(uint8 level); + /****************************************************************************** * FunctionName : espconn_secure_accept * Description : The function given as the listen @@ -401,5 +498,85 @@ sint8 espconn_recv_hold(struct espconn *pespconn); *******************************************************************************/ sint8 espconn_recv_unhold(struct espconn *pespconn); +/****************************************************************************** + * FunctionName : espconn_mdns_init + * Description : register a device with mdns + * Parameters : ipAddr -- the ip address of device + * hostname -- the hostname of device + * Returns : none +*******************************************************************************/ + +void espconn_mdns_init(struct mdns_info *info); +/****************************************************************************** + * FunctionName : espconn_mdns_close + * Description : close a device with mdns + * Parameters : a + * Returns : none +*******************************************************************************/ + +void espconn_mdns_close(void); +/****************************************************************************** + * FunctionName : espconn_mdns_server_register + * Description : register a device with mdns + * Parameters : a + * Returns : none +*******************************************************************************/ +void espconn_mdns_server_register(void); + +/****************************************************************************** + * FunctionName : espconn_mdns_server_unregister + * Description : unregister a device with mdns + * Parameters : a + * Returns : none +*******************************************************************************/ +void espconn_mdns_server_unregister(void); + +/****************************************************************************** + * FunctionName : espconn_mdns_get_servername + * Description : get server name of device with mdns + * Parameters : a + * Returns : none +*******************************************************************************/ + +char* espconn_mdns_get_servername(void); +/****************************************************************************** + * FunctionName : espconn_mdns_set_servername + * Description : set server name of device with mdns + * Parameters : a + * Returns : none +*******************************************************************************/ +void espconn_mdns_set_servername(const char *name); + +/****************************************************************************** + * FunctionName : espconn_mdns_set_hostname + * Description : set host name of device with mdns + * Parameters : a + * Returns : none +*******************************************************************************/ +void espconn_mdns_set_hostname(char *name); + +/****************************************************************************** + * FunctionName : espconn_mdns_get_hostname + * Description : get host name of device with mdns + * Parameters : a + * Returns : none +*******************************************************************************/ +char* espconn_mdns_get_hostname(void); + +/****************************************************************************** + * FunctionName : espconn_mdns_disable + * Description : disable a device with mdns + * Parameters : a + * Returns : none +*******************************************************************************/ +void espconn_mdns_disable(void); + +/****************************************************************************** + * FunctionName : espconn_mdns_enable + * Description : disable a device with mdns + * Parameters : a + * Returns : none +*******************************************************************************/ +void espconn_mdns_enable(void); #endif diff --git a/hardware/tools/esp8266/sdk/include/ets_sys.h b/hardware/tools/esp8266/sdk/include/ets_sys.h index 2244240af7..b7b79c3412 100644 --- a/hardware/tools/esp8266/sdk/include/ets_sys.h +++ b/hardware/tools/esp8266/sdk/include/ets_sys.h @@ -118,6 +118,7 @@ void ets_isr_unmask(int intr); void ets_isr_attach(int intr, int_handler_t handler, void *arg); void ets_intr_lock(); void ets_intr_unlock(); - +int ets_vsnprintf(char * s, size_t n, const char * format, va_list arg); +int ets_vprintf(const char * format, va_list arg); #endif /* _ETS_SYS_H */ diff --git a/hardware/tools/esp8266/sdk/include/osapi.h b/hardware/tools/esp8266/sdk/include/osapi.h index 5fbdf0da21..6935388c54 100644 --- a/hardware/tools/esp8266/sdk/include/osapi.h +++ b/hardware/tools/esp8266/sdk/include/osapi.h @@ -50,6 +50,7 @@ os_printf_plus(flash_str, ##__VA_ARGS__); \ } while(0) #else +extern int os_printf_plus(const char * format, ...); #define os_printf os_printf_plus #endif diff --git a/hardware/tools/esp8266/sdk/include/user_interface.h b/hardware/tools/esp8266/sdk/include/user_interface.h index 1096832cc7..1fa01edd99 100644 --- a/hardware/tools/esp8266/sdk/include/user_interface.h +++ b/hardware/tools/esp8266/sdk/include/user_interface.h @@ -181,6 +181,8 @@ bool wifi_station_scan(struct scan_config *config, scan_done_cb_t cb); uint8 wifi_station_get_auto_connect(void); bool wifi_station_set_auto_connect(uint8 set); +bool wifi_station_set_reconnect_policy(bool set); + enum { STATION_IDLE = 0, STATION_CONNECTING, @@ -229,8 +231,14 @@ struct station_info { }; struct dhcps_lease { - uint32 start_ip; - uint32 end_ip; + struct ip_addr start_ip; + struct ip_addr end_ip; +}; + +enum dhcps_offer_option{ + OFFER_START = 0x00, + OFFER_ROUTER = 0x01, + OFFER_END }; struct station_info * wifi_softap_get_station_info(void); @@ -241,6 +249,7 @@ bool wifi_softap_dhcps_start(void); bool wifi_softap_dhcps_stop(void); bool wifi_softap_set_dhcps_lease(struct dhcps_lease *please); enum dhcp_status wifi_softap_dhcps_status(void); +bool wifi_softap_dhcps_set_offer_option(uint8 level, void* optarg); #define STATION_IF 0x00 #define SOFTAP_IF 0x01 @@ -286,4 +295,96 @@ enum sleep_type { bool wifi_set_sleep_type(enum sleep_type type); enum sleep_type wifi_get_sleep_type(void); +enum { + EVENT_STAMODE_CONNECTED = 0, + EVENT_STAMODE_DISCONNECTED, + EVENT_STAMODE_AUTHMODE_CHANGE, + EVENT_STAMODE_GOT_IP, + EVENT_SOFTAPMODE_STACONNECTED, + EVENT_SOFTAPMODE_STADISCONNECTED, + EVENT_MAX +}; + +enum { + REASON_UNSPECIFIED = 1, + REASON_AUTH_EXPIRE = 2, + REASON_AUTH_LEAVE = 3, + REASON_ASSOC_EXPIRE = 4, + REASON_ASSOC_TOOMANY = 5, + REASON_NOT_AUTHED = 6, + REASON_NOT_ASSOCED = 7, + REASON_ASSOC_LEAVE = 8, + REASON_ASSOC_NOT_AUTHED = 9, + REASON_DISASSOC_PWRCAP_BAD = 10, /* 11h */ + REASON_DISASSOC_SUPCHAN_BAD = 11, /* 11h */ + REASON_IE_INVALID = 13, /* 11i */ + REASON_MIC_FAILURE = 14, /* 11i */ + REASON_4WAY_HANDSHAKE_TIMEOUT = 15, /* 11i */ + REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, /* 11i */ + REASON_IE_IN_4WAY_DIFFERS = 17, /* 11i */ + REASON_GROUP_CIPHER_INVALID = 18, /* 11i */ + REASON_PAIRWISE_CIPHER_INVALID = 19, /* 11i */ + REASON_AKMP_INVALID = 20, /* 11i */ + REASON_UNSUPP_RSN_IE_VERSION = 21, /* 11i */ + REASON_INVALID_RSN_IE_CAP = 22, /* 11i */ + REASON_802_1X_AUTH_FAILED = 23, /* 11i */ + REASON_CIPHER_SUITE_REJECTED = 24, /* 11i */ + + REASON_BEACON_TIMEOUT = 200, + REASON_NO_AP_FOUND = 201, +}; + +typedef struct { + uint8 ssid[32]; + uint8 ssid_len; + uint8 bssid[6]; + uint8 channel; +} Event_StaMode_Connected_t; + +typedef struct { + uint8 ssid[32]; + uint8 ssid_len; + uint8 bssid[6]; + uint8 reason; +} Event_StaMode_Disconnected_t; + +typedef struct { + uint8 old_mode; + uint8 new_mode; +} Event_StaMode_AuthMode_Change_t; + +typedef struct { + struct ip_addr ip; + struct ip_addr mask; + struct ip_addr gw; +} Event_StaMode_Got_IP_t; + +typedef struct { + uint8 mac[6]; + uint8 aid; +} Event_SoftAPMode_StaConnected_t; + +typedef struct { + uint8 mac[6]; + uint8 aid; +} Event_SoftAPMode_StaDisconnected_t; + +typedef union { + Event_StaMode_Connected_t connected; + Event_StaMode_Disconnected_t disconnected; + Event_StaMode_AuthMode_Change_t auth_change; + Event_StaMode_Got_IP_t got_ip; + Event_SoftAPMode_StaConnected_t sta_connected; + Event_SoftAPMode_StaDisconnected_t sta_disconnected; +} Event_Info_u; + +typedef struct _esp_event { + uint32 event; + Event_Info_u event_info; +} System_Event_t; + +typedef void (* wifi_event_handler_cb_t)(System_Event_t *event); + +void wifi_set_event_handler_cb(wifi_event_handler_cb_t cb); + #endif diff --git a/hardware/tools/esp8266/sdk/ld/eagle.app.v6.ld b/hardware/tools/esp8266/sdk/ld/eagle.app.v6.ld index 4bafb697c4..a50c4fb8e9 100644 --- a/hardware/tools/esp8266/sdk/ld/eagle.app.v6.ld +++ b/hardware/tools/esp8266/sdk/ld/eagle.app.v6.ld @@ -2,10 +2,10 @@ /* Linker Script for ld -N */ MEMORY { - dport0_0_seg : org = 0x3FF00000, len = 0x10 - dram0_0_seg : org = 0x3FFE8000, len = 0x14000 - iram1_0_seg : org = 0x40100000, len = 0x8000 - irom0_0_seg : org = 0x40240000, len = 0x32000 + dport0_0_seg : org = 0x3FF00000, len = 0x10 + dram0_0_seg : org = 0x3FFE8000, len = 0x14000 + iram1_0_seg : org = 0x40100000, len = 0x8000 + irom0_0_seg : org = 0x40240000, len = 0x3C000 } PHDRS @@ -153,6 +153,8 @@ SECTIONS _irom0_text_start = ABSOLUTE(.); *core_esp8266_*.o(.literal*, .text*) *.cpp.o(.literal*, .text*) + *libm.a:(.literal .text .literal.* .text.*) + *libsmartconfig.a:(.literal .text .literal.* .text.*) *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text) _irom0_text_end = ABSOLUTE(.); } >irom0_0_seg :irom0_0_phdr diff --git a/hardware/tools/esp8266/sdk/ld/eagle.rom.addr.v6.ld b/hardware/tools/esp8266/sdk/ld/eagle.rom.addr.v6.ld index 412232bae9..076a240dd6 100644 --- a/hardware/tools/esp8266/sdk/ld/eagle.rom.addr.v6.ld +++ b/hardware/tools/esp8266/sdk/ld/eagle.rom.addr.v6.ld @@ -16,10 +16,10 @@ PROVIDE ( SHA1Final = 0x4000b648 ); PROVIDE ( SHA1Init = 0x4000b584 ); PROVIDE ( SHA1Transform = 0x4000a364 ); PROVIDE ( SHA1Update = 0x4000b5a8 ); -PROVIDE ( Wait_SPI_Idle = 0x4000448c ); PROVIDE ( SPI_read_status = 0x400043c8 ); PROVIDE ( SPI_write_status = 0x40004400 ); PROVIDE ( SPI_write_enable = 0x4000443c ); +PROVIDE ( Wait_SPI_Idle = 0x4000448c ); PROVIDE ( SPIEraseArea = 0x40004b44 ); PROVIDE ( SPIEraseBlock = 0x400049b4 ); PROVIDE ( SPIEraseChip = 0x40004984 ); @@ -345,7 +345,3 @@ PROVIDE ( xthal_window_spill_nw = 0x4000e320 ); PROVIDE ( Te0 = 0x3fffccf0 ); PROVIDE ( UartDev = 0x3fffde10 ); PROVIDE ( flashchip = 0x3fffc714); - -malloc = pvPortMalloc; -free = vPortFree; -realloc = pvPortRealloc; diff --git a/hardware/tools/esp8266/sdk/lib/liblwip.a b/hardware/tools/esp8266/sdk/lib/liblwip.a index 24fb74c1ff..d3c356dcea 100644 Binary files a/hardware/tools/esp8266/sdk/lib/liblwip.a and b/hardware/tools/esp8266/sdk/lib/liblwip.a differ diff --git a/hardware/tools/esp8266/sdk/lib/libmain.a b/hardware/tools/esp8266/sdk/lib/libmain.a index 8270c74530..265466dc11 100644 Binary files a/hardware/tools/esp8266/sdk/lib/libmain.a and b/hardware/tools/esp8266/sdk/lib/libmain.a differ diff --git a/hardware/tools/esp8266/sdk/lib/libnet80211.a b/hardware/tools/esp8266/sdk/lib/libnet80211.a index 6d2e52a069..1e908b85c4 100644 Binary files a/hardware/tools/esp8266/sdk/lib/libnet80211.a and b/hardware/tools/esp8266/sdk/lib/libnet80211.a differ diff --git a/hardware/tools/esp8266/sdk/lib/libphy.a b/hardware/tools/esp8266/sdk/lib/libphy.a index 5702e4ef9a..cb026f941c 100644 Binary files a/hardware/tools/esp8266/sdk/lib/libphy.a and b/hardware/tools/esp8266/sdk/lib/libphy.a differ diff --git a/hardware/tools/esp8266/sdk/lib/libpp.a b/hardware/tools/esp8266/sdk/lib/libpp.a index aa609ad725..d28457b1e7 100644 Binary files a/hardware/tools/esp8266/sdk/lib/libpp.a and b/hardware/tools/esp8266/sdk/lib/libpp.a differ diff --git a/hardware/tools/esp8266/sdk/lib/libsmartconfig.a b/hardware/tools/esp8266/sdk/lib/libsmartconfig.a index 1e422ea30f..39bfe39d2f 100644 Binary files a/hardware/tools/esp8266/sdk/lib/libsmartconfig.a and b/hardware/tools/esp8266/sdk/lib/libsmartconfig.a differ diff --git a/hardware/tools/esp8266/sdk/lib/libssl.a b/hardware/tools/esp8266/sdk/lib/libssl.a index 61dc14f7e7..6c54acc2d6 100644 Binary files a/hardware/tools/esp8266/sdk/lib/libssl.a and b/hardware/tools/esp8266/sdk/lib/libssl.a differ diff --git a/hardware/tools/esp8266/sdk/lib/libwpa.a b/hardware/tools/esp8266/sdk/lib/libwpa.a index c536633d86..c3d04200d9 100644 Binary files a/hardware/tools/esp8266/sdk/lib/libwpa.a and b/hardware/tools/esp8266/sdk/lib/libwpa.a differ diff --git a/hardware/tools/esp8266/sdk/version b/hardware/tools/esp8266/sdk/version index afaf360d37..5fc0980134 100644 --- a/hardware/tools/esp8266/sdk/version +++ b/hardware/tools/esp8266/sdk/version @@ -1 +1 @@ -1.0.0 \ No newline at end of file +1.0.1_15_04_24 \ No newline at end of file