Commit graph

2074 commits

Author SHA1 Message Date
XiaXiaotian 5553fbd537 add base MAC address storage choice.
Base MAC address can be stored in default manufacture-defined or customer
    pre-defined place in EFUSE and other place e.g. flash or EEPROM.
    If choose to use base MAC address which is stored in other place, please
    call esp_base_mac_addr_set_external() before initializing WiFi/BT/Ehternet.
2017-04-21 14:55:11 +08:00
Yulong b5989a6b26 component/bt:Recovery the btm_establish_continue when created the acl connection 2017-04-21 02:43:35 -04:00
Angus Gratton fd3ef4cdfe Merge branch 'bugfix/github_fixes' into 'master'
Various fixes from Github

Some one-line fixes from Github PRs.

See merge request !689
2017-04-21 12:27:32 +08:00
Angus Gratton 94a61389ff Merge branch 'bugfix/driver_const_params' into 'master'
components/driver: 'const' all config calls.

Merges PR #519 https://github.com/espressif/esp-idf/pull/519

See merge request !687
2017-04-21 12:25:15 +08:00
Angus Gratton f3a567b65d PPPoS: Rearrange config items (move TCP/IP stack size to LWIP), mark as experimental/unsupported
Ref #272
2017-04-21 14:23:34 +10:00
Adrian Muzyka 47c722d674 Enable lwip PPPoS support
* Fix some lwip api bugs
 * Added PPP_SUPPORT parameter to lwip Kconfig
 * Added example pppos_client

Merges #272 https://github.com/espressif/esp-idf/pull/272
2017-04-21 14:23:34 +10:00
Liu Zhi Fu 561a1a64f2 esp32: update wifi lib for limitting dynamic wifi buffer
Add limit for all dynamic wifi ebuf to avoid wifi run out of memory in some extreme scanrio
2017-04-21 10:38:00 +08:00
Ivan Grokhotkov 6e9d60ef70 rtc_clk_init: handle case when XTAL frequency has already been set
On first reset, ROM code writes the estimated XTAL frequency into
RTC_APB_FREQ_REG (aka STORE5). If the application doesn’t specify exact
XTAL frequency (which is always the case for now), rtc_clk_init will
guess what kind of XTAL is used (26M or 40M), based on the estimated
frequency. Later, detected frequency is written into RTC_XTAL_FREQ_REG
(aka STORE4).

When the application switches clock source to PLL, APB frequency changes
and RTC_APB_FREQ_REG is updated. If the application encounters an RTC
WDT reset, RTC_APB_FREQ_REG will not be updated prior to reset. Once the
application starts up again, it will attempt to auto-detect XTAL
frequency based on RTC_APB_FREQ_REG, which now has value of 80000000.
This will fail, and rtc_clk_xtal_freq_estimate will fall back to the
default value of 26 MHz. Due to an incorrect XTAL frequency, PLL
initialization will also take incorrect path, and PLL will run at a
different frequency. Depending on the application this may cause just
garbage output on UART or a crash (if WiFi is used).
2017-04-21 10:33:58 +08:00
Angus Gratton 52c378b447 bluedroid: Fix compilation warnings related to aliasing
Merges PR #518 https://github.com/espressif/esp-idf/pull/518
2017-04-21 11:31:40 +10:00
Michael Kellner eeb0aaa09e spidriver: Display length errors correctly
SPI transfer length is bits, not bytes, so the error should indicate bits. Also, there are separate lengths for rx and
tx (confusingly named rxlength and length... if rxlength is 0, length is used). The code checks the tx length for the
rx, so it never validates rxlength.

Originally contributed as part of #511 https://github.com/espressif/esp-idf/pull/511
2017-04-21 11:03:07 +10:00
Jonathan Kaufmann bf82b441ae Fixed bug in ledc_set_fade_with_step where returned while holding critical section.
Merges PR #515 https://github.com/espressif/esp-idf/pull/515
2017-04-21 11:03:07 +10:00
Michael Kellner a523aa3ef5 mbedtls port: Fix detection of EWOULDBLOCK/EAGAIN with non-blocking sockets
Since mbedtls_net_errno is reset by fcntl, it is reset after calling
net_would_block, so the call to mbedtls_net_errno in mbedtls_net_recv
and mbedtls_net_send will always get back 0. This change propagates
the value returned by mbedtls_net_errno up through net_would_block,
to allow the correct error value to be used and avoid a redundant
call to mbedtls_net_errno.

Merges PR #511 https://github.com/espressif/esp-idf/pull/511
2017-04-21 10:46:34 +10:00
Yulong bc807a18d1 component/bt:Finish all the separate code from BT & BLE 2017-04-20 07:18:05 -04:00
Angus Gratton 453b5ded1d ethernet: Add convenience functions esp_eth_smi_wait_value() & esp_eth_smi_wait_set()
Covers the common case of waiting for a particular PHY register to have a particular value.
2017-04-20 18:03:00 +10:00
Angus Gratton 453722ba54 ethernet: Refactor PHY support to be part of ethernet component
Move generic PHY support into its own interface
2017-04-20 18:03:00 +10:00
Liu Zhi Fu ab37f89f55 lwip: fix tcp stable test abort issue
1. Modify dhcp server timer to 1 seconds
2. Enable ETHARP_TRUST_IP_MAC

modify according to review
2017-04-19 17:39:32 +08:00
Yulong 2723504473 add the GATTC_INCLUDED marco to close the bta_gattc module when not used the GATTC 2017-04-19 05:16:24 -04:00
Yulong 0ddadc98a3 separate the btm layer from SMP security 2017-04-19 03:44:01 -04:00
Ivan Grokhotkov 8f02730e1f fat/sdmmc: unmount FATFS object on error
Failure to call f_mount(NULL,...) makes FATFS attempt to clean up the old
FS object upon next mount. If previous mount operation has failed, some
parts of FS object may not be fully initialized, which will cause errors
(such as attempting to delete a mutex which wasn’t allocated).
2017-04-19 15:03:30 +08:00
Jiang Jiang Jian 29b32be97c Merge branch 'bugfix/tw11779_softAP_crash_when_wifi_connect' into 'master'
esp32: update wifi lib to fix wifi connect cause crash

Fix softap wifi connect crash bug

See merge request !672
2017-04-19 14:34:53 +08:00
Ivan Grokhotkov 49848eaed5 sdmmc: handle card removal when CD is not used
When SD card is removed during transaction, SDMMC peripheral can report
a range of errors, such as timeouts, CRC errors, start/end bit errors.
Under normal conditions (card is inserted), SDMMC peripheral also generates
command done or data done interrupts. When the card is removed, such
interrupts may not be always generated.

