diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index 41d8dd7fd87..0ebb37262d5 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -28,6 +28,7 @@ #include "soc/rtc.h" #include "soc/rtc_cntl_reg.h" #include "rom/rtc.h" +#include "esp_task_wdt.h" #include "esp32-hal.h" //Undocumented!!! Get chip temperature in Farenheit @@ -44,6 +45,47 @@ void yield() vPortYield(); } +#if CONFIG_AUTOSTART_ARDUINO + +extern TaskHandle_t loopTaskHandle; +extern bool loopTaskWDTEnabled; + +void enableLoopWDT(){ + if(loopTaskHandle != NULL){ + if(esp_task_wdt_add(loopTaskHandle) != ESP_OK){ + log_e("Failed to add loop task to WDT"); + } else { + loopTaskWDTEnabled = true; + } + } +} + +void disableLoopWDT(){ + if(loopTaskHandle != NULL && loopTaskWDTEnabled){ + loopTaskWDTEnabled = false; + if(esp_task_wdt_delete(loopTaskHandle) != ESP_OK){ + log_e("Failed to remove loop task from WDT"); + } + } +} +#endif + +#ifndef CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1 +void enableCore1WDT(){ + TaskHandle_t idle_1 = xTaskGetIdleTaskHandleForCPU(1); + if(idle_1 == NULL || esp_task_wdt_add(idle_1) != ESP_OK){ + log_e("Failed to add Core 1 IDLE task to WDT"); + } +} + +void disableCore1WDT(){ + TaskHandle_t idle_1 = xTaskGetIdleTaskHandleForCPU(1); + if(idle_1 == NULL || esp_task_wdt_delete(idle_1) != ESP_OK){ + log_e("Failed to remove Core 1 IDLE task from WDT"); + } +} +#endif + static uint32_t _cpu_freq_mhz = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ; static uint32_t _sys_time_multiplier = 1; diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index 60fbc6d57fd..7cb44519059 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -72,6 +72,18 @@ void yield(void); //returns chip temperature in Celsius float temperatureRead(); +#if CONFIG_AUTOSTART_ARDUINO +//enable/disable WDT for Arduino's setup and loop functions +void enableLoopWDT(); +void disableLoopWDT(); +#endif + +#ifndef CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1 +//enable/disable WDT for the IDLE task on Core 1 +void enableCore1WDT(); +void disableCore1WDT(); +#endif + //function takes the following frequencies as valid values: // 240, 160, 80 <<< For all XTAL types // 40, 20, 13, 10, 8, 5, 4, 3, 2, 1 <<< For 40MHz XTAL diff --git a/cores/esp32/main.cpp b/cores/esp32/main.cpp index 771da0452fa..edba0e7d4af 100644 --- a/cores/esp32/main.cpp +++ b/cores/esp32/main.cpp @@ -1,7 +1,10 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "esp_task_wdt.h" #include "Arduino.h" +TaskHandle_t loopTaskHandle = NULL; + #if CONFIG_AUTOSTART_ARDUINO #if CONFIG_FREERTOS_UNICORE @@ -10,18 +13,24 @@ #define ARDUINO_RUNNING_CORE 1 #endif +bool loopTaskWDTEnabled; + void loopTask(void *pvParameters) { setup(); for(;;) { + if(loopTaskWDTEnabled){ + esp_task_wdt_reset(); + } loop(); } } extern "C" void app_main() { + loopTaskWDTEnabled = false; initArduino(); - xTaskCreatePinnedToCore(loopTask, "loopTask", 8192, NULL, 1, NULL, ARDUINO_RUNNING_CORE); + xTaskCreatePinnedToCore(loopTask, "loopTask", 8192, NULL, 1, &loopTaskHandle, ARDUINO_RUNNING_CORE); } #endif diff --git a/tools/gen_esp32part.py b/tools/gen_esp32part.py index 53a65efc086..c7b8d502144 100755 --- a/tools/gen_esp32part.py +++ b/tools/gen_esp32part.py @@ -32,7 +32,7 @@ import errno MAX_PARTITION_LENGTH = 0xC00 # 3K for partition data (96 entries) leaves 1K in a 4K sector for signature -MD5_PARTITION_BEGIN = b"\xEB\xEB" + b"\xFF" * 14 # The first 2 bytes are like magic numbers for MD5 sum +MD5_PARTITION_BEGIN = b"\xEB\xEB" + b"\xFF" * 14 # The first 2 bytes are like magic numbers for MD5 sum PARTITION_TABLE_SIZE = 0x1000 # Size of partition table MIN_PARTITION_SUBTYPE_APP_OTA = 0x10 @@ -44,25 +44,25 @@ DATA_TYPE = 0x01 TYPES = { - "app" : APP_TYPE, - "data" : DATA_TYPE, + "app": APP_TYPE, + "data": DATA_TYPE, } # Keep this map in sync with esp_partition_subtype_t enum in esp_partition.h SUBTYPES = { - APP_TYPE : { - "factory" : 0x00, - "test" : 0x20, + APP_TYPE: { + "factory": 0x00, + "test": 0x20, }, - DATA_TYPE : { - "ota" : 0x00, - "phy" : 0x01, - "nvs" : 0x02, - "coredump" : 0x03, - "nvs_keys" : 0x04, - "esphttpd" : 0x80, - "fat" : 0x81, - "spiffs" : 0x82, + DATA_TYPE: { + "ota": 0x00, + "phy": 0x01, + "nvs": 0x02, + "coredump": 0x03, + "nvs_keys": 0x04, + "esphttpd": 0x80, + "fat": 0x81, + "spiffs": 0x82, }, } @@ -71,16 +71,19 @@ secure = False offset_part_table = 0 + def status(msg): """ Print status message to stderr """ if not quiet: critical(msg) + def critical(msg): """ Print critical message to stderr """ sys.stderr.write(msg) sys.stderr.write('\n') + class PartitionTable(list): def __init__(self): super(PartitionTable, self).__init__(self) @@ -102,15 +105,15 @@ def expand_vars(f): if line.startswith("#") or len(line) == 0: continue try: - res.append(PartitionDefinition.from_csv(line, line_no+1)) + res.append(PartitionDefinition.from_csv(line, line_no + 1)) except InputError as e: - raise InputError("Error at line %d: %s" % (line_no+1, e)) + raise InputError("Error at line %d: %s" % (line_no + 1, e)) except Exception: - critical("Unexpected error parsing CSV line %d: %s" % (line_no+1, line)) + critical("Unexpected error parsing CSV line %d: %s" % (line_no + 1, line)) raise # fix up missing offsets & negative sizes - last_end = offset_part_table + PARTITION_TABLE_SIZE # first offset after partition table + last_end = offset_part_table + PARTITION_TABLE_SIZE # first offset after partition table for e in res: if e.offset is not None and e.offset < last_end: if e == res[0]: @@ -149,14 +152,14 @@ def find_by_type(self, ptype, subtype): ptype = TYPES[ptype] except KeyError: try: - ptypes = int(ptype, 0) + ptype = int(ptype, 0) except TypeError: pass try: subtype = SUBTYPES[int(ptype)][subtype] except KeyError: try: - ptypes = int(ptype, 0) + ptype = int(ptype, 0) except TypeError: pass @@ -175,11 +178,11 @@ def verify(self): # verify each partition individually for p in self: p.verify() - + # check on duplicate name - names = [ p.name for p in self ] - duplicates = set( n for n in names if names.count(n) > 1 ) - + names = [p.name for p in self] + duplicates = set(n for n in names if names.count(n) > 1) + # print sorted duplicate partitions by name if len(duplicates) != 0: print("A list of partitions that have the same name:") @@ -187,14 +190,14 @@ def verify(self): if len(duplicates.intersection([p.name])) != 0: print("%s" % (p.to_csv())) raise InputError("Partition names must be unique") - + # check for overlaps last = None for p in sorted(self, key=lambda x:x.offset): if p.offset < offset_part_table + PARTITION_TABLE_SIZE: raise InputError("Partition offset 0x%x is below 0x%x" % (p.offset, offset_part_table + PARTITION_TABLE_SIZE)) if last is not None and p.offset < last.offset + last.size: - raise InputError("Partition at 0x%x overlaps 0x%x-0x%x" % (p.offset, last.offset, last.offset+last.size-1)) + raise InputError("Partition at 0x%x overlaps 0x%x-0x%x" % (p.offset, last.offset, last.offset + last.size - 1)) last = p def flash_size(self): @@ -209,17 +212,17 @@ def flash_size(self): @classmethod def from_binary(cls, b): - md5 = hashlib.md5(); + md5 = hashlib.md5() result = cls() for o in range(0,len(b),32): - data = b[o:o+32] + data = b[o:o + 32] if len(data) != 32: raise InputError("Partition table length must be a multiple of 32 bytes") - if data == b'\xFF'*32: + if data == b'\xFF' * 32: return result # got end marker - if md5sum and data[:2] == MD5_PARTITION_BEGIN[:2]: #check only the magic number part + if md5sum and data[:2] == MD5_PARTITION_BEGIN[:2]: # check only the magic number part if data[16:] == md5.digest(): - continue # the next iteration will check for the end marker + continue # the next iteration will check for the end marker else: raise InputError("MD5 checksums don't match! (computed: 0x%s, parsed: 0x%s)" % (md5.hexdigest(), binascii.hexlify(data[16:]))) else: @@ -231,29 +234,30 @@ def to_binary(self): result = b"".join(e.to_binary() for e in self) if md5sum: result += MD5_PARTITION_BEGIN + hashlib.md5(result).digest() - if len(result )>= MAX_PARTITION_LENGTH: + if len(result) >= MAX_PARTITION_LENGTH: raise InputError("Binary partition table length (%d) longer than max" % len(result)) result += b"\xFF" * (MAX_PARTITION_LENGTH - len(result)) # pad the sector, for signing return result def to_csv(self, simple_formatting=False): - rows = [ "# Espressif ESP32 Partition Table", - "# Name, Type, SubType, Offset, Size, Flags" ] - rows += [ x.to_csv(simple_formatting) for x in self ] + rows = ["# Espressif ESP32 Partition Table", + "# Name, Type, SubType, Offset, Size, Flags"] + rows += [x.to_csv(simple_formatting) for x in self] return "\n".join(rows) + "\n" + class PartitionDefinition(object): MAGIC_BYTES = b"\xAA\x50" ALIGNMENT = { - APP_TYPE : 0x10000, - DATA_TYPE : 0x04, + APP_TYPE: 0x10000, + DATA_TYPE: 0x04, } # dictionary maps flag name (as used in CSV flags list, property name) # to bit set in flags words in binary format FLAGS = { - "encrypted" : 0 + "encrypted": 0 } # add subtypes for the 16 OTA slot values ("ota_XX, etc.") @@ -272,7 +276,7 @@ def __init__(self): def from_csv(cls, line, line_no): """ Parse a line from the CSV """ line_w_defaults = line + ",,,," # lazy way to support default fields - fields = [ f.strip() for f in line_w_defaults.split(",") ] + fields = [f.strip() for f in line_w_defaults.split(",")] res = PartitionDefinition() res.line_no = line_no @@ -302,7 +306,7 @@ def __repr__(self): def maybe_hex(x): return "0x%x" % x if x is not None else "None" return "PartitionDefinition('%s', 0x%x, 0x%x, %s, %s)" % (self.name, self.type, self.subtype or 0, - maybe_hex(self.offset), maybe_hex(self.size)) + maybe_hex(self.offset), maybe_hex(self.size)) def __str__(self): return "Part '%s' %d/%d @ 0x%x size 0x%x" % (self.name, self.type, self.subtype, self.offset or -1, self.size or -1) @@ -329,7 +333,7 @@ def parse_type(self, strval): def parse_subtype(self, strval): if strval == "": - return 0 # default + return 0 # default return parse_int(strval, SUBTYPES.get(self.type, {})) def parse_address(self, strval): @@ -353,12 +357,14 @@ def verify(self): raise ValidationError(self, "Size field is not set") if self.name in TYPES and TYPES.get(self.name, "") != self.type: - critical("WARNING: Partition has name '%s' which is a partition type, but does not match this partition's type (0x%x). Mistake in partition table?" % (self.name, self.type)) + critical("WARNING: Partition has name '%s' which is a partition type, but does not match this partition's " + "type (0x%x). Mistake in partition table?" % (self.name, self.type)) all_subtype_names = [] for names in (t.keys() for t in SUBTYPES.values()): all_subtype_names += names if self.name in all_subtype_names and SUBTYPES.get(self.type, {}).get(self.name, "") != self.subtype: - critical("WARNING: Partition has name '%s' which is a partition subtype, but this partition has non-matching type 0x%x and subtype 0x%x. Mistake in partition table?" % (self.name, self.type, self.subtype)) + critical("WARNING: Partition has name '%s' which is a partition subtype, but this partition has " + "non-matching type 0x%x and subtype 0x%x. Mistake in partition table?" % (self.name, self.type, self.subtype)) STRUCT_FORMAT = b"<2sBBLL16sL" @@ -369,21 +375,21 @@ def from_binary(cls, b): res = cls() (magic, res.type, res.subtype, res.offset, res.size, res.name, flags) = struct.unpack(cls.STRUCT_FORMAT, b) - if b"\x00" in res.name: # strip null byte padding from name string + if b"\x00" in res.name: # strip null byte padding from name string res.name = res.name[:res.name.index(b"\x00")] res.name = res.name.decode() if magic != cls.MAGIC_BYTES: raise InputError("Invalid magic bytes (%r) for partition definition" % magic) for flag,bit in cls.FLAGS.items(): - if flags & (1< #include "rom/queue.h" #include "esp_wifi_types.h" @@ -45,6 +24,8 @@ #include "lwip/ip_addr.h" #include "dhcpserver/dhcpserver.h" +typedef dhcps_lease_t tcpip_adapter_dhcps_lease_t; + #ifdef __cplusplus extern "C" { #endif @@ -67,26 +48,36 @@ extern "C" { #define IPV6STR "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" +/** @brief IPV4 IP address information + */ typedef struct { - ip4_addr_t ip; - ip4_addr_t netmask; - ip4_addr_t gw; + ip4_addr_t ip; /**< Interface IPV4 address */ + ip4_addr_t netmask; /**< Interface IPV4 netmask */ + ip4_addr_t gw; /**< Interface IPV4 gateway address */ } tcpip_adapter_ip_info_t; +/** @brief IPV6 IP address information + */ typedef struct { - ip6_addr_t ip; + ip6_addr_t ip; /**< Interface IPV6 address */ } tcpip_adapter_ip6_info_t; -typedef dhcps_lease_t tcpip_adapter_dhcps_lease_t; - +/** @brief IP address info of station connected to WLAN AP + * + * @note See also wifi_sta_info_t (MAC layer information only) + */ typedef struct { - uint8_t mac[6]; - ip4_addr_t ip; + uint8_t mac[6]; /**< Station MAC address */ + ip4_addr_t ip; /**< Station assigned IP address */ } tcpip_adapter_sta_info_t; +/** @brief WLAN AP: Connected stations list + * + * Used to retrieve IP address information about connected stations. + */ typedef struct { - tcpip_adapter_sta_info_t sta[ESP_WIFI_MAX_CONN_NUM]; - int num; + tcpip_adapter_sta_info_t sta[ESP_WIFI_MAX_CONN_NUM]; /**< Connected stations */ + int num; /**< Number of connected stations */ } tcpip_adapter_sta_list_t; #endif @@ -100,247 +91,250 @@ typedef struct { #define ESP_ERR_TCPIP_ADAPTER_NO_MEM ESP_ERR_TCPIP_ADAPTER_BASE + 0x06 #define ESP_ERR_TCPIP_ADAPTER_DHCP_NOT_STOPPED ESP_ERR_TCPIP_ADAPTER_BASE + 0x07 +/* @brief On-chip network interfaces */ typedef enum { - TCPIP_ADAPTER_IF_STA = 0, /**< ESP32 station interface */ - TCPIP_ADAPTER_IF_AP, /**< ESP32 soft-AP interface */ - TCPIP_ADAPTER_IF_ETH, /**< ESP32 ethernet interface */ + TCPIP_ADAPTER_IF_STA = 0, /**< Wi-Fi STA (station) interface */ + TCPIP_ADAPTER_IF_AP, /**< Wi-Fi soft-AP interface */ + TCPIP_ADAPTER_IF_ETH, /**< Ethernet interface */ TCPIP_ADAPTER_IF_MAX } tcpip_adapter_if_t; -/*type of DNS server*/ +/** @brief Type of DNS server */ typedef enum { - TCPIP_ADAPTER_DNS_MAIN= 0, /**DNS main server address*/ - TCPIP_ADAPTER_DNS_BACKUP, /**DNS backup server address,for STA only,support soft-AP in future*/ - TCPIP_ADAPTER_DNS_FALLBACK, /**DNS fallback server address,for STA only*/ - TCPIP_ADAPTER_DNS_MAX /**Max DNS */ + TCPIP_ADAPTER_DNS_MAIN= 0, /**< DNS main server address*/ + TCPIP_ADAPTER_DNS_BACKUP, /**< DNS backup server address (Wi-Fi STA and Ethernet only) */ + TCPIP_ADAPTER_DNS_FALLBACK, /**< DNS fallback server address (Wi-Fi STA and Ethernet only) */ + TCPIP_ADAPTER_DNS_MAX } tcpip_adapter_dns_type_t; -/*info of DNS server*/ +/** @brief DNS server info */ typedef struct { - ip_addr_t ip; + ip_addr_t ip; /**< IPV4 address of DNS server */ } tcpip_adapter_dns_info_t; -/* status of DHCP client or DHCP server */ +/** @brief Status of DHCP client or DHCP server */ typedef enum { - TCPIP_ADAPTER_DHCP_INIT = 0, /**< DHCP client/server in initial state */ - TCPIP_ADAPTER_DHCP_STARTED, /**< DHCP client/server already been started */ - TCPIP_ADAPTER_DHCP_STOPPED, /**< DHCP client/server already been stopped */ + TCPIP_ADAPTER_DHCP_INIT = 0, /**< DHCP client/server is in initial state (not yet started) */ + TCPIP_ADAPTER_DHCP_STARTED, /**< DHCP client/server has been started */ + TCPIP_ADAPTER_DHCP_STOPPED, /**< DHCP client/server has been stopped */ TCPIP_ADAPTER_DHCP_STATUS_MAX } tcpip_adapter_dhcp_status_t; -/* set the option mode for DHCP client or DHCP server */ +/** @brief Mode for DHCP client or DHCP server option functions */ typedef enum{ TCPIP_ADAPTER_OP_START = 0, - TCPIP_ADAPTER_OP_SET, /**< set option mode */ - TCPIP_ADAPTER_OP_GET, /**< get option mode */ + TCPIP_ADAPTER_OP_SET, /**< Set option */ + TCPIP_ADAPTER_OP_GET, /**< Get option */ TCPIP_ADAPTER_OP_MAX -} tcpip_adapter_option_mode_t; +} tcpip_adapter_dhcp_option_mode_t; +/* Deprecated name for tcpip_adapter_dhcp_option_mode_t, to remove after ESP-IDF V4.0 */ +typedef tcpip_adapter_dhcp_option_mode_t tcpip_adapter_option_mode_t; + +/** @brief Supported options for DHCP client or DHCP server */ typedef enum{ - TCPIP_ADAPTER_DOMAIN_NAME_SERVER = 6, /**< domain name server */ - TCPIP_ADAPTER_ROUTER_SOLICITATION_ADDRESS = 32, /**< solicitation router address */ - TCPIP_ADAPTER_REQUESTED_IP_ADDRESS = 50, /**< request IP address pool */ - TCPIP_ADAPTER_IP_ADDRESS_LEASE_TIME = 51, /**< request IP address lease time */ - TCPIP_ADAPTER_IP_REQUEST_RETRY_TIME = 52, /**< request IP address retry counter */ -} tcpip_adapter_option_id_t; - -struct tcpip_adapter_api_msg_s; -typedef int (*tcpip_adapter_api_fn)(struct tcpip_adapter_api_msg_s *msg); -typedef struct tcpip_adapter_api_msg_s { - int type; /**< The first field MUST be int */ - int ret; - tcpip_adapter_api_fn api_fn; - tcpip_adapter_if_t tcpip_if; - tcpip_adapter_ip_info_t *ip_info; - uint8_t *mac; - void *data; -} tcpip_adapter_api_msg_t; - -typedef struct tcpip_adapter_dns_param_s { - tcpip_adapter_dns_type_t dns_type; - tcpip_adapter_dns_info_t *dns_info; -} tcpip_adapter_dns_param_t; - -#define TCPIP_ADAPTER_TRHEAD_SAFE 1 -#define TCPIP_ADAPTER_IPC_LOCAL 0 -#define TCPIP_ADAPTER_IPC_REMOTE 1 - -#define TCPIP_ADAPTER_IPC_CALL(_if, _mac, _ip, _data, _fn) do {\ - tcpip_adapter_api_msg_t msg;\ - if (tcpip_inited == false) {\ - ESP_LOGE(TAG, "tcpip_adapter is not initialized!");\ - abort();\ - }\ - memset(&msg, 0, sizeof(msg));\ - msg.tcpip_if = (_if);\ - msg.mac = (uint8_t*)(_mac);\ - msg.ip_info = (tcpip_adapter_ip_info_t*)(_ip);\ - msg.data = (void*)(_data);\ - msg.api_fn = (_fn);\ - if (TCPIP_ADAPTER_IPC_REMOTE == tcpip_adapter_ipc_check(&msg)) {\ - ESP_LOGV(TAG, "check: remote, if=%d fn=%p\n", (_if), (_fn));\ - return msg.ret;\ - } else {\ - ESP_LOGV(TAG, "check: local, if=%d fn=%p\n", (_if), (_fn));\ - }\ -}while(0) - -typedef struct tcpip_adatper_ip_lost_timer_s { - bool timer_running; -} tcpip_adapter_ip_lost_timer_t; - -/** - * @brief Initialize tcpip adapter - * - * This will initialize TCPIP stack inside. + TCPIP_ADAPTER_DOMAIN_NAME_SERVER = 6, /**< Domain name server */ + TCPIP_ADAPTER_ROUTER_SOLICITATION_ADDRESS = 32, /**< Solicitation router address */ + TCPIP_ADAPTER_REQUESTED_IP_ADDRESS = 50, /**< Request specific IP address */ + TCPIP_ADAPTER_IP_ADDRESS_LEASE_TIME = 51, /**< Request IP address lease time */ + TCPIP_ADAPTER_IP_REQUEST_RETRY_TIME = 52, /**< Request IP address retry counter */ +} tcpip_adapter_dhcp_option_id_t; + +/* Deprecated name for tcpip_adapter_dhcp_option_id_t, to remove after ESP-IDF V4.0 */ +typedef tcpip_adapter_dhcp_option_id_t tcpip_adapter_option_id_t; + +/** + * @brief Initialize the underlying TCP/IP stack + * + * @note This function should be called exactly once from application code, when the application starts up. */ void tcpip_adapter_init(void); /** - * @brief Start the ethernet interface with specific MAC and IP + * @brief Cause the TCP/IP stack to start the Ethernet interface with specified MAC and IP + * + * @note This function should be called after the Ethernet MAC hardware is initialized. In the default configuration, application code does not need to call this function - it is called automatically by the default handler for the SYSTEM_EVENT_ETH_START event. * - * @param[in] mac: set MAC address of this interface - * @param[in] ip_info: set IP address of this interface + * @param[in] mac Set MAC address of this interface + * @param[in] ip_info Set IP address of this interface * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS - * ESP_ERR_NO_MEM + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * - ESP_ERR_NO_MEM */ esp_err_t tcpip_adapter_eth_start(uint8_t *mac, tcpip_adapter_ip_info_t *ip_info); /** - * @brief Start the Wi-Fi station interface with specific MAC and IP + * @brief Cause the TCP/IP stack to start the Wi-Fi station interface with specified MAC and IP * - * Station interface will be initialized, connect WiFi stack with TCPIP stack. * - * @param[in] mac: set MAC address of this interface - * @param[in] ip_info: set IP address of this interface + * @note This function should be called after the Wi-Fi Station hardware is initialized. In the default configuration, application code does not need to call this function - it is called automatically by the default handler for the SYSTEM_EVENT_STA_START event. * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS - * ESP_ERR_NO_MEM + * @param[in] mac Set MAC address of this interface + * @param[in] ip_info Set IP address of this interface + * + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * - ESP_ERR_NO_MEM */ esp_err_t tcpip_adapter_sta_start(uint8_t *mac, tcpip_adapter_ip_info_t *ip_info); /** - * @brief Start the Wi-Fi AP interface with specific MAC and IP + * @brief Cause the TCP/IP stack to start the Wi-Fi AP interface with specified MAC and IP * - * softAP interface will be initialized, connect WiFi stack with TCPIP stack. + * @note This function should be called after the Wi-Fi AP hardware is initialized. In the default configuration, application code does not need to call this function - it is called automatically by the default handler for the SYSTEM_EVENT_AP_START event. * - * DHCP server will be started automatically. + * DHCP server will be started automatically when this function is called. * - * @param[in] mac: set MAC address of this interface - * @param[in] ip_info: set IP address of this interface + * @param[in] mac Set MAC address of this interface + * @param[in] ip_info Set IP address of this interface * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS - * ESP_ERR_NO_MEM + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * - ESP_ERR_NO_MEM */ esp_err_t tcpip_adapter_ap_start(uint8_t *mac, tcpip_adapter_ip_info_t *ip_info); /** - * @brief Stop an interface + * @brief Cause the TCP/IP stack to stop a network interface + * + * Causes TCP/IP stack to clean up this interface. This includes stopping the DHCP server or client, if they are started. * - * The interface will be cleanup in this API, if DHCP server/client are started, will be stopped. + * @note This API is called by the default Wi-Fi and Ethernet event handlers if the underlying network driver reports that the + * interface has stopped. * - * @param[in] tcpip_if: the interface which will be started + * @note To stop an interface from application code, call the network-specific API (esp_wifi_stop() or esp_eth_stop()). + * The driver layer will then send a stop event and the event handler should call this API. + * Otherwise, the driver and MAC layer will remain started. * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS - * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY + * @param[in] tcpip_if Interface which will be stopped + * + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * - ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY */ esp_err_t tcpip_adapter_stop(tcpip_adapter_if_t tcpip_if); /** - * @brief Bring up an interface + * @brief Cause the TCP/IP stack to bring up an interface + * + * @note This function is called automatically by the default event handlers for the Wi-Fi Station and Ethernet interfaces, + * in response to the SYSTEM_EVENT_STA_CONNECTED and SYSTEM_EVENT_ETH_CONNECTED events, respectively. * - * Only station interface need to be brought up, since station interface will be shut down when disconnect. + * @note This function is not normally used with Wi-Fi AP interface. If the AP interface is started, it is up. * - * @param[in] tcpip_if: the interface which will be up + * @param[in] tcpip_if Interface to bring up * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY */ esp_err_t tcpip_adapter_up(tcpip_adapter_if_t tcpip_if); /** - * @brief Shut down an interface + * @brief Cause the TCP/IP stack to shutdown an interface * - * Only station interface need to be shut down, since station interface will be brought up when connect. + * @note This function is called automatically by the default event handlers for the Wi-Fi Station and Ethernet interfaces, + * in response to the SYSTEM_EVENT_STA_DISCONNECTED and SYSTEM_EVENT_ETH_DISCONNECTED events, respectively. * - * @param[in] tcpip_if: the interface which will be down + * @note This function is not normally used with Wi-Fi AP interface. If the AP interface is stopped, it is down. * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY + * @param[in] tcpip_if Interface to shutdown + * + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY */ esp_err_t tcpip_adapter_down(tcpip_adapter_if_t tcpip_if); /** - * @brief Get interface's IP information + * @brief Get interface's IP address information + * + * If the interface is up, IP information is read directly from the TCP/IP stack. * - * There has an IP information copy in adapter library, if interface is up, get IP information from - * interface, otherwise get from copy. + * If the interface is down, IP information is read from a copy kept in the TCP/IP adapter + * library itself. * - * @param[in] tcpip_if: the interface which we want to get IP information - * @param[out] ip_info: If successful, IP information will be returned in this argument. + * @param[in] tcpip_if Interface to get IP information + * @param[out] ip_info If successful, IP information will be returned in this argument. * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS */ esp_err_t tcpip_adapter_get_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ip_info_t *ip_info); /** - * @brief Set interface's IP information + * @brief Set interface's IP address information + * + * This function is mainly used to set a static IP on an interface. * - * There has an IP information copy in adapter library, if interface is up, also set interface's IP. - * DHCP client/server should be stopped before set new IP information. + * If the interface is up, the new IP information is set directly in the TCP/IP stack. * - * This function is mainly used for setting static IP. + * The copy of IP information kept in the TCP/IP adapter library is also updated (this + * copy is returned if the IP is queried while the interface is still down.) * - * @param[in] tcpip_if: the interface which we want to set IP information - * @param[in] ip_info: store the IP information which needs to be set to specified interface + * @note DHCP client/server must be stopped before setting new IP information. * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * @note Calling this interface for the Wi-Fi STA or Ethernet interfaces may generate a + * SYSTEM_EVENT_STA_GOT_IP or SYSTEM_EVENT_ETH_GOT_IP event. + * + * @param[in] tcpip_if Interface to set IP information + * @param[in] ip_info IP information to set on the specified interface + * + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * - ESP_ERR_TCPIP_ADAPTER_DHCP_NOT_STOPPED If DHCP server or client is still running */ -esp_err_t tcpip_adapter_set_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ip_info_t *ip_info); +esp_err_t tcpip_adapter_set_ip_info(tcpip_adapter_if_t tcpip_if, const tcpip_adapter_ip_info_t *ip_info); /** - * @brief Set DNS Server's information + * @brief Set DNS Server information + * + * This function behaves differently for different interfaces: * - * There has an DNS Server information copy in adapter library, set DNS Server for appointed interface and type. + * - For Wi-Fi Station interface and Ethernet interface, up to three types of DNS server can be set (in order of priority): + * - Main DNS Server (TCPIP_ADAPTER_DNS_MAIN) + * - Backup DNS Server (TCPIP_ADAPTER_DNS_BACKUP) + * - Fallback DNS Server (TCPIP_ADAPTER_DNS_FALLBACK) * - * 1.In station mode, if dhcp client is enabled, then only the fallback DNS server can be set(TCPIP_ADAPTER_DNS_FALLBACK). - * Fallback DNS server is only used if no DNS servers are set via DHCP. - * If dhcp client is disabled, then need to set main/backup dns server(TCPIP_ADAPTER_DNS_MAIN, TCPIP_ADAPTER_DNS_BACKUP). - * - * 2.In soft-AP mode, the DNS Server's main dns server offered to the station is the IP address of soft-AP, - * if the application don't want to use the IP address of soft-AP, they can set the main dns server. + * If DHCP client is enabled, main and backup DNS servers will be updated automatically from the DHCP lease if the relevant DHCP options are set. Fallback DNS Server is never updated from the DHCP lease and is designed to be set via this API. * - * This function is mainly used for setting static or Fallback DNS Server. + * If DHCP client is disabled, all DNS server types can be set via this API only. * - * @param[in] tcpip_if: the interface which we want to set DNS Server information - * @param[in] type: the type of DNS Server,including TCPIP_ADAPTER_DNS_MAIN, TCPIP_ADAPTER_DNS_BACKUP, TCPIP_ADAPTER_DNS_FALLBACK - * @param[in] dns: the DNS Server address to be set - * - * @return + * - For Wi-Fi AP interface, the Main DNS Server setting is used by the DHCP server to provide a DNS Server option to DHCP clients (Wi-Fi stations). + * - The default Main DNS server is the IP of the Wi-Fi AP interface itself. + * - This function can override it by setting server type TCPIP_ADAPTER_DNS_MAIN. + * - Other DNS Server types are not supported for the Wi-Fi AP interface. + * + * @param[in] tcpip_if Interface to set DNS Server information + * @param[in] type Type of DNS Server to set: TCPIP_ADAPTER_DNS_MAIN, TCPIP_ADAPTER_DNS_BACKUP, TCPIP_ADAPTER_DNS_FALLBACK + * @param[in] dns DNS Server address to set + * + * @return * - ESP_OK on success * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS invalid params */ esp_err_t tcpip_adapter_set_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dns_type_t type, tcpip_adapter_dns_info_t *dns); /** - * @brief Get DNS Server's information + * @brief Get DNS Server information + * + * Return the currently configured DNS Server address for the specified interface and Server type. * - * When set the DNS Server information successfully, can get the DNS Server's information via the appointed tcpip_if and type + * This may be result of a previous call to tcpip_adapter_set_dns_info(). If the interface's DHCP client is enabled, + * the Main or Backup DNS Server may be set by the current DHCP lease. * - * This function is mainly used for getting DNS Server information. + * @param[in] tcpip_if Interface to get DNS Server information + * @param[in] type Type of DNS Server to get: TCPIP_ADAPTER_DNS_MAIN, TCPIP_ADAPTER_DNS_BACKUP, TCPIP_ADAPTER_DNS_FALLBACK + * @param[out] dns DNS Server result is written here on success * - * @param[in] tcpip_if: the interface which we want to get DNS Server information - * @param[in] type: the type of DNS Server,including TCPIP_ADAPTER_DNS_MAIN, TCPIP_ADAPTER_DNS_BACKUP, TCPIP_ADAPTER_DNS_FALLBACK - * @param[in] dns: the DNS Server address to be get - * - * @return + * @return * - ESP_OK on success * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS invalid params */ @@ -349,60 +343,66 @@ esp_err_t tcpip_adapter_get_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ /** * @brief Get interface's old IP information * - * When the interface successfully gets a valid IP from DHCP server or static configured, a copy of - * the IP information is set to the old IP information. When IP lost timer expires, the old IP - * information is reset to 0. + * Returns an "old" IP address previously stored for the interface when the valid IP changed. * - * @param[in] tcpip_if: the interface which we want to get old IP information - * @param[out] ip_info: If successful, IP information will be returned in this argument. + * If the IP lost timer has expired (meaning the interface was down for longer than the configured interval) + * then the old IP information will be zero. * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * @param[in] tcpip_if Interface to get old IP information + * @param[out] ip_info If successful, IP information will be returned in this argument. + * + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS */ esp_err_t tcpip_adapter_get_old_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ip_info_t *ip_info); /** - * @brief Set interface's old IP information + * @brief Set interface old IP information + * + * This function is called from the DHCP client for the Wi-Fi STA and Ethernet interfaces, before a new IP is set. It is also called from the default handlers for the SYSTEM_EVENT_STA_CONNECTED and SYSTEM_EVENT_ETH_CONNECTED events. + * + * Calling this function stores the previously configured IP, which can be used to determine if the IP changes in the future. * - * When the interface successfully gets a valid IP from DHCP server or static configured, a copy of - * the IP information is set to the old IP information. When IP lost timer expires, the old IP - * information is reset to 0. + * If the interface is disconnected or down for too long, the "IP lost timer" will expire (after the configured interval) and set the old IP information to zero. * - * @param[in] tcpip_if: the interface which we want to set old IP information - * @param[in] ip_info: store the IP information which needs to be set to specified interface + * @param[in] tcpip_if Interface to set old IP information + * @param[in] ip_info Store the old IP information for the specified interface * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS */ -esp_err_t tcpip_adapter_set_old_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ip_info_t *ip_info); +esp_err_t tcpip_adapter_set_old_ip_info(tcpip_adapter_if_t tcpip_if, const tcpip_adapter_ip_info_t *ip_info); /** - * @brief create interface's linklocal IPv6 information + * @brief Create interface link-local IPv6 address * - * @note this function will create a linklocal IPv6 address about input interface, - * if this address status changed to preferred, will call event call back , - * notify user linklocal IPv6 address has been verified + * Cause the TCP/IP stack to create a link-local IPv6 address for the specified interface. * - * @param[in] tcpip_if: the interface which we want to set IP information + * This function also registers a callback for the specified interface, so that if the link-local address becomes verified as the preferred address then a SYSTEM_EVENT_GOT_IP6 event will be sent. * + * @param[in] tcpip_if Interface to create a link-local IPv6 address * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS */ esp_err_t tcpip_adapter_create_ip6_linklocal(tcpip_adapter_if_t tcpip_if); /** - * @brief get interface's linkloacl IPv6 information + * @brief Get interface link-local IPv6 address * - * There has an IPv6 information copy in adapter library, if interface is up,and IPv6 info - * is preferred,it will get IPv6 linklocal IP successfully + * If the specified interface is up and a preferred link-local IPv6 address + * has been created for the interface, return a copy of it. * - * @param[in] tcpip_if: the interface which we want to set IP information - * @param[in] if_ip6: If successful, IPv6 information will be returned in this argument. + * @param[in] tcpip_if Interface to get link-local IPv6 address + * @param[out] if_ip6 IPv6 information will be returned in this argument if successful. * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * @return + * - ESP_OK + * - ESP_FAIL If interface is down, does not have a link-local IPv6 address, or the link-local IPv6 address is not a preferred address. */ esp_err_t tcpip_adapter_get_ip6_linklocal(tcpip_adapter_if_t tcpip_if, ip6_addr_t *if_ip6); @@ -413,218 +413,251 @@ esp_err_t tcpip_adapter_set_mac(tcpip_adapter_if_t tcpip_if, uint8_t *mac); #endif /** - * @brief Get DHCP server's status + * @brief Get DHCP Server status * - * @param[in] tcpip_if: the interface which we will get status of DHCP server - * @param[out] status: If successful, the status of DHCP server will be return in this argument. + * @param[in] tcpip_if Interface to get status of DHCP server. + * @param[out] status If successful, the status of the DHCP server will be returned in this argument. * - * @return ESP_OK + * @return + * - ESP_OK */ esp_err_t tcpip_adapter_dhcps_get_status(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dhcp_status_t *status); /** - * @brief Set or Get DHCP server's option + * @brief Set or Get DHCP server option * - * @param[in] opt_op: option operate type, 1 for SET, 2 for GET. - * @param[in] opt_id: option index, 32 for ROUTER, 50 for IP POLL, 51 for LEASE TIME, 52 for REQUEST TIME - * @param[in] opt_val: option parameter - * @param[in] opt_len: option length + * @param[in] opt_op TCPIP_ADAPTER_OP_SET to set an option, TCPIP_ADAPTER_OP_GET to get an option. + * @param[in] opt_id Option index to get or set, must be one of the supported enum values. + * @param[inout] opt_val Pointer to the option parameter. + * @param[in] opt_len Length of the option parameter. * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS - * ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED - * ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * - ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED + * - ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED */ -esp_err_t tcpip_adapter_dhcps_option(tcpip_adapter_option_mode_t opt_op, tcpip_adapter_option_id_t opt_id, void *opt_val, uint32_t opt_len); +esp_err_t tcpip_adapter_dhcps_option(tcpip_adapter_dhcp_option_mode_t opt_op, tcpip_adapter_dhcp_option_id_t opt_id, void *opt_val, uint32_t opt_len); /** * @brief Start DHCP server * - * @note Currently DHCP server is bind to softAP interface. + * @note Currently DHCP server is only supported on the Wi-Fi AP interface. * - * @param[in] tcpip_if: the interface which we will start DHCP server + * @param[in] tcpip_if Interface to start DHCP server. Must be TCPIP_ADAPTER_IF_AP. * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS - * ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * - ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED */ esp_err_t tcpip_adapter_dhcps_start(tcpip_adapter_if_t tcpip_if); /** * @brief Stop DHCP server * - * @note Currently DHCP server is bind to softAP interface. + * @note Currently DHCP server is only supported on the Wi-Fi AP interface. * - * @param[in] tcpip_if: the interface which we will stop DHCP server + * @param[in] tcpip_if Interface to stop DHCP server. Must be TCPIP_ADAPTER_IF_AP. * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS - * ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPED - * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * - ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED + * - ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY */ esp_err_t tcpip_adapter_dhcps_stop(tcpip_adapter_if_t tcpip_if); /** * @brief Get DHCP client status * - * @param[in] tcpip_if: the interface which we will get status of DHCP client - * @param[out] status: If successful, the status of DHCP client will be return in this argument. + * @param[in] tcpip_if Interface to get status of DHCP client + * @param[out] status If successful, the status of DHCP client will be returned in this argument. * - * @return ESP_OK + * @return + * - ESP_OK */ esp_err_t tcpip_adapter_dhcpc_get_status(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dhcp_status_t *status); /** * @brief Set or Get DHCP client's option * - * @note This function is not implement now. + * @note This function is not yet implemented * - * @param[in] opt_op: option operate type, 1 for SET, 2 for GET. - * @param[in] opt_id: option index, 32 for ROUTER, 50 for IP POLL, 51 for LEASE TIME, 52 for REQUEST TIME - * @param[in] opt_val: option parameter - * @param[in] opt_len: option length + * @param[in] opt_op TCPIP_ADAPTER_OP_SET to set an option, TCPIP_ADAPTER_OP_GET to get an option. + * @param[in] opt_id Option index to get or set, must be one of the supported enum values. + * @param[inout] opt_val Pointer to the option parameter. + * @param[in] opt_len Length of the option parameter. * - * @return ESP_OK + * @return + * - ESP_ERR_NOT_SUPPORTED (not implemented) */ -esp_err_t tcpip_adapter_dhcpc_option(tcpip_adapter_option_mode_t opt_op, tcpip_adapter_option_id_t opt_id, void *opt_val, uint32_t opt_len); +esp_err_t tcpip_adapter_dhcpc_option(tcpip_adapter_dhcp_option_mode_t opt_op, tcpip_adapter_dhcp_option_id_t opt_id, void *opt_val, uint32_t opt_len); /** - * @brief Start DHCP client + * @brief Start DHCP client * - * @note Currently DHCP client is bind to station interface. + * @note DHCP Client is only supported for the Wi-Fi station and Ethernet interfaces. * - * @param[in] tcpip_if: the interface which we will start DHCP client + * @note The default event handlers for the SYSTEM_EVENT_STA_CONNECTED and SYSTEM_EVENT_ETH_CONNECTED events call this function. * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS - * ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED - * ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED + * @param[in] tcpip_if Interface to start the DHCP client + * + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * - ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED + * - ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED */ esp_err_t tcpip_adapter_dhcpc_start(tcpip_adapter_if_t tcpip_if); /** * @brief Stop DHCP client * - * @note Currently DHCP client is bind to station interface. + * @note DHCP Client is only supported for the Wi-Fi station and Ethernet interfaces. + * + * @note Calling tcpip_adapter_stop() or tcpip_adapter_down() will also stop the DHCP Client if it is running. * - * @param[in] tcpip_if: the interface which we will stop DHCP client + * @param[in] tcpip_if Interface to stop the DHCP client * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS - * ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPED - * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * - ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED + * - ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY */ esp_err_t tcpip_adapter_dhcpc_stop(tcpip_adapter_if_t tcpip_if); /** - * @brief Get data from ethernet interface + * @brief Receive an Ethernet frame from the Ethernet interface + * + * This function will automatically be installed by esp_eth_init(). The Ethernet driver layer will then call this function to forward frames to the TCP/IP stack. * - * This function should be installed by esp_eth_init, so Ethernet packets will be forward to TCPIP stack. + * @note Application code does not usually need to use this function directly. * - * @param[in] void *buffer: the received data point - * @param[in] uint16_t len: the received data length - * @param[in] void *eb: parameter + * @param[in] buffer Received data + * @param[in] len Length of the data frame + * @param[in] eb Pointer to internal Wi-Fi buffer (ignored for Ethernet) * - * @return ESP_OK + * @return + * - ESP_OK */ esp_err_t tcpip_adapter_eth_input(void *buffer, uint16_t len, void *eb); /** - * @brief Get data from station interface + * @brief Receive an 802.11 data frame from the Wi-Fi Station interface * - * This function should be installed by esp_wifi_reg_rxcb, so WiFi packets will be forward to TCPIP stack. + * This function should be installed by calling esp_wifi_reg_rxcb(). The Wi-Fi driver layer will then call this function to forward frames to the TCP/IP stack. * - * @param[in] void *buffer: the received data point - * @param[in] uint16_t len: the received data length - * @param[in] void *eb: parameter + * @note Installation happens automatically in the default handler for the SYSTEM_EVENT_STA_CONNECTED event. * - * @return ESP_OK + * @note Application code does not usually need to call this function directly. + * + * @param[in] buffer Received data + * @param[in] len Length of the data frame + * @param[in] eb Pointer to internal Wi-Fi buffer + * + * @return + * - ESP_OK */ esp_err_t tcpip_adapter_sta_input(void *buffer, uint16_t len, void *eb); /** - * @brief Get data from softAP interface + * @brief Receive an 802.11 data frame from the Wi-Fi AP interface + * + * This function should be installed by calling esp_wifi_reg_rxcb(). The Wi-Fi driver layer will then call this function to forward frames to the TCP/IP stack. * - * This function should be installed by esp_wifi_reg_rxcb, so WiFi packets will be forward to TCPIP stack. + * @note Installation happens automatically in the default handler for the SYSTEM_EVENT_AP_START event. * - * @param[in] void *buffer: the received data point - * @param[in] uint16_t len: the received data length - * @param[in] void *eb: parameter + * @note Application code does not usually need to call this function directly. * - * @return ESP_OK + * @param[in] buffer Received data + * @param[in] len Length of the data frame + * @param[in] eb Pointer to internal Wi-Fi buffer + * + * @return + * - ESP_OK */ esp_err_t tcpip_adapter_ap_input(void *buffer, uint16_t len, void *eb); /** - * @brief Get WiFi interface index + * @brief Get network interface index * - * Get WiFi interface from TCPIP interface struct pointer. + * Get network interface from TCP/IP implementation-specific interface pointer. * - * @param[in] void *dev: adapter interface + * @param[in] dev Implementation-specific TCP/IP stack interface pointer. * - * @return ESP_IF_WIFI_STA - * ESP_IF_WIFI_AP - * ESP_IF_ETH - * ESP_IF_MAX + * @return + * - ESP_IF_WIFI_STA + * - ESP_IF_WIFI_AP + * - ESP_IF_ETH + * - ESP_IF_MAX - invalid parameter */ esp_interface_t tcpip_adapter_get_esp_if(void *dev); /** - * @brief Get the station information list + * @brief Get IP information for stations connected to the Wi-Fi AP interface * - * @param[in] wifi_sta_list_t *wifi_sta_list: station list info - * @param[out] tcpip_adapter_sta_list_t *tcpip_sta_list: station list info + * @param[in] wifi_sta_list Wi-Fi station info list, returned from esp_wifi_ap_get_sta_list() + * @param[out] tcpip_sta_list IP layer station info list, corresponding to MAC addresses provided in wifi_sta_list * - * @return ESP_OK - * ESP_ERR_TCPIP_ADAPTER_NO_MEM - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS + * @return + * - ESP_OK + * - ESP_ERR_TCPIP_ADAPTER_NO_MEM + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS */ -esp_err_t tcpip_adapter_get_sta_list(wifi_sta_list_t *wifi_sta_list, tcpip_adapter_sta_list_t *tcpip_sta_list); +esp_err_t tcpip_adapter_get_sta_list(const wifi_sta_list_t *wifi_sta_list, tcpip_adapter_sta_list_t *tcpip_sta_list); #define TCPIP_HOSTNAME_MAX_SIZE 32 /** - * @brief Set the hostname to the interface + * @brief Set the hostname of an interface * - * @param[in] tcpip_if: the interface which we will set the hostname - * @param[in] hostname: the host name for set the interface, the max length of hostname is 32 bytes + * @param[in] tcpip_if Interface to set the hostname + * @param[in] hostname New hostname for the interface. Maximum length 32 bytes. * - * @return ESP_OK:success - * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY:interface status error - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS:parameter error + * @return + * - ESP_OK - success + * - ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY - interface status error + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS - parameter error */ esp_err_t tcpip_adapter_set_hostname(tcpip_adapter_if_t tcpip_if, const char *hostname); /** - * @brief Get the hostname from the interface + * @brief Get interface hostname. * - * @param[in] tcpip_if: the interface which we will get the hostname - * @param[in] hostname: the host name from the interface + * @param[in] tcpip_if Interface to get the hostname + * @param[out] hostname Returns a pointer to the hostname. May be NULL if no hostname is set. If set non-NULL, pointer remains valid (and string may change if the hostname changes). * - * @return ESP_OK:success - * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY:interface status error - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS:parameter error + * @return + * - ESP_OK - success + * - ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY - interface status error + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS - parameter error */ esp_err_t tcpip_adapter_get_hostname(tcpip_adapter_if_t tcpip_if, const char **hostname); /** - * @brief Get the LwIP netif* that is assigned to the interface + * @brief Get the TCP/IP stack-specific interface that is assigned to a given interface + * + * @note For lwIP, this returns a pointer to a netif structure. * - * @param[in] tcpip_if: the interface which we will get the hostname - * @param[out] void ** netif: pointer to fill the resulting interface + * @param[in] tcpip_if Interface to get the implementation-specific interface + * @param[out] netif Pointer to the implementation-specific interface * - * @return ESP_OK:success - * ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY:interface status error - * ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS:parameter error + * @return + * - ESP_OK - success + * - ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY - interface status error + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS - parameter error */ esp_err_t tcpip_adapter_get_netif(tcpip_adapter_if_t tcpip_if, void ** netif); /** * @brief Test if supplied interface is up or down * - * @param[in] tcpip_if: the interface which we will get the hostname + * @param[in] tcpip_if Interface to test up/down status * - * @return true: tcpip_if is UP - * false: tcpip_if id DOWN + * @return + * - true - Interface is up + * - false - Interface is down */ bool tcpip_adapter_is_netif_up(tcpip_adapter_if_t tcpip_if); @@ -633,4 +666,3 @@ bool tcpip_adapter_is_netif_up(tcpip_adapter_if_t tcpip_if); #endif #endif /* _TCPIP_ADAPTER_H_ */ - diff --git a/tools/sdk/include/tcpip_adapter/tcpip_adapter_internal.h b/tools/sdk/include/tcpip_adapter/tcpip_adapter_internal.h new file mode 100644 index 00000000000..93dfdeedcea --- /dev/null +++ b/tools/sdk/include/tcpip_adapter/tcpip_adapter_internal.h @@ -0,0 +1,66 @@ +// Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include "tcpip_adapter.h" +#include "rom/queue.h" + +struct tcpip_adapter_api_msg_s; + +typedef int (*tcpip_adapter_api_fn)(struct tcpip_adapter_api_msg_s *msg); + +typedef struct tcpip_adapter_api_msg_s { + int type; /**< The first field MUST be int */ + int ret; + tcpip_adapter_api_fn api_fn; + tcpip_adapter_if_t tcpip_if; + tcpip_adapter_ip_info_t *ip_info; + uint8_t *mac; + void *data; +} tcpip_adapter_api_msg_t; + +typedef struct tcpip_adapter_dns_param_s { + tcpip_adapter_dns_type_t dns_type; + tcpip_adapter_dns_info_t *dns_info; +} tcpip_adapter_dns_param_t; + +typedef struct tcpip_adapter_ip_lost_timer_s { + bool timer_running; +} tcpip_adapter_ip_lost_timer_t; + + +#define TCPIP_ADAPTER_TRHEAD_SAFE 1 +#define TCPIP_ADAPTER_IPC_LOCAL 0 +#define TCPIP_ADAPTER_IPC_REMOTE 1 + +#define TCPIP_ADAPTER_IPC_CALL(_if, _mac, _ip, _data, _fn) do {\ + tcpip_adapter_api_msg_t msg;\ + if (tcpip_inited == false) {\ + ESP_LOGE(TAG, "tcpip_adapter is not initialized!");\ + abort();\ + }\ + memset(&msg, 0, sizeof(msg));\ + msg.tcpip_if = (_if);\ + msg.mac = (uint8_t*)(_mac);\ + msg.ip_info = (tcpip_adapter_ip_info_t*)(_ip);\ + msg.data = (void*)(_data);\ + msg.api_fn = (_fn);\ + if (TCPIP_ADAPTER_IPC_REMOTE == tcpip_adapter_ipc_check(&msg)) {\ + ESP_LOGV(TAG, "check: remote, if=%d fn=%p\n", (_if), (_fn));\ + return msg.ret;\ + } else {\ + ESP_LOGV(TAG, "check: local, if=%d fn=%p\n", (_if), (_fn));\ + }\ +} while(0) diff --git a/tools/sdk/ld/esp32.common.ld b/tools/sdk/ld/esp32.common.ld index b7a5d5b7070..01510f67cf9 100644 --- a/tools/sdk/ld/esp32.common.ld +++ b/tools/sdk/ld/esp32.common.ld @@ -14,7 +14,7 @@ SECTIONS { . = ALIGN(4); - *( .rtc.literal .rtc.text) + *( .rtc.literal .rtc.text .rtc.text.*) *rtc_wake_stub*.*(.literal .text .literal.* .text.*) _rtc_text_end = ABSOLUTE(.); @@ -56,7 +56,7 @@ SECTIONS { _rtc_data_start = ABSOLUTE(.); - *( .rtc.data .rtc.rodata) + *( .rtc.data .rtc.data.* .rtc.rodata .rtc.rodata.*) *rtc_wake_stub*.*(.data .rodata .data.* .rodata.* .bss .bss.*) _rtc_data_end = ABSOLUTE(.); diff --git a/tools/sdk/ld/esp32.extram.bss.ld b/tools/sdk/ld/esp32.extram.bss.ld index 6e0ab496e53..582f6eb6ea2 100644 --- a/tools/sdk/ld/esp32.extram.bss.ld +++ b/tools/sdk/ld/esp32.extram.bss.ld @@ -12,6 +12,7 @@ SECTIONS *libpp.a:(.dynsbss .sbss .sbss.* .gnu.linkonce.sb.* .scommon .sbss2.* .gnu.linkonce.sb2.* .dynbss .bss .bss.* .share.mem .gnu.linkonce.b.* COMMON) *liblwip.a:(.dynsbss .sbss .sbss.* .gnu.linkonce.sb.* .scommon .sbss2.* .gnu.linkonce.sb2.* .dynbss .bss .bss.* .share.mem .gnu.linkonce.b.* COMMON) *libbt.a:(EXCLUDE_FILE (libbtdm_app.a) .dynsbss .sbss .sbss.* .gnu.linkonce.sb.* .scommon .sbss2.* .gnu.linkonce.sb2.* .dynbss .bss .bss.* .share.mem .gnu.linkonce.b.* COMMON) + . = ALIGN(4); _ext_ram_bss_end = ABSOLUTE(.); } > extern_ram_seg } diff --git a/tools/sdk/lib/libapp_trace.a b/tools/sdk/lib/libapp_trace.a index c8533ac5ec6..3f402175236 100644 Binary files a/tools/sdk/lib/libapp_trace.a and b/tools/sdk/lib/libapp_trace.a differ diff --git a/tools/sdk/lib/libapp_update.a b/tools/sdk/lib/libapp_update.a index 6a4603be406..d408d9e8450 100644 Binary files a/tools/sdk/lib/libapp_update.a and b/tools/sdk/lib/libapp_update.a differ diff --git a/tools/sdk/lib/libasio.a b/tools/sdk/lib/libasio.a index ce85e6c20ee..fb498cc70e4 100644 Binary files a/tools/sdk/lib/libasio.a and b/tools/sdk/lib/libasio.a differ diff --git a/tools/sdk/lib/libbootloader_support.a b/tools/sdk/lib/libbootloader_support.a index c23dc8e2978..54ddf6c5060 100644 Binary files a/tools/sdk/lib/libbootloader_support.a and b/tools/sdk/lib/libbootloader_support.a differ diff --git a/tools/sdk/lib/libbt.a b/tools/sdk/lib/libbt.a index af4cad0f34c..9fefa58c6f9 100644 Binary files a/tools/sdk/lib/libbt.a and b/tools/sdk/lib/libbt.a differ diff --git a/tools/sdk/lib/libbtdm_app.a b/tools/sdk/lib/libbtdm_app.a old mode 100755 new mode 100644 index d12422460b5..b61143cd2cb Binary files a/tools/sdk/lib/libbtdm_app.a and b/tools/sdk/lib/libbtdm_app.a differ diff --git a/tools/sdk/lib/libcoap.a b/tools/sdk/lib/libcoap.a index b84dd7d4eb6..397808cfa5d 100644 Binary files a/tools/sdk/lib/libcoap.a and b/tools/sdk/lib/libcoap.a differ diff --git a/tools/sdk/lib/libcoexist.a b/tools/sdk/lib/libcoexist.a index f92ca42c324..4fea67bd750 100644 Binary files a/tools/sdk/lib/libcoexist.a and b/tools/sdk/lib/libcoexist.a differ diff --git a/tools/sdk/lib/libconsole.a b/tools/sdk/lib/libconsole.a index 2980accdcce..e6e9c0e87df 100644 Binary files a/tools/sdk/lib/libconsole.a and b/tools/sdk/lib/libconsole.a differ diff --git a/tools/sdk/lib/libcore.a b/tools/sdk/lib/libcore.a index 115ff3bed2b..21754394133 100644 Binary files a/tools/sdk/lib/libcore.a and b/tools/sdk/lib/libcore.a differ diff --git a/tools/sdk/lib/libcxx.a b/tools/sdk/lib/libcxx.a index 3789c5d27bd..08318cf97b5 100644 Binary files a/tools/sdk/lib/libcxx.a and b/tools/sdk/lib/libcxx.a differ diff --git a/tools/sdk/lib/libdriver.a b/tools/sdk/lib/libdriver.a index e6b26581f85..2d93e15893e 100644 Binary files a/tools/sdk/lib/libdriver.a and b/tools/sdk/lib/libdriver.a differ diff --git a/tools/sdk/lib/libesp-tls.a b/tools/sdk/lib/libesp-tls.a index 42095b09bb8..75dfb287975 100644 Binary files a/tools/sdk/lib/libesp-tls.a and b/tools/sdk/lib/libesp-tls.a differ diff --git a/tools/sdk/lib/libesp32-camera.a b/tools/sdk/lib/libesp32-camera.a index 3b8a8930718..1919d80eaad 100644 Binary files a/tools/sdk/lib/libesp32-camera.a and b/tools/sdk/lib/libesp32-camera.a differ diff --git a/tools/sdk/lib/libesp32.a b/tools/sdk/lib/libesp32.a index 6ccedaf87a8..4d0d3ca491d 100644 Binary files a/tools/sdk/lib/libesp32.a and b/tools/sdk/lib/libesp32.a differ diff --git a/tools/sdk/lib/libesp_adc_cal.a b/tools/sdk/lib/libesp_adc_cal.a index 5be5c0b14de..e442d07cff9 100644 Binary files a/tools/sdk/lib/libesp_adc_cal.a and b/tools/sdk/lib/libesp_adc_cal.a differ diff --git a/tools/sdk/lib/libesp_event.a b/tools/sdk/lib/libesp_event.a index a4aed6a8b60..2846eacd5d7 100644 Binary files a/tools/sdk/lib/libesp_event.a and b/tools/sdk/lib/libesp_event.a differ diff --git a/tools/sdk/lib/libesp_http_client.a b/tools/sdk/lib/libesp_http_client.a index e62c1f4e107..cc96a106b75 100644 Binary files a/tools/sdk/lib/libesp_http_client.a and b/tools/sdk/lib/libesp_http_client.a differ diff --git a/tools/sdk/lib/libesp_http_server.a b/tools/sdk/lib/libesp_http_server.a index 0096b272350..24284fec706 100644 Binary files a/tools/sdk/lib/libesp_http_server.a and b/tools/sdk/lib/libesp_http_server.a differ diff --git a/tools/sdk/lib/libesp_https_ota.a b/tools/sdk/lib/libesp_https_ota.a index f4cecb7c72a..294a1a8a253 100644 Binary files a/tools/sdk/lib/libesp_https_ota.a and b/tools/sdk/lib/libesp_https_ota.a differ diff --git a/tools/sdk/lib/libesp_https_server.a b/tools/sdk/lib/libesp_https_server.a index 45408e4d31f..84ca6c9da23 100644 Binary files a/tools/sdk/lib/libesp_https_server.a and b/tools/sdk/lib/libesp_https_server.a differ diff --git a/tools/sdk/lib/libesp_ringbuf.a b/tools/sdk/lib/libesp_ringbuf.a index abad2528965..f1e7a807ad4 100644 Binary files a/tools/sdk/lib/libesp_ringbuf.a and b/tools/sdk/lib/libesp_ringbuf.a differ diff --git a/tools/sdk/lib/libespnow.a b/tools/sdk/lib/libespnow.a index e1ec61158e8..cd718250a3a 100644 Binary files a/tools/sdk/lib/libespnow.a and b/tools/sdk/lib/libespnow.a differ diff --git a/tools/sdk/lib/libethernet.a b/tools/sdk/lib/libethernet.a index b3615da5193..64baaaf9165 100644 Binary files a/tools/sdk/lib/libethernet.a and b/tools/sdk/lib/libethernet.a differ diff --git a/tools/sdk/lib/libexpat.a b/tools/sdk/lib/libexpat.a index a14c322368b..c4d3d3d19cc 100644 Binary files a/tools/sdk/lib/libexpat.a and b/tools/sdk/lib/libexpat.a differ diff --git a/tools/sdk/lib/libfatfs.a b/tools/sdk/lib/libfatfs.a index 55a5b19a0c2..82c405f924b 100644 Binary files a/tools/sdk/lib/libfatfs.a and b/tools/sdk/lib/libfatfs.a differ diff --git a/tools/sdk/lib/libfreemodbus.a b/tools/sdk/lib/libfreemodbus.a index 6a04cf41b95..0a554a2103d 100644 Binary files a/tools/sdk/lib/libfreemodbus.a and b/tools/sdk/lib/libfreemodbus.a differ diff --git a/tools/sdk/lib/libfreertos.a b/tools/sdk/lib/libfreertos.a index acf8b8987b9..bccecb70370 100644 Binary files a/tools/sdk/lib/libfreertos.a and b/tools/sdk/lib/libfreertos.a differ diff --git a/tools/sdk/lib/libheap.a b/tools/sdk/lib/libheap.a index 62d2317ab2a..bf9e6f6f68c 100644 Binary files a/tools/sdk/lib/libheap.a and b/tools/sdk/lib/libheap.a differ diff --git a/tools/sdk/lib/libjsmn.a b/tools/sdk/lib/libjsmn.a index f3f792f392b..f45e64e473a 100644 Binary files a/tools/sdk/lib/libjsmn.a and b/tools/sdk/lib/libjsmn.a differ diff --git a/tools/sdk/lib/libjson.a b/tools/sdk/lib/libjson.a index 1c867990f8d..752893ef4e6 100644 Binary files a/tools/sdk/lib/libjson.a and b/tools/sdk/lib/libjson.a differ diff --git a/tools/sdk/lib/liblibsodium.a b/tools/sdk/lib/liblibsodium.a index 89888203ea0..bb01b8e61be 100644 Binary files a/tools/sdk/lib/liblibsodium.a and b/tools/sdk/lib/liblibsodium.a differ diff --git a/tools/sdk/lib/liblog.a b/tools/sdk/lib/liblog.a index 3fc8ab0f6c1..fee5d507ed4 100644 Binary files a/tools/sdk/lib/liblog.a and b/tools/sdk/lib/liblog.a differ diff --git a/tools/sdk/lib/liblwip.a b/tools/sdk/lib/liblwip.a index d0248d9e4cc..6ac0369cbb4 100644 Binary files a/tools/sdk/lib/liblwip.a and b/tools/sdk/lib/liblwip.a differ diff --git a/tools/sdk/lib/libmbedtls.a b/tools/sdk/lib/libmbedtls.a index 2f1c0469aed..ca81874ab4a 100644 Binary files a/tools/sdk/lib/libmbedtls.a and b/tools/sdk/lib/libmbedtls.a differ diff --git a/tools/sdk/lib/libmdns.a b/tools/sdk/lib/libmdns.a index 557d4dcc7ee..50f6ab7c2a2 100644 Binary files a/tools/sdk/lib/libmdns.a and b/tools/sdk/lib/libmdns.a differ diff --git a/tools/sdk/lib/libmesh.a b/tools/sdk/lib/libmesh.a index 9bee951749b..3b9530adfb6 100644 Binary files a/tools/sdk/lib/libmesh.a and b/tools/sdk/lib/libmesh.a differ diff --git a/tools/sdk/lib/libmicro-ecc.a b/tools/sdk/lib/libmicro-ecc.a index bb4b034d0ab..bb3dd5dda15 100644 Binary files a/tools/sdk/lib/libmicro-ecc.a and b/tools/sdk/lib/libmicro-ecc.a differ diff --git a/tools/sdk/lib/libmqtt.a b/tools/sdk/lib/libmqtt.a index 9811090c3fe..f3466cd7d23 100644 Binary files a/tools/sdk/lib/libmqtt.a and b/tools/sdk/lib/libmqtt.a differ diff --git a/tools/sdk/lib/libnet80211.a b/tools/sdk/lib/libnet80211.a index 74b792d4329..cdc7d8ea96e 100644 Binary files a/tools/sdk/lib/libnet80211.a and b/tools/sdk/lib/libnet80211.a differ diff --git a/tools/sdk/lib/libnewlib.a b/tools/sdk/lib/libnewlib.a index 5f85db3c86f..e2fea37b17b 100644 Binary files a/tools/sdk/lib/libnewlib.a and b/tools/sdk/lib/libnewlib.a differ diff --git a/tools/sdk/lib/libnghttp.a b/tools/sdk/lib/libnghttp.a index 97f76748e28..d3e674afa02 100644 Binary files a/tools/sdk/lib/libnghttp.a and b/tools/sdk/lib/libnghttp.a differ diff --git a/tools/sdk/lib/libnvs_flash.a b/tools/sdk/lib/libnvs_flash.a index 34be0014055..a584ea5c279 100644 Binary files a/tools/sdk/lib/libnvs_flash.a and b/tools/sdk/lib/libnvs_flash.a differ diff --git a/tools/sdk/lib/libopenssl.a b/tools/sdk/lib/libopenssl.a index 9dea8477e8b..c123122690b 100644 Binary files a/tools/sdk/lib/libopenssl.a and b/tools/sdk/lib/libopenssl.a differ diff --git a/tools/sdk/lib/libphy.a b/tools/sdk/lib/libphy.a index 86014fe32d1..984b530987f 100644 Binary files a/tools/sdk/lib/libphy.a and b/tools/sdk/lib/libphy.a differ diff --git a/tools/sdk/lib/libpp.a b/tools/sdk/lib/libpp.a index 2b2eba26ca0..1df0add422b 100644 Binary files a/tools/sdk/lib/libpp.a and b/tools/sdk/lib/libpp.a differ diff --git a/tools/sdk/lib/libprotobuf-c.a b/tools/sdk/lib/libprotobuf-c.a index 7c67c6f7488..7f59411b5d4 100644 Binary files a/tools/sdk/lib/libprotobuf-c.a and b/tools/sdk/lib/libprotobuf-c.a differ diff --git a/tools/sdk/lib/libprotocomm.a b/tools/sdk/lib/libprotocomm.a index a2cec1998f4..2d843920b66 100644 Binary files a/tools/sdk/lib/libprotocomm.a and b/tools/sdk/lib/libprotocomm.a differ diff --git a/tools/sdk/lib/libpthread.a b/tools/sdk/lib/libpthread.a index d71889b85d0..2890322de25 100644 Binary files a/tools/sdk/lib/libpthread.a and b/tools/sdk/lib/libpthread.a differ diff --git a/tools/sdk/lib/libsdmmc.a b/tools/sdk/lib/libsdmmc.a index c18511daf23..5aabe488087 100644 Binary files a/tools/sdk/lib/libsdmmc.a and b/tools/sdk/lib/libsdmmc.a differ diff --git a/tools/sdk/lib/libsmartconfig.a b/tools/sdk/lib/libsmartconfig.a index 7f2d28e8fa4..1e28f79bd65 100644 Binary files a/tools/sdk/lib/libsmartconfig.a and b/tools/sdk/lib/libsmartconfig.a differ diff --git a/tools/sdk/lib/libsmartconfig_ack.a b/tools/sdk/lib/libsmartconfig_ack.a index 3b9f8ce85a3..dd33827e7bf 100644 Binary files a/tools/sdk/lib/libsmartconfig_ack.a and b/tools/sdk/lib/libsmartconfig_ack.a differ diff --git a/tools/sdk/lib/libsoc.a b/tools/sdk/lib/libsoc.a index 062c249a969..2dfe3e7548f 100644 Binary files a/tools/sdk/lib/libsoc.a and b/tools/sdk/lib/libsoc.a differ diff --git a/tools/sdk/lib/libspi_flash.a b/tools/sdk/lib/libspi_flash.a index 5342a8440f1..923ab50f3f1 100644 Binary files a/tools/sdk/lib/libspi_flash.a and b/tools/sdk/lib/libspi_flash.a differ diff --git a/tools/sdk/lib/libspiffs.a b/tools/sdk/lib/libspiffs.a index f16c99b69f8..aeac329265f 100644 Binary files a/tools/sdk/lib/libspiffs.a and b/tools/sdk/lib/libspiffs.a differ diff --git a/tools/sdk/lib/libtcp_transport.a b/tools/sdk/lib/libtcp_transport.a index af8b5c87ad2..2b94e4d81f2 100644 Binary files a/tools/sdk/lib/libtcp_transport.a and b/tools/sdk/lib/libtcp_transport.a differ diff --git a/tools/sdk/lib/libtcpip_adapter.a b/tools/sdk/lib/libtcpip_adapter.a index bce1dadffac..d6f92493060 100644 Binary files a/tools/sdk/lib/libtcpip_adapter.a and b/tools/sdk/lib/libtcpip_adapter.a differ diff --git a/tools/sdk/lib/libulp.a b/tools/sdk/lib/libulp.a index 9e7df941b85..e0f58fd2b58 100644 Binary files a/tools/sdk/lib/libulp.a and b/tools/sdk/lib/libulp.a differ diff --git a/tools/sdk/lib/libunity.a b/tools/sdk/lib/libunity.a index ad75780ac61..7867c0e6f76 100644 Binary files a/tools/sdk/lib/libunity.a and b/tools/sdk/lib/libunity.a differ diff --git a/tools/sdk/lib/libvfs.a b/tools/sdk/lib/libvfs.a index ebe7f6a0277..2ca1c5b7506 100644 Binary files a/tools/sdk/lib/libvfs.a and b/tools/sdk/lib/libvfs.a differ diff --git a/tools/sdk/lib/libwear_levelling.a b/tools/sdk/lib/libwear_levelling.a index 2fb76a923ac..26cd7ee9c12 100644 Binary files a/tools/sdk/lib/libwear_levelling.a and b/tools/sdk/lib/libwear_levelling.a differ diff --git a/tools/sdk/lib/libwifi_provisioning.a b/tools/sdk/lib/libwifi_provisioning.a index f9820a4f770..19a5db90bd7 100644 Binary files a/tools/sdk/lib/libwifi_provisioning.a and b/tools/sdk/lib/libwifi_provisioning.a differ diff --git a/tools/sdk/lib/libwpa.a b/tools/sdk/lib/libwpa.a index 0b761b827df..66fbcea1583 100644 Binary files a/tools/sdk/lib/libwpa.a and b/tools/sdk/lib/libwpa.a differ diff --git a/tools/sdk/lib/libwpa2.a b/tools/sdk/lib/libwpa2.a index 7e033af8bd8..042f41a80bc 100644 Binary files a/tools/sdk/lib/libwpa2.a and b/tools/sdk/lib/libwpa2.a differ diff --git a/tools/sdk/lib/libwpa_supplicant.a b/tools/sdk/lib/libwpa_supplicant.a index 19e88e9624a..aa82f433eb2 100644 Binary files a/tools/sdk/lib/libwpa_supplicant.a and b/tools/sdk/lib/libwpa_supplicant.a differ diff --git a/tools/sdk/lib/libwps.a b/tools/sdk/lib/libwps.a index 5ddb1bead35..2a3a55a7699 100644 Binary files a/tools/sdk/lib/libwps.a and b/tools/sdk/lib/libwps.a differ diff --git a/tools/sdk/lib/libxtensa-debug-module.a b/tools/sdk/lib/libxtensa-debug-module.a index 46eb2603ec7..22cd6b4cb07 100644 Binary files a/tools/sdk/lib/libxtensa-debug-module.a and b/tools/sdk/lib/libxtensa-debug-module.a differ diff --git a/tools/sdk/sdkconfig b/tools/sdk/sdkconfig index 7b19e5ec1cf..06ce2022c27 100644 --- a/tools/sdk/sdkconfig +++ b/tools/sdk/sdkconfig @@ -15,6 +15,8 @@ CONFIG_MAKE_WARN_UNDEFINED_VARIABLES=y # Application manager # CONFIG_APP_COMPILE_TIME_DATE=y +CONFIG_APP_EXCLUDE_PROJECT_VER_VAR= +CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR= # # Arduino Configuration @@ -60,6 +62,7 @@ CONFIG_BOOTLOADER_APP_TEST= CONFIG_BOOTLOADER_WDT_ENABLE=y CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE= CONFIG_BOOTLOADER_WDT_TIME_MS=9000 +CONFIG_APP_ROLLBACK_ENABLE= # # Security features @@ -207,6 +210,7 @@ CONFIG_HFP_ENABLE=y CONFIG_HFP_CLIENT_ENABLE=y CONFIG_HFP_AUDIO_DATA_PATH_PCM=y CONFIG_HFP_AUDIO_DATA_PATH_HCI= +CONFIG_BT_SSP_ENABLED=y CONFIG_GATTS_ENABLE=y CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL= CONFIG_GATTS_SEND_SERVICE_CHANGE_AUTO=y @@ -311,7 +315,7 @@ CONFIG_INT_WDT=y CONFIG_INT_WDT_TIMEOUT_MS=300 CONFIG_INT_WDT_CHECK_CPU1=y CONFIG_TASK_WDT=y -CONFIG_TASK_WDT_PANIC= +CONFIG_TASK_WDT_PANIC=y CONFIG_TASK_WDT_TIMEOUT_S=5 CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1= @@ -463,9 +467,6 @@ CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y # # Modbus configuration # -CONFIG_MB_UART_RXD=34 -CONFIG_MB_UART_TXD=33 -CONFIG_MB_UART_RTS=32 CONFIG_MB_QUEUE_LENGTH=20 CONFIG_MB_SERIAL_TASK_STACK_SIZE=2048 CONFIG_MB_SERIAL_BUF_SIZE=256