Commit graph

2428 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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 b99d5df922 unit tests: Shrink unit test partition table so tests can run on 2MB of flash 2017-04-13 17:55:49 +10: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
Ivan Grokhotkov 8bc153e142 Merge branch 'bugfix/http_request_example' into 'master'
Fix issues with HTTP[S] request examples

This MR includes:

- request string fix for the http_request example (https://github.com/espressif/esp-idf/pull/500)
- same fix applied to the https_request example
- stack size increase for http_request example

Fixes https://www.esp32.com/viewtopic.php?f=13&t=1620

See merge request !646
2017-04-13 15:27:37 +08:00