Commit graph

5627 commits

Author SHA1 Message Date
David Cermak 0e06b4d653 mdsn: fix race condition in updating packet data from user task when failed to allocate or queue a new service
Issue: mdns_service_add API allocates and queues an action to be processed in mdns task context; when allocation or queueing fails, allocated structure needs to be freed. Function _mdns_free_service did not only fee all the structures, but also updates packet data.
Resolution: Moved removal of packet data outside of _mdns_free_service function.
2019-03-13 16:24:03 +01:00
David Cermak 8fe4007dfa mdns: fix possible crash when packet scheduled to transmit contained service which might have been already removed
packets scheduled to transmit are pushed to action queue and removed from tx_queue_head structure, which is searched for all remaining services and while service is removed, then service questions/asnwers are also removed from this structure. This update fixes possible crash when packet is pushed to action queue, and when service is removed, its answers are removed from tx_queue_head, but not from action queue. this could lead to a crash when the packet is poped from action queue containing questions/answers to already removed (freed) service

Closes IDF-438
2019-03-13 16:24:03 +01:00
Ivan Grokhotkov 09f4015300 mdns: use binary semaphore instead of mutex when searching
mdns_search_once_t::lock is used to synchronize tasks (taken by one
task and given by the other) so it should not be a mutex.
Convert to semaphore, and rename to indicate its purpose.
2019-03-13 14:55:01 +01:00
zhiweijian 6628fddae6 Component/bt: add BLE adv report flow control 2019-03-12 20:18:30 +08:00
zwj b305a96a74 component/bt: add vendor hci cmd 2019-03-12 11:55:42 +08:00
Jiang Jiang Jian 12643e063c Merge branch 'bugfix/autoip_memoey_leak_debug_v3.2' into 'release/v3.2'
fix the bug in auto Ip memory leak (backport v3.2)

See merge request idf/esp-idf!4431
2019-03-08 19:54:34 +08:00
Angus Gratton a7dc804476 Merge branch 'bugfix/httpd_sess_ctx_backportv3.2' into 'release/v3.2'
esp_http_server: Provide apps an option to let http_server ignore sess_ctx changes

See merge request idf/esp-idf!4421
2019-03-08 11:52:17 +08:00
aleks 7342811c37 freemodbus: change critical sections to semaphore mutex
revert changes made in mbrtu.c, mbascii.c
change critical section type to semaphore mutex instead of spin lock

Closes: https://github.com/espressif/esp-idf/issues/3009
2019-03-07 16:01:43 +01:00
xiehang 8e0b0af09b fix the bug in auto Ip memory leak 2019-03-06 20:01:36 +08:00
Angus Gratton d99d92e170 Merge branch 'bugfix/fix_dig_gpio_unable_hold_bug_v3.2' into 'release/v3.2'
Bugfix/fix digital gpio unable hold bug  (backport v3.2)

See merge request idf/esp-idf!4355
2019-03-06 12:10:38 +08:00
Piyush Shah f8f0c81077 esp_http_server: Provide apps an option to let http_server ignore sess_ctx changes
By default, if a URI handler changes the http session context,
the webserver internally clears the older context after the handler
returns. However, if applications want to change this behavior and
manage the allocation/de-allocation/freeing themselves and let the
server handle only the "socket close" case, this commit provides such
an option.
2019-03-05 13:06:33 +05:30
Angus Gratton 727c2cfa00 Merge branch 'feature/add_api_get_rmt_idle_level_v3.2' into 'release/v3.2'
Bugfix:  Fixed some RMT related issues (backport v3.2)

See merge request idf/esp-idf!4358
2019-03-05 10:51:00 +08:00
Roland Dobai 1d4eeeb464 VFS: Implement poll() based on select()
Closes https://github.com/espressif/esp-idf/issues/2945
2019-03-04 08:02:03 +01:00
Jiang Jiang Jian e9a764d9a5 Merge branch 'bugfix/make_get_coreid_volatile_backport_v3.2' into 'release/v3.2'
freertos: Make xPortGetCoreID() volatile (backport v3.2)

See merge request idf/esp-idf!4379
2019-03-01 18:49:00 +08:00
Jiang Jiang Jian b2e4af4ed0 Merge branch 'bugfix/ble_reconn_rescan_readv_crash_v3.2' into 'release/v3.2'
component/bt : fix bug that there's low ratio crash when BLE do re-connect/re-scan/re-adv

See merge request idf/esp-idf!4325
2019-03-01 18:06:02 +08:00
Darian Leung 66a0b64e54 freertos: Make xPortGetCoreID() volatile
When xPortGetCoreID() is called twice within a function,
it might only be called once after compilation. This
commit makes the inline assembly of the function volatile.

Closes #3093
2019-03-01 02:05:33 +00:00
Ivan Grokhotkov 9d48cdb6f3 Merge branch 'bugfix/multiple_backports_v3.2' into 'release/v3.2'
multiple backports (v3.2)

See merge request idf/esp-idf!4367
2019-02-28 21:42:19 +08:00
Jiang Jiang Jian 258e9c98be Merge branch 'bugfix/cmake_psram_fix_flag_v3.2' into 'release/v3.2'
cmake: Fix psram workaround compiler flag application (backport v3.2)

See merge request idf/esp-idf!4364
2019-02-28 21:06:11 +08:00
Ivan Grokhotkov c0d32f6e48 nvs: add a blob fragmentation test case
Ref. TW12937
2019-02-28 20:38:31 +08:00
Ivan Grokhotkov 203f75223e nvs: do eager cleanup of HashListBlocks
Previously when HashList was removing items, HashListBlocks were
removed lazily. This resulted in empty HashListBlocks dangling around
in full pages, even when all items have been erased. These blocks
would only be deleted when NVS was re-initialized
(nvs_flash_deinit/nvs_flash_init).

