Skip to content

Commit

Permalink
Update IDF to de750e9 and add BLE (espressif#723)
Browse files Browse the repository at this point in the history
* Update IDF to de750e9

* Add BLE Library submodule
  • Loading branch information
me-no-dev authored Oct 13, 2017
1 parent e6a5b68 commit 60b8b47
Show file tree
Hide file tree
Showing 74 changed files with 264 additions and 45 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "libraries/BLE"]
path = libraries/BLE
url = https://github.com/nkolban/ESP32_BLE_Arduino.git
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion docs/arduino-ide/debian_ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion docs/arduino-ide/fedora.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion docs/arduino-ide/mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion docs/arduino-ide/opensuse.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion docs/esp-idf_component.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions libraries/BLE
Submodule BLE added at 98cd22
Binary file modified tools/sdk/bin/bootloader.bin
Binary file not shown.
Binary file modified tools/sdk/bin/bootloader_qio.bin
Binary file not shown.
1 change: 1 addition & 0 deletions tools/sdk/include/bluedroid/bta_gatt_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions tools/sdk/include/bluedroid/bta_gattc_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions tools/sdk/include/bluedroid/esp_gap_ble_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tools/sdk/include/bluedroid/esp_gattc_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down
2 changes: 2 additions & 0 deletions tools/sdk/include/config/sdkconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 10 additions & 9 deletions tools/sdk/include/driver/driver/sigmadelta.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions tools/sdk/include/esp32/esp_spiram.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 19 additions & 7 deletions tools/sdk/include/esp32/esp_wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
*
Expand Down
34 changes: 27 additions & 7 deletions tools/sdk/include/esp32/esp_wifi_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -121,15 +125,31 @@ 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 */
uint8_t primary; /**< channel of AP */
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 {
Expand Down
15 changes: 15 additions & 0 deletions tools/sdk/include/freertos/freertos/portmacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ extern "C" {
#include "esp_crosscore_int.h"


#include <esp_heap_caps.h>
#include "soc/soc_memory_layout.h"

//#include "xtensa_context.h"

/*-----------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions tools/sdk/include/heap/esp_heap_caps.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down Expand Up @@ -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);
7 changes: 5 additions & 2 deletions tools/sdk/include/heap/esp_heap_caps_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading

0 comments on commit 60b8b47

Please sign in to comment.