Ivan Grokhotkov [Thu, 19 Jan 2017 02:58:09 +0000 (10:58 +0800)]
kconfig: define ESP32_PHY_MAX_TX_POWER if PHY_ENABLED
ESP32_PHY_MAX_TX_POWER option is only meaningful for WiFi, so previous
change made it depend on WIFI_ENABLED. However if WiFi is not enabled,
but BT is, this option becomes undefined which breaks phy_init_data
generation.
This change turns ESP32_PHY_MAX_TX_POWER into a hidden parameter, which
depends on PHY_ENABLED. New user-visible parameter,
ESP32_PHY_MAX_WIFI_TX_POWER is introduced which depends on WIFI_ENABLED
and is used as default value for ESP32_PHY_MAX_TX_POWER if WIFI_ENABLED
is set. Otherwise ESP32_PHY_MAX_WIFI_TX_POWER is set to 20.
Ivan Grokhotkov [Thu, 19 Jan 2017 02:19:06 +0000 (10:19 +0800)]
Merge branch 'feature/category_readme' into 'master'
Readme and links to example category folders
- Added README.md to example category folders, for BT ref. https://github.com/espressif/esp-idf/issues/262
- Added links from api category TOC to example category folders
Ivan Grokhotkov [Thu, 19 Jan 2017 02:17:36 +0000 (10:17 +0800)]
Merge branch 'bugfix/frc1_timer_clear' into 'master'
newlib: fix register used for DPORT/RTC bug workaround
While there was no register at DR_REG_FRC_TIMER_BASE + 0x60, due to
peripheral address space wraparound this write actually affected one of
FRC2 registers, which is used by WiFi stack to implement legacy
ets_timer APIs.
This change uses FRC_TIMER_LOAD_REG(0) instead, which can be set to
known value safely.
Ivan Grokhotkov [Thu, 19 Jan 2017 02:14:34 +0000 (10:14 +0800)]
Merge branch 'bugfix/flash_op_unpinned_task' into 'master'
fixes for issues observed when using spi_flash
This MR fixes three unrelated issues:
- Race condition in spi_flash_enable_interrupts_caches_and_other_cpu
when operations on unpinned tasks are performed.
The issue is reported in https://github.com/espressif/esp-idf/pull/258
- esp_intr_noniram_disable doesn’t disable interrupts when compiled in
release mode. This issue manifested itself with an illegal instruction
exception when task WDT ISR was called at the time when flash was
disabled.
Fixes https://github.com/espressif/esp-idf/issues/263.
- Tick hooks on CPU1 were not called if CPU0 scheduler was disabled for
significant amount of time (which could happen when doing flash erase).
The issue manifested itself as “INT WDT timeout on core 1” error.
Fixes https://github.com/espressif/esp-idf/issues/219.
Ivan Grokhotkov [Wed, 18 Jan 2017 14:49:41 +0000 (22:49 +0800)]
newlib: fix register used for DPORT/RTC bug workaround
While there was no register at DR_REG_FRC_TIMER_BASE + 0x60, due to
peripheral address space wraparound this write actually affected one of
FRC2 registers, which is used by WiFi stack to implement legacy
ets_timer APIs.
This change uses FRC_TIMER_LOAD_REG(0) instead, which can be set to
known value safely.
Ivan Grokhotkov [Wed, 18 Jan 2017 16:33:31 +0000 (00:33 +0800)]
Merge branch 'bugfix/docs_cleanup' into 'master'
Organize examples and API documentation - supplement to !430
This supplement to !430, both intended to replace bulky !421.
1. Fixed broken links
2. Added links to available examples in API documentation, where missing
3. Updated links to point directly to example folder (to show README.md with example description)
4. Added README.md in docs folder info to point reader to ReadTheDocs instead of doc sources, ref. https://github.com/espressif/esp-idf/issues/243
5. Fixed some typo errors / Sphinx warnings
6. Fixed memory leak in example, ref. https://github.com/espressif/esp-idf/issues/209
Ivan Grokhotkov [Wed, 18 Jan 2017 15:14:29 +0000 (23:14 +0800)]
freertos: call tick hooks on CPU1 even if CPU0 scheduler is suspended
The block which dispatches ticks on CPU1 was a copy of the code block
for the normal path (CPU0). It used to check uxPendedTicks, with the
logic that uxPendedTicks can be 0 iff the scheduler is not suspended.
On CPU1 however, uxPendedTicks is not related to the state of the
scheduler (as uxPendedTicks is updated on CPU0). Due to this, if CPU0
scheduler was suspended, and uxPendedTicks happened to be nonzero,
tick hooks on CPU1 didn’t run, even though CPU1 scheduler was working.
This change removes the check for uxPendedTicks in CPU1 code path,
so that the tick hooks on CPU1 always get called (as for the CPU0 code
path).
Ivan Grokhotkov [Wed, 18 Jan 2017 10:31:06 +0000 (18:31 +0800)]
intr_alloc: mark inline asm operand as earlyclobber
When compiling in release mode, compiler was choosing same register for
oldint and intmask variables, so INTENABLE was never modified.
This effectively broke disabling of non-IRAM interrupts during flash
operations, observed in the existing tests if task watchdog is enabled.
This change adds an extra constraint tells the compiler that output
operand should not be placed into the same register as an input one.
Ivan Grokhotkov [Wed, 18 Jan 2017 09:23:04 +0000 (17:23 +0800)]
Merge branch 'feature/parse_unit_test_cases_from_test_files' into 'master'
Parse unit test cases from test files
As of now, we need to sync three different places when adding new unit test cases. The plan is to add a python script in tools/unit-test-app. This script would parse unit test cases from the C files with tests and generate the needed YAML files in components/idf_test/unit_test. CI would run this script in build stage to create the files and unit-test stage would use the generated files to run tests.
To get the needed test metadata, we need to add some more tags in the test case functions. For example:
```
TEST_CASE("SYS_LIB_0102 test time functions", "[stdlib][fails][env=UT_T1_APC]")
{
//...
}
```
Reason for this kind of implementation is that we need the YAML files for generating documents.
Ivan Grokhotkov [Wed, 18 Jan 2017 07:07:27 +0000 (15:07 +0800)]
spi_flash: fix race condition when doing operations in unpinned tasks
spi_flash_enable_interrupts_caches_and_other_cpu function used to enable
non-IRAM interrupts after giving up flash operation lock, which would
cause problems if another task was waiting on the lock to start a flash
operation. In fact, non-IRAM interrupts should be re-enabled before the
task scheduler is resumed. Otherwise non-pinned task can be moved to the
other CPU due to preemption, causing esp_intr_noniram_enable to be
called on the other CPU, causing an abort to be triggered.
Fixes the issue reported in
https://github.com/espressif/esp-idf/pull/258
Ivan Grokhotkov [Tue, 17 Jan 2017 07:14:00 +0000 (15:14 +0800)]
Merge branch 'feature/categorize_examples_doc_new' into 'master'
Organize examples and API documentation
Organize / categorize growing number of code examples and API documentation, ref. https://gitlab.espressif.cn:6688/idf/esp-idf/issues/10
This merge request is intended to replace most of https://gitlab.espressif.cn:6688/idf/esp-idf/merge_requests/421. The rest of changes submitted in https://gitlab.espressif.cn:6688/idf/esp-idf/merge_requests/421 will follow.
1. Moved examples to category folders, removed numbers from example names
2. Modified `buid_examples.sh` script to handle new locations of examples
3. Moved api-name.rst files to category folders
4. Updated documentation TOC (`docs/index.rst`)
5. Updated links to examples in API documentation
Ivan Grokhotkov [Tue, 17 Jan 2017 06:04:11 +0000 (14:04 +0800)]
Merge branch 'bugfix/time_syscalls' into 'master'
Fix issues with time syscalls
- fix compilation error when no time source is selected (https://github.com/espressif/esp-idf/issues/238)
- work around a bug that time speeds up when RTC registers are read on the APP CPU (https://github.com/espressif/arduino-esp32/issues/120)
Ivan Grokhotkov [Mon, 16 Jan 2017 11:52:23 +0000 (19:52 +0800)]
time: workaround for FRC_TIMER_INT_REG write issue
In some cases (when RTC register reads are performed from the APP CPU), a write to FRC_TIMER_INT_REG may be lost on the bus.
Writing to another DPORT register immediately before or after that works around the issue.
We write one dummy value to an address which doesn’t have any register associated with it.
Ivan Grokhotkov [Mon, 16 Jan 2017 16:49:38 +0000 (00:49 +0800)]
newlib: change definition of assert for release builds
One common pattern of using assert function looks as follows:
int ret = do_foo();
assert(ret == 0); // which reads as: “do_foo should never fail here, by design”
The problem with such code is that if ‘assert’ is removed by the preprocessor in release build,
variable ret is no longer used, and the compiler issues a warning about this.
Changing assert definition in the way done here make the variable used, from language syntax perspective.
Semantically, the variable is still unused at run time (as sizeof can be evaluated at compile time), so the compiler
can optimize things away if possible.
Ivan Grokhotkov [Mon, 16 Jan 2017 16:42:55 +0000 (00:42 +0800)]
spi_flash: define spi_flash_guard_{start,stop} with IRAM_ATTR
These functions are marked as inline and are called from functions which are in IRAM.
In release (-Os) builds, the compiler may decide not to inline these functions.
Placing these functions into IRAM explicitly works around this.
Ivan Grokhotkov [Mon, 16 Jan 2017 02:26:58 +0000 (10:26 +0800)]
Merge branch 'bugfix/fixes_from_github' into 'master'
fixes for github issues
This MR includes commits from several Github PRs, as well some fixes for issues reported on Github and on the forum.
- compile PHY-related code only when WiFi is enabled
- fix macOS setup instructions
- fix some of the Sphinx warnings
- update docs index, improve structure of the readme-
- wifi: fix typos, rename ESP_ERR_WIFI_NOT_START to ESP_ERR_WIFI_NOT_STARTED
- sdmmc: fix explanation of flash voltage regulator configuration efuses
- sdmmc: change idx num of example
- fix i2c_get_period name
- fix esp_log_level_set function name in docs
Angus Gratton [Mon, 16 Jan 2017 00:52:15 +0000 (11:52 +1100)]
Build: Handle WiFi & BT enabled/disabled combos gracefully as possible
If using WIFI_INIT_CONFIG_DEFAULT, error message will point out lack
of WiFi. Otherwise linker errors on WiFi symbols should help give a
clue as to what is broken.
Piggy-backs on changes in !420, ref github #230 #237
Ivan Grokhotkov [Sun, 15 Jan 2017 18:18:42 +0000 (02:18 +0800)]
docs: fix macOS setup instructions
Most of the packages mentioned are only needed for building the toolchain using crosstool-NG, not for the normal ESP-IDF environment.
Mention that pyserial needs to be installed (fixes https://github.com/espressif/esp-idf/issues/229).
Ivan Grokhotkov [Sun, 15 Jan 2017 17:19:14 +0000 (01:19 +0800)]
sdmmc: fix explanation of flash voltage regulator configuration efuses
- low level on GPIO12 corresponds to 3.3V output, not 1.8V
- add espefuse.py commands to burn efuses
- add XPD_SDIO_REG to the list of efuses which must be set
Reported on the forum: http://esp32.com/viewtopic.php?f=2&t=849&start=10#p4170