This change does eager cleanup instead, based on the code from
@negativekelvin offered in
https://github.com/espressif/esp-idf/issues/1642#issuecomment-367227994.

Closes https://github.com/espressif/esp-idf/issues/1642.
2019-02-28 20:38:31 +08:00
Ivan Grokhotkov 742f8e7f8a esp_timer: fix occasional failures in "monotonic values" test
1. ref_clock used in unit tests occasionally produces time off by ~100
microseconds shortly after being started. Add a delay to let
ref_clock stabilise, until the cause is found.

2. Reduce roundoff error accumulation which would occasionally cause
the test to fail, by choosing an overflow value which can be divided
by APB frequency.

3. Move time sampling part of the test into an IRAM function to
reduce variations due to cache behavior.

4. Remove calculation of "standard deviation" in the test, as what was
calculated was not actually standard deviation, and it did not add any
useful information.
2019-02-28 20:38:31 +08:00
Ivan Grokhotkov 7e16a79cf7 esp_timer: improve unit test robustness
1. call esp_timer_get_time and ref_clock_get in the same order on
   start and in the loop

2. disable interrupts when calculating delta between ref_clock
   and esp_timer

3. ensure both functions are in cache before calculating the delta
2019-02-28 20:38:31 +08:00
Ivan Grokhotkov 22dc4898d9 soc: define named constants for DPORT_CPUPERIOD_SEL values 2019-02-28 20:38:31 +08:00
Ivan Grokhotkov f78c96a3d7 bootloader: check previously used clock frequency at run time
In the situation when bootloader was compiled for 240MHz, and app was
compiled for 160MHz, and the chip is a revision 0 chip, the
bootloader will assume that the application has also been running at
240MHz. This will cause the chip to lock up later. Modify this to use
a run time check of DPORT_CPUPERIOD_SEL, which indicates which of the
PLL frequencies was used.

Closes https://github.com/espressif/esp-idf/issues/2731.
2019-02-28 20:38:31 +08:00
Ivan Grokhotkov b4727a8765 soc/rtc_clk: don’t clear DPORT_CPUPERIOD_SEL when switching to XTAL
This is not necessary since RTC_CNTL_SOC_CLK_SEL is set before this.
2019-02-28 20:38:31 +08:00
XiaXiaotian 34f1c208a8 esp32: modify WiFi Kconfig in order to achieve better compatility
and performance
2019-02-28 10:07:13 +08:00
Angus Gratton 56694fb4b6 cmake: Fix psram workaround compiler flag application
Previously, this compiler flag was not being applied
regardless of CONFIG_SPIRAM_CACHE_WORKAROUND setting.

Explanation: add_compile_options() only applies to
source files added after the function is run, or in
subdirectories added after the function is run. In
this case, no new source files were being added after
this function was run.
2019-02-27 16:38:29 +11:00
Paul Abbott 929542d4fa driver(rmt): Fixed some RMT related issues.
1. Add missing get function to RMT API: rmt_get_idle_level().
2. Suppress error message from rmt_wait_tx_done() if wait_time==0 (allows for polling).
3. Remove the blank lines between parameter lists.

Merges https://github.com/espressif/esp-idf/pull/2666
2019-02-26 20:46:23 +08:00
kooho be49c8d841 driver(gpio): fixed digital gpio unable hold bug during deep-sleep for release/v3.2. 2019-02-26 20:20:25 +08:00
Tian Hao 67aefe1011 component/bt : fix bug that there's low ratio crash when BLE do re-connect/re-scan/re-adv
fix 3 bugs:
1. do BLE connect (both of slave and master), it mgiht cause crash due to there's much interrupts happens effect ble code running, for example, wifi run on the same core as bluetooth controller and wifi run throughtput test.
2. do BLE scan stop or adv stop or connection stop, it might cause ASSERT or crash due to memory corrupted in controller memory poll.
3. minor bug fix, not really effect bluetooth.
2019-02-25 13:40:46 +00:00
zhiweijian 46a3c36343 Component/bt: add scan window and interval check when set scan params 2019-02-25 13:22:32 +00:00
Supreet Deshpande 58e49d169c esp_http_server/lru_counter_for_timestamp:Added LRU counter for timer
Replaced the os timer in http server by LRU counter. The timestamp is
unnecessary for LRU.
2019-02-25 09:16:28 +00:00
Darian Leung aaaa491c42 freertos: Fix unused variable warning
This commit fixes an unused variable warning when
configASSERT is undefined.
2019-02-22 01:06:44 +08:00
David Cermak 113e829552 mdns: fix memory leak in pbuf if tcpipadapter failed to get netif 2019-02-21 06:43:23 +00:00
David Cermak bb2eb9adeb mdns: fix malfuctional query_txt
when running a query for a single txt, result entries were not created and attached to result structure. this issue was introduced when fixing memory leak in txt structure, which worked correctly for PTR queries, but caused trouble for TXT query.
2019-02-21 06:43:23 +00:00
David Cermak 78116afa01 mdns: fix possible crash when mdns_free called while action queue not empty 2019-02-21 06:43:23 +00:00
David Cermak b865e72aec mdns: fix memory leak when query for service receives multiple ptr entries for one instance
fixes redmine issue 27300
2019-02-21 06:43:23 +00:00
Angus Gratton f1b2457b6c Merge branch 'bugfix/psram_move_qsort_setlocale_flash_v3.2' into 'release/v3.2'
psram: Move newlib qsort() and setlocale() functions from IRAM to flash (backport v3.2)