This change fixes handling of timeout interrupts and SBE interrupts.
It also adds a one second timeout into the event processing loop. This
timeout allows applications to recover in cases when the SDMMC peripheral
doesn’t generate command/data done event on card removal.
2017-04-19 12:50:51 +08:00
Jeroen Domburg b209c6dcbb Make internal stack size variables in FreeRTOS 32-bit instead of 16-bit 2017-04-19 10:47:19 +08:00
Yulong 65ff8bd160 l2cap can send data to low layer when close the classic bt. 2017-04-18 05:42:55 -04:00
Ivan Grokhotkov 5d1bb42c18 soc: allow REG_SET_FIELD to be used with single-bit fields 2017-04-18 17:34:26 +08:00
Ivan Grokhotkov faaf59ccb3 soc: define missing M, V macros for nrx, bb, fe, emac, iomux
Recipe:
- Add _M and _V for single-bit fields
  Search: (#define (\w+)\s*(\(BIT\(\d+\)\)))
  Replace: \1\n#define \2_M \3\n#define \2_V 1

- Add _M and _V for multi-bit fields
  Search: (#define (\w+)\s*(0x[\dA-Fa-f]+))
  Replace: \1\n#define \2_M (\2_V << \2_S)\n#define \2_V \3
2017-04-18 17:34:26 +08:00
Jeroen Domburg f73c6f875c Merge branch 'bugfix/dont_log_before_bss_inited' into 'master'
Remove ESP_EARLY_LOGI before bss is initialized; it crashes the CPU

There's an ESP_EARLY_LOGI line that can get called before the BSS is initialized; the early logging code doesn't cope well with that: it checks if FreeRTOS is up, but the variables it uses for that contains garbage because it isn't cleared yet, giving the wrong result. The logging code then tries to set a mux, crashing the entire system. This patch removes the log line and adds a warning at the BSS initialization line not to do anything complex before that point.

Fixes https://github.com/espressif/esp-idf/issues/523

See merge request !671
2017-04-18 11:21:31 +08:00
Yulong 22ccf6c368 component/bt:rebase the BT_BLE_separate to the new master 2017-04-17 22:53:43 -04:00
Alexey Gerenkov 55f1a63faf esp32: Adds functionality for application tracing over JTAG
- Implements application tracing module which allows to send arbitrary
   data to host over JTAG. This feature is useful for analyzing
   program modules behavior, dumping run-time application data etc.
 - Implements printf-like logging functions on top of apptrace module.
   This feature is a kind of semihosted printf functionality with lower
   overhead and impact on system behaviour as compared to standard printf.
2017-04-17 23:26:29 +03:00
Ivan Grokhotkov ad50a70440 fix test for dumping trace data 2017-04-17 22:19:14 +03:00
Ivan Grokhotkov 639557d975 trace: add Kconfig options for app level trace
CONFIG_MEMMAP_TRACEMEM is now a hidden underlying option, which can be enabled using either CONFIG_ESP32_TRAX or CONFIG_ESP32_APP_TRACE
2017-04-17 22:19:14 +03:00
Ivan Grokhotkov 3ac080fc80 test tracing over JTAG 2017-04-17 22:19:14 +03:00
XiaXiaotian 03e2618d35 Add customer MAC address that read from efuse 2017-04-17 21:24:15 +08:00
Liu Zhi Fu b94e5f7855 esp32: update wifi lib to fix wifi connect cause crash
Fix softap wifi connect crash bug
2017-04-17 19:18:26 +08:00
Ivan Grokhotkov 3624149344 wear_levelling: add unit test sub-component 2017-04-17 11:01:18 +08:00
Ivan Grokhotkov 3a39475d20 wear_levelling: run host side test in CI 2017-04-17 11:01:18 +08:00
Ivan Grokhotkov 8f76fe1d7f move Catch framework header into tools directory 2017-04-17 11:01:18 +08:00
Ivan Grokhotkov 57e380fa99 nvs_flash, wear_levelling: ignore host test files 2017-04-17 11:01:18 +08:00
Ivan Grokhotkov 52b51df859 add wear_levelling component and example 2017-04-17 11:01:17 +08:00
Dmitry Yakovlev aeabbd305c fatfs: add support for small disc sizes (less then 16 MB) 2017-04-17 11:01:17 +08:00
Ivan Grokhotkov 7388efa953 fatfs: add support for variable sector size 2017-04-17 11:01:17 +08:00
Ivan Grokhotkov ed6957302f Kconfig: fix “symbol value '' invalid for PHY_DATA_OFFSET” warning
PHY_DATA_OFFSET is only used if ESP32_PHY_INIT_DATA_IN_PARTITION is set
2017-04-17 11:01:17 +08:00
Jeroen Domburg 76a4082de7 Remove ESP_EARLY_LOGI before bss is initialized; it crashes the CPU 2017-04-16 23:34:03 +08:00
Jiang Jiang Jian 0ea4c3c06b Merge branch 'bugfix/btdm_alarm_event_transfer' into 'master'
component/bt: transfer bluedroid timer events to be handled by BTC task

NVS operation can take long time for timer task to handle. Transfer the alarm event to be handled by BTC task.

See merge request !670
2017-04-14 21:20:19 +08:00
Ivan Grokhotkov 15ec487fde Merge branch 'feature/esp32_d2wd_support' into 'master'
ESP32-D2WD support

Support ESP32-D2WD with integrated flash in ESP-IDF.

Includes fix for https://github.com/espressif/esp-idf/issues /521


See merge request !639
2017-04-14 20:57:39 +08:00
wangmengyang 4f3b391674 component/bt: transfer bluedroid timer events to be handled by BTC task 2017-04-14 18:49:30 +08:00
Yulong 4715fa16ae change the make error in bta_dm_ble_set_rand_address func 2017-04-14 02:52:43 -04:00
Yulong cb5c296829 component/bt:move the bugfix/ble_set_rand_addr_bug here for fix the conflict with the master 2017-04-14 02:45:07 -04:00
Yulong f6f094213e compoment/bt:Change the tabs to space in btc_ble_storage.c & btc_gap_ble.c file 2017-04-13 23:50:14 -04:00
Yulong aff8758fe4 delete the debug log in the btc_ble_storage file 2017-04-13 22:40:37 -04:00
Michel Pollet 349a77cb55 components/driver: 'const' all config calls.
Some were, some weren't. They all could/should be.

Signed-off-by: Michel Pollet <buserror@gmail.com>
2017-04-13 18:33:33 +01:00
Yulong c6a516f122 component/bt:move the btdm_rebase_ssp_api branch to this branch 2017-04-13 10:14:28 -04:00
Jiang Jiang Jian 9050307dfe Merge branch 'feature/check_invalid_cache_access' into 'master'
Detect invalid cache access

This MR adds always-on feature which detects cache invalid access and triggers panic handler when invalid access interrupt is raised.


See merge request !660
2017-04-13 16:11:19 +08:00
Jiang Jiang Jian 7c6c74dff0 Merge branch 'bugfix/check_wifi_state_when_wifi_deinit_is_called' into 'master'
check wifi state when wifi deinit is called



See merge request !663
2017-04-13 16:01:39 +08:00
Angus Gratton f7793840e1 bootloader: Add QIO support for ESP32-D2WD SPI flash 2017-04-13 17:55:47 +10:00
Angus Gratton 85e76a7cfc spiflash ROM functions: Remove Quad I/O mode enable/disable code from flash ROM functions
Confusion here is that original ROM has two functions:

* SPIReadModeCnfig() - sets mode, calls enable_qio_mode/disable_qio_mode
* SPIMasterReadModeCnfig() - As above, but doesn't set QIO mode in status register

However we never want to use the ROM method to set/clear QIO mode flag, as not all flash chips work this way. Instead we
do it in flash_qio_mode.c in bootloader.

So in both cases (ROM or "patched ROM") we now call SPIMasterReadModeCnfig(), which is now named
esp_rom_spiflash_config_readmode().
2017-04-13 17:54:42 +10:00
Ivan Grokhotkov 378884660a Merge branch 'feature/tw11250_add_tcp_delay_statistics' into 'master'
lwip: refactor to esp specific counter

1. Add tcp debug counter
2. Refactor other ESP specific counter

See merge request !635
2017-04-13 15:29:36 +08:00
Ivan Grokhotkov 3cd6d4e5fc Merge branch 'bugfix/uart_tx_buffer_blocked' into 'master'
Fix uart tx function block issue

To enable tx empty interrupt each time the tx ringbuffer get filled, so that tx function will not block if tx data length is larger than tx ringbuffer size.
Reported from customer of Audio team.

See merge request !658
2017-04-13 15:29:09 +08:00
Ivan Grokhotkov 8a9516a973 Merge branch 'bugfix/bootloader_error_handling_code' into 'master'
Add error handling code in bootloader

Forgotten error handling

See merge request !650
2017-04-13 15:28:49 +08:00
Ivan Grokhotkov af0ecca492 add test case for invalid cache access interrupt 2017-04-13 15:27:39 +08:00
Ivan Grokhotkov a8f1918d88 panic handler: access exception frame members via struct fields 2017-04-13 15:27:38 +08:00
Ivan Grokhotkov aae441951b panic handler: send output to the UART configured as console 2017-04-13 15:27:38 +08:00
Jeroen Domburg 0b79d07d34 add detection of invalid cache access
- fix level 4 interrupt vectors to produce correct backtrace
- initialize invalid cache access interrupt on startup
- handle invalid cache access in panic handler
2017-04-13 15:27:38 +08:00
Ivan Grokhotkov 3c6c1e36ec soc: add invalid cache access interrupt bits to dport_reg 2017-04-13 15:27:38 +08:00
Jiang Jiang Jian 82b7ca92ad Merge branch 'bugfix/lwip_sta_ap_netif_names' into 'master'
give the AP and STA netifs different names for ease of debugging lwip

Both AP and STA netifs used to be called "en". This changes the name to "st" for STA and "ap" for AP.

Ref https://github.com/espressif/esp-idf/pull/456.

See merge request !653
2017-04-13 14:43:13 +08:00
Jiang Jiang Jian 6ace4f6fa4 Merge branch 'feature/btdm_avrc' into 'master'
Feature/btdm avrc

The source branch "feature/btdm_avrc" includes classic Bluetooth profiles A2DP(sink role) and AVRCP(controller role); 
Menuconfig options to control whether to enable classic BT is added.

See merge request !591
2017-04-13 14:36:58 +08:00
XiaXiaotian 454d00e2ae check wifi state when wifi deinit is called 2017-04-13 14:34:40 +08:00
Angus Gratton 66308774db esptool: Update to include ESP32-D2WD support (and other SPI flash remapping) 2017-04-13 16:25:15 +10:00
Liu Zhi Fu 743359a6bf esp32: update wifi lib for some refactor
1. Refactor for wifi ebuf management
2. Refactor for wifi rate control/long rate/tx
2017-04-13 11:41:42 +08:00
Ivan Grokhotkov 4eaf5e218a Merge branch 'feature/change_ssid_len_to_33' into 'master'
change scanned ap's ssid array len to 33



See merge request !661
2017-04-13 11:16:11 +08:00
XiaXiaotian d61959b583 change scanned ap's ssid array len to 33 2017-04-13 10:09:07 +08:00
Ivan Grokhotkov a845f211e3 Merge branch 'bugfix/ota_runtime_check_encrypted_flash' into 'master'
Enable checks for encrypted flash in OTA

Even if firmware is compiled without CONFIG_FLASH_ENCRYPTION_ENABLED.

Rationale: CONFIG_FLASH_ENCRYPTION_ENABLED controls whether boot loader generates keys for encryption or not, but flash encryption can be configured externally. With this change, it's possible to have boot loader not generate keys but still have encryption working.

Also fix use of it->part

Ref. https://github.com/espressif/esp-idf/pull/453

See merge request !647
2017-04-12 21:30:07 +08:00
Wangjialin 315aa1fcd8 Fix uart tx function block issue
To enable tx empty interrupt each time the tx ringbuffer get filled, so that tx function will not block if tx data length is larger than tx ringbuffer size.
Reported from customer of Audio team.
2017-04-12 16:57:37 +08:00
wangmengyang b503d68045 component/bt: implement classic Bluetooth profiles A2DP(sink) and AVRCP(controller) 2017-04-12 16:42:14 +08:00
Jiang Jiang Jian 79173c0f2a Merge branch 'bugfix/btdm_gatt_memory_leak' into 'master'
bt component: Fix memory leak while using gatt server

- fix memory leak while creating attribute table
- fix memory leak while deleting service

See merge request !656
2017-04-12 15:43:32 +08:00
island f688309b3a bt component: Fix memory leak while using gatt server
- fix memory leak while creating attribute table
- fix memory leak while deleting service
2017-04-12 14:58:45 +08:00
island 941a12cb4e bt component: Add stop adv/scan completed event 2017-04-12 14:19:16 +08:00
Ivan Grokhotkov 935552427c Merge branch 'bugfix/uart_rmt_fixes' into 'master'
Fixes for UART and RMT drivers

- Add const qualifier for config and tx data in RMT (https://github.com/espressif/esp-idf/pull/495)
- Fix rmt_set_tx_thr_intr_en(): check evt_thresh only in enable path (https://github.com/espressif/esp-idf/pull/492)
- Fix impossible check in uart_set_line_inverse (https://github.com/espressif/esp-idf/pull/489)

See merge request !648
2017-04-12 10:39:22 +08:00
Ivan Grokhotkov 9edab21385 Merge branch 'feature/rtc_clk_impl' into 'master'
Introduce soc component, add source of rtc_clk and rtc_pm libraries

This MR adds parts of the RTC library source code (initialization, clock selection functions, sleep functions). WiFi-related power management functions are kept inside the precompiled library. Most of RTC library APIs have been renamed.

Default CPU frequency option in Kconfig is set to 160MHz, pending qualification of 240MHz mode at high temperatures.

Register header files are moved into the new soc component, which will contain chip-specific header files and low-level non-RTOS-aware APIs (such as rtc_ APIs). Some of the files from ESP32 component were also moved: cpu_util.c, brownout.c, and the corresponding header files. Further refactoring of ESP32 component into more meaningful layers (chip-specific low level functions; chip-specific RTOS aware functions; framework-specific RTOS-related functions) will be done in future MRs.

See merge request !633
2017-04-12 10:38:23 +08:00
Edmund Huber eab6d483a5 give the AP and STA netifs different names for ease of debugging lwip 2017-04-11 20:40:36 +08:00
Ivan Grokhotkov 90e740eb5f esp32: update libraries
This removes librtc_{clk,pm}.a and updates librtc.a to use the new
functions defined in ESP-IDF source code.
2017-04-11 20:20:35 +08:00
Ivan Grokhotkov 1132ef7554 Merge branch 'bugfix/flash_busy_check_Wait_SPI_Idle' into 'master'
Bugfix/flash busy check wait spi idle

This branch moves some ROM SPI flash driver to IDF to fix bug in Wait_SPI_Idle() function.
Also it applies code style rules of IDF to integrated ROM driver sources.

See merge request !584
2017-04-11 20:09:06 +08:00
Deomid Ryabkov 516c708fc7 Enable checks for encrypted flash in OTA
Even if firmware is compiled without CONFIG_FLASH_ENCRYPTION_ENABLED
Rayionale: CONFIG_FLASH_ENCRYPTION_ENABLED controls whether boot loader
generates keys for encryption or not, but flash encryption can be
configured externally. With this change, it's possible to have boot
loader not generate keys but still have encryption working.

Also fix use of it->part
2017-04-11 19:10:26 +08:00
devsaurus ae94fe04ef components/driver/rmt: Add const qualifier for config and tx data. 2017-04-11 18:55:56 +08:00
devsaurus cc164b0dc3 fix rmt_set_tx_thr_intr_en(): check evt_thresh only in enable path 2017-04-11 18:55:56 +08:00
shinyquagsire23 8e89a136e1 Fix impossible check in uart_set_line_inverse 2017-04-11 18:55:56 +08:00
Anton Maklakov e4353f2119 bootloader: Add error handling code 2017-04-11 18:15:36 +08:00
Ivan Grokhotkov 7ee8ee8b7e soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00
Ivan Grokhotkov 9ff446e6f9 soc: convert line endings to unix 2017-04-11 15:44:22 +08:00
island a4f3312d9d bt component: optimize scan feature
1. Add advertising data length and scan response length in scan result
2. Add scan continuously feature
3. Fix non connectable adv topology error
4. Increase BTC queue size
2017-04-11 14:20:20 +08:00
Ivan Grokhotkov d6dbf15a1f soc: move header files into soc component 2017-04-11 14:06:40 +08:00
Ivan Grokhotkov 724673be83 soc: add apb_ctrl, struct headers for rtc_cntl and rtc_io 2017-04-11 14:06:40 +08:00
Alexey Gerenkov 0860f46220 spi_flash: Fixed bug in SPI flash ROM driver to work with embedded flash chip
1) fixed SPI_read_status: added check for flash busy flag in matrix mode
2) fixed SPI_page_program: enable write before writing data to SPI FIFO
3) SPI flash ROM funcs replacement is controlled via menuconfig option
2017-04-11 10:51:19 +08:00
wangmengyang ccfe4fefeb component/bt: implement classic Bluetooth profiles A2DP(sink) and AVRCP(controller) 2017-04-10 16:12:21 +08:00
Liu Zhi Fu ece61944f4 lwip: refractor to esp specific counter
1. Add tcp debug counter
2. Refractor other ESP specific counter
2017-04-10 14:46:48 +08:00
Ivan Grokhotkov e9913a11c1 Merge branch 'test/reboot_between_unit_test_cases' into 'release/v2.0'
CI: add reset between running each unit test cases

Unit test is designed to detect bug **within** each test case. Therefore we'll reset between each case to provide a clean context. We will later add stress cases to run unit test cases together to detect potential bugs.

See merge request !636
2017-04-10 12:59:49 +08:00
Ivan Grokhotkov 801b87b48a Merge branch 'bugfix/cross_core_int_init_single_core' into 'master'
esp32: initialize cross-core interrupt in single core mode

The software interrupt originally used as the cross-core interrupt is
now also used to yield from a FreeRTOS critical section; therefore it
must be initialized for single core mode as well.

Fixes https://github.com/espressif/esp-idf/issues/496

See merge request !640
2017-04-10 12:19:10 +08:00
Ivan Grokhotkov aa817a1475 Merge branch 'bugfix/esp_error_check_release_builds' into 'master'
fix warnings generated by ESP_ERROR_CHECK(variable) in release builds

This uses the same pattern as “assert” in release builds to silence the
warning. At the same time, we make sure that if a statement is wrapped
into ESP_ERROR_CHECK, it is executed in release build as well.

Fixes https://github.com/espressif/esp-idf/issues/497

See merge request !641
2017-04-10 12:18:47 +08:00
Ivan Grokhotkov 05e6fba6c3 Merge branch 'feature/mdns_afl_fuzz' into 'master'
Feature/mdns afl fuzz

Implement AFL Fuzz for testing MDNS parser stability

See merge request !632
2017-04-10 11:55:31 +08:00
Ivan Grokhotkov 275b574ace fix warnings generated by ESP_ERROR_CHECK(variable) in release builds
This uses the same pattern as “assert” in release builds to silence the
warning. At the same time, we make sure that if a statement is wrapped
into ESP_ERROR_CHECK, it is executed in release build as well.
2017-04-07 15:24:58 +08:00
Ivan Grokhotkov 85e709705b Merge branch 'bugfix/btdm_task_priority' into 'master'
component/bt : modify bluetooth task priority

modify bluetooth task priority to lower than IPC task priority.

See merge request !631
2017-04-07 14:56:31 +08:00
Ivan Grokhotkov 8915c18f8a esp32: initialize cross-core interrupt in single core mode
The software interrupt originally used as the cross-core interrupt is
now also used to yield from a FreeRTOS critical section; therefore it
must be initialized for single core mode as well.

Fixes https://github.com/espressif/esp-idf/issues/496
2017-04-07 14:48:08 +08:00
Ivan Grokhotkov fd0539b4ba Merge branch 'feature/panic_wdt' into 'master'
esp32: RWDT is used to reboot system in case of panic handler crash

This branch uses RWDT to reboot system in case of panic handler crash.

See merge request !625
2017-04-07 12:14:30 +08:00
Ivan Grokhotkov 42d819e796 Merge branch 'feature/btdm_uart_hci' into 'master'
Feature/btdm uart hci

    1. support UART HCI, devolper need not to make a bridge between VHCI and UART.
    2. fix bug of rand/srand called in ISR.
    3. fix bug of BLE rx packets may cause assert.

See merge request !626
2017-04-07 12:13:42 +08:00
Alexey Gerenkov c142b9b9e5 esp32: RWDT is used to reboot system in case of panic handler crash
also fixes TG1WDG protection bug in panic handler
2017-04-07 02:34:29 +03:00
wangmengyang b5ea92a26e component/bt: implement classic Bluetooth profiles A2DP(sink) and AVRCP(controller) 2017-04-06 16:56:18 +08:00
wangmengyang dbd4e0522e Merge branch 'master' into feature/btdm_avrc 2017-04-06 14:59:58 +08:00
Tian Hao d90a35af19 component/bt : modify bluetooth config style 2017-04-06 11:35:53 +08:00
Ivan Grokhotkov f9fba35d1d Merge branch 'bugfix/btdm_alarm' into 'master'
component/bt : modify alarm APIs to be safely accessible from multiple tasks

Improve the osi_alarm module to make the alarm APIs become thread safe.

See merge request !570
2017-04-06 07:46:01 +08:00
Tian Hao 95d691afdb component/bt : support UART HCI and fix some bugs
1. support UART HCI, devolper need not to make a bridge between VHCI and UART.
2. fix bug of rand/srand called in ISR.
3. fix bug of BLE rx packets may cause assert.
2017-04-05 21:23:43 +08:00
Tian Hao f5ebeb4c4d component/bt : add uart(1/2) as HCI IO directly 2017-04-05 21:23:42 +08:00
Tian Hao e384c7c014 component/bt : modify alarm APIs to be safely accessible from multiple tasks 2017-04-05 17:34:26 +08:00
me-no-dev 4c2622755d Add AFL fuzz test 2017-04-05 09:23:09 +03:00
Angus Gratton 0b57054ed3 freertos tests: Extend preemption test cases to cross-core wakeup 2017-04-04 10:10:08 +10:00
Angus Gratton bdbeaf97d6 freertos tests: Fix accidental "0 delay" in event group tests
Was a slight race condition where tasks on other CPU may not have finished waking up on BIT_CALL when the unity task
polled the event group state.
2017-04-04 10:10:08 +10:00
Angus Gratton 45581dbaca freertos: Delay context switch from queue/task APIs until exiting critical section
Closes #374: https://github.com/espressif/esp-idf/issues/374
2017-04-04 10:10:08 +10:00
me-no-dev 99d39909c4 implement fixes for issues found while fuzz testing 2017-04-03 16:45:59 +03:00
Jiang Jiang Jian fc15d72038 Merge branch 'feature/implement_lwip_critical_protect_with_mutex' into 'master'
lwip: implement lwip critical session with mutex

Currently lwip critical session is based on interrupt, now replace it with mutex

See merge request !595
2017-04-01 17:27:20 +08:00
Tian Hao ecb75b69fd component/bt : modify bluetooth task priority 2017-04-01 17:17:57 +08:00
Liu Zhi Fu 68e27f8188 optimize tcpip adapter layer 2017-04-01 16:41:51 +08:00
Liu Zhi Fu 778a475136 lwip: implement lwip critical session with mutex
Currently lwip critical session is based on interrupt, now replace it with mutex
2017-04-01 16:24:58 +08:00
Jiang Jiang Jian 74d0edec0f Merge branch 'feature/tw10169_optimize_dhcp_renew_rebind_timer' into 'master'
lwip: optimize dhcp renew/rebind timer

This MR is used to replace MR581 since MR581 use a bad branch name.

See merge request !585
2017-04-01 16:04:13 +08:00
Ivan Grokhotkov 47b8f78cb0 Merge branch 'bugfix/flash_op_deadlock' into 'master'
spi_flash: fix race condition in s_flash_op_complete access

Flash operation complete flag was cleared by the CPU initiating flash operation. If the other core was running an ISR, then IPC task could be late to enter the loop to check `s_flash_op_complete` by the time next flash operation started. This would cause a deadlock, as the IPC task would still be waiting for `s_flash_op_complete` to be set (which was already cleared by the next flash operation), while the flash operation task would be blocked waiting for IPC task to set `s_flash_op_can_start`.

If the flag is cleared on the CPU waiting on this flag, then the race condition can not happen.

See merge request !615
2017-03-31 16:02:26 +08:00
wangmengyang 9d745be3f7 Merge branch 'master' into feature/btdm_avrc 2017-03-31 12:51:45 +08:00
Jeroen Domburg a4acf7b67b Merge branch 'bugfix/spi_timing_issues' into 'master'
Fix timing adjustment needed for higher speeds of SPI master bus.

Ref https://github.com/espressif/esp-idf/issues/363 . It was found out the master SPI driver didn't exactly calculate the delay compensation needed, breaking 20 and 26MHz full-duplex mode. This fixes these use cases. We also found out 40MHz full-duplex routed over the GPIO matrix does not work because of a hardware quirk; this MR adds a check/error for that case until we find a workaround.

See merge request !547
2017-03-31 10:44:37 +08:00
XiaXiaotian 4f89cc73e6 Add WiFi static and dynamic tx buffer choice
If static tx buffer is selected, WiFi tx buffers are allocated when WiFi is initialized and released

    when WiFi is de-initialized. If dynamic tx buffer is selected, WiFi tx buffer is allocated when tx

    data is delivered from LWIP to WiFi and released when tx data is sent out by WiFi.

    The size of each static tx buffers is fixed to about 1.6KB and the size of dynamic tx buffers is

    depend on the length of the data delivered from LWIP.

    If PSRAM is enabled, "STATIC" should be selected to guarantee enough WiFi tx buffers.

    If PSRAM is disabled, "DYNAMIC" should be selected to improve the utilization of RAM.
2017-03-30 21:25:44 +08:00
wangmengyang c9d29d109e component/bt: fix the dependence issue in Kconfig 2017-03-30 21:16:11 +08:00
Jiang Jiang Jian 73612b004f Merge branch 'feature/add_scan_time_config' into 'master'
wifi scan: add wifi scan type and time config



See merge request !586
2017-03-30 20:56:30 +08:00
XiaXiaotian c690447dd9 wifi scan: add wifi scan type and time config 2017-03-30 20:36:52 +08:00
Ivan Grokhotkov 39c376f0c3 Merge branch 'bugfix/cpu1_isr_stack_location' into 'master'
Fix finding location of ISR stack space for CPU1

Up to now, the CPU1 interrupts erroneously used the area *after* the ISR stack region, leading to bugs in BT Classic. This fixes that.

See merge request !618
2017-03-29 12:05:31 +08:00
Angus Gratton 6ba469e7a4 Merge branch 'feature/mdns_dnssd_metaquery' into 'master'
mdns: add simple dns-sd meta query support

Merges PR #340 https://github.com/espressif/esp-idf/pull/340

See merge request !619
2017-03-29 09:29:31 +08:00
negativekelvin 96e8a3c725 mdns: add simple dns-sd meta query support
tabs to spaces

match domain
2017-03-29 11:48:19 +11:00
Jeroen Domburg 0e39b77d4e Fix finding location of ISR stack space for CPU1 2017-03-28 15:50:10 +08:00
Jeroen Domburg 76295c7a13 Fix timing adjustment needed for higher speeds of SPI master bus. 2017-03-28 11:31:59 +08:00
Ivan Grokhotkov 92436021ab spi_flash: fix race condition in s_flash_op_complete access
Flash operation complete flag was cleared by the core initiating flash
operation. If the other core was running an ISR, then IPC task could
be late to enter the loop to check s_flash_op_complete by the time next
flash operation started. If the flag is cleared on the CPU waiting on
this flag, then the race condition can not happen.
2017-03-28 01:34:17 +08:00
Ivan Grokhotkov 41c6914454 Merge branch 'feature/ulp_toolchain' into 'master'
ULP coprocessor toolchain integration

- build system support for ULP coprocessor toolchain
- documentation for ULP coprocessor instruction set
- documentation for ULP code execution flow, loading programs, exchanging data
- example: counting pulses using ULP


See merge request !394
2017-03-27 13:54:51 +08:00
Dmitry Yakovlev a6e4e89592 ulp: add build system integration and example 2017-03-27 12:41:00 +08:00
Jiang Jiang Jian 8ee6f8227e Merge branch 'bugfix/reset_mac_cause_bt_cannot_rx_data' into 'master'
Reset WIFI mac when wifi start and update wifi lib

1. reset wifi mac when wifi start

2. roll back rx hung workaround for beacon timeout

3. fix amsdu ap interface wrong issue

4. fix amsdu header parse error

5. fix amsdu flag wrong issue

6. PHY: V350, fix BT rssi bug

7. RTC: V225, fix bt will be not work when wifi is reset

See merge request !606
2017-03-24 17:02:26 +08:00
XiaXiaotian a30c98c1a2 fix compile bug
1. split some unused rtc functions that calls phy function

2. make check bt idle more safe when reset wifi mac
2017-03-24 16:42:44 +08:00
Ivan Grokhotkov 5cf9ccf6ab Merge branch 'feature/add_auth_type_for_wpa2_enterprise' into 'master'
wpa2: add authenticate type for wpa2 enterprise



See merge request !588
2017-03-24 15:56:21 +08:00
Ivan Grokhotkov 710c853adc Merge branch 'bugfix/spi_flash_lock_period' into 'master'
SPI flash operations lock for shorter periods

Based on bug report here:
https://esp32.com/viewtopic.php?f=13&t=1489&p=6816#p6773

Long SPI flash erase (and possibly write/read) cycles block all tasks on both CPUs for an extended period, and can lead to WiFi dissassociation (and general priority inversion.)

This MR inserts preemption breaks into large operations (all erases, writes every 8KB, reads every 16KB).

Overhead of a single spi_flash_guart_start()/spi_flash_guard_end() cycle measured at approx 67us (assuming no preemption.)

See merge request !600
2017-03-24 15:55:42 +08:00
Ivan Grokhotkov 65baf502b7 Merge branch 'bugfix/esp32_core_dump_issues' into 'master'
bugfix: ESP32 Core Dump reported issues

This MR fixes the following issues:
1.  fixed path to esptool when there is no compiled python module for it
2. GDB inernal failure handling was added

See merge request !599
2017-03-24 14:41:07 +08:00
Angus Gratton 0e31eb458e esp32: Move heap_alloc_caps to IRAM
Rest of malloc() path was already in IRAM
2017-03-24 10:41:45 +08:00
Ivan Grokhotkov 573cc7d36f esp32: make soc header compatible with assembler 2017-03-24 10:11:14 +08:00
Ivan Grokhotkov 6ad0a157e3 driver/rtc: add APIs to enable/disable hold function 2017-03-24 10:11:13 +08:00
Angus Gratton b9a06e68dd Merge branch 'bugfix/minor_fixes' into 'master'
Minor fixes and PRs cherry-picked from Github



See merge request !602
2017-03-23 17:57:28 +08:00
Ivan Grokhotkov ecee175962 Merge branch 'bugfix/nvs_init_check_empty_pages' into 'master'
Error handling in NVS initialization

Previously nvs_flash_init worked under an assumption that there should always be at least one free page available. This is true during normal operation, but in some cases (such as when changing application partition table from a non-OTA to an OTA one), NVS partition may get truncated, which will cause empty pages to be lost.

This MR adds error checks for this condition, and updates code which calls `nvs_flash_init` to check for the return code.
For most examples, a simple `ESP_ERROR_CHECK` is added around `nvs_flash_init`. For NVS examples and the OTA example, more robust error handling is added.

This change also removes nvs_flash_init calls from examples which don't use NVS.

See merge request !582
2017-03-23 17:57:15 +08:00
Angus Gratton 0f1109a9a2 Merge branch 'bugfix/idf_monitor' into 'master'
idf_monitor: Small fixes (baud rate, EOL, /dev/tty.X on macOS, Ctrl-T on failure)

* "make monitor" now passed the configured baud rate.
  Closes #436 https://github.com/espressif/esp-idf/issues/436
* Pass toolchain prefix from sdkconfig into monitor tool
* Allow setting EOL in idf_monitor.py, use CRLF by default
* Detect if /dev/tty.X is used on macOS, warn and replace with /dev/cu.X
* If a build fails or gdb exits, ignore Ctrl-T (allowing Ctrl-T Ctrl-A/F to be same key sequence everywhere)
* Add a note about winpty on Windows.
  Ref 02fdf8271d (commitcomment-21369196)
* Fix problems with Console.cancel() not existing in older pyserial
* Print more user-friendly symbols for "start of iram" and "start of flash"

See merge request !594
2017-03-23 17:56:56 +08:00
XiaXiaotian 61de08b0dd tw11087: fix wifi restore exception
1. stop wifi before restore wifi
2017-03-23 17:47:48 +08:00
XiaXiaotian 6181c39f05 Reset WIFI mac when wifi start and update wifi lib
1. reset wifi mac when wifi start

2. roll back rx hung workaround for beacon timeout

3. fix amsdu ap interface wrong issue

4. fix amsdu header parse error

5. fix amsdu flag wrong issue

6. PHY: V350, fix BT rssi bug

7. RTC: V225, fix bt will be not work when wifi is reset
2017-03-23 14:28:27 +08:00
Angus Gratton 8352e7e9ec unit test: Measure test wall time with CCOUNT, so it includes time w/ interrupts off 2017-03-22 15:35:54 +08:00
Angus Gratton d8fda48551 spi_flash: Split large SPI flash operations into parts, allowing preemption
* Erase range operations allow preemption after each block or sector.
* Write operations allow preemption every 8KB of data.
* Reado operations allow preemption every 16KB of data.
2017-03-22 15:35:54 +08:00
rudi ;-) 5362c7ac50 ethernet: Fix typo in log message
Merges #394 https://github.com/espressif/esp-idf/pull/394
2017-03-22 15:22:27 +08:00
Daniel Campora 01ad387ac8 freertos: Add config parameters to customize FreeRTOS behaviour.
The options are:
    - SUPPORT_STATIC_ALLOCATION
    - ENABLE_STATIC_TASK_CLEAN_UP_HOOK
    - TIMER_TASK_PRIORITY
    - TIMER_TASK_STACK_DEPTH
    - TIMER_QUEUE_LENGTH

Merges #444 https://github.com/espressif/esp-idf/pull/444
2017-03-22 15:21:38 +08:00
Matthias Ringwald 3e7b786af5 component/bt: allow to use alternative Bluetooth stack by disabling Bluedroid
Merges #408 https://github.com/espressif/esp-idf/pull/440
2017-03-22 15:13:25 +08:00
alarruskain eba6789e6c Fix late argument verification in emac-main
Prevent crash when emac_phy_power_enable is not set.

Merges #426 https://github.com/espressif/esp-idf/pull/426
2017-03-22 15:12:12 +08:00
Edmund Huber 0aab67f0aa esp32: esp_wifi.h: Replace a non-working #error statement with a working _Static_assert statement
Merges #440 https://github.com/espressif/esp-idf/pull/440
2017-03-22 15:01:40 +08:00
Angus Gratton 8438b8aa92 bt: Fix typo ESP_BT_MODE_ILDE
Closes #450 https://github.com/espressif/esp-idf/issues/450
2017-03-22 14:41:44 +08:00
Angus Gratton 64f26be053 rmt driver: Remove accidental ESP_LOGE in isr handler
Closes #451 https://github.com/espressif/esp-idf/issues/451
2017-03-22 14:33:22 +08:00
Angus Gratton c30bba8c63 rmt driver: Fix parameter & description of rmt_driver_install
Closes #187 https://github.com/espressif/esp-idf/issues/187
2017-03-22 12:30:34 +08:00
Alexey Gerenkov a593d8a518 bugfix: fixed path to esptool when there is no compiled python module for it
bugfix: GDB inernal failure handling was added
2017-03-21 13:30:38 +03:00
Ivan Grokhotkov fbaeb55c15 Merge branch 'bugfix/btdm_blufi' into 'master'
component/bt : fix blufi bug of sec_mode reset

fix BLUFI cannot be reconnected by phone without re-init.

See merge request !598
2017-03-21 17:54:19 +08:00
Tian Hao 13f0737883 component/bt : fix blufi bug of sec_mode reset 2017-03-21 17:17:07 +08:00
Angus Gratton 6afea0e81c linker scripts: Add explicit symbols for _iram_start and _flash_cache_start
This is to avoid confusion when idf_monitor prints the first symbol in each section, ie "WindowOverflow4" or similar,
when bootloader prints the section mapping address.

Closes #447 https://github.com/espressif/esp-idf/issues/447
2017-03-21 16:45:13 +08:00
Angus Gratton e477ce93e9 idf_monitor: Small fixes (baud rate, EOL, /dev/tty.X on macOS, Ctrl-T on failure)
* "make monitor" not passed the configured baud rate
  Closes #436 https://github.com/espressif/esp-idf/issues/436
* Pass toolchain prefix from sdkconfig into monitor tool
* Allow setting EOL in idf_monitor.py, use CRLF by default
* Detect if /dev/tty.X is used on macOS, warn and replace with /dev/cu.X
* If a build fails or gdb exits, ignore Ctrl-T (allowing Ctrl-T Ctrl-A/F to be same key sequence everywhere)
* Add a note about winpty on Windows
  Ref 02fdf8271d (commitcomment-21369196)
2017-03-21 16:00:32 +08:00
Ivan Grokhotkov 9254d2846f Merge branch 'feature/ledc_low_speed_channels' into 'master'
add ledc low speed channels

1. add low speed channels
2. modify example code.

See merge request !490
2017-03-21 15:35:40 +08:00
Ivan Grokhotkov 91d35f01f2 Merge branch 'bugfix/i2c_spikes_on_master_init_#393_from_github' into 'master'
bugfix: I2C spikes on master init

Fix I2C spikes on master init.
Before I2C io init, set high level on SDA/SCK IOs.

Fixes https://github.com/espressif/esp-idf/issues/393

See merge request !593
2017-03-21 15:09:16 +08:00
Ivan Grokhotkov e4e8a903c3 Merge branch 'bugfix/touch_pad_read_takes_too_much_time' into 'master'
modify touch pad read function

The touch pad read function taks too much time within spin lock waiting for the "done bit". (about 7.6ms as we tested)
So we try to use a mutex on the touch read function and any other functions might change the "done bit".

See merge request !543
2017-03-21 14:46:30 +08:00
Wangjialin 1ad68de8b8 bugfix: I2C spikes on master init #393 from github
Fix I2C spikes on master init.
This issue is reported from https://github.com/espressif/esp-idf/issues/393
Before I2C io init, set high level on SDA/SCK IOs.
2017-03-19 17:05:07 +08:00
Wangjialin 94b91ee4af bugfix: i2c driver not working in 'RELEASE' configuration
This issue is reported from https://github.com/espressif/esp-idf/issues/304.
We found that when we operate the hw command registers in I2C struct, sometimes the behaviour would be different in DEBUG/RELEASE optimisation level:

The code looks like this:
I2C[i2c_num]->command[p_i2c->cmd_idx].byte_num -= 0;

In DEBUG configuration:
I2C[i2c_num]->command[p_i2c->cmd_idx].byte_num -= 0;
400f3ab0:    3388          l32i.n    a8, a3, 12
400f3ab2:    14c882            addi    a8, a8, 20
400f3ab5:    a08840            addx4    a8, a8, a4
400f3ab8:    0020c0            memw
400f3abb:    2898          l32i.n    a9, a8, 8
400f3abd:    0020c0            memw
400f3ac0:    28b8          l32i.n    a11, a8, 8
400f3ac2:    74a090            extui    a10, a9, 0, 8
400f3ac5:    00af92            movi    a9, 0xffffff00
400f3ac8:    109b90            and    a9, a11, a9
400f3acb:    2099a0            or    a9, a9, a10
400f3ace:    0020c0            memw
400f3ad1:    2899          s32i.n    a9, a8, 8

In RELEASE configuration:
I2C[i2c_num]->command[p_i2c->cmd_idx].byte_num -= 0;
400f2ba2:    580572            l8ui    a7, a5, 88
400f2ba5:    747070            extui    a7, a7, 0, 8
400f2ba8:    0020c0            memw
400f2bab:    584572            s8i    a7, a5, 88

Looks like the compiler will make it a 8bit operation after optimisation.
But the register value changes from 0x901 to 0x101.
After this 8-bit optimisation, the 11th bit changed from 1 to zero, which caused this error.

We are still trying to find out why that happens, because there might be some risk when operating the register struct.
This is a workaround to avoid "-=" operation on I2C register struct fields.
2017-03-19 16:09:44 +08:00
wangmengyang af843a9517 component/bt: remove the component esp_audio 2017-03-18 16:10:08 +08:00
wangmengyang 2a5d01a930 component/bt: clean up the A2DP sink example 2017-03-18 16:02:54 +08:00
wangmengyang 8ec94418de component/bt: clean up the API header and generate documentation files 2017-03-18 14:55:31 +08:00
wangmengyang e132e95476 component/bt: format the new source files 2017-03-17 22:46:49 +08:00
wangmengyang 007efdb852 Merge branch 'master' into feature/btdm_avrc 2017-03-17 21:04:18 +08:00
wangmengyang 1cf5a56896 component/bt: move API to set device name that can be used by both bt and ble applications 2017-03-17 19:16:52 +08:00
XiaXiaotian a401169ea8 wpa2: add authenticate type for wpa2 enterprise 2017-03-17 17:28:01 +08:00
Wangjialin 7670e93639 Feature: add ledc low speed channels
1. Add low speed channels for LEDC module.
2. Improve fade object allocate mechanism.
3. Improve ledc example, add 2 low speed channels in example.
4. Remove debug code
5. Improve the register bit field name of slow clock.
2017-03-17 17:26:30 +08:00
wangmengyang 66fd3b9768 component/bt: add conditional compilation direvatives to control the source code building of SBC codec 2017-03-17 15:57:30 +08:00
wangmengyang fda2e89a1e component/bt: add conditional compilation direvatives to control the source code building of classic bluetooth 2017-03-17 15:08:47 +08:00
wangmengyang b2f52dd22e component/bt: add Kconfig option "CLASSIC_BT_ENABLED" 2017-03-16 22:32:27 +08:00
wangmengyang aaf0cc00c4 component/bt: minor issue fixes for pre-merge
1. arrange the order of profile ID enums
2. add directory "external" and move SBC codec source into it
2017-03-16 16:48:39 +08:00
Liu Zhi Fu a8f9d99cae lwip: optimize dhcp renew/rebind timer 2017-03-16 09:46:43 +08:00
Ivan Grokhotkov 51323482b2 Merge branch 'feature/update_wifi_lib_for_some_fixs_and_features' into 'master'
esp32: update wifi lib for some bugfix/features

1. add options to disable nvs
2. add station keepalive with softap
3. fix beacon rx start time not accurate issue
4. set wifi rx desc/buffer boundary check to internal memory boundary

See merge request !578
2017-03-16 09:39:16 +08:00
Ivan Grokhotkov 447ffb23d5 nvs: print page state as text in nvs_dump 2017-03-15 17:28:07 +08:00
Ivan Grokhotkov 4813ab2d28 examples: check return value of nvs_flash_init
nvs_flash_init may return an error code in some cases, and applications
should check this error code (or at least assert on it being ESP_OK, to
make potential issues more immediately obvious).

This change modifies all the examples which use NVS to check the error
code. Most examples get a simple ESP_ERROR_CHECK assert, while NVS
examples, OTA example, and NVS unit tests get a more verbose check which
may be used in real applications.
2017-03-15 10:44:54 +08:00
Angus Gratton 02fdf8271d Merge branch 'feature/idf_monitor' into 'master'
Expand  'make monitor' support

New 'make monitor' idf_monitor tool for better monitor output. Running 'make monitor' will now:
* Automatically look up code addresses via addr2line and print function, source file, line number in terminal.
* Can reset the ESP32 by typing Ctrl-T Ctrl-R.
* Can run "make flash" by typing Ctrl-T Ctrl-F.
* Can run "make app-flash" by typing Ctrl-T Ctrl-A.
* If gdb stub starts, monitor will automatically run gdb and connect. When gdb exits, ESP32 resets and monitor resumes.
* Exit is still Ctrl-[

Have some more features I'd like to add (log output to file, crash dump support) but I think this is at the point of being useful.


See merge request !565
2017-03-15 10:41:08 +08:00
Ivan Grokhotkov 829800f272 Merge branch 'bugfix/mbedtls_non_blocking_sockets' into 'master'
mbedtls port: Fix detection of EWOULDBLOCK/EAGAIN with non-blocking sockets

Previous code read non-blocking status via fcntl first, which resets errno.

* Closes #424 https://github.com/espressif/esp-idf/pull/424
* Merges #425 https://github.com/espressif/esp-idf/pull/425

See merge request !575
2017-03-15 10:39:53 +08:00
Ivan Grokhotkov 94b9898ca7 phy_init: move NVS init into relevant function, check errors
This change also modifies logging statements to print hexadecimal error codes, which are easier to look up.
2017-03-14 22:03:39 +08:00
Ivan Grokhotkov 5a23ec4dc4 nvs: check that storage has at least one free page
This change adds a check for the free page count to nvs_flash_init.
Under normal operation, NVS keeps at least one free page available,
except for transient states such as freeing up new page. Due to external
factors (such as NVS partition size reduction) this free page could be
lost, making NVS operation impossible. Previously this would cause an
error when performing any nvs_set operation or opening a new namespace.
With this change, an error is returned from nvs_flash_init to indicate
that NVS partition is in such a state.
2017-03-14 22:03:39 +08:00
Ivan Grokhotkov 817bbb4bf9 nvs: add missing error code descriptions 2017-03-14 22:03:39 +08:00
wangmengyang a96df34d9b component/bt: recover the BLE buffer size macros 2017-03-14 21:00:58 +08:00
me-no-dev c89e11c8fa address security issues with mDNS 2017-03-14 10:08:38 +02:00
wangmengyang 6cb9985e5d component/bt: merge the HCI packet reassemble logic modification 2017-03-14 15:34:56 +08:00
Ivan Grokhotkov a9ed6d5a24 Merge branch 'bugfix/make_test_components' into 'master'
make: don’t override TEST_COMPONENTS

When idf_monitor is launched from make, it gets modified `TEST_COMPONENTS`
variable which contains full paths to the test components instead of the
names. This causes `TEST_COMPONENT_PATHS` to be empty and the unit test
app gets built without any test components.

This change introduces an internal `TEST_COMPONENTS_LIST` variable which
gets set either from `COMPONENTS` if `TESTS_ALL` is 1, or from
`TEST_COMOPONENTS` otherwise.
Bootloader makefile is also fixed to avoid propagating `TESTS_ALL` to the
bootloader build step.

See merge request !569
2017-03-14 15:16:51 +08:00
Ivan Grokhotkov 10f6f234ff Merge branch 'bugfix/fix_uart_stop_bit_2bit_error' into 'master'
bug fix: fix uart data bug when stop-bit is set as 2-bit mode

This is a workaround for a hardware bug.
When we want to use 2-stop-bit mode, we need to set stop-bit-1 and set dl1_en in rs485 register.

See merge request !544
2017-03-14 14:17:55 +08:00
Angus Gratton 2156408d45 Merge branch 'feature/aws_iot_sdk' into 'master'
Amazon AWS IoT SDK

Amazon IoT SDK component, plus two examples derived from their Linux samples.


See merge request !132
2017-03-14 10:21:08 +08:00
Liu Zhi Fu 67aabbff8f esp32: update wifi lib for some bugfix/features
1. add options to disable nvs
2. add station keepalive with softap
3. fix beacon rx start time not accurate issue
4. set wifi rx desc/buffer boundary check to internal memory boundary
2017-03-14 10:14:26 +08:00
wangmengyang 17696bc679 component/bt: resolve the differences with ESP-IDF master branch 2017-03-13 21:28:53 +08:00
Angus Gratton da660b234c AWS IoT Device SDK Support
Use device cert/key embedded in firmware, or loaded from filesystem.
2017-03-13 17:23:29 +08:00
wangmengyang 383db0dc81 Merge branch 'master' into feature/btdm_avrc 2017-03-13 16:21:41 +08:00
Neil Kolban 16e1a2716e mbedtls port: Fix detection of EWOULDBLOCK/EAGAIN with non-blocking sockets
Previous code read non-blocking status via fcntl first, which resets errno.

Closes #424 https://github.com/espressif/esp-idf/pull/424
Merges #425 https://github.com/espressif/esp-idf/pull/425
2017-03-13 15:45:11 +08:00
wangmengyang d101f2113b component/bt: code clean up for btc_media_task
1. remove unused macros variables and functions
2. modify the implementation of API "esp_a2d_register_data_callback" to post messages to BTC task.
2017-03-13 14:54:02 +08:00
Angus Gratton 1544544f8a tools: New idf_monitor 'make monitor' tool for smarter monitor output 2017-03-13 09:31:45 +08:00
Wangjialin 5d5b625d0e bugfix: fix uart 2-stop-bit error
Fix uart data bug when stop-bit is set as 2-bit mode.
This is just a software workaround.
2017-03-12 11:38:14 +08:00
Chu Shu Chen 194d4e9ffd fix(touch_pad): modify touch pad read function and touch_pad_deinit
The touch pad read function taks too much time within spin lock waiting for the "done bit". (about 7.6ms as we tested)
So we try to use a mutex on the touch read function and any other functions might change the "done bit".
2017-03-11 11:42:44 +08:00
Ivan Grokhotkov 47d3759474 Merge branch 'bugfix/adv_type_error' into 'master'
component/bt: modify BLE advertising type error

fix BLE advertising type error

See merge request !568
2017-03-10 14:16:33 +08:00
Jeroen Domburg dc6c19f560 Merge branch 'feature/tighter_rom_memory_defines' into 'master'
Use more regions reserved for ROM routines/stack we don't use for heap.

This frees up about 28K of RAM.

See merge request !467
2017-03-09 20:25:07 +08:00
wangmengyang 878b85c421 component/bt: update with bugfix that media task failed. 2017-03-09 20:16:10 +08:00
Jeroen Domburg 17a4a2527d MR things 2017-03-09 19:59:09 +08:00
Ivan Grokhotkov 61c33ca24e make: don’t override TEST_COMPONENTS
When idf_monitor is launched from make, it gets modified TEST_COMPONENTS
variable which contains full paths to the test components instead of the
names. This causes TEST_COMPONENT_PATHS to be empty and the unit test
app gets built without any test components.

This change introduces an internal TEST_COMPONENTS_LIST variable which
gets set either from $(COMPONENTS) if TESTS_ALL is 1, and from
TEST_COMOPONENTS otherwise.
Bootloader makefile is also fixed to avoid propagating TESTS_ALL to the
bootloader build step.
2017-03-09 19:43:39 +08:00
wangmengyang 5b7b704365 component/bt: format the API headers 2017-03-09 19:03:34 +08:00
island 123b6f88dc component/bt: modify BLE advertising type error 2017-03-09 15:36:22 +08:00
Jiang Jiang Jian cd4e4fb351 Merge branch 'feature/wifi_deinit_2' into 'master'
wifi deinit: update esp_wifi_deinit()

1. move ets_timer_deinit() to wifi_deinit()

2. delete wifi api mutex when wifi deinit

See merge request !563
2017-03-09 15:35:36 +08:00
Ivan Grokhotkov 045aa45731 Merge branch 'bugfix/btdm_gatt_attribute_table_debug' into 'master'
bt component: fix bluetooth gatt packets process bugs

1. Add process of prepare write request packets
2. Add process of execute write request packets
3. Add process of reliable write request packets
4. Fix bug of processing read blob request packets
5. Fix bug of processing write request packets
6. Optimize error check and process in stack

See merge request !558
2017-03-09 13:28:11 +08:00
wangmengyang 18814c03d4 component/bt: clean up profile call/callback handlers
1. remove the empty function btc_gap_bt_cb_handler();
2. separate the a2dp profile call/callback handers
2017-03-08 21:08:11 +08:00
Jeroen Domburg ab5bbfa74b Malloc test: tabs -> spaces, fix description 2017-03-08 19:44:57 +08:00
Jeroen Domburg 3462b53fbc MR suggestions 2017-03-08 19:27:30 +08:00
wangmengyang 07548918df component/bt: clean up AVRC logic and the header file 2017-03-08 19:25:58 +08:00
Jeroen Domburg 37d56b0e8a Add small testcase 2017-03-08 19:04:28 +08:00
Jeroen Domburg e5f54a9dbd Validate more GPIO ROM functions for non-use of static RAM 2017-03-08 19:04:28 +08:00
Jeroen Domburg 0db8b00b8a tight 28k 2017-03-08 19:04:28 +08:00
island a74f3f9fd7 bt component: code style update 2017-03-08 17:09:05 +08:00
island 3543d8170c bt component: update if…else code style 2017-03-08 17:00:56 +08:00
Ivan Grokhotkov cde4072f25 ulp: ignore tests which use deep sleep 2017-03-08 16:19:58 +08:00
Ivan Grokhotkov 66c693eebb Merge branch 'feature/deep_sleep_wakeup_from_touch' into 'master'
add wakeup from touch sensor, and deep sleep example

- add new deep sleep wakeup mode
- change documentation to explain incompatibilities between different wakeup mode, add error checks
- add new ULP instructions necessary for ULP wakeup scenario
- fix issues with I_WR_REG, I_SLEEP, I_END instructions
- add deep sleep example, illustrating the use of timer, gpio, touch, and ULP wakeup triggers

See merge request !461
2017-03-08 14:27:58 +08:00
wangmengyang e6f36f2dc5 component/bt: modify AVRCP APIs to post events and arguments to be handled by BTC task 2017-03-08 13:48:56 +08:00
XiaXiaotian 624ad1bd8b wifi deinit: update esp_wifi_deinit()
1. move ets_timer_deinit() to wifi_deinit()

2. delete wifi api mutex when wifi deinit
2017-03-08 11:00:02 +08:00
Angus Gratton 74817c35f3 mbedtls: Enable filesystem support 2017-03-08 09:55:31 +11:00
Angus Gratton 5f549aab2e fatfs: Support for Long Filenames 2017-03-08 09:54:40 +11:00
wangmengyang af13acdc29 component/bt: modify a2dp APIs to post event to BTC task 2017-03-07 21:15:54 +08:00
island 5ffe5474ac bt component: optimize gatt debug information 2017-03-07 19:55:21 +08:00
wangmengyang cfb18ba537 component/bt: fix some typos and comments 2017-03-07 15:33:05 +08:00
wangmengyang 3acd445f94 component/bt: transport the following modules: btif_config, btif_storage, btif_util 2017-03-07 15:09:52 +08:00
wangmengyang c23b66b1de component/bt: transport bta_av_co.c 2017-03-07 14:21:26 +08:00
Ivan Grokhotkov 32d5985ad2 Merge branch 'bugfix/btdm_host_init_flow' into 'master'
add extra check before bluedroid init and disable

add extra check before bluedroid init and disable to avoid the mixed call cause unexpected errors.

See merge request !553
2017-03-07 14:17:05 +08:00
Jiang Jiang Jian 8b800df720 Merge branch 'feature/btdm_cfg_stack_size' into 'master'
component/bt: optimize stack size of Bluetooth Tasks and make them be configurab…

Bluetooth tasks' stack size are optimized and can be configured by the CONFIG_NEWLIB_NANO_FORMAT option.

See merge request !559
2017-03-07 11:21:07 +08:00
Angus Gratton 0b7058d8ef mbedTLS: Add generic support for mbedTLS debug output via the esp_log functionality 2017-03-07 10:18:47 +11:00
Angus Gratton 4820b64a7f Add jsmn JSON parser component 2017-03-07 10:18:47 +11:00
Angus Gratton 9f7d8c338e Merge branch 'feature/esptool_espefuse_set_flash_voltage' into 'master'
esptool version bump and new "espefuse.py set_flash voltage" command

* New "espefuse.py set_flash_voltage" command to easily set a fix
  VDD_SDIO regulator voltage (1.8V, 3.3V or disabled).
* Fixes bugs when flashing files with non-4-byte aligned lengths
  (doesn't effect esp-idf image files)
* esptool README improvements
* Detect overlapping files in write_flash
* read_mac now works correctly on ESP32
* Integrates reset fix for older dev boards (formerly the "Windows ESP32R0 reset workaround")


See merge request !481
2017-03-07 07:08:18 +08:00
wangmengyang 870389b3ba component/bt: optimize stack size of Bluetooth Tasks and make them be configurable according to the CONFIG_NEWLIB_NANO_FORMAT option 2017-03-06 23:09:42 +08:00
Ivan Grokhotkov 9463a7c594 Merge branch 'feature/lwip_numbers' into 'master'
Change max number of open sockets

Change max number of open sockets from 16 to 32 because of MFI project need support 21 open sockets at least.

See merge request !532
2017-03-06 22:37:12 +08:00
Ivan Grokhotkov 153472d70d Merge branch 'bugfix/soc_io_mux_h' into 'master'
esp32: update io_mux_reg.h to latest version

fixes https://github.com/espressif/esp-idf/issues/349

See merge request !546
2017-03-06 22:36:19 +08:00
island 2955b20f2e bt component: fix bluetooth gatt packets process bugs
1. Add process of prepare write request packets
2. Add process of execute write request packets
3. Add process of reliable write request packets
4. Fix bug of processing read blob request packets
5. Fix bug of processing write request packets
6. Optimize error check and process in stack
2017-03-06 17:20:45 +08:00
Ivan Grokhotkov c06cc31d85 Merge branch 'bugfix/partition_and_mmap_issues' into 'master'
Fix partition- and mmap-related issues

- Fix unit tests failing to start up due to a mismatch between sdkconfig flash size and size required by partition table.
- Fix a bug that partition APIs loaded the partition table in reverse order. As such, `esp_partition_next` and `esp_partition_find_first` did not work as expected. Add a test.
- Update the workaround for stale cache reads issue: do Cache_Flush for non-encrypted flash as well. Add a test.

See merge request !555
2017-03-06 15:59:28 +08:00
Ivan Grokhotkov d790300215 spi_flash: fix stale data being read from mmaped region
The issue that cache entries are not invalidated correctly sometimes
can also be reproduced for non-encrypted flash as well.
This change updates the workaround to do Cache_Flush, enabling it for
non-encrypted flash, and adds a unit test.
2017-03-04 17:48:44 +08:00
Ivan Grokhotkov 4bf96e99b3 partition_table: update unit test
- change order of assert arguments to (expected, actual)
- set expected partition count to 3 to match the new partition table
- use the new get_test_partition facility
- check that partitions are listed in correct order
- remove leftover debugging printfs
2017-03-04 17:45:04 +08:00
Ivan Grokhotkov fa09c8af61 spi_flash: fix partitions order
Pointer to the tail of linked list was never set, so partitions were
added to the head, instead of adding them to the tail.
2017-03-04 15:34:03 +08:00
Tian Hao bc020da4f5 add extra check before bluedroid init and disable 2017-03-03 18:42:27 +08:00
Liu Zhi Fu 99102af79e esp32: update wifi lib to fix mpdu len error
Fix mpdu len error which impact espressif smartconfig
2017-03-03 18:06:05 +08:00
Angus Gratton e7aea584f5 Merge branch 'bugfix/free_iram' into 'master'
uart driver: Remove ISR from IRAM



See merge request !486
2017-03-03 14:08:10 +08:00