diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..1ca8b1312f5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libraries/BLE"] + path = libraries/BLE + url = https://github.com/nkolban/ESP32_BLE_Arduino.git diff --git a/.travis.yml b/.travis.yml index 344b7ecd659..f1c777e81c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,9 @@ script: - mkdir espressif - cd espressif - ln -s $TRAVIS_BUILD_DIR esp32 - - cd esp32/tools + - cd esp32 + - git submodule update --init --recursive + - cd tools - python get.py - export PATH="$HOME/arduino_ide:$TRAVIS_BUILD_DIR/tools/xtensa-esp32-elf/bin:$PATH" - which arduino diff --git a/docs/arduino-ide/debian_ubuntu.md b/docs/arduino-ide/debian_ubuntu.md index 0f95cf2ac31..419d5c6c469 100644 --- a/docs/arduino-ide/debian_ubuntu.md +++ b/docs/arduino-ide/debian_ubuntu.md @@ -13,7 +13,9 @@ Installation instructions for Debian / Ubuntu OS mkdir -p ~/Arduino/hardware/espressif && \ cd ~/Arduino/hardware/espressif && \ git clone https://github.com/espressif/arduino-esp32.git esp32 && \ - cd esp32/tools/ && \ + cd esp32 && \ + git submodule update --init --recursive && \ + cd tools && \ python get.py ``` - Restart Arduino IDE diff --git a/docs/arduino-ide/fedora.md b/docs/arduino-ide/fedora.md index 6672183989f..c28a2cace5b 100644 --- a/docs/arduino-ide/fedora.md +++ b/docs/arduino-ide/fedora.md @@ -10,7 +10,9 @@ Installation instructions for Fedora mkdir -p ~/Arduino/hardware/espressif && \ cd ~/Arduino/hardware/espressif && \ git clone https://github.com/espressif/arduino-esp32.git esp32 && \ - cd esp32/tools/ && \ + cd esp32 && \ + git submodule update --init --recursive && \ + cd tools && \ python get.py ``` - Restart Arduino IDE diff --git a/docs/arduino-ide/mac.md b/docs/arduino-ide/mac.md index 717d5ef3935..d3d022bdec4 100644 --- a/docs/arduino-ide/mac.md +++ b/docs/arduino-ide/mac.md @@ -8,7 +8,9 @@ Installation instructions for Mac OS mkdir -p ~/Documents/Arduino/hardware/espressif && \ cd ~/Documents/Arduino/hardware/espressif && \ git clone https://github.com/espressif/arduino-esp32.git esp32 && \ - cd esp32/tools/ && \ + cd esp32 && \ + git submodule update --init --recursive && \ + cd tools && \ python get.py ``` - If you get the error below. Install the command line dev tools with xcode-select --install and try the command above again: diff --git a/docs/arduino-ide/opensuse.md b/docs/arduino-ide/opensuse.md index 01b240ff545..4f28b9dd346 100644 --- a/docs/arduino-ide/opensuse.md +++ b/docs/arduino-ide/opensuse.md @@ -14,7 +14,9 @@ Installation instructions for openSUSE mkdir -p ~/Arduino/hardware/espressif && \ cd ~/Arduino/hardware/espressif && \ git clone https://github.com/espressif/arduino-esp32.git esp32 && \ - cd esp32/tools/ && \ + cd esp32 && \ + git submodule update --init --recursive && \ + cd tools && \ python get.py ``` - Restart Arduino IDE diff --git a/docs/esp-idf_component.md b/docs/esp-idf_component.md index abf6f0c4ea0..b6ca9197e53 100644 --- a/docs/esp-idf_component.md +++ b/docs/esp-idf_component.md @@ -9,7 +9,9 @@ To use as a component of ESP-IDF mkdir -p components && \ cd components && \ git clone https://github.com/espressif/arduino-esp32.git arduino && \ - cd .. && \ + cd arduino && \ + git submodule update --init --recursive && \ + cd ../.. && \ make menuconfig ``` - ```make menuconfig``` has some Arduino options diff --git a/libraries/BLE b/libraries/BLE new file mode 160000 index 00000000000..98cd2290d03 --- /dev/null +++ b/libraries/BLE @@ -0,0 +1 @@ +Subproject commit 98cd2290d036a4e27db061a76a512b526ef1cc14 diff --git a/tools/sdk/bin/bootloader.bin b/tools/sdk/bin/bootloader.bin index 5b005eec395..9ef5534e11d 100644 Binary files a/tools/sdk/bin/bootloader.bin and b/tools/sdk/bin/bootloader.bin differ diff --git a/tools/sdk/bin/bootloader_qio.bin b/tools/sdk/bin/bootloader_qio.bin index a799fd8f172..0d10db37034 100644 Binary files a/tools/sdk/bin/bootloader_qio.bin and b/tools/sdk/bin/bootloader_qio.bin differ diff --git a/tools/sdk/include/bluedroid/bta_gatt_api.h b/tools/sdk/include/bluedroid/bta_gatt_api.h index d81fa547e0a..35fb42d71ac 100644 --- a/tools/sdk/include/bluedroid/bta_gatt_api.h +++ b/tools/sdk/include/bluedroid/bta_gatt_api.h @@ -181,6 +181,7 @@ typedef UINT8 tBTA_GATT_STATUS; #define BTA_GATTC_ADV_VSC_EVT 34 /* ADV VSC event */ #define BTA_GATTC_CONNECT_EVT 35 /* GATTC CONNECT event */ #define BTA_GATTC_DISCONNECT_EVT 36 /* GATTC DISCONNECT event */ +#define BTA_GATTC_READ_MUTIPLE_EVT 37 /* GATTC Read mutiple event */ typedef UINT8 tBTA_GATTC_EVT; diff --git a/tools/sdk/include/bluedroid/bta_gattc_int.h b/tools/sdk/include/bluedroid/bta_gattc_int.h index 2515cb5225c..701b3b58c1b 100644 --- a/tools/sdk/include/bluedroid/bta_gattc_int.h +++ b/tools/sdk/include/bluedroid/bta_gattc_int.h @@ -165,6 +165,7 @@ typedef struct { tBTA_GATT_AUTH_REQ auth_req; UINT8 num_attr; UINT16 handles[GATT_MAX_READ_MULTI_HANDLES]; + tBTA_GATTC_EVT cmpl_evt; }tBTA_GATTC_API_READ_MULTI; typedef struct { diff --git a/tools/sdk/include/bluedroid/esp_gap_ble_api.h b/tools/sdk/include/bluedroid/esp_gap_ble_api.h index 62d5c9b098f..9292f95e6b2 100644 --- a/tools/sdk/include/bluedroid/esp_gap_ble_api.h +++ b/tools/sdk/include/bluedroid/esp_gap_ble_api.h @@ -864,9 +864,9 @@ esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr); /** * @brief Set a GAP security parameter value. Overrides the default value. * -* @param[in] param_type :L the type of the param which to be set +* @param[in] param_type : the type of the param which to be set * @param[in] value : the param value -* @param[out] len : the length of the param value +* @param[in] len : the length of the param value * * @return - ESP_OK : success * - other : failed diff --git a/tools/sdk/include/bluedroid/esp_gattc_api.h b/tools/sdk/include/bluedroid/esp_gattc_api.h index ba5cfffac08..b72466b82c1 100644 --- a/tools/sdk/include/bluedroid/esp_gattc_api.h +++ b/tools/sdk/include/bluedroid/esp_gattc_api.h @@ -63,6 +63,7 @@ typedef enum { ESP_GATTC_UNREG_FOR_NOTIFY_EVT = 39, /*!< When unregister for notification of a service completes, the event comes */ ESP_GATTC_CONNECT_EVT = 40, /*!< When the ble physical connection is set up, the event comes */ ESP_GATTC_DISCONNECT_EVT = 41, /*!< When the ble physical connection disconnected, the event comes */ + ESP_GATTC_READ_MUTIPLE_EVT = 42, /*!< When the ble characteristic or descriptor mutiple complete, the event comes */ } esp_gattc_cb_event_t; diff --git a/tools/sdk/include/config/sdkconfig.h b/tools/sdk/include/config/sdkconfig.h index 797d7dfa637..a28d5cca1a1 100644 --- a/tools/sdk/include/config/sdkconfig.h +++ b/tools/sdk/include/config/sdkconfig.h @@ -10,6 +10,7 @@ #define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16 #define CONFIG_BLE_SMP_ENABLE 1 #define CONFIG_TCP_RECVMBOX_SIZE 6 +#define CONFIG_LWIP_ETHARP_TRUST_IP_MAC 1 #define CONFIG_TCP_WND_DEFAULT 5744 #define CONFIG_SW_COEXIST_ENABLE 1 #define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1 @@ -154,6 +155,7 @@ #define CONFIG_SPIFFS_OBJ_NAME_LEN 32 #define CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT 5 #define CONFIG_LOG_BOOTLOADER_LEVEL_NONE 1 +#define CONFIG_TCPIP_RECVMBOX_SIZE 32 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_240 1 #define CONFIG_ESP32_XTAL_FREQ_AUTO 1 #define CONFIG_TCP_MAXRTX 12 diff --git a/tools/sdk/include/driver/driver/sigmadelta.h b/tools/sdk/include/driver/driver/sigmadelta.h index 61a35c21f91..76237c193d3 100644 --- a/tools/sdk/include/driver/driver/sigmadelta.h +++ b/tools/sdk/include/driver/driver/sigmadelta.h @@ -27,14 +27,14 @@ extern "C" { * @brief Sigma-delta channel list */ typedef enum{ - SIGMADELTA_CHANNEL_0 = 0, /*!< Sigma-delta channel0 */ - SIGMADELTA_CHANNEL_1 = 1, /*!< Sigma-delta channel1 */ - SIGMADELTA_CHANNEL_2 = 2, /*!< Sigma-delta channel2 */ - SIGMADELTA_CHANNEL_3 = 3, /*!< Sigma-delta channel3 */ - SIGMADELTA_CHANNEL_4 = 4, /*!< Sigma-delta channel4 */ - SIGMADELTA_CHANNEL_5 = 5, /*!< Sigma-delta channel5 */ - SIGMADELTA_CHANNEL_6 = 6, /*!< Sigma-delta channel6 */ - SIGMADELTA_CHANNEL_7 = 7, /*!< Sigma-delta channel7 */ + SIGMADELTA_CHANNEL_0 = 0, /*!< Sigma-delta channel 0 */ + SIGMADELTA_CHANNEL_1 = 1, /*!< Sigma-delta channel 1 */ + SIGMADELTA_CHANNEL_2 = 2, /*!< Sigma-delta channel 2 */ + SIGMADELTA_CHANNEL_3 = 3, /*!< Sigma-delta channel 3 */ + SIGMADELTA_CHANNEL_4 = 4, /*!< Sigma-delta channel 4 */ + SIGMADELTA_CHANNEL_5 = 5, /*!< Sigma-delta channel 5 */ + SIGMADELTA_CHANNEL_6 = 6, /*!< Sigma-delta channel 6 */ + SIGMADELTA_CHANNEL_7 = 7, /*!< Sigma-delta channel 7 */ SIGMADELTA_CHANNEL_MAX, } sigmadelta_channel_t; @@ -64,7 +64,8 @@ esp_err_t sigmadelta_config(const sigmadelta_config_t *config); * * This function is used to set Sigma-delta channel duty, * If you add a capacitor between the output pin and ground, - * the average output voltage Vdc = VDDIO / 256 * duty + VDDIO/2, VDDIO is power supply voltage. + * the average output voltage will be Vdc = VDDIO / 256 * duty + VDDIO/2, + * where VDDIO is the power supply voltage. * * @param channel Sigma-delta channel number * @param duty Sigma-delta duty of one channel, the value ranges from -128 to 127, recommended range is -90 ~ 90. diff --git a/tools/sdk/include/esp32/esp_spiram.h b/tools/sdk/include/esp32/esp_spiram.h index 9854035295c..2dbff1afc2c 100644 --- a/tools/sdk/include/esp32/esp_spiram.h +++ b/tools/sdk/include/esp32/esp_spiram.h @@ -64,4 +64,16 @@ void esp_spiram_writeback_cache(); +/** + * @brief Reserve a pool of internal memory for specific DMA/internal allocations + * + * @param size Size of reserved pool in bytes + * + * @return + * - ESP_OK on success + * - ESP_ERR_NO_MEM when no memory available for pool + */ +esp_err_t esp_spiram_reserve_dma_pool(size_t size); + + #endif \ No newline at end of file diff --git a/tools/sdk/include/esp32/esp_wifi.h b/tools/sdk/include/esp32/esp_wifi.h index 7bfa96379ee..0ca0dd95abf 100755 --- a/tools/sdk/include/esp32/esp_wifi.h +++ b/tools/sdk/include/esp32/esp_wifi.h @@ -517,23 +517,34 @@ esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second); esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second); /** - * @brief Set country code - * The default value is WIFI_COUNTRY_CN + * @brief configure country info * - * @param country country type + * @attention 1. The default country is {.cc="CN", .schan=1, .nchan=13, policy=WIFI_COUNTRY_POLICY_AUTO} + * @attention 2. When the country policy is WIFI_COUNTRY_POLICY_AUTO, use the country info of AP to which + * the station is connected. E.g. if the configured country info is {.cc="USA", .schan=1, .nchan=11}, + * the country info of the AP to which the station is connected is {.cc="JP", .schan=1, .nchan=14}, + * then our country info is {.cc="JP", .schan=1, .nchan=14}. If the station disconnected + * from the AP, the country info back to {.cc="USA", .schan=1, .nchan=11} again. + * @attention 3. When the country policy is WIFI_COUNTRY_POLICY_MANUAL, always use the configured country info. + * @attention 4. When the country info is changed because of configuration or because the station connects to a different + * external AP, the country IE in probe response/beacon of the soft-AP is changed also. + * @attention 5. The country configuration is not stored into flash + * @attention 6. This API doesn't validate the per-country rules, it's up to the user to fill in all fields according to + * local regulations. + * + * @param country the configured country info * * @return * - ESP_OK: succeed * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init * - ESP_ERR_WIFI_ARG: invalid argument - * - others: refer to error code in esp_err.h */ -esp_err_t esp_wifi_set_country(wifi_country_t country); +esp_err_t esp_wifi_set_country(wifi_country_t *country); /** - * @brief Get country code + * @brief get the current country info * - * @param country store current country + * @param country country info * * @return * - ESP_OK: succeed @@ -542,6 +553,7 @@ esp_err_t esp_wifi_set_country(wifi_country_t country); */ esp_err_t esp_wifi_get_country(wifi_country_t *country); + /** * @brief Set MAC address of the ESP32 WiFi station or the soft-AP interface. * diff --git a/tools/sdk/include/esp32/esp_wifi_types.h b/tools/sdk/include/esp32/esp_wifi_types.h index a37b1b707e4..e91031a5b90 100755 --- a/tools/sdk/include/esp32/esp_wifi_types.h +++ b/tools/sdk/include/esp32/esp_wifi_types.h @@ -40,11 +40,15 @@ typedef esp_interface_t wifi_interface_t; #define WIFI_IF_AP ESP_IF_WIFI_AP typedef enum { - WIFI_COUNTRY_CN = 0, /**< country China, channel range [1, 14] */ - WIFI_COUNTRY_JP, /**< country Japan, channel range [1, 14] */ - WIFI_COUNTRY_US, /**< country USA, channel range [1, 11] */ - WIFI_COUNTRY_EU, /**< country Europe, channel range [1, 13] */ - WIFI_COUNTRY_MAX + WIFI_COUNTRY_POLICY_AUTO, /**< Country policy is auto, use the country info of AP to which the station is connected */ + WIFI_COUNTRY_POLICY_MANUAL, /**< Country policy is manual, always use the configured country info */ +} wifi_country_policy_t; + +typedef struct { + char cc[3]; /**< country code string */ + uint8_t schan; /**< start channel */ + uint8_t nchan; /**< total channel number */ + wifi_country_policy_t policy; /**< country policy */ } wifi_country_t; typedef enum { @@ -121,6 +125,16 @@ typedef struct { wifi_scan_time_t scan_time; /**< scan time per channel */ } wifi_scan_config_t; +typedef enum { + WIFI_CIPHER_TYPE_NONE = 0, /**< the cipher type is none */ + WIFI_CIPHER_TYPE_WEP40, /**< the cipher type is WEP40 */ + WIFI_CIPHER_TYPE_WEP104, /**< the cipher type is WEP104 */ + WIFI_CIPHER_TYPE_TKIP, /**< the cipher type is TKIP */ + WIFI_CIPHER_TYPE_CCMP, /**< the cipher type is CCMP */ + WIFI_CIPHER_TYPE_TKIP_CCMP, /**< the cipher type is TKIP and CCMP */ + WIFI_CIPHER_TYPE_UNKNOWN, /**< the cipher type is unknown */ +} wifi_cipher_type_t; + typedef struct { uint8_t bssid[6]; /**< MAC address of AP */ uint8_t ssid[33]; /**< SSID of AP */ @@ -128,8 +142,14 @@ typedef struct { wifi_second_chan_t second; /**< second channel of AP */ int8_t rssi; /**< signal strength of AP */ wifi_auth_mode_t authmode; /**< authmode of AP */ - uint32_t low_rate_enable:1; /**< bit: 0 flag to identify if low rate is enabled or not */ - uint32_t reserved:31; /**< bit: 1..31 reserved */ + wifi_cipher_type_t pairwise_cipher; /**< pairwise cipher of AP */ + wifi_cipher_type_t group_cipher; /**< group cipher of AP */ + uint32_t phy_11b:1; /**< bit: 0 flag to identify if 11b mode is enabled or not */ + uint32_t phy_11g:1; /**< bit: 1 flag to identify if 11g mode is enabled or not */ + uint32_t phy_11n:1; /**< bit: 2 flag to identify if 11n mode is enabled or not */ + uint32_t phy_lr:1; /**< bit: 3 flag to identify if low rate is enabled or not */ + uint32_t wps:1; /**< bit: 4 flag to identify if WPS is supported or not */ + uint32_t reserved:27; /**< bit: 5..31 reserved */ } wifi_ap_record_t; typedef enum { diff --git a/tools/sdk/include/freertos/freertos/portmacro.h b/tools/sdk/include/freertos/freertos/portmacro.h index d398ba5da68..fbfe9828f9e 100644 --- a/tools/sdk/include/freertos/freertos/portmacro.h +++ b/tools/sdk/include/freertos/freertos/portmacro.h @@ -82,6 +82,9 @@ extern "C" { #include "esp_crosscore_int.h" +#include +#include "soc/soc_memory_layout.h" + //#include "xtensa_context.h" /*----------------------------------------------------------- @@ -245,6 +248,18 @@ static inline unsigned portENTER_CRITICAL_NESTED() { unsigned state = XTOS_SET_I #define portSET_INTERRUPT_MASK_FROM_ISR() portENTER_CRITICAL_NESTED() #define portCLEAR_INTERRUPT_MASK_FROM_ISR(state) portEXIT_CRITICAL_NESTED(state) +//Because the ROM routines don't necessarily handle a stack in external RAM correctly, we force +//the stack memory to always be internal. +#define pvPortMallocTcbMem(size) heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) +#define pvPortMallocStackMem(size) heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) + +//xTaskCreateStatic uses these functions to check incoming memory. +#define portVALID_TCB_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr)) +#ifndef CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY +#define portVALID_STACK_MEM(ptr) esp_ptr_byte_accessible(ptr) +#else +#define portVALID_STACK_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr)) +#endif /* * Wrapper for the Xtensa compare-and-set instruction. This subroutine will atomically compare diff --git a/tools/sdk/include/heap/esp_heap_caps.h b/tools/sdk/include/heap/esp_heap_caps.h index 022ae669a49..6dd1b9b5a6b 100644 --- a/tools/sdk/include/heap/esp_heap_caps.h +++ b/tools/sdk/include/heap/esp_heap_caps.h @@ -32,6 +32,7 @@ #define MALLOC_CAP_PID7 (1<<9) ///< Memory must be mapped to PID7 memory space (PIDs are not currently used) #define MALLOC_CAP_SPIRAM (1<<10) ///< Memory must be in SPI RAM #define MALLOC_CAP_INTERNAL (1<<11) ///< Memory must be internal; specifically it should not disappear when flash/spiram cache is switched off +#define MALLOC_CAP_DEFAULT (1<<12) ///< Memory can be returned in a non-capability-specific memory allocation (e.g. malloc(), calloc()) call #define MALLOC_CAP_INVALID (1<<31) ///< Memory can't be used / list end marker /** @@ -172,3 +173,18 @@ void heap_caps_print_heap_info( uint32_t caps ); * @return True if all heaps are valid, False if at least one heap is corrupt. */ bool heap_caps_check_integrity(uint32_t caps, bool print_errors); + + + +/** + * @brief Enable malloc() in external memory and set limit below which + * malloc() attempts are placed in internal memory. + * + * When external memory is in use, the allocation strategy is to initially try to + * satisfy smaller allocation requests with internal memory and larger requests + * with external memory. This sets the limit between the two, as well as generally + * enabling allocation in external memory. + * + * @param limit Limit, in bytes. + */ +void heap_caps_malloc_extmem_enable(size_t limit); diff --git a/tools/sdk/include/heap/esp_heap_caps_init.h b/tools/sdk/include/heap/esp_heap_caps_init.h index b29e7852620..5cfb8d82b51 100644 --- a/tools/sdk/include/heap/esp_heap_caps_init.h +++ b/tools/sdk/include/heap/esp_heap_caps_init.h @@ -73,8 +73,11 @@ esp_err_t heap_caps_add_region(intptr_t start, intptr_t end); * @param start Start address of new region. * @param end End address of new region. * - * @return ESP_OK on success, ESP_ERR_INVALID_ARG if a parameter is invalid, ESP_ERR_NO_MEM if no - * memory to register new heap. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if a parameter is invalid + * - ESP_ERR_NO_MEM if no memory to register new heap. + * - ESP_FAIL if region overlaps the start and/or end of an existing region */ esp_err_t heap_caps_add_region_with_caps(const uint32_t caps[], intptr_t start, intptr_t end); diff --git a/tools/sdk/include/lwip/lwipopts.h b/tools/sdk/include/lwip/lwipopts.h index 7bc4021e5a9..89d09d2d71f 100644 --- a/tools/sdk/include/lwip/lwipopts.h +++ b/tools/sdk/include/lwip/lwipopts.h @@ -416,7 +416,7 @@ * The queue size value itself is platform-dependent, but is passed to * sys_mbox_new() when tcpip_init is called. */ -#define TCPIP_MBOX_SIZE 32 +#define TCPIP_MBOX_SIZE CONFIG_TCPIP_RECVMBOX_SIZE /** * DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a @@ -520,10 +520,20 @@ ---------- Statistics options ---------- ---------------------------------------- */ + /** * LWIP_STATS==1: Enable statistics collection in lwip_stats. */ -#define LWIP_STATS 0 +#define LWIP_STATS CONFIG_LWIP_STATS + +#if LWIP_STATS + +/** + * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions. + */ +#define LWIP_STATS_DISPLAY CONFIG_LWIP_STATS +#endif + /* --------------------------------- @@ -674,7 +684,7 @@ * The peer *is* in the ARP table if it requested our address before. * Also notice that this slows down input processing of every IP packet! */ -#define ETHARP_TRUST_IP_MAC 1 +#define ETHARP_TRUST_IP_MAC CONFIG_LWIP_ETHARP_TRUST_IP_MAC /* Enable all Espressif-only options */ @@ -692,8 +702,8 @@ #define ESP_IP4_ATON 1 #define ESP_LIGHT_SLEEP 1 #define ESP_L2_TO_L3_COPY CONFIG_L2_TO_L3_COPY -#define ESP_STATS_MEM 0 -#define ESP_STATS_DROP 0 +#define ESP_STATS_MEM CONFIG_LWIP_STATS +#define ESP_STATS_DROP CONFIG_LWIP_STATS #define ESP_STATS_TCP 0 #define ESP_DHCP_TIMER 1 #define ESP_LWIP_LOGI(...) ESP_LOGI("lwip", __VA_ARGS__) diff --git a/tools/sdk/include/lwip/port/lwipopts.h b/tools/sdk/include/lwip/port/lwipopts.h index 7bc4021e5a9..89d09d2d71f 100644 --- a/tools/sdk/include/lwip/port/lwipopts.h +++ b/tools/sdk/include/lwip/port/lwipopts.h @@ -416,7 +416,7 @@ * The queue size value itself is platform-dependent, but is passed to * sys_mbox_new() when tcpip_init is called. */ -#define TCPIP_MBOX_SIZE 32 +#define TCPIP_MBOX_SIZE CONFIG_TCPIP_RECVMBOX_SIZE /** * DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a @@ -520,10 +520,20 @@ ---------- Statistics options ---------- ---------------------------------------- */ + /** * LWIP_STATS==1: Enable statistics collection in lwip_stats. */ -#define LWIP_STATS 0 +#define LWIP_STATS CONFIG_LWIP_STATS + +#if LWIP_STATS + +/** + * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions. + */ +#define LWIP_STATS_DISPLAY CONFIG_LWIP_STATS +#endif + /* --------------------------------- @@ -674,7 +684,7 @@ * The peer *is* in the ARP table if it requested our address before. * Also notice that this slows down input processing of every IP packet! */ -#define ETHARP_TRUST_IP_MAC 1 +#define ETHARP_TRUST_IP_MAC CONFIG_LWIP_ETHARP_TRUST_IP_MAC /* Enable all Espressif-only options */ @@ -692,8 +702,8 @@ #define ESP_IP4_ATON 1 #define ESP_LIGHT_SLEEP 1 #define ESP_L2_TO_L3_COPY CONFIG_L2_TO_L3_COPY -#define ESP_STATS_MEM 0 -#define ESP_STATS_DROP 0 +#define ESP_STATS_MEM CONFIG_LWIP_STATS +#define ESP_STATS_DROP CONFIG_LWIP_STATS #define ESP_STATS_TCP 0 #define ESP_DHCP_TIMER 1 #define ESP_LWIP_LOGI(...) ESP_LOGI("lwip", __VA_ARGS__) diff --git a/tools/sdk/include/soc/soc/soc.h b/tools/sdk/include/soc/soc/soc.h index b889f5fa560..0e633821fdb 100644 --- a/tools/sdk/include/soc/soc/soc.h +++ b/tools/sdk/include/soc/soc/soc.h @@ -295,10 +295,15 @@ #define SOC_DMA_LOW 0x3FFAE000 #define SOC_DMA_HIGH 0x40000000 -// Region of memory that is byte-accessible. See esp_ptr_byte_accesible(). +// Region of memory that is byte-accessible. See esp_ptr_byte_accessible(). #define SOC_BYTE_ACCESSIBLE_LOW 0x3FFAE000 #define SOC_BYTE_ACCESSIBLE_HIGH 0x40000000 +//Region of memory that is internal, as in on the same silicon die as the ESP32 CPUs (excluding RTC data region, that's checked separately.) See esp_ptr_internal(). +#define SOC_MEM_INTERNAL_LOW 0x3F400000 +#define SOC_MEM_INTERNAL_HIGH 0x400C2000 + + //Interrupt hardware source table //This table is decided by hardware, don't touch this. #define ETS_WIFI_MAC_INTR_SOURCE 0/**< interrupt of WiFi MAC, level*/ diff --git a/tools/sdk/include/soc/soc/soc_memory_layout.h b/tools/sdk/include/soc/soc/soc_memory_layout.h new file mode 100644 index 00000000000..1c1415e3dc3 --- /dev/null +++ b/tools/sdk/include/soc/soc/soc_memory_layout.h @@ -0,0 +1,91 @@ +// Copyright 2010-2016 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 +#include +#include + +#include "soc/soc.h" +#include "sdkconfig.h" +#include "esp_attr.h" + +#define SOC_MEMORY_TYPE_NO_PRIOS 3 + +/* Type descriptor holds a description for a particular type of memory on a particular SoC. + */ +typedef struct { + const char *name; ///< Name of this memory type + uint32_t caps[SOC_MEMORY_TYPE_NO_PRIOS]; ///< Capabilities for this memory type (as a prioritised set) + bool aliased_iram; ///< If true, this is data memory that is is also mapped in IRAM + bool startup_stack; ///< If true, memory of this type is used for ROM stack during startup +} soc_memory_type_desc_t; + +/* Constant table of tag descriptors for all this SoC's tags */ +extern const soc_memory_type_desc_t soc_memory_types[]; +extern const size_t soc_memory_type_count; + +/* Region descriptor holds a description for a particular region of memory on a particular SoC. + */ +typedef struct +{ + intptr_t start; ///< Start address of the region + size_t size; ///< Size of the region in bytes + size_t type; ///< Type of the region (index into soc_memory_types array) + intptr_t iram_address; ///< If non-zero, is equivalent address in IRAM +} soc_memory_region_t; + +extern const soc_memory_region_t soc_memory_regions[]; +extern const size_t soc_memory_region_count; + +/* Region descriptor holds a description for a particular region of + memory reserved on this SoC for a particular use (ie not available + for stack/heap usage.) */ +typedef struct +{ + intptr_t start; + intptr_t end; +} soc_reserved_region_t; + +extern const soc_reserved_region_t soc_reserved_regions[]; +extern const size_t soc_reserved_region_count; + +inline static bool IRAM_ATTR esp_ptr_dma_capable(const void *p) +{ + return (intptr_t)p >= SOC_DMA_LOW && (intptr_t)p < SOC_DMA_HIGH; +} + +inline static bool IRAM_ATTR esp_ptr_executable(const void *p) +{ + intptr_t ip = (intptr_t) p; + return (ip >= SOC_IROM_LOW && ip < SOC_IROM_HIGH) + || (ip >= SOC_IRAM_LOW && ip < SOC_IRAM_HIGH) + || (ip >= SOC_RTC_IRAM_LOW && ip < SOC_RTC_IRAM_HIGH); +} + +inline static bool IRAM_ATTR esp_ptr_byte_accessible(const void *p) +{ + bool r; + r = ((intptr_t)p >= SOC_BYTE_ACCESSIBLE_LOW && (intptr_t)p < SOC_BYTE_ACCESSIBLE_HIGH); +#if CONFIG_SPIRAM_SUPPORT + r |= ((intptr_t)p >= SOC_EXTRAM_DATA_LOW && (intptr_t)p < SOC_EXTRAM_DATA_HIGH); +#endif + return r; +} + +inline static bool IRAM_ATTR esp_ptr_internal(const void *p) { + bool r; + r = ((intptr_t)p >= SOC_MEM_INTERNAL_LOW && (intptr_t)p < SOC_MEM_INTERNAL_HIGH); + r |= ((intptr_t)p >= SOC_RTC_DATA_LOW && (intptr_t)p < SOC_RTC_DATA_HIGH); + return r; +} diff --git a/tools/sdk/lib/libapp_trace.a b/tools/sdk/lib/libapp_trace.a index bec5a5b2479..996a18f2cec 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 cd4f70b944f..b68914ad4f2 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/libbootloader_support.a b/tools/sdk/lib/libbootloader_support.a index 6935d689b1c..0a05416cbee 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 c952caa7d3b..f5943114512 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 index b04be18d354..b62ee77cc8b 100644 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 3abf530c021..138683dee72 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 f9c6fa97cda..4436cc0c18e 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 cfff696d659..d92a0852299 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 01145bbfb19..8dc7312fe7b 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 e22a2426ae6..62ba6a1274b 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 22f9c4e070d..3b8fec203f4 100644 Binary files a/tools/sdk/lib/libdriver.a and b/tools/sdk/lib/libdriver.a differ diff --git a/tools/sdk/lib/libesp32.a b/tools/sdk/lib/libesp32.a index d0dc75a4bd3..a81b22ab3a8 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 a27c62a3bf5..c99718de0c3 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/libespnow.a b/tools/sdk/lib/libespnow.a index 3ce33223e28..b5e69a0de97 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 4bc499cb50b..1d0f39588a6 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 a51e7bacd40..3e680feb09c 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 ccce610589f..c753650aa2f 100644 Binary files a/tools/sdk/lib/libfatfs.a and b/tools/sdk/lib/libfatfs.a differ diff --git a/tools/sdk/lib/libfreertos.a b/tools/sdk/lib/libfreertos.a index 5d4663f5ed4..e825f706da2 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 ae746b26c23..0d67cc7352e 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 99b6920462e..b26dc3c973a 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 739834dd98c..a5ef0a076cf 100644 Binary files a/tools/sdk/lib/libjson.a and b/tools/sdk/lib/libjson.a differ diff --git a/tools/sdk/lib/liblog.a b/tools/sdk/lib/liblog.a index 6021625de5f..b6d8abec083 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 75b805be600..e0fff7fe984 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 0d32607f45f..41d0369bbe7 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 cd85eea9392..80ea2566ff8 100644 Binary files a/tools/sdk/lib/libmdns.a and b/tools/sdk/lib/libmdns.a differ diff --git a/tools/sdk/lib/libmicro-ecc.a b/tools/sdk/lib/libmicro-ecc.a index f7b8d7ef441..1f90ec4d858 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/libnet80211.a b/tools/sdk/lib/libnet80211.a index 8c5f026c633..ebe1ba0f024 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 4569e9e93b8..d19e865d5ae 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 2f764429c51..8abdf6519a3 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 303ca709b45..accbb4149b2 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 99189f6124e..7924e5e9b01 100644 Binary files a/tools/sdk/lib/libopenssl.a and b/tools/sdk/lib/libopenssl.a differ diff --git a/tools/sdk/lib/libpp.a b/tools/sdk/lib/libpp.a index ab858601ae8..0773e5bbc86 100644 Binary files a/tools/sdk/lib/libpp.a and b/tools/sdk/lib/libpp.a differ diff --git a/tools/sdk/lib/libpthread.a b/tools/sdk/lib/libpthread.a index e0d1750e166..c3835f801b2 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 0a430b67b0a..486808050a3 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 bf674e3e275..4f021751479 100644 Binary files a/tools/sdk/lib/libsmartconfig.a and b/tools/sdk/lib/libsmartconfig.a differ diff --git a/tools/sdk/lib/libsoc.a b/tools/sdk/lib/libsoc.a index cb3a216d3c8..681ba3df380 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 7af89069c51..0068d01a367 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 14a9ceb3b8c..c0897466406 100644 Binary files a/tools/sdk/lib/libspiffs.a and b/tools/sdk/lib/libspiffs.a differ diff --git a/tools/sdk/lib/libtcpip_adapter.a b/tools/sdk/lib/libtcpip_adapter.a index 2e4203a6a0e..a61d10b178f 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 b67ee81f3ae..8c5e1aba17c 100644 Binary files a/tools/sdk/lib/libulp.a and b/tools/sdk/lib/libulp.a differ diff --git a/tools/sdk/lib/libvfs.a b/tools/sdk/lib/libvfs.a index 0a58aac282b..b2ceeb4106c 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 6b8c0c4dc98..bb465d1355b 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/libwpa.a b/tools/sdk/lib/libwpa.a index 50ac1dc43e2..883d70eb3af 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 74989a55047..4e0844ee608 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 79a3b60d946..51d15af438e 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 67987a8846b..709e0599a7c 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 247c9be5226..6a4fefee2c4 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 6e78c9608f9..ec068fab125 100644 --- a/tools/sdk/sdkconfig +++ b/tools/sdk/sdkconfig @@ -132,7 +132,7 @@ CONFIG_BT_ENABLED=y CONFIG_BLUEDROID_ENABLED=y CONFIG_BTC_TASK_STACK_SIZE=8192 CONFIG_BLUEDROID_MEM_DEBUG= -CONFIG_CLASSIC_BT_ENABLED=y +CONFIG_CLASSIC_BT_ENABLED= CONFIG_GATTS_ENABLE=y CONFIG_GATTC_ENABLE=y CONFIG_BLE_SMP_ENABLE=y @@ -339,6 +339,9 @@ CONFIG_LWIP_SO_RCVBUF=y CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1 CONFIG_LWIP_IP_FRAG= CONFIG_LWIP_IP_REASSEMBLY= +CONFIG_LWIP_STATS= +CONFIG_LWIP_ETHARP_TRUST_IP_MAC=y +CONFIG_TCPIP_RECVMBOX_SIZE=32 # # TCP