See merge request idf/esp-idf!4322
2019-02-21 14:42:17 +08:00
Jiang Jiang Jian 46fa5654a7 Merge branch 'bugfix/btdm_fix_connection_params_update_issues_v3.2' into 'release/v3.2'
component/bt:fix connection params update issues (backport v3.2)

See merge request idf/esp-idf!4297
2019-02-21 11:49:16 +08:00
Angus Gratton bf28a1a27b psram: Move newlib qsort() and setlocale() functions from IRAM to flash 2019-02-21 10:32:00 +11:00
Angus Gratton b7beefba9e Merge branch 'bugfix/cmake_stack_protector_v3.2' into 'release/v3.2'
esp32: disable stack protector for startup code (CMake) (backport v3.2)

See merge request idf/esp-idf!4250
2019-02-20 15:40:14 +08:00
Angus Gratton a7f826750b Merge branch 'revert-00d10688' into 'release/v3.2'
Revert "Merge branch 'bugfix/external_rtc_start_fail_3.2' into 'release/v3.2'"

See merge request idf/esp-idf!4293
2019-02-20 15:09:59 +08:00
Angus Gratton 38086ae737 Merge branch 'bugfix/spiram_linker_wildcards_v3.2' into 'release/v3.2'
esp32 psram: Provide library name for ROM libc objects linked as PSRAM workarounds (backport v3.2)

See merge request idf/esp-idf!4153
2019-02-20 14:17:52 +08:00
Jiang Jiang Jian 6173660ff0 Merge branch 'bugfix/coex_lc_protect_v3.2' into 'release/v3.2'
component/esp32 : fix coexist lc protect cause memory corrupted

See merge request idf/esp-idf!4267
2019-02-20 11:14:22 +08:00
Angus Gratton 79b450cfb4 esp32 psram: Provide library name for ROM libc objects linked as PSRAM workarounds
Fixes bug reported on forums where any source file ending in *lock.c or *creat.c
was being linked to IRAM.

https://esp32.com/viewtopic.php?f=13&t=8909&p=37362#p37362
2019-02-20 00:30:25 +00:00
Jiang Jiang Jian c7fbc6dd85 Merge branch 'bugfix/wdt_compability_app_with_old_bootloader_v3.2' into 'release/v3.2'
esp32: Fix wdt settings in esp_restart_noos (backport v3.2)

See merge request idf/esp-idf!4294
2019-02-20 02:17:09 +08:00
Jiang Jiang Jian 3b5bba1812 Merge branch 'bugfix/fix_psram_eid_v3.2' into 'release/v3.2'
bugfix(psram): fix psram size acquisition method, support esp32-pico chips (backport v3.2)

See merge request idf/esp-idf!4254
2019-02-20 02:13:47 +08:00
zwj b4feb67b5f component/bt:fix connection params update issues 2019-02-19 20:26:36 +08:00
Jiang Jiang Jian 578d7902af Merge branch 'bugfix/btdm_crash_when_inquiry_cancel_v3.2' into 'release/v3.2'
Bugfix/btdm crash when inquiry cancel v3.2

See merge request idf/esp-idf!4277
2019-02-19 17:57:00 +08:00
Ivan Grokhotkov 509884c5ac Revert "Merge branch 'bugfix/external_rtc_start_fail_3.2' into 'release/v3.2'"
This reverts merge request !4272
2019-02-19 12:47:44 +08:00
Konstantin Kondrashov 8a656f006e esp32: Fix wdt settings in esp_restart_noos
Fixed compatibility the new apps with the old bootloaders.

Closes: https://github.com/espressif/esp-idf/issues/2927
2019-02-19 12:43:35 +08:00
Tian Hao 6d6f71bbae component/esp32 : fix coexist lc protect cause memory corrupted
The bug will cause memory corrupted (the largest range is from 0x3ffc0000 ~ 0x3ffc8000),
some strange error will happen, like IllegalInstruction, LoadProhibited and .etc.
2019-02-19 03:30:02 +00:00
Anurag Kar 6a328992d7 protocomm : typos fixed and descriptions corrected 2019-02-18 08:18:44 +00:00
Anurag Kar b51f109dd7 protocomm unit_tests : test cases updated
Changes:
* Version endpoint test added
* Memory leak test updated to include corner case exceptions in protocomm
2019-02-18 08:18:44 +00:00
Anurag Kar 85e8dea26a protocomm security : memory leaks fixed
List of changes:
* Corner case exceptions are properly handled to ensure release of memory occupied by security infrastructure
* fixed erroneous cleanup of security instance by protocomm_console
2019-02-18 08:18:44 +00:00
Anurag Kar 093c7b176d protocomm : version endpoint behavior simplified
List of changes:
* Version endpoint now sends the set version string instead of verifying the incoming version string. This simplifies fetching version info from the provisioning application.
* esp_prov script updated to expect version string as response.
2019-02-18 08:18:44 +00:00
Anurag Kar 30e39631db wifi_provisioning : context pointer added to wifi_config_t structure and related examples/docs updated
Closes https://github.com/espressif/esp-idf/issues/2874
2019-02-18 08:18:44 +00:00
Anurag Kar a7ff611b10 provisioning framework : 'extern C' directives added for C++ support 2019-02-18 08:18:44 +00:00
Piyush Shah 3e6b402756 protocomm_httpd: Allow applications to pass HTTPD handle
This will be useful if a webserver is already running and the application
does not want protocomm to start a new instance.

