Skip to content

Commit 60b8b47

Browse files
authored
Update IDF to de750e9 and add BLE (espressif#723)
* Update IDF to de750e9 * Add BLE Library submodule
1 parent e6a5b68 commit 60b8b47

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+264
-45
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "libraries/BLE"]
2+
path = libraries/BLE
3+
url = https://github.com/nkolban/ESP32_BLE_Arduino.git

.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ script:
1919
- mkdir espressif
2020
- cd espressif
2121
- ln -s $TRAVIS_BUILD_DIR esp32
22-
- cd esp32/tools
22+
- cd esp32
23+
- git submodule update --init --recursive
24+
- cd tools
2325
- python get.py
2426
- export PATH="$HOME/arduino_ide:$TRAVIS_BUILD_DIR/tools/xtensa-esp32-elf/bin:$PATH"
2527
- which arduino

docs/arduino-ide/debian_ubuntu.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ Installation instructions for Debian / Ubuntu OS
1313
mkdir -p ~/Arduino/hardware/espressif && \
1414
cd ~/Arduino/hardware/espressif && \
1515
git clone https://github.com/espressif/arduino-esp32.git esp32 && \
16-
cd esp32/tools/ && \
16+
cd esp32 && \
17+
git submodule update --init --recursive && \
18+
cd tools && \
1719
python get.py
1820
```
1921
- Restart Arduino IDE

docs/arduino-ide/fedora.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ Installation instructions for Fedora
1010
mkdir -p ~/Arduino/hardware/espressif && \
1111
cd ~/Arduino/hardware/espressif && \
1212
git clone https://github.com/espressif/arduino-esp32.git esp32 && \
13-
cd esp32/tools/ && \
13+
cd esp32 && \
14+
git submodule update --init --recursive && \
15+
cd tools && \
1416
python get.py
1517
```
1618
- Restart Arduino IDE

docs/arduino-ide/mac.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ Installation instructions for Mac OS
88
mkdir -p ~/Documents/Arduino/hardware/espressif && \
99
cd ~/Documents/Arduino/hardware/espressif && \
1010
git clone https://github.com/espressif/arduino-esp32.git esp32 && \
11-
cd esp32/tools/ && \
11+
cd esp32 && \
12+
git submodule update --init --recursive && \
13+
cd tools && \
1214
python get.py
1315
```
1416
- If you get the error below. Install the command line dev tools with xcode-select --install and try the command above again:

docs/arduino-ide/opensuse.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ Installation instructions for openSUSE
1414
mkdir -p ~/Arduino/hardware/espressif && \
1515
cd ~/Arduino/hardware/espressif && \
1616
git clone https://github.com/espressif/arduino-esp32.git esp32 && \
17-
cd esp32/tools/ && \
17+
cd esp32 && \
18+
git submodule update --init --recursive && \
19+
cd tools && \
1820
python get.py
1921
```
2022
- Restart Arduino IDE

