Merge branch 'feature/deep_sleep_wake_stub' into 'master'
esp32: Bootloader wake deep sleep stub
App can contain a stub program resident in RTC fast memory. Bootloader
will load the stub on initial boot. If the device wakes from deep sleep,
the stub is run immediately (before any other data is loaded, etc.)
To implement a custom wake stub, implement a function in your program:
```
void RTC_IRAM_ATTR esp_wake_deep_sleep(void)
{
esp_default_wake_deep_sleep();
// other wake logic
}
```
... and it will replace the default implementation.
jack [Thu, 29 Sep 2016 08:29:13 +0000 (16:29 +0800)]
Add Comments
We reserve 4KB Slow RTC memory to save RF calibation result and BT NVS data.
If not all these Slow RTC momory Blocks are used, we will open the other parts.
Merge branch 'workaround/pin_noaffinity_task_to_core_when_fpu_used' into 'master'
Workaround: Automatically pin no-cpu-affinity task to a core when FPU is used
FPU status at the moment does not migrate cleanly between cores, so tasks without affinity that happen to migrate across FPUs will run into problems. As a workaround, this modification will automatically pin the task to the current CPU when FPU activity is detected. If anything, it's better than getting all kinds of weird and wonderful FPU corruption issues...
Merge branch 'feature/freertos_untested_feature_assert' into 'master'
Assert on untested FreeRTOS features
When I SMP-enabled, I went through all the functions and made the necessary modifiucations. I however only managed to test the most used functions thoroughly. While we should test all FreeRTOS functions eventually, this MR will mark the ones we have not tested yet with a macro call that will, if enabled in MenuConfig (default enabled) assert() when the untested function is called.
Also removes some superfluous mux initializion code in EventGroups code.
1. configure LEDC timer saparately
2. add peripher_crtl.c/.h
To enable the peripheral modules, we have to set/clear the control register in dport_reg.h.
These bits are disabled by default and they are all in a same register, so we need to add a lock on that.
3. add include esp_err.h in gpio.h
App can contain a stub program resident in RTC fast memory. Bootloader
will load the stub on initial boot. If the device wakes from deep sleep,
the stub is run immediately (before any other data is loaded, etc.)
To implement a custom wake stub, implement a function in your program:
```
void RTC_IRAM_ATTR esp_wake_deep_sleep(void)
{
esp_default_wake_deep_sleep();
// other wake logic
}
```
... and it will replace the default implementation.
Ivan Grokhotkov [Tue, 27 Sep 2016 14:08:27 +0000 (22:08 +0800)]
Merge branch 'master' into feature/btdm_controller
* master:
app_main: Return type to void
wifi: move type definitions into separate header file
wifi: use default esp_event_send handler in WIFI_INIT_CONFIG_DEFAULT
nvs: Remove flash layout arguments from nvs_init()
Add contributor agreement, update CONTRIBUTING file
Update http_request & https_request examples for new startup flow
Add very simple "hello world" & "blink" examples
Build examples out-of-tree as part of CI process
Examples: Use event groups for waiting until WiFi is associated & ESP has IP
BT example: Enable BT stack in config by default
BT: Relink component on new BT library, auto-initialise submodule if missing
Documentation: Add contributor guide, expand README & add an examples README
Update gitignore for examples
examples: Add https_request example
mbedtls: Add some initial menuconfig options
examples: HTTP request example
component/esp32: udpate wifi lib
component/esp32: modify bool argument name from enable to en
component/esp32: adjust some APIs
esptool: Bump upstream revision
1. move the app demo code to example
2. move the header files to correct path
3. move profile to profiles directory and seperate esp&std
4. some other codes
5. needs continue to cleanup the code
Ivan Grokhotkov [Tue, 27 Sep 2016 04:40:56 +0000 (12:40 +0800)]
Merge branch 'master' into feature/btdm_controller
* master: (32 commits)
components/nghttp: rename Makefile to component.mk
components/nghttp: add HTTP2.0 protocol feature
compoenents/esp32: don't alias start_cpu1 to start_cpu0_default
components/freertos: fix a bug with an uninitialised return value
Change application entry point name back to app_main
gitlab-ci: build SSC with matching branch name, if available
components/spi_flash: remove stray level of indentation
components/nvs: fix broken sentences in comment blocks
components/esp32: fix renaming of esp_event_set_cb, minor clean up
components/esp32: remove "_user" part from entry points, weaken start_cpu0/1
Fix a spelling mistake in panic message, add carriage return to stack canary message
components/lwip,esp32: fixes for C++
components/bt: fix compilation, remove ./ from makefile
components/esp32: clarify type of queue in wifi_init_config_t, add default init macro
components/esp32: add ESP_ERROR_CHECK
Event handling refactoring
clean up warnings
components/esp32,bt: fix typos in comments
Startup flow refactoring
Roll back submodule version
...
Ivan Grokhotkov [Tue, 27 Sep 2016 03:47:47 +0000 (11:47 +0800)]
wifi: move type definitions into separate header file
While this may reduce esp_wifi.h file readability for people who don't have a "go to definition" function in their editors, this is needed to decouple esp_wifi and esp_event headers, and possibly other headers which may use wifi types in the future.
nghttp only support HTTP2.0 parse function, it has nothing to do with other modules. when Communicate with the server, suggest that you use it on the TLS layer.
Ivan Grokhotkov [Mon, 26 Sep 2016 09:06:12 +0000 (17:06 +0800)]
Merge branch 'feature/init_refactoring' into 'master'
Startup flow refactoring
This set of commits changes the startup code in a way that lets the application choose if/when to initialize WiFi/BT.
Application entry point is now a more familiar `main()` function. This function is executed in its own task. Application may choose to do some initialization from main function, create some tasks and then return from `main`. Simple applications may choose to do all their work from `main`.
Additionally this MR splits event handling code into two parts.
- One part is a set of standard handlers for WiFi and DHCP events. Most applications will use this set of handlers, and it is made available via new `esp_event_process_default` function.
- Another part is the default implementation of event handling loop. Some applications may choose to use default event loop through `esp_event_loop_` set of APIs, which start an event handling task and call user-provided event callback from this task. Other applications may create an event queue and implement event loop themselves. In this case application has to provide `esp_event_send` function. In this case the implementation provided by `esp_event_loop_` module is unused.
esp-idf-template has been updated to match this set of changes: https://github.com/espressif/esp-idf-template/tree/feature/init_refactoring
BT example has also been updated.
We need to provide examples of both event handling approaches. This will be done in a separate follow-up MR.
Ivan Grokhotkov [Mon, 26 Sep 2016 06:35:09 +0000 (14:35 +0800)]
Merge branch 'master' into feature/init_refactoring
* master:
components/spi_flash: remove stray level of indentation
components/nvs: fix broken sentences in comment blocks
Roll back submodule version
Spinlocks already come initialized. Remove the code that would essentially re-initialize them at runtime
Remove all references to prvLockQueue / prvUnlockQueue
components/esp32: clean up unused function warnings in single core mode
clean up warnings
components/nvs: fix build, use log library instead of printf
components/spi_flash: add flash operation counters option to Kconfig
components/nvs: add erase function
components/nvs: fix formatting
components/nvs: batch writes when possible
components/spi_flash: add performance counters
components/nvs: maintain item hash list at page level
components/nvs: avoid reading just-erased page
Ivan Grokhotkov [Mon, 26 Sep 2016 04:51:01 +0000 (12:51 +0800)]
Merge branch 'feature/nvs_speed_improvement' into 'master'
nvs: speed improvement and erase APIs
NVS initialization speed issue raised in https://ezredmine.espressif.com/issues/6881 has been addressed for single core mode through optimization of `spi_flash_*` routines. This MR addresses same issue for dual core mode.
- An index table is added at Page level, it allows doing fast search of item index based on key name and namespace. This heavily reduces the number of flash reads.
- Write operations are batched when writing/erasing long variable-length values (str and blob). This gives a 33% reduction in the number of writes for a 64-byte value, 50% reduction for a 96-byte value.
- Add optional (configurable via menuconfig) perfomance counters for spi_flash APIs
With these changes, total init time for NVS goes down from 2 seconds to 140 ms.
Additional RAM usage is 128-640 bytes per page, depending on content. Typical RAM usage for current use case (storing wifi configuration parameters) is 256 bytes.
This change also exposes APIs to erase single key or the whole namespaces, needed for https://ezredmine.espressif.com/issues/6769.
Merge branch 'bugfix/clean_up_warnings' into 'master'
Clean up warnings and remove unused parts of FreeRTOS
For third party components (lwip and expat), compilation flags are adjusted to silence existing warnings (i have manually checked that all warnings are benign).
In components/esp32, replaced use of WIFI_DEBUG with ESP_LOG functions.
Additionally prvLockQueue/prvUnlockQueue have been removed, dragging some other bits of FreeRTOS along.
Original issue: https://github.com/espressif/esp-idf/issues/18
Ivan Grokhotkov [Sun, 25 Sep 2016 19:05:25 +0000 (03:05 +0800)]
components/lwip,esp32: fixes for C++
- put contents of a few headers into c++ guard blocks
- fix off-by-one error in do_global_ctors
- remove system_init from startup code (should be called from main)