Signed-off-by: Piyush Shah <piyush@espressif.com>
2019-02-18 08:18:44 +00:00
baohongde 5568ca2855 components/bt: Add precautions for esp_vhci_host_send_packet (backport 3.2) 2019-02-18 08:15:17 +00:00
baohongde 30f2371917 components/bt: Fix crash when inquiry stop (backport v3.2) 2019-02-18 08:15:17 +00:00
Ivan Grokhotkov 00d1068869 Merge branch 'bugfix/external_rtc_start_fail_3.2' into 'release/v3.2'
Bugfix/external rtc start fail (backport 3.2)

See merge request idf/esp-idf!4272
2019-02-15 17:51:49 +08:00
Jiang Jiang Jian 6f0c70daf6 Merge branch 'bugfix/bugfix/mdns_notask_timer_crash_v3.2' into 'release/v3.2'
mdns: fix crash after init if no memory for task (Backport 3.2)

See merge request idf/esp-idf!4237
2019-02-15 13:49:29 +08:00
Jiang Jiang Jian 219c85cf60 Merge branch 'bugfix/btdm_allow_a2dp_codec_dynamic_allocated_for_v3.2' into 'release/v3.2'
bugfix/btdm_allow_a2dp_codec_dynamic_allocated_for_v3.2(backport v3.2)

See merge request idf/esp-idf!4260
2019-02-15 13:42:39 +08:00
Jiang Jiang Jian 524696d59a Merge branch 'bugfix/fix_some_wifi_bugs_0131_v3.2' into 'release/v3.2'
esp32: fix some WiFi bugs (backport v3.2)

See merge request idf/esp-idf!4217
2019-02-15 12:14:54 +08:00
maojianxin 9a229f4077 soc/rtc: fix RTC_TOUCH_TRIG_EN or RTC_ULP_TRIG_EN should keep RTC_PERIPH power on 2019-02-15 10:58:14 +08:00
Zhang Jun Yi 016c8d8b05 soc/rtc: Bypass touchpad current to external 32k crystal oscillator 2019-02-15 10:55:08 +08:00
Shivani Tipnis 76e4ea7f68 nvs_util: Fix to support write of multiple singlepage big blob data
Closes https://github.com/espressif/esp-idf/issues/3011

(cherry picked from commit ce4944edf01b2a4c997eafe36b66d71f98f2fe29)
2019-02-14 18:05:59 +05:30
Shivani Tipnis 3ec0f415a5 nvs_util: Fix to support write of multiple singlepage big blob data Closes https://github.com/espressif/esp-idf/issues/3011
(cherry picked from commit 21688e3bffee80ddfbef5364a44dd1821e28c776)
2019-02-14 15:57:23 +05:30
Shivani Tipnis f742808333 nvs_util: update test case
(cherry picked from commit 0c72b08872)
2019-02-13 17:12:57 +05:30
Shivani Tipnis 51bd64c754 Update README
(cherry picked from commit 582c547191)
2019-02-13 17:12:50 +05:30
Shivani Tipnis b85321be97 Closes https://github.com/espressif/esp-idf/issues/2472
(cherry picked from commit c44f15441f)
2019-02-13 17:12:40 +05:30
Shivani Tipnis dcd63f73f6 nvs_util: Add changes to nvs part gen util
nvs_util: Add changes to nvs part gen util

nvs_host_test: Add test case for keygen and keyfile paratmeters

(cherry picked from commit 9db1987892)
2019-02-13 17:11:59 +05:30
wangmengyang b8f0c32a0a component/bt: allow dynamic allocation of SBC encoder/decoder buffer used in A2DP to save internal DRAM 2019-02-13 19:15:34 +08:00
chenjianqiang 8f2e1471af bugfix(psram): made some modifcations to support the psram driver backport 2019-02-13 16:06:38 +08:00
chenjianqiang a159e58ead feature(psram): add psram support for esp32-pico chip
1. esp32-pico use standard spi driver to access psram
2. for esp32-pico, flash and psram share the clock
3. for esp32-pico, psram cs io can be overwrite via menuconfig
2019-02-13 14:27:44 +08:00
chenjianqiang fe767855df bugfix(psram): fix psram size acquisition method
1. Use BIT[7:5] of EID to determine psram size
2. Add ID support for 16Mbit psram
3. Remove module reset on SPI1
4. Confirmed with the vendor that only the old 32Mbit psram need special clock timing. For other psram chips, we should use standard QPI mode.
2019-02-13 14:24:20 +08:00
Ivan Grokhotkov 1e674fb4ed esp32: disable stack protector for startup code (CMake)
Files where stack protector is initialized should not be compiled with
stack protector enabled. This was done for Make but missing for CMake.

Fixes https://github.com/espressif/esp-idf/issues/2990.
2019-02-13 10:27:22 +08:00
Jitin George 582bf18789 tcp_transport: Fix incorrect error logging in ssl_read and ssl_write APIs
Closes https://github.com/espressif/esp-idf/issues/2805
2019-02-12 11:32:44 +05:30
Jitin George 2e3f06ece8 esp_http_client: Fix for setting incorrect post header length
Closes https://github.com/espressif/esp-idf/issues/2638
2019-02-12 11:32:23 +05:30
Angus Gratton 1444868917 Merge branch 'bugfix/eth_gpio0_output_v3.2' into 'release/v3.2'
ethernet cleanup && support GPIO0 output mode && support IP101(backport v3.2)

See merge request idf/esp-idf!4214
2019-02-12 07:54:57 +08:00
Angus Gratton 37b7153c0e Merge branch 'feature/http_server_backport_api_changes' into 'release/v3.2'
(backport v3.2) HTTP Server API changes

