Commit graph

2445 commits

Author SHA1 Message Date
XiaXiaotian 100d2dd938 optimize scan before station connecting to AP
1. Store the information of AP(ssid, password, bssid, channel, etc)
    into nvs when station connects to AP successfully. If station
    connects to the same AP next time, it will scan the stored channel of the AP
    first.

    2. Add a parameter of channel for scanning before connecting to AP.
    If it is set to 1~13, station will scan starting from the channel.
    If the channel of AP is unknown, set it to 0.
2017-04-27 14:28:52 +08:00
Jiang Jiang Jian 36ed7f507e Merge branch 'bugfix/gattc_example_strcmp' into 'master'
Fix device_name check in gatt_client example

`strcmp` was used against `adv_name` array, which was not a zero terminated string, causing `strcmp` check to fail for valid names.

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

See merge request !652
2017-04-24 13:11:41 +08:00
Jiang Jiang Jian 99e461c676 Merge branch 'bugfix/tw7105_tcp_stable_test_abort_issue' into 'master'
lwip: fix tcp stable test abort issue

This MR covers following changes:
1. Modify dhcp server timer to 1 seconds
2. Enable ETHARP_TRUST_IP_MAC. Consider following scenario: we are in throughput test or traffic stability test, if this option is disabled, then every 5 minutes, the IP/MAC entry in arch cache is aged out, however, the traffic continuously send to lwip from application, because there is no IP/MAC entry in ARP cache, then the packets have to be buffered in ARP queue and a ARP request is triggered, but the ARP queue can only holds 3 packets, the later packets will be dropped, then if the traffic is big, a lot of packets will be dropped here before we get the right ARP response. For TCP, this will trigger re-transmit, it's intolerable for some application, such as real time audio, if re-transmit happen, then performance of voice will be impact. For UDP, sometimes it may also cause problem, such as DHCP, if here we failed to send the DHCP here, we has to wait the DHCP timeout etc... so this option is enabled here by default.

See merge request !681
2017-04-24 13:10:21 +08:00
Jiang Jiang Jian 767e38f462 Merge branch 'example/perf_tcp_udp_revision' into 'master'
tcp_udp_perf: add license and modify some details

tcp_udp_perf: add license and modify some details

See merge request !666
2017-04-24 13:07:32 +08:00
Jiang Jiang Jian 733e404fcf Merge branch 'feature/optimize_text_rodata_in_iram_dram' into 'master'
optimize WiFi text rodata in iram dram

1. optimize text and rodata in wifi lib

2. update smartconfig

See merge request !668
2017-04-24 13:03:07 +08:00
Jiang Jiang Jian 29002a1c83 Merge branch 'feature/add_limit_for_all_dynamic_ebuf' into 'master'
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. 
The default max allocated dynamic tx buffer is 32
The default max allocated dynamic rx buffer is 64, make default value is bigger because when all packets we received are small packets, e.g. the length is 64Bytes, then 64K can hold 1000 packets, so 64 maybe a good candidate default value, anyway the customer can configure it via menuconfig.
The default dynamic wifi internal long/long-long mgmt is 32, generally 32 is enough for mgmt packet (beacon/auth/assoc/probe/null etc). Generally when all the 32 mgmt buffer is run out of memory, it means internal wifi state machine may has problem, we need to debug it.

See merge request !683
2017-04-24 11:49:50 +08:00
Jiang Jiang Jian 97142bb8db Merge branch 'feature/support_read_mac_addr_from_customer_efuse' into 'master'
Add customer MAC address that read from efuse



See merge request !673
2017-04-24 11:30:55 +08:00
XiaXiaotian 9d8425bd72 put RODATA of libphy.a into DRAM
There are some RODATAs of libphy.a that are called in ISR. So need
    to put them into DRAM to avoid access them when R/W SPI flash. Due
    to the RODATAs which are called in ISR haven't been picked out to
    put into DRAM, put all of the RODATA of libphy.a into DRAM. This
    will be optimized in the future.
2017-04-24 11:22:49 +08:00
Ivan Grokhotkov af6f3bffab Merge branch 'feature/esp32_wdt_rst_info' into 'master'
esp32: Added dumping debug info from traceport upon reset by any WDT

Adds ability to dump debug info (PC and internal processor state) from traceport upon reset by any WDT.

See merge request !654
2017-04-24 10:32:16 +08:00
Alexey Gerenkov 77a92e6dcc esp32: Added dumping info from traceport upon reset by any WDT
- Last PC info and waiti mode indication are printed for both CPUs
 - Raw traceport regs values are printed only for log levels higher than DEBUG
