Ivan Grokhotkov [Fri, 31 Mar 2017 08:02:26 +0000 (16:02 +0800)]
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.
Jeroen Domburg [Fri, 31 Mar 2017 02:44:37 +0000 (10:44 +0800)]
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.
Ivan Grokhotkov [Wed, 29 Mar 2017 09:37:34 +0000 (17:37 +0800)]
Merge branch 'bugfix/git_porcelain_arg' into 'master'
make: remove version parameter from git status porcelain option
Version parameter was added in git 2.11, while default git on macOS is
currently 2.10. According to the latest git docs, if the version
parameter is not provided, it defaults to ‘v1’, so removing it doesn’t
change the format.
Angus Gratton [Wed, 29 Mar 2017 00:50:49 +0000 (08:50 +0800)]
Merge branch 'bugfix/example_naming' into 'master'
examples: Standardise naming of files, symbols, etc. in examples
* Use "example" in all example function & variable names,
ie use i2c_example_xxx instead of i2c_xxx for example functions.
Closes #198 https://github.com/espressif/esp-idf/issues/198
* Mark example functions, etc. static
* Replace uses of "test" & "demo" with "example"
* Split the UART example into two
* Rename "main" example files to end with "_main.c" for disambiguation
Ivan Grokhotkov [Tue, 28 Mar 2017 06:22:27 +0000 (14:22 +0800)]
make: remove version parameter from git status porcelain option
Version parameter was added in git 2.11, while default git on macOS is
currently 2.10. According to the latest git docs, if the version
parameter is not provided, it defaults to ‘v1’, so removing it doesn’t
change the format.
Angus Gratton [Tue, 28 Mar 2017 02:49:08 +0000 (10:49 +0800)]
Merge branch 'bugfix/windows_setup' into 'master'
Windows setup improvements
* Tweak Makefile to significantly reduce startup time on Windows (also reduced on other platforms, but less obvious.)
* Revise windows setup installation script to fix various issues, use latest toolchain.
* Tweak Windows config docs
Ivan Grokhotkov [Mon, 27 Mar 2017 17:02:58 +0000 (01:02 +0800)]
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.
Angus Gratton [Wed, 22 Mar 2017 04:36:11 +0000 (12:36 +0800)]
examples: Standardise naming of files, symbols, etc. in examples
* Use "example" in all example function & variable names,
ie use i2c_example_xxx instead of i2c_xxx for example functions.
Closes #198 https://github.com/espressif/esp-idf/issues/198
* Mark example functions, etc. static
* Replace uses of "test" & "demo" with "example"
* Split the UART example into two
* Rename "main" example files to end with "_main.c" for disambiguation
Ivan Grokhotkov [Mon, 27 Mar 2017 05:54:51 +0000 (13:54 +0800)]
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
Ivan Grokhotkov [Fri, 24 Mar 2017 07:55:42 +0000 (15:55 +0800)]
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.)
Ivan Grokhotkov [Fri, 24 Mar 2017 07:55:15 +0000 (15:55 +0800)]
Merge branch 'feature/ci_tags_release_branches' into 'master'
CI support for testing & deploying release tags & branches
For CI testing & deployment of release branches:
* Test release tags as well as branches
* Swap gitlab submodule URLs to github when testing release tags or branches.
These changes are already pushed to the release/v2.0 branch.
Ivan Grokhotkov [Thu, 23 Mar 2017 12:58:23 +0000 (20:58 +0800)]
Merge branch 'feature/ci-use-local-registry' into 'master'
ci: allow passing Hub account or registry name from the environment
This change allows to set registry name or Hub account name using CI Variables. Needs all runners to be updated to gitlab-ci-runner v1.8+ in order for the auth feature to work.
Ivan Grokhotkov [Thu, 23 Mar 2017 09:57:15 +0000 (17:57 +0800)]
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.
Angus Gratton [Thu, 23 Mar 2017 09:56:56 +0000 (17:56 +0800)]
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 https://github.com/espressif/esp-idf/commit/02fdf8271de3a6db2ab9d4d6f023c160c84ebdbe#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"
Angus Gratton [Wed, 22 Mar 2017 03:48:33 +0000 (11:48 +0800)]
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.
Angus Gratton [Tue, 21 Mar 2017 08:29:57 +0000 (16:29 +0800)]
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.
Angus Gratton [Fri, 17 Mar 2017 10:41:18 +0000 (18:41 +0800)]
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 https://github.com/espressif/esp-idf/commit/02fdf8271de3a6db2ab9d4d6f023c160c84ebdbe#commitcomment-21369196
Angus Gratton [Tue, 14 Mar 2017 10:55:12 +0000 (18:55 +0800)]
build system: Call 'git status' w/ machine-readable output once to check submodules
This is substantially faster than the 'git submodule status' command, has same effect. Particularly noticeable on
Windows, where 'submodule status' takes 2 seconds and 'status' takes 0.2 seconds.
Ivan Grokhotkov [Tue, 21 Mar 2017 06:46:30 +0000 (14:46 +0800)]
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".
Wangjialin [Sun, 19 Mar 2017 09:05:07 +0000 (17:05 +0800)]
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.
Wangjialin [Sun, 19 Mar 2017 08:09:44 +0000 (16:09 +0800)]
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;
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.
Wangjialin [Wed, 8 Feb 2017 11:52:18 +0000 (19:52 +0800)]
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.
Ivan Grokhotkov [Thu, 16 Mar 2017 01:39:16 +0000 (09:39 +0800)]
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
Ivan Grokhotkov [Tue, 14 Mar 2017 13:39:44 +0000 (21:39 +0800)]
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.
Angus Gratton [Wed, 15 Mar 2017 02:41:08 +0000 (10:41 +0800)]
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.
Ivan Grokhotkov [Tue, 14 Mar 2017 13:24:56 +0000 (21:24 +0800)]
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.
Ivan Grokhotkov [Tue, 14 Mar 2017 13:42:06 +0000 (21:42 +0800)]
Merge branch 'bugfix/mdns_security_issues' into 'master'
Bugfix/mdns security issues
Fixes a series of security issues with MDNS.
STACK-SMASH: https://github.com/espressif/esp-idf/blob/dd3f18d2d88ee78909d4af2840dfdf0b9f715f28/components/mdns/mdns.c#L494:
The sprintf is not limited. We can execute the sprintf codeflow as
many times as we want, allowing arbitrary long data being written
into stack.
PACKET-OF-DEATH:
https://github.com/espressif/esp-idf/blob/dd3f18d2d88ee78909d4af2840dfdf0b9f715f28/components/mdns/mdns.c#L502.
The compare allows equal, and thus jumping back to it self infinite
recursion -> guaranteed crash
TXT-SMASH: https://github.com/espressif/esp-idf/blob/dd3f18d2d88ee78909d4af2840dfdf0b9f715f28/components/mdns/mdns.c#L1381
The loop does not check on reaching a->txt maximum size (1024),
resulting in stack overflow.
Ivan Grokhotkov [Tue, 14 Mar 2017 07:16:51 +0000 (15:16 +0800)]
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.
Liu Zhi Fu [Tue, 14 Mar 2017 02:14:26 +0000 (10:14 +0800)]
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