See merge request idf/esp-idf!4232
2019-02-08 11:43:33 +08:00
David Cermak 1a53334843 mdns: fix crash after init if no memory for task
mdns init first starts timer task, then starts service task. if service task failed to be created, timer task needs to be stopped too.
fixed https://ezredmine.espressif.cn:8765/issues/28466
2019-02-05 07:59:38 +01:00
Angus Gratton fd29b0165f Merge branch 'bugfix/event_loop_library_memory_leak_v3.2' into 'release/v3.2'
Fix event loop library memory leak (backport v3.2)

See merge request idf/esp-idf!4221
2019-02-04 16:35:17 +08:00
Anurag Kar 9c3262f80b esp_http_server : APIs renamed and context get/set implementations fixed
* http_sess_set_*_override APIs are now the only ones available to set custom recv/send/pending functions
* Fixed side effects to using http_sess_set/get_context inside URI handlers
2019-02-03 21:50:35 +05:30
Ondřej Hruška 13a1f4ed78 esp_http_server improvements to allow adding transport layer encryption
Changes:
- renamed `httpd_free_sess_ctx_fn_t` to `httpd_free_ctx_fn_t`
- added a `httpd_handle_t` argument to `httpd_send_func_t` and `httpd_recv_func_t`
- internal function `httpd_sess_get()` is no longer static, as it's used in other
  files besides httpd_sess.c

Bug fixes:
- removed a trailing semicolon from `HTTPD_DEFAULT_CONFIG()`
- fixed issue with failed `select()`, now it automatically closes invalid sockets
  instead of shutting down the entire server

New features:
- `httpd_resp_send()` and `httpd_resp_send_chunk()` now accept -1 as length to use
  `strlen()` internally
- added `httpd_sess_set_ctx()` to accompany `httpd_sess_get_ctx()`
- added a "transport context" to the session structure (next to user context)
- added `httpd_sess_{get,set}_transport_ctx()` to work with this transport context
- added "global user context" and "global transport context" stored in the server
  config (and then the handle); supports a user-provided free_fn
- added a "pending func" to e.g. check for data in the transport layer receive
  buffer
- added functions `httpd_set_sess_{send,recv,pending}_override()` that target
  a session by ID (i.e. not using a request object)
- added `httpd_set_pending_override()`
- added a "open_fn" and "close_fn" - functions called when creating and closing
  a session. These may be used to set up transport layer encryption or some other
  session-wide feature
2019-02-03 21:32:07 +05:30
Jiang Jiang Jian 8a69ffc36f Merge branch 'bugfix/btdm_add_handle_in_gatts_conf_event_for_indication_v3.2' into 'release/v3.2'
Component/bt: add handle in gatts conf event for indication (backport v3.2)

See merge request idf/esp-idf!4222
2019-02-01 21:34:05 +08:00
Jiang Jiang Jian a437e4dc5c Merge branch 'bugfix/btdm_fix_write_char_crash_after_disconnection_v3.2' into 'release/v3.2'
Component/bt: fix write char crash after disconnection (backport v3.2)

See merge request idf/esp-idf!4210
2019-02-01 21:28:29 +08:00
Liu Zhi Fu 741f97da4e esp32: fix some WiFi bugs
Fix following WiFi bugs:
1. Fix a crash bug which is caused by WiFi static TX buffer alloc/free.
2. Fix the bug that iphone fails to connect to ESP32 AP by enabling AP BAR receiving.
3. Fix the bug that ESP32 station fails to connect some APs, such as Xiaomi hotspot etc,
   after reset.
2019-02-01 11:52:40 +08:00
Renz Christian Bagaporo eae2baa0f1 esp_event: detect leaks in unit test 2019-02-01 10:08:50 +08:00
Renz Christian Bagaporo f49f5ff35a esp_event: fix post data type inconsistency 2019-02-01 10:08:50 +08:00
Renz Christian Bagaporo 020b295f06 esp_event: fix memory leaks
Closes https://github.com/espressif/esp-idf/issues/2886
2019-02-01 10:08:50 +08:00
Jiang Jiang Jian 6e14de0fa8 Merge branch 'mesh/malloc_routing_table_v3.2' into 'release/v3.2'
mesh: modify to malloc routing table (backport v3.2)

See merge request idf/esp-idf!4178
2019-02-01 10:02:24 +08:00
zhiweijian 95c7f45e84 Component/bt: add handle in gatts conf event for indication 2019-01-31 20:30:23 +08:00
zhiweijian 651a08f710 Component/bt: fix write char crash after disconnection 2019-01-31 12:20:16 +00:00
morris 18cb87b4ce ethernet: support new PHY (IP101)
1. Add support for new PHY IP101.
2. Re-enable GPIO0 output mode.
3. Clean up some docs.
2019-01-31 15:02:45 +08:00
He Yin Ling 1fedece94d Merge branch 'feature/add_ipv6_related_change_v3.2' into 'release/v3.2'
modify test case to support ipv6 (backport v3.2)

See merge request idf/esp-idf!4074
2019-01-31 14:31:44 +08:00
qiyuexia 137810915c mesh: modify to malloc routing table 2019-01-31 13:46:50 +08:00
Jiang Jiang Jian bb766355b5 Merge branch 'bugfix/tw28445_wps_thread_safe_v3.2' into 'release/v3.2'
esp32: fix WPS thread-safe (backport v3.2)

See merge request idf/esp-idf!4195
2019-01-30 17:50:33 +08:00
Ivan Grokhotkov 807ef53c38 Merge branch 'bugfix/mdns_crash_free_strdup_3.2_fix' into 'release/v3.2'
mdns: fixed crash on free undefined ptr if strdup is skipped (Backport 3.2 FIX)