docs/esp-idf_component.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ To use as a component of ESP-IDF
99
mkdir -p components && \
1010
cd components && \
1111
git clone https://github.com/espressif/arduino-esp32.git arduino && \
12-
cd .. && \
12+
cd arduino && \
13+
git submodule update --init --recursive && \
14+
cd ../.. && \
1315
make menuconfig
1416
```
1517
- ```make menuconfig``` has some Arduino options

libraries/BLE

Submodule BLE added at 98cd229

tools/sdk/bin/bootloader.bin

512 Bytes
Binary file not shown.

tools/sdk/bin/bootloader_qio.bin

528 Bytes
Binary file not shown.

tools/sdk/include/bluedroid/bta_gatt_api.h

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ typedef UINT8 tBTA_GATT_STATUS;
181181
#define BTA_GATTC_ADV_VSC_EVT 34 /* ADV VSC event */
182182
#define BTA_GATTC_CONNECT_EVT 35 /* GATTC CONNECT event */
183183
#define BTA_GATTC_DISCONNECT_EVT 36 /* GATTC DISCONNECT event */
184+
#define BTA_GATTC_READ_MUTIPLE_EVT 37 /* GATTC Read mutiple event */
184185

185186
typedef UINT8 tBTA_GATTC_EVT;
186187

tools/sdk/include/bluedroid/bta_gattc_int.h

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ typedef struct {
165165
tBTA_GATT_AUTH_REQ auth_req;
166166
UINT8 num_attr;
167167
UINT16 handles[GATT_MAX_READ_MULTI_HANDLES];
168+
tBTA_GATTC_EVT cmpl_evt;
168169
}tBTA_GATTC_API_READ_MULTI;
169170

170171
typedef struct {

tools/sdk/include/bluedroid/esp_gap_ble_api.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -864,9 +864,9 @@ esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr);
864864
/**
865865
* @brief Set a GAP security parameter value. Overrides the default value.
866866
*
867-
* @param[in] param_type :L the type of the param which to be set
867+
* @param[in] param_type : the type of the param which to be set
868868
* @param[in] value : the param value
869-
* @param[out] len : the length of the param value
869+
* @param[in] len : the length of the param value
870870
*
871871
* @return - ESP_OK : success
872872
* - other : failed

tools/sdk/include/bluedroid/esp_gattc_api.h

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ typedef enum {
6363
ESP_GATTC_UNREG_FOR_NOTIFY_EVT = 39, /*!< When unregister for notification of a service completes, the event comes */
6464
ESP_GATTC_CONNECT_EVT = 40, /*!< When the ble physical connection is set up, the event comes */
6565
ESP_GATTC_DISCONNECT_EVT = 41, /*!< When the ble physical connection disconnected, the event comes */
66+
ESP_GATTC_READ_MUTIPLE_EVT = 42, /*!< When the ble characteristic or descriptor mutiple complete, the event comes */
6667
} esp_gattc_cb_event_t;
6768

6869

tools/sdk/include/config/sdkconfig.h

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16
1111
#define CONFIG_BLE_SMP_ENABLE 1
1212
#define CONFIG_TCP_RECVMBOX_SIZE 6
13+
#define CONFIG_LWIP_ETHARP_TRUST_IP_MAC 1
1314
#define CONFIG_TCP_WND_DEFAULT 5744
1415
#define CONFIG_SW_COEXIST_ENABLE 1
1516
#define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1
@@ -154,6 +155,7 @@
154155
#define CONFIG_SPIFFS_OBJ_NAME_LEN 32
155156
#define CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT 5
156157
#define CONFIG_LOG_BOOTLOADER_LEVEL_NONE 1
158+
#define CONFIG_TCPIP_RECVMBOX_SIZE 32
157159
#define CONFIG_ESP32_DEFAULT_CPU_FREQ_240 1
158160
#define CONFIG_ESP32_XTAL_FREQ_AUTO 1
159161
#define CONFIG_TCP_MAXRTX 12

tools/sdk/include/driver/driver/sigmadelta.h

+10-9
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ extern "C" {
2727
* @brief Sigma-delta channel list
2828
*/
2929
typedef enum{
30-
SIGMADELTA_CHANNEL_0 = 0, /*!< Sigma-delta channel0 */
31-
SIGMADELTA_CHANNEL_1 = 1, /*!< Sigma-delta channel1 */
32-
SIGMADELTA_CHANNEL_2 = 2, /*!< Sigma-delta channel2 */
33-
SIGMADELTA_CHANNEL_3 = 3, /*!< Sigma-delta channel3 */
34-
SIGMADELTA_CHANNEL_4 = 4, /*!< Sigma-delta channel4 */
35-
SIGMADELTA_CHANNEL_5 = 5, /*!< Sigma-delta channel5 */
36-
SIGMADELTA_CHANNEL_6 = 6, /*!< Sigma-delta channel6 */
37-
SIGMADELTA_CHANNEL_7 = 7, /*!< Sigma-delta channel7 */
30+
SIGMADELTA_CHANNEL_0 = 0, /*!< Sigma-delta channel 0 */
31+
SIGMADELTA_CHANNEL_1 = 1, /*!< Sigma-delta channel 1 */
32+
SIGMADELTA_CHANNEL_2 = 2, /*!< Sigma-delta channel 2 */
33+
SIGMADELTA_CHANNEL_3 = 3, /*!< Sigma-delta channel 3 */
34+
SIGMADELTA_CHANNEL_4 = 4, /*!< Sigma-delta channel 4 */
35+
SIGMADELTA_CHANNEL_5 = 5, /*!< Sigma-delta channel 5 */
36+
SIGMADELTA_CHANNEL_6 = 6, /*!< Sigma-delta channel 6 */
37+
SIGMADELTA_CHANNEL_7 = 7, /*!< Sigma-delta channel 7 */
3838
SIGMADELTA_CHANNEL_MAX,
3939
} sigmadelta_channel_t;
4040

@@ -64,7 +64,8 @@ esp_err_t sigmadelta_config(const sigmadelta_config_t *config);
6464
*
6565
* This function is used to set Sigma-delta channel duty,
6666
* If you add a capacitor between the output pin and ground,
67-
* the average output voltage Vdc = VDDIO / 256 * duty + VDDIO/2, VDDIO is power supply voltage.
67+
* the average output voltage will be Vdc = VDDIO / 256 * duty + VDDIO/2,
68+
* where VDDIO is the power supply voltage.
6869
*
6970
* @param channel Sigma-delta channel number
7071
* @param duty Sigma-delta duty of one channel, the value ranges from -128 to 127, recommended range is -90 ~ 90.

tools/sdk/include/esp32/esp_spiram.h

+12
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,16 @@ void esp_spiram_writeback_cache();
6464

6565

6666

67+
/**
68+
* @brief Reserve a pool of internal memory for specific DMA/internal allocations
69+
*
70+
* @param size Size of reserved pool in bytes
71+
*
72+
* @return
73+
* - ESP_OK on success
74+
* - ESP_ERR_NO_MEM when no memory available for pool
75+
*/
76+
esp_err_t esp_spiram_reserve_dma_pool(size_t size);
77+
78+
6779
#endif

tools/sdk/include/esp32/esp_wifi.h

+19-7
Original file line numberDiff line numberDiff line change
@@ -517,23 +517,34 @@ esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second);
517517
esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
518518

519519
/**
520-
* @brief Set country code
521-
* The default value is WIFI_COUNTRY_CN
520+
* @brief configure country info
522521
*
523-
* @param country country type
522+
* @attention 1. The default country is {.cc="CN", .schan=1, .nchan=13, policy=WIFI_COUNTRY_POLICY_AUTO}
523+
* @attention 2. When the country policy is WIFI_COUNTRY_POLICY_AUTO, use the country info of AP to which
524+
* the station is connected. E.g. if the configured country info is {.cc="USA", .schan=1, .nchan=11},
525+
* the country info of the AP to which the station is connected is {.cc="JP", .schan=1, .nchan=14},
526+
* then our country info is {.cc="JP", .schan=1, .nchan=14}. If the station disconnected
527+
* from the AP, the country info back to {.cc="USA", .schan=1, .nchan=11} again.
528+
* @attention 3. When the country policy is WIFI_COUNTRY_POLICY_MANUAL, always use the configured country info.
529+
* @attention 4. When the country info is changed because of configuration or because the station connects to a different
530+
* external AP, the country IE in probe response/beacon of the soft-AP is changed also.
531+
* @attention 5. The country configuration is not stored into flash
532+
* @attention 6. This API doesn't validate the per-country rules, it's up to the user to fill in all fields according to
533+
* local regulations.
534+
*
535+
* @param country the configured country info
524536
*
525537
* @return
526538
* - ESP_OK: succeed
527539
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
528540
* - ESP_ERR_WIFI_ARG: invalid argument
529-
* - others: refer to error code in esp_err.h
530541
*/
531-
esp_err_t esp_wifi_set_country(wifi_country_t country);
542+
esp_err_t esp_wifi_set_country(wifi_country_t *country);
532543

533544
/**
534-
* @brief Get country code
545+
* @brief get the current country info
535546
*
536-
* @param country store current country
547+
* @param country country info
537548
*
538549
* @return
539550
* - ESP_OK: succeed
@@ -542,6 +553,7 @@ esp_err_t esp_wifi_set_country(wifi_country_t country);
542553
*/
543554
esp_err_t esp_wifi_get_country(wifi_country_t *country);
544555

556+
545557
/**
546558
* @brief Set MAC address of the ESP32 WiFi station or the soft-AP interface.
547559
*

tools/sdk/include/esp32/esp_wifi_types.h

+27-7
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,15 @@ typedef esp_interface_t wifi_interface_t;
4040
#define WIFI_IF_AP ESP_IF_WIFI_AP
4141

4242
typedef enum {
43-
WIFI_COUNTRY_CN = 0, /**< country China, channel range [1, 14] */
44-
WIFI_COUNTRY_JP, /**< country Japan, channel range [1, 14] */
45-
WIFI_COUNTRY_US, /**< country USA, channel range [1, 11] */
46-
WIFI_COUNTRY_EU, /**< country Europe, channel range [1, 13] */
47-
WIFI_COUNTRY_MAX
43+
WIFI_COUNTRY_POLICY_AUTO, /**< Country policy is auto, use the country info of AP to which the station is connected */
44+
WIFI_COUNTRY_POLICY_MANUAL, /**< Country policy is manual, always use the configured country info */
45+
} wifi_country_policy_t;
46+
47+
typedef struct {
48+
char cc[3]; /**< country code string */
49+
uint8_t schan; /**< start channel */
50+
uint8_t nchan; /**< total channel number */
51+
wifi_country_policy_t policy; /**< country policy */
4852
} wifi_country_t;
4953

5054
typedef enum {
@@ -121,15 +125,31 @@ typedef struct {
121125
wifi_scan_time_t scan_time; /**< scan time per channel */
122126
} wifi_scan_config_t;
123127

128+
typedef enum {
129+
WIFI_CIPHER_TYPE_NONE = 0, /**< the cipher type is none */
130+
WIFI_CIPHER_TYPE_WEP40, /**< the cipher type is WEP40 */
131+
WIFI_CIPHER_TYPE_WEP104, /**< the cipher type is WEP104 */
132+
WIFI_CIPHER_TYPE_TKIP, /**< the cipher type is TKIP */
133+
WIFI_CIPHER_TYPE_CCMP, /**< the cipher type is CCMP */
134+
WIFI_CIPHER_TYPE_TKIP_CCMP, /**< the cipher type is TKIP and CCMP */
135+
WIFI_CIPHER_TYPE_UNKNOWN, /**< the cipher type is unknown */
136+
} wifi_cipher_type_t;
137+
124138
typedef struct {
125139
uint8_t bssid[6]; /**< MAC address of AP */
126140
uint8_t ssid[33]; /**< SSID of AP */
127141
uint8_t primary; /**< channel of AP */
128142
wifi_second_chan_t second; /**< second channel of AP */
129143
int8_t rssi; /**< signal strength of AP */
130144
wifi_auth_mode_t authmode; /**< authmode of AP */
131-
uint32_t low_rate_enable:1; /**< bit: 0 flag to identify if low rate is enabled or not */
132-
uint32_t reserved:31; /**< bit: 1..31 reserved */
145+
wifi_cipher_type_t pairwise_cipher; /**< pairwise cipher of AP */
146+
wifi_cipher_type_t group_cipher; /**< group cipher of AP */
147+
uint32_t phy_11b:1; /**< bit: 0 flag to identify if 11b mode is enabled or not */
148+
uint32_t phy_11g:1; /**< bit: 1 flag to identify if 11g mode is enabled or not */
149+
uint32_t phy_11n:1; /**< bit: 2 flag to identify if 11n mode is enabled or not */
150+
uint32_t phy_lr:1; /**< bit: 3 flag to identify if low rate is enabled or not */
151+
uint32_t wps:1; /**< bit: 4 flag to identify if WPS is supported or not */
152+
uint32_t reserved:27; /**< bit: 5..31 reserved */
133153
} wifi_ap_record_t;
134154

135155
typedef enum {

tools/sdk/include/freertos/freertos/portmacro.h

+15
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ extern "C" {
8282
#include "esp_crosscore_int.h"
8383

8484

85+
#include <esp_heap_caps.h>
86+
#include "soc/soc_memory_layout.h"
87+
8588
//#include "xtensa_context.h"
8689

8790
/*-----------------------------------------------------------
@@ -245,6 +248,18 @@ static inline unsigned portENTER_CRITICAL_NESTED() { unsigned state = XTOS_SET_I
245248
#define portSET_INTERRUPT_MASK_FROM_ISR() portENTER_CRITICAL_NESTED()
246249
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(state) portEXIT_CRITICAL_NESTED(state)
247250

251+
//Because the ROM routines don't necessarily handle a stack in external RAM correctly, we force
252+
//the stack memory to always be internal.
253+
#define pvPortMallocTcbMem(size) heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT)
254+
#define pvPortMallocStackMem(size) heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT)
255+
256+
//xTaskCreateStatic uses these functions to check incoming memory.
257+
#define portVALID_TCB_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr))
258+
#ifndef CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
259+
#define portVALID_STACK_MEM(ptr) esp_ptr_byte_accessible(ptr)
260+
#else
261+
#define portVALID_STACK_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr))
262+
#endif
248263

249264
/*
250265
* Wrapper for the Xtensa compare-and-set instruction. This subroutine will atomically compare

tools/sdk/include/heap/esp_heap_caps.h

+16
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define MALLOC_CAP_PID7 (1<<9) ///< Memory must be mapped to PID7 memory space (PIDs are not currently used)
3333
#define MALLOC_CAP_SPIRAM (1<<10) ///< Memory must be in SPI RAM
3434
#define MALLOC_CAP_INTERNAL (1<<11) ///< Memory must be internal; specifically it should not disappear when flash/spiram cache is switched off
35+
#define MALLOC_CAP_DEFAULT (1<<12) ///< Memory can be returned in a non-capability-specific memory allocation (e.g. malloc(), calloc()) call
3536
#define MALLOC_CAP_INVALID (1<<31) ///< Memory can't be used / list end marker
3637

3738
/**
@@ -172,3 +173,18 @@ void heap_caps_print_heap_info( uint32_t caps );
172173
* @return True if all heaps are valid, False if at least one heap is corrupt.
173174
*/
174175
bool heap_caps_check_integrity(uint32_t caps, bool print_errors);
176+
177+
178+
179+
/**
180+
* @brief Enable malloc() in external memory and set limit below which
181+
* malloc() attempts are placed in internal memory.
182+
*
183+
* When external memory is in use, the allocation strategy is to initially try to
184+
* satisfy smaller allocation requests with internal memory and larger requests
185+
* with external memory. This sets the limit between the two, as well as generally
186+
* enabling allocation in external memory.
187+
*
188+
* @param limit Limit, in bytes.
189+
*/
190+
void heap_caps_malloc_extmem_enable(size_t limit);

tools/sdk/include/heap/esp_heap_caps_init.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@ esp_err_t heap_caps_add_region(intptr_t start, intptr_t end);
7373
* @param start Start address of new region.
7474
* @param end End address of new region.
7575
*
76-
* @return ESP_OK on success, ESP_ERR_INVALID_ARG if a parameter is invalid, ESP_ERR_NO_MEM if no
77-
* memory to register new heap.
76+
* @return
77+
* - ESP_OK on success
78+
* - ESP_ERR_INVALID_ARG if a parameter is invalid
79+
* - ESP_ERR_NO_MEM if no memory to register new heap.
80+
* - ESP_FAIL if region overlaps the start and/or end of an existing region
7881
*/
7982
esp_err_t heap_caps_add_region_with_caps(const uint32_t caps[], intptr_t start, intptr_t end);
8083

0 commit comments

Comments
 (0)