2017-04-23 22:07:56 +03:00
Ivan Grokhotkov 404e89da4d Merge branch 'bugfix/rtc_reg_fields' into 'master'
soc: allow REG_SET_FIELD to be used for bit fields

- Fixes an issue with `rtc_clk_apll_enable`: https://esp32.com/viewtopic.php?f=13&t=1673
- Fixes `rtc_clk_fast_freq_set` function always selecting XTAL/4 as fast clock source.
- Fixes regression in deep sleep current (7uA instead of 5uA).

See merge request !674
2017-04-21 19:40:45 +08:00
Ivan Grokhotkov 8399ed900a Merge branch 'bugfix/xtal_freq_after_wdt_reset' into 'master'
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).

This change checks if RTC_XTAL_FREQ_REG has already been set before trying
to estimate XTAL frequency based on the value of RTC_APB_FREQ_REG, and
uses RTC_XTAL_FREQ_REG value if it is valid.

Fixes TW11738.

See merge request !691
2017-04-21 19:38:46 +08:00
XiaXiaotian b238bc691d Do not put the whole object files into IRAM. Add attributes to the functions called in ISR instead. 2017-04-21 15:38:01 +08:00
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
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 2c17b16328 Merge branch 'bugfix/mbedtls_wrong_errno' into 'master'
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

See merge request !688
2017-04-21 12:24:59 +08: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
Eyob cdc7396f97 Make sure LD -L option is calculated correctly when the project Makefile has specified SRCDIRS components that are not directly below Makefile folder level.
For example,
SRCDIRS = comp_a  happy/comp_b  /c/dev/comp_c

Then the following are built:
build/comp_a/libcomp_a.a
build/comp_b/libcomp_b.a
build/comp_c/libcomp_c.a

But when LD is run the -L is calculated as follows
-L build/comp_a
-L build/happy/comp_b
-L build//c/dev/comp_c

This means comp_b and comp_c are not found by LD. With this change set -L is calculated correctly for comp_b and comp_c

Merges #504 https://github.com/espressif/esp-idf/pull/504
2017-04-21 11:03:07 +10:00
rudi ;-) e5012bd07e OTA example readme: [typo]: Worflow to Workflow
Merges PR #507 https://github.com/espressif/esp-idf/pull/507
2017-04-21 11:03:07 +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
Ivan Grokhotkov 793003d0fa Merge branch 'bugfix/ci_ssc_build_nonverbose' into 'master'
ci: Build SSC with V=0

BATCH_BUILD implies V=1, but SSC produces a *lot* of log output in verbose mode.

See merge request !682
2017-04-20 15:12:38 +08:00
Angus Gratton 7b0e6e2fc4 ci: Build with V=0
BATCH_BUILD implies V=1, but SSC produces a *lot* of log output in verbose mode.

For now, disable setting V=1 for all CI build modes.
2017-04-20 13:58:30 +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
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 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
chenyudong 85f75f1ccd tcp_udp_perf: add license and modify some details 2017-04-18 15:23:28 +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
Ivan Grokhotkov c04e4f179f Merge branch 'feature/log_via_apptrace' into 'master'
Apptrace interface and logging via apptrace

- adds apptrace module which allows arbitrary data to be sent to host over JTAG
- implements printf-like logging to host via apptrace module

This feature depends on changes in idf/openocd-esp32!2

See merge request !548
2017-04-18 10:45:14 +08:00
Asuki Kono a797dca528 Replace to strncmp from strcmp to check device_name on examples/bluetooth/gatt_client
(Amended slightly from version in https://github.com/espressif/esp-idf/pull/502 to
account for differences when adv_name is a prefix of device_name.)
2017-04-18 10:29:36 +10: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
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
Jiang Jiang Jian 4ba62a6b45 Merge branch 'bugfix/rb_ble_set_rand_addr' into 'master'
move the bugfix/ble_set_rand_addr_bug here for fix the conflict with the master

move the bugfix/ble_set_rand_addr_bug to here avoid the conflict with the master

See merge request !669
2017-04-14 15:17:29 +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
Jiang Jiang Jian 3026eda86a Merge branch 'feature/btdm_sec_rebase_api' into 'master'
component/bt:move the btdm_rebase_ssp_api branch to this branch

remove the btdm_rebase_ssp_api branch & move it to this branch avoid the conflict with the maset

See merge request !667
2017-04-14 12:12:24 +08: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