See merge request idf/esp-idf!4197
2019-01-30 14:24:12 +08:00
Angus Gratton e585121011 Merge branch 'bugfix/backtrace_from_interrupts_backport_v3.2' into 'release/v3.2'
Make backtrace work across interrupts (backport v3.2)

See merge request idf/esp-idf!4183
2019-01-30 13:11:29 +08:00
Liu Zhi Fu 2a47c5c7a4 esp32: fix WPS thread-safe
Fix WPS thread-safe bug
2019-01-29 19:44:24 +08:00
David Cermak 43a722f0de mdns: fixed crash on free undefined ptr after skipped strdup
Shortcircuit evaluation may cause skip of _mdns_strdup_check of any further question field, which after clear_rx_packet freed undefined memory.
Fixes https://ezredmine.espressif.cn:8765/issues/28465
2019-01-29 10:34:04 +01:00
XiaXiaotian eff24857bc esp32: update libphy.a to fix interrupt watchdog when WiFi and BT run at
the same time and both enable modem sleep
2019-01-29 11:05:15 +08:00
David Cermak 64757c0228 mdns: fixed crash on free undefined ptr after skipped strdup
Shortcircuit evaluation may cause skip of _mdns_strdup_check of any further question field, which after clear_rx_packet freed undefined memory.
Fixes https://ezredmine.espressif.cn:8765/issues/28465
2019-01-28 20:17:37 +01:00
Darian Leung bab80ad202 freertos: Make backtrace work across interrupts (backport v3.2)
This commit adds the ability for backtracing to trace from the itnerrupt to the
task stack, and across nested interrupts. Test cases have also been added.

See MR !4084
2019-01-29 02:22:04 +08:00
Jiang Jiang Jian 76f0dda3a4 Merge branch 'mesh/bugfix_backport_v3.2' into 'release/v3.2'
Mesh/bugfix backport v3.2

See merge request idf/esp-idf!4117
2019-01-28 14:05:51 +08:00
huchaoru ce9878ce71 modify test case to support ipv6 2019-01-26 13:03:35 +00:00
Jiang Jiang Jian bab379faf8 Merge branch 'bugfix/i2c_master_clear_bus_v3.2' into 'release/v3.2'
i2c/fix i2c_master_clear_bus (backport v3.2)

See merge request idf/esp-idf!4127
2019-01-25 13:52:48 +08:00
Tian Hao 78511c3cc3 component/bt: add a option to make report adv data and scan response individually
Originally, when doing BLE active scan, Bluedroid will not report adv to
application layer until receive scan response. This option is used to
disable the behavior. When enable this option, Bluedroid will report
adv data or scan response to application layer immediately.
2019-01-24 14:43:36 +08:00
Jiang Jiang Jian cd6bbaa727 Merge branch 'bugfix/bootloader_map_size_v3.2' into 'release/v3.2'
bootloader: fix incorrect mapping size (backport v3.2)

See merge request idf/esp-idf!4138
2019-01-24 14:09:35 +08:00
Jiang Jiang Jian 55b8f2ea8c Merge branch 'bugfix/sha_ownership_v3.2' into 'release/v3.2'
hwcrypto sha: Allow SHA contexts to be shared between tasks (backport v3.2)

See merge request idf/esp-idf!4143
2019-01-24 14:08:35 +08:00
qiyueixa ec2f1a6b9a test: modify the reason code from 204 to 15 in WIFI_CONN_0904 2019-01-24 11:33:06 +08:00
qiyueixa 26646b5b31 mesh: bugfix
1. fix network channel switch function.
2. support not configuring the network channel.
3. support not configuring the router BSSID even if the router is hidden.
4. add allow_channel_switch to mesh configuration.
5. add allow_router_switch to mesh router configuration.
6. support handling beacon without IE of DS Parameter Set.
7. fix Wi-Fi RX fails in a specific scenario (update libphy.a).
8. fix STAs can not detect disconnection from AP when encrypt transmission is used.
9. fix can not find hidden APs.
10. for root, modify the active scan time to 120ms.
11. remove all rc when clear parent Wi-Fi configuration.
12. fix memory leak caused by the remove announcement being sent is not released when esp_mesh_stop() is called.
13. fix modify IE encrypt after mesh is started.
14. ignore esp_mesh_connect() if mesh automatic reconnection is enabled.
15. fix reason is cleared before vote is done.
16. fix issues in the example of manual_networking when mesh network is encrypted.
17. detect and fix root conflicts when router BSSID is not set.
18. when root can not connect to the router due to NO_MORE_STAS(reason code:5), root will stop re-connection and perform MESH_NWK_LOOK_FOR_NETWORK.
19. wifi: fix the disconnection caused by receiving a deauth frame from non-parent node during scanning.
20. fix routing table redundant issue due to the remove announcement is not 100% reliable.
21. modify the max routes limitation from 300 to 1000.
22. wifi: fix ap does not deauth the sta which has not yet completed the 4-way handshake but the max replay count is reached.
2019-01-24 11:31:00 +08:00
Jiang Jiang Jian 1ae9a2ae0b Merge branch 'bugfix/wifi_fix_invalid_csi_data_index_v3.2' into 'release/v3.2'
esp32: fix invalid channel state information(CSI) data index (backort v3.2)

See merge request idf/esp-idf!4129
2019-01-23 22:14:04 +08:00
Jiang Jiang Jian 28eb488892 Merge branch 'bugfix/vfs_unregister_nested_v3.2' into 'release/v3.2'
vfs: fix unregister removing top level VFS instead of nested (backport v3.2)

See merge request idf/esp-idf!4137
2019-01-23 21:54:50 +08:00
Jiang Jiang Jian fcf1dba9cd Merge branch 'bugfix/init_memctl_v3.2' into 'release/v3.2'
bootloader, esp32: add workaround for Tensilica erratum 572 (backport v3.2)

See merge request idf/esp-idf!4134
2019-01-23 21:43:58 +08:00
Angus Gratton 94ed7b8298 hwcrypto sha: Use spinlocks instead of semaphores for small state changes
Significant performance improvement and smaller RAM footprint.
2019-01-23 18:18:13 +08:00
Angus Gratton 24fab0b7a9 hwcrypto sha: Allow SHA contexts to be shared between tasks
Previously, hardware SHA engine "locks" were mutex semaphores. This meant that the task which
started a particular SHA session (in hardware) needed to finalise that session, or an invalid
FreeRTOS state was created.

Replace with binary semaphore which can be shared between tasks.

Includes a unit test, but unit test doesn't crash even without this fix
(some other unknown condition is required).
2019-01-23 18:18:13 +08:00
Angus Gratton c4c1af114e Update esptool.py to v2.6 2019-01-23 17:02:02 +08:00
Ivan Grokhotkov b1ee25afde bootloader: account for load address when mapping cache pages
Bootloader used to calculate the number of cache pages assuming that
load address was aligned, while in reality load address for DROM and
IROM was offset by 0x20 bytes from the start of 64kB page. This
caused the bootloader to map one less page if the size of the image
was 0x4..0x1c less than a multiple of 64kB.

Reported in https://esp32.com/viewtopic.php?f=13&t=6952.
2019-01-23 17:02:02 +08:00
Ivan Grokhotkov cccaa68467 bootloader: fix IROM and DROM swapped in log messages 2019-01-23 17:02:02 +08:00
Ivan Grokhotkov 6080767379 vfs: fix unregister removing top level VFS instead of nested
Credits @neoniousTR.

Fixes https://github.com/espressif/esp-idf/pull/2770
2019-01-23 16:28:48 +08:00
Ivan Grokhotkov 42b6c4953d bootloader, esp32: add workaround for Tensilica erratum 572
If zero-overhead loop buffer is enabled, under certain rare conditions
when executing a zero-overhead loop, the CPU may attempt to execute an invalid instruction. Work around by disabling the buffer.
2019-01-23 16:23:56 +08:00
XiaXiaotian 746e831c19 esp32: fix invalid channel state information(CSI) data index
Due to a hardware limitation in ESP32, the first four bytes of some
    CSI data is invalid, not the last four bytes.

    Correct a mistake of CSI sub-carrier index in documentation.
2019-01-22 20:30:05 +08:00
Wangjialin 553ba51924 bugfix(i2c): reduce speed of I2C master bus reset routine and release SDA
closes https://github.com/espressif/esp-idf/issues/2494
closes https://github.com/espressif/esp-idf/pull/2493
closes https://github.com/espressif/esp-idf/pull/2496

1. Change bus reset to handle interrupted READ sequences.
2. Slow down I2C to 100khz during reset
3. If a SLAVE device was in a read operation when the bus was interrupted, the SLAVE device is controlling SDA.The only bit during the 9 clock cycles of a byte READ the MASTER(ESP32) is guaranteed control over, is during the ACK bit period.
If the SLAVE is sending a stream of ZERO bytes, it will only release SDA during the ACK bit period. The master(ESP32) cannot generate a STOP unless SDA is HIGH. So, this reset code synchronizes the bit stream with, Either, the ACK bit, Or a 1 bit.
2019-01-22 11:43:55 +08:00
chuck todd 929d98538e 1. Slow down I2C to 100khz During Reset
I am stealing this delay coding from @jeremyherbert #2493 pr.

2. Change Bus Reset to handle interrupted READ sequences.

The current code does not handle interrupted READ cycles.

 If a SLAVE device was in a read operation when the bus was interrupted, the SLAVE device is controlling SDA.

The only bit during the 9 clock cycles of a byte READ the MASTER(ESP32) is guaranteed control over, is during the ACK bit period.

If the SLAVE is sending a stream of ZERO bytes, it will only release SDA during the ACK bit period. The master(ESP32) cannot generate a STOP unless SDA is HIGH.

So, this reset code synchronizes the bit stream with, Either, the ACK bit, Or a 1 bit.

3. fix typo

correct `sda_id` to `sda_io` in `i2c_master_clear_bus()` @ryan-ma found it.  This typo was generated when I manually edited this patch on GitHub, I should have done a Copy/Paste operation!
2019-01-22 11:43:40 +08:00
jeremy b810b32675 reduce speed of i2c master bus reset routine and release sda 2019-01-22 11:43:28 +08:00
Tian Hao a953f73c64 Fix some bugs in phy
1. fix bug PHY/RTC functions called in ISR (update phy to v4007)
2. add UnitTest to test it
3. fix task watchdog bug when wifi change channel
4. disable/enable agc to mac deinit/init
2019-01-16 22:04:49 +08:00
jack a80bfc1dcf esp32: fix the incorrect tx complete state issue 2019-01-12 19:40:52 +08:00
Liu Zhi Fu ca54a5ce2a esp32: fix wrongly deleting hardware BA index bug
Fix the bug that hardware BA index will be wrongly removed in
WiFi mode WIFI_MODE_APSTA.
2019-01-11 21:46:28 +08:00
XiaXiaotian f0a6432717 esp32: do defragmentation only for data and management frame
Check frame type before defragmentation. Only data and management frame
    can do defragmentation.
2019-01-10 14:17:21 +08:00
Jiang Jiang Jian c18e86a826 Merge branch 'bugfix/coex_unforce_wifi_if_no_data_buffered_in_beacon_v3.2' into 'release/v3.2'
esp32: unforce wifi if receiving beacon with no data buffered in dream (backport v3.2)

See merge request idf/esp-idf!4036
2019-01-10 14:11:02 +08:00
Jiang Jiang Jian b5d53a0eff Merge branch 'bugfix/timer_delete_dispatch_race_v3.2' into 'release/v3.2'
esp_timer: do not allow deleting timers while callbacks are dispatched (backport v3.2)

See merge request idf/esp-idf!4062
2019-01-10 13:44:15 +08:00
XiaXiaotian 10afc3de77 esp32: unforce wifi if receiving beacon with no data buffered in dream
state and reduce force receiving broadcast data time

    1. If receiving beacon which indicates that there is no data buffered,
    do not force to receive WiFi data.
    2. If receiving beacon which indicates that there is broadcast data
    buffered, reduce the time to force receiving broadcast data.
2019-01-09 14:13:08 +08:00
Jiang Jiang Jian ec7909956d Merge branch 'bugfix/fix_mbox_thread_safe_issue_v3.2' into 'release/v3.2'
tcpip: fix mbox thread-safe issue  (backport v3.2)

See merge request idf/esp-idf!4005
2019-01-09 10:21:22 +08:00
Ivan Grokhotkov d9c3a08813 Merge branch 'bugfix/mdns_udp_send_protected_backport3.2' into 'release/v3.2'
mdns networking udp send protected (Backport 3.2)

See merge request idf/esp-idf!4020
2019-01-08 12:04:23 +08:00
Ivan Grokhotkov eb9a93f9b7 Merge branch 'bugfix/mdns_crash_when_query_backport3.2' into 'release/v3.2'
mdns crash when query (backport 3.2)

See merge request idf/esp-idf!3950
2019-01-08 12:03:52 +08:00
Jiang Jiang Jian 710019a47f Merge branch 'bugfix/fix_the_country_code_bug_v3.2' into 'release/v3.2'
wifi: fix the bug that STA can scan the channel out of the country regdomain range (backport v3.2)

See merge request idf/esp-idf!4068
2019-01-07 20:33:02 +08:00
zhangyanjiao b80eba8d5a wifi: fix the bug that STA can scan the channel out of the country regdomain range 2019-01-04 14:34:36 +08:00
Liu Zhi Fu efa70bc8e3 lwip: fix mbox thread-safe issue
Fix a mbox free thread-safe issue that can lead to crash in sys_arch_mbox_fetch.
2019-01-02 22:48:19 +08:00
Ivan Grokhotkov 31b7db5c38 esp_timer: do not allow deleting timers while callbacks are dispatched
timer_process_alarm function of esp_timer holds a spinlock for the
entire duration of its operation, except for the time when timer
callback function is called. It is possible that when
timer_process_alarm releases the spinlock, a higher priority task may
run and delete the timer. Then the execution will return to
timer_process_alarm, and this will either cause a crash, or undesired
execution of callback after the timer has been stopped or deleted.

To solve this problem, add a mutex which will prevent deletion of timers
while callbacks are being dispatched.
2019-01-02 20:06:06 +11:00
Mahavir Jain 62eb0f4c12 i2s: add (optional) support to clear tx descriptor in underflow case
It has been observed that, in case of underflow (data unavailability) in
I2S transmission, previously filled up tx descriptors continue to get
transmitted on line, causing noise in case of audio use case.

This change adds optional `tx_desc_auto_clear` field during I2S driver intialization
than can zero initialize tx descriptor in case of underflow situation in
interrupt handler itself.

Closes: https://github.com/espressif/esp-idf/issues/1789
(cherry picked from commit 765bf674d0)
2018-12-31 13:42:26 +05:30
Jiang Jiang Jian 155f034b1e Merge branch 'feature/freemodbus_move_rs485_mode_control_v3.2' into 'release/v3.2'
examples: freemodbus port serial slave move uart mode settings into example (backport v3.2)

See merge request idf/esp-idf!4015
2018-12-29 10:28:27 +08:00
Jiang Jiang Jian 47dea73b03 Merge branch 'doc/btdm_modem_sleep_EVED_mode_for_v3.2' into 'release/v3.2'
doc/btdm_modem_sleep_EVED_mode_for_v3.2(backport v3.2)

See merge request idf/esp-idf!4016
2018-12-29 10:27:52 +08:00
Jiang Jiang Jian 28fdf96828 Merge branch 'bugfix/ota_magic_byte_issue_v3.2' into 'release/v3.2'
Bugfix/ota magic byte issue v3.2(backport v3.2)

See merge request idf/esp-idf!4004
2018-12-29 10:24:24 +08:00
Jiang Jiang Jian 3969fe0dad Merge branch 'bugfix/lwip_add_hostname_option_in_dhcp_discover_v3.2' into 'release/v3.2'
add hostname option in dhcp discover (backport v3.2)

See merge request idf/esp-idf!3938
2018-12-29 10:07:50 +08:00
Jiang Jiang Jian c70c25afd0 Merge branch 'mesh/bugfix_v3.2' into 'release/v3.2'
mesh: when no parent is found, send probe request

See merge request idf/esp-idf!3940
2018-12-28 14:02:23 +08:00
Jiang Jiang Jian d59d9eef4f Merge branch 'bugfix/bbpll_wakeup_reset_v3.2' into 'release/v3.2'
BBPLL reset fixes (backport v3.2)

See merge request idf/esp-idf!4011
2018-12-24 18:16:47 +08:00
David Cermak 22514e12d8 mdns: fix networking running udp_sendif from lwip thread 2018-12-21 16:44:15 +01:00